Passed
Push — master ( a78624...b981cb )
by Christoph
14:14 queued 11s
created
lib/public/IUser.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -36,178 +36,178 @@
 block discarded – undo
36 36
  */
37 37
 interface IUser {
38 38
 
39
-	/**
40
-	 * get the user id
41
-	 *
42
-	 * @return string
43
-	 * @since 8.0.0
44
-	 */
45
-	public function getUID();
46
-
47
-	/**
48
-	 * get the display name for the user, if no specific display name is set it will fallback to the user id
49
-	 *
50
-	 * @return string
51
-	 * @since 8.0.0
52
-	 */
53
-	public function getDisplayName();
54
-
55
-	/**
56
-	 * set the display name for the user
57
-	 *
58
-	 * @param string $displayName
59
-	 * @return bool
60
-	 * @since 8.0.0
61
-	 */
62
-	public function setDisplayName($displayName);
63
-
64
-	/**
65
-	 * returns the timestamp of the user's last login or 0 if the user did never
66
-	 * login
67
-	 *
68
-	 * @return int
69
-	 * @since 8.0.0
70
-	 */
71
-	public function getLastLogin();
72
-
73
-	/**
74
-	 * updates the timestamp of the most recent login of this user
75
-	 * @since 8.0.0
76
-	 */
77
-	public function updateLastLoginTimestamp();
78
-
79
-	/**
80
-	 * Delete the user
81
-	 *
82
-	 * @return bool
83
-	 * @since 8.0.0
84
-	 */
85
-	public function delete();
86
-
87
-	/**
88
-	 * Set the password of the user
89
-	 *
90
-	 * @param string $password
91
-	 * @param string $recoveryPassword for the encryption app to reset encryption keys
92
-	 * @return bool
93
-	 * @since 8.0.0
94
-	 */
95
-	public function setPassword($password, $recoveryPassword = null);
96
-
97
-	/**
98
-	 * get the users home folder to mount
99
-	 *
100
-	 * @return string
101
-	 * @since 8.0.0
102
-	 */
103
-	public function getHome();
104
-
105
-	/**
106
-	 * Get the name of the backend class the user is connected with
107
-	 *
108
-	 * @return string
109
-	 * @since 8.0.0
110
-	 */
111
-	public function getBackendClassName();
112
-
113
-	/**
114
-	 * Get the backend for the current user object
115
-	 *
116
-	 * @return UserInterface
117
-	 * @since 15.0.0
118
-	 */
119
-	public function getBackend();
120
-
121
-	/**
122
-	 * check if the backend allows the user to change his avatar on Personal page
123
-	 *
124
-	 * @return bool
125
-	 * @since 8.0.0
126
-	 */
127
-	public function canChangeAvatar();
128
-
129
-	/**
130
-	 * check if the backend supports changing passwords
131
-	 *
132
-	 * @return bool
133
-	 * @since 8.0.0
134
-	 */
135
-	public function canChangePassword();
136
-
137
-	/**
138
-	 * check if the backend supports changing display names
139
-	 *
140
-	 * @return bool
141
-	 * @since 8.0.0
142
-	 */
143
-	public function canChangeDisplayName();
144
-
145
-	/**
146
-	 * check if the user is enabled
147
-	 *
148
-	 * @return bool
149
-	 * @since 8.0.0
150
-	 */
151
-	public function isEnabled();
152
-
153
-	/**
154
-	 * set the enabled status for the user
155
-	 *
156
-	 * @param bool $enabled
157
-	 * @since 8.0.0
158
-	 */
159
-	public function setEnabled(bool $enabled = true);
160
-
161
-	/**
162
-	 * get the users email address
163
-	 *
164
-	 * @return string|null
165
-	 * @since 9.0.0
166
-	 */
167
-	public function getEMailAddress();
168
-
169
-	/**
170
-	 * get the avatar image if it exists
171
-	 *
172
-	 * @param int $size
173
-	 * @return IImage|null
174
-	 * @since 9.0.0
175
-	 */
176
-	public function getAvatarImage($size);
177
-
178
-	/**
179
-	 * get the federation cloud id
180
-	 *
181
-	 * @return string
182
-	 * @since 9.0.0
183
-	 */
184
-	public function getCloudId();
185
-
186
-	/**
187
-	 * set the email address of the user
188
-	 *
189
-	 * @param string|null $mailAddress
190
-	 * @return void
191
-	 * @since 9.0.0
192
-	 */
193
-	public function setEMailAddress($mailAddress);
194
-
195
-	/**
196
-	 * get the users' quota in human readable form. If a specific quota is not
197
-	 * set for the user, the default value is returned. If a default setting
198
-	 * was not set otherwise, it is return as 'none', i.e. quota is not limited.
199
-	 *
200
-	 * @return string
201
-	 * @since 9.0.0
202
-	 */
203
-	public function getQuota();
204
-
205
-	/**
206
-	 * set the users' quota
207
-	 *
208
-	 * @param string $quota
209
-	 * @return void
210
-	 * @since 9.0.0
211
-	 */
212
-	public function setQuota($quota);
39
+    /**
40
+     * get the user id
41
+     *
42
+     * @return string
43
+     * @since 8.0.0
44
+     */
45
+    public function getUID();
46
+
47
+    /**
48
+     * get the display name for the user, if no specific display name is set it will fallback to the user id
49
+     *
50
+     * @return string
51
+     * @since 8.0.0
52
+     */
53
+    public function getDisplayName();
54
+
55
+    /**
56
+     * set the display name for the user
57
+     *
58
+     * @param string $displayName
59
+     * @return bool
60
+     * @since 8.0.0
61
+     */
62
+    public function setDisplayName($displayName);
63
+
64
+    /**
65
+     * returns the timestamp of the user's last login or 0 if the user did never
66
+     * login
67
+     *
68
+     * @return int
69
+     * @since 8.0.0
70
+     */
71
+    public function getLastLogin();
72
+
73
+    /**
74
+     * updates the timestamp of the most recent login of this user
75
+     * @since 8.0.0
76
+     */
77
+    public function updateLastLoginTimestamp();
78
+
79
+    /**
80
+     * Delete the user
81
+     *
82
+     * @return bool
83
+     * @since 8.0.0
84
+     */
85
+    public function delete();
86
+
87
+    /**
88
+     * Set the password of the user
89
+     *
90
+     * @param string $password
91
+     * @param string $recoveryPassword for the encryption app to reset encryption keys
92
+     * @return bool
93
+     * @since 8.0.0
94
+     */
95
+    public function setPassword($password, $recoveryPassword = null);
96
+
97
+    /**
98
+     * get the users home folder to mount
99
+     *
100
+     * @return string
101
+     * @since 8.0.0
102
+     */
103
+    public function getHome();
104
+
105
+    /**
106
+     * Get the name of the backend class the user is connected with
107
+     *
108
+     * @return string
109
+     * @since 8.0.0
110
+     */
111
+    public function getBackendClassName();
112
+
113
+    /**
114
+     * Get the backend for the current user object
115
+     *
116
+     * @return UserInterface
117
+     * @since 15.0.0
118
+     */
119
+    public function getBackend();
120
+
121
+    /**
122
+     * check if the backend allows the user to change his avatar on Personal page
123
+     *
124
+     * @return bool
125
+     * @since 8.0.0
126
+     */
127
+    public function canChangeAvatar();
128
+
129
+    /**
130
+     * check if the backend supports changing passwords
131
+     *
132
+     * @return bool
133
+     * @since 8.0.0
134
+     */
135
+    public function canChangePassword();
136
+
137
+    /**
138
+     * check if the backend supports changing display names
139
+     *
140
+     * @return bool
141
+     * @since 8.0.0
142
+     */
143
+    public function canChangeDisplayName();
144
+
145
+    /**
146
+     * check if the user is enabled
147
+     *
148
+     * @return bool
149
+     * @since 8.0.0
150
+     */
151
+    public function isEnabled();
152
+
153
+    /**
154
+     * set the enabled status for the user
155
+     *
156
+     * @param bool $enabled
157
+     * @since 8.0.0
158
+     */
159
+    public function setEnabled(bool $enabled = true);
160
+
161
+    /**
162
+     * get the users email address
163
+     *
164
+     * @return string|null
165
+     * @since 9.0.0
166
+     */
167
+    public function getEMailAddress();
168
+
169
+    /**
170
+     * get the avatar image if it exists
171
+     *
172
+     * @param int $size
173
+     * @return IImage|null
174
+     * @since 9.0.0
175
+     */
176
+    public function getAvatarImage($size);
177
+
178
+    /**
179
+     * get the federation cloud id
180
+     *
181
+     * @return string
182
+     * @since 9.0.0
183
+     */
184
+    public function getCloudId();
185
+
186
+    /**
187
+     * set the email address of the user
188
+     *
189
+     * @param string|null $mailAddress
190
+     * @return void
191
+     * @since 9.0.0
192
+     */
193
+    public function setEMailAddress($mailAddress);
194
+
195
+    /**
196
+     * get the users' quota in human readable form. If a specific quota is not
197
+     * set for the user, the default value is returned. If a default setting
198
+     * was not set otherwise, it is return as 'none', i.e. quota is not limited.
199
+     *
200
+     * @return string
201
+     * @since 9.0.0
202
+     */
203
+    public function getQuota();
204
+
205
+    /**
206
+     * set the users' quota
207
+     *
208
+     * @param string $quota
209
+     * @return void
210
+     * @since 9.0.0
211
+     */
212
+    public function setQuota($quota);
213 213
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/Version1008Date20181105112049.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
 
33 33
 class Version1008Date20181105112049 extends SimpleMigrationStep {
34 34
 
35
-	/**
36
-	 * @param IOutput $output
37
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
-	 * @param array $options
39
-	 * @return null|ISchemaWrapper
40
-	 */
41
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42
-		/** @var ISchemaWrapper $schema */
43
-		$schema = $schemaClosure();
44
-		$table = $schema->getTable('calendarsubscriptions');
45
-		$table->dropColumn('source_copy');
35
+    /**
36
+     * @param IOutput $output
37
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
+     * @param array $options
39
+     * @return null|ISchemaWrapper
40
+     */
41
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42
+        /** @var ISchemaWrapper $schema */
43
+        $schema = $schemaClosure();
44
+        $table = $schema->getTable('calendarsubscriptions');
45
+        $table->dropColumn('source_copy');
46 46
 
47
-		return $schema;
48
-	}
47
+        return $schema;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/Version1008Date20181105104833.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
 
33 33
 class Version1008Date20181105104833 extends SimpleMigrationStep {
34 34
 
35
-	/**
36
-	 * @param IOutput $output
37
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
-	 * @param array $options
39
-	 * @return null|ISchemaWrapper
40
-	 */
41
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42
-		/** @var ISchemaWrapper $schema */
43
-		$schema = $schemaClosure();
44
-		$table = $schema->getTable('calendarsubscriptions');
45
-		$table->dropColumn('source');
35
+    /**
36
+     * @param IOutput $output
37
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38
+     * @param array $options
39
+     * @return null|ISchemaWrapper
40
+     */
41
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42
+        /** @var ISchemaWrapper $schema */
43
+        $schema = $schemaClosure();
44
+        $table = $schema->getTable('calendarsubscriptions');
45
+        $table->dropColumn('source');
46 46
 
47
-		return $schema;
48
-	}
47
+        return $schema;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
lib/public/Security/ICrypto.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,31 +37,31 @@
 block discarded – undo
37 37
  */
38 38
 interface ICrypto {
39 39
 
40
-	/**
41
-	 * @param string $message The message to authenticate
42
-	 * @param string $password Password to use (defaults to `secret` in config.php)
43
-	 * @return string Calculated HMAC
44
-	 * @since 8.0.0
45
-	 */
46
-	public function calculateHMAC(string $message, string $password = ''): string;
40
+    /**
41
+     * @param string $message The message to authenticate
42
+     * @param string $password Password to use (defaults to `secret` in config.php)
43
+     * @return string Calculated HMAC
44
+     * @since 8.0.0
45
+     */
46
+    public function calculateHMAC(string $message, string $password = ''): string;
47 47
 
48
-	/**
49
-	 * Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
50
-	 * @param string $plaintext
51
-	 * @param string $password Password to encrypt, if not specified the secret from config.php will be taken
52
-	 * @return string Authenticated ciphertext
53
-	 * @since 8.0.0
54
-	 */
55
-	public function encrypt(string $plaintext, string $password = ''): string;
48
+    /**
49
+     * Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
50
+     * @param string $plaintext
51
+     * @param string $password Password to encrypt, if not specified the secret from config.php will be taken
52
+     * @return string Authenticated ciphertext
53
+     * @since 8.0.0
54
+     */
55
+    public function encrypt(string $plaintext, string $password = ''): string;
56 56
 
57
-	/**
58
-	 * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac)
59
-	 * @param string $authenticatedCiphertext
60
-	 * @param string $password Password to encrypt, if not specified the secret from config.php will be taken
61
-	 * @return string plaintext
62
-	 * @throws \Exception If the HMAC does not match
63
-	 * @throws \Exception If the decryption failed
64
-	 * @since 8.0.0
65
-	 */
66
-	public function decrypt(string $authenticatedCiphertext, string $password = ''): string;
57
+    /**
58
+     * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac)
59
+     * @param string $authenticatedCiphertext
60
+     * @param string $password Password to encrypt, if not specified the secret from config.php will be taken
61
+     * @return string plaintext
62
+     * @throws \Exception If the HMAC does not match
63
+     * @throws \Exception If the decryption failed
64
+     * @since 8.0.0
65
+     */
66
+    public function decrypt(string $authenticatedCiphertext, string $password = ''): string;
67 67
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/Version1008Date20181114084440.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -33,27 +33,27 @@
 block discarded – undo
33 33
 class Version1008Date20181114084440 extends SimpleMigrationStep {
34 34
 
35 35
 
36
-	/**
37
-	 * @param IOutput $output
38
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
-	 * @param array $options
40
-	 * @return null|ISchemaWrapper
41
-	 */
42
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
-		/** @var ISchemaWrapper $schema */
44
-		$schema = $schemaClosure();
45
-
46
-		if ($schema->hasTable('calendarchanges')) {
47
-			$calendarChangesTable = $schema->getTable('calendarchanges');
48
-			if ($calendarChangesTable->hasIndex('calendarid_calendartype_synctoken')) {
49
-				$calendarChangesTable->dropIndex('calendarid_calendartype_synctoken');
50
-			}
51
-
52
-			if (!$calendarChangesTable->hasIndex('calid_type_synctoken')) {
53
-				$calendarChangesTable->addIndex(['calendarid', 'calendartype', 'synctoken'], 'calid_type_synctoken');
54
-			}
55
-		}
56
-
57
-		return $schema;
58
-	}
36
+    /**
37
+     * @param IOutput $output
38
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
+     * @param array $options
40
+     * @return null|ISchemaWrapper
41
+     */
42
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
+        /** @var ISchemaWrapper $schema */
44
+        $schema = $schemaClosure();
45
+
46
+        if ($schema->hasTable('calendarchanges')) {
47
+            $calendarChangesTable = $schema->getTable('calendarchanges');
48
+            if ($calendarChangesTable->hasIndex('calendarid_calendartype_synctoken')) {
49
+                $calendarChangesTable->dropIndex('calendarid_calendartype_synctoken');
50
+            }
51
+
52
+            if (!$calendarChangesTable->hasIndex('calid_type_synctoken')) {
53
+                $calendarChangesTable->addIndex(['calendarid', 'calendartype', 'synctoken'], 'calid_type_synctoken');
54
+            }
55
+        }
56
+
57
+        return $schema;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Sabre/VersionHome.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -32,79 +32,79 @@
 block discarded – undo
32 32
 
33 33
 class VersionHome implements ICollection {
34 34
 
35
-	/** @var array */
36
-	private $principalInfo;
37
-
38
-	/** @var IRootFolder */
39
-	private $rootFolder;
40
-
41
-	/** @var IUserManager */
42
-	private $userManager;
43
-
44
-	/** @var IVersionManager */
45
-	private $versionManager;
46
-
47
-	public function __construct(array $principalInfo, IRootFolder $rootFolder, IUserManager $userManager, IVersionManager $versionManager) {
48
-		$this->principalInfo = $principalInfo;
49
-		$this->rootFolder = $rootFolder;
50
-		$this->userManager = $userManager;
51
-		$this->versionManager = $versionManager;
52
-	}
53
-
54
-	private function getUser() {
55
-		list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']);
56
-		$user = $this->userManager->get($name);
57
-		if (!$user) {
58
-			throw new NoUserException();
59
-		}
60
-		return $user;
61
-	}
62
-
63
-	public function delete() {
64
-		throw new Forbidden();
65
-	}
66
-
67
-	public function getName(): string {
68
-		return $this->getUser()->getUID();
69
-	}
70
-
71
-	public function setName($name) {
72
-		throw new Forbidden();
73
-	}
74
-
75
-	public function createFile($name, $data = null) {
76
-		throw new Forbidden();
77
-	}
78
-
79
-	public function createDirectory($name) {
80
-		throw new Forbidden();
81
-	}
82
-
83
-	public function getChild($name) {
84
-		$user = $this->getUser();
85
-
86
-		if ($name === 'versions') {
87
-			return new VersionRoot($user, $this->rootFolder, $this->versionManager);
88
-		}
89
-		if ($name === 'restore') {
90
-			return new RestoreFolder();
91
-		}
92
-	}
93
-
94
-	public function getChildren() {
95
-		$user = $this->getUser();
96
-
97
-		return [
98
-			new VersionRoot($user, $this->rootFolder, $this->versionManager),
99
-			new RestoreFolder(),
100
-		];
101
-	}
102
-
103
-	public function childExists($name) {
104
-		return $name === 'versions' || $name === 'restore';
105
-	}
106
-
107
-	public function getLastModified() {
108
-		return 0;
109
-	}
35
+    /** @var array */
36
+    private $principalInfo;
37
+
38
+    /** @var IRootFolder */
39
+    private $rootFolder;
40
+
41
+    /** @var IUserManager */
42
+    private $userManager;
43
+
44
+    /** @var IVersionManager */
45
+    private $versionManager;
46
+
47
+    public function __construct(array $principalInfo, IRootFolder $rootFolder, IUserManager $userManager, IVersionManager $versionManager) {
48
+        $this->principalInfo = $principalInfo;
49
+        $this->rootFolder = $rootFolder;
50
+        $this->userManager = $userManager;
51
+        $this->versionManager = $versionManager;
52
+    }
53
+
54
+    private function getUser() {
55
+        list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']);
56
+        $user = $this->userManager->get($name);
57
+        if (!$user) {
58
+            throw new NoUserException();
59
+        }
60
+        return $user;
61
+    }
62
+
63
+    public function delete() {
64
+        throw new Forbidden();
65
+    }
66
+
67
+    public function getName(): string {
68
+        return $this->getUser()->getUID();
69
+    }
70
+
71
+    public function setName($name) {
72
+        throw new Forbidden();
73
+    }
74
+
75
+    public function createFile($name, $data = null) {
76
+        throw new Forbidden();
77
+    }
78
+
79
+    public function createDirectory($name) {
80
+        throw new Forbidden();
81
+    }
82
+
83
+    public function getChild($name) {
84
+        $user = $this->getUser();
85
+
86
+        if ($name === 'versions') {
87
+            return new VersionRoot($user, $this->rootFolder, $this->versionManager);
88
+        }
89
+        if ($name === 'restore') {
90
+            return new RestoreFolder();
91
+        }
92
+    }
93
+
94
+    public function getChildren() {
95
+        $user = $this->getUser();
96
+
97
+        return [
98
+            new VersionRoot($user, $this->rootFolder, $this->versionManager),
99
+            new RestoreFolder(),
100
+        ];
101
+    }
102
+
103
+    public function childExists($name) {
104
+        return $name === 'versions' || $name === 'restore';
105
+    }
106
+
107
+    public function getLastModified() {
108
+        return 0;
109
+    }
110 110
 }
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@
 block discarded – undo
37 37
  */
38 38
 interface IActivatableByAdmin extends IProvider {
39 39
 
40
-	/**
41
-	 * Enable this provider for the given user.
42
-	 *
43
-	 * @param IUser $user the user to activate this provider for
44
-	 *
45
-	 * @return void
46
-	 *
47
-	 * @since 15.0.0
48
-	 */
49
-	public function enableFor(IUser $user);
40
+    /**
41
+     * Enable this provider for the given user.
42
+     *
43
+     * @param IUser $user the user to activate this provider for
44
+     *
45
+     * @return void
46
+     *
47
+     * @since 15.0.0
48
+     */
49
+    public function enableFor(IUser $user);
50 50
 
51 51
 }
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@
 block discarded – undo
37 37
  */
38 38
 interface IDeactivatableByAdmin extends IProvider {
39 39
 
40
-	/**
41
-	 * Disable this provider for the given user.
42
-	 *
43
-	 * @param IUser $user the user to deactivate this provider for
44
-	 *
45
-	 * @return void
46
-	 *
47
-	 * @since 15.0.0
48
-	 */
49
-	public function disableFor(IUser $user);
40
+    /**
41
+     * Disable this provider for the given user.
42
+     *
43
+     * @param IUser $user the user to deactivate this provider for
44
+     *
45
+     * @return void
46
+     *
47
+     * @since 15.0.0
48
+     */
49
+    public function disableFor(IUser $user);
50 50
 
51 51
 }
Please login to merge, or discard this patch.
lib/private/RichObjectStrings/Validator.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -38,87 +38,87 @@
 block discarded – undo
38 38
  */
39 39
 class Validator implements IValidator {
40 40
 
41
-	/** @var Definitions */
42
-	protected $definitions;
43
-
44
-	/** @var array[] */
45
-	protected $requiredParameters = [];
46
-
47
-	/**
48
-	 * Constructor
49
-	 *
50
-	 * @param Definitions $definitions
51
-	 */
52
-	public function __construct(Definitions $definitions) {
53
-		$this->definitions = $definitions;
54
-	}
55
-
56
-	/**
57
-	 * @param string $subject
58
-	 * @param array[] $parameters
59
-	 * @throws InvalidObjectExeption
60
-	 * @since 11.0.0
61
-	 */
62
-	public function validate($subject, array $parameters) {
63
-		$matches = [];
64
-		$result = preg_match_all('/\{([a-z0-9]+)\}/i', $subject, $matches);
65
-
66
-		if ($result === false) {
67
-			throw new InvalidObjectExeption();
68
-		}
69
-
70
-		if (!empty($matches[1])) {
71
-			foreach ($matches[1] as $parameter) {
72
-				if (!isset($parameters[$parameter])) {
73
-					throw new InvalidObjectExeption('Parameter is undefined');
74
-				}
75
-			}
76
-		}
77
-
78
-		foreach ($parameters as $parameter) {
79
-			if (!\is_array($parameter)) {
80
-				throw new InvalidObjectExeption('Parameter is malformed');
81
-			}
82
-
83
-			$this->validateParameter($parameter);
84
-		}
85
-	}
86
-
87
-	/**
88
-	 * @param array $parameter
89
-	 * @throws InvalidObjectExeption
90
-	 */
91
-	protected function validateParameter(array $parameter) {
92
-		if (!isset($parameter['type'])) {
93
-			throw new InvalidObjectExeption('Object type is undefined');
94
-		}
95
-
96
-		$definition = $this->definitions->getDefinition($parameter['type']);
97
-		$requiredParameters = $this->getRequiredParameters($parameter['type'], $definition);
98
-
99
-		$missingKeys = array_diff($requiredParameters, array_keys($parameter));
100
-		if (!empty($missingKeys)) {
101
-			throw new InvalidObjectExeption('Object is invalid');
102
-		}
103
-	}
104
-
105
-	/**
106
-	 * @param string $type
107
-	 * @param array $definition
108
-	 * @return string[]
109
-	 */
110
-	protected function getRequiredParameters($type, array $definition) {
111
-		if (isset($this->requiredParameters[$type])) {
112
-			return $this->requiredParameters[$type];
113
-		}
114
-
115
-		$this->requiredParameters[$type] = [];
116
-		foreach ($definition['parameters'] as $parameter => $data) {
117
-			if ($data['required']) {
118
-				$this->requiredParameters[$type][] = $parameter;
119
-			}
120
-		}
121
-
122
-		return $this->requiredParameters[$type];
123
-	}
41
+    /** @var Definitions */
42
+    protected $definitions;
43
+
44
+    /** @var array[] */
45
+    protected $requiredParameters = [];
46
+
47
+    /**
48
+     * Constructor
49
+     *
50
+     * @param Definitions $definitions
51
+     */
52
+    public function __construct(Definitions $definitions) {
53
+        $this->definitions = $definitions;
54
+    }
55
+
56
+    /**
57
+     * @param string $subject
58
+     * @param array[] $parameters
59
+     * @throws InvalidObjectExeption
60
+     * @since 11.0.0
61
+     */
62
+    public function validate($subject, array $parameters) {
63
+        $matches = [];
64
+        $result = preg_match_all('/\{([a-z0-9]+)\}/i', $subject, $matches);
65
+
66
+        if ($result === false) {
67
+            throw new InvalidObjectExeption();
68
+        }
69
+
70
+        if (!empty($matches[1])) {
71
+            foreach ($matches[1] as $parameter) {
72
+                if (!isset($parameters[$parameter])) {
73
+                    throw new InvalidObjectExeption('Parameter is undefined');
74
+                }
75
+            }
76
+        }
77
+
78
+        foreach ($parameters as $parameter) {
79
+            if (!\is_array($parameter)) {
80
+                throw new InvalidObjectExeption('Parameter is malformed');
81
+            }
82
+
83
+            $this->validateParameter($parameter);
84
+        }
85
+    }
86
+
87
+    /**
88
+     * @param array $parameter
89
+     * @throws InvalidObjectExeption
90
+     */
91
+    protected function validateParameter(array $parameter) {
92
+        if (!isset($parameter['type'])) {
93
+            throw new InvalidObjectExeption('Object type is undefined');
94
+        }
95
+
96
+        $definition = $this->definitions->getDefinition($parameter['type']);
97
+        $requiredParameters = $this->getRequiredParameters($parameter['type'], $definition);
98
+
99
+        $missingKeys = array_diff($requiredParameters, array_keys($parameter));
100
+        if (!empty($missingKeys)) {
101
+            throw new InvalidObjectExeption('Object is invalid');
102
+        }
103
+    }
104
+
105
+    /**
106
+     * @param string $type
107
+     * @param array $definition
108
+     * @return string[]
109
+     */
110
+    protected function getRequiredParameters($type, array $definition) {
111
+        if (isset($this->requiredParameters[$type])) {
112
+            return $this->requiredParameters[$type];
113
+        }
114
+
115
+        $this->requiredParameters[$type] = [];
116
+        foreach ($definition['parameters'] as $parameter => $data) {
117
+            if ($data['required']) {
118
+                $this->requiredParameters[$type][] = $parameter;
119
+            }
120
+        }
121
+
122
+        return $this->requiredParameters[$type];
123
+    }
124 124
 }
Please login to merge, or discard this patch.