Completed
Push — master ( 5a635f...5116f5 )
by Ron
47s
created
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/Workers/FileWorker.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 * @param Delegate $parent
26 26
 	 */
27 27
 	public function __construct($basePath, $fileExt = null, array $vars = array(), WorkerConfiguration $configuration = null, Delegate $parent = null) {
28
-		if($fileExt === null)  {
28
+		if ($fileExt === null) {
29 29
 			$fileExt = '.phtml';
30 30
 		}
31
-		if($configuration === null) {
31
+		if ($configuration === null) {
32 32
 			$configuration = new FileWorkerConfiguration();
33 33
 		}
34 34
 		parent::__construct($vars, [], $configuration);
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 		$this->setRegions($regions);
69 69
 
70 70
 		try {
71
-			$content = $this->obRecord(function () use ($filename, $resource, $vars) {
71
+			$content = $this->obRecord(function() use ($filename, $resource, $vars) {
72 72
 				$templateFilename = Directories::concat($this->currentWorkDir, $filename);
73 73
 				$templateFilename = $this->normalize($templateFilename);
74
-				$templatePath = stream_resolve_include_path($templateFilename . $this->fileExt);
75
-				if($templatePath === false) {
74
+				$templatePath = stream_resolve_include_path($templateFilename.$this->fileExt);
75
+				if ($templatePath === false) {
76 76
 					$templatePath = stream_resolve_include_path($templateFilename);
77 77
 				}
78
-				if($templatePath !== false) {
78
+				if ($templatePath !== false) {
79 79
 					$templateFilename = $templatePath;
80
-					$fn = function () use ($templateFilename) {
80
+					$fn = function() use ($templateFilename) {
81 81
 						require $templateFilename;
82 82
 					};
83 83
 					$fn->bindTo(new \stdClass());
84 84
 					call_user_func($fn);
85 85
 				} else {
86
-					if($this->parent !== null) {
86
+					if ($this->parent !== null) {
87 87
 						echo $this->parent->render($resource, $vars);
88 88
 					} else {
89 89
 						throw new ResourceNotFoundException("Resource not found: {$resource}");
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @throws \Exception
104 104
 	 */
105 105
 	private function generateLayoutContent($content) {
106
-		if($this->getLayout() !== null) {
106
+		if ($this->getLayout() !== null) {
107 107
 			$regions = $this->getRegions();
108 108
 			$regions['content'] = $content;
109 109
 			$layoutResource = $this->getLayout();
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 	 * @return string
135 135
 	 */
136 136
 	private function normalize($templateFilename) {
137
-		if(strpos($templateFilename, '..')) {
137
+		if (strpos($templateFilename, '..')) {
138 138
 			$templateFilename = strtr($templateFilename, [DIRECTORY_SEPARATOR => '/']);
139 139
 			$templateFilename = preg_replace('/\\/+/', '/', $templateFilename);
140 140
 			$parts = explode('/', $templateFilename);
141 141
 			$correctedParts = [];
142
-			foreach($parts as $part) {
143
-				if($part === '.') {
142
+			foreach ($parts as $part) {
143
+				if ($part === '.') {
144 144
 					// Skip
145
-				} elseif($part === '..') {
146
-					if(count($correctedParts)) {
145
+				} elseif ($part === '..') {
146
+					if (count($correctedParts)) {
147 147
 						array_pop($correctedParts);
148 148
 					} else {
149 149
 						// Skip
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	 * @return string
163 163
 	 */
164 164
 	private function getCurrentWorkDir($subPath) {
165
-		if(substr($subPath, 0, 1) === '@') {
166
-			$replace = function ($matches) {
165
+		if (substr($subPath, 0, 1) === '@') {
166
+			$replace = function($matches) {
167 167
 				$paths = $this->getConfiguration()->getPaths();
168
-				if(!array_key_exists($matches[2], $paths)) {
168
+				if (!array_key_exists($matches[2], $paths)) {
169 169
 					throw new VirtualPathNotRegisteredException("Virtual path not registered: {$matches[1]}{$matches[2]}");
170 170
 				}
171 171
 				return $paths[$matches[2]];
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.