Skip to content

Commit 40f7f4a

Browse files
committed
Move source code to "src/" directory for conciseness
1 parent 2fe101b commit 40f7f4a

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"minimum-stability": "stable",
2424
"autoload": {
2525
"psr-4": {
26-
"Orbitale\\Component\\ImageMagick\\": ""
26+
"Orbitale\\Component\\ImageMagick\\": "src/"
2727
}
2828
}
2929
}

Command.php renamed to src/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public function run(): CommandResponse
274274
$output = '';
275275
$error = '';
276276

277-
$code = $process->run(function ($type, $buffer) use (&$output, &$error): void {
277+
$code = $process->run(static function ($type, $buffer) use (&$output, &$error): void {
278278
if (Process::ERR === $type) {
279279
$error .= $buffer;
280280
} else {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(
104104
$this->value = $geometry;
105105
}
106106

107-
public function __toString()
107+
public function __toString(): string
108108
{
109109
return (string) $this->value;
110110
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function __construct(string $gravity)
3838
$this->value = $gravity;
3939
}
4040

41-
public function __toString()
41+
public function __toString(): string
4242
{
43-
return (string) $this->value;
43+
return $this->value;
4444
}
4545

4646
public function validate(): string

References.php renamed to src/References.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ final class References
2828

2929
public function __construct()
3030
{
31-
$referenceFile = __DIR__.'/Resources/references.php';
31+
$referenceFile = \dirname(__DIR__).'/Resources/references.php';
3232

33-
if (!\file_exists($referenceFile)) {
33+
if (!\is_file($referenceFile)) {
3434
throw new \RuntimeException(\sprintf(
3535
'File %s for ImageMagick references does not exist.'."\n".
3636
'Check that the file exists and that it is readable.',
@@ -46,6 +46,7 @@ public function __construct()
4646
foreach ($keysToCheck as $key) {
4747
if (!\array_key_exists($key, $config)) {
4848
$keysExist = false;
49+
break;
4950
}
5051
}
5152

@@ -172,7 +173,7 @@ public function rotation(string $rotation): string
172173
{
173174
$rotation = \trim($rotation);
174175

175-
if (\preg_match('~^-?\d+(?:<|>)$~u', $rotation)) {
176+
if (\preg_match('~^-?\d+[<>]$~u', $rotation)) {
176177
return $rotation;
177178
}
178179

@@ -230,12 +231,12 @@ public function threshold(string $threshold): string
230231
{
231232
$threshold = \trim($threshold);
232233

233-
if (is_numeric($threshold)) {
234+
if (\is_numeric($threshold)) {
234235
return $threshold;
235236
}
236237

237-
if (substr($threshold, -1) == '%') {
238-
$percentNumber = substr($threshold, 0, -1);
238+
if (\substr($threshold, -1) === '%') {
239+
$percentNumber = \substr($threshold, 0, -1);
239240
if (is_numeric($percentNumber)) {
240241
return $threshold;
241242
}

0 commit comments

Comments
 (0)