Completed
Push — master ( a56ab6...23ba41 )
by Christoph
14:05 queued 02:25
created
lib/private/TemplateLayout.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 			parent::__construct( 'core', 'layout.user' );
62 62
 			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
63 63
 				$this->assign('bodyid', 'body-settings');
64
-			}else{
64
+			} else{
65 65
 				$this->assign('bodyid', 'body-user');
66 66
 			}
67 67
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,6 @@
 block discarded – undo
42 42
 use OC\Template\JSConfigHelper;
43 43
 use OC\Template\SCSSCacher;
44 44
 use OCP\Defaults;
45
-use OC\AppFramework\Http\Request;
46 45
 
47 46
 class TemplateLayout extends \OC_Template {
48 47
 
Please login to merge, or discard this patch.
Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -46,294 +46,294 @@
 block discarded – undo
46 46
 
47 47
 class TemplateLayout extends \OC_Template {
48 48
 
49
-	private static $versionHash = '';
50
-
51
-	/**
52
-	 * @var \OCP\IConfig
53
-	 */
54
-	private $config;
55
-
56
-	/**
57
-	 * @param string $renderAs
58
-	 * @param string $appId application id
59
-	 */
60
-	public function __construct( $renderAs, $appId = '' ) {
61
-
62
-		// yes - should be injected ....
63
-		$this->config = \OC::$server->getConfig();
64
-
65
-		if(\OCP\Util::isIE()) {
66
-			\OC_Util::addStyle('ie');
67
-		}
68
-
69
-		// Decide which page we show
70
-		if($renderAs == 'user') {
71
-			parent::__construct( 'core', 'layout.user' );
72
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
73
-				$this->assign('bodyid', 'body-settings');
74
-			}else{
75
-				$this->assign('bodyid', 'body-user');
76
-			}
77
-
78
-			// Code integrity notification
79
-			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
80
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
81
-				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
82
-			}
83
-
84
-			// Add navigation entry
85
-			$this->assign( 'application', '');
86
-			$this->assign( 'appid', $appId );
87
-			$navigation = \OC::$server->getNavigationManager()->getAll();
88
-			$this->assign( 'navigation', $navigation);
89
-			$settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings');
90
-			$this->assign( 'settingsnavigation', $settingsNavigation);
91
-			foreach($navigation as $entry) {
92
-				if ($entry['active']) {
93
-					$this->assign( 'application', $entry['name'] );
94
-					break;
95
-				}
96
-			}
97
-
98
-			foreach($settingsNavigation as $entry) {
99
-				if ($entry['active']) {
100
-					$this->assign( 'application', $entry['name'] );
101
-					break;
102
-				}
103
-			}
104
-			$userDisplayName = \OC_User::getDisplayName();
105
-			$this->assign('user_displayname', $userDisplayName);
106
-			$this->assign('user_uid', \OC_User::getUser());
107
-
108
-			if (\OC_User::getUser() === false) {
109
-				$this->assign('userAvatarSet', false);
110
-			} else {
111
-				$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
112
-				$this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
113
-			}
114
-
115
-			// check if app menu icons should be inverted
116
-			try {
117
-				/** @var \OCA\Theming\Util $util */
118
-				$util = \OC::$server->query(\OCA\Theming\Util::class);
119
-				$this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary()));
120
-			} catch (\OCP\AppFramework\QueryException $e) {
121
-				$this->assign('themingInvertMenu', false);
122
-			}
123
-
124
-		} else if ($renderAs == 'error') {
125
-			parent::__construct('core', 'layout.guest', '', false);
126
-			$this->assign('bodyid', 'body-login');
127
-		} else if ($renderAs == 'guest') {
128
-			parent::__construct('core', 'layout.guest');
129
-			\OC_Util::addStyle('guest');
130
-			$this->assign('bodyid', 'body-login');
131
-		} else if ($renderAs == 'public') {
132
-			parent::__construct('core', 'layout.public');
133
-			$this->assign( 'appid', $appId );
134
-			$this->assign('bodyid', 'body-public');
135
-			$this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false);
136
-		} else {
137
-			parent::__construct('core', 'layout.base');
138
-
139
-		}
140
-		// Send the language and the locale to our layouts
141
-		$lang = \OC::$server->getL10NFactory()->findLanguage();
142
-		$locale = \OC::$server->getL10NFactory()->findLocale($lang);
143
-		$localeLang = \OC::$server->getL10NFactory()->findLanguageFromLocale('lib', $locale);
144
-
145
-		$lang = str_replace('_', '-', $lang);
146
-		$this->assign('language', $lang);
147
-		$this->assign('locale', $locale);
148
-
149
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
150
-			if (empty(self::$versionHash)) {
151
-				$v = \OC_App::getAppVersions();
152
-				$v['core'] = implode('.', \OCP\Util::getVersion());
153
-				self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
154
-			}
155
-		} else {
156
-			self::$versionHash = md5('not installed');
157
-		}
158
-
159
-		// Add the js files
160
-		$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
161
-		$this->assign('jsfiles', array());
162
-		if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
163
-			if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
164
-				$jsConfigHelper = new JSConfigHelper(
165
-					\OC::$server->getL10N('lib', $localeLang ?: $lang),
166
-					\OC::$server->query(Defaults::class),
167
-					\OC::$server->getAppManager(),
168
-					\OC::$server->getSession(),
169
-					\OC::$server->getUserSession()->getUser(),
170
-					$this->config,
171
-					\OC::$server->getGroupManager(),
172
-					\OC::$server->getIniWrapper(),
173
-					\OC::$server->getURLGenerator(),
174
-					\OC::$server->getCapabilitiesManager()
175
-				);
176
-				$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
177
-			} else {
178
-				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
179
-			}
180
-		}
181
-		foreach($jsFiles as $info) {
182
-			$web = $info[1];
183
-			$file = $info[2];
184
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
185
-		}
186
-
187
-		try {
188
-			$pathInfo = \OC::$server->getRequest()->getPathInfo();
189
-		} catch (\Exception $e) {
190
-			$pathInfo = '';
191
-		}
192
-
193
-		// Do not initialise scss appdata until we have a fully installed instance
194
-		// Do not load scss for update, errors, installation or login page
195
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
196
-			&& !\OCP\Util::needUpgrade()
197
-			&& $pathInfo !== ''
198
-			&& !preg_match('/^\/login/', $pathInfo)
199
-			&& $renderAs !== 'error'
200
-		) {
201
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
202
-		} else {
203
-			// If we ignore the scss compiler,
204
-			// we need to load the guest css fallback
205
-			\OC_Util::addStyle('guest');
206
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
207
-		}
208
-
209
-		$this->assign('cssfiles', array());
210
-		$this->assign('printcssfiles', []);
211
-		$this->assign('versionHash', self::$versionHash);
212
-		foreach($cssFiles as $info) {
213
-			$web = $info[1];
214
-			$file = $info[2];
215
-
216
-			if (substr($file, -strlen('print.css')) === 'print.css') {
217
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
218
-			} else {
219
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
220
-			}
221
-		}
222
-	}
223
-
224
-	/**
225
-	 * @param string $path
226
- 	 * @param string $file
227
-	 * @return string
228
-	 */
229
-	protected function getVersionHashSuffix($path = false, $file = false) {
230
-		if ($this->config->getSystemValue('debug', false)) {
231
-			// allows chrome workspace mapping in debug mode
232
-			return "";
233
-		}
234
-		$themingSuffix = '';
235
-		$v = [];
236
-
237
-		if ($this->config->getSystemValue('installed', false)) {
238
-			if (\OC::$server->getAppManager()->isInstalled('theming')) {
239
-				$themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
240
-			}
241
-			$v = \OC_App::getAppVersions();
242
-		}
243
-
244
-		// Try the webroot path for a match
245
-		if ($path !== false && $path !== '') {
246
-			$appName = $this->getAppNamefromPath($path);
247
-			if(array_key_exists($appName, $v)) {
248
-				$appVersion = $v[$appName];
249
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
250
-			}
251
-		}
252
-		// fallback to the file path instead
253
-		if ($file !== false && $file !== '') {
254
-			$appName = $this->getAppNamefromPath($file);
255
-			if(array_key_exists($appName, $v)) {
256
-				$appVersion = $v[$appName];
257
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
258
-			}
259
-		}
260
-
261
-		return '?v=' . self::$versionHash . $themingSuffix;
262
-	}
263
-
264
-	/**
265
-	 * @param array $styles
266
-	 * @return array
267
-	 */
268
-	static public function findStylesheetFiles($styles, $compileScss = true) {
269
-		// Read the selected theme from the config file
270
-		$theme = \OC_Util::getTheme();
271
-
272
-		if($compileScss) {
273
-			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
274
-		} else {
275
-			$SCSSCacher = null;
276
-		}
277
-
278
-		$locator = new \OC\Template\CSSResourceLocator(
279
-			\OC::$server->getLogger(),
280
-			$theme,
281
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
282
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
283
-			$SCSSCacher
284
-		);
285
-		$locator->find($styles);
286
-		return $locator->getResources();
287
-	}
288
-
289
-	/**
290
-	 * @param string $path
291
-	 * @return string|boolean
292
-	 */
293
-	public function getAppNamefromPath($path) {
294
-		if ($path !== '' && is_string($path)) {
295
-			$pathParts = explode('/', $path);
296
-			if ($pathParts[0] === 'css') {
297
-				// This is a scss request
298
-				return $pathParts[1];
299
-			}
300
-			return end($pathParts);
301
-		}
302
-		return false;
303
-
304
-	}
305
-
306
-	/**
307
-	 * @param array $scripts
308
-	 * @return array
309
-	 */
310
-	static public function findJavascriptFiles($scripts) {
311
-		// Read the selected theme from the config file
312
-		$theme = \OC_Util::getTheme();
313
-
314
-		$locator = new \OC\Template\JSResourceLocator(
315
-			\OC::$server->getLogger(),
316
-			$theme,
317
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
318
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
319
-			\OC::$server->query(JSCombiner::class)
320
-			);
321
-		$locator->find($scripts);
322
-		return $locator->getResources();
323
-	}
324
-
325
-	/**
326
-	 * Converts the absolute file path to a relative path from \OC::$SERVERROOT
327
-	 * @param string $filePath Absolute path
328
-	 * @return string Relative path
329
-	 * @throws \Exception If $filePath is not under \OC::$SERVERROOT
330
-	 */
331
-	public static function convertToRelativePath($filePath) {
332
-		$relativePath = explode(\OC::$SERVERROOT, $filePath);
333
-		if(count($relativePath) !== 2) {
334
-			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
335
-		}
336
-
337
-		return $relativePath[1];
338
-	}
49
+    private static $versionHash = '';
50
+
51
+    /**
52
+     * @var \OCP\IConfig
53
+     */
54
+    private $config;
55
+
56
+    /**
57
+     * @param string $renderAs
58
+     * @param string $appId application id
59
+     */
60
+    public function __construct( $renderAs, $appId = '' ) {
61
+
62
+        // yes - should be injected ....
63
+        $this->config = \OC::$server->getConfig();
64
+
65
+        if(\OCP\Util::isIE()) {
66
+            \OC_Util::addStyle('ie');
67
+        }
68
+
69
+        // Decide which page we show
70
+        if($renderAs == 'user') {
71
+            parent::__construct( 'core', 'layout.user' );
72
+            if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
73
+                $this->assign('bodyid', 'body-settings');
74
+            }else{
75
+                $this->assign('bodyid', 'body-user');
76
+            }
77
+
78
+            // Code integrity notification
79
+            $integrityChecker = \OC::$server->getIntegrityCodeChecker();
80
+            if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
81
+                \OCP\Util::addScript('core', 'integritycheck-failed-notification');
82
+            }
83
+
84
+            // Add navigation entry
85
+            $this->assign( 'application', '');
86
+            $this->assign( 'appid', $appId );
87
+            $navigation = \OC::$server->getNavigationManager()->getAll();
88
+            $this->assign( 'navigation', $navigation);
89
+            $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings');
90
+            $this->assign( 'settingsnavigation', $settingsNavigation);
91
+            foreach($navigation as $entry) {
92
+                if ($entry['active']) {
93
+                    $this->assign( 'application', $entry['name'] );
94
+                    break;
95
+                }
96
+            }
97
+
98
+            foreach($settingsNavigation as $entry) {
99
+                if ($entry['active']) {
100
+                    $this->assign( 'application', $entry['name'] );
101
+                    break;
102
+                }
103
+            }
104
+            $userDisplayName = \OC_User::getDisplayName();
105
+            $this->assign('user_displayname', $userDisplayName);
106
+            $this->assign('user_uid', \OC_User::getUser());
107
+
108
+            if (\OC_User::getUser() === false) {
109
+                $this->assign('userAvatarSet', false);
110
+            } else {
111
+                $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
112
+                $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
113
+            }
114
+
115
+            // check if app menu icons should be inverted
116
+            try {
117
+                /** @var \OCA\Theming\Util $util */
118
+                $util = \OC::$server->query(\OCA\Theming\Util::class);
119
+                $this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary()));
120
+            } catch (\OCP\AppFramework\QueryException $e) {
121
+                $this->assign('themingInvertMenu', false);
122
+            }
123
+
124
+        } else if ($renderAs == 'error') {
125
+            parent::__construct('core', 'layout.guest', '', false);
126
+            $this->assign('bodyid', 'body-login');
127
+        } else if ($renderAs == 'guest') {
128
+            parent::__construct('core', 'layout.guest');
129
+            \OC_Util::addStyle('guest');
130
+            $this->assign('bodyid', 'body-login');
131
+        } else if ($renderAs == 'public') {
132
+            parent::__construct('core', 'layout.public');
133
+            $this->assign( 'appid', $appId );
134
+            $this->assign('bodyid', 'body-public');
135
+            $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false);
136
+        } else {
137
+            parent::__construct('core', 'layout.base');
138
+
139
+        }
140
+        // Send the language and the locale to our layouts
141
+        $lang = \OC::$server->getL10NFactory()->findLanguage();
142
+        $locale = \OC::$server->getL10NFactory()->findLocale($lang);
143
+        $localeLang = \OC::$server->getL10NFactory()->findLanguageFromLocale('lib', $locale);
144
+
145
+        $lang = str_replace('_', '-', $lang);
146
+        $this->assign('language', $lang);
147
+        $this->assign('locale', $locale);
148
+
149
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
150
+            if (empty(self::$versionHash)) {
151
+                $v = \OC_App::getAppVersions();
152
+                $v['core'] = implode('.', \OCP\Util::getVersion());
153
+                self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
154
+            }
155
+        } else {
156
+            self::$versionHash = md5('not installed');
157
+        }
158
+
159
+        // Add the js files
160
+        $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
161
+        $this->assign('jsfiles', array());
162
+        if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
163
+            if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
164
+                $jsConfigHelper = new JSConfigHelper(
165
+                    \OC::$server->getL10N('lib', $localeLang ?: $lang),
166
+                    \OC::$server->query(Defaults::class),
167
+                    \OC::$server->getAppManager(),
168
+                    \OC::$server->getSession(),
169
+                    \OC::$server->getUserSession()->getUser(),
170
+                    $this->config,
171
+                    \OC::$server->getGroupManager(),
172
+                    \OC::$server->getIniWrapper(),
173
+                    \OC::$server->getURLGenerator(),
174
+                    \OC::$server->getCapabilitiesManager()
175
+                );
176
+                $this->assign('inline_ocjs', $jsConfigHelper->getConfig());
177
+            } else {
178
+                $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
179
+            }
180
+        }
181
+        foreach($jsFiles as $info) {
182
+            $web = $info[1];
183
+            $file = $info[2];
184
+            $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
185
+        }
186
+
187
+        try {
188
+            $pathInfo = \OC::$server->getRequest()->getPathInfo();
189
+        } catch (\Exception $e) {
190
+            $pathInfo = '';
191
+        }
192
+
193
+        // Do not initialise scss appdata until we have a fully installed instance
194
+        // Do not load scss for update, errors, installation or login page
195
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)
196
+            && !\OCP\Util::needUpgrade()
197
+            && $pathInfo !== ''
198
+            && !preg_match('/^\/login/', $pathInfo)
199
+            && $renderAs !== 'error'
200
+        ) {
201
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
202
+        } else {
203
+            // If we ignore the scss compiler,
204
+            // we need to load the guest css fallback
205
+            \OC_Util::addStyle('guest');
206
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
207
+        }
208
+
209
+        $this->assign('cssfiles', array());
210
+        $this->assign('printcssfiles', []);
211
+        $this->assign('versionHash', self::$versionHash);
212
+        foreach($cssFiles as $info) {
213
+            $web = $info[1];
214
+            $file = $info[2];
215
+
216
+            if (substr($file, -strlen('print.css')) === 'print.css') {
217
+                $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
218
+            } else {
219
+                $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
220
+            }
221
+        }
222
+    }
223
+
224
+    /**
225
+     * @param string $path
226
+     * @param string $file
227
+     * @return string
228
+     */
229
+    protected function getVersionHashSuffix($path = false, $file = false) {
230
+        if ($this->config->getSystemValue('debug', false)) {
231
+            // allows chrome workspace mapping in debug mode
232
+            return "";
233
+        }
234
+        $themingSuffix = '';
235
+        $v = [];
236
+
237
+        if ($this->config->getSystemValue('installed', false)) {
238
+            if (\OC::$server->getAppManager()->isInstalled('theming')) {
239
+                $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
240
+            }
241
+            $v = \OC_App::getAppVersions();
242
+        }
243
+
244
+        // Try the webroot path for a match
245
+        if ($path !== false && $path !== '') {
246
+            $appName = $this->getAppNamefromPath($path);
247
+            if(array_key_exists($appName, $v)) {
248
+                $appVersion = $v[$appName];
249
+                return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
250
+            }
251
+        }
252
+        // fallback to the file path instead
253
+        if ($file !== false && $file !== '') {
254
+            $appName = $this->getAppNamefromPath($file);
255
+            if(array_key_exists($appName, $v)) {
256
+                $appVersion = $v[$appName];
257
+                return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
258
+            }
259
+        }
260
+
261
+        return '?v=' . self::$versionHash . $themingSuffix;
262
+    }
263
+
264
+    /**
265
+     * @param array $styles
266
+     * @return array
267
+     */
268
+    static public function findStylesheetFiles($styles, $compileScss = true) {
269
+        // Read the selected theme from the config file
270
+        $theme = \OC_Util::getTheme();
271
+
272
+        if($compileScss) {
273
+            $SCSSCacher = \OC::$server->query(SCSSCacher::class);
274
+        } else {
275
+            $SCSSCacher = null;
276
+        }
277
+
278
+        $locator = new \OC\Template\CSSResourceLocator(
279
+            \OC::$server->getLogger(),
280
+            $theme,
281
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
282
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
283
+            $SCSSCacher
284
+        );
285
+        $locator->find($styles);
286
+        return $locator->getResources();
287
+    }
288
+
289
+    /**
290
+     * @param string $path
291
+     * @return string|boolean
292
+     */
293
+    public function getAppNamefromPath($path) {
294
+        if ($path !== '' && is_string($path)) {
295
+            $pathParts = explode('/', $path);
296
+            if ($pathParts[0] === 'css') {
297
+                // This is a scss request
298
+                return $pathParts[1];
299
+            }
300
+            return end($pathParts);
301
+        }
302
+        return false;
303
+
304
+    }
305
+
306
+    /**
307
+     * @param array $scripts
308
+     * @return array
309
+     */
310
+    static public function findJavascriptFiles($scripts) {
311
+        // Read the selected theme from the config file
312
+        $theme = \OC_Util::getTheme();
313
+
314
+        $locator = new \OC\Template\JSResourceLocator(
315
+            \OC::$server->getLogger(),
316
+            $theme,
317
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
318
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
319
+            \OC::$server->query(JSCombiner::class)
320
+            );
321
+        $locator->find($scripts);
322
+        return $locator->getResources();
323
+    }
324
+
325
+    /**
326
+     * Converts the absolute file path to a relative path from \OC::$SERVERROOT
327
+     * @param string $filePath Absolute path
328
+     * @return string Relative path
329
+     * @throws \Exception If $filePath is not under \OC::$SERVERROOT
330
+     */
331
+    public static function convertToRelativePath($filePath) {
332
+        $relativePath = explode(\OC::$SERVERROOT, $filePath);
333
+        if(count($relativePath) !== 2) {
334
+            throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
335
+        }
336
+
337
+        return $relativePath[1];
338
+    }
339 339
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -57,47 +57,47 @@  discard block
 block discarded – undo
