Completed
Push — master ( 08b58a...0efd05 )
by Daniel
30:08 queued 21s
created
lib/private/Remote/Api/ApiBase.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -26,72 +26,72 @@
 block discarded – undo
26 26
 use OCP\Remote\IInstance;
27 27
 
28 28
 class ApiBase {
29
-	/** @var IInstance */
30
-	private $instance;
31
-	/** @var ICredentials */
32
-	private $credentials;
33
-	/** @var IClientService */
34
-	private $clientService;
29
+    /** @var IInstance */
30
+    private $instance;
31
+    /** @var ICredentials */
32
+    private $credentials;
33
+    /** @var IClientService */
34
+    private $clientService;
35 35
 
36
-	public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
37
-		$this->instance = $instance;
38
-		$this->credentials = $credentials;
39
-		$this->clientService = $clientService;
40
-	}
36
+    public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
37
+        $this->instance = $instance;
38
+        $this->credentials = $credentials;
39
+        $this->clientService = $clientService;
40
+    }
41 41
 
42
-	protected function getHttpClient() {
43
-		return $this->clientService->newClient();
44
-	}
42
+    protected function getHttpClient() {
43
+        return $this->clientService->newClient();
44
+    }
45 45
 
46
-	protected function addDefaultHeaders(array $headers) {
47
-		return array_merge([
48
-			'OCS-APIREQUEST' => 'true',
49
-			'Accept' => 'application/json'
50
-		], $headers);
51
-	}
46
+    protected function addDefaultHeaders(array $headers) {
47
+        return array_merge([
48
+            'OCS-APIREQUEST' => 'true',
49
+            'Accept' => 'application/json'
50
+        ], $headers);
51
+    }
52 52
 
53
-	/**
54
-	 * @param string $method
55
-	 * @param string $url
56
-	 * @param array $body
57
-	 * @param array $query
58
-	 * @param array $headers
59
-	 * @return resource|string
60
-	 * @throws \InvalidArgumentException
61
-	 */
62
-	protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
63
-		$fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
64
-		$options = [
65
-			'query' => $query,
66
-			'headers' => $this->addDefaultHeaders($headers),
67
-			'auth' => [$this->credentials->getUsername(), $this->credentials->getPassword()]
68
-		];
69
-		if ($body) {
70
-			$options['body'] = $body;
71
-		}
53
+    /**
54
+     * @param string $method
55
+     * @param string $url
56
+     * @param array $body
57
+     * @param array $query
58
+     * @param array $headers
59
+     * @return resource|string
60
+     * @throws \InvalidArgumentException
61
+     */
62
+    protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
63
+        $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
64
+        $options = [
65
+            'query' => $query,
66
+            'headers' => $this->addDefaultHeaders($headers),
67
+            'auth' => [$this->credentials->getUsername(), $this->credentials->getPassword()]
68
+        ];
69
+        if ($body) {
70
+            $options['body'] = $body;
71
+        }
72 72
 
73
-		$client = $this->getHttpClient();
73
+        $client = $this->getHttpClient();
74 74
 
75
-		switch ($method) {
76
-			case 'get':
77
-				$response = $client->get($fullUrl, $options);
78
-				break;
79
-			case 'post':
80
-				$response = $client->post($fullUrl, $options);
81
-				break;
82
-			case 'put':
83
-				$response = $client->put($fullUrl, $options);
84
-				break;
85
-			case 'delete':
86
-				$response = $client->delete($fullUrl, $options);
87
-				break;
88
-			case 'options':
89
-				$response = $client->options($fullUrl, $options);
90
-				break;
91
-			default:
92
-				throw new \InvalidArgumentException('Invalid method ' . $method);
93
-		}
75
+        switch ($method) {
76
+            case 'get':
77
+                $response = $client->get($fullUrl, $options);
78
+                break;
79
+            case 'post':
80
+                $response = $client->post($fullUrl, $options);
81
+                break;
82
+            case 'put':
83
+                $response = $client->put($fullUrl, $options);
84
+                break;
85
+            case 'delete':
86
+                $response = $client->delete($fullUrl, $options);
87
+                break;
88
+            case 'options':
89
+                $response = $client->options($fullUrl, $options);
90
+                break;
91
+            default:
92
+                throw new \InvalidArgumentException('Invalid method ' . $method);
93
+        }
94 94
 
