Completed
Push — master ( 85fcd4...1ee7e1 )
by Lukas
29:36 queued 13:35
created
core/Controller/CssController.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -34,74 +34,74 @@
 block discarded – undo
34 34
 
35 35
 class CssController extends Controller {
36 36
 
37
-	/** @var IAppData */
38
-	protected $appData;
37
+    /** @var IAppData */
38
+    protected $appData;
39 39
 
40
-	/** @var ITimeFactory */
41
-	protected $timeFactory;
40
+    /** @var ITimeFactory */
41
+    protected $timeFactory;
42 42
 
43
-	/**
44
-	 * @param string $appName
45
-	 * @param IRequest $request
46
-	 * @param IAppData $appData
47
-	 * @param ITimeFactory $timeFactory
48
-	 */
49
-	public function __construct($appName, IRequest $request, IAppData $appData, ITimeFactory $timeFactory) {
50
-		parent::__construct($appName, $request);
43
+    /**
44
+     * @param string $appName
45
+     * @param IRequest $request
46
+     * @param IAppData $appData
47
+     * @param ITimeFactory $timeFactory
48
+     */
49
+    public function __construct($appName, IRequest $request, IAppData $appData, ITimeFactory $timeFactory) {
50
+        parent::__construct($appName, $request);
51 51
 
52
-		$this->appData = $appData;
53
-		$this->timeFactory = $timeFactory;
54
-	}
52
+        $this->appData = $appData;
53
+        $this->timeFactory = $timeFactory;
54
+    }
55 55
 
56
-	/**
57
-	 * @PublicPage
58
-	 * @NoCSRFRequired
59
-	 *
60
-	 * @param string $fileName css filename with extension
61
-	 * @param string $appName css folder name
62
-	 * @return FileDisplayResponse|NotFoundResponse
63
-	 */
64
-	public function getCss($fileName, $appName) {
65
-		try {
66
-			$folder = $this->appData->getFolder($appName);
67
-			$gzip = false;
68
-			$file = $this->getFile($folder, $fileName, $gzip);
69
-		} catch(NotFoundException $e) {
70
-			return new NotFoundResponse();
71
-		}
56
+    /**
57
+     * @PublicPage
58
+     * @NoCSRFRequired
59
+     *
60
+     * @param string $fileName css filename with extension
61
+     * @param string $appName css folder name
62
+     * @return FileDisplayResponse|NotFoundResponse
63
+     */
64
+    public function getCss($fileName, $appName) {
65
+        try {
66
+            $folder = $this->appData->getFolder($appName);
67
+            $gzip = false;
68
+            $file = $this->getFile($folder, $fileName, $gzip);
69
+        } catch(NotFoundException $e) {
70
+            return new NotFoundResponse();
71
+        }
72 72
 
73
-		$response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'text/css']);
74
-		if ($gzip) {
75
-			$response->addHeader('Content-Encoding', 'gzip');
76
-		}
77
-		$response->cacheFor(86400);
78
-		$expires = new \DateTime();
79
-		$expires->setTimestamp($this->timeFactory->getTime());
80
-		$expires->add(new \DateInterval('PT24H'));
81
-		$response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
82
-		$response->addHeader('Pragma', 'cache');
83
-		return $response;
84
-	}
73
+        $response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'text/css']);
74
+        if ($gzip) {
75
+            $response->addHeader('Content-Encoding', 'gzip');
76
+        }
77
+        $response->cacheFor(86400);
78
+        $expires = new \DateTime();
79
+        $expires->setTimestamp($this->timeFactory->getTime());
80
+        $expires->add(new \DateInterval('PT24H'));
81
+        $response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
82
+        $response->addHeader('Pragma', 'cache');
83
+        return $response;
84
+    }
85 85
 
86
-	/**
87
-	 * @param ISimpleFolder $folder
88
-	 * @param string $fileName
89
-	 * @param bool $gzip is set to true if we use the gzip file
90
-	 * @return ISimpleFile
91
-	 */
92
-	private function getFile(ISimpleFolder $folder, $fileName, &$gzip) {
93
-		$encoding = $this->request->getHeader('Accept-Encoding');
86
+    /**
87
+     * @param ISimpleFolder $folder
88
+     * @param string $fileName
89
+     * @param bool $gzip is set to true if we use the gzip file
90
+     * @return ISimpleFile
91
+     */
92
+    private function getFile(ISimpleFolder $folder, $fileName, &$gzip) {
93
+        $encoding = $this->request->getHeader('Accept-Encoding');
94 94
 
95
-		if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
96
-			try {
97
-				$gzip = true;
98
-				return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
99
-			} catch (NotFoundException $e) {
100
-				// continue
101
-			}
102
-		}
95
+        if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
96
+            try {
97
+                $gzip = true;
98
+                return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
99
+            } catch (NotFoundException $e) {
100
+                // continue
101
+            }
102
+        }
103 103
 
104
-		$gzip = false;
105
-		return $folder->getFile($fileName);
106
-	}
104
+        $gzip = false;
105
+        return $folder->getFile($fileName);
106
+    }
107 107
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$folder = $this->appData->getFolder($appName);
67 67
 			$gzip = false;
68 68
 			$file = $this->getFile($folder, $fileName, $gzip);
69
-		} catch(NotFoundException $e) {
69
+		} catch (NotFoundException $e) {
70 70
 			return new NotFoundResponse();
71 71
 		}
72 72
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
96 96
 			try {
97 97
 				$gzip = true;
98
-				return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
98
+				return $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz
99 99
 			} catch (NotFoundException $e) {
100 100
 				// continue
101 101
 			}
