Passed
Push — master ( 27fb46...dad31c )
by rakekniven
15:02 queued 12s
created
lib/private/Tagging/TagMapper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 			$owners = [$owners];
55 55
 		}
56 56
 
57
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners) - 1) . '?) AND `type` = ? ORDER BY `category`';
57
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
58
+			. 'WHERE `uid` IN ('.str_repeat('?,', count($owners) - 1).'?) AND `type` = ? ORDER BY `category`';
59 59
 		return $this->findEntities($sql, array_merge($owners, [$type]));
60 60
 	}
61 61
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @return bool
67 67
 	 */
68 68
 	public function tagExists($tag) {
69
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
69
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
70 70
 			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71 71
 		try {
72 72
 			$this->findEntity($sql, [$tag->getOwner(), $tag->getType(), $tag->getName()]);
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -35,46 +35,46 @@
 block discarded – undo
35 35
  */
36 36
 class TagMapper extends Mapper {
37 37
 
38
-	/**
39
-	 * Constructor.
40
-	 *
41
-	 * @param IDBConnection $db Instance of the Db abstraction layer.
42
-	 */
43
-	public function __construct(IDBConnection $db) {
44
-		parent::__construct($db, 'vcategory', Tag::class);
45
-	}
38
+    /**
39
+     * Constructor.
40
+     *
41
+     * @param IDBConnection $db Instance of the Db abstraction layer.
42
+     */
43
+    public function __construct(IDBConnection $db) {
44
+        parent::__construct($db, 'vcategory', Tag::class);
45
+    }
46 46
 
47
-	/**
48
-	 * Load tags from the database.
49
-	 *
50
-	 * @param array|string $owners The user(s) whose tags we are going to load.
51
-	 * @param string $type The type of item for which we are loading tags.
52
-	 * @return array An array of Tag objects.
53
-	 */
54
-	public function loadTags($owners, $type) {
55
-		if (!is_array($owners)) {
56
-			$owners = [$owners];
57
-		}
47
+    /**
48
+     * Load tags from the database.
49
+     *
50
+     * @param array|string $owners The user(s) whose tags we are going to load.
51
+     * @param string $type The type of item for which we are loading tags.
52
+     * @return array An array of Tag objects.
53
+     */
54
+    public function loadTags($owners, $type) {
55
+        if (!is_array($owners)) {
56
+            $owners = [$owners];
57
+        }
58 58
 
59
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
60
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners) - 1) . '?) AND `type` = ? ORDER BY `category`';
61
-		return $this->findEntities($sql, array_merge($owners, [$type]));
62
-	}
59
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
60
+            . 'WHERE `uid` IN (' . str_repeat('?,', count($owners) - 1) . '?) AND `type` = ? ORDER BY `category`';
61
+        return $this->findEntities($sql, array_merge($owners, [$type]));
62
+    }
63 63
 
64
-	/**
65
-	 * Check if a given Tag object already exists in the database.
66
-	 *
67
-	 * @param Tag $tag The tag to look for in the database.
68
-	 * @return bool
69
-	 */
70
-	public function tagExists($tag) {
71
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
72
-			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
73
-		try {
74
-			$this->findEntity($sql, [$tag->getOwner(), $tag->getType(), $tag->getName()]);
75
-		} catch (DoesNotExistException $e) {
76
-			return false;
77
-		}
78
-		return true;
79
-	}
64
+    /**
65
+     * Check if a given Tag object already exists in the database.
66
+     *
67
+     * @param Tag $tag The tag to look for in the database.
68
+     * @return bool
69
+     */
70
+    public function tagExists($tag) {
71
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
72
+            . 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
73
+        try {
74
+            $this->findEntity($sql, [$tag->getOwner(), $tag->getType(), $tag->getName()]);
75
+        } catch (DoesNotExistException $e) {
76
+            return false;
77
+        }
78
+        return true;
79
+    }
80 80
 }
Please login to merge, or discard this patch.
Middleware/Security/Exceptions/StrictCookieMissingException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  * @package OC\AppFramework\Middleware\Security\Exceptions
33 33
  */
34 34
 class StrictCookieMissingException extends SecurityException {
35
-	public function __construct() {
36
-		parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED);
37
-	}
35
+    public function __construct() {
36
+        parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED);
37
+    }
38 38
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/OCS/V1Response.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
 			'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage,
71 71
 		];
72 72
 
73
-		$meta['totalitems'] = $this->itemsCount !== null ? (string)$this->itemsCount : '';
74
-		$meta['itemsperpage'] = $this->itemsPerPage !== null ? (string)$this->itemsPerPage: '';
73
+		$meta['totalitems'] = $this->itemsCount !== null ? (string) $this->itemsCount : '';
74
+		$meta['itemsperpage'] = $this->itemsPerPage !== null ? (string) $this->itemsPerPage : '';
75 75
 
76 76
 		return $this->renderResult($meta);
77 77
 	}
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,52 +29,52 @@
 block discarded – undo
29 29
 
30 30
 class V1Response extends BaseResponse {
31 31
 
32
-	/**
33
-	 * The V1 endpoint has very limited http status codes basically everything
34
-	 * is status 200 except 401
35
-	 *
36
-	 * @return int
37
-	 */
38
-	public function getStatus() {
39
-		$status = parent::getStatus();
40
-		if ($status === OCSController::RESPOND_UNAUTHORISED) {
41
-			return Http::STATUS_UNAUTHORIZED;
42
-		}
32
+    /**
33
+     * The V1 endpoint has very limited http status codes basically everything
34
+     * is status 200 except 401
35
+     *
36
+     * @return int
37
+     */
38
+    public function getStatus() {
39
+        $status = parent::getStatus();
40
+        if ($status === OCSController::RESPOND_UNAUTHORISED) {
41
+            return Http::STATUS_UNAUTHORIZED;
42
+        }
43 43
 
44
-		return Http::STATUS_OK;
45
-	}
44
+        return Http::STATUS_OK;
45
+    }
46 46
 
47
-	/**
48
-	 * In v1 all OK is 100
49
-	 *
50
-	 * @return int
51
-	 */
52
-	public function getOCSStatus() {
53
-		$status = parent::getOCSStatus();
47
+    /**
48
+     * In v1 all OK is 100
49
+     *
50
+     * @return int
51
+     */
52
+    public function getOCSStatus() {
53
+        $status = parent::getOCSStatus();
54 54
 
55
-		if ($status === Http::STATUS_OK) {
56
-			return 100;
57
-		}
55
+        if ($status === Http::STATUS_OK) {
56
+            return 100;
57
+        }
58 58
 
59
-		return $status;
60
-	}
59
+        return $status;
60
+    }
61 61
 
62
-	/**
63
-	 * Construct the meta part of the response
64
-	 * And then late the base class render
65
-	 *
66
-	 * @return string
67
-	 */
68
-	public function render() {
69
-		$meta = [
70
-			'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure',
71
-			'statuscode' => $this->getOCSStatus(),
72
-			'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage,
73
-		];
62
+    /**
63
+     * Construct the meta part of the response
64
+     * And then late the base class render
65
+     *
66
+     * @return string
67
+     */
68
+    public function render() {
69
+        $meta = [
70
+            'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure',
71
+            'statuscode' => $this->getOCSStatus(),
72
+            'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage,
73
+        ];
74 74
 
75
-		$meta['totalitems'] = $this->itemsCount !== null ? (string)$this->itemsCount : '';
76
-		$meta['itemsperpage'] = $this->itemsPerPage !== null ? (string)$this->itemsPerPage: '';
75
+        $meta['totalitems'] = $this->itemsCount !== null ? (string)$this->itemsCount : '';
76
+        $meta['itemsperpage'] = $this->itemsPerPage !== null ? (string)$this->itemsPerPage: '';
77 77
 
78
-		return $this->renderResult($meta);
79
-	}
78
+        return $this->renderResult($meta);
79
+    }
80 80
 }
