@@ -71,7 +71,7 @@ |
||
71 | 71 | * @param Response $response |
72 | 72 | * @return Response |
73 | 73 | */ |
74 | - public function afterController($controller, $methodName, Response $response){ |
|
74 | + public function afterController($controller, $methodName, Response $response) { |
|
75 | 75 | $useSession = $this->reflector->hasAnnotation('UseSession'); |
76 | 76 | if ($useSession) { |
77 | 77 | $this->session->close(); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | use OCP\AppFramework\Http\EmptyContentSecurityPolicy; |
27 | 27 | use OCP\AppFramework\Http\Response; |
28 | 28 | |
29 | -abstract class BaseResponse extends Response { |
|
29 | +abstract class BaseResponse extends Response { |
|
30 | 30 | /** @var array */ |
31 | 31 | protected $data; |
32 | 32 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getStatus() { |
37 | 37 | |
38 | - $status = parent::getStatus(); |
|
38 | + $status = parent::getStatus(); |
|
39 | 39 | if ($status === API::RESPOND_UNAUTHORISED) { |
40 | 40 | return Http::STATUS_UNAUTHORIZED; |
41 | 41 | } else if ($status === API::RESPOND_NOT_FOUND) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return int |
35 | 35 | */ |
36 | 36 | public function getStatus() { |
37 | - $status = parent::getStatus(); |
|
37 | + $status = parent::getStatus(); |
|
38 | 38 | if ($status === Http::STATUS_FORBIDDEN || $status === API::RESPOND_UNAUTHORISED) { |
39 | 39 | return Http::STATUS_UNAUTHORIZED; |
40 | 40 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | 'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage, |
71 | 71 | ]; |
72 | 72 | |
73 | - $meta['totalitems'] = $this->itemsCount !== null ? (string)$this->itemsCount : ''; |
|
74 | - $meta['itemsperpage'] = $this->itemsPerPage !== null ? (string)$this->itemsPerPage: ''; |
|
73 | + $meta['totalitems'] = $this->itemsCount !== null ? (string) $this->itemsCount : ''; |
|
74 | + $meta['itemsperpage'] = $this->itemsPerPage !== null ? (string) $this->itemsPerPage : ''; |
|
75 | 75 | |
76 | 76 | return $this->renderResult($meta); |
77 | 77 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $root = '/apps/'.$this->appName; |
104 | 104 | } |
105 | 105 | |
106 | - $url = $root . $ocsRoute['url']; |
|
106 | + $url = $root.$ocsRoute['url']; |
|
107 | 107 | $verb = isset($ocsRoute['verb']) ? strtoupper($ocsRoute['verb']) : 'GET'; |
108 | 108 | |
109 | 109 | $split = explode('#', $name, 2); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | // register the route |
120 | 120 | $handler = new RouteActionHandler($this->container, $controllerName, $actionName); |
121 | 121 | |
122 | - $router = $this->router->create('ocs.'.$this->appName.'.'.$controller.'.'.$action . $postfix, $url) |
|
122 | + $router = $this->router->create('ocs.'.$this->appName.'.'.$controller.'.'.$action.$postfix, $url) |
|
123 | 123 | ->method($verb) |
124 | 124 | ->action($handler); |
125 | 125 | |
126 | 126 | // optionally register requirements for route. This is used to |
127 | 127 | // tell the route parser how url parameters should be matched |
128 | - if(array_key_exists('requirements', $ocsRoute)) { |
|
128 | + if (array_key_exists('requirements', $ocsRoute)) { |
|
129 | 129 | $router->requirements($ocsRoute['requirements']); |
130 | 130 | } |
131 | 131 | |
132 | 132 | // optionally register defaults for route. This is used to |
133 | 133 | // tell the route parser how url parameters should be default valued |
134 | - if(array_key_exists('defaults', $ocsRoute)) { |
|
134 | + if (array_key_exists('defaults', $ocsRoute)) { |
|
135 | 135 | $router->defaults($ocsRoute['defaults']); |
136 | 136 | } |
137 | 137 | } |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | |
169 | 169 | // register the route |
170 | 170 | $handler = new RouteActionHandler($this->container, $controllerName, $actionName); |
171 | - $router = $this->router->create($this->appName.'.'.$controller.'.'.$action . $postfix, $url) |
|
171 | + $router = $this->router->create($this->appName.'.'.$controller.'.'.$action.$postfix, $url) |
|
172 | 172 | ->method($verb) |
173 | 173 | ->action($handler); |
174 | 174 | |
175 | 175 | // optionally register requirements for route. This is used to |
176 | 176 | // tell the route parser how url parameters should be matched |
177 | - if(array_key_exists('requirements', $simpleRoute)) { |
|
177 | + if (array_key_exists('requirements', $simpleRoute)) { |
|
178 | 178 | $router->requirements($simpleRoute['requirements']); |
179 | 179 | } |
180 | 180 | |
181 | 181 | // optionally register defaults for route. This is used to |
182 | 182 | // tell the route parser how url parameters should be default valued |
183 | - if(array_key_exists('defaults', $simpleRoute)) { |
|
183 | + if (array_key_exists('defaults', $simpleRoute)) { |
|
184 | 184 | $router->defaults($simpleRoute['defaults']); |
185 | 185 | } |
186 | 186 | } |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | foreach ($resources as $resource => $config) { |
213 | 213 | |
214 | 214 | // the url parameter used as id to the resource |
215 | - foreach($actions as $action) { |
|
215 | + foreach ($actions as $action) { |
|
216 | 216 | $url = $config['url']; |
217 | 217 | $method = $action['name']; |
218 | 218 | $verb = isset($action['verb']) ? strtoupper($action['verb']) : 'GET'; |
219 | 219 | $collectionAction = isset($action['on-collection']) ? $action['on-collection'] : false; |
220 | 220 | if (!$collectionAction) { |
221 | - $url = $url . '/{id}'; |
|
221 | + $url = $url.'/{id}'; |
|
222 | 222 | } |
223 | 223 | if (isset($action['url-postfix'])) { |
224 | - $url = $url . '/' . $action['url-postfix']; |
|
224 | + $url = $url.'/'.$action['url-postfix']; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | $controller = $resource; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $controllerName = $this->buildControllerName($controller); |
230 | 230 | $actionName = $this->buildActionName($method); |
231 | 231 | |
232 | - $routeName = $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); |
|
232 | + $routeName = $this->appName.'.'.strtolower($resource).'.'.strtolower($method); |
|
233 | 233 | |
234 | 234 | $this->router->create($routeName, $url)->method($verb)->action( |
235 | 235 | new RouteActionHandler($this->container, $controllerName, $actionName) |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | private function buildControllerName($controller) |
247 | 247 | { |
248 | 248 | if (!isset($this->controllerNameCache[$controller])) { |
249 | - $this->controllerNameCache[$controller] = $this->underScoreToCamelCase(ucfirst($controller)) . 'Controller'; |
|
249 | + $this->controllerNameCache[$controller] = $this->underScoreToCamelCase(ucfirst($controller)).'Controller'; |
|
250 | 250 | } |
251 | 251 | return $this->controllerNameCache[$controller]; |
252 | 252 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $pattern = "/_[a-z]?/"; |
270 | 270 | return preg_replace_callback( |
271 | 271 | $pattern, |
272 | - function ($matches) { |
|
272 | + function($matches) { |
|
273 | 273 | return strtoupper(ltrim($matches[0], "_")); |
274 | 274 | }, |
275 | 275 | $str); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * Callback function for usort. http://php.net/usort |
52 | 52 | */ |
53 | 53 | public function sort($a, $b) { |
54 | - if(!isset($a[$this->key]) || !isset($b[$this->key])) { |
|
55 | - if(!is_null($this->log)) { |
|
56 | - $this->log->error('Sharing dialogue: cannot sort due to ' . |
|
54 | + if (!isset($a[$this->key]) || !isset($b[$this->key])) { |
|
55 | + if (!is_null($this->log)) { |
|
56 | + $this->log->error('Sharing dialogue: cannot sort due to '. |
|
57 | 57 | 'missing array key', array('app' => 'core')); |
58 | 58 | } |
59 | 59 | return 0; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $i = mb_strpos($nameA, $this->search, 0, $this->encoding); |
64 | 64 | $j = mb_strpos($nameB, $this->search, 0, $this->encoding); |
65 | 65 | |
66 | - if($i === $j || $i > 0 && $j > 0) { |
|
66 | + if ($i === $j || $i > 0 && $j > 0) { |
|
67 | 67 | return strcmp(mb_strtolower($nameA, $this->encoding), |
68 | 68 | mb_strtolower($nameB, $this->encoding)); |
69 | 69 | } elseif ($i === 0) { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | const FORMAT_NONE = -1; |
37 | 37 | const FORMAT_STATUSES = -2; |
38 | - const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it |
|
38 | + const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it |
|
39 | 39 | |
40 | 40 | const RESPONSE_FORMAT = 'json'; // default resonse format for ocs calls |
41 | 41 |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | |
45 | 45 | public function run(IOutput $output) { |
46 | 46 | |
47 | - $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
47 | + $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); |
|
48 | 48 | $instanceId = $this->config->getSystemValue('instanceid', null); |
49 | 49 | |
50 | - if(!is_string($instanceId) || empty($instanceId)) { |
|
50 | + if (!is_string($instanceId) || empty($instanceId)) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - $updaterFolderPath = $dataDir . '/updater-' . $instanceId; |
|
55 | - $stepFile = $updaterFolderPath . '/.step'; |
|
56 | - if(file_exists($stepFile)) { |
|
54 | + $updaterFolderPath = $dataDir.'/updater-'.$instanceId; |
|
55 | + $stepFile = $updaterFolderPath.'/.step'; |
|
56 | + if (file_exists($stepFile)) { |
|
57 | 57 | $output->info('.step file exists'); |
58 | 58 | |
59 | - $previousStepFile = $updaterFolderPath . '/.step-previous-update'; |
|
59 | + $previousStepFile = $updaterFolderPath.'/.step-previous-update'; |
|
60 | 60 | |
61 | 61 | // cleanup |
62 | - if(file_exists($previousStepFile)) { |
|
63 | - if(\OC_Helper::rmdirr($previousStepFile)) { |
|
62 | + if (file_exists($previousStepFile)) { |
|
63 | + if (\OC_Helper::rmdirr($previousStepFile)) { |
|
64 | 64 | $output->info('.step-previous-update removed'); |
65 | 65 | } else { |
66 | 66 | $output->info('.step-previous-update can\'t be removed - abort move of .step file'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // move step file |
72 | - if(rename($stepFile, $previousStepFile)) { |
|
72 | + if (rename($stepFile, $previousStepFile)) { |
|
73 | 73 | $output->info('.step file moved to .step-previous-update'); |
74 | 74 | } else { |
75 | 75 | $output->warning('.step file can\'t be moved'); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $result->closeCursor(); |
70 | 70 | |
71 | 71 | if ($entriesUpdated > 0) { |
72 | - $output->info($entriesUpdated . ' mounts updated'); |
|
72 | + $output->info($entriesUpdated.' mounts updated'); |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 |