Please login to merge, or discard this patch.
core/Controller/JsController.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -35,74 +35,74 @@
 block discarded – undo
35 35
 
36 36
 class JsController extends Controller {
37 37
 
38
-	/** @var IAppData */
39
-	protected $appData;
38
+    /** @var IAppData */
39
+    protected $appData;
40 40
 
41
-	/** @var ITimeFactory */
42
-	protected $timeFactory;
41
+    /** @var ITimeFactory */
42
+    protected $timeFactory;
43 43
 
44
-	/**
45
-	 * @param string $appName
46
-	 * @param IRequest $request
47
-	 * @param IAppData $appData
48
-	 * @param ITimeFactory $timeFactory
49
-	 */
50
-	public function __construct($appName, IRequest $request, IAppData $appData, ITimeFactory $timeFactory) {
51
-		parent::__construct($appName, $request);
44
+    /**
45
+     * @param string $appName
46
+     * @param IRequest $request
47
+     * @param IAppData $appData
48
+     * @param ITimeFactory $timeFactory
49
+     */
50
+    public function __construct($appName, IRequest $request, IAppData $appData, ITimeFactory $timeFactory) {
51
+        parent::__construct($appName, $request);
52 52
 
53
-		$this->appData = $appData;
54
-		$this->timeFactory = $timeFactory;
55
-	}
53
+        $this->appData = $appData;
54
+        $this->timeFactory = $timeFactory;
55
+    }
56 56
 
57
-	/**
58
-	 * @PublicPage
59
-	 * @NoCSRFRequired
60
-	 *
61
-	 * @param string $fileName css filename with extension
62
-	 * @param string $appName css folder name
63
-	 * @return FileDisplayResponse|NotFoundResponse
64
-	 */
65
-	public function getJs($fileName, $appName) {
66
-		try {
67
-			$folder = $this->appData->getFolder($appName);
68
-			$gzip = false;
69
-			$file = $this->getFile($folder, $fileName, $gzip);
70
-		} catch(NotFoundException $e) {
71
-			return new NotFoundResponse();
72
-		}
57
+    /**
58
+     * @PublicPage
59
+     * @NoCSRFRequired
60
+     *
61
+     * @param string $fileName css filename with extension
62
+     * @param string $appName css folder name
63
+     * @return FileDisplayResponse|NotFoundResponse
64
+     */
65
+    public function getJs($fileName, $appName) {
66
+        try {
67
+            $folder = $this->appData->getFolder($appName);
68
+            $gzip = false;
69
+            $file = $this->getFile($folder, $fileName, $gzip);
70
+        } catch(NotFoundException $e) {
71
+            return new NotFoundResponse();
72
+        }
73 73
 
74
-		$response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'application/javascript']);
75
-		if ($gzip) {
76
-			$response->addHeader('Content-Encoding', 'gzip');
77
-		}
78
-		$response->cacheFor(86400);
79
-		$expires = new \DateTime();
80
-		$expires->setTimestamp($this->timeFactory->getTime());
81
-		$expires->add(new \DateInterval('PT24H'));
82
-		$response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
83
-		$response->addHeader('Pragma', 'cache');
84
-		return $response;
85
-	}
74
+        $response = new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => 'application/javascript']);
75
+        if ($gzip) {
76
+            $response->addHeader('Content-Encoding', 'gzip');
77
+        }
78
+        $response->cacheFor(86400);
79
+        $expires = new \DateTime();
80
+        $expires->setTimestamp($this->timeFactory->getTime());
81
+        $expires->add(new \DateInterval('PT24H'));
82
+        $response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
83
+        $response->addHeader('Pragma', 'cache');
84
+        return $response;
85
+    }
86 86
 
87
-	/**
88
-	 * @param ISimpleFolder $folder
89
-	 * @param string $fileName
90
-	 * @param bool $gzip is set to true if we use the gzip file
91
-	 * @return ISimpleFile
92
-	 */
93
-	private function getFile(ISimpleFolder $folder, $fileName, &$gzip) {
94
-		$encoding = $this->request->getHeader('Accept-Encoding');
87
+    /**
88
+     * @param ISimpleFolder $folder
89
+     * @param string $fileName
90
+     * @param bool $gzip is set to true if we use the gzip file
91
+     * @return ISimpleFile
92
+     */
93
+    private function getFile(ISimpleFolder $folder, $fileName, &$gzip) {
94
+        $encoding = $this->request->getHeader('Accept-Encoding');
95 95
 
96
-		if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
97
-			try {
98
-				$gzip = true;
99
-				return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
100
-			} catch (NotFoundException $e) {
101
-				// continue
102
-			}
103
-		}
96
+        if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
97
+            try {
98
+                $gzip = true;
99
+                return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
100
+            } catch (NotFoundException $e) {
101
+                // continue
102
+            }
103
+        }
104 104
 
105
-		$gzip = false;
106
-		return $folder->getFile($fileName);
107
-	}
105
+        $gzip = false;
106
+        return $folder->getFile($fileName);
107
+    }
108 108
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$folder = $this->appData->getFolder($appName);
67 67
 			$gzip = false;
68 68
 			$file = $this->getFile($folder, $fileName, $gzip);
69
-		} catch(NotFoundException $e) {
69
+		} catch (NotFoundException $e) {
70 70
 			return new NotFoundResponse();
71 71
 		}
72 72
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
96 96
 			try {
97 97
 				$gzip = true;
98
-				return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
98
+				return $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz
99 99
 			} catch (NotFoundException $e) {
100 100
 				// continue
101 101
 			}
Please login to merge, or discard this patch.
lib/private/Template/SCSSCacher.php 2 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -37,202 +37,202 @@
 block discarded – undo