Please login to merge, or discard this patch.
apps/dav/lib/Comments/RootCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@
 block discarded – undo
147 147
 		if (isset($this->entityTypeCollections[$name])) {
148 148
 			return $this->entityTypeCollections[$name];
149 149
 		}
150
-		throw new NotFound('Entity type "' . $name . '" not found."');
150
+		throw new NotFound('Entity type "'.$name.'" not found."');
151 151
 	}
152 152
 
153 153
 	/**
Please login to merge, or discard this patch.
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -37,176 +37,176 @@
 block discarded – undo
37 37
 
38 38
 class RootCollection implements ICollection {
39 39
 
40
-	/** @var EntityTypeCollection[]|null */
41
-	private $entityTypeCollections;
42
-
43
-	/** @var ICommentsManager */
44
-	protected $commentsManager;
45
-
46
-	/** @var string */
47
-	protected $name = 'comments';
48
-
49
-	/** @var ILogger */
50
-	protected $logger;
51
-
52
-	/** @var IUserManager */
53
-	protected $userManager;
54
-
55
-	/** @var IUserSession */
56
-	protected $userSession;
57
-
58
-	/** @var EventDispatcherInterface */
59
-	protected $dispatcher;
60
-
61
-	/**
62
-	 * @param ICommentsManager $commentsManager
63
-	 * @param IUserManager $userManager
64
-	 * @param IUserSession $userSession
65
-	 * @param EventDispatcherInterface $dispatcher
66
-	 * @param ILogger $logger
67
-	 */
68
-	public function __construct(
69
-		ICommentsManager $commentsManager,
70
-		IUserManager $userManager,
71
-		IUserSession $userSession,
72
-		EventDispatcherInterface $dispatcher,
73
-		ILogger $logger) {
74
-		$this->commentsManager = $commentsManager;
75
-		$this->logger = $logger;
76
-		$this->userManager = $userManager;
77
-		$this->userSession = $userSession;
78
-		$this->dispatcher = $dispatcher;
79
-	}
80
-
81
-	/**
82
-	 * initializes the collection. At this point of time, we need the logged in
83
-	 * user. Since it is not the case when the instance is created, we cannot
84
-	 * have this in the constructor.
85
-	 *
86
-	 * @throws NotAuthenticated
87
-	 */
88
-	protected function initCollections() {
89
-		if ($this->entityTypeCollections !== null) {
90
-			return;
91
-		}
92
-		$user = $this->userSession->getUser();
93
-		if (is_null($user)) {
94
-			throw new NotAuthenticated();
95
-		}
96
-
97
-		$event = new CommentsEntityEvent(CommentsEntityEvent::EVENT_ENTITY);
98
-		$this->dispatcher->dispatch(CommentsEntityEvent::EVENT_ENTITY, $event);
99
-
100
-		$this->entityTypeCollections = [];
101
-		foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) {
102
-			$this->entityTypeCollections[$entity] = new EntityTypeCollection(
103
-				$entity,
104
-				$this->commentsManager,
105
-				$this->userManager,
106
-				$this->userSession,
107
-				$this->logger,
108
-				$entityExistsFunction
109
-			);
110
-		}
111
-	}
112
-
113
-	/**
114
-	 * Creates a new file in the directory
115
-	 *
116
-	 * @param string $name Name of the file
117
-	 * @param resource|string $data Initial payload
118
-	 * @return null|string
119
-	 * @throws Forbidden
120
-	 */
121
-	public function createFile($name, $data = null) {
122
-		throw new Forbidden('Cannot create comments by id');
123
-	}
124
-
125
-	/**
126
-	 * Creates a new subdirectory
127
-	 *
128
-	 * @param string $name
129
-	 * @throws Forbidden
130
-	 */
131
-	public function createDirectory($name) {
132
-		throw new Forbidden('Permission denied to create collections');
133
-	}
134
-
135
-	/**
136
-	 * Returns a specific child node, referenced by its name
137
-	 *
138
-	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
139
-	 * exist.
140
-	 *
141
-	 * @param string $name
142
-	 * @return \Sabre\DAV\INode
143
-	 * @throws NotFound
144
-	 */
145
-	public function getChild($name) {
146
-		$this->initCollections();
147
-		if (isset($this->entityTypeCollections[$name])) {
148
-			return $this->entityTypeCollections[$name];
149
-		}
150
-		throw new NotFound('Entity type "' . $name . '" not found."');
151
-	}
152
-
153
-	/**
154
-	 * Returns an array with all the child nodes
155
-	 *
156
-	 * @return \Sabre\DAV\INode[]
157
-	 */
158
-	public function getChildren() {
159
-		$this->initCollections();
160
-		return $this->entityTypeCollections;
161
-	}
162
-
163
-	/**
164
-	 * Checks if a child-node with the specified name exists
165
-	 *
166
-	 * @param string $name
167
-	 * @return bool
168
-	 */
169
-	public function childExists($name) {
170
-		$this->initCollections();
171
-		return isset($this->entityTypeCollections[$name]);
172
-	}
173
-
174
-	/**
175
-	 * Deleted the current node
176
-	 *
177
-	 * @throws Forbidden
178
-	 */
179
-	public function delete() {
180
-		throw new Forbidden('Permission denied to delete this collection');
181
-	}
182
-
183
-	/**
184
-	 * Returns the name of the node.
185
-	 *
186
-	 * This is used to generate the url.
187
-	 *
188
-	 * @return string
189
-	 */
190
-	public function getName() {
191
-		return $this->name;
192
-	}
193
-
194
-	/**
195
-	 * Renames the node
196
-	 *
197
-	 * @param string $name The new name
198
-	 * @throws Forbidden
199
-	 */
200
-	public function setName($name) {
201
-		throw new Forbidden('Permission denied to rename this collection');
202
-	}
203
-
204
-	/**
205
-	 * Returns the last modification time, as a unix timestamp
206
-	 *
207
-	 * @return int
208
-	 */
209
-	public function getLastModified() {
210
-		return null;
211
-	}
40
+    /** @var EntityTypeCollection[]|null */
41
+    private $entityTypeCollections;
42
+
43
+    /** @var ICommentsManager */
44
+    protected $commentsManager;
45
+
46
+    /** @var string */
47
+    protected $name = 'comments';
48
+
49
+    /** @var ILogger */
50
+    protected $logger;
51
+
52
+    /** @var IUserManager */
53
+    protected $userManager;
54
+
55
+    /** @var IUserSession */
56
+    protected $userSession;
57
+
58
+    /** @var EventDispatcherInterface */
59
+    protected $dispatcher;
60
+
61
+    /**
62
+     * @param ICommentsManager $commentsManager
63
+     * @param IUserManager $userManager
64
+     * @param IUserSession $userSession
65
+     * @param EventDispatcherInterface $dispatcher
66
+     * @param ILogger $logger
67
+     */
68
+    public function __construct(
69
+        ICommentsManager $commentsManager,
70
+        IUserManager $userManager,
71
+        IUserSession $userSession,
72
+        EventDispatcherInterface $dispatcher,
73
+        ILogger $logger) {
74
+        $this->commentsManager = $commentsManager;
75
+        $this->logger = $logger;
76
+        $this->userManager = $userManager;
77
+        $this->userSession = $userSession;
78
+        $this->dispatcher = $dispatcher;
79
+    }
80
+
81
+    /**
82
+     * initializes the collection. At this point of time, we need the logged in
83
+     * user. Since it is not the case when the instance is created, we cannot
84
+     * have this in the constructor.
85
+     *
86
+     * @throws NotAuthenticated
87
+     */
88
+    protected function initCollections() {
89
+        if ($this->entityTypeCollections !== null) {
90
+            return;
91
+        }
92
+        $user = $this->userSession->getUser();
93
+        if (is_null($user)) {
94
+            throw new NotAuthenticated();
95
+        }
96
+
97
+        $event = new CommentsEntityEvent(CommentsEntityEvent::EVENT_ENTITY);
98
+        $this->dispatcher->dispatch(CommentsEntityEvent::EVENT_ENTITY, $event);
99
+
100
+        $this->entityTypeCollections = [];
101
+        foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) {
102
+            $this->entityTypeCollections[$entity] = new EntityTypeCollection(
103
+                $entity,
104
+                $this->commentsManager,
105
+                $this->userManager,
106
+                $this->userSession,
107
+                $this->logger,
108
+                $entityExistsFunction
109
+            );
110
+        }
111
+    }
112
+
113
+    /**
114
+     * Creates a new file in the directory
115
+     *
116
+     * @param string $name Name of the file
117
+     * @param resource|string $data Initial payload
118
+     * @return null|string
119
+     * @throws Forbidden
120
+     */
121
+    public function createFile($name, $data = null) {
122
+        throw new Forbidden('Cannot create comments by id');
123
+    }
124
+
125
+    /**
126
+     * Creates a new subdirectory
127
+     *
128
+     * @param string $name
129
+     * @throws Forbidden
130
+     */
131
+    public function createDirectory($name) {
132
+        throw new Forbidden('Permission denied to create collections');
133
+    }
134
+
135
+    /**
136
+     * Returns a specific child node, referenced by its name
137
+     *
138
+     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
139
+     * exist.
140
+     *
141
+     * @param string $name
142
+     * @return \Sabre\DAV\INode
143
+     * @throws NotFound
144
+     */
145
+    public function getChild($name) {
146
+        $this->initCollections();
147
+        if (isset($this->entityTypeCollections[$name])) {
148
+            return $this->entityTypeCollections[$name];
149
+        }
150
+        throw new NotFound('Entity type "' . $name . '" not found."');
151
+    }
152
+
153
+    /**
154
+     * Returns an array with all the child nodes
155
+     *
156
+     * @return \Sabre\DAV\INode[]
157
+     */
158
+    public function getChildren() {
159
+        $this->initCollections();
160
+        return $this->entityTypeCollections;
161
+    }
162
+
163
+    /**
164
+     * Checks if a child-node with the specified name exists
165
+     *
166
+     * @param string $name
167
+     * @return bool
168
+     */
169
+    public function childExists($name) {
170
+        $this->initCollections();
171
+        return isset($this->entityTypeCollections[$name]);
172
+    }
173
+
174
+    /**
175
+     * Deleted the current node
176
+     *
177
+     * @throws Forbidden
178
+     */
179
+    public function delete() {
180
+        throw new Forbidden('Permission denied to delete this collection');
181
+    }
182
+
183
+    /**
184
+     * Returns the name of the node.
185
+     *
186
+     * This is used to generate the url.
187
+     *
188
+     * @return string
189
+     */
190
+    public function getName() {
191
+        return $this->name;
192
+    }
193
+
194
+    /**
195
+     * Renames the node
196
+     *
197
+     * @param string $name The new name
198
+     * @throws Forbidden
199
+     */
200
+    public function setName($name) {
201
+        throw new Forbidden('Permission denied to rename this collection');
202
+    }
203
+
204
+    /**
205
+     * Returns the last modification time, as a unix timestamp
206
+     *
207
+     * @return int
208
+     */
209
+    public function getLastModified() {
210
+        return null;
211
+    }
212 212
 }
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityTypeCollection.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -43,84 +43,84 @@
 block discarded – undo