95
-		return $response->getBody();
96
-	}
95
+        return $response->getBody();
96
+    }
97 97
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @throws \InvalidArgumentException
61 61
 	 */
62 62
 	protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
63
-		$fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
63
+		$fullUrl = trim($this->instance->getFullUrl(), '/').'/'.$url;
64 64
 		$options = [
65 65
 			'query' => $query,
66 66
 			'headers' => $this->addDefaultHeaders($headers),
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				$response = $client->options($fullUrl, $options);
90 90
 				break;
91 91
 			default:
92
-				throw new \InvalidArgumentException('Invalid method ' . $method);
92
+				throw new \InvalidArgumentException('Invalid method '.$method);
93 93
 		}
94 94
 
95 95
 		return $response->getBody();
Please login to merge, or discard this patch.
lib/private/Remote/InstanceFactory.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 use OCP\Remote\IInstanceFactory;
28 28
 
29 29
 class InstanceFactory implements IInstanceFactory {
30
-	/** @var ICache */
31
-	private $cache;
32
-	/** @var IClientService */
33
-	private $clientService;
30
+    /** @var ICache */
31
+    private $cache;
32
+    /** @var IClientService */
33
+    private $clientService;
34 34
 
35
-	public function __construct(ICache $cache, IClientService $clientService) {
36
-		$this->cache = $cache;
37
-		$this->clientService = $clientService;
38
-	}
35
+    public function __construct(ICache $cache, IClientService $clientService) {
36
+        $this->cache = $cache;
37
+        $this->clientService = $clientService;
38
+    }
39 39
 
40
-	public function getInstance($url) {
41
-		return new Instance($url, $this->cache, $this->clientService);
42
-	}
40
+    public function getInstance($url) {
41
+        return new Instance($url, $this->cache, $this->clientService);
42
+    }
43 43
 }
Please login to merge, or discard this patch.
lib/private/Remote/Api/OCS.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
45 45
 		try {
46
-			$response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true);
46
+			$response = json_decode(parent::request($method, 'ocs/v2.php/'.$url, $body, $query, $headers), true);
47 47
 		} catch (ClientException $e) {
48 48
 			if ($e->getResponse()->getStatusCode() === 404) {
49 49
 				throw new NotFoundException();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			throw new NotFoundException();
64 64
 		}
65 65
 		if ($response['ocs']['meta']['status'] !== 'ok') {
66
-			throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
66
+			throw new \Exception('Unknown ocs error '.$response['ocs']['meta']['message']);
67 67
 		}
68 68
 
69 69
 		return $response['ocs']['data'];
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 	private function checkResponseArray(array $data, $type, array $keys) {
79 79
 		foreach ($keys as $key) {
80 80
 			if (!array_key_exists($key, $data)) {
81
-				throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
81
+				throw new \Exception('Invalid '.$type.' response, expected field '.$key.' not found');
82 82
 			}
83 83
 		}
84 84
 	}
85 85
 
86 86
 	public function getUser($userId) {
87
-		$result = $this->request('get', 'cloud/users/' . $userId);
87
+		$result = $this->request('get', 'cloud/users/'.$userId);
88 88
 		$this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
89 89
 		return new User($result);
90 90
 	}
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -32,70 +32,70 @@
 block discarded – undo
32 32
 use OCP\Remote\Api\IUserApi;
33 33
 
34 34
 class OCS extends ApiBase implements ICapabilitiesApi, IUserApi {
35
-	/**
36
-	 * @param string $method
37
-	 * @param string $url
38
-	 * @param array $body
39
-	 * @param array $query
40
-	 * @param array $headers
41
-	 * @return array
42
-	 * @throws ForbiddenException
43
-	 * @throws NotFoundException
44
-	 * @throws \Exception
45
-	 */
46
-	protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
47
-		try {
48
-			$response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true);
49
-		} catch (ClientException $e) {
50
-			if ($e->getResponse()->getStatusCode() === 404) {
51
-				throw new NotFoundException();
52
-			} elseif ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) {
53
-				throw new ForbiddenException();
54
-			} else {
55
-				throw $e;
56
-			}
57
-		}
58
-		if (!isset($response['ocs']) || !isset($response['ocs']['meta'])) {
59
-			throw new \Exception('Invalid ocs response');
60
-		}
61
-		if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_UNAUTHORISED) {
62
-			throw new ForbiddenException();
63
-		}
64
-		if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_NOT_FOUND) {
65
-			throw new NotFoundException();
66
-		}
67
-		if ($response['ocs']['meta']['status'] !== 'ok') {
68
-			throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
69
-		}
35
+    /**
36
+     * @param string $method
37
+     * @param string $url
38
+     * @param array $body
39
+     * @param array $query
40
+     * @param array $headers
41
+     * @return array
42
+     * @throws ForbiddenException
43
+     * @throws NotFoundException
44
+     * @throws \Exception
45
+     */
46
+    protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
47
+        try {
48
+            $response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true);
49
+        } catch (ClientException $e) {
50
+            if ($e->getResponse()->getStatusCode() === 404) {
51
+                throw new NotFoundException();
52
+            } elseif ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) {
53
+                throw new ForbiddenException();
54
+            } else {
55
+                throw $e;
56
+            }
57
+        }
58
+        if (!isset($response['ocs']) || !isset($response['ocs']['meta'])) {
59
+            throw new \Exception('Invalid ocs response');
60
+        }
61
+        if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_UNAUTHORISED) {
62
+            throw new ForbiddenException();
63
+        }
64
+        if ($response['ocs']['meta']['statuscode'] === OCSController::RESPOND_NOT_FOUND) {
65
+            throw new NotFoundException();
66
+        }
67
+        if ($response['ocs']['meta']['status'] !== 'ok') {
68
+            throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
69
+        }
70 70
 
71
-		return $response['ocs']['data'];
72
-	}
71
+        return $response['ocs']['data'];
72
+    }
73 73
 
74
-	/**
75
-	 * @param array $data
76
-	 * @param string $type
77
-	 * @param string[] $keys
78
-	 * @throws \Exception
79
-	 */
80
-	private function checkResponseArray(array $data, $type, array $keys) {
81
-		foreach ($keys as $key) {
82
-			if (!array_key_exists($key, $data)) {
83
-				throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
84
-			}
85
-		}
86
-	}
74
+    /**
75
+     * @param array $data
76
+     * @param string $type
77
+     * @param string[] $keys
78
+     * @throws \Exception
79
+     */
80
+    private function checkResponseArray(array $data, $type, array $keys) {
81
+        foreach ($keys as $key) {
82
+            if (!array_key_exists($key, $data)) {
83
+                throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
84
+            }
85
+        }
86
+    }
87 87
 
88
-	public function getUser($userId) {
89
-		$result = $this->request('get', 'cloud/users/' . $userId);
90
-		$this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
91
-		return new User($result);
92
-	}
88
+    public function getUser($userId) {
89
+        $result = $this->request('get', 'cloud/users/' . $userId);
90
+        $this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
91
+        return new User($result);
92
+    }
93 93
 
94
-	/**
95
-	 * @return array The capabilities in the form of [$appId => [$capability => $value]]
96
-	 */
97
-	public function getCapabilities() {
98
-		$result = $this->request('get', 'cloud/capabilities');
99
-		return $result['capabilities'];
100
-	}
94
+    /**
95
+     * @return array The capabilities in the form of [$appId => [$capability => $value]]
96
+     */
97
+    public function getCapabilities() {
98
+        $result = $this->request('get', 'cloud/capabilities');
99
+        return $result['capabilities'];
100
+    }
101 101
 }
Please login to merge, or discard this patch.
apps/files/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Files\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Files\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/encryption/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Encryption\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Encryption\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/federatedfilesharing/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\FederatedFileSharing\\' => array($baseDir . '/../lib'),
9
+    'OCA\\FederatedFileSharing\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/federation/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Federation\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Federation\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/files_external/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Files_External\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Files_External\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/lookup_server_connector/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\LookupServerConnector\\' => array($baseDir . '/../lib'),
9
+    'OCA\\LookupServerConnector\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.