37 37
 
38 38
 class SCSSCacher {
39 39
 
40
-	/** @var ILogger */
41
-	protected $logger;
42
-
43
-	/** @var IAppData */
44
-	protected $appData;
45
-
46
-	/** @var IURLGenerator */
47
-	protected $urlGenerator;
48
-
49
-	/** @var IConfig */
50
-	protected $config;
51
-
52
-	/** @var string */
53
-	protected $serverRoot;
54
-
55
-	/** @var ICache */
56
-	protected $depsCache;
57
-
58
-	/**
59
-	 * @param ILogger $logger
60
-	 * @param IAppData $appData
61
-	 * @param IURLGenerator $urlGenerator
62
-	 * @param IConfig $config
63
-	 * @param string $serverRoot
64
-	 * @param ICache $depsCache
65
-	 */
66
-	public function __construct(ILogger $logger,
67
-								IAppData $appData,
68
-								IURLGenerator $urlGenerator,
69
-								IConfig $config,
70
-								$serverRoot,
71
-								ICache $depsCache) {
72
-		$this->logger = $logger;
73
-		$this->appData = $appData;
74
-		$this->urlGenerator = $urlGenerator;
75
-		$this->config = $config;
76
-		$this->serverRoot = $serverRoot;
77
-		$this->depsCache = $depsCache;
78
-	}
79
-
80
-	/**
81
-	 * Process the caching process if needed
82
-	 * @param string $root Root path to the nextcloud installation
83
-	 * @param string $file
84
-	 * @param string $app The app name
85
-	 * @return boolean
86
-	 */
87
-	public function process($root, $file, $app) {
88
-		$path = explode('/', $root . '/' . $file);
89
-
90
-		$fileNameSCSS = array_pop($path);
91
-		$fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
92
-
93
-		$path = implode('/', $path);
94
-
95
-		$webDir = substr($path, strlen($this->serverRoot)+1);
96
-
97
-		try {
98
-			$folder = $this->appData->getFolder($app);
99
-		} catch(NotFoundException $e) {
100
-			// creating css appdata folder
101
-			$folder = $this->appData->newFolder($app);
102
-		}
103
-
104
-		if($this->isCached($fileNameCSS, $folder)) {
105
-			return true;
106
-		}
107
-		return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
108
-	}
109
-
110
-	/**
111
-	 * Check if the file is cached or not
112
-	 * @param string $fileNameCSS
113
-	 * @param ISimpleFolder $folder
114
-	 * @return boolean
115
-	 */
116
-	private function isCached($fileNameCSS, ISimpleFolder $folder) {
117
-		try {
118
-			$cachedFile = $folder->getFile($fileNameCSS);
119
-			if ($cachedFile->getSize() > 0) {
120
-				$depFileName = $fileNameCSS . '.deps';
121
-				$deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
122
-				if ($deps === null) {
123
-					$depFile = $folder->getFile($depFileName);
124
-					$deps = $depFile->getContent();
125
-					//Set to memcache for next run
126
-					$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
127
-				}
128
-				$deps = json_decode($deps, true);
129
-
130
-				foreach ($deps as $file=>$mtime) {
131
-					if (!file_exists($file) || filemtime($file) > $mtime) {
132
-						return false;
133
-					}
134
-				}
135
-			}
136
-			return true;
137
-		} catch(NotFoundException $e) {
138
-			return false;
139
-		}
140
-	}
141
-
142
-	/**
143
-	 * Cache the file with AppData
144
-	 * @param string $path
145
-	 * @param string $fileNameCSS
146
-	 * @param string $fileNameSCSS
147
-	 * @param ISimpleFolder $folder
148
-	 * @param string $webDir
149
-	 * @return boolean
150
-	 */
151
-	private function cache($path, $fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $webDir) {
152
-		$scss = new Compiler();
153
-		$scss->setImportPaths([
154
-			$path,
155
-			\OC::$SERVERROOT . '/core/css/',
156
-		]);
157
-		if($this->config->getSystemValue('debug')) {
158
-			// Debug mode
159
-			$scss->setFormatter(Expanded::class);
160
-			$scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
161
-		} else {
162
-			// Compression
163
-			$scss->setFormatter(Crunched::class);
164
-		}
165
-
166
-		try {
167
-			$cachedfile = $folder->getFile($fileNameCSS);
168
-		} catch(NotFoundException $e) {
169
-			$cachedfile = $folder->newFile($fileNameCSS);
170
-		}
171
-
172
-		$depFileName = $fileNameCSS . '.deps';
173
-		try {
174
-			$depFile = $folder->getFile($depFileName);
175
-		} catch (NotFoundException $e) {
176
-			$depFile = $folder->newFile($depFileName);
177
-		}
178
-
179
-		// Compile
180
-		try {
181
-			$compiledScss = $scss->compile(
182
-				'@import "variables.scss";' .
183
-				'@import "'.$fileNameSCSS.'";');
184
-		} catch(ParserException $e) {
185
-			$this->logger->error($e, ['app' => 'core']);
186
-			return false;
187
-		}
188
-
189
-		// Gzip file
190
-		try {
191
-			$gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
192
-		} catch (NotFoundException $e) {
193
-			$gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
194
-		}
195
-
196
-		try {
197
-			$data = $this->rebaseUrls($compiledScss, $webDir);
198
-			$cachedfile->putContent($data);
199
-			$depFile->putContent(json_encode($scss->getParsedFiles()));
200
-			$gzipFile->putContent(gzencode($data, 9));
201
-			$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
202
-			return true;
203
-		} catch(NotPermittedException $e) {
204
-			return false;
205
-		}
206
-	}
207
-
208
-	/**
209
-	 * Add the correct uri prefix to make uri valid again
210
-	 * @param string $css
211
-	 * @param string $webDir
212
-	 * @return string
213
-	 */
214
-	private function rebaseUrls($css, $webDir) {
215
-		$re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
216
-		// OC\Route\Router:75
217
-		if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
218
-			$subst = 'url(\'../../'.$webDir.'/$1\')';	
219
-		} else {
220
-			$subst = 'url(\'../../../'.$webDir.'/$1\')';
221
-		}
222
-		return preg_replace($re, $subst, $css);
223
-	}
224
-
225
-	/**
226
-	 * Return the cached css file uri
227
-	 * @param string $appName the app name
228
-	 * @param string $fileName
229
-	 * @return string
230
-	 */
231
-	public function getCachedSCSS($appName, $fileName) {
232
-		$tmpfileLoc = explode('/', $fileName);
233
-		$fileName = array_pop($tmpfileLoc);
234
-		$fileName = str_replace('.scss', '.css', $fileName);
235
-
236
-		return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
237
-	}
40
+    /** @var ILogger */
41
+    protected $logger;
42
+
43
+    /** @var IAppData */
44
+    protected $appData;
45
+
46
+    /** @var IURLGenerator */
47
+    protected $urlGenerator;
48
+
49
+    /** @var IConfig */
50
+    protected $config;
51
+
52
+    /** @var string */
53
+    protected $serverRoot;
54
+
55
+    /** @var ICache */
56
+    protected $depsCache;
57
+
58
+    /**
59
+     * @param ILogger $logger
60
+     * @param IAppData $appData
61
+     * @param IURLGenerator $urlGenerator
62
+     * @param IConfig $config
63
+     * @param string $serverRoot
64
+     * @param ICache $depsCache
65
+     */
66
+    public function __construct(ILogger $logger,
67
+                                IAppData $appData,
68
+                                IURLGenerator $urlGenerator,
69
+                                IConfig $config,
70
+                                $serverRoot,
71
+                                ICache $depsCache) {
72
+        $this->logger = $logger;
73
+        $this->appData = $appData;
74
+        $this->urlGenerator = $urlGenerator;
75
+        $this->config = $config;
76
+        $this->serverRoot = $serverRoot;
77
+        $this->depsCache = $depsCache;
78
+    }
79
+
80
+    /**
81
+     * Process the caching process if needed
82
+     * @param string $root Root path to the nextcloud installation
83
+     * @param string $file
84
+     * @param string $app The app name
85
+     * @return boolean
86
+     */
87
+    public function process($root, $file, $app) {
88
+        $path = explode('/', $root . '/' . $file);
89
+
90
+        $fileNameSCSS = array_pop($path);
91
+        $fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
92
+
93
+        $path = implode('/', $path);
94
+
95
+        $webDir = substr($path, strlen($this->serverRoot)+1);
96
+
97
+        try {
98
+            $folder = $this->appData->getFolder($app);
99
+        } catch(NotFoundException $e) {
100
+            // creating css appdata folder
101
+            $folder = $this->appData->newFolder($app);
102
+        }
103
+
104
+        if($this->isCached($fileNameCSS, $folder)) {
105
+            return true;
106
+        }
107
+        return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
108
+    }
109
+
110
+    /**
111
+     * Check if the file is cached or not
112
+     * @param string $fileNameCSS
113
+     * @param ISimpleFolder $folder
114
+     * @return boolean
115
+     */
116
+    private function isCached($fileNameCSS, ISimpleFolder $folder) {
117
+        try {
118
+            $cachedFile = $folder->getFile($fileNameCSS);
119
+            if ($cachedFile->getSize() > 0) {
120
+                $depFileName = $fileNameCSS . '.deps';
121
+                $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
122
+                if ($deps === null) {
123
+                    $depFile = $folder->getFile($depFileName);
124
+                    $deps = $depFile->getContent();
125
+                    //Set to memcache for next run
126
+                    $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
127
+                }
128
+                $deps = json_decode($deps, true);
129
+
130
+                foreach ($deps as $file=>$mtime) {
131
+                    if (!file_exists($file) || filemtime($file) > $mtime) {
132
+                        return false;
133
+                    }
134
+                }
135
+            }
136
+            return true;
137
+        } catch(NotFoundException $e) {
138
+            return false;
139
+        }
140
+    }
141
+
142
+    /**
143
+     * Cache the file with AppData
144
+     * @param string $path
145
+     * @param string $fileNameCSS
146
+     * @param string $fileNameSCSS
147
+     * @param ISimpleFolder $folder
148
+     * @param string $webDir
149
+     * @return boolean
150
+     */
151
+    private function cache($path, $fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $webDir) {
152
+        $scss = new Compiler();
153
+        $scss->setImportPaths([
154
+            $path,
155
+            \OC::$SERVERROOT . '/core/css/',
156
+        ]);
157
+        if($this->config->getSystemValue('debug')) {
158
+            // Debug mode
159
+            $scss->setFormatter(Expanded::class);
160
+            $scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
161
+        } else {
162
+            // Compression
163
+            $scss->setFormatter(Crunched::class);
164
+        }
165
+
166
+        try {
167
+            $cachedfile = $folder->getFile($fileNameCSS);
168
+        } catch(NotFoundException $e) {
169
+            $cachedfile = $folder->newFile($fileNameCSS);
170
+        }
171
+
172
+        $depFileName = $fileNameCSS . '.deps';
173
+        try {
174
+            $depFile = $folder->getFile($depFileName);
175
+        } catch (NotFoundException $e) {
176
+            $depFile = $folder->newFile($depFileName);
177
+        }
178
+
179
+        // Compile
180
+        try {
181
+            $compiledScss = $scss->compile(
182
+                '@import "variables.scss";' .
183
+                '@import "'.$fileNameSCSS.'";');
184
+        } catch(ParserException $e) {
185
+            $this->logger->error($e, ['app' => 'core']);
186
+            return false;
187
+        }
188
+
189
+        // Gzip file
190
+        try {
191
+            $gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
192
+        } catch (NotFoundException $e) {
193
+            $gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
194
+        }
195
+
196
+        try {
197
+            $data = $this->rebaseUrls($compiledScss, $webDir);
198
+            $cachedfile->putContent($data);
199
+            $depFile->putContent(json_encode($scss->getParsedFiles()));
200
+            $gzipFile->putContent(gzencode($data, 9));
201
+            $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
202
+            return true;
203
+        } catch(NotPermittedException $e) {
204
+            return false;
205
+        }
206
+    }
207
+
208
+    /**
209
+     * Add the correct uri prefix to make uri valid again
210
+     * @param string $css
211
+     * @param string $webDir
212
+     * @return string
213
+     */
214
+    private function rebaseUrls($css, $webDir) {
215
+        $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
216
+        // OC\Route\Router:75
217
+        if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
218
+            $subst = 'url(\'../../'.$webDir.'/$1\')';	
219
+        } else {
220
+            $subst = 'url(\'../../../'.$webDir.'/$1\')';
221
+        }
222
+        return preg_replace($re, $subst, $css);
223
+    }
224
+
225
+    /**
226
+     * Return the cached css file uri
227
+     * @param string $appName the app name
228
+     * @param string $fileName
229
+     * @return string
230
+     */
231
+    public function getCachedSCSS($appName, $fileName) {
232
+        $tmpfileLoc = explode('/', $fileName);
233
+        $fileName = array_pop($tmpfileLoc);
234
+        $fileName = str_replace('.scss', '.css', $fileName);
235
+
236
+        return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
237
+    }
238 238
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
 	 * @return boolean