43 43
  */
44 44
 class EntityTypeCollection extends RootCollection {
45 45
 
46
-	/** @var ILogger */
47
-	protected $logger;
46
+    /** @var ILogger */
47
+    protected $logger;
48 48
 
49
-	/** @var IUserManager */
50
-	protected $userManager;
49
+    /** @var IUserManager */
50
+    protected $userManager;
51 51
 
52
-	/** @var \Closure */
53
-	protected $childExistsFunction;
52
+    /** @var \Closure */
53
+    protected $childExistsFunction;
54 54
 
55
-	/**
56
-	 * @param string $name
57
-	 * @param ICommentsManager $commentsManager
58
-	 * @param IUserManager $userManager
59
-	 * @param IUserSession $userSession
60
-	 * @param ILogger $logger
61
-	 * @param \Closure $childExistsFunction
62
-	 */
63
-	public function __construct(
64
-		$name,
65
-		ICommentsManager $commentsManager,
66
-		IUserManager $userManager,
67
-		IUserSession $userSession,
68
-		ILogger $logger,
69
-		\Closure $childExistsFunction
70
-	) {
71
-		$name = trim($name);
72
-		if (empty($name) || !is_string($name)) {
73
-			throw new \InvalidArgumentException('"name" parameter must be non-empty string');
74
-		}
75
-		$this->name = $name;
76
-		$this->commentsManager = $commentsManager;
77
-		$this->logger = $logger;
78
-		$this->userManager = $userManager;
79
-		$this->userSession = $userSession;
80
-		$this->childExistsFunction = $childExistsFunction;
81
-	}
55
+    /**
56
+     * @param string $name
57
+     * @param ICommentsManager $commentsManager
58
+     * @param IUserManager $userManager
59
+     * @param IUserSession $userSession
60
+     * @param ILogger $logger
61
+     * @param \Closure $childExistsFunction
62
+     */
63
+    public function __construct(
64
+        $name,
65
+        ICommentsManager $commentsManager,
66
+        IUserManager $userManager,
67
+        IUserSession $userSession,
68
+        ILogger $logger,
69
+        \Closure $childExistsFunction
70
+    ) {
71
+        $name = trim($name);
72
+        if (empty($name) || !is_string($name)) {
73
+            throw new \InvalidArgumentException('"name" parameter must be non-empty string');
74
+        }
75
+        $this->name = $name;
76
+        $this->commentsManager = $commentsManager;
77
+        $this->logger = $logger;
78
+        $this->userManager = $userManager;
79
+        $this->userSession = $userSession;
80
+        $this->childExistsFunction = $childExistsFunction;
81
+    }
82 82
 
83
-	/**
84
-	 * Returns a specific child node, referenced by its name
85
-	 *
86
-	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
87
-	 * exist.
88
-	 *
89
-	 * @param string $name
90
-	 * @return \Sabre\DAV\INode
91
-	 * @throws NotFound
92
-	 */
93
-	public function getChild($name) {
94
-		if (!$this->childExists($name)) {
95
-			throw new NotFound('Entity does not exist or is not available');
96
-		}
97
-		return new EntityCollection(
98
-			$name,
99
-			$this->name,
100
-			$this->commentsManager,
101
-			$this->userManager,
102
-			$this->userSession,
103
-			$this->logger
104
-		);
105
-	}
83
+    /**
84
+     * Returns a specific child node, referenced by its name
85
+     *
86
+     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
87
+     * exist.
88
+     *
89
+     * @param string $name
90
+     * @return \Sabre\DAV\INode
91
+     * @throws NotFound
92
+     */
93
+    public function getChild($name) {
94
+        if (!$this->childExists($name)) {
95
+            throw new NotFound('Entity does not exist or is not available');
96
+        }
97
+        return new EntityCollection(
98
+            $name,
99
+            $this->name,
100
+            $this->commentsManager,
101
+            $this->userManager,
102
+            $this->userSession,
103
+            $this->logger
104
+        );
105
+    }
106 106
 
107
-	/**
108
-	 * Returns an array with all the child nodes
109
-	 *
110
-	 * @return \Sabre\DAV\INode[]
111
-	 * @throws MethodNotAllowed
112
-	 */
113
-	public function getChildren() {
114
-		throw new MethodNotAllowed('No permission to list folder contents');
115
-	}
107
+    /**
108
+     * Returns an array with all the child nodes
109
+     *
110
+     * @return \Sabre\DAV\INode[]
111
+     * @throws MethodNotAllowed
112
+     */
113
+    public function getChildren() {
114
+        throw new MethodNotAllowed('No permission to list folder contents');
115
+    }
116 116
 
117
-	/**
118
-	 * Checks if a child-node with the specified name exists
119
-	 *
120
-	 * @param string $name
121
-	 * @return bool
122
-	 */
123
-	public function childExists($name) {
124
-		return call_user_func($this->childExistsFunction, $name);
125
-	}
117
+    /**
118
+     * Checks if a child-node with the specified name exists
119
+     *
120
+     * @param string $name
121
+     * @return bool
122
+     */
123
+    public function childExists($name) {
124
+        return call_user_func($this->childExistsFunction, $name);
125
+    }
126 126
 }
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		foreach (['id', 'name'] as $property) {
69 69
 			$$property = trim($$property);
70 70
 			if (empty($$property) || !is_string($$property)) {
71
-				throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
71
+				throw new \InvalidArgumentException('"'.$property.'" parameter must be non-empty string');
72 72
 			}
73 73
 		}
