@@ -39,22 +39,22 @@ |
||
39 | 39 | * @method string getToken() |
40 | 40 | */ |
41 | 41 | class OpenLocalEditor extends Entity { |
42 | - /** @var string */ |
|
43 | - protected $userId; |
|
42 | + /** @var string */ |
|
43 | + protected $userId; |
|
44 | 44 | |
45 | - /** @var string */ |
|
46 | - protected $pathHash; |
|
45 | + /** @var string */ |
|
46 | + protected $pathHash; |
|
47 | 47 | |
48 | - /** @var int */ |
|
49 | - protected $expirationTime; |
|
48 | + /** @var int */ |
|
49 | + protected $expirationTime; |
|
50 | 50 | |
51 | - /** @var string */ |
|
52 | - protected $token; |
|
51 | + /** @var string */ |
|
52 | + protected $token; |
|
53 | 53 | |
54 | - public function __construct() { |
|
55 | - $this->addType('userId', 'string'); |
|
56 | - $this->addType('pathHash', 'string'); |
|
57 | - $this->addType('expirationTime', 'integer'); |
|
58 | - $this->addType('token', 'string'); |
|
59 | - } |
|
54 | + public function __construct() { |
|
55 | + $this->addType('userId', 'string'); |
|
56 | + $this->addType('pathHash', 'string'); |
|
57 | + $this->addType('expirationTime', 'integer'); |
|
58 | + $this->addType('token', 'string'); |
|
59 | + } |
|
60 | 60 | } |
@@ -32,69 +32,69 @@ |
||
32 | 32 | * @since 11.0.0 |
33 | 33 | */ |
34 | 34 | interface ISimpleFolder { |
35 | - /** |
|
36 | - * Get all the files in a folder |
|
37 | - * |
|
38 | - * @return ISimpleFile[] |
|
39 | - * @since 11.0.0 |
|
40 | - */ |
|
41 | - public function getDirectoryListing(): array; |
|
35 | + /** |
|
36 | + * Get all the files in a folder |
|
37 | + * |
|
38 | + * @return ISimpleFile[] |
|
39 | + * @since 11.0.0 |
|
40 | + */ |
|
41 | + public function getDirectoryListing(): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Check if a file with $name exists |
|
45 | - * |
|
46 | - * @param string $name |
|
47 | - * @return bool |
|
48 | - * @since 11.0.0 |
|
49 | - */ |
|
50 | - public function fileExists(string $name): bool; |
|
43 | + /** |
|
44 | + * Check if a file with $name exists |
|
45 | + * |
|
46 | + * @param string $name |
|
47 | + * @return bool |
|
48 | + * @since 11.0.0 |
|
49 | + */ |
|
50 | + public function fileExists(string $name): bool; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get the file named $name from the folder |
|
54 | - * |
|
55 | - * @throws NotFoundException |
|
56 | - * @since 11.0.0 |
|
57 | - */ |
|
58 | - public function getFile(string $name): ISimpleFile; |
|
52 | + /** |
|
53 | + * Get the file named $name from the folder |
|
54 | + * |
|
55 | + * @throws NotFoundException |
|
56 | + * @since 11.0.0 |
|
57 | + */ |
|
58 | + public function getFile(string $name): ISimpleFile; |
|
59 | 59 | |
60 | - /** |
|
61 | - * Creates a new file with $name in the folder |
|
62 | - * |
|
63 | - * @param string|resource|null $content @since 19.0.0 |
|
64 | - * @throws NotPermittedException |
|
65 | - * @since 11.0.0 |
|
66 | - */ |
|
67 | - public function newFile(string $name, $content = null): ISimpleFile; |
|
60 | + /** |
|
61 | + * Creates a new file with $name in the folder |
|
62 | + * |
|
63 | + * @param string|resource|null $content @since 19.0.0 |
|
64 | + * @throws NotPermittedException |
|
65 | + * @since 11.0.0 |
|
66 | + */ |
|
67 | + public function newFile(string $name, $content = null): ISimpleFile; |
|
68 | 68 | |
69 | - /** |
|
70 | - * Remove the folder and all the files in it |
|
71 | - * |
|
72 | - * @throws NotPermittedException |
|
73 | - * @since 11.0.0 |
|
74 | - */ |
|
75 | - public function delete(): void; |
|
69 | + /** |
|
70 | + * Remove the folder and all the files in it |
|
71 | + * |
|
72 | + * @throws NotPermittedException |
|
73 | + * @since 11.0.0 |
|
74 | + */ |
|
75 | + public function delete(): void; |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get the folder name |
|
79 | - * |
|
80 | - * @since 11.0.0 |
|
81 | - */ |
|
82 | - public function getName(): string; |
|
77 | + /** |
|
78 | + * Get the folder name |
|
79 | + * |
|
80 | + * @since 11.0.0 |
|
81 | + */ |
|
82 | + public function getName(): string; |
|
83 | 83 | |
84 | - /** |
|
85 | - * Get the folder named $name from the current folder |
|
86 | - * |
|
87 | - * @throws NotFoundException |
|
88 | - * @since 25.0.0 |
|
89 | - */ |
|
90 | - public function getFolder(string $name): ISimpleFolder; |
|
84 | + /** |
|
85 | + * Get the folder named $name from the current folder |
|
86 | + * |
|
87 | + * @throws NotFoundException |
|
88 | + * @since 25.0.0 |
|
89 | + */ |
|
90 | + public function getFolder(string $name): ISimpleFolder; |
|
91 | 91 | |
92 | - /** |
|
93 | - * Creates a new folder with $name in the current folder |
|
94 | - * |
|
95 | - * @param string|resource|null $content @since 19.0.0 |
|
96 | - * @throws NotPermittedException |
|
97 | - * @since 25.0.0 |
|
98 | - */ |
|
99 | - public function newFolder(string $path): ISimpleFolder; |
|
92 | + /** |
|
93 | + * Creates a new folder with $name in the current folder |
|
94 | + * |
|
95 | + * @param string|resource|null $content @since 19.0.0 |
|
96 | + * @throws NotPermittedException |
|
97 | + * @since 25.0.0 |
|
98 | + */ |
|
99 | + public function newFolder(string $path): ISimpleFolder; |
|
100 | 100 | } |
@@ -53,69 +53,69 @@ |
||
53 | 53 | * Object can affect storage mounting |
54 | 54 | */ |
55 | 55 | class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefinition { |
56 | - /** Standard authentication schemes */ |
|
57 | - public const SCHEME_NULL = 'null'; |
|
58 | - public const SCHEME_BUILTIN = 'builtin'; |
|
59 | - public const SCHEME_PASSWORD = 'password'; |
|
60 | - public const SCHEME_OAUTH1 = 'oauth1'; |
|
61 | - public const SCHEME_OAUTH2 = 'oauth2'; |
|
62 | - public const SCHEME_PUBLICKEY = 'publickey'; |
|
63 | - public const SCHEME_OPENSTACK = 'openstack'; |
|
64 | - public const SCHEME_SMB = 'smb'; |
|
56 | + /** Standard authentication schemes */ |
|
57 | + public const SCHEME_NULL = 'null'; |
|
58 | + public const SCHEME_BUILTIN = 'builtin'; |
|
59 | + public const SCHEME_PASSWORD = 'password'; |
|
60 | + public const SCHEME_OAUTH1 = 'oauth1'; |
|
61 | + public const SCHEME_OAUTH2 = 'oauth2'; |
|
62 | + public const SCHEME_PUBLICKEY = 'publickey'; |
|
63 | + public const SCHEME_OPENSTACK = 'openstack'; |
|
64 | + public const SCHEME_SMB = 'smb'; |
|
65 | 65 | |
66 | - use VisibilityTrait; |
|
67 | - use FrontendDefinitionTrait; |
|
68 | - use StorageModifierTrait; |
|
69 | - use IdentifierTrait; |
|
66 | + use VisibilityTrait; |
|
67 | + use FrontendDefinitionTrait; |
|
68 | + use StorageModifierTrait; |
|
69 | + use IdentifierTrait; |
|
70 | 70 | |
71 | - /** @var string */ |
|
72 | - protected $scheme; |
|
71 | + /** @var string */ |
|
72 | + protected $scheme; |
|
73 | 73 | |
74 | - /** |
|
75 | - * Get the authentication scheme implemented |
|
76 | - * See self::SCHEME_* constants |
|
77 | - * |
|
78 | - * @return string |
|
79 | - */ |
|
80 | - public function getScheme() { |
|
81 | - return $this->scheme; |
|
82 | - } |
|
74 | + /** |
|
75 | + * Get the authentication scheme implemented |
|
76 | + * See self::SCHEME_* constants |
|
77 | + * |
|
78 | + * @return string |
|
79 | + */ |
|
80 | + public function getScheme() { |
|
81 | + return $this->scheme; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @param string $scheme |
|
86 | - * @return $this |
|
87 | - */ |
|
88 | - public function setScheme($scheme) { |
|
89 | - $this->scheme = $scheme; |
|
90 | - return $this; |
|
91 | - } |
|
84 | + /** |
|
85 | + * @param string $scheme |
|
86 | + * @return $this |
|
87 | + */ |
|
88 | + public function setScheme($scheme) { |
|
89 | + $this->scheme = $scheme; |
|
90 | + return $this; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Serialize into JSON for client-side JS |
|
95 | - */ |
|
96 | - public function jsonSerialize(): array { |
|
97 | - $data = $this->jsonSerializeDefinition(); |
|
98 | - $data += $this->jsonSerializeIdentifier(); |
|
93 | + /** |
|
94 | + * Serialize into JSON for client-side JS |
|
95 | + */ |
|
96 | + public function jsonSerialize(): array { |
|
97 | + $data = $this->jsonSerializeDefinition(); |
|
98 | + $data += $this->jsonSerializeIdentifier(); |
|
99 | 99 | |
100 | - $data['scheme'] = $this->getScheme(); |
|
101 | - $data['visibility'] = $this->getVisibility(); |
|
100 | + $data['scheme'] = $this->getScheme(); |
|
101 | + $data['visibility'] = $this->getVisibility(); |
|
102 | 102 | |
103 | - return $data; |
|
104 | - } |
|
103 | + return $data; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Check if parameters are satisfied in a StorageConfig |
|
108 | - * |
|
109 | - * @param StorageConfig $storage |
|
110 | - * @return bool |
|
111 | - */ |
|
112 | - public function validateStorage(StorageConfig $storage) { |
|
113 | - // does the backend actually support this scheme |
|
114 | - $supportedSchemes = $storage->getBackend()->getAuthSchemes(); |
|
115 | - if (!isset($supportedSchemes[$this->getScheme()])) { |
|
116 | - return false; |
|
117 | - } |
|
106 | + /** |
|
107 | + * Check if parameters are satisfied in a StorageConfig |
|
108 | + * |
|
109 | + * @param StorageConfig $storage |
|
110 | + * @return bool |
|
111 | + */ |
|
112 | + public function validateStorage(StorageConfig $storage) { |
|
113 | + // does the backend actually support this scheme |
|
114 | + $supportedSchemes = $storage->getBackend()->getAuthSchemes(); |
|
115 | + if (!isset($supportedSchemes[$this->getScheme()])) { |
|
116 | + return false; |
|
117 | + } |
|
118 | 118 | |
119 | - return $this->validateStorageDefinition($storage); |
|
120 | - } |
|
119 | + return $this->validateStorageDefinition($storage); |
|
120 | + } |
|
121 | 121 | } |
@@ -29,22 +29,22 @@ |
||
29 | 29 | */ |
30 | 30 | trait PriorityTrait { |
31 | 31 | |
32 | - /** @var int initial priority */ |
|
33 | - protected $priority = BackendService::PRIORITY_DEFAULT; |
|
32 | + /** @var int initial priority */ |
|
33 | + protected $priority = BackendService::PRIORITY_DEFAULT; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return int |
|
37 | - */ |
|
38 | - public function getPriority() { |
|
39 | - return $this->priority; |
|
40 | - } |
|
35 | + /** |
|
36 | + * @return int |
|
37 | + */ |
|
38 | + public function getPriority() { |
|
39 | + return $this->priority; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param int $priority |
|
44 | - * @return self |
|
45 | - */ |
|
46 | - public function setPriority($priority) { |
|
47 | - $this->priority = $priority; |
|
48 | - return $this; |
|
49 | - } |
|
42 | + /** |
|
43 | + * @param int $priority |
|
44 | + * @return self |
|
45 | + */ |
|
46 | + public function setPriority($priority) { |
|
47 | + $this->priority = $priority; |
|
48 | + return $this; |
|
49 | + } |
|
50 | 50 | } |
@@ -28,41 +28,41 @@ |
||
28 | 28 | */ |
29 | 29 | trait LegacyDependencyCheckPolyfill { |
30 | 30 | |
31 | - /** |
|
32 | - * @return class-string<IStorage> |
|
33 | - */ |
|
34 | - abstract public function getStorageClass(); |
|
31 | + /** |
|
32 | + * @return class-string<IStorage> |
|
33 | + */ |
|
34 | + abstract public function getStorageClass(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Check if object is valid for use |
|
38 | - * |
|
39 | - * @return MissingDependency[] Unsatisfied dependencies |
|
40 | - */ |
|
41 | - public function checkDependencies() { |
|
42 | - $ret = []; |
|
36 | + /** |
|
37 | + * Check if object is valid for use |
|
38 | + * |
|
39 | + * @return MissingDependency[] Unsatisfied dependencies |
|
40 | + */ |
|
41 | + public function checkDependencies() { |
|
42 | + $ret = []; |
|
43 | 43 | |
44 | - $result = call_user_func([$this->getStorageClass(), 'checkDependencies']); |
|
45 | - if ($result !== true) { |
|
46 | - if (!is_array($result)) { |
|
47 | - $result = [$result]; |
|
48 | - } |
|
49 | - foreach ($result as $key => $value) { |
|
50 | - if (!($value instanceof MissingDependency)) { |
|
51 | - $module = null; |
|
52 | - $message = null; |
|
53 | - if (is_numeric($key)) { |
|
54 | - $module = $value; |
|
55 | - } else { |
|
56 | - $module = $key; |
|
57 | - $message = $value; |
|
58 | - } |
|
59 | - $value = new MissingDependency($module); |
|
60 | - $value->setMessage($message); |
|
61 | - } |
|
62 | - $ret[] = $value; |
|
63 | - } |
|
64 | - } |
|
44 | + $result = call_user_func([$this->getStorageClass(), 'checkDependencies']); |
|
45 | + if ($result !== true) { |
|
46 | + if (!is_array($result)) { |
|
47 | + $result = [$result]; |
|
48 | + } |
|
49 | + foreach ($result as $key => $value) { |
|
50 | + if (!($value instanceof MissingDependency)) { |
|
51 | + $module = null; |
|
52 | + $message = null; |
|
53 | + if (is_numeric($key)) { |
|
54 | + $module = $value; |
|
55 | + } else { |
|
56 | + $module = $key; |
|
57 | + $message = $value; |
|
58 | + } |
|
59 | + $value = new MissingDependency($module); |
|
60 | + $value->setMessage($message); |
|
61 | + } |
|
62 | + $ret[] = $value; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - return $ret; |
|
67 | - } |
|
66 | + return $ret; |
|
67 | + } |
|
68 | 68 | } |
@@ -21,36 +21,36 @@ |
||
21 | 21 | |
22 | 22 | interface IFrontendDefinition { |
23 | 23 | |
24 | - public function getText(): string; |
|
24 | + public function getText(): string; |
|
25 | 25 | |
26 | - public function setText(string $text): self; |
|
26 | + public function setText(string $text): self; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @return array<string, DefinitionParameter> |
|
30 | - */ |
|
31 | - public function getParameters(): array; |
|
28 | + /** |
|
29 | + * @return array<string, DefinitionParameter> |
|
30 | + */ |
|
31 | + public function getParameters(): array; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param list<DefinitionParameter> $parameters |
|
35 | - */ |
|
36 | - public function addParameters(array $parameters): self; |
|
33 | + /** |
|
34 | + * @param list<DefinitionParameter> $parameters |
|
35 | + */ |
|
36 | + public function addParameters(array $parameters): self; |
|
37 | 37 | |
38 | - public function addParameter(DefinitionParameter $parameter): self; |
|
38 | + public function addParameter(DefinitionParameter $parameter): self; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string[] |
|
42 | - */ |
|
43 | - public function getCustomJs(): array; |
|
40 | + /** |
|
41 | + * @return string[] |
|
42 | + */ |
|
43 | + public function getCustomJs(): array; |
|
44 | 44 | |
45 | - public function addCustomJs(string $custom): self; |
|
45 | + public function addCustomJs(string $custom): self; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Serialize into JSON for client-side JS |
|
49 | - */ |
|
50 | - public function jsonSerializeDefinition(): array; |
|
47 | + /** |
|
48 | + * Serialize into JSON for client-side JS |
|
49 | + */ |
|
50 | + public function jsonSerializeDefinition(): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Check if parameters are satisfied in a StorageConfig |
|
54 | - */ |
|
55 | - public function validateStorageDefinition(StorageConfig $storage): bool; |
|
52 | + /** |
|
53 | + * Check if parameters are satisfied in a StorageConfig |
|
54 | + */ |
|
55 | + public function validateStorageDefinition(StorageConfig $storage): bool; |
|
56 | 56 | } |
@@ -59,102 +59,102 @@ |
||
59 | 59 | * Object can affect storage mounting |
60 | 60 | */ |
61 | 61 | class Backend implements \JsonSerializable, IIdentifier, IFrontendDefinition { |
62 | - use VisibilityTrait; |
|
63 | - use FrontendDefinitionTrait; |
|
64 | - use PriorityTrait; |
|
65 | - use DependencyTrait; |
|
66 | - use StorageModifierTrait; |
|
67 | - use IdentifierTrait; |
|
68 | - |
|
69 | - /** @var string storage class */ |
|
70 | - private $storageClass; |
|
71 | - |
|
72 | - /** @var array 'scheme' => true, supported authentication schemes */ |
|
73 | - private $authSchemes = []; |
|
74 | - |
|
75 | - /** @var AuthMechanism|callable authentication mechanism fallback */ |
|
76 | - private $legacyAuthMechanism; |
|
77 | - |
|
78 | - /** |
|
79 | - * @return class-string<IStorage> |
|
80 | - */ |
|
81 | - public function getStorageClass() { |
|
82 | - return $this->storageClass; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @param string $class |
|
87 | - * @return $this |
|
88 | - */ |
|
89 | - public function setStorageClass($class) { |
|
90 | - $this->storageClass = $class; |
|
91 | - return $this; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @return array |
|
96 | - */ |
|
97 | - public function getAuthSchemes() { |
|
98 | - if (empty($this->authSchemes)) { |
|
99 | - return [AuthMechanism::SCHEME_NULL => true]; |
|
100 | - } |
|
101 | - return $this->authSchemes; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @param string $scheme |
|
106 | - * @return self |
|
107 | - */ |
|
108 | - public function addAuthScheme($scheme) { |
|
109 | - $this->authSchemes[$scheme] = true; |
|
110 | - return $this; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * @param array $parameters storage parameters, for dynamic mechanism selection |
|
115 | - * @return AuthMechanism |
|
116 | - */ |
|
117 | - public function getLegacyAuthMechanism(array $parameters = []) { |
|
118 | - if (is_callable($this->legacyAuthMechanism)) { |
|
119 | - return call_user_func($this->legacyAuthMechanism, $parameters); |
|
120 | - } |
|
121 | - return $this->legacyAuthMechanism; |
|
122 | - } |
|
123 | - |
|
124 | - public function setLegacyAuthMechanism(AuthMechanism $authMechanism): self { |
|
125 | - $this->legacyAuthMechanism = $authMechanism; |
|
126 | - return $this; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @param callable $callback dynamic auth mechanism selection |
|
131 | - */ |
|
132 | - public function setLegacyAuthMechanismCallback(callable $callback): self { |
|
133 | - $this->legacyAuthMechanism = $callback; |
|
134 | - return $this; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Serialize into JSON for client-side JS |
|
139 | - */ |
|
140 | - public function jsonSerialize(): array { |
|
141 | - $data = $this->jsonSerializeDefinition(); |
|
142 | - $data += $this->jsonSerializeIdentifier(); |
|
143 | - |
|
144 | - $data['backend'] = $data['name']; // legacy compat |
|
145 | - $data['priority'] = $this->getPriority(); |
|
146 | - $data['authSchemes'] = $this->getAuthSchemes(); |
|
147 | - |
|
148 | - return $data; |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Check if parameters are satisfied in a StorageConfig |
|
153 | - * |
|
154 | - * @param StorageConfig $storage |
|
155 | - * @return bool |
|
156 | - */ |
|
157 | - public function validateStorage(StorageConfig $storage) { |
|
158 | - return $this->validateStorageDefinition($storage); |
|
159 | - } |
|
62 | + use VisibilityTrait; |
|
63 | + use FrontendDefinitionTrait; |
|
64 | + use PriorityTrait; |
|
65 | + use DependencyTrait; |
|
66 | + use StorageModifierTrait; |
|
67 | + use IdentifierTrait; |
|
68 | + |
|
69 | + /** @var string storage class */ |
|
70 | + private $storageClass; |
|
71 | + |
|
72 | + /** @var array 'scheme' => true, supported authentication schemes */ |
|
73 | + private $authSchemes = []; |
|
74 | + |
|
75 | + /** @var AuthMechanism|callable authentication mechanism fallback */ |
|
76 | + private $legacyAuthMechanism; |
|
77 | + |
|
78 | + /** |
|
79 | + * @return class-string<IStorage> |
|
80 | + */ |
|
81 | + public function getStorageClass() { |
|
82 | + return $this->storageClass; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @param string $class |
|
87 | + * @return $this |
|
88 | + */ |
|
89 | + public function setStorageClass($class) { |
|
90 | + $this->storageClass = $class; |
|
91 | + return $this; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @return array |
|
96 | + */ |
|
97 | + public function getAuthSchemes() { |
|
98 | + if (empty($this->authSchemes)) { |
|
99 | + return [AuthMechanism::SCHEME_NULL => true]; |
|
100 | + } |
|
101 | + return $this->authSchemes; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @param string $scheme |
|
106 | + * @return self |
|
107 | + */ |
|
108 | + public function addAuthScheme($scheme) { |
|
109 | + $this->authSchemes[$scheme] = true; |
|
110 | + return $this; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * @param array $parameters storage parameters, for dynamic mechanism selection |
|
115 | + * @return AuthMechanism |
|
116 | + */ |
|
117 | + public function getLegacyAuthMechanism(array $parameters = []) { |
|
118 | + if (is_callable($this->legacyAuthMechanism)) { |
|
119 | + return call_user_func($this->legacyAuthMechanism, $parameters); |
|
120 | + } |
|
121 | + return $this->legacyAuthMechanism; |
|
122 | + } |
|
123 | + |
|
124 | + public function setLegacyAuthMechanism(AuthMechanism $authMechanism): self { |
|
125 | + $this->legacyAuthMechanism = $authMechanism; |
|
126 | + return $this; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @param callable $callback dynamic auth mechanism selection |
|
131 | + */ |
|
132 | + public function setLegacyAuthMechanismCallback(callable $callback): self { |
|
133 | + $this->legacyAuthMechanism = $callback; |
|
134 | + return $this; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Serialize into JSON for client-side JS |
|
139 | + */ |
|
140 | + public function jsonSerialize(): array { |
|
141 | + $data = $this->jsonSerializeDefinition(); |
|
142 | + $data += $this->jsonSerializeIdentifier(); |
|
143 | + |
|
144 | + $data['backend'] = $data['name']; // legacy compat |
|
145 | + $data['priority'] = $this->getPriority(); |
|
146 | + $data['authSchemes'] = $this->getAuthSchemes(); |
|
147 | + |
|
148 | + return $data; |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Check if parameters are satisfied in a StorageConfig |
|
153 | + * |
|
154 | + * @param StorageConfig $storage |
|
155 | + * @return bool |
|
156 | + */ |
|
157 | + public function validateStorage(StorageConfig $storage) { |
|
158 | + return $this->validateStorageDefinition($storage); |
|
159 | + } |
|
160 | 160 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | interface IIdentifier { |
23 | 23 | |
24 | - public function getIdentifier(): string; |
|
24 | + public function getIdentifier(): string; |
|
25 | 25 | |
26 | - public function setIdentifier(string $identifier): self; |
|
26 | + public function setIdentifier(string $identifier): self; |
|
27 | 27 | } |
@@ -32,13 +32,13 @@ |
||
32 | 32 | * @since 26.0.0 |
33 | 33 | */ |
34 | 34 | interface IAssertion { |
35 | - /** |
|
36 | - * This method throws a localized exception when user limits are exceeded, |
|
37 | - * if applicable. Notifications are also created in that case. It is a |
|
38 | - * shorthand for a check against IRegistry::delegateIsHardUserLimitReached(). |
|
39 | - * |
|
40 | - * @throws HintException |
|
41 | - * @since 26.0.0 |
|
42 | - */ |
|
43 | - public function createUserIsLegit(): void; |
|
35 | + /** |
|
36 | + * This method throws a localized exception when user limits are exceeded, |
|
37 | + * if applicable. Notifications are also created in that case. It is a |
|
38 | + * shorthand for a check against IRegistry::delegateIsHardUserLimitReached(). |
|
39 | + * |
|
40 | + * @throws HintException |
|
41 | + * @since 26.0.0 |
|
42 | + */ |
|
43 | + public function createUserIsLegit(): void; |
|
44 | 44 | } |