@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | return [ |
24 | - 'routes' => [ |
|
25 | - ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], |
|
26 | - ] |
|
24 | + 'routes' => [ |
|
25 | + ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], |
|
26 | + ] |
|
27 | 27 | ]; |
@@ -31,129 +31,129 @@ |
||
31 | 31 | */ |
32 | 32 | trait FrontendDefinitionTrait { |
33 | 33 | |
34 | - /** @var string human-readable mechanism name */ |
|
35 | - private $text; |
|
36 | - |
|
37 | - /** @var DefinitionParameter[] parameters for mechanism */ |
|
38 | - private $parameters = []; |
|
39 | - |
|
40 | - /** @var string[] custom JS */ |
|
41 | - private $customJs = []; |
|
42 | - |
|
43 | - /** |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - public function getText() { |
|
47 | - return $this->text; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * @param string $text |
|
52 | - * @return $this |
|
53 | - */ |
|
54 | - public function setText($text) { |
|
55 | - $this->text = $text; |
|
56 | - return $this; |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * @param FrontendDefinitionTrait $a |
|
61 | - * @param FrontendDefinitionTrait $b |
|
62 | - * @return int |
|
63 | - */ |
|
64 | - public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) { |
|
65 | - return strcmp($a->getText(), $b->getText()); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @return DefinitionParameter[] |
|
70 | - */ |
|
71 | - public function getParameters() { |
|
72 | - return $this->parameters; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @param DefinitionParameter[] $parameters |
|
77 | - * @return self |
|
78 | - */ |
|
79 | - public function addParameters(array $parameters) { |
|
80 | - foreach ($parameters as $parameter) { |
|
81 | - $this->addParameter($parameter); |
|
82 | - } |
|
83 | - return $this; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * @param DefinitionParameter $parameter |
|
88 | - * @return self |
|
89 | - */ |
|
90 | - public function addParameter(DefinitionParameter $parameter) { |
|
91 | - $this->parameters[$parameter->getName()] = $parameter; |
|
92 | - return $this; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @return string[] |
|
97 | - */ |
|
98 | - public function getCustomJs() { |
|
99 | - return $this->customJs; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @param string $custom |
|
104 | - * @return self |
|
105 | - */ |
|
106 | - public function addCustomJs($custom) { |
|
107 | - $this->customJs[] = $custom; |
|
108 | - return $this; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @param string $custom |
|
113 | - * @return self |
|
114 | - * @deprecated 9.1.0, use addCustomJs() instead |
|
115 | - */ |
|
116 | - public function setCustomJs($custom) { |
|
117 | - $this->customJs = [$custom]; |
|
118 | - return $this; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Serialize into JSON for client-side JS |
|
123 | - * |
|
124 | - * @return array |
|
125 | - */ |
|
126 | - public function jsonSerializeDefinition() { |
|
127 | - $configuration = []; |
|
128 | - foreach ($this->getParameters() as $parameter) { |
|
129 | - $configuration[$parameter->getName()] = $parameter; |
|
130 | - } |
|
131 | - |
|
132 | - $data = [ |
|
133 | - 'name' => $this->getText(), |
|
134 | - 'configuration' => $configuration, |
|
135 | - 'custom' => $this->getCustomJs(), |
|
136 | - ]; |
|
137 | - return $data; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Check if parameters are satisfied in a StorageConfig |
|
142 | - * |
|
143 | - * @param StorageConfig $storage |
|
144 | - * @return bool |
|
145 | - */ |
|
146 | - public function validateStorageDefinition(StorageConfig $storage) { |
|
147 | - foreach ($this->getParameters() as $name => $parameter) { |
|
148 | - $value = $storage->getBackendOption($name); |
|
149 | - if (!is_null($value) || !$parameter->isOptional()) { |
|
150 | - if (!$parameter->validateValue($value)) { |
|
151 | - return false; |
|
152 | - } |
|
153 | - $storage->setBackendOption($name, $value); |
|
154 | - } |
|
155 | - } |
|
156 | - return true; |
|
157 | - } |
|
34 | + /** @var string human-readable mechanism name */ |
|
35 | + private $text; |
|
36 | + |
|
37 | + /** @var DefinitionParameter[] parameters for mechanism */ |
|
38 | + private $parameters = []; |
|
39 | + |
|
40 | + /** @var string[] custom JS */ |
|
41 | + private $customJs = []; |
|
42 | + |
|
43 | + /** |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + public function getText() { |
|
47 | + return $this->text; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * @param string $text |
|
52 | + * @return $this |
|
53 | + */ |
|
54 | + public function setText($text) { |
|
55 | + $this->text = $text; |
|
56 | + return $this; |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * @param FrontendDefinitionTrait $a |
|
61 | + * @param FrontendDefinitionTrait $b |
|
62 | + * @return int |
|
63 | + */ |
|
64 | + public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) { |
|
65 | + return strcmp($a->getText(), $b->getText()); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @return DefinitionParameter[] |
|
70 | + */ |
|
71 | + public function getParameters() { |
|
72 | + return $this->parameters; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @param DefinitionParameter[] $parameters |
|
77 | + * @return self |
|
78 | + */ |
|
79 | + public function addParameters(array $parameters) { |
|
80 | + foreach ($parameters as $parameter) { |
|
81 | + $this->addParameter($parameter); |
|
82 | + } |
|
83 | + return $this; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * @param DefinitionParameter $parameter |
|
88 | + * @return self |
|
89 | + */ |
|
90 | + public function addParameter(DefinitionParameter $parameter) { |
|
91 | + $this->parameters[$parameter->getName()] = $parameter; |
|
92 | + return $this; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @return string[] |
|
97 | + */ |
|
98 | + public function getCustomJs() { |
|
99 | + return $this->customJs; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @param string $custom |
|
104 | + * @return self |
|
105 | + */ |
|
106 | + public function addCustomJs($custom) { |
|
107 | + $this->customJs[] = $custom; |
|
108 | + return $this; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @param string $custom |
|
113 | + * @return self |
|
114 | + * @deprecated 9.1.0, use addCustomJs() instead |
|
115 | + */ |
|
116 | + public function setCustomJs($custom) { |
|
117 | + $this->customJs = [$custom]; |
|
118 | + return $this; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Serialize into JSON for client-side JS |
|
123 | + * |
|
124 | + * @return array |
|
125 | + */ |
|
126 | + public function jsonSerializeDefinition() { |
|
127 | + $configuration = []; |
|
128 | + foreach ($this->getParameters() as $parameter) { |
|
129 | + $configuration[$parameter->getName()] = $parameter; |
|
130 | + } |
|
131 | + |
|
132 | + $data = [ |
|
133 | + 'name' => $this->getText(), |
|
134 | + 'configuration' => $configuration, |
|
135 | + 'custom' => $this->getCustomJs(), |
|
136 | + ]; |
|
137 | + return $data; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Check if parameters are satisfied in a StorageConfig |
|
142 | + * |
|
143 | + * @param StorageConfig $storage |
|
144 | + * @return bool |
|
145 | + */ |
|
146 | + public function validateStorageDefinition(StorageConfig $storage) { |
|
147 | + foreach ($this->getParameters() as $name => $parameter) { |
|
148 | + $value = $storage->getBackendOption($name); |
|
149 | + if (!is_null($value) || !$parameter->isOptional()) { |
|
150 | + if (!$parameter->validateValue($value)) { |
|
151 | + return false; |
|
152 | + } |
|
153 | + $storage->setBackendOption($name, $value); |
|
154 | + } |
|
155 | + } |
|
156 | + return true; |
|
157 | + } |
|
158 | 158 | |
159 | 159 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | * Authentication mechanism or backend has insufficient data |
30 | 30 | */ |
31 | 31 | class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableException { |
32 | - /** |
|
33 | - * StorageNotAvailableException constructor. |
|
34 | - * |
|
35 | - * @param string $message |
|
36 | - * @param int $code |
|
37 | - * @param \Exception|null $previous |
|
38 | - * @since 6.0.0 |
|
39 | - */ |
|
40 | - public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
41 | - parent::__construct($message, $code, $previous); |
|
42 | - } |
|
32 | + /** |
|
33 | + * StorageNotAvailableException constructor. |
|
34 | + * |
|
35 | + * @param string $message |
|
36 | + * @param int $code |
|
37 | + * @param \Exception|null $previous |
|
38 | + * @since 6.0.0 |
|
39 | + */ |
|
40 | + public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | + } |
|
43 | 43 | } |
@@ -28,76 +28,76 @@ |
||
28 | 28 | */ |
29 | 29 | trait IdentifierTrait { |
30 | 30 | |
31 | - /** @var string */ |
|
32 | - protected $identifier; |
|
31 | + /** @var string */ |
|
32 | + protected $identifier; |
|
33 | 33 | |
34 | - /** @var string[] */ |
|
35 | - protected $identifierAliases = []; |
|
34 | + /** @var string[] */ |
|
35 | + protected $identifierAliases = []; |
|
36 | 36 | |
37 | - /** @var IdentifierTrait */ |
|
38 | - protected $deprecateTo = null; |
|
37 | + /** @var IdentifierTrait */ |
|
38 | + protected $deprecateTo = null; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function getIdentifier() { |
|
44 | - return $this->identifier; |
|
45 | - } |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function getIdentifier() { |
|
44 | + return $this->identifier; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $identifier |
|
49 | - * @return $this |
|
50 | - */ |
|
51 | - public function setIdentifier($identifier) { |
|
52 | - $this->identifier = $identifier; |
|
53 | - $this->identifierAliases[] = $identifier; |
|
54 | - return $this; |
|
55 | - } |
|
47 | + /** |
|
48 | + * @param string $identifier |
|
49 | + * @return $this |
|
50 | + */ |
|
51 | + public function setIdentifier($identifier) { |
|
52 | + $this->identifier = $identifier; |
|
53 | + $this->identifierAliases[] = $identifier; |
|
54 | + return $this; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return string[] |
|
59 | - */ |
|
60 | - public function getIdentifierAliases() { |
|
61 | - return $this->identifierAliases; |
|
62 | - } |
|
57 | + /** |
|
58 | + * @return string[] |
|
59 | + */ |
|
60 | + public function getIdentifierAliases() { |
|
61 | + return $this->identifierAliases; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param string $alias |
|
66 | - * @return $this |
|
67 | - */ |
|
68 | - public function addIdentifierAlias($alias) { |
|
69 | - $this->identifierAliases[] = $alias; |
|
70 | - return $this; |
|
71 | - } |
|
64 | + /** |
|
65 | + * @param string $alias |
|
66 | + * @return $this |
|
67 | + */ |
|
68 | + public function addIdentifierAlias($alias) { |
|
69 | + $this->identifierAliases[] = $alias; |
|
70 | + return $this; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return object|null |
|
75 | - */ |
|
76 | - public function getDeprecateTo() { |
|
77 | - return $this->deprecateTo; |
|
78 | - } |
|
73 | + /** |
|
74 | + * @return object|null |
|
75 | + */ |
|
76 | + public function getDeprecateTo() { |
|
77 | + return $this->deprecateTo; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @param object $destinationObject |
|
82 | - * @return self |
|
83 | - */ |
|
84 | - public function deprecateTo($destinationObject) { |
|
85 | - $this->deprecateTo = $destinationObject; |
|
86 | - return $this; |
|
87 | - } |
|
80 | + /** |
|
81 | + * @param object $destinationObject |
|
82 | + * @return self |
|
83 | + */ |
|
84 | + public function deprecateTo($destinationObject) { |
|
85 | + $this->deprecateTo = $destinationObject; |
|
86 | + return $this; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function jsonSerializeIdentifier() { |
|
93 | - $data = [ |
|
94 | - 'identifier' => $this->identifier, |
|
95 | - 'identifierAliases' => $this->identifierAliases, |
|
96 | - ]; |
|
97 | - if ($this->deprecateTo) { |
|
98 | - $data['deprecateTo'] = $this->deprecateTo->getIdentifier(); |
|
99 | - } |
|
100 | - return $data; |
|
101 | - } |
|
89 | + /** |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function jsonSerializeIdentifier() { |
|
93 | + $data = [ |
|
94 | + 'identifier' => $this->identifier, |
|
95 | + 'identifierAliases' => $this->identifierAliases, |
|
96 | + ]; |
|
97 | + if ($this->deprecateTo) { |
|
98 | + $data['deprecateTo'] = $this->deprecateTo->getIdentifier(); |
|
99 | + } |
|
100 | + return $data; |
|
101 | + } |
|
102 | 102 | |
103 | 103 | } |
@@ -128,32 +128,32 @@ discard block |
||
128 | 128 | $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
129 | 129 | |
130 | 130 | if (!Filesystem::isValidPath($mountPoint)) { |
131 | - $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
131 | + $output->writeln('<error>Invalid mountpoint "'.$mountPoint.'"</error>'); |
|
132 | 132 | return 1; |
133 | 133 | } |
134 | 134 | if (is_null($storageBackend)) { |
135 | - $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
135 | + $output->writeln('<error>Storage backend with identifier "'.$storageIdentifier.'" not found (see `occ files_external:backends` for possible values)</error>'); |
|
136 | 136 | return 404; |
137 | 137 | } |
138 | 138 | if (is_null($authBackend)) { |
139 | - $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
139 | + $output->writeln('<error>Authentication backend with identifier "'.$authIdentifier.'" not found (see `occ files_external:backends` for possible values)</error>'); |
|
140 | 140 | return 404; |
141 | 141 | } |
142 | 142 | $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
143 | 143 | if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
144 | - $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
144 | + $output->writeln('<error>Authentication backend "'.$authIdentifier.'" not valid for storage backend "'.$storageIdentifier.'" (see `occ files_external:backends storage '.$storageIdentifier.'` for possible values)</error>'); |
|
145 | 145 | return 1; |
146 | 146 | } |
147 | 147 | |
148 | 148 | $config = []; |
149 | 149 | foreach ($configInput as $configOption) { |
150 | 150 | if (!strpos($configOption, '=')) { |
151 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
151 | + $output->writeln('<error>Invalid mount configuration option "'.$configOption.'"</error>'); |
|
152 | 152 | return 1; |
153 | 153 | } |
154 | 154 | list($key, $value) = explode('=', $configOption, 2); |
155 | 155 | if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
156 | - $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
156 | + $output->writeln('<error>Unknown configuration for backends "'.$key.'"</error>'); |
|
157 | 157 | return 1; |
158 | 158 | } |
159 | 159 | $config[$key] = $value; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | if ($user) { |
169 | 169 | if (!$this->userManager->userExists($user)) { |
170 | - $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
170 | + $output->writeln('<error>User "'.$user.'" not found</error>'); |
|
171 | 171 | return 1; |
172 | 172 | } |
173 | 173 | $mount->setApplicableUsers([$user]); |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | } else { |
179 | 179 | $this->getStorageService($user)->addStorage($mount); |
180 | 180 | if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
181 | - $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
181 | + $output->writeln('<info>Storage created with id '.$mount->getId().'</info>'); |
|
182 | 182 | } else { |
183 | - $output->writeln((string)$mount->getId()); |
|
183 | + $output->writeln((string) $mount->getId()); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return 0; |
@@ -44,182 +44,182 @@ |
||
44 | 44 | use Symfony\Component\Console\Output\OutputInterface; |
45 | 45 | |
46 | 46 | class Create extends Base { |
47 | - /** |
|
48 | - * @var GlobalStoragesService |
|
49 | - */ |
|
50 | - private $globalService; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var UserStoragesService |
|
54 | - */ |
|
55 | - private $userService; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var IUserManager |
|
59 | - */ |
|
60 | - private $userManager; |
|
61 | - |
|
62 | - /** @var BackendService */ |
|
63 | - private $backendService; |
|
64 | - |
|
65 | - /** @var IUserSession */ |
|
66 | - private $userSession; |
|
67 | - |
|
68 | - public function __construct(GlobalStoragesService $globalService, |
|
69 | - UserStoragesService $userService, |
|
70 | - IUserManager $userManager, |
|
71 | - IUserSession $userSession, |
|
72 | - BackendService $backendService |
|
73 | - ) { |
|
74 | - parent::__construct(); |
|
75 | - $this->globalService = $globalService; |
|
76 | - $this->userService = $userService; |
|
77 | - $this->userManager = $userManager; |
|
78 | - $this->userSession = $userSession; |
|
79 | - $this->backendService = $backendService; |
|
80 | - } |
|
81 | - |
|
82 | - protected function configure() { |
|
83 | - $this |
|
84 | - ->setName('files_external:create') |
|
85 | - ->setDescription('Create a new mount configuration') |
|
86 | - ->addOption( |
|
87 | - 'user', |
|
88 | - '', |
|
89 | - InputOption::VALUE_OPTIONAL, |
|
90 | - 'user to add the mount configuration for, if not set the mount will be added as system mount' |
|
91 | - ) |
|
92 | - ->addArgument( |
|
93 | - 'mount_point', |
|
94 | - InputArgument::REQUIRED, |
|
95 | - 'mount point for the new mount' |
|
96 | - ) |
|
97 | - ->addArgument( |
|
98 | - 'storage_backend', |
|
99 | - InputArgument::REQUIRED, |
|
100 | - 'storage backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
101 | - ) |
|
102 | - ->addArgument( |
|
103 | - 'authentication_backend', |
|
104 | - InputArgument::REQUIRED, |
|
105 | - 'authentication backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
106 | - ) |
|
107 | - ->addOption( |
|
108 | - 'config', |
|
109 | - 'c', |
|
110 | - InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
111 | - 'Mount configuration option in key=value format' |
|
112 | - ) |
|
113 | - ->addOption( |
|
114 | - 'dry', |
|
115 | - '', |
|
116 | - InputOption::VALUE_NONE, |
|
117 | - 'Don\'t save the created mount, only list the new mount' |
|
118 | - ); |
|
119 | - parent::configure(); |
|
120 | - } |
|
121 | - |
|
122 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
123 | - $user = $input->getOption('user'); |
|
124 | - $mountPoint = $input->getArgument('mount_point'); |
|
125 | - $storageIdentifier = $input->getArgument('storage_backend'); |
|
126 | - $authIdentifier = $input->getArgument('authentication_backend'); |
|
127 | - $configInput = $input->getOption('config'); |
|
128 | - |
|
129 | - $storageBackend = $this->backendService->getBackend($storageIdentifier); |
|
130 | - $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
|
131 | - |
|
132 | - if (!Filesystem::isValidPath($mountPoint)) { |
|
133 | - $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
134 | - return 1; |
|
135 | - } |
|
136 | - if (is_null($storageBackend)) { |
|
137 | - $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
138 | - return 404; |
|
139 | - } |
|
140 | - if (is_null($authBackend)) { |
|
141 | - $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
142 | - return 404; |
|
143 | - } |
|
144 | - $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
|
145 | - if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
|
146 | - $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
147 | - return 1; |
|
148 | - } |
|
149 | - |
|
150 | - $config = []; |
|
151 | - foreach ($configInput as $configOption) { |
|
152 | - if (!strpos($configOption, '=')) { |
|
153 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
154 | - return 1; |
|
155 | - } |
|
156 | - list($key, $value) = explode('=', $configOption, 2); |
|
157 | - if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
|
158 | - $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
159 | - return 1; |
|
160 | - } |
|
161 | - $config[$key] = $value; |
|
162 | - } |
|
163 | - |
|
164 | - $mount = new StorageConfig(); |
|
165 | - $mount->setMountPoint($mountPoint); |
|
166 | - $mount->setBackend($storageBackend); |
|
167 | - $mount->setAuthMechanism($authBackend); |
|
168 | - $mount->setBackendOptions($config); |
|
169 | - |
|
170 | - if ($user) { |
|
171 | - if (!$this->userManager->userExists($user)) { |
|
172 | - $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
173 | - return 1; |
|
174 | - } |
|
175 | - $mount->setApplicableUsers([$user]); |
|
176 | - } |
|
177 | - |
|
178 | - if ($input->getOption('dry')) { |
|
179 | - $this->showMount($user, $mount, $input, $output); |
|
180 | - } else { |
|
181 | - $this->getStorageService($user)->addStorage($mount); |
|
182 | - if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
|
183 | - $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
184 | - } else { |
|
185 | - $output->writeln((string)$mount->getId()); |
|
186 | - } |
|
187 | - } |
|
188 | - return 0; |
|
189 | - } |
|
190 | - |
|
191 | - private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend) { |
|
192 | - $params = array_merge($storageBackend->getParameters(), $authBackend->getParameters()); |
|
193 | - foreach ($params as $param) { |
|
194 | - /** @var DefinitionParameter $param */ |
|
195 | - if ($param->getName() === $key) { |
|
196 | - if ($param->getType() === DefinitionParameter::VALUE_BOOLEAN) { |
|
197 | - $value = ($value === 'true'); |
|
198 | - } |
|
199 | - return true; |
|
200 | - } |
|
201 | - } |
|
202 | - return false; |
|
203 | - } |
|
204 | - |
|
205 | - private function showMount($user, StorageConfig $mount, InputInterface $input, OutputInterface $output) { |
|
206 | - $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
207 | - $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
208 | - $listInput->setOption('output', $input->getOption('output')); |
|
209 | - $listInput->setOption('show-password', true); |
|
210 | - $listCommand->listMounts($user, [$mount], $listInput, $output); |
|
211 | - } |
|
212 | - |
|
213 | - protected function getStorageService($userId) { |
|
214 | - if (!empty($userId)) { |
|
215 | - $user = $this->userManager->get($userId); |
|
216 | - if (is_null($user)) { |
|
217 | - throw new NoUserException("user $userId not found"); |
|
218 | - } |
|
219 | - $this->userSession->setUser($user); |
|
220 | - return $this->userService; |
|
221 | - } else { |
|
222 | - return $this->globalService; |
|
223 | - } |
|
224 | - } |
|
47 | + /** |
|
48 | + * @var GlobalStoragesService |
|
49 | + */ |
|
50 | + private $globalService; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var UserStoragesService |
|
54 | + */ |
|
55 | + private $userService; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var IUserManager |
|
59 | + */ |
|
60 | + private $userManager; |
|
61 | + |
|
62 | + /** @var BackendService */ |
|
63 | + private $backendService; |
|
64 | + |
|
65 | + /** @var IUserSession */ |
|
66 | + private $userSession; |
|
67 | + |
|
68 | + public function __construct(GlobalStoragesService $globalService, |
|
69 | + UserStoragesService $userService, |
|
70 | + IUserManager $userManager, |
|
71 | + IUserSession $userSession, |
|
72 | + BackendService $backendService |
|
73 | + ) { |
|
74 | + parent::__construct(); |
|
75 | + $this->globalService = $globalService; |
|
76 | + $this->userService = $userService; |
|
77 | + $this->userManager = $userManager; |
|
78 | + $this->userSession = $userSession; |
|
79 | + $this->backendService = $backendService; |
|
80 | + } |
|
81 | + |
|
82 | + protected function configure() { |
|
83 | + $this |
|
84 | + ->setName('files_external:create') |
|
85 | + ->setDescription('Create a new mount configuration') |
|
86 | + ->addOption( |
|
87 | + 'user', |
|
88 | + '', |
|
89 | + InputOption::VALUE_OPTIONAL, |
|
90 | + 'user to add the mount configuration for, if not set the mount will be added as system mount' |
|
91 | + ) |
|
92 | + ->addArgument( |
|
93 | + 'mount_point', |
|
94 | + InputArgument::REQUIRED, |
|
95 | + 'mount point for the new mount' |
|
96 | + ) |
|
97 | + ->addArgument( |
|
98 | + 'storage_backend', |
|
99 | + InputArgument::REQUIRED, |
|
100 | + 'storage backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
101 | + ) |
|
102 | + ->addArgument( |
|
103 | + 'authentication_backend', |
|
104 | + InputArgument::REQUIRED, |
|
105 | + 'authentication backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
106 | + ) |
|
107 | + ->addOption( |
|
108 | + 'config', |
|
109 | + 'c', |
|
110 | + InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
111 | + 'Mount configuration option in key=value format' |
|
112 | + ) |
|
113 | + ->addOption( |
|
114 | + 'dry', |
|
115 | + '', |
|
116 | + InputOption::VALUE_NONE, |
|
117 | + 'Don\'t save the created mount, only list the new mount' |
|
118 | + ); |
|
119 | + parent::configure(); |
|
120 | + } |
|
121 | + |
|
122 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
123 | + $user = $input->getOption('user'); |
|
124 | + $mountPoint = $input->getArgument('mount_point'); |
|
125 | + $storageIdentifier = $input->getArgument('storage_backend'); |
|
126 | + $authIdentifier = $input->getArgument('authentication_backend'); |
|
127 | + $configInput = $input->getOption('config'); |
|
128 | + |
|
129 | + $storageBackend = $this->backendService->getBackend($storageIdentifier); |
|
130 | + $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
|
131 | + |
|
132 | + if (!Filesystem::isValidPath($mountPoint)) { |
|
133 | + $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
134 | + return 1; |
|
135 | + } |
|
136 | + if (is_null($storageBackend)) { |
|
137 | + $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
138 | + return 404; |
|
139 | + } |
|
140 | + if (is_null($authBackend)) { |
|
141 | + $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
142 | + return 404; |
|
143 | + } |
|
144 | + $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
|
145 | + if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
|
146 | + $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
147 | + return 1; |
|
148 | + } |
|
149 | + |
|
150 | + $config = []; |
|
151 | + foreach ($configInput as $configOption) { |
|
152 | + if (!strpos($configOption, '=')) { |
|
153 | + $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
154 | + return 1; |
|
155 | + } |
|
156 | + list($key, $value) = explode('=', $configOption, 2); |
|
157 | + if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
|
158 | + $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
159 | + return 1; |
|
160 | + } |
|
161 | + $config[$key] = $value; |
|
162 | + } |
|
163 | + |
|
164 | + $mount = new StorageConfig(); |
|
165 | + $mount->setMountPoint($mountPoint); |
|
166 | + $mount->setBackend($storageBackend); |
|
167 | + $mount->setAuthMechanism($authBackend); |
|
168 | + $mount->setBackendOptions($config); |
|
169 | + |
|
170 | + if ($user) { |
|
171 | + if (!$this->userManager->userExists($user)) { |
|
172 | + $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
173 | + return 1; |
|
174 | + } |
|
175 | + $mount->setApplicableUsers([$user]); |
|
176 | + } |
|
177 | + |
|
178 | + if ($input->getOption('dry')) { |
|
179 | + $this->showMount($user, $mount, $input, $output); |
|
180 | + } else { |
|
181 | + $this->getStorageService($user)->addStorage($mount); |
|
182 | + if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
|
183 | + $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
184 | + } else { |
|
185 | + $output->writeln((string)$mount->getId()); |
|
186 | + } |
|
187 | + } |
|
188 | + return 0; |
|
189 | + } |
|
190 | + |
|
191 | + private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend) { |
|
192 | + $params = array_merge($storageBackend->getParameters(), $authBackend->getParameters()); |
|
193 | + foreach ($params as $param) { |
|
194 | + /** @var DefinitionParameter $param */ |
|
195 | + if ($param->getName() === $key) { |
|
196 | + if ($param->getType() === DefinitionParameter::VALUE_BOOLEAN) { |
|
197 | + $value = ($value === 'true'); |
|
198 | + } |
|
199 | + return true; |
|
200 | + } |
|
201 | + } |
|
202 | + return false; |
|
203 | + } |
|
204 | + |
|
205 | + private function showMount($user, StorageConfig $mount, InputInterface $input, OutputInterface $output) { |
|
206 | + $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
207 | + $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
208 | + $listInput->setOption('output', $input->getOption('output')); |
|
209 | + $listInput->setOption('show-password', true); |
|
210 | + $listCommand->listMounts($user, [$mount], $listInput, $output); |
|
211 | + } |
|
212 | + |
|
213 | + protected function getStorageService($userId) { |
|
214 | + if (!empty($userId)) { |
|
215 | + $user = $this->userManager->get($userId); |
|
216 | + if (is_null($user)) { |
|
217 | + throw new NoUserException("user $userId not found"); |
|
218 | + } |
|
219 | + $this->userSession->setUser($user); |
|
220 | + return $this->userService; |
|
221 | + } else { |
|
222 | + return $this->globalService; |
|
223 | + } |
|
224 | + } |
|
225 | 225 | } |
@@ -21,62 +21,62 @@ |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | return [ |
24 | - 'routes' => [ |
|
25 | - [ |
|
26 | - 'name' => 'RateLimitTest#userAndAnonProtected', |
|
27 | - 'url' => '/userAndAnonProtected', |
|
28 | - 'verb' => 'GET', |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'RateLimitTest#onlyAnonProtected', |
|
32 | - 'url' => '/anonProtected', |
|
33 | - 'verb' => 'GET', |
|
34 | - ], |
|
35 | - ], |
|
24 | + 'routes' => [ |
|
25 | + [ |
|
26 | + 'name' => 'RateLimitTest#userAndAnonProtected', |
|
27 | + 'url' => '/userAndAnonProtected', |
|
28 | + 'verb' => 'GET', |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'RateLimitTest#onlyAnonProtected', |
|
32 | + 'url' => '/anonProtected', |
|
33 | + 'verb' => 'GET', |
|
34 | + ], |
|
35 | + ], |
|
36 | 36 | |
37 | - 'ocs' => [ |
|
38 | - [ |
|
39 | - 'name' => 'Config#setAppValue', |
|
40 | - 'url' => '/api/v1/app/{appid}/{configkey}', |
|
41 | - 'verb' => 'POST', |
|
42 | - ], |
|
43 | - [ |
|
44 | - 'name' => 'Config#deleteAppValue', |
|
45 | - 'url' => '/api/v1/app/{appid}/{configkey}', |
|
46 | - 'verb' => 'DELETE', |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'Locking#isLockingEnabled', |
|
50 | - 'url' => '/api/v1/lockprovisioning', |
|
51 | - 'verb' => 'GET', |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'name' => 'Locking#isLocked', |
|
55 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
56 | - 'verb' => 'GET', |
|
57 | - ], |
|
58 | - [ |
|
59 | - 'name' => 'Locking#acquireLock', |
|
60 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
61 | - 'verb' => 'POST', |
|
62 | - ], |
|
63 | - [ |
|
64 | - 'name' => 'Locking#changeLock', |
|
65 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
66 | - 'verb' => 'PUT', |
|
67 | - ], |
|
68 | - [ |
|
69 | - 'name' => 'Locking#releaseLock', |
|
70 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
71 | - 'verb' => 'DELETE', |
|
72 | - ], |
|
73 | - [ |
|
74 | - 'name' => 'Locking#releaseAll', |
|
75 | - 'url' => '/api/v1/lockprovisioning/{type}', |
|
76 | - 'verb' => 'DELETE', |
|
77 | - 'defaults' => [ |
|
78 | - 'type' => null |
|
79 | - ] |
|
80 | - ], |
|
81 | - ], |
|
37 | + 'ocs' => [ |
|
38 | + [ |
|
39 | + 'name' => 'Config#setAppValue', |
|
40 | + 'url' => '/api/v1/app/{appid}/{configkey}', |
|
41 | + 'verb' => 'POST', |
|
42 | + ], |
|
43 | + [ |
|
44 | + 'name' => 'Config#deleteAppValue', |
|
45 | + 'url' => '/api/v1/app/{appid}/{configkey}', |
|
46 | + 'verb' => 'DELETE', |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'Locking#isLockingEnabled', |
|
50 | + 'url' => '/api/v1/lockprovisioning', |
|
51 | + 'verb' => 'GET', |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'name' => 'Locking#isLocked', |
|
55 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
56 | + 'verb' => 'GET', |
|
57 | + ], |
|
58 | + [ |
|
59 | + 'name' => 'Locking#acquireLock', |
|
60 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
61 | + 'verb' => 'POST', |
|
62 | + ], |
|
63 | + [ |
|
64 | + 'name' => 'Locking#changeLock', |
|
65 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
66 | + 'verb' => 'PUT', |
|
67 | + ], |
|
68 | + [ |
|
69 | + 'name' => 'Locking#releaseLock', |
|
70 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
71 | + 'verb' => 'DELETE', |
|
72 | + ], |
|
73 | + [ |
|
74 | + 'name' => 'Locking#releaseAll', |
|
75 | + 'url' => '/api/v1/lockprovisioning/{type}', |
|
76 | + 'verb' => 'DELETE', |
|
77 | + 'defaults' => [ |
|
78 | + 'type' => null |
|
79 | + ] |
|
80 | + ], |
|
81 | + ], |
|
82 | 82 | ]; |
@@ -36,91 +36,91 @@ |
||
36 | 36 | */ |
37 | 37 | interface IRouter { |
38 | 38 | |
39 | - /** |
|
40 | - * Get the files to load the routes from |
|
41 | - * |
|
42 | - * @return string[] |
|
43 | - * @since 7.0.0 |
|
44 | - * @deprecated 9.0.0 |
|
45 | - */ |
|
46 | - public function getRoutingFiles(); |
|
39 | + /** |
|
40 | + * Get the files to load the routes from |
|
41 | + * |
|
42 | + * @return string[] |
|
43 | + * @since 7.0.0 |
|
44 | + * @deprecated 9.0.0 |
|
45 | + */ |
|
46 | + public function getRoutingFiles(); |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string |
|
50 | - * @since 7.0.0 |
|
51 | - * @deprecated 9.0.0 |
|
52 | - */ |
|
53 | - public function getCacheKey(); |
|
48 | + /** |
|
49 | + * @return string |
|
50 | + * @since 7.0.0 |
|
51 | + * @deprecated 9.0.0 |
|
52 | + */ |
|
53 | + public function getCacheKey(); |
|
54 | 54 | |
55 | - /** |
|
56 | - * Loads the routes |
|
57 | - * |
|
58 | - * @param null|string $app |
|
59 | - * @since 7.0.0 |
|
60 | - * @deprecated 9.0.0 |
|
61 | - */ |
|
62 | - public function loadRoutes($app = null); |
|
55 | + /** |
|
56 | + * Loads the routes |
|
57 | + * |
|
58 | + * @param null|string $app |
|
59 | + * @since 7.0.0 |
|
60 | + * @deprecated 9.0.0 |
|
61 | + */ |
|
62 | + public function loadRoutes($app = null); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Sets the collection to use for adding routes |
|
66 | - * |
|
67 | - * @param string $name Name of the collection to use. |
|
68 | - * @return void |
|
69 | - * @since 7.0.0 |
|
70 | - * @deprecated 9.0.0 |
|
71 | - */ |
|
72 | - public function useCollection($name); |
|
64 | + /** |
|
65 | + * Sets the collection to use for adding routes |
|
66 | + * |
|
67 | + * @param string $name Name of the collection to use. |
|
68 | + * @return void |
|
69 | + * @since 7.0.0 |
|
70 | + * @deprecated 9.0.0 |
|
71 | + */ |
|
72 | + public function useCollection($name); |
|
73 | 73 | |
74 | - /** |
|
75 | - * returns the current collection name in use for adding routes |
|
76 | - * |
|
77 | - * @return string the collection name |
|
78 | - * @since 8.0.0 |
|
79 | - * @deprecated 9.0.0 |
|
80 | - */ |
|
81 | - public function getCurrentCollection(); |
|
74 | + /** |
|
75 | + * returns the current collection name in use for adding routes |
|
76 | + * |
|
77 | + * @return string the collection name |
|
78 | + * @since 8.0.0 |
|
79 | + * @deprecated 9.0.0 |
|
80 | + */ |
|
81 | + public function getCurrentCollection(); |
|
82 | 82 | |
83 | - /** |
|
84 | - * Create a \OCP\Route\IRoute. |
|
85 | - * |
|
86 | - * @param string $name Name of the route to create. |
|
87 | - * @param string $pattern The pattern to match |
|
88 | - * @param array $defaults An array of default parameter values |
|
89 | - * @param array $requirements An array of requirements for parameters (regexes) |
|
90 | - * @return \OCP\Route\IRoute |
|
91 | - * @since 7.0.0 |
|
92 | - * @deprecated 9.0.0 |
|
93 | - */ |
|
94 | - public function create($name, $pattern, array $defaults = [], array $requirements = []); |
|
83 | + /** |
|
84 | + * Create a \OCP\Route\IRoute. |
|
85 | + * |
|
86 | + * @param string $name Name of the route to create. |
|
87 | + * @param string $pattern The pattern to match |
|
88 | + * @param array $defaults An array of default parameter values |
|
89 | + * @param array $requirements An array of requirements for parameters (regexes) |
|
90 | + * @return \OCP\Route\IRoute |
|
91 | + * @since 7.0.0 |
|
92 | + * @deprecated 9.0.0 |
|
93 | + */ |
|
94 | + public function create($name, $pattern, array $defaults = [], array $requirements = []); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Find the route matching $url. |
|
98 | - * |
|
99 | - * @param string $url The url to find |
|
100 | - * @throws \Exception |
|
101 | - * @return void |
|
102 | - * @since 7.0.0 |
|
103 | - * @deprecated 9.0.0 |
|
104 | - */ |
|
105 | - public function match($url); |
|
96 | + /** |
|
97 | + * Find the route matching $url. |
|
98 | + * |
|
99 | + * @param string $url The url to find |
|
100 | + * @throws \Exception |
|
101 | + * @return void |
|
102 | + * @since 7.0.0 |
|
103 | + * @deprecated 9.0.0 |
|
104 | + */ |
|
105 | + public function match($url); |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get the url generator |
|
109 | - * |
|
110 | - * @since 7.0.0 |
|
111 | - * @deprecated 9.0.0 |
|
112 | - */ |
|
113 | - public function getGenerator(); |
|
107 | + /** |
|
108 | + * Get the url generator |
|
109 | + * |
|
110 | + * @since 7.0.0 |
|
111 | + * @deprecated 9.0.0 |
|
112 | + */ |
|
113 | + public function getGenerator(); |
|
114 | 114 | |
115 | - /** |
|
116 | - * Generate url based on $name and $parameters |
|
117 | - * |
|
118 | - * @param string $name Name of the route to use. |
|
119 | - * @param array $parameters Parameters for the route |
|
120 | - * @param bool $absolute |
|
121 | - * @return string |
|
122 | - * @since 7.0.0 |
|
123 | - * @deprecated 9.0.0 |
|
124 | - */ |
|
125 | - public function generate($name, $parameters = [], $absolute = false); |
|
115 | + /** |
|
116 | + * Generate url based on $name and $parameters |
|
117 | + * |
|
118 | + * @param string $name Name of the route to use. |
|
119 | + * @param array $parameters Parameters for the route |
|
120 | + * @param bool $absolute |
|
121 | + * @return string |
|
122 | + * @since 7.0.0 |
|
123 | + * @deprecated 9.0.0 |
|
124 | + */ |
|
125 | + public function generate($name, $parameters = [], $absolute = false); |
|
126 | 126 | } |
@@ -28,39 +28,39 @@ |
||
28 | 28 | * @since 8.2.0 |
29 | 29 | */ |
30 | 30 | interface ICompositeExpression { |
31 | - /** |
|
32 | - * Adds multiple parts to composite expression. |
|
33 | - * |
|
34 | - * @param array $parts |
|
35 | - * |
|
36 | - * @return ICompositeExpression |
|
37 | - * @since 8.2.0 |
|
38 | - */ |
|
39 | - public function addMultiple(array $parts = []); |
|
31 | + /** |
|
32 | + * Adds multiple parts to composite expression. |
|
33 | + * |
|
34 | + * @param array $parts |
|
35 | + * |
|
36 | + * @return ICompositeExpression |
|
37 | + * @since 8.2.0 |
|
38 | + */ |
|
39 | + public function addMultiple(array $parts = []); |
|
40 | 40 | |
41 | - /** |
|
42 | - * Adds an expression to composite expression. |
|
43 | - * |
|
44 | - * @param mixed $part |
|
45 | - * |
|
46 | - * @return ICompositeExpression |
|
47 | - * @since 8.2.0 |
|
48 | - */ |
|
49 | - public function add($part); |
|
41 | + /** |
|
42 | + * Adds an expression to composite expression. |
|
43 | + * |
|
44 | + * @param mixed $part |
|
45 | + * |
|
46 | + * @return ICompositeExpression |
|
47 | + * @since 8.2.0 |
|
48 | + */ |
|
49 | + public function add($part); |
|
50 | 50 | |
51 | - /** |
|
52 | - * Retrieves the amount of expressions on composite expression. |
|
53 | - * |
|
54 | - * @return integer |
|
55 | - * @since 8.2.0 |
|
56 | - */ |
|
57 | - public function count(); |
|
51 | + /** |
|
52 | + * Retrieves the amount of expressions on composite expression. |
|
53 | + * |
|
54 | + * @return integer |
|
55 | + * @since 8.2.0 |
|
56 | + */ |
|
57 | + public function count(); |
|
58 | 58 | |
59 | - /** |
|
60 | - * Returns the type of this composite expression (AND/OR). |
|
61 | - * |
|
62 | - * @return string |
|
63 | - * @since 8.2.0 |
|
64 | - */ |
|
65 | - public function getType(); |
|
59 | + /** |
|
60 | + * Returns the type of this composite expression (AND/OR). |
|
61 | + * |
|
62 | + * @return string |
|
63 | + * @since 8.2.0 |
|
64 | + */ |
|
65 | + public function getType(); |
|
66 | 66 | } |
@@ -42,67 +42,67 @@ |
||
42 | 42 | abstract class Middleware { |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * This is being run in normal order before the controller is being |
|
47 | - * called which allows several modifications and checks |
|
48 | - * |
|
49 | - * @param Controller $controller the controller that is being called |
|
50 | - * @param string $methodName the name of the method that will be called on |
|
51 | - * the controller |
|
52 | - * @since 6.0.0 |
|
53 | - */ |
|
54 | - public function beforeController($controller, $methodName) { |
|
55 | - } |
|
45 | + /** |
|
46 | + * This is being run in normal order before the controller is being |
|
47 | + * called which allows several modifications and checks |
|
48 | + * |
|
49 | + * @param Controller $controller the controller that is being called |
|
50 | + * @param string $methodName the name of the method that will be called on |
|
51 | + * the controller |
|
52 | + * @since 6.0.0 |
|
53 | + */ |
|
54 | + public function beforeController($controller, $methodName) { |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * This is being run when either the beforeController method or the |
|
60 | - * controller method itself is throwing an exception. The middleware is |
|
61 | - * asked in reverse order to handle the exception and to return a response. |
|
62 | - * If the response is null, it is assumed that the exception could not be |
|
63 | - * handled and the error will be thrown again |
|
64 | - * |
|
65 | - * @param Controller $controller the controller that is being called |
|
66 | - * @param string $methodName the name of the method that will be called on |
|
67 | - * the controller |
|
68 | - * @param \Exception $exception the thrown exception |
|
69 | - * @throws \Exception the passed in exception if it can't handle it |
|
70 | - * @return Response a Response object in case that the exception was handled |
|
71 | - * @since 6.0.0 |
|
72 | - */ |
|
73 | - public function afterException($controller, $methodName, \Exception $exception) { |
|
74 | - throw $exception; |
|
75 | - } |
|
58 | + /** |
|
59 | + * This is being run when either the beforeController method or the |
|
60 | + * controller method itself is throwing an exception. The middleware is |
|
61 | + * asked in reverse order to handle the exception and to return a response. |
|
62 | + * If the response is null, it is assumed that the exception could not be |
|
63 | + * handled and the error will be thrown again |
|
64 | + * |
|
65 | + * @param Controller $controller the controller that is being called |
|
66 | + * @param string $methodName the name of the method that will be called on |
|
67 | + * the controller |
|
68 | + * @param \Exception $exception the thrown exception |
|
69 | + * @throws \Exception the passed in exception if it can't handle it |
|
70 | + * @return Response a Response object in case that the exception was handled |
|
71 | + * @since 6.0.0 |
|
72 | + */ |
|
73 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
74 | + throw $exception; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * This is being run after a successful controllermethod call and allows |
|
80 | - * the manipulation of a Response object. The middleware is run in reverse order |
|
81 | - * |
|
82 | - * @param Controller $controller the controller that is being called |
|
83 | - * @param string $methodName the name of the method that will be called on |
|
84 | - * the controller |
|
85 | - * @param Response $response the generated response from the controller |
|
86 | - * @return Response a Response object |
|
87 | - * @since 6.0.0 |
|
88 | - */ |
|
89 | - public function afterController($controller, $methodName, Response $response) { |
|
90 | - return $response; |
|
91 | - } |
|
78 | + /** |
|
79 | + * This is being run after a successful controllermethod call and allows |
|
80 | + * the manipulation of a Response object. The middleware is run in reverse order |
|
81 | + * |
|
82 | + * @param Controller $controller the controller that is being called |
|
83 | + * @param string $methodName the name of the method that will be called on |
|
84 | + * the controller |
|
85 | + * @param Response $response the generated response from the controller |
|
86 | + * @return Response a Response object |
|
87 | + * @since 6.0.0 |
|
88 | + */ |
|
89 | + public function afterController($controller, $methodName, Response $response) { |
|
90 | + return $response; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * This is being run after the response object has been rendered and |
|
96 | - * allows the manipulation of the output. The middleware is run in reverse order |
|
97 | - * |
|
98 | - * @param Controller $controller the controller that is being called |
|
99 | - * @param string $methodName the name of the method that will be called on |
|
100 | - * the controller |
|
101 | - * @param string $output the generated output from a response |
|
102 | - * @return string the output that should be printed |
|
103 | - * @since 6.0.0 |
|
104 | - */ |
|
105 | - public function beforeOutput($controller, $methodName, $output) { |
|
106 | - return $output; |
|
107 | - } |
|
94 | + /** |
|
95 | + * This is being run after the response object has been rendered and |
|
96 | + * allows the manipulation of the output. The middleware is run in reverse order |
|
97 | + * |
|
98 | + * @param Controller $controller the controller that is being called |
|
99 | + * @param string $methodName the name of the method that will be called on |
|
100 | + * the controller |
|
101 | + * @param string $output the generated output from a response |
|
102 | + * @return string the output that should be printed |
|
103 | + * @since 6.0.0 |
|
104 | + */ |
|
105 | + public function beforeOutput($controller, $methodName, $output) { |
|
106 | + return $output; |
|
107 | + } |
|
108 | 108 | } |