@@ -27,9 +27,9 @@ |
||
27 | 27 | public const ERROR_CANNOT_UNSERIALIZE_ERROR_DATA = 57201; |
28 | 28 | public const ERROR_ERROR_DATA_KEY_MISSING = 57202; |
29 | 29 | |
30 | - /** |
|
31 | - * @var LibXMLError |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var LibXMLError |
|
32 | + */ |
|
33 | 33 | private LibXMLError $error; |
34 | 34 | |
35 | 35 | /** |
@@ -90,9 +90,9 @@ |
||
90 | 90 | */ |
91 | 91 | private static function checkErrorData(array $data) : void |
92 | 92 | { |
93 | - foreach(self::$requiredKeys as $key) |
|
93 | + foreach (self::$requiredKeys as $key) |
|
94 | 94 | { |
95 | - if(!array_key_exists($key, $data)) |
|
95 | + if (!array_key_exists($key, $data)) |
|
96 | 96 | { |
97 | 97 | throw new XMLHelper_Exception( |
98 | 98 | 'Required key missing in error data', |
@@ -58,8 +58,7 @@ |
||
58 | 58 | try |
59 | 59 | { |
60 | 60 | $data = json_decode($serialized, true, 512, JSON_THROW_ON_ERROR); |
61 | - } |
|
62 | - catch (JsonException $e) |
|
61 | + } catch (JsonException $e) |
|
63 | 62 | { |
64 | 63 | throw new XMLHelper_Exception( |
65 | 64 | 'Could not unserialize error data', |
@@ -28,32 +28,32 @@ |
||
28 | 28 | |
29 | 29 | private ?SimpleXMLElement $element = null; |
30 | 30 | |
31 | - /** |
|
32 | - * @var XMLHelper_SimpleXML_Error[] |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var XMLHelper_SimpleXML_Error[] |
|
33 | + */ |
|
34 | 34 | private array $errors = array(); |
35 | 35 | |
36 | - /** |
|
37 | - * Creates a simplexml instance from an XML string. |
|
38 | - * |
|
39 | - * NOTE: returns false in case of a fatal error. |
|
40 | - * |
|
41 | - * @param string $string |
|
42 | - * @return SimpleXMLElement|NULL |
|
43 | - */ |
|
36 | + /** |
|
37 | + * Creates a simplexml instance from an XML string. |
|
38 | + * |
|
39 | + * NOTE: returns false in case of a fatal error. |
|
40 | + * |
|
41 | + * @param string $string |
|
42 | + * @return SimpleXMLElement|NULL |
|
43 | + */ |
|
44 | 44 | public function loadString(string $string) : ?SimpleXMLElement |
45 | 45 | { |
46 | 46 | return $this->load('string', $string); |
47 | 47 | } |
48 | 48 | |
49 | - /** |
|
50 | - * Creates a simplexml instance from an XML file. |
|
51 | - * |
|
52 | - * NOTE: returns false in case of a fatal error. |
|
53 | - * |
|
54 | - * @param string $file |
|
55 | - * @return SimpleXMLElement|NULL |
|
56 | - */ |
|
49 | + /** |
|
50 | + * Creates a simplexml instance from an XML file. |
|
51 | + * |
|
52 | + * NOTE: returns false in case of a fatal error. |
|
53 | + * |
|
54 | + * @param string $file |
|
55 | + * @return SimpleXMLElement|NULL |
|
56 | + */ |
|
57 | 57 | public function loadFile(string $file) : ?SimpleXMLElement |
58 | 58 | { |
59 | 59 | return $this->load('file', $file); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // error wrappers. |
84 | 84 | $errors = libxml_get_errors(); |
85 | 85 | |
86 | - foreach($errors as $error) |
|
86 | + foreach ($errors as $error) |
|
87 | 87 | { |
88 | 88 | $this->errors[] = new XMLHelper_SimpleXML_Error($this, $error); |
89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $xml = $function($subject); |
99 | 99 | |
100 | - if($xml instanceof SimpleXMLElement) |
|
100 | + if ($xml instanceof SimpleXMLElement) |
|
101 | 101 | { |
102 | 102 | return $xml; |
103 | 103 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function getConverter() : XMLHelper_Converter |
109 | 109 | { |
110 | - if($this->element instanceof SimpleXMLElement) |
|
110 | + if ($this->element instanceof SimpleXMLElement) |
|
111 | 111 | { |
112 | 112 | return XMLHelper::convertElement($this->element); |
113 | 113 | } |
@@ -10,9 +10,9 @@ |
||
10 | 10 | { |
11 | 11 | protected XMLHelper_SimpleXML $xml; |
12 | 12 | |
13 | - /** |
|
14 | - * @var LibXMLError |
|
15 | - */ |
|
13 | + /** |
|
14 | + * @var LibXMLError |
|
15 | + */ |
|
16 | 16 | protected LibXMLError $nativeError; |
17 | 17 | |
18 | 18 | public function __construct(XMLHelper_SimpleXML $xml, LibXMLError $nativeError) |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | class Request_RefreshParams_Exclude_Callback extends Request_RefreshParams_Exclude |
22 | 22 | { |
23 | - /** |
|
24 | - * @var callable |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var callable |
|
25 | + */ |
|
26 | 26 | private $callback; |
27 | 27 | |
28 | 28 | public function __construct(callable $callback) |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | |
7 | 7 | abstract class VariableInfo_Renderer |
8 | 8 | { |
9 | - /** |
|
10 | - * @var mixed|NULL |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var mixed|NULL |
|
11 | + */ |
|
12 | 12 | protected $value; |
13 | 13 | |
14 | 14 | protected VariableInfo $info; |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | abstract protected function init() : void; |
26 | 26 | |
27 | - /** |
|
28 | - * Renders the value to the target format. |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
27 | + /** |
|
28 | + * Renders the value to the target format. |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | 32 | public function render() : string |
33 | 33 | { |
34 | 34 | return $this->_render(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function getPresetsManager() : PresetsManager |
43 | 43 | { |
44 | - if(!isset(self::$presets)) |
|
44 | + if (!isset(self::$presets)) |
|
45 | 45 | { |
46 | 46 | self::$presets = new PresetsManager(); |
47 | 47 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param string $name |
58 | 58 | * @return RGBAColor |
59 | 59 | */ |
60 | - public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $alpha=null, string $name='') : RGBAColor |
|
60 | + public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $alpha = null, string $name = '') : RGBAColor |
|
61 | 61 | { |
62 | - if($alpha === null) |
|
62 | + if ($alpha === null) |
|
63 | 63 | { |
64 | 64 | $alpha = ColorChannel::eightBit(0); |
65 | 65 | } |
@@ -86,31 +86,31 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function createAuto($subject) : ?RGBAColor |
88 | 88 | { |
89 | - if($subject instanceof RGBAColor) |
|
89 | + if ($subject instanceof RGBAColor) |
|
90 | 90 | { |
91 | 91 | return $subject; |
92 | 92 | } |
93 | 93 | |
94 | - if(is_array($subject)) |
|
94 | + if (is_array($subject)) |
|
95 | 95 | { |
96 | 96 | return self::createFrom8BitArray($subject); |
97 | 97 | } |
98 | 98 | |
99 | 99 | $hexOrPreset = (string)$subject; |
100 | 100 | |
101 | - if($hexOrPreset === '') |
|
101 | + if ($hexOrPreset === '') |
|
102 | 102 | { |
103 | 103 | return null; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $manager = self::getPresetsManager(); |
107 | 107 | |
108 | - if($manager->hasPreset($hexOrPreset)) |
|
108 | + if ($manager->hasPreset($hexOrPreset)) |
|
109 | 109 | { |
110 | 110 | return $manager->getPreset($hexOrPreset); |
111 | 111 | } |
112 | 112 | |
113 | - if(preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset)) |
|
113 | + if (preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset)) |
|
114 | 114 | { |
115 | 115 | return self::createFromHEX($hexOrPreset); |
116 | 116 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $color = FormatsConverter::array2associative($color); |
160 | 160 | |
161 | - if(!isset($color[RGBAColor::CHANNEL_ALPHA])) |
|
161 | + if (!isset($color[RGBAColor::CHANNEL_ALPHA])) |
|
162 | 162 | { |
163 | 163 | $color[RGBAColor::CHANNEL_ALPHA] = 0; |
164 | 164 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @see RGBAColor::ERROR_INVALID_COLOR_COMPONENT |
184 | 184 | * @see RGBAColor::ERROR_INVALID_PERCENTAGE_VALUE |
185 | 185 | */ |
186 | - public static function createFromHEX(string $hex, string $name='') : RGBAColor |
|
186 | + public static function createFromHEX(string $hex, string $name = '') : RGBAColor |
|
187 | 187 | { |
188 | 188 | return FormatsConverter::hex2color($hex, $name); |
189 | 189 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param string $name |
209 | 209 | * @return RGBAColor |
210 | 210 | */ |
211 | - public static function createPercent(float $red, float $green, float $blue, float $alpha=0, string $name='') : RGBAColor |
|
211 | + public static function createPercent(float $red, float $green, float $blue, float $alpha = 0, string $name = '') : RGBAColor |
|
212 | 212 | { |
213 | 213 | return new RGBAColor( |
214 | 214 | ColorChannel::percent($red), |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param string $name |
231 | 231 | * @return RGBAColor |
232 | 232 | */ |
233 | - public static function createCSS(int $red, int $green, int $blue, float $alpha=0, string $name='') : RGBAColor |
|
233 | + public static function createCSS(int $red, int $green, int $blue, float $alpha = 0, string $name = '') : RGBAColor |
|
234 | 234 | { |
235 | 235 | return self::create( |
236 | 236 | ColorChannel::eightBit($red), |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param string $name |
253 | 253 | * @return RGBAColor |
254 | 254 | */ |
255 | - public static function create8Bit(int $red, int $green, int $blue, int $alpha=0, string $name='') : RGBAColor |
|
255 | + public static function create8Bit(int $red, int $green, int $blue, int $alpha = 0, string $name = '') : RGBAColor |
|
256 | 256 | { |
257 | 257 | return self::create( |
258 | 258 | ColorChannel::eightBit($red), |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param string $name |
276 | 276 | * @return RGBAColor |
277 | 277 | */ |
278 | - public static function createGD(int $red, int $green, int $blue, int $alpha=0, string $name='') : RGBAColor |
|
278 | + public static function createGD(int $red, int $green, int $blue, int $alpha = 0, string $name = '') : RGBAColor |
|
279 | 279 | { |
280 | 280 | return self::create( |
281 | 281 | ColorChannel::eightBit($red), |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $color = imagecolorsforindex($img, $colorIndex); |
298 | 298 | |
299 | 299 | // it seems imagecolorsforindex() may return false (undocumented, unproven) |
300 | - if(is_array($color)) { |
|
300 | + if (is_array($color)) { |
|
301 | 301 | return self::create( |
302 | 302 | ColorChannel::eightBit($color['red']), |
303 | 303 | ColorChannel::eightBit($color['green']), |
@@ -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->getAlpha()->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 | } |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | { |
118 | 118 | return (int)floor( |
119 | 119 | ( |
120 | - ($this->getRed()->get8Bit()*2) |
|
120 | + ($this->getRed()->get8Bit() * 2) |
|
121 | 121 | + |
122 | 122 | $this->getBlue()->get8Bit() |
123 | 123 | + |
124 | - ($this->getGreen()->get8Bit()*3) |
|
124 | + ($this->getGreen()->get8Bit() * 3) |
|
125 | 125 | ) |
126 | 126 | /6 |
127 | 127 | ); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | private function requireValidComponent(string $name) : void |
370 | 370 | { |
371 | - if(in_array($name, self::COLOR_COMPONENTS)) |
|
371 | + if (in_array($name, self::COLOR_COMPONENTS)) |
|
372 | 372 | { |
373 | 373 | return; |
374 | 374 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $this->setOption('separatorChar', $char); |
47 | 47 | } |
48 | 48 | |
49 | - public function setTrailingNewline(bool $useNewline=true) : self |
|
49 | + public function setTrailingNewline(bool $useNewline = true) : self |
|
50 | 50 | { |
51 | 51 | return $this->setOption('trailingNewline', $useNewline); |
52 | 52 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $args = $args[0]; |
65 | 65 | } |
66 | 66 | |
67 | - $this->lines[] = '"' . implode('"'.$this->getOption('separatorChar').'"', $args) . '"'; |
|
67 | + $this->lines[] = '"'.implode('"'.$this->getOption('separatorChar').'"', $args).'"'; |
|
68 | 68 | |
69 | 69 | return $this; |
70 | 70 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $csv = implode(PHP_EOL, $this->lines); |
82 | 82 | |
83 | - if($this->getOption('trailingNewline')) { |
|
83 | + if ($this->getOption('trailingNewline')) { |
|
84 | 84 | $csv .= PHP_EOL; |
85 | 85 | } |
86 | 86 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setOption(string $name, $value) : self |
96 | 96 | { |
97 | - if(!isset($this->options)) { |
|
97 | + if (!isset($this->options)) { |
|
98 | 98 | $this->options = $this->getDefaultOptions(); |
99 | 99 | } |
100 | 100 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function setOptions(array $options) : self |
110 | 110 | { |
111 | - foreach($options as $name => $value) { |
|
111 | + foreach ($options as $name => $value) { |
|
112 | 112 | $this->setOption($name, $value); |
113 | 113 | } |
114 | 114 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * @param mixed|NULL $default |
121 | 121 | * @return mixed|NULL |
122 | 122 | */ |
123 | - public function getOption(string $name, $default=null) |
|
123 | + public function getOption(string $name, $default = null) |
|
124 | 124 | { |
125 | - if(!isset($this->options)) { |
|
125 | + if (!isset($this->options)) { |
|
126 | 126 | $this->options = $this->getDefaultOptions(); |
127 | 127 | } |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | public function hasOption(string $name) : bool |
133 | 133 | { |
134 | - if(!isset($this->options)) { |
|
134 | + if (!isset($this->options)) { |
|
135 | 135 | $this->options = $this->getDefaultOptions(); |
136 | 136 | } |
137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function getOptions() : array |
145 | 145 | { |
146 | - if(!isset($this->options)) { |
|
146 | + if (!isset($this->options)) { |
|
147 | 147 | $this->options = $this->getDefaultOptions(); |
148 | 148 | } |
149 | 149 |