Passed
Push — master ( 1199e5...c7b7ee )
by Blizzz
11:21 queued 12s
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.
apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	 *
79 79
 	 * @return string
80 80
 	 */
81
-	public function getPluginName()	{
81
+	public function getPluginName() {
82 82
 		return 'nc-enable-birthday-calendar';
83 83
 	}
84 84
 
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -38,102 +38,102 @@
 block discarded – undo
38 38
  * @package OCA\DAV\CalDAV\BirthdayCalendar
39 39
  */
40 40
 class EnablePlugin extends ServerPlugin {
41
-	const NS_Nextcloud = 'http://nextcloud.com/ns';
42
-
43
-	/**
44
-	 * @var IConfig
45
-	 */
46
-	protected $config;
47
-
48
-	/**
49
-	 * @var BirthdayService
50
-	 */
51
-	protected $birthdayService;
52
-
53
-	/**
54
-	 * @var Server
55
-	 */
56
-	protected $server;
57
-
58
-	/**
59
-	 * PublishPlugin constructor.
60
-	 *
61
-	 * @param IConfig $config
62
-	 * @param BirthdayService $birthdayService
63
-	 */
64
-	public function __construct(IConfig $config, BirthdayService $birthdayService) {
65
-		$this->config = $config;
66
-		$this->birthdayService = $birthdayService;
67
-	}
68
-
69
-	/**
70
-	 * This method should return a list of server-features.
71
-	 *
72
-	 * This is for example 'versioning' and is added to the DAV: header
73
-	 * in an OPTIONS response.
74
-	 *
75
-	 * @return string[]
76
-	 */
77
-	public function getFeatures() {
78
-		return ['nc-enable-birthday-calendar'];
79
-	}
80
-
81
-	/**
82
-	 * Returns a plugin name.
83
-	 *
84
-	 * Using this name other plugins will be able to access other plugins
85
-	 * using Sabre\DAV\Server::getPlugin
86
-	 *
87
-	 * @return string
88
-	 */
89
-	public function getPluginName()	{
90
-		return 'nc-enable-birthday-calendar';
91
-	}
92
-
93
-	/**
94
-	 * This initializes the plugin.
95
-	 *
96
-	 * This function is called by Sabre\DAV\Server, after
97
-	 * addPlugin is called.
98
-	 *
99
-	 * This method should set up the required event subscriptions.
100
-	 *
101
-	 * @param Server $server
102
-	 */
103
-	public function initialize(Server $server) {
104
-		$this->server = $server;
105
-
106
-		$this->server->on('method:POST', [$this, 'httpPost']);
107
-	}
108
-
109
-	/**
110
-	 * We intercept this to handle POST requests on calendar homes.
111
-	 *
112
-	 * @param RequestInterface $request
113
-	 * @param ResponseInterface $response
114
-	 *
115
-	 * @return bool|void
116
-	 */
117
-	public function httpPost(RequestInterface $request, ResponseInterface $response) {
118
-		$node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
119
-		if (!($node instanceof CalendarHome)) {
120
-			return;
121
-		}
122
-
123
-		$requestBody = $request->getBodyAsString();
124
-		$this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
125
-		if ($documentType !== '{'.self::NS_Nextcloud.'}enable-birthday-calendar') {
126
-			return;
127
-		}
128
-
129
-		$principalUri = $node->getOwner();
130
-		$userId = substr($principalUri, 17);
131
-
132
-		$this->config->setUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
133
-		$this->birthdayService->syncUser($userId);
134
-
135
-		$this->server->httpResponse->setStatus(204);
136
-
137
-		return false;
138
-	}
41
+    const NS_Nextcloud = 'http://nextcloud.com/ns';
42
+
43
+    /**
44
+     * @var IConfig
45
+     */
46
+    protected $config;
47
+
48
+    /**
49
+     * @var BirthdayService
50
+     */
51
+    protected $birthdayService;
52
+
53
+    /**
54
+     * @var Server
55
+     */
56
+    protected $server;
57
+
58
+    /**
59
+     * PublishPlugin constructor.
60
+     *
61
+     * @param IConfig $config
62
+     * @param BirthdayService $birthdayService
63
+     */
64
+    public function __construct(IConfig $config, BirthdayService $birthdayService) {
65
+        $this->config = $config;
66
+        $this->birthdayService = $birthdayService;
67
+    }
68
+
69
+    /**
70
+     * This method should return a list of server-features.
71
+     *
72
+     * This is for example 'versioning' and is added to the DAV: header
73
+     * in an OPTIONS response.
74
+     *
75
+     * @return string[]
76
+     */
77
+    public function getFeatures() {
78
+        return ['nc-enable-birthday-calendar'];
79
+    }
80
+
81
+    /**
82
+     * Returns a plugin name.
83
+     *
84
+     * Using this name other plugins will be able to access other plugins
85
+     * using Sabre\DAV\Server::getPlugin
86
+     *
87
+     * @return string
88
+     */
89
+    public function getPluginName()	{
90
+        return 'nc-enable-birthday-calendar';
91
+    }
92
+
93
+    /**
94
+     * This initializes the plugin.
95
+     *
96
+     * This function is called by Sabre\DAV\Server, after
97
+     * addPlugin is called.
98
+     *
99
+     * This method should set up the required event subscriptions.
100
+     *
101
+     * @param Server $server
102
+     */
103
+    public function initialize(Server $server) {
104
+        $this->server = $server;
105
+
106
+        $this->server->on('method:POST', [$this, 'httpPost']);
107
+    }
108
+
109
+    /**
110
+     * We intercept this to handle POST requests on calendar homes.
111
+     *
112
+     * @param RequestInterface $request
113
+     * @param ResponseInterface $response
114
+     *
115
+     * @return bool|void
116
+     */
117
+    public function httpPost(RequestInterface $request, ResponseInterface $response) {
118
+        $node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
119
+        if (!($node instanceof CalendarHome)) {
120
+            return;
121
+        }
122
+
123
+        $requestBody = $request->getBodyAsString();
124
+        $this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
125
+        if ($documentType !== '{'.self::NS_Nextcloud.'}enable-birthday-calendar') {
126
+            return;
127
+        }
128
+
129
+        $principalUri = $node->getOwner();
130
+        $userId = substr($principalUri, 17);
131
+
132
+        $this->config->setUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
133
+        $this->birthdayService->syncUser($userId);
134
+
135
+        $this->server->httpResponse->setStatus(204);
136
+
137
+        return false;
138
+    }
139 139
 }
Please login to merge, or discard this patch.
lib/private/Remote/Api/OCS.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -30,70 +30,70 @@
 block discarded – undo
30 30
 use OCP\Remote\Api\IUserApi;
31 31
 
32 32
 class OCS extends ApiBase implements ICapabilitiesApi, IUserApi {
33
-	/**
34
-	 * @param string $method
35
-	 * @param string $url
36
-	 * @param array $body
37
-	 * @param array $query
38
-	 * @param array $headers
39
-	 * @return array
40
-	 * @throws ForbiddenException
41
-	 * @throws NotFoundException
42
-	 * @throws \Exception
43
-	 */
44
-	protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
45
-		try {
46
-			$response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true);
47
-		} catch (ClientException $e) {
48
-			if ($e->getResponse()->getStatusCode() === 404) {
49
-				throw new NotFoundException();
50
-			} else if ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) {
51
-				throw new ForbiddenException();
52
-			} else {
53
-				throw $e;
54
-			}
55
-		}
56
-		if (!isset($response['ocs']) || !isset($response['ocs']['meta'])) {
57
-			throw new \Exception('Invalid ocs response');
58
-		}
59
-		if ($response['ocs']['meta']['statuscode'] === API::RESPOND_UNAUTHORISED) {
60
-			throw new ForbiddenException();
61
-		}
62
-		if ($response['ocs']['meta']['statuscode'] === API::RESPOND_NOT_FOUND) {
63
-			throw new NotFoundException();
64
-		}
65
-		if ($response['ocs']['meta']['status'] !== 'ok') {
66
-			throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
67
-		}
33
+    /**
34
+     * @param string $method
35
+     * @param string $url
36
+     * @param array $body
37
+     * @param array $query
38
+     * @param array $headers
39
+     * @return array
40
+     * @throws ForbiddenException
41
+     * @throws NotFoundException
42
+     * @throws \Exception
43
+     */
44
+    protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
45
+        try {
46
+            $response = json_decode(parent::request($method, 'ocs/v2.php/' . $url, $body, $query, $headers), true);
47
+        } catch (ClientException $e) {
48
+            if ($e->getResponse()->getStatusCode() === 404) {
49
+                throw new NotFoundException();
50
+            } else if ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) {
51
+                throw new ForbiddenException();
52
+            } else {
53
+                throw $e;
54
+            }
55
+        }
56
+        if (!isset($response['ocs']) || !isset($response['ocs']['meta'])) {
57
+            throw new \Exception('Invalid ocs response');
58
+        }
59
+        if ($response['ocs']['meta']['statuscode'] === API::RESPOND_UNAUTHORISED) {
60
+            throw new ForbiddenException();
61
+        }
62
+        if ($response['ocs']['meta']['statuscode'] === API::RESPOND_NOT_FOUND) {
63
+            throw new NotFoundException();
64
+        }
65
+        if ($response['ocs']['meta']['status'] !== 'ok') {
66
+            throw new \Exception('Unknown ocs error ' . $response['ocs']['meta']['message']);
67
+        }
68 68
 
