Completed
Push — master ( e5ab6e...b77dd2 )
by Michal
03:26
created
src/Webrouse/AssetMacro/AssetMacro.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 			$filePath = $isVersion ? ($wwwDir . $ds . $path) : ($wwwDir . $ds . Utils::normalizePath($revision));
79 79
 			if ( ! file_exists($filePath)) {
80 80
 				Utils::throwError(
81
-				    new AssetNotFoundException(sprintf("Asset '%s' not found.", $filePath)),
82
-                    $config['missingAsset'],
83
-                    $need
84
-                );
81
+					new AssetNotFoundException(sprintf("Asset '%s' not found.", $filePath)),
82
+					$config['missingAsset'],
83
+					$need
84
+				);
85 85
 				return '';
86 86
 			}
87 87
 		}
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 		if (is_string($manifest)) {
172 172
 			if ( ! file_exists($manifest)) {
173 173
 				Utils::throwError(
174
-				    new ManifestNotFoundException(sprintf("Manifest file not found: '%s'.", $manifest)),
175
-                    $config['missingManifest'],
176
-                    $need
177
-                );
174
+					new ManifestNotFoundException(sprintf("Manifest file not found: '%s'.", $manifest)),
175
+					$config['missingManifest'],
176
+					$need
177
+				);
178 178
 				return NULL;
179 179
 			}
180 180
 			return Json::decode(file_get_contents($manifest), Json::FORCE_ARRAY);
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 		$dir = realpath($wwwDir . DIRECTORY_SEPARATOR . dirname($asset));
199 199
 		if ($dir === FALSE) {
200 200
 			Utils::throwError(
201
-			    new DirNotFoundException(sprintf("Parent dir of asset '%s' not found.", $asset)),
202
-                $config['missingAsset'],
203
-                $need
204
-            );
201
+				new DirNotFoundException(sprintf("Parent dir of asset '%s' not found.", $asset)),
202
+				$config['missingAsset'],
203
+				$need
204
+			);
205 205
 			return NULL;
206 206
 		}
207 207
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 		}
220 220
 
221 221
 		Utils::throwError(
222
-		    new ManifestNotFoundException(
223
-		        sprintf("Manifest not found in: %s.", implode(', ', $autodetectPaths))),
224
-                $config['missingManifest'],
225
-                $need
226
-            );
222
+			new ManifestNotFoundException(
223
+				sprintf("Manifest not found in: %s.", implode(', ', $autodetectPaths))),
224
+				$config['missingManifest'],
225
+				$need
226
+			);
227 227
 		return NULL;
228 228
 	}
229 229
 
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 
242 242
 		if ($revision === NULL) {
243 243
 			Utils::throwError(
244
-			    new RevisionNotFound(sprintf("Revision for asset '%s' not found in manifest.", $path)),
245
-                $config['missingRevision'],
246
-                $need
247
-            );
244
+				new RevisionNotFound(sprintf("Revision for asset '%s' not found in manifest.", $path)),
245
+				$config['missingRevision'],
246
+				$need
247
+			);
248 248
 		}
249 249
 
250 250
 		return $revision;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		if ($config['existCheck'] === TRUE) {
77 77
 			$ds = DIRECTORY_SEPARATOR;
78 78
 			$filePath = $isVersion ? ($wwwDir . $ds . $path) : ($wwwDir . $ds . Utils::normalizePath($revision));
79
-			if ( ! file_exists($filePath)) {
79
+			if (!file_exists($filePath)) {
80 80
 				Utils::throwError(
81 81
 				    new AssetNotFoundException(sprintf("Asset '%s' not found.", $filePath)),
82 82
                     $config['missingAsset'],
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 		return Strings::replace($format,
108 108
 			'/%([^%]+)%/',
109
-			function ($matches) use ($basePath, $format, $path, $revision, $isVersion) {
109
+			function($matches) use ($basePath, $format, $path, $revision, $isVersion) {
110 110
 				switch ($matches[1]) {
111 111
 					case 'raw':
112 112
 						return $revision;
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
 						return $path;
117 117
 					case 'url':
118 118
 						return $isVersion ?
119
-							sprintf("%s/%s?v=%s", $basePath, $path, $revision) :
120
-							sprintf("%s/%s", $basePath, $path);
119
+							sprintf("%s/%s?v=%s", $basePath, $path, $revision) : sprintf("%s/%s", $basePath, $path);
121 120
 					default:
122 121
 						$msg = sprintf(
123 122
 							"Asset macro: Invalid variable '%s' in format '%s'. " .
@@ -169,7 +168,7 @@  discard block
 block discarded – undo
169 168
 
170 169
 		// Path to JSON manifest
171 170
 		if (is_string($manifest)) {
172
-			if ( ! file_exists($manifest)) {
171
+			if (!file_exists($manifest)) {
173 172
 				Utils::throwError(
174 173
 				    new ManifestNotFoundException(sprintf("Manifest file not found: '%s'.", $manifest)),
175 174
                     $config['missingManifest'],
Please login to merge, or discard this patch.