74 74
 		$this->id = $id;
Please login to merge, or discard this patch.
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -42,155 +42,155 @@
 block discarded – undo
42 42
  * @package OCA\DAV\Comments
43 43
  */
44 44
 class EntityCollection extends RootCollection implements IProperties {
45
-	public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
45
+    public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
46 46
 
47
-	/** @var  string */
48
-	protected $id;
47
+    /** @var  string */
48
+    protected $id;
49 49
 
50
-	/** @var  ILogger */
51
-	protected $logger;
50
+    /** @var  ILogger */
51
+    protected $logger;
52 52
 
53
-	/**
54
-	 * @param string $id
55
-	 * @param string $name
56
-	 * @param ICommentsManager $commentsManager
57
-	 * @param IUserManager $userManager
58
-	 * @param IUserSession $userSession
59
-	 * @param ILogger $logger
60
-	 */
61
-	public function __construct(
62
-		$id,
63
-		$name,
64
-		ICommentsManager $commentsManager,
65
-		IUserManager $userManager,
66
-		IUserSession $userSession,
67
-		ILogger $logger
68
-	) {
69
-		foreach (['id', 'name'] as $property) {
70
-			$$property = trim($$property);
71
-			if (empty($$property) || !is_string($$property)) {
72
-				throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
73
-			}
74
-		}
75
-		$this->id = $id;
76
-		$this->name = $name;
77
-		$this->commentsManager = $commentsManager;
78
-		$this->logger = $logger;
79
-		$this->userManager = $userManager;
80
-		$this->userSession = $userSession;
81
-	}
53
+    /**
54
+     * @param string $id
55
+     * @param string $name
56
+     * @param ICommentsManager $commentsManager
57
+     * @param IUserManager $userManager
58
+     * @param IUserSession $userSession
59
+     * @param ILogger $logger
60
+     */
61
+    public function __construct(
62
+        $id,
63
+        $name,
64
+        ICommentsManager $commentsManager,
65
+        IUserManager $userManager,
66
+        IUserSession $userSession,
67
+        ILogger $logger
68
+    ) {
69
+        foreach (['id', 'name'] as $property) {
70
+            $$property = trim($$property);
71
+            if (empty($$property) || !is_string($$property)) {
72
+                throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string');
73
+            }
74
+        }
75
+        $this->id = $id;
76
+        $this->name = $name;
77
+        $this->commentsManager = $commentsManager;
78
+        $this->logger = $logger;
79
+        $this->userManager = $userManager;
80
+        $this->userSession = $userSession;
81
+    }
82 82
 
83
-	/**
84
-	 * returns the ID of this entity
85
-	 *
86
-	 * @return string
87
-	 */
88
-	public function getId() {
89
-		return $this->id;
90
-	}
83
+    /**
84
+     * returns the ID of this entity
85
+     *
86
+     * @return string
87
+     */
88
+    public function getId() {
89
+        return $this->id;
90
+    }
91 91
 
92
-	/**
93
-	 * Returns a specific child node, referenced by its name
94
-	 *
95
-	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
96
-	 * exist.
97
-	 *
98
-	 * @param string $name
99
-	 * @return \Sabre\DAV\INode
100
-	 * @throws NotFound
101
-	 */
102
-	public function getChild($name) {
103
-		try {
104
-			$comment = $this->commentsManager->get($name);
105
-			return new CommentNode(
106
-				$this->commentsManager,
107
-				$comment,
108
-				$this->userManager,
109
-				$this->userSession,
110
-				$this->logger
111
-			);
112
-		} catch (NotFoundException $e) {
113
-			throw new NotFound();
114
-		}
115
-	}
92
+    /**
93
+     * Returns a specific child node, referenced by its name
94
+     *
95
+     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
96
+     * exist.
97
+     *
98
+     * @param string $name
99
+     * @return \Sabre\DAV\INode
100
+     * @throws NotFound
101
+     */
102
+    public function getChild($name) {
103
+        try {
104
+            $comment = $this->commentsManager->get($name);
105
+            return new CommentNode(
106
+                $this->commentsManager,
107
+                $comment,
108
+                $this->userManager,
109
+                $this->userSession,
110
+                $this->logger
111
+            );
112
+        } catch (NotFoundException $e) {
113
+            throw new NotFound();
114
+        }
115
+    }
116 116
 
117
-	/**
118
-	 * Returns an array with all the child nodes
119
-	 *
120
-	 * @return \Sabre\DAV\INode[]
121
-	 */
122
-	public function getChildren() {
123
-		return $this->findChildren();
124
-	}
117
+    /**
118
+     * Returns an array with all the child nodes
119
+     *
120
+     * @return \Sabre\DAV\INode[]
121
+     */
122
+    public function getChildren() {
123
+        return $this->findChildren();
124
+    }
125 125
 
126
-	/**
127
-	 * Returns an array of comment nodes. Result can be influenced by offset,
128
-	 * limit and date time parameters.
129
-	 *
130
-	 * @param int $limit
131
-	 * @param int $offset
132
-	 * @param \DateTime|null $datetime
133
-	 * @return CommentNode[]
134
-	 */
135
-	public function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
136
-		$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
137
-		$result = [];
138
-		foreach ($comments as $comment) {
139
-			$result[] = new CommentNode(
140
-				$this->commentsManager,
141
-				$comment,
142
-				$this->userManager,
143
-				$this->userSession,
144
-				$this->logger
145
-			);
146
-		}
147
-		return $result;
148
-	}
126
+    /**
127
+     * Returns an array of comment nodes. Result can be influenced by offset,
128
+     * limit and date time parameters.
129
+     *
130
+     * @param int $limit
131
+     * @param int $offset
132
+     * @param \DateTime|null $datetime
133
+     * @return CommentNode[]
134
+     */
135
+    public function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
136
+        $comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
137
+        $result = [];
138
+        foreach ($comments as $comment) {
139
+            $result[] = new CommentNode(
140
+                $this->commentsManager,
141
+                $comment,
142
+                $this->userManager,
143
+                $this->userSession,
144
+                $this->logger
145
+            );
146
+        }
147
+        return $result;
148
+    }
149 149
 