57 57
 	 * @param string $renderAs
58 58
 	 * @param string $appId application id
59 59
 	 */
60
-	public function __construct( $renderAs, $appId = '' ) {
60
+	public function __construct($renderAs, $appId = '') {
61 61
 
62 62
 		// yes - should be injected ....
63 63
 		$this->config = \OC::$server->getConfig();
64 64
 
65
-		if(\OCP\Util::isIE()) {
65
+		if (\OCP\Util::isIE()) {
66 66
 			\OC_Util::addStyle('ie');
67 67
 		}
68 68
 
69 69
 		// Decide which page we show
70
-		if($renderAs == 'user') {
71
-			parent::__construct( 'core', 'layout.user' );
72
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
70
+		if ($renderAs == 'user') {
71
+			parent::__construct('core', 'layout.user');
72
+			if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
73 73
 				$this->assign('bodyid', 'body-settings');
74
-			}else{
74
+			} else {
75 75
 				$this->assign('bodyid', 'body-user');
76 76
 			}
77 77
 
78 78
 			// Code integrity notification
79 79
 			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
80
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
80
+			if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
81 81
 				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
82 82
 			}
83 83
 
84 84
 			// Add navigation entry
85
-			$this->assign( 'application', '');
86
-			$this->assign( 'appid', $appId );
85
+			$this->assign('application', '');
86
+			$this->assign('appid', $appId);
87 87
 			$navigation = \OC::$server->getNavigationManager()->getAll();
88
-			$this->assign( 'navigation', $navigation);
88
+			$this->assign('navigation', $navigation);
89 89
 			$settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings');
90
-			$this->assign( 'settingsnavigation', $settingsNavigation);
91
-			foreach($navigation as $entry) {
90
+			$this->assign('settingsnavigation', $settingsNavigation);
91
+			foreach ($navigation as $entry) {
92 92
 				if ($entry['active']) {
93
-					$this->assign( 'application', $entry['name'] );
93
+					$this->assign('application', $entry['name']);
94 94
 					break;
95 95
 				}
96 96
 			}
97 97
 
98
-			foreach($settingsNavigation as $entry) {
98
+			foreach ($settingsNavigation as $entry) {
99 99
 				if ($entry['active']) {
100
-					$this->assign( 'application', $entry['name'] );
100
+					$this->assign('application', $entry['name']);
101 101
 					break;
102 102
 				}
103 103
 			}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			$this->assign('bodyid', 'body-login');
131 131
 		} else if ($renderAs == 'public') {
132 132
 			parent::__construct('core', 'layout.public');
133
-			$this->assign( 'appid', $appId );
133
+			$this->assign('appid', $appId);
134 134
 			$this->assign('bodyid', 'body-public');
135 135
 			$this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false);
136 136
 		} else {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$this->assign('language', $lang);
147 147
 		$this->assign('locale', $locale);
148 148
 
149
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
149
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
150 150
 			if (empty(self::$versionHash)) {
151 151
 				$v = \OC_App::getAppVersions();
152 152
 				$v['core'] = implode('.', \OCP\Util::getVersion());
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
179 179
 			}
180 180
 		}
181
-		foreach($jsFiles as $info) {
181
+		foreach ($jsFiles as $info) {
182 182
 			$web = $info[1];
183 183
 			$file = $info[2];
184
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
184
+			$this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix());
185 185
 		}
186 186
 
187 187
 		try {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 		// Do not initialise scss appdata until we have a fully installed instance
194 194
 		// Do not load scss for update, errors, installation or login page
195
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
195
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)
196 196
 			&& !\OCP\Util::needUpgrade()
197 197
 			&& $pathInfo !== ''
198 198
 			&& !preg_match('/^\/login/', $pathInfo)
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 		$this->assign('cssfiles', array());
210 210
 		$this->assign('printcssfiles', []);
211 211
 		$this->assign('versionHash', self::$versionHash);
212
-		foreach($cssFiles as $info) {
212
+		foreach ($cssFiles as $info) {
213 213
 			$web = $info[1];
214 214
 			$file = $info[2];
215 215
 
216 216
 			if (substr($file, -strlen('print.css')) === 'print.css') {
217
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
217
+				$this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
218 218
 			} else {
219
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file)  );
219
+				$this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix($web, $file));
220 220
 			}
221 221
 		}
222 222
 	}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		if ($this->config->getSystemValue('installed', false)) {
238 238
 			if (\OC::$server->getAppManager()->isInstalled('theming')) {
239
-				$themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
239
+				$themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0');
240 240
 			}
241 241
 			$v = \OC_App::getAppVersions();
242 242
 		}
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
 		// Try the webroot path for a match