86 86
 	 */
87 87
 	public function process($root, $file, $app) {
88
-		$path = explode('/', $root . '/' . $file);
88
+		$path = explode('/', $root.'/'.$file);
89 89
 
90 90
 		$fileNameSCSS = array_pop($path);
91 91
 		$fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
92 92
 
93 93
 		$path = implode('/', $path);
94 94
 
95
-		$webDir = substr($path, strlen($this->serverRoot)+1);
95
+		$webDir = substr($path, strlen($this->serverRoot) + 1);
96 96
 
97 97
 		try {
98 98
 			$folder = $this->appData->getFolder($app);
99
-		} catch(NotFoundException $e) {
99
+		} catch (NotFoundException $e) {
100 100
 			// creating css appdata folder
101 101
 			$folder = $this->appData->newFolder($app);
102 102
 		}
103 103
 
104
-		if($this->isCached($fileNameCSS, $folder)) {
104
+		if ($this->isCached($fileNameCSS, $folder)) {
105 105
 			return true;
106 106
 		}
107 107
 		return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			$cachedFile = $folder->getFile($fileNameCSS);
119 119
 			if ($cachedFile->getSize() > 0) {
120
-				$depFileName = $fileNameCSS . '.deps';
121
-				$deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
120
+				$depFileName = $fileNameCSS.'.deps';
121
+				$deps = $this->depsCache->get($folder->getName().'-'.$depFileName);
122 122
 				if ($deps === null) {
123 123
 					$depFile = $folder->getFile($depFileName);
124 124
 					$deps = $depFile->getContent();
125 125
 					//Set to memcache for next run
126
-					$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
126
+					$this->depsCache->set($folder->getName().'-'.$depFileName, $deps);
127 127
 				}
128 128
 				$deps = json_decode($deps, true);
129 129
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				}
135 135
 			}
136 136
 			return true;
137
-		} catch(NotFoundException $e) {
137
+		} catch (NotFoundException $e) {
138 138
 			return false;
139 139
 		}
