@@ -40,53 +40,53 @@ |
||
40 | 40 | |
41 | 41 | class TagManager implements \OCP\ITagManager { |
42 | 42 | |
43 | - /** |
|
44 | - * User session |
|
45 | - * |
|
46 | - * @var \OCP\IUserSession |
|
47 | - */ |
|
48 | - private $userSession; |
|
43 | + /** |
|
44 | + * User session |
|
45 | + * |
|
46 | + * @var \OCP\IUserSession |
|
47 | + */ |
|
48 | + private $userSession; |
|
49 | 49 | |
50 | - /** |
|
51 | - * TagMapper |
|
52 | - * |
|
53 | - * @var TagMapper |
|
54 | - */ |
|
55 | - private $mapper; |
|
50 | + /** |
|
51 | + * TagMapper |
|
52 | + * |
|
53 | + * @var TagMapper |
|
54 | + */ |
|
55 | + private $mapper; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Constructor. |
|
59 | - * |
|
60 | - * @param TagMapper $mapper Instance of the TagMapper abstraction layer. |
|
61 | - * @param \OCP\IUserSession $userSession the user session |
|
62 | - */ |
|
63 | - public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) { |
|
64 | - $this->mapper = $mapper; |
|
65 | - $this->userSession = $userSession; |
|
57 | + /** |
|
58 | + * Constructor. |
|
59 | + * |
|
60 | + * @param TagMapper $mapper Instance of the TagMapper abstraction layer. |
|
61 | + * @param \OCP\IUserSession $userSession the user session |
|
62 | + */ |
|
63 | + public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) { |
|
64 | + $this->mapper = $mapper; |
|
65 | + $this->userSession = $userSession; |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Create a new \OCP\ITags instance and load tags from db. |
|
71 | - * |
|
72 | - * @see \OCP\ITags |
|
73 | - * @param string $type The type identifier e.g. 'contact' or 'event'. |
|
74 | - * @param array $defaultTags An array of default tags to be used if none are stored. |
|
75 | - * @param boolean $includeShared Whether to include tags for items shared with this user by others. |
|
76 | - * @param string $userId user for which to retrieve the tags, defaults to the currently |
|
77 | - * logged in user |
|
78 | - * @return \OCP\ITags |
|
79 | - */ |
|
80 | - public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) { |
|
81 | - if (is_null($userId)) { |
|
82 | - $user = $this->userSession->getUser(); |
|
83 | - if ($user === null) { |
|
84 | - // nothing we can do without a user |
|
85 | - return null; |
|
86 | - } |
|
87 | - $userId = $this->userSession->getUser()->getUId(); |
|
88 | - } |
|
89 | - return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared); |
|
90 | - } |
|
69 | + /** |
|
70 | + * Create a new \OCP\ITags instance and load tags from db. |
|
71 | + * |
|
72 | + * @see \OCP\ITags |
|
73 | + * @param string $type The type identifier e.g. 'contact' or 'event'. |
|
74 | + * @param array $defaultTags An array of default tags to be used if none are stored. |
|
75 | + * @param boolean $includeShared Whether to include tags for items shared with this user by others. |
|
76 | + * @param string $userId user for which to retrieve the tags, defaults to the currently |
|
77 | + * logged in user |
|
78 | + * @return \OCP\ITags |
|
79 | + */ |
|
80 | + public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) { |
|
81 | + if (is_null($userId)) { |
|
82 | + $user = $this->userSession->getUser(); |
|
83 | + if ($user === null) { |
|
84 | + // nothing we can do without a user |
|
85 | + return null; |
|
86 | + } |
|
87 | + $userId = $this->userSession->getUser()->getUId(); |
|
88 | + } |
|
89 | + return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | } |
@@ -25,14 +25,14 @@ |
||
25 | 25 | namespace OC; |
26 | 26 | |
27 | 27 | class NaturalSort_DefaultCollator { |
28 | - public function compare($a, $b) { |
|
29 | - $result = strcasecmp($a, $b); |
|
30 | - if ($result === 0) { |
|
31 | - if ($a === $b) { |
|
32 | - return 0; |
|
33 | - } |
|
34 | - return ($a > $b) ? -1 : 1; |
|
35 | - } |
|
36 | - return ($result < 0) ? -1 : 1; |
|
37 | - } |
|
28 | + public function compare($a, $b) { |
|
29 | + $result = strcasecmp($a, $b); |
|
30 | + if ($result === 0) { |
|
31 | + if ($a === $b) { |
|
32 | + return 0; |
|
33 | + } |
|
34 | + return ($a > $b) ? -1 : 1; |
|
35 | + } |
|
36 | + return ($result < 0) ? -1 : 1; |
|
37 | + } |
|
38 | 38 | } |
@@ -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 | } |
@@ -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 | } |