@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | return 'font-style'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function italic(bool $important=false) : StyleBuilder |
|
| 21 | + public function italic(bool $important = false) : StyleBuilder |
|
| 22 | 22 | { |
| 23 | 23 | return $this->setStyle(self::STYLE_ITALIC, $important); |
| 24 | 24 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | * @return StyleBuilder |
| 32 | 32 | * @link https://developer.mozilla.org/fr/docs/Web/CSS/font-style |
| 33 | 33 | */ |
| 34 | - public function oblique(int $degrees=self::OBLIQUE_DEFAULT_DEGREES, bool $important=false) : StyleBuilder |
|
| 34 | + public function oblique(int $degrees = self::OBLIQUE_DEFAULT_DEGREES, bool $important = false) : StyleBuilder |
|
| 35 | 35 | { |
| 36 | 36 | $value = self::STYLE_OBLIQUE; |
| 37 | 37 | |
| 38 | - if($degrees !== self::OBLIQUE_DEFAULT_DEGREES) |
|
| 38 | + if ($degrees !== self::OBLIQUE_DEFAULT_DEGREES) |
|
| 39 | 39 | { |
| 40 | 40 | $value .= sprintf( |
| 41 | 41 | ' %sdeg', |
@@ -14,37 +14,37 @@ |
||
| 14 | 14 | return 'font-size'; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function relativeLarger(bool $important=false) : StyleBuilder |
|
| 17 | + public function relativeLarger(bool $important = false) : StyleBuilder |
|
| 18 | 18 | { |
| 19 | 19 | return $this->setStyle('larger', $important); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function relativeSmaller(bool $important=false) : StyleBuilder |
|
| 22 | + public function relativeSmaller(bool $important = false) : StyleBuilder |
|
| 23 | 23 | { |
| 24 | 24 | return $this->setStyle('smaller', $important); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function custom(string $value, bool $important=false) : StyleBuilder |
|
| 27 | + public function custom(string $value, bool $important = false) : StyleBuilder |
|
| 28 | 28 | { |
| 29 | 29 | return $this->setStyle($value, $important); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function percent(float $percent, bool $important=false) : StyleBuilder |
|
| 32 | + public function percent(float $percent, bool $important = false) : StyleBuilder |
|
| 33 | 33 | { |
| 34 | 34 | return $this->setStylePercent($percent, $important); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function px(int $pixels, bool $important=false) : StyleBuilder |
|
| 37 | + public function px(int $pixels, bool $important = false) : StyleBuilder |
|
| 38 | 38 | { |
| 39 | 39 | return $this->setStylePX($pixels, $important); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function em(float $em, bool $important=false) : StyleBuilder |
|
| 42 | + public function em(float $em, bool $important = false) : StyleBuilder |
|
| 43 | 43 | { |
| 44 | 44 | return $this->setStyleEM($em, $important); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function rem(float $rem, bool $important=false) : StyleBuilder |
|
| 47 | + public function rem(float $rem, bool $important = false) : StyleBuilder |
|
| 48 | 48 | { |
| 49 | 49 | return $this->setStyleREM($rem, $important); |
| 50 | 50 | } |
@@ -33,11 +33,11 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function weight() : FontWeight |
| 35 | 35 | { |
| 36 | - return new FontWeight($this->styles,$this->collection); |
|
| 36 | + return new FontWeight($this->styles, $this->collection); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function size() : FontSize |
| 40 | 40 | { |
| 41 | - return new FontSize($this->styles,$this->collection); |
|
| 41 | + return new FontSize($this->styles, $this->collection); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -8,17 +8,17 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class NumericContainer extends StyleContainer |
| 10 | 10 | { |
| 11 | - public function px(int $px, bool $important=false) : StyleBuilder |
|
| 11 | + public function px(int $px, bool $important = false) : StyleBuilder |
|
| 12 | 12 | { |
| 13 | 13 | return $this->setStylePX($px, $important); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function percent(float $percent, bool $important=false) : StyleBuilder |
|
| 16 | + public function percent(float $percent, bool $important = false) : StyleBuilder |
|
| 17 | 17 | { |
| 18 | 18 | return $this->setStylePercent($percent, $important); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function em(float $percent, bool $important=false) : StyleBuilder |
|
| 21 | + public function em(float $percent, bool $important = false) : StyleBuilder |
|
| 22 | 22 | { |
| 23 | 23 | return $this->setStyleEM($percent, $important); |
| 24 | 24 | } |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | private $collection; |
| 23 | 23 | |
| 24 | - private function __construct(?StyleCollection $collection=null) |
|
| 24 | + private function __construct(?StyleCollection $collection = null) |
|
| 25 | 25 | { |
| 26 | - if($collection === null) |
|
| 26 | + if ($collection === null) |
|
| 27 | 27 | { |
| 28 | 28 | $collection = StyleCollection::create(); |
| 29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->collection = $collection; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public static function create(?StyleCollection $collection=null) : StyleBuilder |
|
| 34 | + public static function create(?StyleCollection $collection = null) : StyleBuilder |
|
| 35 | 35 | { |
| 36 | 36 | return new StyleBuilder($collection); |
| 37 | 37 | } |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | |
| 99 | 99 | public static function percent2Float(float $percent) : float |
| 100 | 100 | { |
| 101 | - return round($percent/100, self::$floatPrecision); |
|
| 101 | + return round($percent / 100, self::$floatPrecision); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public static function float2percent(float $value) : float |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $parts = array(RGBAColor::CHANNEL_RED, RGBAColor::CHANNEL_GREEN, RGBAColor::CHANNEL_BLUE); |
| 43 | 43 | |
| 44 | - foreach($parts as $part) |
|
| 44 | + foreach ($parts as $part) |
|
| 45 | 45 | { |
| 46 | - if($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit()) |
|
| 46 | + if ($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit()) |
|
| 47 | 47 | { |
| 48 | 48 | return false; |
| 49 | 49 | } |
@@ -92,8 +92,7 @@ |
||
| 92 | 92 | if(isset($this->customPresets[$name])) |
| 93 | 93 | { |
| 94 | 94 | $preset = $this->customPresets[$name]; |
| 95 | - } |
|
| 96 | - else if(isset(self::$globalPresets[$name])) |
|
| 95 | + } else if(isset(self::$globalPresets[$name])) |
|
| 97 | 96 | { |
| 98 | 97 | $preset = self::$globalPresets[$name]; |
| 99 | 98 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | private function init() : void |
| 64 | 64 | { |
| 65 | - if(self::$initialized === true) |
|
| 65 | + if (self::$initialized === true) |
|
| 66 | 66 | { |
| 67 | 67 | return; |
| 68 | 68 | } |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $preset = null; |
| 91 | 91 | |
| 92 | - if(isset($this->customPresets[$name])) |
|
| 92 | + if (isset($this->customPresets[$name])) |
|
| 93 | 93 | { |
| 94 | 94 | $preset = $this->customPresets[$name]; |
| 95 | 95 | } |
| 96 | - else if(isset(self::$globalPresets[$name])) |
|
| 96 | + else if (isset(self::$globalPresets[$name])) |
|
| 97 | 97 | { |
| 98 | 98 | $preset = self::$globalPresets[$name]; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if($preset !== null) |
|
| 101 | + if ($preset !== null) |
|
| 102 | 102 | { |
| 103 | 103 | return ColorFactory::create( |
| 104 | 104 | ColorChannel::eightBit($preset[RGBAColor::CHANNEL_RED]), |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $this->requireNotGlobal($name); |
| 134 | 134 | |
| 135 | - if(!isset(self::$globalPresets[$name])) |
|
| 135 | + if (!isset(self::$globalPresets[$name])) |
|
| 136 | 136 | { |
| 137 | 137 | self::$globalPresets[$name] = array( |
| 138 | 138 | RGBAColor::CHANNEL_RED => $red, |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha=255) : PresetsManager |
|
| 157 | + public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha = 255) : PresetsManager |
|
| 158 | 158 | { |
| 159 | 159 | $this->requireNotGlobal($name); |
| 160 | 160 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | private function requireNotGlobal(string $name) : void |
| 172 | 172 | { |
| 173 | - if(!isset(self::$globalPresets[$name])) |
|
| 173 | + if (!isset(self::$globalPresets[$name])) |
|
| 174 | 174 | { |
| 175 | 175 | return; |
| 176 | 176 | } |
@@ -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 | } |