150
-	/**
151
-	 * Checks if a child-node with the specified name exists
152
-	 *
153
-	 * @param string $name
154
-	 * @return bool
155
-	 */
156
-	public function childExists($name) {
157
-		try {
158
-			$this->commentsManager->get($name);
159
-			return true;
160
-		} catch (NotFoundException $e) {
161
-			return false;
162
-		}
163
-	}
150
+    /**
151
+     * Checks if a child-node with the specified name exists
152
+     *
153
+     * @param string $name
154
+     * @return bool
155
+     */
156
+    public function childExists($name) {
157
+        try {
158
+            $this->commentsManager->get($name);
159
+            return true;
160
+        } catch (NotFoundException $e) {
161
+            return false;
162
+        }
163
+    }
164 164
 
165
-	/**
166
-	 * Sets the read marker to the specified date for the logged in user
167
-	 *
168
-	 * @param \DateTime $value
169
-	 * @return bool
170
-	 */
171
-	public function setReadMarker($value) {
172
-		$dateTime = new \DateTime($value);
173
-		$user = $this->userSession->getUser();
174
-		$this->commentsManager->setReadMark($this->name, $this->id, $dateTime, $user);
175
-		return true;
176
-	}
165
+    /**
166
+     * Sets the read marker to the specified date for the logged in user
167
+     *
168
+     * @param \DateTime $value
169
+     * @return bool
170
+     */
171
+    public function setReadMarker($value) {
172
+        $dateTime = new \DateTime($value);
173
+        $user = $this->userSession->getUser();
174
+        $this->commentsManager->setReadMark($this->name, $this->id, $dateTime, $user);
175
+        return true;
176
+    }
177 177
 
178
-	/**
179
-	 * @inheritdoc
180
-	 */
181
-	public function propPatch(PropPatch $propPatch) {
182
-		$propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']);
183
-	}
178
+    /**
179
+     * @inheritdoc
180
+     */
181
+    public function propPatch(PropPatch $propPatch) {
182
+        $propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']);
183
+    }
184 184
 
185
-	/**
186
-	 * @inheritdoc
187
-	 */
188
-	public function getProperties($properties) {
189
-		$marker = null;
190
-		$user = $this->userSession->getUser();
191
-		if (!is_null($user)) {
192
-			$marker = $this->commentsManager->getReadMark($this->name, $this->id, $user);
193
-		}
194
-		return [self::PROPERTY_NAME_READ_MARKER => $marker];
195
-	}
185
+    /**
186
+     * @inheritdoc
187
+     */
188
+    public function getProperties($properties) {
189
+        $marker = null;
190
+        $user = $this->userSession->getUser();
191
+        if (!is_null($user)) {
192
+            $marker = $this->commentsManager->getReadMark($this->name, $this->id, $user);
193
+        }
194
+        return [self::PROPERTY_NAME_READ_MARKER => $marker];
195
+    }
196 196
 }
Please login to merge, or discard this patch.
apps/dav/lib/Comments/CommentNode.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 		$this->logger = $logger;
86 86
 
87 87
 		$methods = get_class_methods($this->comment);
88
-		$methods = array_filter($methods, function ($name) {
88
+		$methods = array_filter($methods, function($name) {
89 89
 			return strpos($name, 'get') === 0;
90 90
 		});
91 91
 		foreach ($methods as $getter) {
92 92
 			if ($getter === 'getMentions') {
93
-				continue;	// special treatment
93
+				continue; // special treatment
94 94
 			}
95
-			$name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3));
95
+			$name = '{'.self::NS_OWNCLOUD.'}'.lcfirst(substr($getter, 3));
96 96
 			$this->properties[$name] = $getter;
97 97
 		}
98 98
 		$this->userManager = $userManager;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			$this->logger->logException($e, ['app' => 'dav/comments']);
198 198
 			if ($e instanceof MessageTooLongException) {
199 199
 				$msg = 'Message exceeds allowed character limit of ';
200
-				throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
200
+				throw new BadRequest($msg.IComment::MAX_MESSAGE_LENGTH, 0, $e);
201 201
 			}
202 202
 			throw $e;
203 203
 		}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @return array
284 284
 	 */