69
-		return $response['ocs']['data'];
70
-	}
69
+        return $response['ocs']['data'];
70
+    }
71 71
 
72
-	/**
73
-	 * @param array $data
74
-	 * @param string $type
75
-	 * @param string[] $keys
76
-	 * @throws \Exception
77
-	 */
78
-	private function checkResponseArray(array $data, $type, array $keys) {
79
-		foreach ($keys as $key) {
80
-			if (!array_key_exists($key, $data)) {
81
-				throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
82
-			}
83
-		}
84
-	}
72
+    /**
73
+     * @param array $data
74
+     * @param string $type
75
+     * @param string[] $keys
76
+     * @throws \Exception
77
+     */
78
+    private function checkResponseArray(array $data, $type, array $keys) {
79
+        foreach ($keys as $key) {
80
+            if (!array_key_exists($key, $data)) {
81
+                throw new \Exception('Invalid ' . $type . ' response, expected field ' . $key . ' not found');
82
+            }
83
+        }
84
+    }
85 85
 
86
-	public function getUser($userId) {
87
-		$result = $this->request('get', 'cloud/users/' . $userId);
88
-		$this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
89
-		return new User($result);
90
-	}
86
+    public function getUser($userId) {
87
+        $result = $this->request('get', 'cloud/users/' . $userId);
88
+        $this->checkResponseArray($result, 'user', User::EXPECTED_KEYS);
89
+        return new User($result);
90
+    }
91 91
 
92
-	/**
93
-	 * @return array The capabilities in the form of [$appId => [$capability => $value]]
94
-	 */
95
-	public function getCapabilities() {
96
-		$result = $this->request('get', 'cloud/capabilities');
97
-		return $result['capabilities'];
98
-	}
92
+    /**
93
+     * @return array The capabilities in the form of [$appId => [$capability => $value]]
94
+     */
95
+    public function getCapabilities() {
96
+        $result = $this->request('get', 'cloud/capabilities');
97
+        return $result['capabilities'];
98
+    }
99 99
 }
Please login to merge, or discard this patch.
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.
lib/private/Remote/User.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -25,114 +25,114 @@
 block discarded – undo
25 25
 use OCP\Remote\IUser;
26 26
 
27 27
 class User implements IUser {
28
-	const EXPECTED_KEYS = [
29
-		'id',
30
-		'email',
31
-		'displayname',
32
-		'phone',
33
-		'address',
34
-		'website',
35
-		'groups',
36
-		'language',
37
-		'quota'
38
-	];
39
-
40
-	/** @var array */
41
-	private $data;
42
-
43
-	public function __construct(array $data) {
44
-		$this->data = $data;
45
-	}
46
-
47
-
48
-	/**
49
-	 * @return string
50
-	 */
51
-	public function getUserId() {
52
-		return $this->data['id'];
53
-	}
54
-
55
-	/**
56
-	 * @return string
57
-	 */
58
-	public function getEmail() {
59
-		return $this->data['email'];
60
-	}
61
-
62
-	/**
63
-	 * @return string
64
-	 */
65
-	public function getDisplayName() {
66
-		return $this->data['displayname'];
67
-	}
68
-
69
-	/**
70
-	 * @return string
71
-	 */
72
-	public function getPhone() {
73
-		return $this->data['phone'];
74
-	}
75
-
76
-	/**
77
-	 * @return string
78
-	 */
79
-	public function getAddress() {
80
-		return $this->data['address'];
81
-	}
82
-
83
-	/**
84
-	 * @return string
85
-	 */
86
-	public function getWebsite() {
87
-		return $this->data['website'];
88
-	}
89
-
90
-	/**
91
-	 * @return string
92
-	 */
93
-	public function getTwitter() {
94
-		return isset($this->data['twitter']) ? $this->data['twitter'] : '';
95
-	}
96
-
97
-	/**
98
-	 * @return string[]
99
-	 */
100
-	public function getGroups() {
101
-		return $this->data['groups'];
102
-	}
103
-
104
-	/**
105
-	 * @return string
106
-	 */
107
-	public function getLanguage() {
108
-		return $this->data['language'];
109
-	}
110
-
111
-	/**
112
-	 * @return int
113
-	 */
114
-	public function getUsedSpace() {
115
-		return $this->data['quota']['used'];
116
-	}
117
-
118
-	/**
119
-	 * @return int
120
-	 */
121
-	public function getFreeSpace() {
122
-		return $this->data['quota']['free'];
123
-	}
124
-
125
-	/**
126
-	 * @return int
127
-	 */
128
-	public function getTotalSpace() {
129
-		return $this->data['quota']['total'];
130
-	}
131
-
132
-	/**
133
-	 * @return int
134
-	 */
135
-	public function getQuota() {
136
-		return $this->data['quota']['quota'];
137
-	}
28
+    const EXPECTED_KEYS = [
29
+        'id',
30
+        'email',
31
+        'displayname',
32
+        'phone',
33
+        'address',
34
+        'website',
35
+        'groups',
36
+        'language',
37
+        'quota'
38
+    ];
39
+
40
+    /** @var array */
41
+    private $data;
42
+
43
+    public function __construct(array $data) {
44
+        $this->data = $data;
45
+    }
46
+
47
+
48
+    /**
49
+     * @return string
50
+     */
51
+    public function getUserId() {
52
+        return $this->data['id'];
53
+    }
54
+
55
+    /**
56
+     * @return string
57
+     */
58
+    public function getEmail() {
59
+        return $this->data['email'];
60
+    }
61
+
62
+    /**
63
+     * @return string
64
+     */
65
+    public function getDisplayName() {
66
+        return $this->data['displayname'];
67
+    }
68
+
69
+    /**
70
+     * @return string
71
+     */
72
+    public function getPhone() {
73
+        return $this->data['phone'];
74
+    }
75
+
76
+    /**
77
+     * @return string
78
+     */
79
+    public function getAddress() {
80
+        return $this->data['address'];
81
+    }
82
+
83
+    /**
84
+     * @return string
85
+     */
86
+    public function getWebsite() {
87
+        return $this->data['website'];
88
+    }
89
+
90
+    /**
91
+     * @return string
92
+     */
93
+    public function getTwitter() {
94
+        return isset($this->data['twitter']) ? $this->data['twitter'] : '';
95
+    }
96
+
97
+    /**
98
+     * @return string[]
99
+     */
100
+    public function getGroups() {
101
+        return $this->data['groups'];
102
+    }
103
+
104
+    /**
105
+     * @return string
106
+     */
107
+    public function getLanguage() {
108
+        return $this->data['language'];
109
+    }
110
+
111
+    /**
112
+     * @return int
113
+     */
114
+    public function getUsedSpace() {
115
+        return $this->data['quota']['used'];
116
+    }
117
+
118
+    /**
119
+     * @return int
120
+     */
121
+    public function getFreeSpace() {
122
+        return $this->data['quota']['free'];
123
+    }
124
+
125
+    /**
126
+     * @return int
127
+     */
128
+    public function getTotalSpace() {
129
+        return $this->data['quota']['total'];
130
+    }
131
+
132
+    /**
133
+     * @return int
134
+     */
135
+    public function getQuota() {
136
+        return $this->data['quota']['quota'];
137
+    }
138 138
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncBirthdayCalendar.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 		$output->writeln('');
110 110
 	}
111 111
 
