Completed
Push — master ( ef6746...5a635f )
by Ron
07:26
created
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 $this
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 static($this->callback, $baseDir, array_merge($this->vars, $vars), $this->config);
Please login to merge, or discard this patch.
src/Workers/FileWorker.php 1 patch
Spacing   +19 added lines, -19 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);
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 		$this->setVars($vars);
68 68
 		$this->setRegions($regions);
69 69
 
70
-		return ViewTryFinallySimulator::tryThis(function () use ($filename, $resource, $vars) {
71
-			$content = $this->obRecord(function () use ($filename, $resource, $vars) {
70
+		return ViewTryFinallySimulator::tryThis(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
 						/** @noinspection PhpIncludeInspection */
82 82
 						require $templateFilename;
83 83
 					};
84 84
 					$fn->bindTo(new \stdClass());
85 85
 					call_user_func($fn);
86 86
 				} else {
87
-					if($this->parent !== null) {
87
+					if ($this->parent !== null) {
88 88
 						echo $this->parent->render($resource, $vars);
89 89
 					} else {
90 90
 						throw new ResourceNotFoundException("Resource not found: {$resource}");
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				}
93 93
 			});
94 94
 			return $this->generateLayoutContent($content);
95
-		}, function () use ($oldVars, $oldRegions) {
95
+		}, function() use ($oldVars, $oldRegions) {
96 96
 			$this->setVars($oldVars);
97 97
 			$this->setRegions($oldRegions);
98 98
 		});
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @throws \Exception
105 105
 	 */
106 106
 	private function generateLayoutContent($content) {
107
-		if($this->getLayout() !== null) {
107
+		if ($this->getLayout() !== null) {
108 108
 			$regions = $this->getRegions();
109 109
 			$regions['content'] = $content;
110 110
 			$layoutResource = $this->getLayout();
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 * @return string
137 137
 	 */
138 138
 	private function normalize($templateFilename) {
139
-		if(strpos($templateFilename, '..')) {
139
+		if (strpos($templateFilename, '..')) {
140 140
 			$templateFilename = strtr($templateFilename, [DIRECTORY_SEPARATOR => '/']);
141 141
 			$templateFilename = preg_replace('/\\/+/', '/', $templateFilename);
142 142
 			$parts = explode('/', $templateFilename);
143 143
 			$correctedParts = [];
144
-			foreach($parts as $part) {
145
-				if($part === '.') {
144
+			foreach ($parts as $part) {
145
+				if ($part === '.') {
146 146
 					// Skip
147
-				} elseif($part === '..') {
148
-					if(count($correctedParts)) {
147
+				} elseif ($part === '..') {
148
+					if (count($correctedParts)) {
149 149
 						array_pop($correctedParts);
150 150
 					} else {
151 151
 						// Skip
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	 * @return string
165 165
 	 */
166 166
 	private function getCurrentWorkDir($subPath) {
167
-		if(substr($subPath, 0, 1) === '@') {
168
-			$replace = function ($matches) {
167
+		if (substr($subPath, 0, 1) === '@') {
168
+			$replace = function($matches) {
169 169
 				$paths = $this->getConfiguration()->getPaths();
170
-				if(!array_key_exists($matches[2], $paths)) {
170
+				if (!array_key_exists($matches[2], $paths)) {
171 171
 					throw new VirtualPathNotRegisteredException("Virtual path not registered: {$matches[1]}{$matches[2]}");
172 172
 				}
173 173
 				return $paths[$matches[2]];
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.