285 285
 	protected function composeMentionsPropertyValue() {
286
-		return array_map(function ($mention) {
286
+		return array_map(function($mention) {
287 287
 			try {
288 288
 				$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
289 289
 			} catch (\OutOfBoundsException $e) {
Please login to merge, or discard this patch.
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -36,270 +36,270 @@
 block discarded – undo
36 36
 use Sabre\DAV\PropPatch;
37 37
 
38 38
 class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
39
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
39
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
40 40
 
41
-	public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}isUnread';
42
-	public const PROPERTY_NAME_MESSAGE = '{http://owncloud.org/ns}message';
43
-	public const PROPERTY_NAME_ACTOR_DISPLAYNAME = '{http://owncloud.org/ns}actorDisplayName';
44
-	public const PROPERTY_NAME_MENTIONS = '{http://owncloud.org/ns}mentions';
45
-	public const PROPERTY_NAME_MENTION = '{http://owncloud.org/ns}mention';
46
-	public const PROPERTY_NAME_MENTION_TYPE = '{http://owncloud.org/ns}mentionType';
47
-	public const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId';
48
-	public const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName';
41
+    public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}isUnread';
42
+    public const PROPERTY_NAME_MESSAGE = '{http://owncloud.org/ns}message';
43
+    public const PROPERTY_NAME_ACTOR_DISPLAYNAME = '{http://owncloud.org/ns}actorDisplayName';
44
+    public const PROPERTY_NAME_MENTIONS = '{http://owncloud.org/ns}mentions';
45
+    public const PROPERTY_NAME_MENTION = '{http://owncloud.org/ns}mention';
46
+    public const PROPERTY_NAME_MENTION_TYPE = '{http://owncloud.org/ns}mentionType';
47
+    public const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId';
48
+    public const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName';
49 49
 
50
-	/** @var  IComment */
51
-	public $comment;
50
+    /** @var  IComment */
51
+    public $comment;
52 52
 
53
-	/** @var ICommentsManager */
54
-	protected $commentsManager;
53
+    /** @var ICommentsManager */
54
+    protected $commentsManager;
55 55
 
56
-	/** @var  ILogger */
57
-	protected $logger;
56
+    /** @var  ILogger */
57
+    protected $logger;
58 58
 
59
-	/** @var array list of properties with key being their name and value their setter */
60
-	protected $properties = [];
59
+    /** @var array list of properties with key being their name and value their setter */
60
+    protected $properties = [];
61 61
 
62
-	/** @var IUserManager */
63
-	protected $userManager;
62
+    /** @var IUserManager */
63
+    protected $userManager;
64 64
 
65
-	/** @var IUserSession */
66
-	protected $userSession;
65
+    /** @var IUserSession */
66
+    protected $userSession;
67 67
 
68
-	/**
69
-	 * CommentNode constructor.
70
-	 *
71
-	 * @param ICommentsManager $commentsManager
72
-	 * @param IComment $comment
73
-	 * @param IUserManager $userManager
74
-	 * @param IUserSession $userSession
75
-	 * @param ILogger $logger
76
-	 */
77
-	public function __construct(
78
-		ICommentsManager $commentsManager,
79
-		IComment $comment,
80
-		IUserManager $userManager,
81
-		IUserSession $userSession,
82
-		ILogger $logger
83
-	) {
84
-		$this->commentsManager = $commentsManager;
85
-		$this->comment = $comment;
86
-		$this->logger = $logger;
68
+    /**
69
+     * CommentNode constructor.
70
+     *
71
+     * @param ICommentsManager $commentsManager
72
+     * @param IComment $comment
73
+     * @param IUserManager $userManager
74
+     * @param IUserSession $userSession
75
+     * @param ILogger $logger
76
+     */
77
+    public function __construct(
78
+        ICommentsManager $commentsManager,
79
+        IComment $comment,
80
+        IUserManager $userManager,
81
+        IUserSession $userSession,
82
+        ILogger $logger
83
+    ) {
84
+        $this->commentsManager = $commentsManager;
85
+        $this->comment = $comment;
86
+        $this->logger = $logger;
87 87
 
88
-		$methods = get_class_methods($this->comment);
89
-		$methods = array_filter($methods, function ($name) {
90
-			return strpos($name, 'get') === 0;
91
-		});
92
-		foreach ($methods as $getter) {
93
-			if ($getter === 'getMentions') {
94
-				continue;	// special treatment
95
-			}
96
-			$name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3));
97
-			$this->properties[$name] = $getter;
98
-		}
99
-		$this->userManager = $userManager;
100
-		$this->userSession = $userSession;
101
-	}
88
+        $methods = get_class_methods($this->comment);
89
+        $methods = array_filter($methods, function ($name) {
90
+            return strpos($name, 'get') === 0;
91
+        });
92
+        foreach ($methods as $getter) {
93
+            if ($getter === 'getMentions') {
94
+                continue;	// special treatment
95
+            }
96
+            $name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3));
97
+            $this->properties[$name] = $getter;
98
+        }
99
+        $this->userManager = $userManager;
100
+        $this->userSession = $userSession;
101
+    }
102 102
 
103
-	/**
104
-	 * returns a list of all possible property names
105
-	 *
106
-	 * @return array
107
-	 */
108
-	public static function getPropertyNames() {
109
-		return [
110
-			'{http://owncloud.org/ns}id',
111
-			'{http://owncloud.org/ns}parentId',
112
-			'{http://owncloud.org/ns}topmostParentId',
113
-			'{http://owncloud.org/ns}childrenCount',
114
-			'{http://owncloud.org/ns}verb',
115
-			'{http://owncloud.org/ns}actorType',
116
-			'{http://owncloud.org/ns}actorId',
117
-			'{http://owncloud.org/ns}creationDateTime',
118
-			'{http://owncloud.org/ns}latestChildDateTime',
119
-			'{http://owncloud.org/ns}objectType',
120
-			'{http://owncloud.org/ns}objectId',
121
-			// re-used property names are defined as constants
122
-			self::PROPERTY_NAME_MESSAGE,
123
-			self::PROPERTY_NAME_ACTOR_DISPLAYNAME,
124
-			self::PROPERTY_NAME_UNREAD,
125
-			self::PROPERTY_NAME_MENTIONS,
126
-			self::PROPERTY_NAME_MENTION,
127
-			self::PROPERTY_NAME_MENTION_TYPE,
128
-			self::PROPERTY_NAME_MENTION_ID,
129
-			self::PROPERTY_NAME_MENTION_DISPLAYNAME,
130
-		];
131
-	}
103
+    /**
104
+     * returns a list of all possible property names
105
+     *
106
+     * @return array
107
+     */
108
+    public static function getPropertyNames() {
109
+        return [
110
+            '{http://owncloud.org/ns}id',
111
+            '{http://owncloud.org/ns}parentId',
112
+            '{http://owncloud.org/ns}topmostParentId',
113
+            '{http://owncloud.org/ns}childrenCount',
114
+            '{http://owncloud.org/ns}verb',
115
+            '{http://owncloud.org/ns}actorType',
116
+            '{http://owncloud.org/ns}actorId',
117
+            '{http://owncloud.org/ns}creationDateTime',
118
+            '{http://owncloud.org/ns}latestChildDateTime',
119
+            '{http://owncloud.org/ns}objectType',
120
+            '{http://owncloud.org/ns}objectId',
121
+            // re-used property names are defined as constants
122
+            self::PROPERTY_NAME_MESSAGE,
123
+            self::PROPERTY_NAME_ACTOR_DISPLAYNAME,
124
+            self::PROPERTY_NAME_UNREAD,
125
+            self::PROPERTY_NAME_MENTIONS,
126
+            self::PROPERTY_NAME_MENTION,
127
+            self::PROPERTY_NAME_MENTION_TYPE,
128
+            self::PROPERTY_NAME_MENTION_ID,
129
+            self::PROPERTY_NAME_MENTION_DISPLAYNAME,
130
+        ];
131
+    }
132 132
 
133
-	protected function checkWriteAccessOnComment() {
134
-		$user = $this->userSession->getUser();
135
-		if ($this->comment->getActorType() !== 'users'
136
-			|| is_null($user)
137
-			|| $this->comment->getActorId() !== $user->getUID()
138
-		) {
139
-			throw new Forbidden('Only authors are allowed to edit their comment.');
140
-		}
141
-	}
133
+    protected function checkWriteAccessOnComment() {
134
+        $user = $this->userSession->getUser();
135
+        if ($this->comment->getActorType() !== 'users'
136
+            || is_null($user)
137
+            || $this->comment->getActorId() !== $user->getUID()
138
+        ) {
139
+            throw new Forbidden('Only authors are allowed to edit their comment.');
140
+        }
141
+    }
142 142
 
143
-	/**
144
-	 * Deleted the current node
145
-	 *
146
-	 * @return void
147
-	 */
148
-	public function delete() {
149
-		$this->checkWriteAccessOnComment();
150
-		$this->commentsManager->delete($this->comment->getId());
151
-	}
143
+    /**
144
+     * Deleted the current node
145
+     *
146
+     * @return void
147
+     */
148
+    public function delete() {
149
+        $this->checkWriteAccessOnComment();
150
+        $this->commentsManager->delete($this->comment->getId());
151
+    }
152 152
 
153
-	/**
154
-	 * Returns the name of the node.
155
-	 *
156
-	 * This is used to generate the url.
157
-	 *
158
-	 * @return string
159
-	 */
160
-	public function getName() {
161
-		return $this->comment->getId();
162
-	}
153
+    /**
154
+     * Returns the name of the node.
155
+     *
156
+     * This is used to generate the url.
157
+     *
158
+     * @return string
159
+     */
160
+    public function getName() {
161
+        return $this->comment->getId();
162
+    }
163 163
 