112
-	protected function verifyEnabled () {
112
+	protected function verifyEnabled() {
113 113
 		$isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
114 114
 
115 115
 		if ($isEnabled !== 'yes') {
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -34,86 +34,86 @@
 block discarded – undo
34 34
 
35 35
 class SyncBirthdayCalendar extends Command {
36 36
 
37
-	/** @var BirthdayService */
38
-	private $birthdayService;
39
-
40
-	/** @var IConfig */
41
-	private $config;
42
-
43
-	/** @var IUserManager */
44
-	private $userManager;
45
-
46
-	/**
47
-	 * @param IUserManager $userManager
48
-	 * @param IConfig $config
49
-	 * @param BirthdayService $birthdayService
50
-	 */
51
-	function __construct(IUserManager $userManager, IConfig $config,
52
-						 BirthdayService $birthdayService) {
53
-		parent::__construct();
54
-		$this->birthdayService = $birthdayService;
55
-		$this->config = $config;
56
-		$this->userManager = $userManager;
57
-	}
58
-
59
-	protected function configure() {
60
-		$this
61
-			->setName('dav:sync-birthday-calendar')
62
-			->setDescription('Synchronizes the birthday calendar')
63
-			->addArgument('user',
64
-				InputArgument::OPTIONAL,
65
-				'User for whom the birthday calendar will be synchronized');
66
-	}
67
-
68
-	/**
69
-	 * @param InputInterface $input
70
-	 * @param OutputInterface $output
71
-	 */
72
-	protected function execute(InputInterface $input, OutputInterface $output) {
73
-		$this->verifyEnabled();
74
-
75
-		$user = $input->getArgument('user');
76
-		if (!is_null($user)) {
77
-			if (!$this->userManager->userExists($user)) {
78
-				throw new \InvalidArgumentException("User <$user> in unknown.");
79
-			}
80
-
81
-			// re-enable the birthday calendar in case it's called directly with a user name
82
-			$isEnabled = $this->config->getUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
83
-			if ($isEnabled !== 'yes') {
84
-				$this->config->setUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
85
-				$output->writeln("Re-enabling birthday calendar for $user");
86
-			}
87
-
88
-			$output->writeln("Start birthday calendar sync for $user");
89
-			$this->birthdayService->syncUser($user);
90
-			return;
91
-		}
92
-		$output->writeln("Start birthday calendar sync for all users ...");
93
-		$p = new ProgressBar($output);
94
-		$p->start();
95
-		$this->userManager->callForSeenUsers(function($user) use ($p)  {
96
-			$p->advance();
97
-
98
-			$userId = $user->getUID();
99
-			$isEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
100
-			if ($isEnabled !== 'yes') {
101
-				return;
102
-			}
103
-
104
-			/** @var IUser $user */
105
-			$this->birthdayService->syncUser($user->getUID());
106
-		});
107
-
108
-		$p->finish();
109
-		$output->writeln('');
110
-	}
111
-
112
-	protected function verifyEnabled () {
113
-		$isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
114
-
115
-		if ($isEnabled !== 'yes') {
116
-			throw new \InvalidArgumentException('Birthday calendars are disabled');
117
-		}
118
-	}
37
+    /** @var BirthdayService */
38
+    private $birthdayService;
39
+
40
+    /** @var IConfig */
41
+    private $config;
42
+
43
+    /** @var IUserManager */
44
+    private $userManager;
45
+
46
+    /**
47
+     * @param IUserManager $userManager
48
+     * @param IConfig $config
49
+     * @param BirthdayService $birthdayService
50
+     */
51
+    function __construct(IUserManager $userManager, IConfig $config,
52
+                            BirthdayService $birthdayService) {
53
+        parent::__construct();
54
+        $this->birthdayService = $birthdayService;
55
+        $this->config = $config;
56
+        $this->userManager = $userManager;
57
+    }
58
+
59
+    protected function configure() {
60
+        $this
61
+            ->setName('dav:sync-birthday-calendar')
62
+            ->setDescription('Synchronizes the birthday calendar')
63
+            ->addArgument('user',
64
+                InputArgument::OPTIONAL,
65
+                'User for whom the birthday calendar will be synchronized');
66
+    }
67
+
68
+    /**
69
+     * @param InputInterface $input
70
+     * @param OutputInterface $output
71
+     */
72
+    protected function execute(InputInterface $input, OutputInterface $output) {
73
+        $this->verifyEnabled();
74
+
75
+        $user = $input->getArgument('user');
76
+        if (!is_null($user)) {
77
+            if (!$this->userManager->userExists($user)) {
78
+                throw new \InvalidArgumentException("User <$user> in unknown.");
79
+            }
80
+
81
+            // re-enable the birthday calendar in case it's called directly with a user name
82
+            $isEnabled = $this->config->getUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
83
+            if ($isEnabled !== 'yes') {
84
+                $this->config->setUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
85
+                $output->writeln("Re-enabling birthday calendar for $user");
86
+            }
87
+
88
+            $output->writeln("Start birthday calendar sync for $user");
89
+            $this->birthdayService->syncUser($user);
90
+            return;
91
+        }
92
+        $output->writeln("Start birthday calendar sync for all users ...");
93
+        $p = new ProgressBar($output);
94
+        $p->start();
95
+        $this->userManager->callForSeenUsers(function($user) use ($p)  {
96
+            $p->advance();
97
+
98
+            $userId = $user->getUID();
99
+            $isEnabled = $this->config->getUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes');
100
+            if ($isEnabled !== 'yes') {
101
+                return;
102
+            }
103
+
104
+            /** @var IUser $user */
105
+            $this->birthdayService->syncUser($user->getUID());
106
+        });
107
+
108
+        $p->finish();
109
+        $output->writeln('');
110
+    }
111
+
112
+    protected function verifyEnabled () {
113
+        $isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
114
+
115
+        if ($isEnabled !== 'yes') {
116
+            throw new \InvalidArgumentException('Birthday calendars are disabled');
117
+        }
118
+    }
119 119
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalendarObject.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	private static function createConfidentialObject(Component\VCalendar $vObject) {
73 73
 		/** @var Component $vElement */
74 74
 		$vElement = null;
75
-		if(isset($vObject->VEVENT)) {
75
+		if (isset($vObject->VEVENT)) {
76 76
 			$vElement = $vObject->VEVENT;
77 77
 		}
78
-		if(isset($vObject->VJOURNAL)) {
78
+		if (isset($vObject->VJOURNAL)) {
79 79
 			$vElement = $vObject->VJOURNAL;
80 80
 		}
81
-		if(isset($vObject->VTODO)) {
81
+		if (isset($vObject->VTODO)) {
82 82
 			$vElement = $vObject->VTODO;
83 83
 		}
84
-		if(!is_null($vElement)) {
84
+		if (!is_null($vElement)) {
85 85
 			foreach ($vElement->children() as &$property) {
86 86
 				/** @var Property $property */
87
-				switch($property->name) {
87
+				switch ($property->name) {
88 88
 					case 'CREATED':
89 89
 					case 'DTSTART':
90 90
 					case 'RRULE':
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	private function removeVAlarms(Component\VCalendar $vObject) {
113 113
 		$subcomponents = $vObject->getComponents();
114 114
 
115
-		foreach($subcomponents as $subcomponent) {
115
+		foreach ($subcomponents as $subcomponent) {
116 116
 			unset($subcomponent->VALARM);
117 117
 		}
118 118
 	}
Please login to merge, or discard this patch.
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -32,114 +32,114 @@
 block discarded – undo
32 32
 
33 33
 class CalendarObject extends \Sabre\CalDAV\CalendarObject {
34 34
 
35
-	/**
36
-	 * CalendarObject constructor.
37
-	 *
38
-	 * @param CalDavBackend $caldavBackend
39
-	 * @param array $calendarInfo
40
-	 * @param array $objectData
41
-	 */
42
-	public function __construct(CalDavBackend $caldavBackend, array $calendarInfo,
43
-								array $objectData) {
44
-		parent::__construct($caldavBackend, $calendarInfo, $objectData);
45
-
46
-		if ($this->isShared()) {
47
-			unset($this->objectData['size']);
48
-		}
49
-	}
50
-
51
-	/**
52
-	 * @inheritdoc
53
-	 */
54
-	function get() {
55
-		$data = parent::get();
56
-
57
-		if (!$this->isShared()) {
58
-			return $data;
59
-		}
60
-
61
-		$vObject = Reader::read($data);
62
-
63
-		// remove VAlarms if calendar is shared read-only
64
-		if (!$this->canWrite()) {
65
-			$this->removeVAlarms($vObject);
66
-		}
67
-
68
-		// shows as busy if event is declared confidential
69
-		if ($this->objectData['classification'] === CalDavBackend::CLASSIFICATION_CONFIDENTIAL) {
70
-			$this->createConfidentialObject($vObject);
71
-		}
72
-
73
-		return $vObject->serialize();
74
-	}
75
-
76
-	protected function isShared() {
77
-		if (!isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
78
-			return false;
79
-		}
80
-
81
-		return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri'];
82
-	}
83
-
84
-	/**
85
-	 * @param Component\VCalendar $vObject
86
-	 * @return void
87
-	 */
88
-	private static function createConfidentialObject(Component\VCalendar $vObject) {
89
-		/** @var Component $vElement */
90
-		$vElement = null;
91
-		if(isset($vObject->VEVENT)) {
92
-			$vElement = $vObject->VEVENT;
93
-		}
94
-		if(isset($vObject->VJOURNAL)) {
95
-			$vElement = $vObject->VJOURNAL;
96
-		}
97
-		if(isset($vObject->VTODO)) {
98
-			$vElement = $vObject->VTODO;
99
-		}
100
-		if(!is_null($vElement)) {
101
-			foreach ($vElement->children() as &$property) {
102
-				/** @var Property $property */
103
-				switch($property->name) {
104
-					case 'CREATED':
105
-					case 'DTSTART':
106
-					case 'RRULE':
107
-					case 'DURATION':
108
-					case 'DTEND':
109
-					case 'CLASS':
110
-					case 'UID':
111
-						break;
112
-					case 'SUMMARY':
113
-						$property->setValue('Busy');
114
-						break;
115
-					default:
116
-						$vElement->__unset($property->name);
117
-						unset($property);
118
-						break;
119
-				}
120
-			}
121
-		}
122
-	}
123
-
124
-	/**
125
-	 * @param Component\VCalendar $vObject
126
-	 * @return void
127
-	 */
128
-	private function removeVAlarms(Component\VCalendar $vObject) {
129
-		$subcomponents = $vObject->getComponents();
130
-
131
-		foreach($subcomponents as $subcomponent) {
132
-			unset($subcomponent->VALARM);
133
-		}
134
-	}
135
-
136
-	/**
137
-	 * @return bool
138
-	 */
139
-	private function canWrite() {
140
-		if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) {
141
-			return !$this->calendarInfo['{http://owncloud.org/ns}read-only'];
142
-		}
143
-		return true;
144
-	}
35
+    /**
36
+     * CalendarObject constructor.
37
+     *
38
+     * @param CalDavBackend $caldavBackend
39
+     * @param array $calendarInfo
40
+     * @param array $objectData
41
+     */
42
+    public function __construct(CalDavBackend $caldavBackend, array $calendarInfo,
43
+                                array $objectData) {
44
+        parent::__construct($caldavBackend, $calendarInfo, $objectData);
45
+
46
+        if ($this->isShared()) {
47
+            unset($this->objectData['size']);
48
+        }
49
+    }
50
+
51
+    /**
52
+     * @inheritdoc
53
+     */
54
+    function get() {
55
+        $data = parent::get();
56
+
57
+        if (!$this->isShared()) {
58
+            return $data;
59
+        }
60
+
61
+        $vObject = Reader::read($data);
62
+
63
+        // remove VAlarms if calendar is shared read-only
64
+        if (!$this->canWrite()) {
65
+            $this->removeVAlarms($vObject);
66
+        }
67
+
68
+        // shows as busy if event is declared confidential
69
+        if ($this->objectData['classification'] === CalDavBackend::CLASSIFICATION_CONFIDENTIAL) {
70
+            $this->createConfidentialObject($vObject);
71
+        }
72
+
73
+        return $vObject->serialize();
74
+    }
75
+
76
+    protected function isShared() {
77
+        if (!isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
78
+            return false;
79
+        }
80
+
81
+        return $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri'];
82
+    }
83
+
84
+    /**
85
+     * @param Component\VCalendar $vObject
86
+     * @return void
87
+     */
88
+    private static function createConfidentialObject(Component\VCalendar $vObject) {
89
+        /** @var Component $vElement */
90
+        $vElement = null;
91
+        if(isset($vObject->VEVENT)) {
92
+            $vElement = $vObject->VEVENT;
93
+        }
94
+        if(isset($vObject->VJOURNAL)) {
95
+            $vElement = $vObject->VJOURNAL;
96
+        }
97
+        if(isset($vObject->VTODO)) {
98
+            $vElement = $vObject->VTODO;
99
+        }
100
+        if(!is_null($vElement)) {
101
+            foreach ($vElement->children() as &$property) {
102
+                /** @var Property $property */
103
+                switch($property->name) {
104
+                    case 'CREATED':
105
+                    case 'DTSTART':
106
+                    case 'RRULE':
107
+                    case 'DURATION':
108
+                    case 'DTEND':
109
+                    case 'CLASS':
110
+                    case 'UID':
111
+                        break;
112
+                    case 'SUMMARY':
113
+                        $property->setValue('Busy');
114
+                        break;
115
+                    default:
116
+                        $vElement->__unset($property->name);
117
+                        unset($property);
118
+                        break;
119
+                }
120
+            }
121
+        }
122
+    }
123
+
124
+    /**
125
+     * @param Component\VCalendar $vObject
126
+     * @return void
127
+     */
128
+    private function removeVAlarms(Component\VCalendar $vObject) {
129
+        $subcomponents = $vObject->getComponents();
130
+
131
+        foreach($subcomponents as $subcomponent) {
132
+            unset($subcomponent->VALARM);
133
+        }
134
+    }
135
+
136
+    /**
137
+     * @return bool
138
+     */
139
+    private function canWrite() {
140
+        if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) {
141
+            return !$this->calendarInfo['{http://owncloud.org/ns}read-only'];
142
+        }
143
+        return true;
144
+    }
145 145
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Activity/Provider/Todo.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -25,120 +25,120 @@
 block discarded – undo
25 25
 
26 26
 class Todo extends Event {
27 27
 
28
-	/**
29
-	 * @param string $language
30
-	 * @param IEvent $event
31
-	 * @param IEvent|null $previousEvent
32
-	 * @return IEvent
33
-	 * @throws \InvalidArgumentException
34
-	 * @since 11.0.0
35
-	 */
36
-	public function parse($language, IEvent $event, IEvent $previousEvent = null) {
37
-		if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') {
38
-			throw new \InvalidArgumentException();
39
-		}
28
+    /**
29
+     * @param string $language
30
+     * @param IEvent $event
31
+     * @param IEvent|null $previousEvent
32
+     * @return IEvent
33
+     * @throws \InvalidArgumentException
34
+     * @since 11.0.0
35
+     */
36
+    public function parse($language, IEvent $event, IEvent $previousEvent = null) {
37
+        if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') {
38
+            throw new \InvalidArgumentException();
39
+        }
40 40
 
41
-		$this->l = $this->languageFactory->get('dav', $language);
41
+        $this->l = $this->languageFactory->get('dav', $language);
42 42
 
43
-		if ($this->activityManager->getRequirePNG()) {
44
-			$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png')));
45
-		} else {
46
-			$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
47
-		}
43
+        if ($this->activityManager->getRequirePNG()) {
44
+            $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png')));
45
+        } else {
46
+            $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
47
+        }
48 48
 
49
-		if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
50
-			$subject = $this->l->t('{actor} created todo {todo} in list {calendar}');
51
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') {
52
-			$subject = $this->l->t('You created todo {todo} in list {calendar}');
53
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') {
54
-			$subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}');
55
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') {
56
-			$subject = $this->l->t('You deleted todo {todo} from list {calendar}');
57
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') {
58
-			$subject = $this->l->t('{actor} updated todo {todo} in list {calendar}');
59
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') {
60
-			$subject = $this->l->t('You updated todo {todo} in list {calendar}');
49
+        if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
50
+            $subject = $this->l->t('{actor} created todo {todo} in list {calendar}');
51
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') {
52
+            $subject = $this->l->t('You created todo {todo} in list {calendar}');
53
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') {
54
+            $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}');
55
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') {
56
+            $subject = $this->l->t('You deleted todo {todo} from list {calendar}');
57
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') {
58
+            $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}');
59
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') {
60
+            $subject = $this->l->t('You updated todo {todo} in list {calendar}');
61 61
 
62
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') {
63
-			$subject = $this->l->t('{actor} solved todo {todo} in list {calendar}');
64
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') {
65
-			$subject = $this->l->t('You solved todo {todo} in list {calendar}');
66
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') {
67
-			$subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}');
68
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') {
69
-			$subject = $this->l->t('You reopened todo {todo} in list {calendar}');
70
-		} else {
71
-			throw new \InvalidArgumentException();
72
-		}
62
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') {
63
+            $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}');
64
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') {
65
+            $subject = $this->l->t('You solved todo {todo} in list {calendar}');
66
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') {
67
+            $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}');
68
+        } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') {
69
+            $subject = $this->l->t('You reopened todo {todo} in list {calendar}');
70
+        } else {
71
+            throw new \InvalidArgumentException();
72
+        }
73 73
 
74
-		$parsedParameters = $this->getParameters($event);
75
-		$this->setSubjects($event, $subject, $parsedParameters);
74
+        $parsedParameters = $this->getParameters($event);
75
+        $this->setSubjects($event, $subject, $parsedParameters);
76 76
 
77
-		$event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent);
77
+        $event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent);
78 78
 
79
-		return $event;
80
-	}
79
+        return $event;
80
+    }
81 81
 
82
-	/**
83
-	 * @param IEvent $event
84
-	 * @return array
85
-	 */
86
-	protected function getParameters(IEvent $event) {
87
-		$subject = $event->getSubject();
88
-		$parameters = $event->getSubjectParameters();
82
+    /**
83
+     * @param IEvent $event
84
+     * @return array
85
+     */
86
+    protected function getParameters(IEvent $event) {
87
+        $subject = $event->getSubject();
88
+        $parameters = $event->getSubjectParameters();
89 89
 
90
-		// Nextcloud 13+
91
-		if (isset($parameters['calendar'])) {
92
-			switch ($subject) {
93
-				case self::SUBJECT_OBJECT_ADD . '_todo':
94
-				case self::SUBJECT_OBJECT_DELETE . '_todo':
95
-				case self::SUBJECT_OBJECT_UPDATE . '_todo':
96
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
97
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
98
-					return [
99
-						'actor' => $this->generateUserParameter($parameters['actor']),
100
-						'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
101
-						'todo' => $this->generateObjectParameter($parameters['object']),
102
-					];
103
-				case self::SUBJECT_OBJECT_ADD . '_todo_self':
104
-				case self::SUBJECT_OBJECT_DELETE . '_todo_self':
105
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
106
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
107
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
108
-					return [
109
-						'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
110
-						'todo' => $this->generateObjectParameter($parameters['object']),
111
-					];
112
-			}
113
-		}
90
+        // Nextcloud 13+
91
+        if (isset($parameters['calendar'])) {
92
+            switch ($subject) {
93
+                case self::SUBJECT_OBJECT_ADD . '_todo':
94
+                case self::SUBJECT_OBJECT_DELETE . '_todo':
95
+                case self::SUBJECT_OBJECT_UPDATE . '_todo':
96
+                case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
97
+                case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
98
+                    return [
99
+                        'actor' => $this->generateUserParameter($parameters['actor']),
100
+                        'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
101
+                        'todo' => $this->generateObjectParameter($parameters['object']),
102
+                    ];
103
+                case self::SUBJECT_OBJECT_ADD . '_todo_self':
104
+                case self::SUBJECT_OBJECT_DELETE . '_todo_self':
105
+                case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
106
+                case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
107
+                case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
108
+                    return [
109
+                        'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
110
+                        'todo' => $this->generateObjectParameter($parameters['object']),
111
+                    ];
112
+            }
113
+        }
114 114
 
115
-		// Legacy - Do NOT Remove unless necessary
116
-		// Removing this will break parsing of activities that were created on
117
-		// Nextcloud 12, so we should keep this as long as it's acceptable.
118
-		// Otherwise if people upgrade over multiple releases in a short period,
119
-		// they will get the dead entries in their stream.
120
-		switch ($subject) {
121
-			case self::SUBJECT_OBJECT_ADD . '_todo':
122
-			case self::SUBJECT_OBJECT_DELETE . '_todo':
123
-			case self::SUBJECT_OBJECT_UPDATE . '_todo':
124
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
125
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
126
-				return [
127
-					'actor' => $this->generateUserParameter($parameters[0]),
128
-					'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
129
-					'todo' => $this->generateObjectParameter($parameters[2]),
130
-				];
131
-			case self::SUBJECT_OBJECT_ADD . '_todo_self':
132
-			case self::SUBJECT_OBJECT_DELETE . '_todo_self':
133
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
134
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
135
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
136
-				return [
137
-					'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
138
-					'todo' => $this->generateObjectParameter($parameters[2]),
139
-				];
140
-		}
115
+        // Legacy - Do NOT Remove unless necessary
116
+        // Removing this will break parsing of activities that were created on
117
+        // Nextcloud 12, so we should keep this as long as it's acceptable.
118
+        // Otherwise if people upgrade over multiple releases in a short period,
119
+        // they will get the dead entries in their stream.
120
+        switch ($subject) {
121
+            case self::SUBJECT_OBJECT_ADD . '_todo':
122
+            case self::SUBJECT_OBJECT_DELETE . '_todo':
123
+            case self::SUBJECT_OBJECT_UPDATE . '_todo':
124
+            case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
125
+            case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
126
+                return [
127
+                    'actor' => $this->generateUserParameter($parameters[0]),
128
+                    'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
129
+                    'todo' => $this->generateObjectParameter($parameters[2]),
130
+                ];
131
+            case self::SUBJECT_OBJECT_ADD . '_todo_self':
132
+            case self::SUBJECT_OBJECT_DELETE . '_todo_self':
133
+            case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
134
+            case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
135
+            case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
136
+                return [
137
+                    'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
138
+                    'todo' => $this->generateObjectParameter($parameters[2]),
139
+                ];
140
+        }
141 141
 
142
-		throw new \InvalidArgumentException();
143
-	}
142
+        throw new \InvalidArgumentException();
143
+    }
144 144
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@  discard block
 block discarded – undo
46 46
 			$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
47 47
 		}
