@@ -21,18 +21,18 @@ |
||
| 21 | 21 | * @throws ColorException |
| 22 | 22 | * @see RGBAColor::ERROR_INVALID_HEX_LENGTH |
| 23 | 23 | */ |
| 24 | - public function parse(string $hex, string $name='') : RGBAColor |
|
| 24 | + public function parse(string $hex, string $name = '') : RGBAColor |
|
| 25 | 25 | { |
| 26 | 26 | $hex = ltrim($hex, '#'); // Remove the hash if present |
| 27 | 27 | $hex = strtoupper($hex); |
| 28 | 28 | $length = strlen($hex); |
| 29 | 29 | |
| 30 | - if($length === 3) |
|
| 30 | + if ($length === 3) |
|
| 31 | 31 | { |
| 32 | 32 | return $this->parseHEX3($hex, $name); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if($length === 6) |
|
| 35 | + if ($length === 6) |
|
| 36 | 36 | { |
| 37 | 37 | return $this->parseHEX6($hex, $name); |
| 38 | 38 | } |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | declare(strict_types=1); |
| 11 | 11 | |
| 12 | -$autoload = __DIR__ . '/../vendor/autoload.php'; |
|
| 12 | +$autoload = __DIR__.'/../vendor/autoload.php'; |
|
| 13 | 13 | |
| 14 | -if(!file_exists($autoload)) |
|
| 14 | +if (!file_exists($autoload)) |
|
| 15 | 15 | { |
| 16 | 16 | die('<b>ERROR:</b> Autoloader not present. Please run composer install first.'); |
| 17 | 17 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | <br> |
| 43 | 43 | <?php |
| 44 | 44 | |
| 45 | - foreach($urls as $url) |
|
| 45 | + foreach ($urls as $url) |
|
| 46 | 46 | { |
| 47 | 47 | $info = parseURL($url); |
| 48 | 48 | |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function invert() : EightBitChannel |
| 43 | 43 | { |
| 44 | - return ColorChannel::eightBit(255-$this->value); |
|
| 44 | + return ColorChannel::eightBit(255 - $this->value); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $this->validateValue($value); |
| 38 | 38 | |
| 39 | - if(strlen($value) === 1) |
|
| 39 | + if (strlen($value) === 1) |
|
| 40 | 40 | { |
| 41 | 41 | $value = str_repeat($value, 2); |
| 42 | 42 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $match = preg_match('/\A[0-9A-F]{1,2}\z/iU', $hex); |
| 55 | 55 | |
| 56 | - if($match !== false && $match > 0) |
|
| 56 | + if ($match !== false && $match > 0) |
|
| 57 | 57 | { |
| 58 | 58 | return; |
| 59 | 59 | } |
@@ -56,6 +56,6 @@ |
||
| 56 | 56 | |
| 57 | 57 | public function invert() : SevenBitChannel |
| 58 | 58 | { |
| 59 | - return ColorChannel::sevenBit(127-$this->value); |
|
| 59 | + return ColorChannel::sevenBit(127 - $this->value); |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function invert() : PercentChannel |
| 43 | 43 | { |
| 44 | - return ColorChannel::percent(100-$this->value); |
|
| 44 | + return ColorChannel::percent(100 - $this->value); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function invert() : DecimalChannel |
| 43 | 43 | { |
| 44 | - return ColorChannel::decimal(1-$this->value); |
|
| 44 | + return ColorChannel::decimal(1 - $this->value); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | self::SERIALIZED_PREVIOUS => null, |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - if($info->hasPrevious()) |
|
| 42 | + if ($info->hasPrevious()) |
|
| 43 | 43 | { |
| 44 | 44 | $result[self::SERIALIZED_PREVIOUS] = $info->getPrevious()->serialize(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $calls = $info->getCalls(); |
| 48 | - foreach($calls as $call) |
|
| 48 | + foreach ($calls as $call) |
|
| 49 | 49 | { |
| 50 | 50 | $result[self::SERIALIZED_CALLS][] = $call->serialize(); |
| 51 | 51 | } |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | $data = self::validateSerializedData($serialized); |
| 64 | 64 | $data[self::SERIALIZED_PREVIOUS] = self::unserializePrevious($data[self::SERIALIZED_PREVIOUS]); |
| 65 | 65 | |
| 66 | - if(!isset($data[self::SERIALIZED_CLASS])) |
|
| 66 | + if (!isset($data[self::SERIALIZED_CLASS])) |
|
| 67 | 67 | { |
| 68 | 68 | $data[self::SERIALIZED_CLASS] = ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if(!isset($data[self::SERIALIZED_DETAILS])) |
|
| 71 | + if (!isset($data[self::SERIALIZED_DETAILS])) |
|
| 72 | 72 | { |
| 73 | 73 | $data[self::SERIALIZED_DETAILS] = ''; |
| 74 | 74 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | self::SERIALIZED_CALLS => 'array' |
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - foreach($keys as $key => $type) |
|
| 97 | + foreach ($keys as $key => $type) |
|
| 98 | 98 | { |
| 99 | - if(!isset($serialized[$key]) || gettype($serialized[$key]) !== $type) |
|
| 99 | + if (!isset($serialized[$key]) || gettype($serialized[$key]) !== $type) |
|
| 100 | 100 | { |
| 101 | 101 | throw self::createTypeException($key, $type); |
| 102 | 102 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private static function unserializePrevious(?array $previous) : ?ConvertHelper_ThrowableInfo |
| 127 | 127 | { |
| 128 | - if(!empty($previous)) |
|
| 128 | + if (!empty($previous)) |
|
| 129 | 129 | { |
| 130 | 130 | return ConvertHelper_ThrowableInfo::fromSerialized($previous); |
| 131 | 131 | } |