245 245
 		if ($path !== false && $path !== '') {
246 246
 			$appName = $this->getAppNamefromPath($path);
247
-			if(array_key_exists($appName, $v)) {
247
+			if (array_key_exists($appName, $v)) {
248 248
 				$appVersion = $v[$appName];
249
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
249
+				return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix;
250 250
 			}
251 251
 		}
252 252
 		// fallback to the file path instead
253 253
 		if ($file !== false && $file !== '') {
254 254
 			$appName = $this->getAppNamefromPath($file);
255
-			if(array_key_exists($appName, $v)) {
255
+			if (array_key_exists($appName, $v)) {
256 256
 				$appVersion = $v[$appName];
257
-				return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
257
+				return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix;
258 258
 			}
259 259
 		}
260 260
 
261
-		return '?v=' . self::$versionHash . $themingSuffix;
261
+		return '?v='.self::$versionHash.$themingSuffix;
262 262
 	}
263 263
 
264 264
 	/**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		// Read the selected theme from the config file
270 270
 		$theme = \OC_Util::getTheme();
271 271
 
272
-		if($compileScss) {
272
+		if ($compileScss) {
273 273
 			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
274 274
 		} else {
275 275
 			$SCSSCacher = null;
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 		$locator = new \OC\Template\CSSResourceLocator(
279 279
 			\OC::$server->getLogger(),
280 280
 			$theme,
281
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
282
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
281
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
282
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
283 283
 			$SCSSCacher
284 284
 		);
285 285
 		$locator->find($styles);
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 		$locator = new \OC\Template\JSResourceLocator(
315 315
 			\OC::$server->getLogger(),
316 316
 			$theme,
317
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
318
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
317
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
318
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
319 319
 			\OC::$server->query(JSCombiner::class)
320 320
 			);
321 321
 		$locator->find($scripts);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	public static function convertToRelativePath($filePath) {
332 332
 		$relativePath = explode(\OC::$SERVERROOT, $filePath);
333
-		if(count($relativePath) !== 2) {
333
+		if (count($relativePath) !== 2) {
334 334
 			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
335 335
 		}
336 336
 
Please login to merge, or discard this patch.
lib/private/Migration/BackgroundRepair.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function execute($jobList, ILogger $logger = null) {
59 59
 		// add an interval of 15 mins
60
-		$this->setInterval(15*60);
60
+		$this->setInterval(15 * 60);
61 61
 
62 62
 		$this->jobList = $jobList;
63 63
 		$this->logger = $logger;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		try {
91 91
 			$repair->addStep($step);
92 92
 		} catch (\Exception $ex) {
93
-			$this->logger->logException($ex,[
93
+			$this->logger->logException($ex, [
94 94
 				'app' => 'migration'
95 95
 			]);
96 96
 
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,81 +37,81 @@
 block discarded – undo
37 37
  */
38 38
 class BackgroundRepair extends TimedJob {
39 39
 
40
-	/** @var IJobList */
41
-	private $jobList;
40
+    /** @var IJobList */
41
+    private $jobList;
42 42
 
43
-	/** @var ILogger */
44
-	private $logger;
43
+    /** @var ILogger */
44
+    private $logger;
45 45
 
46
-	/** @var EventDispatcher */
47
-	private $dispatcher;
46
+    /** @var EventDispatcher */
47
+    private $dispatcher;
48 48
 
49
-	public function setDispatcher(EventDispatcher $dispatcher) {
50
-		$this->dispatcher = $dispatcher;
51
-	}
52
-	/**
53
-	 * run the job, then remove it from the job list
54
-	 *
55
-	 * @param JobList $jobList
56
-	 * @param ILogger|null $logger
57
-	 */
58
-	public function execute($jobList, ILogger $logger = null) {
59
-		// add an interval of 15 mins
60
-		$this->setInterval(15*60);
49
+    public function setDispatcher(EventDispatcher $dispatcher) {
50
+        $this->dispatcher = $dispatcher;
51
+    }
52
+    /**
53
+     * run the job, then remove it from the job list
54
+     *
55
+     * @param JobList $jobList
56
+     * @param ILogger|null $logger
57
+     */
58
+    public function execute($jobList, ILogger $logger = null) {
59
+        // add an interval of 15 mins
60
+        $this->setInterval(15*60);
61 61
 
62
-		$this->jobList = $jobList;
63
-		$this->logger = $logger;
64
-		parent::execute($jobList, $logger);
65
-	}
62
+        $this->jobList = $jobList;
63
+        $this->logger = $logger;
64
+        parent::execute($jobList, $logger);
65
+    }
66 66
 
67
-	/**
68
-	 * @param array $argument
69
-	 * @throws \Exception
70
-	 * @throws \OC\NeedsUpdateException
71
-	 */
72
-	protected function run($argument) {
73
-		if (!isset($argument['app']) || !isset($argument['step'])) {
74
-			// remove the job - we can never execute it
75
-			$this->jobList->remove($this, $this->argument);
76
-			return;
77
-		}
78
-		$app = $argument['app'];
67
+    /**
68
+     * @param array $argument
69
+     * @throws \Exception
70
+     * @throws \OC\NeedsUpdateException
71
+     */
72
+    protected function run($argument) {
73
+        if (!isset($argument['app']) || !isset($argument['step'])) {
74
+            // remove the job - we can never execute it
75
+            $this->jobList->remove($this, $this->argument);
76
+            return;
77
+        }
78
+        $app = $argument['app'];
79 79
 
80
-		try {
81
-			$this->loadApp($app);
82
-		} catch (NeedsUpdateException $ex) {
83
-			// as long as the app is not yet done with it's offline migration
84
-			// we better not start with the live migration
85
-			return;
86
-		}
80
+        try {
81
+            $this->loadApp($app);
82
+        } catch (NeedsUpdateException $ex) {
83
+            // as long as the app is not yet done with it's offline migration
84
+            // we better not start with the live migration
85
+            return;
86
+        }
87 87
 
88
-		$step = $argument['step'];
89
-		$repair = new Repair([], $this->dispatcher);
90
-		try {
91
-			$repair->addStep($step);
92
-		} catch (\Exception $ex) {
93
-			$this->logger->logException($ex,[
94
-				'app' => 'migration'
95
-			]);
88
+        $step = $argument['step'];
89
+        $repair = new Repair([], $this->dispatcher);
90
+        try {
91
+            $repair->addStep($step);
92
+        } catch (\Exception $ex) {
93
+            $this->logger->logException($ex,[
94
+                'app' => 'migration'
95
+            ]);
96 96
 
97
-			// remove the job - we can never execute it
98
-			$this->jobList->remove($this, $this->argument);
99
-			return;
100
-		}
97
+            // remove the job - we can never execute it
98
+            $this->jobList->remove($this, $this->argument);
99
+            return;
100
+        }
101 101
 
102
-		// execute the repair step
103
-		$repair->run();
102
+        // execute the repair step
103
+        $repair->run();
104 104
 
105
-		// remove the job once executed successfully
106
-		$this->jobList->remove($this, $this->argument);
107
-	}
105
+        // remove the job once executed successfully
106
+        $this->jobList->remove($this, $this->argument);
107
+    }
108 108
 
109
-	/**
110
-	 * @codeCoverageIgnore
111
-	 * @param $app
112
-	 * @throws NeedsUpdateException
113
-	 */
114
-	protected function loadApp($app) {
115
-		OC_App::loadApp($app);
116
-	}
109
+    /**
110
+     * @codeCoverageIgnore
111
+     * @param $app
112
+     * @throws NeedsUpdateException
113
+     */
114
+    protected function loadApp($app) {
115
+        OC_App::loadApp($app);
116
+    }
117 117
 }
Please login to merge, or discard this patch.
lib/private/Command/QueueBus.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		if ($command instanceof ICommand) {
56 56
 			// ensure the command can be serialized
57 57
 			$serialized = serialize($command);
58
-			if(strlen($serialized) > 4000) {
58
+			if (strlen($serialized) > 4000) {
59 59
 				throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
60 60
 			}
61 61
 			$unserialized = unserialize($serialized);
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -26,48 +26,48 @@
 block discarded – undo
26 26
 use OCP\Command\ICommand;
27 27
 
28 28
 class QueueBus implements IBus {
29
-	/**
30
-	 * @var ICommand[]|callable[]
31
-	 */
32
-	private $queue = [];
29
+    /**
30
+     * @var ICommand[]|callable[]
31
+     */
32
+    private $queue = [];
33 33
 
34
-	/**
35
-	 * Schedule a command to be fired
36
-	 *
37
-	 * @param \OCP\Command\ICommand | callable $command
38
-	 */
39
-	public function push($command) {
40
-		$this->queue[] = $command;
41
-	}
34
+    /**
35
+     * Schedule a command to be fired
36
+     *
37
+     * @param \OCP\Command\ICommand | callable $command
38
+     */
39
+    public function push($command) {
40
+        $this->queue[] = $command;
41
+    }
42 42
 
43
-	/**
44
-	 * Require all commands using a trait to be run synchronous
45
-	 *
46
-	 * @param string $trait
47
-	 */
48
-	public function requireSync($trait) {
49
-	}
43
+    /**
44
+     * Require all commands using a trait to be run synchronous
45
+     *
46
+     * @param string $trait
47
+     */
48
+    public function requireSync($trait) {
49
+    }
50 50
 
51
-	/**
52
-	 * @param \OCP\Command\ICommand | callable $command
53
-	 */
54
-	private function runCommand($command) {
55
-		if ($command instanceof ICommand) {
56
-			// ensure the command can be serialized
57
-			$serialized = serialize($command);
58
-			if(strlen($serialized) > 4000) {
59
-				throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
60
-			}
61
-			$unserialized = unserialize($serialized);
62
-			$unserialized->handle();
63
-		} else {
64
-			$command();
65
-		}
66
-	}
51
+    /**
52
+     * @param \OCP\Command\ICommand | callable $command
53
+     */
54
+    private function runCommand($command) {
55
+        if ($command instanceof ICommand) {
56
+            // ensure the command can be serialized
57
+            $serialized = serialize($command);
58
+            if(strlen($serialized) > 4000) {
59
+                throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
60
+            }
61
+            $unserialized = unserialize($serialized);
62
+            $unserialized->handle();
63
+        } else {
64
+            $command();
65
+        }
66
+    }
67 67
 
68
-	public function run() {
69
-		while ($command = array_shift($this->queue)) {
70
-			$this->runCommand($command);
71
-		}
72
-	}
68
+    public function run() {
69
+        while ($command = array_shift($this->queue)) {
70
+            $this->runCommand($command);
71
+        }
72
+    }
73 73
 }
Please login to merge, or discard this patch.
lib/private/Command/CallableJob.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
 use OC\BackgroundJob\QueuedJob;
26 26
 
27 27
 class CallableJob extends QueuedJob {
28
-	protected function run($serializedCallable) {
29
-		$callable = unserialize($serializedCallable);
30
-		if (is_callable($callable)) {
31
-			$callable();
32
-		} else {
33
-			throw new \InvalidArgumentException('Invalid serialized callable');
34
-		}
35
-	}
28
+    protected function run($serializedCallable) {
29
+        $callable = unserialize($serializedCallable);
30
+        if (is_callable($callable)) {
31
+            $callable();
32
+        } else {
33
+            throw new \InvalidArgumentException('Invalid serialized callable');
34
+        }
35
+    }
36 36
 }
Please login to merge, or discard this patch.
lib/private/Command/ClosureJob.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 use SuperClosure\Serializer;
27 27
 
28 28
 class ClosureJob extends QueuedJob {
29
-	protected function run($serializedCallable) {
30
-		$serializer = new Serializer();
31
-		$callable = $serializer->unserialize($serializedCallable);
32
-		if (is_callable($callable)) {
33
-			$callable();
34
-		} else {
35
-			throw new \InvalidArgumentException('Invalid serialized callable');
36
-		}
37
-	}
29
+    protected function run($serializedCallable) {
30
+        $serializer = new Serializer();
31
+        $callable = $serializer->unserialize($serializedCallable);
32
+        if (is_callable($callable)) {
33
+            $callable();
34
+        } else {
35
+            throw new \InvalidArgumentException('Invalid serialized callable');
36
+        }
37
+    }
38 38
 }
Please login to merge, or discard this patch.
lib/private/Command/FileAccess.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 trait FileAccess {
28
-	protected function setupFS(IUser $user){
29
-		\OC_Util::setupFS($user->getUID());
30
-	}
28
+    protected function setupFS(IUser $user){
29
+        \OC_Util::setupFS($user->getUID());
30
+    }
31 31
 
32
-	protected function getUserFolder(IUser $user) {
33
-		$this->setupFS($user);
34
-		return \OC::$server->getUserFolder($user->getUID());
35
-	}
32
+    protected function getUserFolder(IUser $user) {
33
+        $this->setupFS($user);
34
+        return \OC::$server->getUserFolder($user->getUID());
35
+    }
36 36
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 trait FileAccess {
28
-	protected function setupFS(IUser $user){
28
+	protected function setupFS(IUser $user) {
29 29
 		\OC_Util::setupFS($user->getUID());
30 30
 	}
31 31
 
Please login to merge, or discard this patch.
lib/private/Command/CommandJob.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
  * Wrap a command in the background job interface
30 30
  */
31 31
 class CommandJob extends QueuedJob {
32
-	protected function run($serializedCommand) {
33
-		$command = unserialize($serializedCommand);
34
-		if ($command instanceof ICommand) {
35
-			$command->handle();
36
-		} else {
37
-			throw new \InvalidArgumentException('Invalid serialized command');
38
-		}
39
-	}
32
+    protected function run($serializedCommand) {
33
+        $command = unserialize($serializedCommand);
34
+        if ($command instanceof ICommand) {
35
+            $command->handle();
36
+        } else {
37
+            throw new \InvalidArgumentException('Invalid serialized command');
38
+        }
39
+    }
40 40
 }
Please login to merge, or discard this patch.
lib/private/Template/ResourceNotFoundException.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,23 +24,23 @@
 block discarded – undo
24 24
 namespace OC\Template;
25 25
 
26 26
 class ResourceNotFoundException extends \LogicException {
27
-	protected $resource;
28
-	protected $webPath;
27
+    protected $resource;
28
+    protected $webPath;
29 29
 
30
-	/**
31
-	 * @param string $resource
32
-	 * @param string $webPath
33
-	 */
34
-	public function __construct($resource, $webPath) {
35
-		parent::__construct('Resource not found');
36
-		$this->resource = $resource;
37
-		$this->webPath = $webPath;
38
-	}
30
+    /**
31
+     * @param string $resource
32
+     * @param string $webPath
33
+     */
34
+    public function __construct($resource, $webPath) {
35
+        parent::__construct('Resource not found');
36
+        $this->resource = $resource;
37
+        $this->webPath = $webPath;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string
42
-	 */
43
-	public function getResourcePath() {
44
-		return $this->webPath . '/' . $this->resource;
45
-	}
40
+    /**
41
+     * @return string
42
+     */
43
+    public function getResourcePath() {
44
+        return $this->webPath . '/' . $this->resource;
45
+    }
46 46
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
41 41
 	 * @return string
42 42
 	 */
43 43
 	public function getResourcePath() {
44
-		return $this->webPath . '/' . $this->resource;
44
+		return $this->webPath.'/'.$this->resource;
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
lib/private/Template/TemplateFileLocator.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -26,37 +26,37 @@
 block discarded – undo
26 26
 namespace OC\Template;
27 27
 
28 28
 class TemplateFileLocator {
29
-	protected $dirs;
30
-	private $path;
29
+    protected $dirs;
30
+    private $path;
31 31
 
32
-	/**
33
-	 * @param string[] $dirs
34
-	 */
35
-	public function __construct( $dirs ) {
36
-		$this->dirs = $dirs;
37
-	}
32
+    /**
33
+     * @param string[] $dirs
34
+     */
35
+    public function __construct( $dirs ) {
36
+        $this->dirs = $dirs;
37
+    }
38 38
 
39
-	/**
40
-	 * @param string $template
41
-	 * @return string
42
-	 * @throws \Exception
43
-	 */
44
-	public function find( $template ) {
45
-		if ($template === '') {
46
-			throw new \InvalidArgumentException('Empty template name');
47
-		}
39
+    /**
40
+     * @param string $template
41
+     * @return string
42
+     * @throws \Exception
43
+     */
44
+    public function find( $template ) {
45
+        if ($template === '') {
46
+            throw new \InvalidArgumentException('Empty template name');
47
+        }
48 48
 
49
-		foreach($this->dirs as $dir) {
50
-			$file = $dir.$template.'.php';
51
-			if (is_file($file)) {
52
-				$this->path = $dir;
53
-				return $file;
54
-			}
55
-		}
56
-		throw new \Exception('template file not found: template:'.$template);
57
-	}
49
+        foreach($this->dirs as $dir) {
50
+            $file = $dir.$template.'.php';
51
+            if (is_file($file)) {
52
+                $this->path = $dir;
53
+                return $file;
54
+            }
55
+        }
56
+        throw new \Exception('template file not found: template:'.$template);
57
+    }
58 58
 
59
-	public function getPath() {
60
-		return $this->path;
61
-	}
59
+    public function getPath() {
60
+        return $this->path;
61
+    }
62 62
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param string[] $dirs
34 34
 	 */
35
-	public function __construct( $dirs ) {
35
+	public function __construct($dirs) {
36 36
 		$this->dirs = $dirs;
37 37
 	}
38 38
 
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @return string
42 42
 	 * @throws \Exception
43 43
 	 */
44
-	public function find( $template ) {
44
+	public function find($template) {
45 45
 		if ($template === '') {
46 46
 			throw new \InvalidArgumentException('Empty template name');
47 47
 		}
48 48
 
49
-		foreach($this->dirs as $dir) {
49
+		foreach ($this->dirs as $dir) {
50 50
 			$file = $dir.$template.'.php';
51 51
 			if (is_file($file)) {
52 52
 				$this->path = $dir;
Please login to merge, or discard this patch.