@@ -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 | } |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class ColorContainer extends StyleContainer |
| 13 | 13 | { |
| 14 | - public function rgbaValues(int $red, int $green, int $blue, float $opacity=1) : StyleBuilder |
|
| 14 | + public function rgbaValues(int $red, int $green, int $blue, float $opacity = 1) : StyleBuilder |
|
| 15 | 15 | { |
| 16 | 16 | return $this->rgba(ColorFactory::createCSS($red, $green, $blue, $opacity)); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function rgba(RGBAColor $color, bool $important=false) : StyleBuilder |
|
| 19 | + public function rgba(RGBAColor $color, bool $important = false) : StyleBuilder |
|
| 20 | 20 | { |
| 21 | 21 | return $this->setStyle($color->toCSS(), $important); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function hex(RGBAColor $color, bool $important=false) : StyleBuilder |
|
| 24 | + public function hex(RGBAColor $color, bool $important = false) : StyleBuilder |
|
| 25 | 25 | { |
| 26 | 26 | return $this->setStyle('#'.$color->toHEX(), $important); |
| 27 | 27 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return StyleBuilder |
| 35 | 35 | * @throws ColorException |
| 36 | 36 | */ |
| 37 | - public function hexString(string $hex, bool $important=false) : StyleBuilder |
|
| 37 | + public function hexString(string $hex, bool $important = false) : StyleBuilder |
|
| 38 | 38 | { |
| 39 | 39 | return $this->hex(ColorFactory::createFromHEX($hex), $important); |
| 40 | 40 | } |
@@ -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 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | public static function color2HEX(RGBAColor $color) : string |
| 41 | 41 | { |
| 42 | 42 | $hex = |
| 43 | - UnitsConverter::int2hex($color->getRed()->get8Bit()) . |
|
| 44 | - UnitsConverter::int2hex($color->getGreen()->get8Bit()) . |
|
| 43 | + UnitsConverter::int2hex($color->getRed()->get8Bit()). |
|
| 44 | + UnitsConverter::int2hex($color->getGreen()->get8Bit()). |
|
| 45 | 45 | UnitsConverter::int2hex($color->getBlue()->get8Bit()); |
| 46 | 46 | |
| 47 | - if($color->hasTransparency()) |
|
| 47 | + if ($color->hasTransparency()) |
|
| 48 | 48 | { |
| 49 | 49 | $hex .= UnitsConverter::int2hex($color->getOpacity()->get8Bit()); |
| 50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public static function color2CSS(RGBAColor $color) : string |
| 62 | 62 | { |
| 63 | - if($color->hasTransparency()) |
|
| 63 | + if ($color->hasTransparency()) |
|
| 64 | 64 | { |
| 65 | 65 | return sprintf( |
| 66 | 66 | 'rgba(%s, %s, %s, %s)', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public static function requireValidColorArray(array $color) : void |
| 97 | 97 | { |
| 98 | - if(self::isColorArray($color)) |
|
| 98 | + if (self::isColorArray($color)) |
|
| 99 | 99 | { |
| 100 | 100 | return; |
| 101 | 101 | } |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | RGBAColor::CHANNEL_BLUE |
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | - foreach($keys as $key) |
|
| 130 | + foreach ($keys as $key) |
|
| 131 | 131 | { |
| 132 | - if(!isset($color[$key])) |
|
| 132 | + if (!isset($color[$key])) |
|
| 133 | 133 | { |
| 134 | 134 | return false; |
| 135 | 135 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public static function color2readable(RGBAColor $color) : string |
| 150 | 150 | { |
| 151 | - if($color->hasTransparency()) |
|
| 151 | + if ($color->hasTransparency()) |
|
| 152 | 152 | { |
| 153 | 153 | return sprintf( |
| 154 | 154 | 'RGBA(%s %s %s %s)', |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | * @throws ColorException |
| 192 | 192 | * @see RGBAColor::ERROR_INVALID_HEX_LENGTH |
| 193 | 193 | */ |
| 194 | - public static function hex2color(string $hex, string $name='') : RGBAColor |
|
| 194 | + public static function hex2color(string $hex, string $name = '') : RGBAColor |
|
| 195 | 195 | { |
| 196 | - if(!isset(self::$hexParser)) |
|
| 196 | + if (!isset(self::$hexParser)) |
|
| 197 | 197 | { |
| 198 | 198 | self::$hexParser = new HEXParser(); |
| 199 | 199 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | // If one associative key is present, we assume |
| 247 | 247 | // that the color array is already correct. |
| 248 | - if(isset($color[RGBAColor::CHANNEL_RED])) |
|
| 248 | + if (isset($color[RGBAColor::CHANNEL_RED])) |
|
| 249 | 249 | { |
| 250 | 250 | return $color; |
| 251 | 251 | } |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | $values = array_values($color); |
| 254 | 254 | $result = array(); |
| 255 | 255 | |
| 256 | - foreach(self::$keys as $idx => $def) |
|
| 256 | + foreach (self::$keys as $idx => $def) |
|
| 257 | 257 | { |
| 258 | - if(isset($values[$idx])) |
|
| 258 | + if (isset($values[$idx])) |
|
| 259 | 259 | { |
| 260 | 260 | $result[$def['key']] = $values[$idx]; |
| 261 | 261 | continue; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if(!$def['mandatory']) |
|
| 264 | + if (!$def['mandatory']) |
|
| 265 | 265 | { |
| 266 | 266 | continue; |
| 267 | 267 | } |
@@ -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 | } |