@@ -25,12 +25,12 @@ |
||
| 25 | 25 | use OC\BackgroundJob\QueuedJob; |
| 26 | 26 | |
| 27 | 27 | class CallableJob extends QueuedJob { |
| 28 | - protected function run($serializedCallable) { |
|
| 29 | - $callable = unserialize($serializedCallable); |
|
| 30 | - if (is_callable($callable)) { |
|
| 31 | - $callable(); |
|
| 32 | - } else { |
|
| 33 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | - } |
|
| 35 | - } |
|
| 28 | + protected function run($serializedCallable) { |
|
| 29 | + $callable = unserialize($serializedCallable); |
|
| 30 | + if (is_callable($callable)) { |
|
| 31 | + $callable(); |
|
| 32 | + } else { |
|
| 33 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -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 | } |