164
-	/**
165
-	 * Renames the node
166
-	 *
167
-	 * @param string $name The new name
168
-	 * @throws MethodNotAllowed
169
-	 */
170
-	public function setName($name) {
171
-		throw new MethodNotAllowed();
172
-	}
164
+    /**
165
+     * Renames the node
166
+     *
167
+     * @param string $name The new name
168
+     * @throws MethodNotAllowed
169
+     */
170
+    public function setName($name) {
171
+        throw new MethodNotAllowed();
172
+    }
173 173
 
174
-	/**
175
-	 * Returns the last modification time, as a unix timestamp
176
-	 *
177
-	 * @return int
178
-	 */
179
-	public function getLastModified() {
180
-		return null;
181
-	}
174
+    /**
175
+     * Returns the last modification time, as a unix timestamp
176
+     *
177
+     * @return int
178
+     */
179
+    public function getLastModified() {
180
+        return null;
181
+    }
182 182
 
183
-	/**
184
-	 * update the comment's message
185
-	 *
186
-	 * @param $propertyValue
187
-	 * @return bool
188
-	 * @throws BadRequest
189
-	 * @throws \Exception
190
-	 */
191
-	public function updateComment($propertyValue) {
192
-		$this->checkWriteAccessOnComment();
193
-		try {
194
-			$this->comment->setMessage($propertyValue);
195
-			$this->commentsManager->save($this->comment);
196
-			return true;
197
-		} catch (\Exception $e) {
198
-			$this->logger->logException($e, ['app' => 'dav/comments']);
199
-			if ($e instanceof MessageTooLongException) {
200
-				$msg = 'Message exceeds allowed character limit of ';
201
-				throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
202
-			}
203
-			throw $e;
204
-		}
205
-	}
183
+    /**
184
+     * update the comment's message
185
+     *
186
+     * @param $propertyValue
187
+     * @return bool
188
+     * @throws BadRequest
189
+     * @throws \Exception
190
+     */
191
+    public function updateComment($propertyValue) {
192
+        $this->checkWriteAccessOnComment();
193
+        try {
194
+            $this->comment->setMessage($propertyValue);
195
+            $this->commentsManager->save($this->comment);
196
+            return true;
197
+        } catch (\Exception $e) {
198
+            $this->logger->logException($e, ['app' => 'dav/comments']);
199
+            if ($e instanceof MessageTooLongException) {
200
+                $msg = 'Message exceeds allowed character limit of ';
201
+                throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
202
+            }
203
+            throw $e;
204
+        }
205
+    }
206 206
 
207
-	/**
208
-	 * Updates properties on this node.
209
-	 *
210
-	 * This method received a PropPatch object, which contains all the
211
-	 * information about the update.
212
-	 *
213
-	 * To update specific properties, call the 'handle' method on this object.
214
-	 * Read the PropPatch documentation for more information.
215
-	 *
216
-	 * @param PropPatch $propPatch
217
-	 * @return void
218
-	 */
219
-	public function propPatch(PropPatch $propPatch) {
220
-		// other properties than 'message' are read only
221
-		$propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']);
222
-	}
207
+    /**
208
+     * Updates properties on this node.
209
+     *
210
+     * This method received a PropPatch object, which contains all the
211
+     * information about the update.
212
+     *
213
+     * To update specific properties, call the 'handle' method on this object.
214
+     * Read the PropPatch documentation for more information.
215
+     *
216
+     * @param PropPatch $propPatch
217
+     * @return void
218
+     */
219
+    public function propPatch(PropPatch $propPatch) {
220
+        // other properties than 'message' are read only
221
+        $propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']);
222
+    }
223 223
 
224
-	/**
225
-	 * Returns a list of properties for this nodes.
226
-	 *
227
-	 * The properties list is a list of propertynames the client requested,
228
-	 * encoded in clark-notation {xmlnamespace}tagname
229
-	 *
230
-	 * If the array is empty, it means 'all properties' were requested.
231
-	 *
232
-	 * Note that it's fine to liberally give properties back, instead of
233
-	 * conforming to the list of requested properties.
234
-	 * The Server class will filter out the extra.
235
-	 *
236
-	 * @param array $properties
237
-	 * @return array
238
-	 */
239
-	public function getProperties($properties) {
240
-		$properties = array_keys($this->properties);
224
+    /**
225
+     * Returns a list of properties for this nodes.
226
+     *
227
+     * The properties list is a list of propertynames the client requested,
228
+     * encoded in clark-notation {xmlnamespace}tagname
229
+     *
230
+     * If the array is empty, it means 'all properties' were requested.
231
+     *
232
+     * Note that it's fine to liberally give properties back, instead of
233
+     * conforming to the list of requested properties.
234
+     * The Server class will filter out the extra.
235
+     *
236
+     * @param array $properties
237
+     * @return array
238
+     */
239
+    public function getProperties($properties) {
240
+        $properties = array_keys($this->properties);
241 241
 
242
-		$result = [];
243
-		foreach ($properties as $property) {
244
-			$getter = $this->properties[$property];
245
-			if (method_exists($this->comment, $getter)) {
246
-				$result[$property] = $this->comment->$getter();
247
-			}
248
-		}
242
+        $result = [];
243
+        foreach ($properties as $property) {
244
+            $getter = $this->properties[$property];
245
+            if (method_exists($this->comment, $getter)) {
246
+                $result[$property] = $this->comment->$getter();
247
+            }
248
+        }
249 249
 
250
-		if ($this->comment->getActorType() === 'users') {
251
-			$user = $this->userManager->get($this->comment->getActorId());
252
-			$displayName = is_null($user) ? null : $user->getDisplayName();
253
-			$result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName;
254
-		}
250
+        if ($this->comment->getActorType() === 'users') {
251
+            $user = $this->userManager->get($this->comment->getActorId());
252
+            $displayName = is_null($user) ? null : $user->getDisplayName();
253
+            $result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName;
254
+        }
255 255
 
256
-		$result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue();
256
+        $result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue();
257 257
 
258
-		$unread = null;
259
-		$user = $this->userSession->getUser();
260
-		if (!is_null($user)) {
261
-			$readUntil = $this->commentsManager->getReadMark(
262
-				$this->comment->getObjectType(),
263
-				$this->comment->getObjectId(),
264
-				$user
265
-			);
266
-			if (is_null($readUntil)) {
267
-				$unread = 'true';
268
-			} else {
269
-				$unread = $this->comment->getCreationDateTime() > $readUntil;
270
-				// re-format for output
271
-				$unread = $unread ? 'true' : 'false';
272
-			}
273
-		}
274
-		$result[self::PROPERTY_NAME_UNREAD] = $unread;
258
+        $unread = null;
259
+        $user = $this->userSession->getUser();
260
+        if (!is_null($user)) {
261
+            $readUntil = $this->commentsManager->getReadMark(
262
+                $this->comment->getObjectType(),
263
+                $this->comment->getObjectId(),
264
+                $user
265
+            );
266
+            if (is_null($readUntil)) {
267
+                $unread = 'true';
268
+            } else {
269
+                $unread = $this->comment->getCreationDateTime() > $readUntil;
270
+                // re-format for output
271
+                $unread = $unread ? 'true' : 'false';
272
+            }
273
+        }
274
+        $result[self::PROPERTY_NAME_UNREAD] = $unread;
275 275
 
276
-		return $result;
277
-	}
276
+        return $result;
277
+    }
278 278
 
279
-	/**
280
-	 * transforms a mentions array as returned from IComment->getMentions to an
281
-	 * array with DAV-compatible structure that can be assigned to the
282
-	 * PROPERTY_NAME_MENTION property.
283
-	 *
284
-	 * @return array
285
-	 */
286
-	protected function composeMentionsPropertyValue() {
287
-		return array_map(function ($mention) {
288
-			try {
289
-				$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
290
-			} catch (\OutOfBoundsException $e) {
291
-				$this->logger->logException($e);
292
-				// No displayname, upon client's discretion what to display.
293
-				$displayName = '';
294
-			}
279
+    /**
280
+     * transforms a mentions array as returned from IComment->getMentions to an
281
+     * array with DAV-compatible structure that can be assigned to the
282
+     * PROPERTY_NAME_MENTION property.
283
+     *
284
+     * @return array
285
+     */
286
+    protected function composeMentionsPropertyValue() {
287
+        return array_map(function ($mention) {
288
+            try {
289
+                $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
290
+            } catch (\OutOfBoundsException $e) {
291
+                $this->logger->logException($e);
292
+                // No displayname, upon client's discretion what to display.
293
+                $displayName = '';
294
+            }
295 295
 
296
-			return [
297
-				self::PROPERTY_NAME_MENTION => [
298
-					self::PROPERTY_NAME_MENTION_TYPE => $mention['type'],
299
-					self::PROPERTY_NAME_MENTION_ID => $mention['id'],
300
-					self::PROPERTY_NAME_MENTION_DISPLAYNAME => $displayName,
301
-				]
302
-			];
303
-		}, $this->comment->getMentions());
304
-	}
296
+            return [
297
+                self::PROPERTY_NAME_MENTION => [
298
+                    self::PROPERTY_NAME_MENTION_TYPE => $mention['type'],
299
+                    self::PROPERTY_NAME_MENTION_ID => $mention['id'],
300
+                    self::PROPERTY_NAME_MENTION_DISPLAYNAME => $displayName,
301
+                ]
302
+            ];
303
+        }, $this->comment->getMentions());
304
+    }
305 305
 }
Please login to merge, or discard this patch.
apps/dav/lib/Files/Sharing/FilesDropPlugin.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 		$path = array_pop($path);
78 78
 
79 79
 		$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
80
-		$url = $request->getBaseUrl() . $newName;
80
+		$url = $request->getBaseUrl().$newName;
81 81
 		$request->setUrl($url);
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,51 +35,51 @@
 block discarded – undo
35 35
  */
36 36
 class FilesDropPlugin extends ServerPlugin {
37 37
 
38
-	/** @var View */
39
-	private $view;
38
+    /** @var View */
39
+    private $view;
40 40
 
41
-	/** @var bool */
42
-	private $enabled = false;
41
+    /** @var bool */
42
+    private $enabled = false;
43 43
 
44
-	/**
45
-	 * @param View $view
46
-	 */
47
-	public function setView($view) {
48
-		$this->view = $view;
49
-	}
44
+    /**
45
+     * @param View $view
46
+     */
47
+    public function setView($view) {
48
+        $this->view = $view;
49
+    }
50 50
 
51
-	public function enable() {
52
-		$this->enabled = true;
53
-	}
51
+    public function enable() {
52
+        $this->enabled = true;
53
+    }
54 54
 
55 55
 
56
-	/**
57
-	 * This initializes the plugin.
58
-	 *
59
-	 * @param \Sabre\DAV\Server $server Sabre server
60
-	 *
61
-	 * @return void
62
-	 * @throws MethodNotAllowed
63
-	 */
64
-	public function initialize(\Sabre\DAV\Server $server) {
65
-		$server->on('beforeMethod:*', [$this, 'beforeMethod'], 999);
66
-		$this->enabled = false;
67
-	}
56
+    /**
57
+     * This initializes the plugin.
58
+     *
59
+     * @param \Sabre\DAV\Server $server Sabre server
60
+     *
61
+     * @return void
62
+     * @throws MethodNotAllowed
63
+     */
64
+    public function initialize(\Sabre\DAV\Server $server) {
65
+        $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999);
66
+        $this->enabled = false;
67
+    }
68 68
 
69
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
70
-		if (!$this->enabled) {
71
-			return;
72
-		}
69
+    public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
70
+        if (!$this->enabled) {
71
+            return;
72
+        }
73 73
 
74
-		if ($request->getMethod() !== 'PUT') {
75
-			throw new MethodNotAllowed('Only PUT is allowed on files drop');
76
-		}
74
+        if ($request->getMethod() !== 'PUT') {
75
+            throw new MethodNotAllowed('Only PUT is allowed on files drop');
76
+        }
77 77
 
78
-		$path = explode('/', $request->getPath());
79
-		$path = array_pop($path);
78
+        $path = explode('/', $request->getPath());
79
+        $path = array_pop($path);
80 80
 
81
-		$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
82
-		$url = $request->getBaseUrl() . $newName;
83
-		$request->setUrl($url);
84
-	}
81
+        $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
82
+        $url = $request->getBaseUrl() . $newName;
83
+        $request->setUrl($url);
84
+    }
85 85
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncSystemAddressBook.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 		$output->writeln('Syncing users ...');
55 55
 		$progress = new ProgressBar($output);
56 56
 		$progress->start();
57
-		$this->syncService->syncInstance(function () use ($progress) {
57
+		$this->syncService->syncInstance(function() use ($progress) {
58 58
 			$progress->advance();
59 59
 		});
60 60
 
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,37 +32,37 @@
 block discarded – undo
32 32
 
33 33
 class SyncSystemAddressBook extends Command {
34 34
 
35
-	/** @var SyncService */
36
-	private $syncService;
35
+    /** @var SyncService */
36
+    private $syncService;
37 37
 
38
-	/**
39
-	 * @param SyncService $syncService
40
-	 */
41
-	public function __construct(SyncService $syncService) {
42
-		parent::__construct();
43
-		$this->syncService = $syncService;
44
-	}
38
+    /**
39
+     * @param SyncService $syncService
40
+     */
41
+    public function __construct(SyncService $syncService) {
42
+        parent::__construct();
43
+        $this->syncService = $syncService;
44
+    }
45 45
 
46
-	protected function configure() {
47
-		$this
48
-			->setName('dav:sync-system-addressbook')
49
-			->setDescription('Synchronizes users to the system addressbook');
50
-	}
46
+    protected function configure() {
47
+        $this
48
+            ->setName('dav:sync-system-addressbook')
49
+            ->setDescription('Synchronizes users to the system addressbook');
50
+    }
51 51
 
52
-	/**
53
-	 * @param InputInterface $input
54
-	 * @param OutputInterface $output
55
-	 */
56
-	protected function execute(InputInterface $input, OutputInterface $output): int {
57
-		$output->writeln('Syncing users ...');
58
-		$progress = new ProgressBar($output);
59
-		$progress->start();
60
-		$this->syncService->syncInstance(function () use ($progress) {
61
-			$progress->advance();
62
-		});
52
+    /**
53
+     * @param InputInterface $input
54
+     * @param OutputInterface $output
55
+     */
56
+    protected function execute(InputInterface $input, OutputInterface $output): int {
57
+        $output->writeln('Syncing users ...');
58
+        $progress = new ProgressBar($output);
59
+        $progress->start();
60
+        $this->syncService->syncInstance(function () use ($progress) {
61
+            $progress->advance();
62
+        });
63 63
 
64
-		$progress->finish();
65
-		$output->writeln('');
66
-		return 0;
67
-	}
64
+        $progress->finish();
65
+        $output->writeln('');
66
+        return 0;
67
+    }
68 68
 }
Please login to merge, or discard this patch.