@@ -32,113 +32,113 @@ |
||
32 | 32 | */ |
33 | 33 | class Watcher implements IWatcher { |
34 | 34 | |
35 | - protected $watchPolicy = self::CHECK_ONCE; |
|
35 | + protected $watchPolicy = self::CHECK_ONCE; |
|
36 | 36 | |
37 | - protected $checkedPaths = array(); |
|
37 | + protected $checkedPaths = array(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var \OC\Files\Storage\Storage $storage |
|
41 | - */ |
|
42 | - protected $storage; |
|
39 | + /** |
|
40 | + * @var \OC\Files\Storage\Storage $storage |
|
41 | + */ |
|
42 | + protected $storage; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var Cache $cache |
|
46 | - */ |
|
47 | - protected $cache; |
|
44 | + /** |
|
45 | + * @var Cache $cache |
|
46 | + */ |
|
47 | + protected $cache; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @var Scanner $scanner ; |
|
51 | - */ |
|
52 | - protected $scanner; |
|
49 | + /** |
|
50 | + * @var Scanner $scanner ; |
|
51 | + */ |
|
52 | + protected $scanner; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param \OC\Files\Storage\Storage $storage |
|
56 | - */ |
|
57 | - public function __construct(\OC\Files\Storage\Storage $storage) { |
|
58 | - $this->storage = $storage; |
|
59 | - $this->cache = $storage->getCache(); |
|
60 | - $this->scanner = $storage->getScanner(); |
|
61 | - } |
|
54 | + /** |
|
55 | + * @param \OC\Files\Storage\Storage $storage |
|
56 | + */ |
|
57 | + public function __construct(\OC\Files\Storage\Storage $storage) { |
|
58 | + $this->storage = $storage; |
|
59 | + $this->cache = $storage->getCache(); |
|
60 | + $this->scanner = $storage->getScanner(); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS |
|
65 | - */ |
|
66 | - public function setPolicy($policy) { |
|
67 | - $this->watchPolicy = $policy; |
|
68 | - } |
|
63 | + /** |
|
64 | + * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS |
|
65 | + */ |
|
66 | + public function setPolicy($policy) { |
|
67 | + $this->watchPolicy = $policy; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS |
|
72 | - */ |
|
73 | - public function getPolicy() { |
|
74 | - return $this->watchPolicy; |
|
75 | - } |
|
70 | + /** |
|
71 | + * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS |
|
72 | + */ |
|
73 | + public function getPolicy() { |
|
74 | + return $this->watchPolicy; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * check $path for updates and update if needed |
|
79 | - * |
|
80 | - * @param string $path |
|
81 | - * @param ICacheEntry|null $cachedEntry |
|
82 | - * @return boolean true if path was updated |
|
83 | - */ |
|
84 | - public function checkUpdate($path, $cachedEntry = null) { |
|
85 | - if (is_null($cachedEntry)) { |
|
86 | - $cachedEntry = $this->cache->get($path); |
|
87 | - } |
|
88 | - if ($this->needsUpdate($path, $cachedEntry)) { |
|
89 | - $this->update($path, $cachedEntry); |
|
90 | - return true; |
|
91 | - } else { |
|
92 | - return false; |
|
93 | - } |
|
94 | - } |
|
77 | + /** |
|
78 | + * check $path for updates and update if needed |
|
79 | + * |
|
80 | + * @param string $path |
|
81 | + * @param ICacheEntry|null $cachedEntry |
|
82 | + * @return boolean true if path was updated |
|
83 | + */ |
|
84 | + public function checkUpdate($path, $cachedEntry = null) { |
|
85 | + if (is_null($cachedEntry)) { |
|
86 | + $cachedEntry = $this->cache->get($path); |
|
87 | + } |
|
88 | + if ($this->needsUpdate($path, $cachedEntry)) { |
|
89 | + $this->update($path, $cachedEntry); |
|
90 | + return true; |
|
91 | + } else { |
|
92 | + return false; |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Update the cache for changes to $path |
|
98 | - * |
|
99 | - * @param string $path |
|
100 | - * @param ICacheEntry $cachedData |
|
101 | - */ |
|
102 | - public function update($path, $cachedData) { |
|
103 | - if ($this->storage->is_dir($path)) { |
|
104 | - $this->scanner->scan($path, Scanner::SCAN_SHALLOW); |
|
105 | - } else { |
|
106 | - $this->scanner->scanFile($path); |
|
107 | - } |
|
108 | - if ($cachedData['mimetype'] === 'httpd/unix-directory') { |
|
109 | - $this->cleanFolder($path); |
|
110 | - } |
|
111 | - if ($this->cache instanceof Cache) { |
|
112 | - $this->cache->correctFolderSize($path); |
|
113 | - } |
|
114 | - } |
|
96 | + /** |
|
97 | + * Update the cache for changes to $path |
|
98 | + * |
|
99 | + * @param string $path |
|
100 | + * @param ICacheEntry $cachedData |
|
101 | + */ |
|
102 | + public function update($path, $cachedData) { |
|
103 | + if ($this->storage->is_dir($path)) { |
|
104 | + $this->scanner->scan($path, Scanner::SCAN_SHALLOW); |
|
105 | + } else { |
|
106 | + $this->scanner->scanFile($path); |
|
107 | + } |
|
108 | + if ($cachedData['mimetype'] === 'httpd/unix-directory') { |
|
109 | + $this->cleanFolder($path); |
|
110 | + } |
|
111 | + if ($this->cache instanceof Cache) { |
|
112 | + $this->cache->correctFolderSize($path); |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Check if the cache for $path needs to be updated |
|
118 | - * |
|
119 | - * @param string $path |
|
120 | - * @param ICacheEntry $cachedData |
|
121 | - * @return bool |
|
122 | - */ |
|
123 | - public function needsUpdate($path, $cachedData) { |
|
124 | - if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and array_search($path, $this->checkedPaths) === false)) { |
|
125 | - $this->checkedPaths[] = $path; |
|
126 | - return $this->storage->hasUpdated($path, $cachedData['storage_mtime']); |
|
127 | - } |
|
128 | - return false; |
|
129 | - } |
|
116 | + /** |
|
117 | + * Check if the cache for $path needs to be updated |
|
118 | + * |
|
119 | + * @param string $path |
|
120 | + * @param ICacheEntry $cachedData |
|
121 | + * @return bool |
|
122 | + */ |
|
123 | + public function needsUpdate($path, $cachedData) { |
|
124 | + if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and array_search($path, $this->checkedPaths) === false)) { |
|
125 | + $this->checkedPaths[] = $path; |
|
126 | + return $this->storage->hasUpdated($path, $cachedData['storage_mtime']); |
|
127 | + } |
|
128 | + return false; |
|
129 | + } |
|
130 | 130 | |
131 | - /** |
|
132 | - * remove deleted files in $path from the cache |
|
133 | - * |
|
134 | - * @param string $path |
|
135 | - */ |
|
136 | - public function cleanFolder($path) { |
|
137 | - $cachedContent = $this->cache->getFolderContents($path); |
|
138 | - foreach ($cachedContent as $entry) { |
|
139 | - if (!$this->storage->file_exists($entry['path'])) { |
|
140 | - $this->cache->remove($entry['path']); |
|
141 | - } |
|
142 | - } |
|
143 | - } |
|
131 | + /** |
|
132 | + * remove deleted files in $path from the cache |
|
133 | + * |
|
134 | + * @param string $path |
|
135 | + */ |
|
136 | + public function cleanFolder($path) { |
|
137 | + $cachedContent = $this->cache->getFolderContents($path); |
|
138 | + foreach ($cachedContent as $entry) { |
|
139 | + if (!$this->storage->file_exists($entry['path'])) { |
|
140 | + $this->cache->remove($entry['path']); |
|
141 | + } |
|
142 | + } |
|
143 | + } |
|
144 | 144 | } |
@@ -29,13 +29,13 @@ |
||
29 | 29 | */ |
30 | 30 | class Image extends File { |
31 | 31 | |
32 | - /** |
|
33 | - * Type name; translated in templates |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $type = 'image'; |
|
32 | + /** |
|
33 | + * Type name; translated in templates |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $type = 'image'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @TODO add EXIF information |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @TODO add EXIF information |
|
40 | + */ |
|
41 | 41 | } |
@@ -29,13 +29,13 @@ |
||
29 | 29 | */ |
30 | 30 | class Audio extends File { |
31 | 31 | |
32 | - /** |
|
33 | - * Type name; translated in templates |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $type = 'audio'; |
|
32 | + /** |
|
33 | + * Type name; translated in templates |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $type = 'audio'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @TODO add ID3 information |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @TODO add ID3 information |
|
40 | + */ |
|
41 | 41 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | */ |
30 | 30 | class Folder extends File { |
31 | 31 | |
32 | - /** |
|
33 | - * Type name; translated in templates |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $type = 'folder'; |
|
32 | + /** |
|
33 | + * Type name; translated in templates |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $type = 'folder'; |
|
37 | 37 | |
38 | 38 | } |
@@ -42,137 +42,137 @@ |
||
42 | 42 | class SimpleContainer extends Container implements IContainer { |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param ReflectionClass $class the class to instantiate |
|
47 | - * @return \stdClass the created class |
|
48 | - */ |
|
49 | - private function buildClass(ReflectionClass $class) { |
|
50 | - $constructor = $class->getConstructor(); |
|
51 | - if ($constructor === null) { |
|
52 | - return $class->newInstance(); |
|
53 | - } else { |
|
54 | - $parameters = []; |
|
55 | - foreach ($constructor->getParameters() as $parameter) { |
|
56 | - $parameterClass = $parameter->getClass(); |
|
57 | - |
|
58 | - // try to find out if it is a class or a simple parameter |
|
59 | - if ($parameterClass === null) { |
|
60 | - $resolveName = $parameter->getName(); |
|
61 | - } else { |
|
62 | - $resolveName = $parameterClass->name; |
|
63 | - } |
|
64 | - |
|
65 | - try { |
|
66 | - $parameters[] = $this->query($resolveName); |
|
67 | - } catch (\Exception $e) { |
|
68 | - // Service not found, use the default value when available |
|
69 | - if ($parameter->isDefaultValueAvailable()) { |
|
70 | - $parameters[] = $parameter->getDefaultValue(); |
|
71 | - } else if ($parameterClass !== null) { |
|
72 | - $resolveName = $parameter->getName(); |
|
73 | - $parameters[] = $this->query($resolveName); |
|
74 | - } else { |
|
75 | - throw $e; |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - return $class->newInstanceArgs($parameters); |
|
80 | - } |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * If a parameter is not registered in the container try to instantiate it |
|
86 | - * by using reflection to find out how to build the class |
|
87 | - * @param string $name the class name to resolve |
|
88 | - * @return \stdClass |
|
89 | - * @throws QueryException if the class could not be found or instantiated |
|
90 | - */ |
|
91 | - public function resolve($name) { |
|
92 | - $baseMsg = 'Could not resolve ' . $name . '!'; |
|
93 | - try { |
|
94 | - $class = new ReflectionClass($name); |
|
95 | - if ($class->isInstantiable()) { |
|
96 | - return $this->buildClass($class); |
|
97 | - } else { |
|
98 | - throw new QueryException($baseMsg . |
|
99 | - ' Class can not be instantiated'); |
|
100 | - } |
|
101 | - } catch(ReflectionException $e) { |
|
102 | - throw new QueryException($baseMsg . ' ' . $e->getMessage()); |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - /** |
|
108 | - * @param string $name name of the service to query for |
|
109 | - * @return mixed registered service for the given $name |
|
110 | - * @throws QueryException if the query could not be resolved |
|
111 | - */ |
|
112 | - public function query($name) { |
|
113 | - $name = $this->sanitizeName($name); |
|
114 | - if ($this->offsetExists($name)) { |
|
115 | - return $this->offsetGet($name); |
|
116 | - } else { |
|
117 | - $object = $this->resolve($name); |
|
118 | - $this->registerService($name, function () use ($object) { |
|
119 | - return $object; |
|
120 | - }); |
|
121 | - return $object; |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param string $name |
|
127 | - * @param mixed $value |
|
128 | - */ |
|
129 | - public function registerParameter($name, $value) { |
|
130 | - $this[$name] = $value; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * The given closure is call the first time the given service is queried. |
|
135 | - * The closure has to return the instance for the given service. |
|
136 | - * Created instance will be cached in case $shared is true. |
|
137 | - * |
|
138 | - * @param string $name name of the service to register another backend for |
|
139 | - * @param Closure $closure the closure to be called on service creation |
|
140 | - * @param bool $shared |
|
141 | - */ |
|
142 | - public function registerService($name, Closure $closure, $shared = true) { |
|
143 | - $name = $this->sanitizeName($name); |
|
144 | - if (isset($this[$name])) { |
|
145 | - unset($this[$name]); |
|
146 | - } |
|
147 | - if ($shared) { |
|
148 | - $this[$name] = $closure; |
|
149 | - } else { |
|
150 | - $this[$name] = parent::factory($closure); |
|
151 | - } |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Shortcut for returning a service from a service under a different key, |
|
156 | - * e.g. to tell the container to return a class when queried for an |
|
157 | - * interface |
|
158 | - * @param string $alias the alias that should be registered |
|
159 | - * @param string $target the target that should be resolved instead |
|
160 | - */ |
|
161 | - public function registerAlias($alias, $target) { |
|
162 | - $this->registerService($alias, function (IContainer $container) use ($target) { |
|
163 | - return $container->query($target); |
|
164 | - }, false); |
|
165 | - } |
|
166 | - |
|
167 | - /* |
|
45 | + /** |
|
46 | + * @param ReflectionClass $class the class to instantiate |
|
47 | + * @return \stdClass the created class |
|
48 | + */ |
|
49 | + private function buildClass(ReflectionClass $class) { |
|
50 | + $constructor = $class->getConstructor(); |
|
51 | + if ($constructor === null) { |
|
52 | + return $class->newInstance(); |
|
53 | + } else { |
|
54 | + $parameters = []; |
|
55 | + foreach ($constructor->getParameters() as $parameter) { |
|
56 | + $parameterClass = $parameter->getClass(); |
|
57 | + |
|
58 | + // try to find out if it is a class or a simple parameter |
|
59 | + if ($parameterClass === null) { |
|
60 | + $resolveName = $parameter->getName(); |
|
61 | + } else { |
|
62 | + $resolveName = $parameterClass->name; |
|
63 | + } |
|
64 | + |
|
65 | + try { |
|
66 | + $parameters[] = $this->query($resolveName); |
|
67 | + } catch (\Exception $e) { |
|
68 | + // Service not found, use the default value when available |
|
69 | + if ($parameter->isDefaultValueAvailable()) { |
|
70 | + $parameters[] = $parameter->getDefaultValue(); |
|
71 | + } else if ($parameterClass !== null) { |
|
72 | + $resolveName = $parameter->getName(); |
|
73 | + $parameters[] = $this->query($resolveName); |
|
74 | + } else { |
|
75 | + throw $e; |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + return $class->newInstanceArgs($parameters); |
|
80 | + } |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * If a parameter is not registered in the container try to instantiate it |
|
86 | + * by using reflection to find out how to build the class |
|
87 | + * @param string $name the class name to resolve |
|
88 | + * @return \stdClass |
|
89 | + * @throws QueryException if the class could not be found or instantiated |
|
90 | + */ |
|
91 | + public function resolve($name) { |
|
92 | + $baseMsg = 'Could not resolve ' . $name . '!'; |
|
93 | + try { |
|
94 | + $class = new ReflectionClass($name); |
|
95 | + if ($class->isInstantiable()) { |
|
96 | + return $this->buildClass($class); |
|
97 | + } else { |
|
98 | + throw new QueryException($baseMsg . |
|
99 | + ' Class can not be instantiated'); |
|
100 | + } |
|
101 | + } catch(ReflectionException $e) { |
|
102 | + throw new QueryException($baseMsg . ' ' . $e->getMessage()); |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + /** |
|
108 | + * @param string $name name of the service to query for |
|
109 | + * @return mixed registered service for the given $name |
|
110 | + * @throws QueryException if the query could not be resolved |
|
111 | + */ |
|
112 | + public function query($name) { |
|
113 | + $name = $this->sanitizeName($name); |
|
114 | + if ($this->offsetExists($name)) { |
|
115 | + return $this->offsetGet($name); |
|
116 | + } else { |
|
117 | + $object = $this->resolve($name); |
|
118 | + $this->registerService($name, function () use ($object) { |
|
119 | + return $object; |
|
120 | + }); |
|
121 | + return $object; |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param string $name |
|
127 | + * @param mixed $value |
|
128 | + */ |
|
129 | + public function registerParameter($name, $value) { |
|
130 | + $this[$name] = $value; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * The given closure is call the first time the given service is queried. |
|
135 | + * The closure has to return the instance for the given service. |
|
136 | + * Created instance will be cached in case $shared is true. |
|
137 | + * |
|
138 | + * @param string $name name of the service to register another backend for |
|
139 | + * @param Closure $closure the closure to be called on service creation |
|
140 | + * @param bool $shared |
|
141 | + */ |
|
142 | + public function registerService($name, Closure $closure, $shared = true) { |
|
143 | + $name = $this->sanitizeName($name); |
|
144 | + if (isset($this[$name])) { |
|
145 | + unset($this[$name]); |
|
146 | + } |
|
147 | + if ($shared) { |
|
148 | + $this[$name] = $closure; |
|
149 | + } else { |
|
150 | + $this[$name] = parent::factory($closure); |
|
151 | + } |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Shortcut for returning a service from a service under a different key, |
|
156 | + * e.g. to tell the container to return a class when queried for an |
|
157 | + * interface |
|
158 | + * @param string $alias the alias that should be registered |
|
159 | + * @param string $target the target that should be resolved instead |
|
160 | + */ |
|
161 | + public function registerAlias($alias, $target) { |
|
162 | + $this->registerService($alias, function (IContainer $container) use ($target) { |
|
163 | + return $container->query($target); |
|
164 | + }, false); |
|
165 | + } |
|
166 | + |
|
167 | + /* |
|
168 | 168 | * @param string $name |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - protected function sanitizeName($name) { |
|
172 | - if (isset($name[0]) && $name[0] === '\\') { |
|
173 | - return ltrim($name, '\\'); |
|
174 | - } |
|
175 | - return $name; |
|
176 | - } |
|
171 | + protected function sanitizeName($name) { |
|
172 | + if (isset($name[0]) && $name[0] === '\\') { |
|
173 | + return ltrim($name, '\\'); |
|
174 | + } |
|
175 | + return $name; |
|
176 | + } |
|
177 | 177 | |
178 | 178 | } |
@@ -30,70 +30,70 @@ |
||
30 | 30 | * Very thin wrapper class to make output testable |
31 | 31 | */ |
32 | 32 | class Output implements IOutput { |
33 | - /** @var string */ |
|
34 | - private $webRoot; |
|
33 | + /** @var string */ |
|
34 | + private $webRoot; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param $webRoot |
|
38 | - */ |
|
39 | - public function __construct($webRoot) { |
|
40 | - $this->webRoot = $webRoot; |
|
41 | - } |
|
36 | + /** |
|
37 | + * @param $webRoot |
|
38 | + */ |
|
39 | + public function __construct($webRoot) { |
|
40 | + $this->webRoot = $webRoot; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $out |
|
45 | - */ |
|
46 | - public function setOutput($out) { |
|
47 | - print($out); |
|
48 | - } |
|
43 | + /** |
|
44 | + * @param string $out |
|
45 | + */ |
|
46 | + public function setOutput($out) { |
|
47 | + print($out); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string|resource $path or file handle |
|
52 | - * |
|
53 | - * @return bool false if an error occurred |
|
54 | - */ |
|
55 | - public function setReadfile($path) { |
|
56 | - if (is_resource($path)) { |
|
57 | - $output = fopen('php://output', 'w'); |
|
58 | - return stream_copy_to_stream($path, $output) > 0; |
|
59 | - } else { |
|
60 | - return @readfile($path); |
|
61 | - } |
|
62 | - } |
|
50 | + /** |
|
51 | + * @param string|resource $path or file handle |
|
52 | + * |
|
53 | + * @return bool false if an error occurred |
|
54 | + */ |
|
55 | + public function setReadfile($path) { |
|
56 | + if (is_resource($path)) { |
|
57 | + $output = fopen('php://output', 'w'); |
|
58 | + return stream_copy_to_stream($path, $output) > 0; |
|
59 | + } else { |
|
60 | + return @readfile($path); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param string $header |
|
66 | - */ |
|
67 | - public function setHeader($header) { |
|
68 | - header($header); |
|
69 | - } |
|
64 | + /** |
|
65 | + * @param string $header |
|
66 | + */ |
|
67 | + public function setHeader($header) { |
|
68 | + header($header); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @param int $code sets the http status code |
|
73 | - */ |
|
74 | - public function setHttpResponseCode($code) { |
|
75 | - http_response_code($code); |
|
76 | - } |
|
71 | + /** |
|
72 | + * @param int $code sets the http status code |
|
73 | + */ |
|
74 | + public function setHttpResponseCode($code) { |
|
75 | + http_response_code($code); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @return int returns the current http response code |
|
80 | - */ |
|
81 | - public function getHttpResponseCode() { |
|
82 | - return http_response_code(); |
|
83 | - } |
|
78 | + /** |
|
79 | + * @return int returns the current http response code |
|
80 | + */ |
|
81 | + public function getHttpResponseCode() { |
|
82 | + return http_response_code(); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param string $name |
|
87 | - * @param string $value |
|
88 | - * @param int $expire |
|
89 | - * @param string $path |
|
90 | - * @param string $domain |
|
91 | - * @param bool $secure |
|
92 | - * @param bool $httpOnly |
|
93 | - */ |
|
94 | - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) { |
|
95 | - $path = $this->webRoot ? : '/'; |
|
96 | - setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); |
|
97 | - } |
|
85 | + /** |
|
86 | + * @param string $name |
|
87 | + * @param string $value |
|
88 | + * @param int $expire |
|
89 | + * @param string $path |
|
90 | + * @param string $domain |
|
91 | + * @param bool $secure |
|
92 | + * @param bool $httpOnly |
|
93 | + */ |
|
94 | + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) { |
|
95 | + $path = $this->webRoot ? : '/'; |
|
96 | + setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | } |
@@ -43,142 +43,142 @@ |
||
43 | 43 | */ |
44 | 44 | class Dispatcher { |
45 | 45 | |
46 | - private $middlewareDispatcher; |
|
47 | - private $protocol; |
|
48 | - private $reflector; |
|
49 | - private $request; |
|
50 | - |
|
51 | - /** |
|
52 | - * @param Http $protocol the http protocol with contains all status headers |
|
53 | - * @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which |
|
54 | - * runs the middleware |
|
55 | - * @param ControllerMethodReflector $reflector the reflector that is used to inject |
|
56 | - * the arguments for the controller |
|
57 | - * @param IRequest $request the incoming request |
|
58 | - */ |
|
59 | - public function __construct(Http $protocol, |
|
60 | - MiddlewareDispatcher $middlewareDispatcher, |
|
61 | - ControllerMethodReflector $reflector, |
|
62 | - IRequest $request) { |
|
63 | - $this->protocol = $protocol; |
|
64 | - $this->middlewareDispatcher = $middlewareDispatcher; |
|
65 | - $this->reflector = $reflector; |
|
66 | - $this->request = $request; |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Handles a request and calls the dispatcher on the controller |
|
72 | - * @param Controller $controller the controller which will be called |
|
73 | - * @param string $methodName the method name which will be called on |
|
74 | - * the controller |
|
75 | - * @return array $array[0] contains a string with the http main header, |
|
76 | - * $array[1] contains headers in the form: $key => value, $array[2] contains |
|
77 | - * the response output |
|
78 | - * @throws \Exception |
|
79 | - */ |
|
80 | - public function dispatch(Controller $controller, $methodName) { |
|
81 | - $out = array(null, array(), null); |
|
82 | - |
|
83 | - try { |
|
84 | - // prefill reflector with everything thats needed for the |
|
85 | - // middlewares |
|
86 | - $this->reflector->reflect($controller, $methodName); |
|
87 | - |
|
88 | - $this->middlewareDispatcher->beforeController($controller, |
|
89 | - $methodName); |
|
90 | - $response = $this->executeController($controller, $methodName); |
|
91 | - |
|
92 | - // if an exception appears, the middleware checks if it can handle the |
|
93 | - // exception and creates a response. If no response is created, it is |
|
94 | - // assumed that theres no middleware who can handle it and the error is |
|
95 | - // thrown again |
|
96 | - } catch(\Exception $exception){ |
|
97 | - $response = $this->middlewareDispatcher->afterException( |
|
98 | - $controller, $methodName, $exception); |
|
99 | - if (is_null($response)) { |
|
100 | - throw $exception; |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - $response = $this->middlewareDispatcher->afterController( |
|
105 | - $controller, $methodName, $response); |
|
106 | - |
|
107 | - // depending on the cache object the headers need to be changed |
|
108 | - $out[0] = $this->protocol->getStatusHeader($response->getStatus(), |
|
109 | - $response->getLastModified(), $response->getETag()); |
|
110 | - $out[1] = array_merge($response->getHeaders()); |
|
111 | - $out[2] = $response->getCookies(); |
|
112 | - $out[3] = $this->middlewareDispatcher->beforeOutput( |
|
113 | - $controller, $methodName, $response->render() |
|
114 | - ); |
|
115 | - $out[4] = $response; |
|
116 | - |
|
117 | - return $out; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * Uses the reflected parameters, types and request parameters to execute |
|
123 | - * the controller |
|
124 | - * @param Controller $controller the controller to be executed |
|
125 | - * @param string $methodName the method on the controller that should be executed |
|
126 | - * @return Response |
|
127 | - */ |
|
128 | - private function executeController($controller, $methodName) { |
|
129 | - $arguments = array(); |
|
130 | - |
|
131 | - // valid types that will be casted |
|
132 | - $types = array('int', 'integer', 'bool', 'boolean', 'float'); |
|
133 | - |
|
134 | - foreach($this->reflector->getParameters() as $param => $default) { |
|
135 | - |
|
136 | - // try to get the parameter from the request object and cast |
|
137 | - // it to the type annotated in the @param annotation |
|
138 | - $value = $this->request->getParam($param, $default); |
|
139 | - $type = $this->reflector->getType($param); |
|
140 | - |
|
141 | - // if this is submitted using GET or a POST form, 'false' should be |
|
142 | - // converted to false |
|
143 | - if(($type === 'bool' || $type === 'boolean') && |
|
144 | - $value === 'false' && |
|
145 | - ( |
|
146 | - $this->request->method === 'GET' || |
|
147 | - strpos($this->request->getHeader('Content-Type'), |
|
148 | - 'application/x-www-form-urlencoded') !== false |
|
149 | - ) |
|
150 | - ) { |
|
151 | - $value = false; |
|
152 | - |
|
153 | - } elseif($value !== null && in_array($type, $types)) { |
|
154 | - settype($value, $type); |
|
155 | - } |
|
156 | - |
|
157 | - $arguments[] = $value; |
|
158 | - } |
|
159 | - |
|
160 | - $response = call_user_func_array(array($controller, $methodName), $arguments); |
|
161 | - |
|
162 | - // format response |
|
163 | - if($response instanceof DataResponse || !($response instanceof Response)) { |
|
164 | - |
|
165 | - // get format from the url format or request format parameter |
|
166 | - $format = $this->request->getParam('format'); |
|
167 | - |
|
168 | - // if none is given try the first Accept header |
|
169 | - if($format === null) { |
|
170 | - $headers = $this->request->getHeader('Accept'); |
|
171 | - $format = $controller->getResponderByHTTPHeader($headers, null); |
|
172 | - } |
|
173 | - |
|
174 | - if ($format !== null) { |
|
175 | - $response = $controller->buildResponse($response, $format); |
|
176 | - } else { |
|
177 | - $response = $controller->buildResponse($response); |
|
178 | - } |
|
179 | - } |
|
180 | - |
|
181 | - return $response; |
|
182 | - } |
|
46 | + private $middlewareDispatcher; |
|
47 | + private $protocol; |
|
48 | + private $reflector; |
|
49 | + private $request; |
|
50 | + |
|
51 | + /** |
|
52 | + * @param Http $protocol the http protocol with contains all status headers |
|
53 | + * @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which |
|
54 | + * runs the middleware |
|
55 | + * @param ControllerMethodReflector $reflector the reflector that is used to inject |
|
56 | + * the arguments for the controller |
|
57 | + * @param IRequest $request the incoming request |
|
58 | + */ |
|
59 | + public function __construct(Http $protocol, |
|
60 | + MiddlewareDispatcher $middlewareDispatcher, |
|
61 | + ControllerMethodReflector $reflector, |
|
62 | + IRequest $request) { |
|
63 | + $this->protocol = $protocol; |
|
64 | + $this->middlewareDispatcher = $middlewareDispatcher; |
|
65 | + $this->reflector = $reflector; |
|
66 | + $this->request = $request; |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Handles a request and calls the dispatcher on the controller |
|
72 | + * @param Controller $controller the controller which will be called |
|
73 | + * @param string $methodName the method name which will be called on |
|
74 | + * the controller |
|
75 | + * @return array $array[0] contains a string with the http main header, |
|
76 | + * $array[1] contains headers in the form: $key => value, $array[2] contains |
|
77 | + * the response output |
|
78 | + * @throws \Exception |
|
79 | + */ |
|
80 | + public function dispatch(Controller $controller, $methodName) { |
|
81 | + $out = array(null, array(), null); |
|
82 | + |
|
83 | + try { |
|
84 | + // prefill reflector with everything thats needed for the |
|
85 | + // middlewares |
|
86 | + $this->reflector->reflect($controller, $methodName); |
|
87 | + |
|
88 | + $this->middlewareDispatcher->beforeController($controller, |
|
89 | + $methodName); |
|
90 | + $response = $this->executeController($controller, $methodName); |
|
91 | + |
|
92 | + // if an exception appears, the middleware checks if it can handle the |
|
93 | + // exception and creates a response. If no response is created, it is |
|
94 | + // assumed that theres no middleware who can handle it and the error is |
|
95 | + // thrown again |
|
96 | + } catch(\Exception $exception){ |
|
97 | + $response = $this->middlewareDispatcher->afterException( |
|
98 | + $controller, $methodName, $exception); |
|
99 | + if (is_null($response)) { |
|
100 | + throw $exception; |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + $response = $this->middlewareDispatcher->afterController( |
|
105 | + $controller, $methodName, $response); |
|
106 | + |
|
107 | + // depending on the cache object the headers need to be changed |
|
108 | + $out[0] = $this->protocol->getStatusHeader($response->getStatus(), |
|
109 | + $response->getLastModified(), $response->getETag()); |
|
110 | + $out[1] = array_merge($response->getHeaders()); |
|
111 | + $out[2] = $response->getCookies(); |
|
112 | + $out[3] = $this->middlewareDispatcher->beforeOutput( |
|
113 | + $controller, $methodName, $response->render() |
|
114 | + ); |
|
115 | + $out[4] = $response; |
|
116 | + |
|
117 | + return $out; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * Uses the reflected parameters, types and request parameters to execute |
|
123 | + * the controller |
|
124 | + * @param Controller $controller the controller to be executed |
|
125 | + * @param string $methodName the method on the controller that should be executed |
|
126 | + * @return Response |
|
127 | + */ |
|
128 | + private function executeController($controller, $methodName) { |
|
129 | + $arguments = array(); |
|
130 | + |
|
131 | + // valid types that will be casted |
|
132 | + $types = array('int', 'integer', 'bool', 'boolean', 'float'); |
|
133 | + |
|
134 | + foreach($this->reflector->getParameters() as $param => $default) { |
|
135 | + |
|
136 | + // try to get the parameter from the request object and cast |
|
137 | + // it to the type annotated in the @param annotation |
|
138 | + $value = $this->request->getParam($param, $default); |
|
139 | + $type = $this->reflector->getType($param); |
|
140 | + |
|
141 | + // if this is submitted using GET or a POST form, 'false' should be |
|
142 | + // converted to false |
|
143 | + if(($type === 'bool' || $type === 'boolean') && |
|
144 | + $value === 'false' && |
|
145 | + ( |
|
146 | + $this->request->method === 'GET' || |
|
147 | + strpos($this->request->getHeader('Content-Type'), |
|
148 | + 'application/x-www-form-urlencoded') !== false |
|
149 | + ) |
|
150 | + ) { |
|
151 | + $value = false; |
|
152 | + |
|
153 | + } elseif($value !== null && in_array($type, $types)) { |
|
154 | + settype($value, $type); |
|
155 | + } |
|
156 | + |
|
157 | + $arguments[] = $value; |
|
158 | + } |
|
159 | + |
|
160 | + $response = call_user_func_array(array($controller, $methodName), $arguments); |
|
161 | + |
|
162 | + // format response |
|
163 | + if($response instanceof DataResponse || !($response instanceof Response)) { |
|
164 | + |
|
165 | + // get format from the url format or request format parameter |
|
166 | + $format = $this->request->getParam('format'); |
|
167 | + |
|
168 | + // if none is given try the first Accept header |
|
169 | + if($format === null) { |
|
170 | + $headers = $this->request->getHeader('Accept'); |
|
171 | + $format = $controller->getResponderByHTTPHeader($headers, null); |
|
172 | + } |
|
173 | + |
|
174 | + if ($format !== null) { |
|
175 | + $response = $controller->buildResponse($response, $format); |
|
176 | + } else { |
|
177 | + $response = $controller->buildResponse($response); |
|
178 | + } |
|
179 | + } |
|
180 | + |
|
181 | + return $response; |
|
182 | + } |
|
183 | 183 | |
184 | 184 | } |
@@ -45,116 +45,116 @@ |
||
45 | 45 | * https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS |
46 | 46 | */ |
47 | 47 | class CORSMiddleware extends Middleware { |
48 | - /** @var IRequest */ |
|
49 | - private $request; |
|
50 | - /** @var ControllerMethodReflector */ |
|
51 | - private $reflector; |
|
52 | - /** @var Session */ |
|
53 | - private $session; |
|
54 | - /** @var Throttler */ |
|
55 | - private $throttler; |
|
48 | + /** @var IRequest */ |
|
49 | + private $request; |
|
50 | + /** @var ControllerMethodReflector */ |
|
51 | + private $reflector; |
|
52 | + /** @var Session */ |
|
53 | + private $session; |
|
54 | + /** @var Throttler */ |
|
55 | + private $throttler; |
|
56 | 56 | |
57 | - /** |
|
58 | - * @param IRequest $request |
|
59 | - * @param ControllerMethodReflector $reflector |
|
60 | - * @param Session $session |
|
61 | - * @param Throttler $throttler |
|
62 | - */ |
|
63 | - public function __construct(IRequest $request, |
|
64 | - ControllerMethodReflector $reflector, |
|
65 | - Session $session, |
|
66 | - Throttler $throttler) { |
|
67 | - $this->request = $request; |
|
68 | - $this->reflector = $reflector; |
|
69 | - $this->session = $session; |
|
70 | - $this->throttler = $throttler; |
|
71 | - } |
|
57 | + /** |
|
58 | + * @param IRequest $request |
|
59 | + * @param ControllerMethodReflector $reflector |
|
60 | + * @param Session $session |
|
61 | + * @param Throttler $throttler |
|
62 | + */ |
|
63 | + public function __construct(IRequest $request, |
|
64 | + ControllerMethodReflector $reflector, |
|
65 | + Session $session, |
|
66 | + Throttler $throttler) { |
|
67 | + $this->request = $request; |
|
68 | + $this->reflector = $reflector; |
|
69 | + $this->session = $session; |
|
70 | + $this->throttler = $throttler; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * This is being run in normal order before the controller is being |
|
75 | - * called which allows several modifications and checks |
|
76 | - * |
|
77 | - * @param Controller $controller the controller that is being called |
|
78 | - * @param string $methodName the name of the method that will be called on |
|
79 | - * the controller |
|
80 | - * @throws SecurityException |
|
81 | - * @since 6.0.0 |
|
82 | - */ |
|
83 | - public function beforeController($controller, $methodName){ |
|
84 | - // ensure that @CORS annotated API routes are not used in conjunction |
|
85 | - // with session authentication since this enables CSRF attack vectors |
|
86 | - if ($this->reflector->hasAnnotation('CORS') && |
|
87 | - !$this->reflector->hasAnnotation('PublicPage')) { |
|
88 | - $user = $this->request->server['PHP_AUTH_USER']; |
|
89 | - $pass = $this->request->server['PHP_AUTH_PW']; |
|
73 | + /** |
|
74 | + * This is being run in normal order before the controller is being |
|
75 | + * called which allows several modifications and checks |
|
76 | + * |
|
77 | + * @param Controller $controller the controller that is being called |
|
78 | + * @param string $methodName the name of the method that will be called on |
|
79 | + * the controller |
|
80 | + * @throws SecurityException |
|
81 | + * @since 6.0.0 |
|
82 | + */ |
|
83 | + public function beforeController($controller, $methodName){ |
|
84 | + // ensure that @CORS annotated API routes are not used in conjunction |
|
85 | + // with session authentication since this enables CSRF attack vectors |
|
86 | + if ($this->reflector->hasAnnotation('CORS') && |
|
87 | + !$this->reflector->hasAnnotation('PublicPage')) { |
|
88 | + $user = $this->request->server['PHP_AUTH_USER']; |
|
89 | + $pass = $this->request->server['PHP_AUTH_PW']; |
|
90 | 90 | |
91 | - $this->session->logout(); |
|
92 | - try { |
|
93 | - if (!$this->session->logClientIn($user, $pass, $this->request, $this->throttler)) { |
|
94 | - throw new SecurityException('CORS requires basic auth', Http::STATUS_UNAUTHORIZED); |
|
95 | - } |
|
96 | - } catch (PasswordLoginForbiddenException $ex) { |
|
97 | - throw new SecurityException('Password login forbidden, use token instead', Http::STATUS_UNAUTHORIZED); |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
91 | + $this->session->logout(); |
|
92 | + try { |
|
93 | + if (!$this->session->logClientIn($user, $pass, $this->request, $this->throttler)) { |
|
94 | + throw new SecurityException('CORS requires basic auth', Http::STATUS_UNAUTHORIZED); |
|
95 | + } |
|
96 | + } catch (PasswordLoginForbiddenException $ex) { |
|
97 | + throw new SecurityException('Password login forbidden, use token instead', Http::STATUS_UNAUTHORIZED); |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * This is being run after a successful controllermethod call and allows |
|
104 | - * the manipulation of a Response object. The middleware is run in reverse order |
|
105 | - * |
|
106 | - * @param Controller $controller the controller that is being called |
|
107 | - * @param string $methodName the name of the method that will be called on |
|
108 | - * the controller |
|
109 | - * @param Response $response the generated response from the controller |
|
110 | - * @return Response a Response object |
|
111 | - * @throws SecurityException |
|
112 | - */ |
|
113 | - public function afterController($controller, $methodName, Response $response){ |
|
114 | - // only react if its a CORS request and if the request sends origin and |
|
102 | + /** |
|
103 | + * This is being run after a successful controllermethod call and allows |
|
104 | + * the manipulation of a Response object. The middleware is run in reverse order |
|
105 | + * |
|
106 | + * @param Controller $controller the controller that is being called |
|
107 | + * @param string $methodName the name of the method that will be called on |
|
108 | + * the controller |
|
109 | + * @param Response $response the generated response from the controller |
|
110 | + * @return Response a Response object |
|
111 | + * @throws SecurityException |
|
112 | + */ |
|
113 | + public function afterController($controller, $methodName, Response $response){ |
|
114 | + // only react if its a CORS request and if the request sends origin and |
|
115 | 115 | |
116 | - if(isset($this->request->server['HTTP_ORIGIN']) && |
|
117 | - $this->reflector->hasAnnotation('CORS')) { |
|
116 | + if(isset($this->request->server['HTTP_ORIGIN']) && |
|
117 | + $this->reflector->hasAnnotation('CORS')) { |
|
118 | 118 | |
119 | - // allow credentials headers must not be true or CSRF is possible |
|
120 | - // otherwise |
|
121 | - foreach($response->getHeaders() as $header => $value) { |
|
122 | - if(strtolower($header) === 'access-control-allow-credentials' && |
|
123 | - strtolower(trim($value)) === 'true') { |
|
124 | - $msg = 'Access-Control-Allow-Credentials must not be '. |
|
125 | - 'set to true in order to prevent CSRF'; |
|
126 | - throw new SecurityException($msg); |
|
127 | - } |
|
128 | - } |
|
119 | + // allow credentials headers must not be true or CSRF is possible |
|
120 | + // otherwise |
|
121 | + foreach($response->getHeaders() as $header => $value) { |
|
122 | + if(strtolower($header) === 'access-control-allow-credentials' && |
|
123 | + strtolower(trim($value)) === 'true') { |
|
124 | + $msg = 'Access-Control-Allow-Credentials must not be '. |
|
125 | + 'set to true in order to prevent CSRF'; |
|
126 | + throw new SecurityException($msg); |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - $origin = $this->request->server['HTTP_ORIGIN']; |
|
131 | - $response->addHeader('Access-Control-Allow-Origin', $origin); |
|
132 | - } |
|
133 | - return $response; |
|
134 | - } |
|
130 | + $origin = $this->request->server['HTTP_ORIGIN']; |
|
131 | + $response->addHeader('Access-Control-Allow-Origin', $origin); |
|
132 | + } |
|
133 | + return $response; |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * If an SecurityException is being caught return a JSON error response |
|
138 | - * |
|
139 | - * @param Controller $controller the controller that is being called |
|
140 | - * @param string $methodName the name of the method that will be called on |
|
141 | - * the controller |
|
142 | - * @param \Exception $exception the thrown exception |
|
143 | - * @throws \Exception the passed in exception if it can't handle it |
|
144 | - * @return Response a Response object or null in case that the exception could not be handled |
|
145 | - */ |
|
146 | - public function afterException($controller, $methodName, \Exception $exception){ |
|
147 | - if($exception instanceof SecurityException){ |
|
148 | - $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | - if($exception->getCode() !== 0) { |
|
150 | - $response->setStatus($exception->getCode()); |
|
151 | - } else { |
|
152 | - $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
153 | - } |
|
154 | - return $response; |
|
155 | - } |
|
136 | + /** |
|
137 | + * If an SecurityException is being caught return a JSON error response |
|
138 | + * |
|
139 | + * @param Controller $controller the controller that is being called |
|
140 | + * @param string $methodName the name of the method that will be called on |
|
141 | + * the controller |
|
142 | + * @param \Exception $exception the thrown exception |
|
143 | + * @throws \Exception the passed in exception if it can't handle it |
|
144 | + * @return Response a Response object or null in case that the exception could not be handled |
|
145 | + */ |
|
146 | + public function afterException($controller, $methodName, \Exception $exception){ |
|
147 | + if($exception instanceof SecurityException){ |
|
148 | + $response = new JSONResponse(['message' => $exception->getMessage()]); |
|
149 | + if($exception->getCode() !== 0) { |
|
150 | + $response->setStatus($exception->getCode()); |
|
151 | + } else { |
|
152 | + $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
153 | + } |
|
154 | + return $response; |
|
155 | + } |
|
156 | 156 | |
157 | - throw $exception; |
|
158 | - } |
|
157 | + throw $exception; |
|
158 | + } |
|
159 | 159 | |
160 | 160 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @package OC\AppFramework\Middleware\Security\Exceptions |
32 | 32 | */ |
33 | 33 | class NotConfirmedException extends SecurityException { |
34 | - public function __construct() { |
|
35 | - parent::__construct('Password confirmation is required', Http::STATUS_FORBIDDEN); |
|
36 | - } |
|
34 | + public function __construct() { |
|
35 | + parent::__construct('Password confirmation is required', Http::STATUS_FORBIDDEN); |
|
36 | + } |
|
37 | 37 | } |