@@ -184,7 +184,7 @@ |
||
184 | 184 | if (is_array($scope)) { |
185 | 185 | parent::setScope(json_encode($scope)); |
186 | 186 | } else { |
187 | - parent::setScope((string)$scope); |
|
187 | + parent::setScope((string) $scope); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |
@@ -49,192 +49,192 @@ |
||
49 | 49 | * @method setPasswordHash(string $hash) |
50 | 50 | */ |
51 | 51 | class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { |
52 | - public const VERSION = 2; |
|
53 | - |
|
54 | - /** @var string user UID */ |
|
55 | - protected $uid; |
|
56 | - |
|
57 | - /** @var string login name used for generating the token */ |
|
58 | - protected $loginName; |
|
59 | - |
|
60 | - /** @var string encrypted user password */ |
|
61 | - protected $password; |
|
62 | - |
|
63 | - /** @var string hashed user password */ |
|
64 | - protected $passwordHash; |
|
65 | - |
|
66 | - /** @var string token name (e.g. browser/OS) */ |
|
67 | - protected $name; |
|
68 | - |
|
69 | - /** @var string */ |
|
70 | - protected $token; |
|
71 | - |
|
72 | - /** @var int */ |
|
73 | - protected $type; |
|
74 | - |
|
75 | - /** @var int */ |
|
76 | - protected $remember; |
|
77 | - |
|
78 | - /** @var int */ |
|
79 | - protected $lastActivity; |
|
80 | - |
|
81 | - /** @var int */ |
|
82 | - protected $lastCheck; |
|
83 | - |
|
84 | - /** @var string */ |
|
85 | - protected $scope; |
|
86 | - |
|
87 | - /** @var int */ |
|
88 | - protected $expires; |
|
89 | - |
|
90 | - /** @var string */ |
|
91 | - protected $privateKey; |
|
92 | - |
|
93 | - /** @var string */ |
|
94 | - protected $publicKey; |
|
95 | - |
|
96 | - /** @var int */ |
|
97 | - protected $version; |
|
98 | - |
|
99 | - /** @var bool */ |
|
100 | - protected $passwordInvalid; |
|
101 | - |
|
102 | - public function __construct() { |
|
103 | - $this->addType('uid', 'string'); |
|
104 | - $this->addType('loginName', 'string'); |
|
105 | - $this->addType('password', 'string'); |
|
106 | - $this->addType('passwordHash', 'string'); |
|
107 | - $this->addType('name', 'string'); |
|
108 | - $this->addType('token', 'string'); |
|
109 | - $this->addType('type', 'int'); |
|
110 | - $this->addType('remember', 'int'); |
|
111 | - $this->addType('lastActivity', 'int'); |
|
112 | - $this->addType('lastCheck', 'int'); |
|
113 | - $this->addType('scope', 'string'); |
|
114 | - $this->addType('expires', 'int'); |
|
115 | - $this->addType('publicKey', 'string'); |
|
116 | - $this->addType('privateKey', 'string'); |
|
117 | - $this->addType('version', 'int'); |
|
118 | - $this->addType('passwordInvalid', 'bool'); |
|
119 | - } |
|
120 | - |
|
121 | - public function getId(): int { |
|
122 | - return $this->id; |
|
123 | - } |
|
124 | - |
|
125 | - public function getUID(): string { |
|
126 | - return $this->uid; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Get the login name used when generating the token |
|
131 | - * |
|
132 | - * @return string |
|
133 | - */ |
|
134 | - public function getLoginName(): string { |
|
135 | - return parent::getLoginName(); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Get the (encrypted) login password |
|
140 | - * |
|
141 | - * @return string|null |
|
142 | - */ |
|
143 | - public function getPassword() { |
|
144 | - return parent::getPassword(); |
|
145 | - } |
|
146 | - |
|
147 | - public function jsonSerialize(): array { |
|
148 | - return [ |
|
149 | - 'id' => $this->id, |
|
150 | - 'name' => $this->name, |
|
151 | - 'lastActivity' => $this->lastActivity, |
|
152 | - 'type' => $this->type, |
|
153 | - 'scope' => $this->getScopeAsArray() |
|
154 | - ]; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Get the timestamp of the last password check |
|
159 | - * |
|
160 | - * @return int |
|
161 | - */ |
|
162 | - public function getLastCheck(): int { |
|
163 | - return parent::getLastCheck(); |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Get the timestamp of the last password check |
|
168 | - * |
|
169 | - * @param int $time |
|
170 | - */ |
|
171 | - public function setLastCheck(int $time) { |
|
172 | - parent::setLastCheck($time); |
|
173 | - } |
|
174 | - |
|
175 | - public function getScope(): string { |
|
176 | - $scope = parent::getScope(); |
|
177 | - if ($scope === null) { |
|
178 | - return ''; |
|
179 | - } |
|
180 | - |
|
181 | - return $scope; |
|
182 | - } |
|
183 | - |
|
184 | - public function getScopeAsArray(): array { |
|
185 | - $scope = json_decode($this->getScope(), true); |
|
186 | - if (!$scope) { |
|
187 | - return [ |
|
188 | - 'filesystem' => true |
|
189 | - ]; |
|
190 | - } |
|
191 | - return $scope; |
|
192 | - } |
|
193 | - |
|
194 | - public function setScope($scope) { |
|
195 | - if (is_array($scope)) { |
|
196 | - parent::setScope(json_encode($scope)); |
|
197 | - } else { |
|
198 | - parent::setScope((string)$scope); |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - public function getName(): string { |
|
203 | - return parent::getName(); |
|
204 | - } |
|
205 | - |
|
206 | - public function setName(string $name): void { |
|
207 | - parent::setName($name); |
|
208 | - } |
|
209 | - |
|
210 | - public function getRemember(): int { |
|
211 | - return parent::getRemember(); |
|
212 | - } |
|
213 | - |
|
214 | - public function setToken(string $token) { |
|
215 | - parent::setToken($token); |
|
216 | - } |
|
217 | - |
|
218 | - public function setPassword(string $password = null) { |
|
219 | - parent::setPassword($password); |
|
220 | - } |
|
221 | - |
|
222 | - public function setExpires($expires) { |
|
223 | - parent::setExpires($expires); |
|
224 | - } |
|
225 | - |
|
226 | - /** |
|
227 | - * @return int|null |
|
228 | - */ |
|
229 | - public function getExpires() { |
|
230 | - return parent::getExpires(); |
|
231 | - } |
|
232 | - |
|
233 | - public function setPasswordInvalid(bool $invalid) { |
|
234 | - parent::setPasswordInvalid($invalid); |
|
235 | - } |
|
236 | - |
|
237 | - public function wipe(): void { |
|
238 | - parent::setType(IToken::WIPE_TOKEN); |
|
239 | - } |
|
52 | + public const VERSION = 2; |
|
53 | + |
|
54 | + /** @var string user UID */ |
|
55 | + protected $uid; |
|
56 | + |
|
57 | + /** @var string login name used for generating the token */ |
|
58 | + protected $loginName; |
|
59 | + |
|
60 | + /** @var string encrypted user password */ |
|
61 | + protected $password; |
|
62 | + |
|
63 | + /** @var string hashed user password */ |
|
64 | + protected $passwordHash; |
|
65 | + |
|
66 | + /** @var string token name (e.g. browser/OS) */ |
|
67 | + protected $name; |
|
68 | + |
|
69 | + /** @var string */ |
|
70 | + protected $token; |
|
71 | + |
|
72 | + /** @var int */ |
|
73 | + protected $type; |
|
74 | + |
|
75 | + /** @var int */ |
|
76 | + protected $remember; |
|
77 | + |
|
78 | + /** @var int */ |
|
79 | + protected $lastActivity; |
|
80 | + |
|
81 | + /** @var int */ |
|
82 | + protected $lastCheck; |
|
83 | + |
|
84 | + /** @var string */ |
|
85 | + protected $scope; |
|
86 | + |
|
87 | + /** @var int */ |
|
88 | + protected $expires; |
|
89 | + |
|
90 | + /** @var string */ |
|
91 | + protected $privateKey; |
|
92 | + |
|
93 | + /** @var string */ |
|
94 | + protected $publicKey; |
|
95 | + |
|
96 | + /** @var int */ |
|
97 | + protected $version; |
|
98 | + |
|
99 | + /** @var bool */ |
|
100 | + protected $passwordInvalid; |
|
101 | + |
|
102 | + public function __construct() { |
|
103 | + $this->addType('uid', 'string'); |
|
104 | + $this->addType('loginName', 'string'); |
|
105 | + $this->addType('password', 'string'); |
|
106 | + $this->addType('passwordHash', 'string'); |
|
107 | + $this->addType('name', 'string'); |
|
108 | + $this->addType('token', 'string'); |
|
109 | + $this->addType('type', 'int'); |
|
110 | + $this->addType('remember', 'int'); |
|
111 | + $this->addType('lastActivity', 'int'); |
|
112 | + $this->addType('lastCheck', 'int'); |
|
113 | + $this->addType('scope', 'string'); |
|
114 | + $this->addType('expires', 'int'); |
|
115 | + $this->addType('publicKey', 'string'); |
|
116 | + $this->addType('privateKey', 'string'); |
|
117 | + $this->addType('version', 'int'); |
|
118 | + $this->addType('passwordInvalid', 'bool'); |
|
119 | + } |
|
120 | + |
|
121 | + public function getId(): int { |
|
122 | + return $this->id; |
|
123 | + } |
|
124 | + |
|
125 | + public function getUID(): string { |
|
126 | + return $this->uid; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Get the login name used when generating the token |
|
131 | + * |
|
132 | + * @return string |
|
133 | + */ |
|
134 | + public function getLoginName(): string { |
|
135 | + return parent::getLoginName(); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Get the (encrypted) login password |
|
140 | + * |
|
141 | + * @return string|null |
|
142 | + */ |
|
143 | + public function getPassword() { |
|
144 | + return parent::getPassword(); |
|
145 | + } |
|
146 | + |
|
147 | + public function jsonSerialize(): array { |
|
148 | + return [ |
|
149 | + 'id' => $this->id, |
|
150 | + 'name' => $this->name, |
|
151 | + 'lastActivity' => $this->lastActivity, |
|
152 | + 'type' => $this->type, |
|
153 | + 'scope' => $this->getScopeAsArray() |
|
154 | + ]; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Get the timestamp of the last password check |
|
159 | + * |
|
160 | + * @return int |
|
161 | + */ |
|
162 | + public function getLastCheck(): int { |
|
163 | + return parent::getLastCheck(); |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Get the timestamp of the last password check |
|
168 | + * |
|
169 | + * @param int $time |
|
170 | + */ |
|
171 | + public function setLastCheck(int $time) { |
|
172 | + parent::setLastCheck($time); |
|
173 | + } |
|
174 | + |
|
175 | + public function getScope(): string { |
|
176 | + $scope = parent::getScope(); |
|
177 | + if ($scope === null) { |
|
178 | + return ''; |
|
179 | + } |
|
180 | + |
|
181 | + return $scope; |
|
182 | + } |
|
183 | + |
|
184 | + public function getScopeAsArray(): array { |
|
185 | + $scope = json_decode($this->getScope(), true); |
|
186 | + if (!$scope) { |
|
187 | + return [ |
|
188 | + 'filesystem' => true |
|
189 | + ]; |
|
190 | + } |
|
191 | + return $scope; |
|
192 | + } |
|
193 | + |
|
194 | + public function setScope($scope) { |
|
195 | + if (is_array($scope)) { |
|
196 | + parent::setScope(json_encode($scope)); |
|
197 | + } else { |
|
198 | + parent::setScope((string)$scope); |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + public function getName(): string { |
|
203 | + return parent::getName(); |
|
204 | + } |
|
205 | + |
|
206 | + public function setName(string $name): void { |
|
207 | + parent::setName($name); |
|
208 | + } |
|
209 | + |
|
210 | + public function getRemember(): int { |
|
211 | + return parent::getRemember(); |
|
212 | + } |
|
213 | + |
|
214 | + public function setToken(string $token) { |
|
215 | + parent::setToken($token); |
|
216 | + } |
|
217 | + |
|
218 | + public function setPassword(string $password = null) { |
|
219 | + parent::setPassword($password); |
|
220 | + } |
|
221 | + |
|
222 | + public function setExpires($expires) { |
|
223 | + parent::setExpires($expires); |
|
224 | + } |
|
225 | + |
|
226 | + /** |
|
227 | + * @return int|null |
|
228 | + */ |
|
229 | + public function getExpires() { |
|
230 | + return parent::getExpires(); |
|
231 | + } |
|
232 | + |
|
233 | + public function setPasswordInvalid(bool $invalid) { |
|
234 | + parent::setPasswordInvalid($invalid); |
|
235 | + } |
|
236 | + |
|
237 | + public function wipe(): void { |
|
238 | + parent::setType(IToken::WIPE_TOKEN); |
|
239 | + } |
|
240 | 240 | } |
@@ -107,7 +107,7 @@ |
||
107 | 107 | * @return string language |
108 | 108 | * @since 7.0.0 |
109 | 109 | */ |
110 | - public function getLanguageCode(): string ; |
|
110 | + public function getLanguageCode(): string; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * * The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object |
@@ -43,77 +43,77 @@ |
||
43 | 43 | * @since 6.0.0 |
44 | 44 | */ |
45 | 45 | interface IL10N { |
46 | - /** |
|
47 | - * Translating |
|
48 | - * @param string $text The text we need a translation for |
|
49 | - * @param array|string $parameters default:array() Parameters for sprintf |
|
50 | - * @return string Translation or the same text |
|
51 | - * |
|
52 | - * Returns the translation. If no translation is found, $text will be |
|
53 | - * returned. |
|
54 | - * @since 6.0.0 |
|
55 | - */ |
|
56 | - public function t(string $text, $parameters = []): string; |
|
46 | + /** |
|
47 | + * Translating |
|
48 | + * @param string $text The text we need a translation for |
|
49 | + * @param array|string $parameters default:array() Parameters for sprintf |
|
50 | + * @return string Translation or the same text |
|
51 | + * |
|
52 | + * Returns the translation. If no translation is found, $text will be |
|
53 | + * returned. |
|
54 | + * @since 6.0.0 |
|
55 | + */ |
|
56 | + public function t(string $text, $parameters = []): string; |
|
57 | 57 | |
58 | - /** |
|
59 | - * Translating |
|
60 | - * @param string $text_singular the string to translate for exactly one object |
|
61 | - * @param string $text_plural the string to translate for n objects |
|
62 | - * @param integer $count Number of objects |
|
63 | - * @param array $parameters default:array() Parameters for sprintf |
|
64 | - * @return string Translation or the same text |
|
65 | - * |
|
66 | - * Returns the translation. If no translation is found, $text will be |
|
67 | - * returned. %n will be replaced with the number of objects. |
|
68 | - * |
|
69 | - * The correct plural is determined by the plural_forms-function |
|
70 | - * provided by the po file. |
|
71 | - * @since 6.0.0 |
|
72 | - * |
|
73 | - */ |
|
74 | - public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string; |
|
58 | + /** |
|
59 | + * Translating |
|
60 | + * @param string $text_singular the string to translate for exactly one object |
|
61 | + * @param string $text_plural the string to translate for n objects |
|
62 | + * @param integer $count Number of objects |
|
63 | + * @param array $parameters default:array() Parameters for sprintf |
|
64 | + * @return string Translation or the same text |
|
65 | + * |
|
66 | + * Returns the translation. If no translation is found, $text will be |
|
67 | + * returned. %n will be replaced with the number of objects. |
|
68 | + * |
|
69 | + * The correct plural is determined by the plural_forms-function |
|
70 | + * provided by the po file. |
|
71 | + * @since 6.0.0 |
|
72 | + * |
|
73 | + */ |
|
74 | + public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string; |
|
75 | 75 | |
76 | - /** |
|
77 | - * Localization |
|
78 | - * @param string $type Type of localization |
|
79 | - * @param \DateTime|int|string $data parameters for this localization |
|
80 | - * @param array $options currently supports following options: |
|
81 | - * - 'width': handed into \Punic\Calendar::formatDate as second parameter |
|
82 | - * @return string|int|false |
|
83 | - * |
|
84 | - * Returns the localized data. |
|
85 | - * |
|
86 | - * Implemented types: |
|
87 | - * - date |
|
88 | - * - Creates a date |
|
89 | - * - l10n-field: date |
|
90 | - * - params: timestamp (int/string) |
|
91 | - * - datetime |
|
92 | - * - Creates date and time |
|
93 | - * - l10n-field: datetime |
|
94 | - * - params: timestamp (int/string) |
|
95 | - * - time |
|
96 | - * - Creates a time |
|
97 | - * - l10n-field: time |
|
98 | - * - params: timestamp (int/string) |
|
99 | - * @since 6.0.0 - parameter $options was added in 8.0.0 |
|
100 | - */ |
|
101 | - public function l(string $type, $data, array $options = []); |
|
76 | + /** |
|
77 | + * Localization |
|
78 | + * @param string $type Type of localization |
|
79 | + * @param \DateTime|int|string $data parameters for this localization |
|
80 | + * @param array $options currently supports following options: |
|
81 | + * - 'width': handed into \Punic\Calendar::formatDate as second parameter |
|
82 | + * @return string|int|false |
|
83 | + * |
|
84 | + * Returns the localized data. |
|
85 | + * |
|
86 | + * Implemented types: |
|
87 | + * - date |
|
88 | + * - Creates a date |
|
89 | + * - l10n-field: date |
|
90 | + * - params: timestamp (int/string) |
|
91 | + * - datetime |
|
92 | + * - Creates date and time |
|
93 | + * - l10n-field: datetime |
|
94 | + * - params: timestamp (int/string) |
|
95 | + * - time |
|
96 | + * - Creates a time |
|
97 | + * - l10n-field: time |
|
98 | + * - params: timestamp (int/string) |
|
99 | + * @since 6.0.0 - parameter $options was added in 8.0.0 |
|
100 | + */ |
|
101 | + public function l(string $type, $data, array $options = []); |
|
102 | 102 | |
103 | 103 | |
104 | - /** |
|
105 | - * The code (en, de, ...) of the language that is used for this IL10N object |
|
106 | - * |
|
107 | - * @return string language |
|
108 | - * @since 7.0.0 |
|
109 | - */ |
|
110 | - public function getLanguageCode(): string ; |
|
104 | + /** |
|
105 | + * The code (en, de, ...) of the language that is used for this IL10N object |
|
106 | + * |
|
107 | + * @return string language |
|
108 | + * @since 7.0.0 |
|
109 | + */ |
|
110 | + public function getLanguageCode(): string ; |
|
111 | 111 | |
112 | - /** |
|
113 | - * * The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object |
|
114 | - * |
|
115 | - * @return string locale |
|
116 | - * @since 14.0.0 |
|
117 | - */ |
|
118 | - public function getLocaleCode(): string; |
|
112 | + /** |
|
113 | + * * The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object |
|
114 | + * |
|
115 | + * @return string locale |
|
116 | + * @since 14.0.0 |
|
117 | + */ |
|
118 | + public function getLocaleCode(): string; |
|
119 | 119 | } |
@@ -40,22 +40,22 @@ |
||
40 | 40 | * @method void setData(string $data) |
41 | 41 | */ |
42 | 42 | class ChangesResult extends Entity { |
43 | - /** @var string */ |
|
44 | - protected $version = ''; |
|
43 | + /** @var string */ |
|
44 | + protected $version = ''; |
|
45 | 45 | |
46 | - /** @var string */ |
|
47 | - protected $etag = ''; |
|
46 | + /** @var string */ |
|
47 | + protected $etag = ''; |
|
48 | 48 | |
49 | - /** @var int */ |
|
50 | - protected $lastCheck = 0; |
|
49 | + /** @var int */ |
|
50 | + protected $lastCheck = 0; |
|
51 | 51 | |
52 | - /** @var string */ |
|
53 | - protected $data = ''; |
|
52 | + /** @var string */ |
|
53 | + protected $data = ''; |
|
54 | 54 | |
55 | - public function __construct() { |
|
56 | - $this->addType('version', 'string'); |
|
57 | - $this->addType('etag', 'string'); |
|
58 | - $this->addType('lastCheck', 'int'); |
|
59 | - $this->addType('data', 'string'); |
|
60 | - } |
|
55 | + public function __construct() { |
|
56 | + $this->addType('version', 'string'); |
|
57 | + $this->addType('etag', 'string'); |
|
58 | + $this->addType('lastCheck', 'int'); |
|
59 | + $this->addType('data', 'string'); |
|
60 | + } |
|
61 | 61 | } |
@@ -73,19 +73,19 @@ |
||
73 | 73 | default: |
74 | 74 | foreach ($items as $key => $item) { |
75 | 75 | if (is_array($item)) { |
76 | - $output->writeln($prefix . $key . ':'); |
|
77 | - $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
76 | + $output->writeln($prefix.$key.':'); |
|
77 | + $this->writeArrayInOutputFormat($input, $output, $item, ' '.$prefix); |
|
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | if (!is_int($key) || ListCommand::class === get_class($this)) { |
81 | 81 | $value = $this->valueToString($item); |
82 | 82 | if (!is_null($value)) { |
83 | - $output->writeln($prefix . $key . ': ' . $value); |
|
83 | + $output->writeln($prefix.$key.': '.$value); |
|
84 | 84 | } else { |
85 | - $output->writeln($prefix . $key); |
|
85 | + $output->writeln($prefix.$key); |
|
86 | 86 | } |
87 | 87 | } else { |
88 | - $output->writeln($prefix . $this->valueToString($item)); |
|
88 | + $output->writeln($prefix.$this->valueToString($item)); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | break; |
@@ -35,166 +35,166 @@ |
||
35 | 35 | use Symfony\Component\Console\Output\OutputInterface; |
36 | 36 | |
37 | 37 | class Base extends Command implements CompletionAwareInterface { |
38 | - public const OUTPUT_FORMAT_PLAIN = 'plain'; |
|
39 | - public const OUTPUT_FORMAT_JSON = 'json'; |
|
40 | - public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; |
|
41 | - |
|
42 | - protected string $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; |
|
43 | - private bool $php_pcntl_signal = false; |
|
44 | - private bool $interrupted = false; |
|
45 | - |
|
46 | - protected function configure() { |
|
47 | - $this |
|
48 | - ->addOption( |
|
49 | - 'output', |
|
50 | - null, |
|
51 | - InputOption::VALUE_OPTIONAL, |
|
52 | - 'Output format (plain, json or json_pretty, default is plain)', |
|
53 | - $this->defaultOutputFormat |
|
54 | - ) |
|
55 | - ; |
|
56 | - } |
|
57 | - |
|
58 | - protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, array $items, string $prefix = ' - '): void { |
|
59 | - switch ($input->getOption('output')) { |
|
60 | - case self::OUTPUT_FORMAT_JSON: |
|
61 | - $output->writeln(json_encode($items)); |
|
62 | - break; |
|
63 | - case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
64 | - $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
65 | - break; |
|
66 | - default: |
|
67 | - foreach ($items as $key => $item) { |
|
68 | - if (is_array($item)) { |
|
69 | - $output->writeln($prefix . $key . ':'); |
|
70 | - $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
71 | - continue; |
|
72 | - } |
|
73 | - if (!is_int($key) || ListCommand::class === get_class($this)) { |
|
74 | - $value = $this->valueToString($item); |
|
75 | - if (!is_null($value)) { |
|
76 | - $output->writeln($prefix . $key . ': ' . $value); |
|
77 | - } else { |
|
78 | - $output->writeln($prefix . $key); |
|
79 | - } |
|
80 | - } else { |
|
81 | - $output->writeln($prefix . $this->valueToString($item)); |
|
82 | - } |
|
83 | - } |
|
84 | - break; |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - protected function writeTableInOutputFormat(InputInterface $input, OutputInterface $output, array $items): void { |
|
89 | - switch ($input->getOption('output')) { |
|
90 | - case self::OUTPUT_FORMAT_JSON: |
|
91 | - $output->writeln(json_encode($items)); |
|
92 | - break; |
|
93 | - case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
94 | - $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
95 | - break; |
|
96 | - default: |
|
97 | - $table = new Table($output); |
|
98 | - $table->setRows($items); |
|
99 | - if (!empty($items) && is_string(array_key_first(reset($items)))) { |
|
100 | - $table->setHeaders(array_keys(reset($items))); |
|
101 | - } |
|
102 | - $table->render(); |
|
103 | - break; |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @param mixed $item |
|
110 | - */ |
|
111 | - protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) { |
|
112 | - if (is_array($item)) { |
|
113 | - $this->writeArrayInOutputFormat($input, $output, $item, ''); |
|
114 | - return; |
|
115 | - } |
|
116 | - |
|
117 | - switch ($input->getOption('output')) { |
|
118 | - case self::OUTPUT_FORMAT_JSON: |
|
119 | - $output->writeln(json_encode($item)); |
|
120 | - break; |
|
121 | - case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
122 | - $output->writeln(json_encode($item, JSON_PRETTY_PRINT)); |
|
123 | - break; |
|
124 | - default: |
|
125 | - $output->writeln($this->valueToString($item, false)); |
|
126 | - break; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - protected function valueToString($value, bool $returnNull = true): ?string { |
|
131 | - if ($value === false) { |
|
132 | - return 'false'; |
|
133 | - } elseif ($value === true) { |
|
134 | - return 'true'; |
|
135 | - } elseif ($value === null) { |
|
136 | - return $returnNull ? null : 'null'; |
|
137 | - } else { |
|
138 | - return $value; |
|
139 | - } |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Throw InterruptedException when interrupted by user |
|
144 | - * |
|
145 | - * @throws InterruptedException |
|
146 | - */ |
|
147 | - protected function abortIfInterrupted() { |
|
148 | - if ($this->php_pcntl_signal === false) { |
|
149 | - return; |
|
150 | - } |
|
151 | - |
|
152 | - pcntl_signal_dispatch(); |
|
153 | - |
|
154 | - if ($this->interrupted === true) { |
|
155 | - throw new InterruptedException('Command interrupted by user'); |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Changes the status of the command to "interrupted" if ctrl-c has been pressed |
|
161 | - * |
|
162 | - * Gives a chance to the command to properly terminate what it's doing |
|
163 | - */ |
|
164 | - protected function cancelOperation() { |
|
165 | - $this->interrupted = true; |
|
166 | - } |
|
167 | - |
|
168 | - public function run(InputInterface $input, OutputInterface $output) { |
|
169 | - // check if the php pcntl_signal functions are accessible |
|
170 | - $this->php_pcntl_signal = function_exists('pcntl_signal'); |
|
171 | - if ($this->php_pcntl_signal) { |
|
172 | - // Collect interrupts and notify the running command |
|
173 | - pcntl_signal(SIGTERM, [$this, 'cancelOperation']); |
|
174 | - pcntl_signal(SIGINT, [$this, 'cancelOperation']); |
|
175 | - } |
|
176 | - |
|
177 | - return parent::run($input, $output); |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * @param string $optionName |
|
182 | - * @param CompletionContext $context |
|
183 | - * @return string[] |
|
184 | - */ |
|
185 | - public function completeOptionValues($optionName, CompletionContext $context) { |
|
186 | - if ($optionName === 'output') { |
|
187 | - return ['plain', 'json', 'json_pretty']; |
|
188 | - } |
|
189 | - return []; |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * @param string $argumentName |
|
194 | - * @param CompletionContext $context |
|
195 | - * @return string[] |
|
196 | - */ |
|
197 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
198 | - return []; |
|
199 | - } |
|
38 | + public const OUTPUT_FORMAT_PLAIN = 'plain'; |
|
39 | + public const OUTPUT_FORMAT_JSON = 'json'; |
|
40 | + public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; |
|
41 | + |
|
42 | + protected string $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; |
|
43 | + private bool $php_pcntl_signal = false; |
|
44 | + private bool $interrupted = false; |
|
45 | + |
|
46 | + protected function configure() { |
|
47 | + $this |
|
48 | + ->addOption( |
|
49 | + 'output', |
|
50 | + null, |
|
51 | + InputOption::VALUE_OPTIONAL, |
|
52 | + 'Output format (plain, json or json_pretty, default is plain)', |
|
53 | + $this->defaultOutputFormat |
|
54 | + ) |
|
55 | + ; |
|
56 | + } |
|
57 | + |
|
58 | + protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, array $items, string $prefix = ' - '): void { |
|
59 | + switch ($input->getOption('output')) { |
|
60 | + case self::OUTPUT_FORMAT_JSON: |
|
61 | + $output->writeln(json_encode($items)); |
|
62 | + break; |
|
63 | + case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
64 | + $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
65 | + break; |
|
66 | + default: |
|
67 | + foreach ($items as $key => $item) { |
|
68 | + if (is_array($item)) { |
|
69 | + $output->writeln($prefix . $key . ':'); |
|
70 | + $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix); |
|
71 | + continue; |
|
72 | + } |
|
73 | + if (!is_int($key) || ListCommand::class === get_class($this)) { |
|
74 | + $value = $this->valueToString($item); |
|
75 | + if (!is_null($value)) { |
|
76 | + $output->writeln($prefix . $key . ': ' . $value); |
|
77 | + } else { |
|
78 | + $output->writeln($prefix . $key); |
|
79 | + } |
|
80 | + } else { |
|
81 | + $output->writeln($prefix . $this->valueToString($item)); |
|
82 | + } |
|
83 | + } |
|
84 | + break; |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + protected function writeTableInOutputFormat(InputInterface $input, OutputInterface $output, array $items): void { |
|
89 | + switch ($input->getOption('output')) { |
|
90 | + case self::OUTPUT_FORMAT_JSON: |
|
91 | + $output->writeln(json_encode($items)); |
|
92 | + break; |
|
93 | + case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
94 | + $output->writeln(json_encode($items, JSON_PRETTY_PRINT)); |
|
95 | + break; |
|
96 | + default: |
|
97 | + $table = new Table($output); |
|
98 | + $table->setRows($items); |
|
99 | + if (!empty($items) && is_string(array_key_first(reset($items)))) { |
|
100 | + $table->setHeaders(array_keys(reset($items))); |
|
101 | + } |
|
102 | + $table->render(); |
|
103 | + break; |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @param mixed $item |
|
110 | + */ |
|
111 | + protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) { |
|
112 | + if (is_array($item)) { |
|
113 | + $this->writeArrayInOutputFormat($input, $output, $item, ''); |
|
114 | + return; |
|
115 | + } |
|
116 | + |
|
117 | + switch ($input->getOption('output')) { |
|
118 | + case self::OUTPUT_FORMAT_JSON: |
|
119 | + $output->writeln(json_encode($item)); |
|
120 | + break; |
|
121 | + case self::OUTPUT_FORMAT_JSON_PRETTY: |
|
122 | + $output->writeln(json_encode($item, JSON_PRETTY_PRINT)); |
|
123 | + break; |
|
124 | + default: |
|
125 | + $output->writeln($this->valueToString($item, false)); |
|
126 | + break; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + protected function valueToString($value, bool $returnNull = true): ?string { |
|
131 | + if ($value === false) { |
|
132 | + return 'false'; |
|
133 | + } elseif ($value === true) { |
|
134 | + return 'true'; |
|
135 | + } elseif ($value === null) { |
|
136 | + return $returnNull ? null : 'null'; |
|
137 | + } else { |
|
138 | + return $value; |
|
139 | + } |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Throw InterruptedException when interrupted by user |
|
144 | + * |
|
145 | + * @throws InterruptedException |
|
146 | + */ |
|
147 | + protected function abortIfInterrupted() { |
|
148 | + if ($this->php_pcntl_signal === false) { |
|
149 | + return; |
|
150 | + } |
|
151 | + |
|
152 | + pcntl_signal_dispatch(); |
|
153 | + |
|
154 | + if ($this->interrupted === true) { |
|
155 | + throw new InterruptedException('Command interrupted by user'); |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Changes the status of the command to "interrupted" if ctrl-c has been pressed |
|
161 | + * |
|
162 | + * Gives a chance to the command to properly terminate what it's doing |
|
163 | + */ |
|
164 | + protected function cancelOperation() { |
|
165 | + $this->interrupted = true; |
|
166 | + } |
|
167 | + |
|
168 | + public function run(InputInterface $input, OutputInterface $output) { |
|
169 | + // check if the php pcntl_signal functions are accessible |
|
170 | + $this->php_pcntl_signal = function_exists('pcntl_signal'); |
|
171 | + if ($this->php_pcntl_signal) { |
|
172 | + // Collect interrupts and notify the running command |
|
173 | + pcntl_signal(SIGTERM, [$this, 'cancelOperation']); |
|
174 | + pcntl_signal(SIGINT, [$this, 'cancelOperation']); |
|
175 | + } |
|
176 | + |
|
177 | + return parent::run($input, $output); |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * @param string $optionName |
|
182 | + * @param CompletionContext $context |
|
183 | + * @return string[] |
|
184 | + */ |
|
185 | + public function completeOptionValues($optionName, CompletionContext $context) { |
|
186 | + if ($optionName === 'output') { |
|
187 | + return ['plain', 'json', 'json_pretty']; |
|
188 | + } |
|
189 | + return []; |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * @param string $argumentName |
|
194 | + * @param CompletionContext $context |
|
195 | + * @return string[] |
|
196 | + */ |
|
197 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
198 | + return []; |
|
199 | + } |
|
200 | 200 | } |
@@ -30,72 +30,72 @@ |
||
30 | 30 | |
31 | 31 | class FileChanges implements IFilter { |
32 | 32 | |
33 | - /** @var IL10N */ |
|
34 | - protected $l; |
|
33 | + /** @var IL10N */ |
|
34 | + protected $l; |
|
35 | 35 | |
36 | - /** @var IURLGenerator */ |
|
37 | - protected $url; |
|
36 | + /** @var IURLGenerator */ |
|
37 | + protected $url; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param IL10N $l |
|
41 | - * @param IURLGenerator $url |
|
42 | - */ |
|
43 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
44 | - $this->l = $l; |
|
45 | - $this->url = $url; |
|
46 | - } |
|
39 | + /** |
|
40 | + * @param IL10N $l |
|
41 | + * @param IURLGenerator $url |
|
42 | + */ |
|
43 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
44 | + $this->l = $l; |
|
45 | + $this->url = $url; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string Lowercase a-z only identifier |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getIdentifier() { |
|
53 | - return 'files'; |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string Lowercase a-z only identifier |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getIdentifier() { |
|
53 | + return 'files'; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return string A translated string |
|
58 | - * @since 11.0.0 |
|
59 | - */ |
|
60 | - public function getName() { |
|
61 | - return $this->l->t('File changes'); |
|
62 | - } |
|
56 | + /** |
|
57 | + * @return string A translated string |
|
58 | + * @since 11.0.0 |
|
59 | + */ |
|
60 | + public function getName() { |
|
61 | + return $this->l->t('File changes'); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return int |
|
66 | - * @since 11.0.0 |
|
67 | - */ |
|
68 | - public function getPriority() { |
|
69 | - return 30; |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return int |
|
66 | + * @since 11.0.0 |
|
67 | + */ |
|
68 | + public function getPriority() { |
|
69 | + return 30; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @return string Full URL to an icon, empty string when none is given |
|
74 | - * @since 11.0.0 |
|
75 | - */ |
|
76 | - public function getIcon() { |
|
77 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); |
|
78 | - } |
|
72 | + /** |
|
73 | + * @return string Full URL to an icon, empty string when none is given |
|
74 | + * @since 11.0.0 |
|
75 | + */ |
|
76 | + public function getIcon() { |
|
77 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @param string[] $types |
|
82 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
83 | - * @since 11.0.0 |
|
84 | - */ |
|
85 | - public function filterTypes(array $types) { |
|
86 | - return array_intersect([ |
|
87 | - 'file_created', |
|
88 | - 'file_changed', |
|
89 | - 'file_deleted', |
|
90 | - 'file_restored', |
|
91 | - ], $types); |
|
92 | - } |
|
80 | + /** |
|
81 | + * @param string[] $types |
|
82 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
83 | + * @since 11.0.0 |
|
84 | + */ |
|
85 | + public function filterTypes(array $types) { |
|
86 | + return array_intersect([ |
|
87 | + 'file_created', |
|
88 | + 'file_changed', |
|
89 | + 'file_deleted', |
|
90 | + 'file_restored', |
|
91 | + ], $types); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
96 | - * @since 11.0.0 |
|
97 | - */ |
|
98 | - public function allowedApps() { |
|
99 | - return ['files']; |
|
100 | - } |
|
94 | + /** |
|
95 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
96 | + * @since 11.0.0 |
|
97 | + */ |
|
98 | + public function allowedApps() { |
|
99 | + return ['files']; |
|
100 | + } |
|
101 | 101 | } |
@@ -30,65 +30,65 @@ |
||
30 | 30 | |
31 | 31 | class Calendar implements IFilter { |
32 | 32 | |
33 | - /** @var IL10N */ |
|
34 | - protected $l; |
|
33 | + /** @var IL10N */ |
|
34 | + protected $l; |
|
35 | 35 | |
36 | - /** @var IURLGenerator */ |
|
37 | - protected $url; |
|
36 | + /** @var IURLGenerator */ |
|
37 | + protected $url; |
|
38 | 38 | |
39 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
40 | - $this->l = $l; |
|
41 | - $this->url = $url; |
|
42 | - } |
|
39 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
40 | + $this->l = $l; |
|
41 | + $this->url = $url; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @return string Lowercase a-z and underscore only identifier |
|
46 | - * @since 11.0.0 |
|
47 | - */ |
|
48 | - public function getIdentifier() { |
|
49 | - return 'calendar'; |
|
50 | - } |
|
44 | + /** |
|
45 | + * @return string Lowercase a-z and underscore only identifier |
|
46 | + * @since 11.0.0 |
|
47 | + */ |
|
48 | + public function getIdentifier() { |
|
49 | + return 'calendar'; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return string A translated string |
|
54 | - * @since 11.0.0 |
|
55 | - */ |
|
56 | - public function getName() { |
|
57 | - return $this->l->t('Calendar'); |
|
58 | - } |
|
52 | + /** |
|
53 | + * @return string A translated string |
|
54 | + * @since 11.0.0 |
|
55 | + */ |
|
56 | + public function getName() { |
|
57 | + return $this->l->t('Calendar'); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @return int whether the filter should be rather on the top or bottom of |
|
62 | - * the admin section. The filters are arranged in ascending order of the |
|
63 | - * priority values. It is required to return a value between 0 and 100. |
|
64 | - * @since 11.0.0 |
|
65 | - */ |
|
66 | - public function getPriority() { |
|
67 | - return 40; |
|
68 | - } |
|
60 | + /** |
|
61 | + * @return int whether the filter should be rather on the top or bottom of |
|
62 | + * the admin section. The filters are arranged in ascending order of the |
|
63 | + * priority values. It is required to return a value between 0 and 100. |
|
64 | + * @since 11.0.0 |
|
65 | + */ |
|
66 | + public function getPriority() { |
|
67 | + return 40; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @return string Full URL to an icon, empty string when none is given |
|
72 | - * @since 11.0.0 |
|
73 | - */ |
|
74 | - public function getIcon() { |
|
75 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); |
|
76 | - } |
|
70 | + /** |
|
71 | + * @return string Full URL to an icon, empty string when none is given |
|
72 | + * @since 11.0.0 |
|
73 | + */ |
|
74 | + public function getIcon() { |
|
75 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param string[] $types |
|
80 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
81 | - * @since 11.0.0 |
|
82 | - */ |
|
83 | - public function filterTypes(array $types) { |
|
84 | - return array_intersect(['calendar', 'calendar_event'], $types); |
|
85 | - } |
|
78 | + /** |
|
79 | + * @param string[] $types |
|
80 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
81 | + * @since 11.0.0 |
|
82 | + */ |
|
83 | + public function filterTypes(array $types) { |
|
84 | + return array_intersect(['calendar', 'calendar_event'], $types); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
89 | - * @since 11.0.0 |
|
90 | - */ |
|
91 | - public function allowedApps() { |
|
92 | - return []; |
|
93 | - } |
|
87 | + /** |
|
88 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
89 | + * @since 11.0.0 |
|
90 | + */ |
|
91 | + public function allowedApps() { |
|
92 | + return []; |
|
93 | + } |
|
94 | 94 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |