Completed
Pull Request — master (#4905)
by Joas
15:01
created
lib/private/ServerContainer.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -34,101 +34,101 @@
 block discarded – undo
34 34
  * @package OC
35 35
  */
36 36
 class ServerContainer extends SimpleContainer {
37
-	/** @var DIContainer[] */
38
-	protected $appContainers;
37
+    /** @var DIContainer[] */
38
+    protected $appContainers;
39 39
 
40
-	/** @var string[] */
41
-	protected $hasNoAppContainer;
40
+    /** @var string[] */
41
+    protected $hasNoAppContainer;
42 42
 
43
-	/** @var string[] */
44
-	protected $namespaces;
43
+    /** @var string[] */
44
+    protected $namespaces;
45 45
 
46
-	/**
47
-	 * ServerContainer constructor.
48
-	 */
49
-	public function __construct() {
50
-		parent::__construct();
51
-		$this->appContainers = [];
52
-		$this->namespaces = [];
53
-		$this->hasNoAppContainer = [];
54
-	}
46
+    /**
47
+     * ServerContainer constructor.
48
+     */
49
+    public function __construct() {
50
+        parent::__construct();
51
+        $this->appContainers = [];
52
+        $this->namespaces = [];
53
+        $this->hasNoAppContainer = [];
54
+    }
55 55
 
56
-	/**
57
-	 * @param string $appName
58
-	 * @param string $appNamespace
59
-	 */
60
-	public function registerNamespace($appName, $appNamespace) {
61
-		// Cut of OCA\ and lowercase
62
-		$appNamespace = strtolower(substr($appNamespace, strrpos($appNamespace, '\\') + 1));
63
-		$this->namespaces[$appNamespace] = $appName;
64
-	}
56
+    /**
57
+     * @param string $appName
58
+     * @param string $appNamespace
59
+     */
60
+    public function registerNamespace($appName, $appNamespace) {
61
+        // Cut of OCA\ and lowercase
62
+        $appNamespace = strtolower(substr($appNamespace, strrpos($appNamespace, '\\') + 1));
63
+        $this->namespaces[$appNamespace] = $appName;
64
+    }
65 65
 
66
-	/**
67
-	 * @param string $appName
68
-	 * @param DIContainer $container
69
-	 */
70
-	public function registerAppContainer($appName, DIContainer $container) {
71
-		$this->appContainers[strtolower(App::buildAppNamespace($appName, ''))] = $container;
72
-	}
66
+    /**
67
+     * @param string $appName
68
+     * @param DIContainer $container
69
+     */
70
+    public function registerAppContainer($appName, DIContainer $container) {
71
+        $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))] = $container;
72
+    }
73 73
 
74
-	/**
75
-	 * @param string $namespace
76
-	 * @param string $sensitiveNamespace
77
-	 * @return DIContainer
78
-	 * @throws QueryException
79
-	 */
80
-	protected function getAppContainer($namespace, $sensitiveNamespace) {
81
-		if (isset($this->appContainers[$namespace])) {
82
-			return $this->appContainers[$namespace];
83
-		}
74
+    /**
75
+     * @param string $namespace
76
+     * @param string $sensitiveNamespace
77
+     * @return DIContainer
78
+     * @throws QueryException
79
+     */
80
+    protected function getAppContainer($namespace, $sensitiveNamespace) {
81
+        if (isset($this->appContainers[$namespace])) {
82
+            return $this->appContainers[$namespace];
83
+        }
84 84
 
85
-		if (isset($this->namespaces[$namespace])) {
86
-			if (!isset($this->hasNoAppContainer[$namespace])) {
87
-				$applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
88
-				if (class_exists($applicationClassName)) {
89
-					new $applicationClassName();
90
-					if (isset($this->appContainers[$namespace])) {
91
-						return $this->appContainers[$namespace];
92
-					}
93
-				}
94
-				$this->hasNoAppContainer[$namespace] = true;
95
-			}
85
+        if (isset($this->namespaces[$namespace])) {
86
+            if (!isset($this->hasNoAppContainer[$namespace])) {
87
+                $applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
88
+                if (class_exists($applicationClassName)) {
89
+                    new $applicationClassName();
90
+                    if (isset($this->appContainers[$namespace])) {
91
+                        return $this->appContainers[$namespace];
92
+                    }
93
+                }
94
+                $this->hasNoAppContainer[$namespace] = true;
95
+            }
96 96
 
97
-			return new DIContainer($this->namespaces[$namespace]);
98
-		}
99
-		throw new QueryException();
100
-	}
97
+            return new DIContainer($this->namespaces[$namespace]);
98
+        }
99
+        throw new QueryException();
100
+    }
101 101
 
102
-	/**
103
-	 * @param string $name name of the service to query for
104
-	 * @return mixed registered service for the given $name
105
-	 * @throws QueryException if the query could not be resolved
106
-	 */
107
-	public function query($name) {
108
-		$name = $this->sanitizeName($name);
102
+    /**
103
+     * @param string $name name of the service to query for
104
+     * @return mixed registered service for the given $name
105
+     * @throws QueryException if the query could not be resolved
106
+     */
107
+    public function query($name) {
108
+        $name = $this->sanitizeName($name);
109 109
 
110
-		// In case the service starts with OCA\ we try to find the service in
111
-		// the apps container first.
112
-		if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {
113
-			$segments = explode('\\', $name);
114
-			try {
115
-				$appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]);
116
-				return $appContainer->queryNoFallback($name);
117
-			} catch (QueryException $e) {
118
-				// Didn't find the service or the respective app container,
119
-				// ignore it and fall back to the core container.
120
-			}
121
-		} else if (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) {
122
-			$segments = explode('\\', $name);
123
-			try {
124
-				$appContainer = $this->getAppContainer(strtolower($segments[1]));
125
-				return $appContainer->queryNoFallback($name);
126
-			} catch (QueryException $e) {
127
-				// Didn't find the service or the respective app container,
128
-				// ignore it and fall back to the core container.
129
-			}
130
-		}
110
+        // In case the service starts with OCA\ we try to find the service in
111
+        // the apps container first.
112
+        if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {
113
+            $segments = explode('\\', $name);
114
+            try {
115
+                $appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]);
116
+                return $appContainer->queryNoFallback($name);
117
+            } catch (QueryException $e) {
118
+                // Didn't find the service or the respective app container,
119
+                // ignore it and fall back to the core container.
120
+            }
121
+        } else if (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) {
122
+            $segments = explode('\\', $name);
123
+            try {
124
+                $appContainer = $this->getAppContainer(strtolower($segments[1]));
125
+                return $appContainer->queryNoFallback($name);
126
+            } catch (QueryException $e) {
127
+                // Didn't find the service or the respective app container,
128
+                // ignore it and fall back to the core container.
129
+            }
130
+        }
131 131
 
132
-		return parent::query($name);
133
-	}
132
+        return parent::query($name);
133
+    }
134 134
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
 		if (isset($this->namespaces[$namespace])) {
86 86
 			if (!isset($this->hasNoAppContainer[$namespace])) {
87
-				$applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
87
+				$applicationClassName = 'OCA\\'.$sensitiveNamespace.'\\AppInfo\\Application';
88 88
 				if (class_exists($applicationClassName)) {
89 89
 					new $applicationClassName();
90 90
 					if (isset($this->appContainers[$namespace])) {
Please login to merge, or discard this patch.