48 48
 
49
-		if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
49
+		if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_todo') {
50 50
 			$subject = $this->l->t('{actor} created todo {todo} in list {calendar}');
51
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') {
51
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD.'_todo_self') {
52 52
 			$subject = $this->l->t('You created todo {todo} in list {calendar}');
53
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') {
53
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_todo') {
54 54
 			$subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}');
55
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') {
55
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE.'_todo_self') {
56 56
 			$subject = $this->l->t('You deleted todo {todo} from list {calendar}');
57
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') {
57
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo') {
58 58
 			$subject = $this->l->t('{actor} updated todo {todo} in list {calendar}');
59
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') {
59
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_self') {
60 60
 			$subject = $this->l->t('You updated todo {todo} in list {calendar}');
61 61
 
62
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') {
62
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_completed') {
63 63
 			$subject = $this->l->t('{actor} solved todo {todo} in list {calendar}');
64
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') {
64
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_completed_self') {
65 65
 			$subject = $this->l->t('You solved todo {todo} in list {calendar}');
66
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') {
66
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action') {
67 67
 			$subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}');
68
-		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') {
68
+		} else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action_self') {
69 69
 			$subject = $this->l->t('You reopened todo {todo} in list {calendar}');
70 70
 		} else {
71 71
 			throw new \InvalidArgumentException();
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 		// Nextcloud 13+
91 91
 		if (isset($parameters['calendar'])) {
92 92
 			switch ($subject) {
93
-				case self::SUBJECT_OBJECT_ADD . '_todo':
94
-				case self::SUBJECT_OBJECT_DELETE . '_todo':
95
-				case self::SUBJECT_OBJECT_UPDATE . '_todo':
96
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
97
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
93
+				case self::SUBJECT_OBJECT_ADD.'_todo':
94
+				case self::SUBJECT_OBJECT_DELETE.'_todo':
95
+				case self::SUBJECT_OBJECT_UPDATE.'_todo':
96
+				case self::SUBJECT_OBJECT_UPDATE.'_todo_completed':
97
+				case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action':
98 98
 					return [
99 99
 						'actor' => $this->generateUserParameter($parameters['actor']),
100 100
 						'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
101 101
 						'todo' => $this->generateObjectParameter($parameters['object']),
102 102
 					];
103
-				case self::SUBJECT_OBJECT_ADD . '_todo_self':
104
-				case self::SUBJECT_OBJECT_DELETE . '_todo_self':
105
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
106
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
107
-				case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
103
+				case self::SUBJECT_OBJECT_ADD.'_todo_self':
104
+				case self::SUBJECT_OBJECT_DELETE.'_todo_self':
105
+				case self::SUBJECT_OBJECT_UPDATE.'_todo_self':
106
+				case self::SUBJECT_OBJECT_UPDATE.'_todo_completed_self':
107
+				case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action_self':
108 108
 					return [
109 109
 						'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
110 110
 						'todo' => $this->generateObjectParameter($parameters['object']),
@@ -118,23 +118,23 @@  discard block
 block discarded – undo
118 118
 		// Otherwise if people upgrade over multiple releases in a short period,
119 119
 		// they will get the dead entries in their stream.
120 120
 		switch ($subject) {
121
-			case self::SUBJECT_OBJECT_ADD . '_todo':
122
-			case self::SUBJECT_OBJECT_DELETE . '_todo':
123
-			case self::SUBJECT_OBJECT_UPDATE . '_todo':
124
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_completed':
125
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
121
+			case self::SUBJECT_OBJECT_ADD.'_todo':
122
+			case self::SUBJECT_OBJECT_DELETE.'_todo':
123
+			case self::SUBJECT_OBJECT_UPDATE.'_todo':
124
+			case self::SUBJECT_OBJECT_UPDATE.'_todo_completed':
125
+			case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action':
126 126
 				return [
127 127
 					'actor' => $this->generateUserParameter($parameters[0]),
128
-					'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
128
+					'calendar' => $this->generateLegacyCalendarParameter((int) $event->getObjectId(), $parameters[1]),
129 129
 					'todo' => $this->generateObjectParameter($parameters[2]),
130 130
 				];
131
-			case self::SUBJECT_OBJECT_ADD . '_todo_self':
132
-			case self::SUBJECT_OBJECT_DELETE . '_todo_self':
133
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_self':
134
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
135
-			case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
131
+			case self::SUBJECT_OBJECT_ADD.'_todo_self':
132
+			case self::SUBJECT_OBJECT_DELETE.'_todo_self':
133
+			case self::SUBJECT_OBJECT_UPDATE.'_todo_self':
134
+			case self::SUBJECT_OBJECT_UPDATE.'_todo_completed_self':
135
+			case self::SUBJECT_OBJECT_UPDATE.'_todo_needs_action_self':
136 136
 				return [
137
-					'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]),
137
+					'calendar' => $this->generateLegacyCalendarParameter((int) $event->getObjectId(), $parameters[1]),
138 138
 					'todo' => $this->generateObjectParameter($parameters[2]),
139 139
 				];
140 140
 		}
Please login to merge, or discard this patch.
apps/admin_audit/composer/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 
3 3
 // autoload.php @generated by Composer
4 4
 
5
-require_once __DIR__ . '/composer/autoload_real.php';
5
+require_once __DIR__.'/composer/autoload_real.php';
6 6
 
7 7
 return ComposerAutoloaderInitAdminAudit::getLoader();
Please login to merge, or discard this patch.