@@ -26,13 +26,13 @@ |
||
26 | 26 | use SuperClosure\Serializer; |
27 | 27 | |
28 | 28 | class ClosureJob extends QueuedJob { |
29 | - protected function run($serializedCallable) { |
|
30 | - $serializer = new Serializer(); |
|
31 | - $callable = $serializer->unserialize($serializedCallable); |
|
32 | - if (is_callable($callable)) { |
|
33 | - $callable(); |
|
34 | - } else { |
|
35 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
36 | - } |
|
37 | - } |
|
29 | + protected function run($serializedCallable) { |
|
30 | + $serializer = new Serializer(); |
|
31 | + $callable = $serializer->unserialize($serializedCallable); |
|
32 | + if (is_callable($callable)) { |
|
33 | + $callable(); |
|
34 | + } else { |
|
35 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
@@ -25,12 +25,12 @@ |
||
25 | 25 | use OCP\IUser; |
26 | 26 | |
27 | 27 | trait FileAccess { |
28 | - protected function setupFS(IUser $user){ |
|
29 | - \OC_Util::setupFS($user->getUID()); |
|
30 | - } |
|
28 | + protected function setupFS(IUser $user){ |
|
29 | + \OC_Util::setupFS($user->getUID()); |
|
30 | + } |
|
31 | 31 | |
32 | - protected function getUserFolder(IUser $user) { |
|
33 | - $this->setupFS($user); |
|
34 | - return \OC::$server->getUserFolder($user->getUID()); |
|
35 | - } |
|
32 | + protected function getUserFolder(IUser $user) { |
|
33 | + $this->setupFS($user); |
|
34 | + return \OC::$server->getUserFolder($user->getUID()); |
|
35 | + } |
|
36 | 36 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | * Wrap a command in the background job interface |
30 | 30 | */ |
31 | 31 | class CommandJob extends QueuedJob { |
32 | - protected function run($serializedCommand) { |
|
33 | - $command = unserialize($serializedCommand); |
|
34 | - if ($command instanceof ICommand) { |
|
35 | - $command->handle(); |
|
36 | - } else { |
|
37 | - throw new \InvalidArgumentException('Invalid serialized command'); |
|
38 | - } |
|
39 | - } |
|
32 | + protected function run($serializedCommand) { |
|
33 | + $command = unserialize($serializedCommand); |
|
34 | + if ($command instanceof ICommand) { |
|
35 | + $command->handle(); |
|
36 | + } else { |
|
37 | + throw new \InvalidArgumentException('Invalid serialized command'); |
|
38 | + } |
|
39 | + } |
|
40 | 40 | } |
@@ -24,23 +24,23 @@ |
||
24 | 24 | namespace OC\Template; |
25 | 25 | |
26 | 26 | class ResourceNotFoundException extends \LogicException { |
27 | - protected $resource; |
|
28 | - protected $webPath; |
|
27 | + protected $resource; |
|
28 | + protected $webPath; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param string $resource |
|
32 | - * @param string $webPath |
|
33 | - */ |
|
34 | - public function __construct($resource, $webPath) { |
|
35 | - parent::__construct('Resource not found'); |
|
36 | - $this->resource = $resource; |
|
37 | - $this->webPath = $webPath; |
|
38 | - } |
|
30 | + /** |
|
31 | + * @param string $resource |
|
32 | + * @param string $webPath |
|
33 | + */ |
|
34 | + public function __construct($resource, $webPath) { |
|
35 | + parent::__construct('Resource not found'); |
|
36 | + $this->resource = $resource; |
|
37 | + $this->webPath = $webPath; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function getResourcePath() { |
|
44 | - return $this->webPath . '/' . $this->resource; |
|
45 | - } |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function getResourcePath() { |
|
44 | + return $this->webPath . '/' . $this->resource; |
|
45 | + } |
|
46 | 46 | } |
@@ -26,37 +26,37 @@ |
||
26 | 26 | namespace OC\Template; |
27 | 27 | |
28 | 28 | class TemplateFileLocator { |
29 | - protected $dirs; |
|
30 | - private $path; |
|
29 | + protected $dirs; |
|
30 | + private $path; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param string[] $dirs |
|
34 | - */ |
|
35 | - public function __construct( $dirs ) { |
|
36 | - $this->dirs = $dirs; |
|
37 | - } |
|
32 | + /** |
|
33 | + * @param string[] $dirs |
|
34 | + */ |
|
35 | + public function __construct( $dirs ) { |
|
36 | + $this->dirs = $dirs; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $template |
|
41 | - * @return string |
|
42 | - * @throws \Exception |
|
43 | - */ |
|
44 | - public function find( $template ) { |
|
45 | - if ($template === '') { |
|
46 | - throw new \InvalidArgumentException('Empty template name'); |
|
47 | - } |
|
39 | + /** |
|
40 | + * @param string $template |
|
41 | + * @return string |
|
42 | + * @throws \Exception |
|
43 | + */ |
|
44 | + public function find( $template ) { |
|
45 | + if ($template === '') { |
|
46 | + throw new \InvalidArgumentException('Empty template name'); |
|
47 | + } |
|
48 | 48 | |
49 | - foreach($this->dirs as $dir) { |
|
50 | - $file = $dir.$template.'.php'; |
|
51 | - if (is_file($file)) { |
|
52 | - $this->path = $dir; |
|
53 | - return $file; |
|
54 | - } |
|
55 | - } |
|
56 | - throw new \Exception('template file not found: template:'.$template); |
|
57 | - } |
|
49 | + foreach($this->dirs as $dir) { |
|
50 | + $file = $dir.$template.'.php'; |
|
51 | + if (is_file($file)) { |
|
52 | + $this->path = $dir; |
|
53 | + return $file; |
|
54 | + } |
|
55 | + } |
|
56 | + throw new \Exception('template file not found: template:'.$template); |
|
57 | + } |
|
58 | 58 | |
59 | - public function getPath() { |
|
60 | - return $this->path; |
|
61 | - } |
|
59 | + public function getPath() { |
|
60 | + return $this->path; |
|
61 | + } |
|
62 | 62 | } |
@@ -24,5 +24,5 @@ |
||
24 | 24 | namespace OC\Hooks; |
25 | 25 | |
26 | 26 | abstract class BasicEmitter implements Emitter { |
27 | - use EmitterTrait; |
|
27 | + use EmitterTrait; |
|
28 | 28 | } |
@@ -32,19 +32,19 @@ |
||
32 | 32 | * @package OC\Hooks |
33 | 33 | */ |
34 | 34 | interface Emitter { |
35 | - /** |
|
36 | - * @param string $scope |
|
37 | - * @param string $method |
|
38 | - * @param callable $callback |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - public function listen($scope, $method, callable $callback); |
|
35 | + /** |
|
36 | + * @param string $scope |
|
37 | + * @param string $method |
|
38 | + * @param callable $callback |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + public function listen($scope, $method, callable $callback); |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $scope optional |
|
45 | - * @param string $method optional |
|
46 | - * @param callable $callback optional |
|
47 | - * @return void |
|
48 | - */ |
|
49 | - public function removeListener($scope = null, $method = null, callable $callback = null); |
|
43 | + /** |
|
44 | + * @param string $scope optional |
|
45 | + * @param string $method optional |
|
46 | + * @param callable $callback optional |
|
47 | + * @return void |
|
48 | + */ |
|
49 | + public function removeListener($scope = null, $method = null, callable $callback = null); |
|
50 | 50 | } |
@@ -31,35 +31,35 @@ |
||
31 | 31 | * @package OC\Hooks |
32 | 32 | */ |
33 | 33 | abstract class ForwardingEmitter extends BasicEmitter { |
34 | - /** |
|
35 | - * @var \OC\Hooks\Emitter[] array |
|
36 | - */ |
|
37 | - private $forwardEmitters = array(); |
|
34 | + /** |
|
35 | + * @var \OC\Hooks\Emitter[] array |
|
36 | + */ |
|
37 | + private $forwardEmitters = array(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $scope |
|
41 | - * @param string $method |
|
42 | - * @param callable $callback |
|
43 | - */ |
|
44 | - public function listen($scope, $method, callable $callback) { |
|
45 | - parent::listen($scope, $method, $callback); |
|
46 | - foreach ($this->forwardEmitters as $emitter) { |
|
47 | - $emitter->listen($scope, $method, $callback); |
|
48 | - } |
|
49 | - } |
|
39 | + /** |
|
40 | + * @param string $scope |
|
41 | + * @param string $method |
|
42 | + * @param callable $callback |
|
43 | + */ |
|
44 | + public function listen($scope, $method, callable $callback) { |
|
45 | + parent::listen($scope, $method, $callback); |
|
46 | + foreach ($this->forwardEmitters as $emitter) { |
|
47 | + $emitter->listen($scope, $method, $callback); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @param \OC\Hooks\Emitter $emitter |
|
53 | - */ |
|
54 | - protected function forward(Emitter $emitter) { |
|
55 | - $this->forwardEmitters[] = $emitter; |
|
51 | + /** |
|
52 | + * @param \OC\Hooks\Emitter $emitter |
|
53 | + */ |
|
54 | + protected function forward(Emitter $emitter) { |
|
55 | + $this->forwardEmitters[] = $emitter; |
|
56 | 56 | |
57 | - //forward all previously connected hooks |
|
58 | - foreach ($this->listeners as $key => $listeners) { |
|
59 | - list($scope, $method) = explode('::', $key, 2); |
|
60 | - foreach ($listeners as $listener) { |
|
61 | - $emitter->listen($scope, $method, $listener); |
|
62 | - } |
|
63 | - } |
|
64 | - } |
|
57 | + //forward all previously connected hooks |
|
58 | + foreach ($this->listeners as $key => $listeners) { |
|
59 | + list($scope, $method) = explode('::', $key, 2); |
|
60 | + foreach ($listeners as $listener) { |
|
61 | + $emitter->listen($scope, $method, $listener); |
|
62 | + } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | } |
@@ -34,87 +34,87 @@ |
||
34 | 34 | * @deprecated Use \OCP\Http\Client\IClientService |
35 | 35 | */ |
36 | 36 | class HTTPHelper { |
37 | - const USER_AGENT = 'ownCloud Server Crawler'; |
|
37 | + const USER_AGENT = 'ownCloud Server Crawler'; |
|
38 | 38 | |
39 | - /** @var \OCP\IConfig */ |
|
40 | - private $config; |
|
41 | - /** @var IClientService */ |
|
42 | - private $clientService; |
|
39 | + /** @var \OCP\IConfig */ |
|
40 | + private $config; |
|
41 | + /** @var IClientService */ |
|
42 | + private $clientService; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param IConfig $config |
|
46 | - * @param IClientService $clientService |
|
47 | - */ |
|
48 | - public function __construct(IConfig $config, |
|
49 | - IClientService $clientService) { |
|
50 | - $this->config = $config; |
|
51 | - $this->clientService = $clientService; |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param IConfig $config |
|
46 | + * @param IClientService $clientService |
|
47 | + */ |
|
48 | + public function __construct(IConfig $config, |
|
49 | + IClientService $clientService) { |
|
50 | + $this->config = $config; |
|
51 | + $this->clientService = $clientService; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get URL content |
|
56 | - * @param string $url Url to get content |
|
57 | - * @throws \Exception If the URL does not start with http:// or https:// |
|
58 | - * @return string of the response or false on error |
|
59 | - * This function get the content of a page via curl, if curl is enabled. |
|
60 | - * If not, file_get_contents is used. |
|
61 | - * @deprecated Use \OCP\Http\Client\IClientService |
|
62 | - */ |
|
63 | - public function getUrlContent($url) { |
|
64 | - try { |
|
65 | - $client = $this->clientService->newClient(); |
|
66 | - $response = $client->get($url); |
|
67 | - return $response->getBody(); |
|
68 | - } catch (\Exception $e) { |
|
69 | - return false; |
|
70 | - } |
|
71 | - } |
|
54 | + /** |
|
55 | + * Get URL content |
|
56 | + * @param string $url Url to get content |
|
57 | + * @throws \Exception If the URL does not start with http:// or https:// |
|
58 | + * @return string of the response or false on error |
|
59 | + * This function get the content of a page via curl, if curl is enabled. |
|
60 | + * If not, file_get_contents is used. |
|
61 | + * @deprecated Use \OCP\Http\Client\IClientService |
|
62 | + */ |
|
63 | + public function getUrlContent($url) { |
|
64 | + try { |
|
65 | + $client = $this->clientService->newClient(); |
|
66 | + $response = $client->get($url); |
|
67 | + return $response->getBody(); |
|
68 | + } catch (\Exception $e) { |
|
69 | + return false; |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Returns the response headers of a HTTP URL without following redirects |
|
75 | - * @param string $location Needs to be a HTTPS or HTTP URL |
|
76 | - * @return array |
|
77 | - * @deprecated Use \OCP\Http\Client\IClientService |
|
78 | - */ |
|
79 | - public function getHeaders($location) { |
|
80 | - $client = $this->clientService->newClient(); |
|
81 | - $response = $client->get($location); |
|
82 | - return $response->getHeaders(); |
|
83 | - } |
|
73 | + /** |
|
74 | + * Returns the response headers of a HTTP URL without following redirects |
|
75 | + * @param string $location Needs to be a HTTPS or HTTP URL |
|
76 | + * @return array |
|
77 | + * @deprecated Use \OCP\Http\Client\IClientService |
|
78 | + */ |
|
79 | + public function getHeaders($location) { |
|
80 | + $client = $this->clientService->newClient(); |
|
81 | + $response = $client->get($location); |
|
82 | + return $response->getHeaders(); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Checks whether the supplied URL begins with HTTPS:// or HTTP:// (case insensitive) |
|
87 | - * @param string $url |
|
88 | - * @return bool |
|
89 | - */ |
|
90 | - public function isHTTPURL($url) { |
|
91 | - return stripos($url, 'https://') === 0 || stripos($url, 'http://') === 0; |
|
92 | - } |
|
85 | + /** |
|
86 | + * Checks whether the supplied URL begins with HTTPS:// or HTTP:// (case insensitive) |
|
87 | + * @param string $url |
|
88 | + * @return bool |
|
89 | + */ |
|
90 | + public function isHTTPURL($url) { |
|
91 | + return stripos($url, 'https://') === 0 || stripos($url, 'http://') === 0; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * send http post request |
|
96 | - * |
|
97 | - * @param string $url |
|
98 | - * @param array $fields data send by the request |
|
99 | - * @return array |
|
100 | - * @deprecated Use \OCP\Http\Client\IClientService |
|
101 | - */ |
|
102 | - public function post($url, array $fields) { |
|
103 | - $client = $this->clientService->newClient(); |
|
94 | + /** |
|
95 | + * send http post request |
|
96 | + * |
|
97 | + * @param string $url |
|
98 | + * @param array $fields data send by the request |
|
99 | + * @return array |
|
100 | + * @deprecated Use \OCP\Http\Client\IClientService |
|
101 | + */ |
|
102 | + public function post($url, array $fields) { |
|
103 | + $client = $this->clientService->newClient(); |
|
104 | 104 | |
105 | - try { |
|
106 | - $response = $client->post( |
|
107 | - $url, |
|
108 | - [ |
|
109 | - 'body' => $fields, |
|
110 | - 'connect_timeout' => 10, |
|
111 | - ] |
|
112 | - ); |
|
113 | - } catch (\Exception $e) { |
|
114 | - return ['success' => false, 'result' => $e->getMessage()]; |
|
115 | - } |
|
105 | + try { |
|
106 | + $response = $client->post( |
|
107 | + $url, |
|
108 | + [ |
|
109 | + 'body' => $fields, |
|
110 | + 'connect_timeout' => 10, |
|
111 | + ] |
|
112 | + ); |
|
113 | + } catch (\Exception $e) { |
|
114 | + return ['success' => false, 'result' => $e->getMessage()]; |
|
115 | + } |
|
116 | 116 | |
117 | - return ['success' => true, 'result' => $response->getBody()]; |
|
118 | - } |
|
117 | + return ['success' => true, 'result' => $response->getBody()]; |
|
118 | + } |
|
119 | 119 | |
120 | 120 | } |