Passed
Push — master ( 56ad07...6ac66e )
by Morris
13:38
created
lib/private/AppFramework/Http.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param array $server $_SERVER
42 42
 	 * @param string $protocolVersion the http version to use defaults to HTTP/1.1
43 43
 	 */
44
-	public function __construct($server, $protocolVersion='HTTP/1.1') {
44
+	public function __construct($server, $protocolVersion = 'HTTP/1.1') {
45 45
 		$this->server = $server;
46 46
 		$this->protocolVersion = $protocolVersion;
47 47
 
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 	 * @param string $ETag the etag
117 117
 	 * @return string
118 118
 	 */
119
-	public function getStatusHeader($status, \DateTime $lastModified=null, 
120
-	                                $ETag=null) {
119
+	public function getStatusHeader($status, \DateTime $lastModified = null, 
120
+	                                $ETag = null) {
121 121
 
122
-		if(!is_null($lastModified)) {
122
+		if (!is_null($lastModified)) {
123 123
 			$lastModified = $lastModified->format(\DateTime::RFC2822);
124 124
 		}
125 125
 
126 126
 		// if etag or lastmodified have not changed, return a not modified
127 127
 		if ((isset($this->server['HTTP_IF_NONE_MATCH'])
128
-			&& trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string)$ETag)
128
+			&& trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string) $ETag)
129 129
 
130 130
 			||
131 131
 
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 		// we have one change currently for the http 1.0 header that differs
140 140
 		// from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND
141 141
 		// if this differs any more, we want to create childclasses for this
142
-		if($status === self::STATUS_TEMPORARY_REDIRECT 
142
+		if ($status === self::STATUS_TEMPORARY_REDIRECT 
143 143
 			&& $this->protocolVersion === 'HTTP/1.0') {
144 144
 
145 145
 			$status = self::STATUS_FOUND;
146 146
 		}
147 147
 
148
-		return $this->protocolVersion . ' ' . $status . ' ' . 
148
+		return $this->protocolVersion.' '.$status.' '. 
149 149
 			$this->headers[$status];
150 150
 	}
151 151
 
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/Security/CORSMiddleware.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 * @throws SecurityException
81 81
 	 * @since 6.0.0
82 82
 	 */
83
-	public function beforeController($controller, $methodName){
83
+	public function beforeController($controller, $methodName) {
84 84
 		// ensure that @CORS annotated API routes are not used in conjunction
85 85
 		// with session authentication since this enables CSRF attack vectors
86 86
 		if ($this->reflector->hasAnnotation('CORS') &&
87
-			!$this->reflector->hasAnnotation('PublicPage'))  {
87
+			!$this->reflector->hasAnnotation('PublicPage')) {
88 88
 			$user = $this->request->server['PHP_AUTH_USER'];
89 89
 			$pass = $this->request->server['PHP_AUTH_PW'];
90 90
 
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	 * @return Response a Response object
111 111
 	 * @throws SecurityException
112 112
 	 */
113
-	public function afterController($controller, $methodName, Response $response){
113
+	public function afterController($controller, $methodName, Response $response) {
114 114
 		// only react if its a CORS request and if the request sends origin and
115 115
 
116
-		if(isset($this->request->server['HTTP_ORIGIN']) &&
116
+		if (isset($this->request->server['HTTP_ORIGIN']) &&
117 117
 			$this->reflector->hasAnnotation('CORS')) {
118 118
 
119 119
 			// allow credentials headers must not be true or CSRF is possible
120 120
 			// otherwise
121
-			foreach($response->getHeaders() as $header => $value) {
122
-				if(strtolower($header) === 'access-control-allow-credentials' &&
121
+			foreach ($response->getHeaders() as $header => $value) {
122
+				if (strtolower($header) === 'access-control-allow-credentials' &&
123 123
 				   strtolower(trim($value)) === 'true') {
124 124
 					$msg = 'Access-Control-Allow-Credentials must not be '.
125 125
 						   'set to true in order to prevent CSRF';
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	 * @throws \Exception the passed in exception if it can't handle it
144 144
 	 * @return Response a Response object or null in case that the exception could not be handled
145 145
 	 */
146
-	public function afterException($controller, $methodName, \Exception $exception){
147
-		if($exception instanceof SecurityException){
148
-			$response =  new JSONResponse(['message' => $exception->getMessage()]);
149
-			if($exception->getCode() !== 0) {
146
+	public function afterException($controller, $methodName, \Exception $exception) {
147
+		if ($exception instanceof SecurityException) {
148
+			$response = new JSONResponse(['message' => $exception->getMessage()]);
149
+			if ($exception->getCode() !== 0) {
150 150
 				$response->setStatus($exception->getCode());
151 151
 			} else {
152 152
 				$response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR);
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/OCSMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 		$format = $this->request->getParam('format');
144 144
 
145 145
 		// if none is given try the first Accept header
146
-		if($format === null) {
146
+		if ($format === null) {
147 147
 			$headers = $this->request->getHeader('Accept');
148 148
 			$format = $controller->getResponderByHTTPHeader($headers, 'xml');
149 149
 		}
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/SessionMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
lib/private/AppFramework/OCS/BaseResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/private/AppFramework/OCS/V2Response.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
lib/private/AppFramework/OCS/V1Response.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
lib/private/AppFramework/Routing/RouteConfig.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
lib/private/Share/SearchResultSorter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.