Completed
Push — master ( 14a040...abe4fb )
by Ron
18s
created
src/Helpers/RecursiveStringPath.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@
 block discarded – undo
61 61
 	 * @return array
62 62
 	 */
63 63
 	private function getPath($string) {
64
-		if(strpos($string, '.') === false) {
64
+		if (strpos($string, '.') === false) {
65 65
 			return array($string);
66 66
 		}
67
-		if(strpos($string, '\\') !== false) {
67
+		if (strpos($string, '\\') !== false) {
68 68
 			return preg_split("/\\\\.(*SKIP)(*FAIL)|{$this->delimiter}/s", $string);
69 69
 		}
70 70
 		return explode('.', $string);
Please login to merge, or discard this patch.
src/Helpers/RecursiveArrayPath.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 		if (!$count) {
13 13
 			return false;
14 14
 		}
15
-		for($idx = 0; $idx < $count; $idx++) {
15
+		for ($idx = 0; $idx < $count; $idx++) {
16 16
 			$part = $path[$idx];
17
-			if(!array_key_exists($part, $array)) {
17
+			if (!array_key_exists($part, $array)) {
18 18
 				return false;
19 19
 			}
20 20
 			$array = $array[$part];
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 		if (!$count) {
34 34
 			return $default;
35 35
 		}
36
-		for($idx = 0; $idx < $count; $idx++) {
36
+		for ($idx = 0; $idx < $count; $idx++) {
37 37
 			$part = $path[$idx];
38
-			if(!array_key_exists($part, $array)) {
38
+			if (!array_key_exists($part, $array)) {
39 39
 				return $default;
40 40
 			}
41 41
 			$array = $array[$part];
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	public static function del($array, array $path) {
72 72
 		while (count($path)) { // Try as long as a valid path is given
73 73
 			$key = array_shift($path); // Get the current key
74
-			if(array_key_exists($key, $array)) { // If the current key is present in the current recursion-level...
75
-				if(count($path)) { // After involving array_shift, the path could now be empty. If not...
76
-					if(is_array($array[$key])) { // If it is an array we need to step into the next recursion-level...
74
+			if (array_key_exists($key, $array)) { // If the current key is present in the current recursion-level...
75
+				if (count($path)) { // After involving array_shift, the path could now be empty. If not...
76
+					if (is_array($array[$key])) { // If it is an array we need to step into the next recursion-level...
77 77
 						$array[$key] = self::del($array[$key], $path);
78 78
 					}
79 79
 					// If it is not an array, the sub-path can't be reached - stop.
Please login to merge, or discard this patch.
src/Renderer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
 	 * @return $this
34 34
 	 */
35 35
 	public function addAll(array $map) {
36
-		foreach($map as $key => $value) {
37
-			if(is_numeric($key) || !is_string($key)) {
36
+		foreach ($map as $key => $value) {
37
+			if (is_numeric($key) || !is_string($key)) {
38 38
 				throw new \Exception("Invalid key type: ".gettype($key));
39 39
 			}
40 40
 			$this->add($key, $value);
Please login to merge, or discard this patch.
src/Helpers/Directories.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	public static function concat() {
9 9
 		$parts = func_get_args();
10 10
 		$result = array_shift($parts);
11
-		foreach($parts as $part) {
11
+		foreach ($parts as $part) {
12 12
 			$result = self::concatPaths($result, $part);
13 13
 		}
14 14
 		return $result;
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	private static function concatPaths($a, $b) {
23 23
 		$basePath = str_replace('\\', '/', $a);
24 24
 		$filename = str_replace('\\', '/', $b);
25
-		if($basePath && $filename) {
26
-			return rtrim($basePath, '/') . '/' . ltrim($filename, '/');
25
+		if ($basePath && $filename) {
26
+			return rtrim($basePath, '/').'/'.ltrim($filename, '/');
27 27
 		}
28
-		return $basePath . $filename;
28
+		return $basePath.$filename;
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
src/Proxying/ObjectProxyFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
 	 * @return ObjectProxy|mixed
28 28
 	 */
29 29
 	public function create($object) {
30
-		if($object === null) {
30
+		if ($object === null) {
31 31
 			$proxy = '';
32
-		} elseif(is_resource($object)) {
32
+		} elseif (is_resource($object)) {
33 33
 			$proxy = $object;
34
-		} elseif(is_array($object) || $object instanceof Traversable) {
34
+		} elseif (is_array($object) || $object instanceof Traversable) {
35 35
 			$proxy = new ArrayProxy($object, $this);
36
-		} elseif(is_object($object)) {
37
-			if(!is_object($object)) {
36
+		} elseif (is_object($object)) {
37
+			if (!is_object($object)) {
38 38
 				$object = (object) $object;
39 39
 			}
40 40
 			$proxy = new ObjectProxy($object, $this);
Please login to merge, or discard this patch.
src/Proxying/ArrayProxy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 * @param ObjectProxyFactory $objectProxyFactory
21 21
 	 */
22 22
 	public function __construct($array = [], ?ObjectProxyFactory $objectProxyFactory = null) {
23
-		if($objectProxyFactory === null) {
23
+		if ($objectProxyFactory === null) {
24 24
 			throw new RuntimeException('No object proxy factory given');
25 25
 		}
26
-		if($array instanceof Generator) {
26
+		if ($array instanceof Generator) {
27 27
 			$array = iterator_to_array($array);
28 28
 		}
29 29
 		$this->array = $array;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	#[\ReturnTypeWillChange]
37 37
 	public function getIterator() {
38 38
 		$result = [];
39
-		foreach($this->getArray() as $key => $value) {
39
+		foreach ($this->getArray() as $key => $value) {
40 40
 			$result[$key] = $this->objectProxyFactory->create($value);
41 41
 		}
42 42
 		return new ArrayIterator($result);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	#[\ReturnTypeWillChange]
60 60
 	public function offsetGet($offset) {
61 61
 		$array = $this->getArray();
62
-		if(array_key_exists($offset, $array)) {
62
+		if (array_key_exists($offset, $array)) {
63 63
 			return $this->objectProxyFactory->create($this->array[$offset]);
64 64
 		}
65 65
 		return null;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @return array
107 107
 	 */
108 108
 	private function getArray() {
109
-		if($this->array instanceof Traversable) {
109
+		if ($this->array instanceof Traversable) {
110 110
 			$this->array = iterator_to_array($this->array);
111 111
 		}
112 112
 		return $this->array;
Please login to merge, or discard this patch.
src/Workers/AbstractWorker.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param WorkerConfiguration|null $configuration
25 25
 	 */
26 26
 	public function __construct(array $vars = [], array $regions = [], ?WorkerConfiguration $configuration = null) {
27
-		if($configuration === null) {
27
+		if ($configuration === null) {
28 28
 			throw new RuntimeException('No configuration given');
29 29
 		}
30 30
 		$this->vars = $vars;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return mixed
47 47
 	 */
48 48
 	public function get($key, $default = null) {
49
-		if(!$this->has($key)) {
49
+		if (!$this->has($key)) {
50 50
 			return $default;
51 51
 		}
52 52
 		return $this->configuration->getRecursiveAccessor()->get($this->vars, $key, $default);
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 * @return string
59 59
 	 */
60 60
 	public function getStr($key, $default = '') {
61
-		if(!$this->has($key)) {
61
+		if (!$this->has($key)) {
62 62
 			return $default;
63 63
 		}
64 64
 		$value = $this->get($key);
65
-		if(!is_scalar($value)) {
65
+		if (!is_scalar($value)) {
66 66
 			$value = '';
67 67
 		}
68 68
 		return $this->configuration->getContext()->escape($value);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 */
76 76
 	public function getBool($key, $default = false) {
77
-		if(!$this->has($key)) {
77
+		if (!$this->has($key)) {
78 78
 			return $default;
79 79
 		}
80 80
 		return !!$this->getStr($key);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return int
87 87
 	 */
88 88
 	public function getInt($key, $default = false) {
89
-		if(!$this->has($key)) {
89
+		if (!$this->has($key)) {
90 90
 			return $default;
91 91
 		}
92 92
 		return (int) $this->getStr($key);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @return float
99 99
 	 */
100 100
 	public function getFloat($key, $default = false) {
101
-		if(!$this->has($key)) {
101
+		if (!$this->has($key)) {
102 102
 			return $default;
103 103
 		}
104 104
 		return (float) $this->getStr($key);
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
 	 * @return array|Generator|Traversable
111 111
 	 */
112 112
 	public function getArray($key, $default = []) {
113
-		if(!$this->has($key)) {
113
+		if (!$this->has($key)) {
114 114
 			return $default;
115 115
 		}
116 116
 		$value = $this->get($key);
117
-		if($value instanceof ArrayObject) {
117
+		if ($value instanceof ArrayObject) {
118 118
 			$value = $value->getArrayCopy();
119 119
 		}
120
-		if(!is_array($value)) {
120
+		if (!is_array($value)) {
121 121
 			$value = [];
122 122
 		}
123 123
 		return $value;
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 * @return array|Generator|Traversable
130 130
 	 */
131 131
 	public function getArrayObj($key, $default = []) {
132
-		if(!$this->has($key)) {
132
+		if (!$this->has($key)) {
133 133
 			return $default;
134 134
 		}
135 135
 		$value = $this->get($key);
136
-		if(!is_array($value) && !$value instanceof Traversable) {
136
+		if (!is_array($value) && !$value instanceof Traversable) {
137 137
 			$value = [];
138 138
 		}
139 139
 		return new ArrayProxy($value, $this->configuration->getObjectProxyFactory());
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @return string
195 195
 	 */
196 196
 	public function getRegion($name) {
197
-		if(array_key_exists($name, $this->regions)) {
197
+		if (array_key_exists($name, $this->regions)) {
198 198
 			return (string) $this->regions[$name];
199 199
 		}
200 200
 		return '';
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return $this
222 222
 	 */
223 223
 	public function region($name) {
224
-		ob_start(function ($content) use ($name) {
224
+		ob_start(function($content) use ($name) {
225 225
 			$this->regions[$name] = $content;
226 226
 		});
227 227
 		return $this;
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @return $this
233 233
 	 */
234 234
 	public function getRegionOr($name) {
235
-		if(!array_key_exists($name, $this->regions)) {
236
-			ob_start(function ($content) {
235
+		if (!array_key_exists($name, $this->regions)) {
236
+			ob_start(function($content) {
237 237
 				return $content;
238 238
 			});
239 239
 		} else {
240
-			ob_start(function () use ($name) {
240
+			ob_start(function() use ($name) {
241 241
 				return $this->regions[$name];
242 242
 			});
243 243
 		}
Please login to merge, or discard this patch.
src/Factories/CallbackViewFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * @return Renderer
45 45
 	 */
46 46
 	public function create($baseDir = null, array $vars = []) {
47
-		if($baseDir === null) {
47
+		if ($baseDir === null) {
48 48
 			$baseDir = $this->baseDir;
49
-		} elseif($this->baseDir !== null) {
49
+		} elseif ($this->baseDir !== null) {
50 50
 			$baseDir = Directories::concat($this->baseDir, $baseDir);
51 51
 		}
52 52
 		return call_user_func($this->callback, $baseDir, $vars, $this->config);
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	 * @return self
59 59
 	 */
60 60
 	public function deriveFactory($baseDir = null, array $vars = []) {
61
-		if($baseDir === null) {
61
+		if ($baseDir === null) {
62 62
 			$baseDir = $this->baseDir;
63
-		} elseif($this->baseDir !== null) {
63
+		} elseif ($this->baseDir !== null) {
64 64
 			$baseDir = Directories::concat($this->baseDir, $baseDir);
65 65
 		}
66 66
 		return new self($this->callback, $baseDir, array_merge($this->vars, $vars), $this->config);
Please login to merge, or discard this patch.
src/Workers/FileWorker/FileWorkerConfiguration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 	 * @param array $config
25 25
 	 */
26 26
 	public function __construct(?Context $context = null, ?RecursiveStringPath $recursiveAccessor = null, ?ObjectProxyFactory $objectProxyFactory = null, array $config = []) {
27
-		if($context === null) {
27
+		if ($context === null) {
28 28
 			$context = new HtmlContext();
29 29
 		}
30
-		if($recursiveAccessor === null) {
30
+		if ($recursiveAccessor === null) {
31 31
 			$recursiveAccessor = new RecursiveStringPath();
32 32
 		}
33
-		if($objectProxyFactory === null) {
33
+		if ($objectProxyFactory === null) {
34 34
 			$objectProxyFactory = new ObjectProxyFactory($context);
35 35
 		}
36 36
 		$this->context = $context;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return array
65 65
 	 */
66 66
 	public function getPaths() {
67
-		if(array_key_exists('paths', $this->config)) {
67
+		if (array_key_exists('paths', $this->config)) {
68 68
 			return $this->config['paths'];
69 69
 		}
70 70
 		return [];
Please login to merge, or discard this patch.