140 140
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		$scss = new Compiler();
153 153
 		$scss->setImportPaths([
154 154
 			$path,
155
-			\OC::$SERVERROOT . '/core/css/',
155
+			\OC::$SERVERROOT.'/core/css/',
156 156
 		]);
157
-		if($this->config->getSystemValue('debug')) {
157
+		if ($this->config->getSystemValue('debug')) {
158 158
 			// Debug mode
159 159
 			$scss->setFormatter(Expanded::class);
160 160
 			$scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 
166 166
 		try {
167 167
 			$cachedfile = $folder->getFile($fileNameCSS);
168
-		} catch(NotFoundException $e) {
168
+		} catch (NotFoundException $e) {
169 169
 			$cachedfile = $folder->newFile($fileNameCSS);
170 170
 		}
171 171
 
172
-		$depFileName = $fileNameCSS . '.deps';
172
+		$depFileName = $fileNameCSS.'.deps';
173 173
 		try {
174 174
 			$depFile = $folder->getFile($depFileName);
175 175
 		} catch (NotFoundException $e) {
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
 		// Compile
180 180
 		try {
181 181
 			$compiledScss = $scss->compile(
182
-				'@import "variables.scss";' .
182
+				'@import "variables.scss";'.
183 183
 				'@import "'.$fileNameSCSS.'";');
184
-		} catch(ParserException $e) {
184
+		} catch (ParserException $e) {
185 185
 			$this->logger->error($e, ['app' => 'core']);
186 186
 			return false;
187 187
 		}
188 188
 
189 189
 		// Gzip file
190 190
 		try {
191
-			$gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
191
+			$gzipFile = $folder->getFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz
192 192
 		} catch (NotFoundException $e) {
193
-			$gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
193
+			$gzipFile = $folder->newFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz
194 194
 		}
195 195
 
196 196
 		try {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$gzipFile->putContent(gzencode($data, 9));
201 201
 			$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
202 202
 			return true;
203
-		} catch(NotPermittedException $e) {
203
+		} catch (NotPermittedException $e) {
204 204
 			return false;
205 205
 		}
206 206
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	private function rebaseUrls($css, $webDir) {
215 215
 		$re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
216 216
 		// OC\Route\Router:75
217
-		if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
217
+		if (($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
218 218
 			$subst = 'url(\'../../'.$webDir.'/$1\')';	
219 219
 		} else {
220 220
 			$subst = 'url(\'../../../'.$webDir.'/$1\')';
Please login to merge, or discard this patch.
lib/private/Template/JSCombiner.php 2 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -32,178 +32,178 @@
 block discarded – undo
32 32
 
33 33
 class JSCombiner {
34 34
 
35
-	/** @var IAppData */
36
-	protected $appData;
37
-
38
-	/** @var IURLGenerator */
39
-	protected $urlGenerator;
40
-
41
-	/** @var ICache */
42
-	protected $depsCache;
43
-
44
-	/** @var SystemConfig */
45
-	protected $config;
46
-
47
-	/**
48
-	 * @param IAppData $appData
49
-	 * @param IURLGenerator $urlGenerator
50
-	 * @param ICache $depsCache
51
-	 * @param SystemConfig $config
52
-	 */
53
-	public function __construct(IAppData $appData,
54
-								IURLGenerator $urlGenerator,
55
-								ICache $depsCache,
56
-								SystemConfig $config) {
57
-		$this->appData = $appData;
58
-		$this->urlGenerator = $urlGenerator;
59
-		$this->depsCache = $depsCache;
60
-		$this->config = $config;
61
-	}
62
-
63
-	/**
64
-	 * @param string $root
65
-	 * @param string $file
66
-	 * @param string $app
67
-	 * @return bool
68
-	 */
69
-	public function process($root, $file, $app) {
70
-		if ($this->config->getValue('debug') || !$this->config->getValue('installed')) {
71
-			return false;
72
-		}
73
-
74
-		$path = explode('/', $root . '/' . $file);
75
-
76
-		$fileName = array_pop($path);
77
-		$path = implode('/', $path);
78
-
79
-		try {
80
-			$folder = $this->appData->getFolder($app);
81
-		} catch(NotFoundException $e) {
82
-			// creating css appdata folder
83
-			$folder = $this->appData->newFolder($app);
84
-		}
85
-
86
-		if($this->isCached($fileName, $folder)) {
87
-			return true;
88
-		}
89
-		return $this->cache($path, $fileName, $folder);
90
-	}
91
-
92
-	/**
93
-	 * @param string $fileName
94
-	 * @param ISimpleFolder $folder
95
-	 * @return bool
96
-	 */
97
-	protected function isCached($fileName, ISimpleFolder $folder) {
98
-		$fileName = str_replace('.json', '.js', $fileName) . '.deps';
99
-		try {
100
-			$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
101
-			if ($deps === null) {
102
-				$depFile = $folder->getFile($fileName);
103
-				$deps = $depFile->getContent();
104
-				$this->depsCache->set($folder->getName() . '-' . $fileName, $deps);
105
-			}
106
-			$deps = json_decode($deps, true);
107
-
108
-			foreach ($deps as $file=>$mtime) {
109
-				if (!file_exists($file) || filemtime($file) > $mtime) {
110
-					return false;
111
-				}
112
-			}
113
-
114
-			return true;
115
-		} catch(NotFoundException $e) {
116
-			return false;
117
-		}
118
-	}
119
-
120
-	/**
121
-	 * @param string $path
122
-	 * @param string $fileName
123
-	 * @param ISimpleFolder $folder
124
-	 * @return bool
125
-	 */
126
-	protected function cache($path, $fileName, ISimpleFolder $folder) {
127
-		$deps = [];
128
-		$fullPath = $path . '/' . $fileName;
129
-		$data = json_decode(file_get_contents($fullPath));
130
-		$deps[$fullPath] = filemtime($fullPath);
131
-
132
-		$res = '';
133
-		foreach ($data as $file) {
134
-			$filePath = $path . '/' . $file;
135
-
136
-			if (is_file($filePath)) {
137
-				$res .= file_get_contents($filePath);
138
-				$res .= PHP_EOL . PHP_EOL;
139
-				$deps[$filePath] = filemtime($filePath);
140
-			}
141
-		}
142
-
143
-		$fileName = str_replace('.json', '.js', $fileName);
144
-		try {
145
-			$cachedfile = $folder->getFile($fileName);
146
-		} catch(NotFoundException $e) {
147
-			$cachedfile = $folder->newFile($fileName);
148
-		}
149
-
150
-		$depFileName = $fileName . '.deps';
151
-		try {
152
-			$depFile = $folder->getFile($depFileName);
153
-		} catch (NotFoundException $e) {
154
-			$depFile = $folder->newFile($depFileName);
155
-		}
156
-
157
-		try {
158
-			$gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
159
-		} catch (NotFoundException $e) {
160
-			$gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz
161
-		}
162
-
163
-		try {
164
-			$cachedfile->putContent($res);
165
-			$depFile->putContent(json_encode($deps));
166
-			$gzipFile->putContent(gzencode($res, 9));
167
-			return true;
168
-		} catch (NotPermittedException $e) {
169
-			return false;
170
-		}
171
-	}
172
-
173
-	/**
174
-	 * @param string $appName
175
-	 * @param string $fileName
176
-	 * @return string
177
-	 */
178
-	public function getCachedJS($appName, $fileName) {
179
-		$tmpfileLoc = explode('/', $fileName);
180
-		$fileName = array_pop($tmpfileLoc);
181
-		$fileName = str_replace('.json', '.js', $fileName);
182
-
183
-		return substr($this->urlGenerator->linkToRoute('core.Js.getJs', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
184
-	}
185
-
186
-	/**
187
-	 * @param string $root
188
-	 * @param string $file
189
-	 * @return string[]
190
-	 */
191
-	public function getContent($root, $file) {
192
-		/** @var array $data */
193
-		$data = json_decode(file_get_contents($root . '/' . $file));
194
-		if(!is_array($data)) {
195
-			return [];
196
-		}
197
-
198
-		$path = explode('/', $file);
199
-		array_pop($path);
200
-		$path = implode('/', $path);
201
-
202
-		$result = [];
203
-		foreach ($data as $f) {
204
-			$result[] = $path . '/' . $f;
205
-		}
206
-
207
-		return $result;
208
-	}
35
+    /** @var IAppData */
36
+    protected $appData;
37
+
38
+    /** @var IURLGenerator */
39
+    protected $urlGenerator;
40
+
41
+    /** @var ICache */
42
+    protected $depsCache;
43
+
44
+    /** @var SystemConfig */
45
+    protected $config;
46
+
47
+    /**
48
+     * @param IAppData $appData
49
+     * @param IURLGenerator $urlGenerator
50
+     * @param ICache $depsCache
51
+     * @param SystemConfig $config
52
+     */
53
+    public function __construct(IAppData $appData,
54
+                                IURLGenerator $urlGenerator,
55
+                                ICache $depsCache,
56
+                                SystemConfig $config) {
57
+        $this->appData = $appData;
58
+        $this->urlGenerator = $urlGenerator;
59
+        $this->depsCache = $depsCache;
60
+        $this->config = $config;
61
+    }
62
+
63
+    /**
64
+     * @param string $root
65
+     * @param string $file
66
+     * @param string $app
67
+     * @return bool
68
+     */
69
+    public function process($root, $file, $app) {
70
+        if ($this->config->getValue('debug') || !$this->config->getValue('installed')) {
71
+            return false;
72
+        }
73
+
74
+        $path = explode('/', $root . '/' . $file);
75
+
76
+        $fileName = array_pop($path);
77
+        $path = implode('/', $path);
78
+
79
+        try {
80
+            $folder = $this->appData->getFolder($app);
81
+        } catch(NotFoundException $e) {
82
+            // creating css appdata folder
83
+            $folder = $this->appData->newFolder($app);
84
+        }
85
+
86
+        if($this->isCached($fileName, $folder)) {
87
+            return true;
88
+        }
89
+        return $this->cache($path, $fileName, $folder);
90
+    }
91
+
92
+    /**
93
+     * @param string $fileName
94
+     * @param ISimpleFolder $folder
95
+     * @return bool
96
+     */
97
+    protected function isCached($fileName, ISimpleFolder $folder) {
98
+        $fileName = str_replace('.json', '.js', $fileName) . '.deps';
99
+        try {
100
+            $deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
101
+            if ($deps === null) {
102
+                $depFile = $folder->getFile($fileName);
103
+                $deps = $depFile->getContent();
104
+                $this->depsCache->set($folder->getName() . '-' . $fileName, $deps);
105
+            }
106
+            $deps = json_decode($deps, true);
107
+
108
+            foreach ($deps as $file=>$mtime) {
109
+                if (!file_exists($file) || filemtime($file) > $mtime) {
110
+                    return false;
111
+                }
112
+            }
113
+
114
+            return true;
115
+        } catch(NotFoundException $e) {
116
+            return false;
117
+        }
118
+    }
119
+
120
+    /**
121
+     * @param string $path
122
+     * @param string $fileName
123
+     * @param ISimpleFolder $folder
124
+     * @return bool
125
+     */
126
+    protected function cache($path, $fileName, ISimpleFolder $folder) {
127
+        $deps = [];
128
+        $fullPath = $path . '/' . $fileName;
129
+        $data = json_decode(file_get_contents($fullPath));
130
+        $deps[$fullPath] = filemtime($fullPath);
131
+
132
+        $res = '';
133
+        foreach ($data as $file) {
134
+            $filePath = $path . '/' . $file;
135
+
136
+            if (is_file($filePath)) {
137
+                $res .= file_get_contents($filePath);
138
+                $res .= PHP_EOL . PHP_EOL;
139
+                $deps[$filePath] = filemtime($filePath);
140
+            }
141
+        }
142
+
143
+        $fileName = str_replace('.json', '.js', $fileName);
144
+        try {
145
+            $cachedfile = $folder->getFile($fileName);
146
+        } catch(NotFoundException $e) {
147
+            $cachedfile = $folder->newFile($fileName);
148
+        }
149
+
150
+        $depFileName = $fileName . '.deps';
151
+        try {
152
+            $depFile = $folder->getFile($depFileName);
153
+        } catch (NotFoundException $e) {
154
+            $depFile = $folder->newFile($depFileName);
155
+        }
156
+
157
+        try {
158
+            $gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
159
+        } catch (NotFoundException $e) {
160
+            $gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz
161
+        }
162
+
163
+        try {
164
+            $cachedfile->putContent($res);
165
+            $depFile->putContent(json_encode($deps));
166
+            $gzipFile->putContent(gzencode($res, 9));
167
+            return true;
168
+        } catch (NotPermittedException $e) {
169
+            return false;
170
+        }
171
+    }
172
+
173
+    /**
174
+     * @param string $appName
175
+     * @param string $fileName
176
+     * @return string
177
+     */
178
+    public function getCachedJS($appName, $fileName) {
179
+        $tmpfileLoc = explode('/', $fileName);
180
+        $fileName = array_pop($tmpfileLoc);
181
+        $fileName = str_replace('.json', '.js', $fileName);
182
+
183
+        return substr($this->urlGenerator->linkToRoute('core.Js.getJs', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
184
+    }
185
+
186
+    /**
187
+     * @param string $root
188
+     * @param string $file
189
+     * @return string[]
190
+     */
191
+    public function getContent($root, $file) {
192
+        /** @var array $data */
193
+        $data = json_decode(file_get_contents($root . '/' . $file));
194
+        if(!is_array($data)) {
195
+            return [];
196
+        }
197
+
198
+        $path = explode('/', $file);
199
+        array_pop($path);
200
+        $path = implode('/', $path);
201
+
202
+        $result = [];
203
+        foreach ($data as $f) {
204
+            $result[] = $path . '/' . $f;
205
+        }
206
+
207
+        return $result;
208
+    }
209 209
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
 			return false;
72 72
 		}
73 73
 
74
-		$path = explode('/', $root . '/' . $file);
74
+		$path = explode('/', $root.'/'.$file);
75 75
 
76 76
 		$fileName = array_pop($path);
77 77
 		$path = implode('/', $path);
78 78
 
79 79
 		try {
80 80
 			$folder = $this->appData->getFolder($app);
81
-		} catch(NotFoundException $e) {
81
+		} catch (NotFoundException $e) {
82 82
 			// creating css appdata folder
83 83
 			$folder = $this->appData->newFolder($app);
84 84
 		}
85 85
 
86
-		if($this->isCached($fileName, $folder)) {
86
+		if ($this->isCached($fileName, $folder)) {
87 87
 			return true;
88 88
 		}
89 89
 		return $this->cache($path, $fileName, $folder);
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 * @return bool
96 96
 	 */
97 97
 	protected function isCached($fileName, ISimpleFolder $folder) {
98
-		$fileName = str_replace('.json', '.js', $fileName) . '.deps';
98
+		$fileName = str_replace('.json', '.js', $fileName).'.deps';
99 99
 		try {
100
-			$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
100
+			$deps = $this->depsCache->get($folder->getName().'-'.$fileName);
101 101
 			if ($deps === null) {
102 102
 				$depFile = $folder->getFile($fileName);
103 103
 				$deps = $depFile->getContent();
104
-				$this->depsCache->set($folder->getName() . '-' . $fileName, $deps);
104
+				$this->depsCache->set($folder->getName().'-'.$fileName, $deps);
105 105
 			}
106 106
 			$deps = json_decode($deps, true);
107 107
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			return true;
115
-		} catch(NotFoundException $e) {
115
+		} catch (NotFoundException $e) {
116 116
 			return false;
117 117
 		}
118 118
 	}
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function cache($path, $fileName, ISimpleFolder $folder) {
127 127
 		$deps = [];
128
-		$fullPath = $path . '/' . $fileName;
128
+		$fullPath = $path.'/'.$fileName;
129 129
 		$data = json_decode(file_get_contents($fullPath));
130 130
 		$deps[$fullPath] = filemtime($fullPath);
131 131
 
132 132
 		$res = '';
133 133
 		foreach ($data as $file) {
134
-			$filePath = $path . '/' . $file;
134
+			$filePath = $path.'/'.$file;
135 135
 
136 136
 			if (is_file($filePath)) {
137 137
 				$res .= file_get_contents($filePath);
138
-				$res .= PHP_EOL . PHP_EOL;
138
+				$res .= PHP_EOL.PHP_EOL;
139 139
 				$deps[$filePath] = filemtime($filePath);
140 140
 			}
141 141
 		}
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 		$fileName = str_replace('.json', '.js', $fileName);
144 144
 		try {
145 145
 			$cachedfile = $folder->getFile($fileName);
146
-		} catch(NotFoundException $e) {
146
+		} catch (NotFoundException $e) {
147 147
 			$cachedfile = $folder->newFile($fileName);
148 148
 		}
149 149
 
150
-		$depFileName = $fileName . '.deps';
150
+		$depFileName = $fileName.'.deps';
151 151
 		try {
152 152
 			$depFile = $folder->getFile($depFileName);
153 153
 		} catch (NotFoundException $e) {
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		try {
158
-			$gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
158
+			$gzipFile = $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz
159 159
 		} catch (NotFoundException $e) {
160
-			$gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz
160
+			$gzipFile = $folder->newFile($fileName.'.gzip'); # Safari doesn't like .gz
161 161
 		}
162 162
 
163 163
 		try {
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function getContent($root, $file) {
192 192
 		/** @var array $data */
193
-		$data = json_decode(file_get_contents($root . '/' . $file));
194
-		if(!is_array($data)) {
193
+		$data = json_decode(file_get_contents($root.'/'.$file));
194
+		if (!is_array($data)) {
195 195
 			return [];
196 196
 		}
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 		$result = [];
203 203
 		foreach ($data as $f) {
204
-			$result[] = $path . '/' . $f;
204
+			$result[] = $path.'/'.$f;
205 205
 		}
206 206
 
207 207
 		return $result;
Please login to merge, or discard this patch.