Completed
Push — master ( a67720...be1982 )
by Daniel
19:40 queued 14s
created
apps/workflowengine/lib/Check/FileSystemTags.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	public function supportedEntities(): array {
158
-		return [ File::class ];
158
+		return [File::class];
159 159
 	}
160 160
 
161 161
 	public function isAvailableForScope(int $scope): bool {
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -21,138 +21,138 @@
 block discarded – undo
21 21
 use OCP\WorkflowEngine\IFileCheck;
22 22
 
23 23
 class FileSystemTags implements ICheck, IFileCheck {
24
-	use TFileCheck;
25
-
26
-	/** @var array */
27
-	protected $fileIds;
28
-
29
-	/** @var array */
30
-	protected $fileSystemTags;
31
-
32
-	public function __construct(
33
-		protected IL10N $l,
34
-		protected ISystemTagManager $systemTagManager,
35
-		protected ISystemTagObjectMapper $systemTagObjectMapper,
36
-		protected IUserSession $userSession,
37
-		protected IGroupManager $groupManager,
38
-	) {
39
-	}
40
-
41
-	/**
42
-	 * @param string $operator
43
-	 * @param string $value
44
-	 * @return bool
45
-	 */
46
-	public function executeCheck($operator, $value) {
47
-		$systemTags = $this->getSystemTags();
48
-		return ($operator === 'is') === in_array($value, $systemTags);
49
-	}
50
-
51
-	/**
52
-	 * @param string $operator
53
-	 * @param string $value
54
-	 * @throws \UnexpectedValueException
55
-	 */
56
-	public function validateCheck($operator, $value) {
57
-		if (!in_array($operator, ['is', '!is'])) {
58
-			throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
59
-		}
60
-
61
-		try {
62
-			$tags = $this->systemTagManager->getTagsByIds($value);
63
-
64
-			$user = $this->userSession->getUser();
65
-			$isAdmin = $user instanceof IUser && $this->groupManager->isAdmin($user->getUID());
66
-
67
-			if (!$isAdmin) {
68
-				foreach ($tags as $tag) {
69
-					if (!$tag->isUserVisible()) {
70
-						throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 4);
71
-					}
72
-				}
73
-			}
74
-		} catch (TagNotFoundException $e) {
75
-			throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 2);
76
-		} catch (\InvalidArgumentException $e) {
77
-			throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 3);
78
-		}
79
-	}
80
-
81
-	/**
82
-	 * Get the ids of the assigned system tags
83
-	 * @return string[]
84
-	 */
85
-	protected function getSystemTags() {
86
-		$cache = $this->storage->getCache();
87
-		$fileIds = $this->getFileIds($cache, $this->path, !$this->storage->instanceOfStorage(IHomeStorage::class) || $this->storage->instanceOfStorage(SharedStorage::class));
88
-
89
-		$systemTags = [];
90
-		foreach ($fileIds as $i => $fileId) {
91
-			if (isset($this->fileSystemTags[$fileId])) {
92
-				$systemTags[] = $this->fileSystemTags[$fileId];
93
-				unset($fileIds[$i]);
94
-			}
95
-		}
96
-
97
-		if (!empty($fileIds)) {
98
-			$mappedSystemTags = $this->systemTagObjectMapper->getTagIdsForObjects($fileIds, 'files');
99
-			foreach ($mappedSystemTags as $fileId => $fileSystemTags) {
100
-				$this->fileSystemTags[$fileId] = $fileSystemTags;
101
-				$systemTags[] = $fileSystemTags;
102
-			}
103
-		}
104
-
105
-		$systemTags = call_user_func_array('array_merge', $systemTags);
106
-		$systemTags = array_unique($systemTags);
107
-		return $systemTags;
108
-	}
109
-
110
-	/**
111
-	 * Get the file ids of the given path and its parents
112
-	 * @param ICache $cache
113
-	 * @param string $path
114
-	 * @param bool $isExternalStorage
115
-	 * @return int[]
116
-	 */
117
-	protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
118
-		$cacheId = $cache->getNumericStorageId();
119
-		if ($this->storage->instanceOfStorage(Jail::class)) {
120
-			$absolutePath = $this->storage->getUnjailedPath($path);
121
-		} else {
122
-			$absolutePath = $path;
123
-		}
124
-
125
-		if (isset($this->fileIds[$cacheId][$absolutePath])) {
126
-			return $this->fileIds[$cacheId][$absolutePath];
127
-		}
128
-
129
-		$parentIds = [];
130
-		if ($path !== $this->dirname($path)) {
131
-			$parentIds = $this->getFileIds($cache, $this->dirname($path), $isExternalStorage);
132
-		} elseif (!$isExternalStorage) {
133
-			return [];
134
-		}
135
-
136
-		$fileId = $cache->getId($path);
137
-		if ($fileId !== -1) {
138
-			$parentIds[] = $fileId;
139
-		}
140
-
141
-		$this->fileIds[$cacheId][$absolutePath] = $parentIds;
142
-
143
-		return $parentIds;
144
-	}
145
-
146
-	protected function dirname($path) {
147
-		$dir = dirname($path);
148
-		return $dir === '.' ? '' : $dir;
149
-	}
150
-
151
-	public function supportedEntities(): array {
152
-		return [ File::class ];
153
-	}
154
-
155
-	public function isAvailableForScope(int $scope): bool {
156
-		return true;
157
-	}
24
+    use TFileCheck;
25
+
26
+    /** @var array */
27
+    protected $fileIds;
28
+
29
+    /** @var array */
30
+    protected $fileSystemTags;
31
+
32
+    public function __construct(
33
+        protected IL10N $l,
34
+        protected ISystemTagManager $systemTagManager,
35
+        protected ISystemTagObjectMapper $systemTagObjectMapper,
36
+        protected IUserSession $userSession,
37
+        protected IGroupManager $groupManager,
38
+    ) {
39
+    }
40
+
41
+    /**
42
+     * @param string $operator
43
+     * @param string $value
44
+     * @return bool
45
+     */
46
+    public function executeCheck($operator, $value) {
47
+        $systemTags = $this->getSystemTags();
48
+        return ($operator === 'is') === in_array($value, $systemTags);
49
+    }
50
+
51
+    /**
52
+     * @param string $operator
53
+     * @param string $value
54
+     * @throws \UnexpectedValueException
55
+     */
56
+    public function validateCheck($operator, $value) {
57
+        if (!in_array($operator, ['is', '!is'])) {
58
+            throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
59
+        }
60
+
61
+        try {
62
+            $tags = $this->systemTagManager->getTagsByIds($value);
63
+
64
+            $user = $this->userSession->getUser();
65
+            $isAdmin = $user instanceof IUser && $this->groupManager->isAdmin($user->getUID());
66
+
67
+            if (!$isAdmin) {
68
+                foreach ($tags as $tag) {
69
+                    if (!$tag->isUserVisible()) {
70
+                        throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 4);
71
+                    }
72
+                }
73
+            }
74
+        } catch (TagNotFoundException $e) {
75
+            throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 2);
76
+        } catch (\InvalidArgumentException $e) {
77
+            throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 3);
78
+        }
79
+    }
80
+
81
+    /**
82
+     * Get the ids of the assigned system tags
83
+     * @return string[]
84
+     */
85
+    protected function getSystemTags() {
86
+        $cache = $this->storage->getCache();
87
+        $fileIds = $this->getFileIds($cache, $this->path, !$this->storage->instanceOfStorage(IHomeStorage::class) || $this->storage->instanceOfStorage(SharedStorage::class));
88
+
89
+        $systemTags = [];
90
+        foreach ($fileIds as $i => $fileId) {
91
+            if (isset($this->fileSystemTags[$fileId])) {
92
+                $systemTags[] = $this->fileSystemTags[$fileId];
93
+                unset($fileIds[$i]);
94
+            }
95
+        }
96
+
97
+        if (!empty($fileIds)) {
98
+            $mappedSystemTags = $this->systemTagObjectMapper->getTagIdsForObjects($fileIds, 'files');
99
+            foreach ($mappedSystemTags as $fileId => $fileSystemTags) {
100
+                $this->fileSystemTags[$fileId] = $fileSystemTags;
101
+                $systemTags[] = $fileSystemTags;
102
+            }
103
+        }
104
+
105
+        $systemTags = call_user_func_array('array_merge', $systemTags);
106
+        $systemTags = array_unique($systemTags);
107
+        return $systemTags;
108
+    }
109
+
110
+    /**
111
+     * Get the file ids of the given path and its parents
112
+     * @param ICache $cache
113
+     * @param string $path
114
+     * @param bool $isExternalStorage
115
+     * @return int[]
116
+     */
117
+    protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
118
+        $cacheId = $cache->getNumericStorageId();
119
+        if ($this->storage->instanceOfStorage(Jail::class)) {
120
+            $absolutePath = $this->storage->getUnjailedPath($path);
121
+        } else {
122
+            $absolutePath = $path;
123
+        }
124
+
125
+        if (isset($this->fileIds[$cacheId][$absolutePath])) {
126
+            return $this->fileIds[$cacheId][$absolutePath];
127
+        }
128
+
129
+        $parentIds = [];
130
+        if ($path !== $this->dirname($path)) {
131
+            $parentIds = $this->getFileIds($cache, $this->dirname($path), $isExternalStorage);
132
+        } elseif (!$isExternalStorage) {
133
+            return [];
134
+        }
135
+
136
+        $fileId = $cache->getId($path);
137
+        if ($fileId !== -1) {
138
+            $parentIds[] = $fileId;
139
+        }
140
+
141
+        $this->fileIds[$cacheId][$absolutePath] = $parentIds;
142
+
143
+        return $parentIds;
144
+    }
145
+
146
+    protected function dirname($path) {
147
+        $dir = dirname($path);
148
+        return $dir === '.' ? '' : $dir;
149
+    }
150
+
151
+    public function supportedEntities(): array {
152
+        return [ File::class ];
153
+    }
154
+
155
+    public function isAvailableForScope(int $scope): bool {
156
+        return true;
157
+    }
158 158
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/IEntityCheck.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@
 block discarded – undo
34 34
  * @since 18.0.0
35 35
  */
36 36
 interface IEntityCheck {
37
-	/**
38
-	 * Equips the check with a subject fitting the Entity. For instance, an
39
-	 * entity of File will receive an instance of OCP\Files\Node, or a comment
40
-	 * entity might get an IComment.
41
-	 *
42
-	 * The implementing check must be aware of the incoming type.
43
-	 *
44
-	 * If an unsupported subject is passed the implementation MAY throw an
45
-	 * \UnexpectedValueException.
46
-	 *
47
-	 * @param IEntity $entity
48
-	 * @param mixed $subject
49
-	 * @throws \UnexpectedValueException
50
-	 * @since 18.0.0
51
-	 */
52
-	public function setEntitySubject(IEntity $entity, $subject): void;
37
+    /**
38
+     * Equips the check with a subject fitting the Entity. For instance, an
39
+     * entity of File will receive an instance of OCP\Files\Node, or a comment
40
+     * entity might get an IComment.
41
+     *
42
+     * The implementing check must be aware of the incoming type.
43
+     *
44
+     * If an unsupported subject is passed the implementation MAY throw an
45
+     * \UnexpectedValueException.
46
+     *
47
+     * @param IEntity $entity
48
+     * @param mixed $subject
49
+     * @throws \UnexpectedValueException
50
+     * @since 18.0.0
51
+     */
52
+    public function setEntitySubject(IEntity $entity, $subject): void;
53 53
 
54 54
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/ICheck.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -31,43 +31,43 @@
 block discarded – undo
31 31
  * @since 9.1
32 32
  */
33 33
 interface ICheck {
34
-	/**
35
-	 * @param string $operator
36
-	 * @param string $value
37
-	 * @return bool
38
-	 * @since 9.1
39
-	 */
40
-	public function executeCheck($operator, $value);
34
+    /**
35
+     * @param string $operator
36
+     * @param string $value
37
+     * @return bool
38
+     * @since 9.1
39
+     */
40
+    public function executeCheck($operator, $value);
41 41
 
42
-	/**
43
-	 * @param string $operator
44
-	 * @param string $value
45
-	 * @throws \UnexpectedValueException
46
-	 * @since 9.1
47
-	 */
48
-	public function validateCheck($operator, $value);
42
+    /**
43
+     * @param string $operator
44
+     * @param string $value
45
+     * @throws \UnexpectedValueException
46
+     * @since 9.1
47
+     */
48
+    public function validateCheck($operator, $value);
49 49
 
50
-	/**
51
-	 * returns a list of Entities the checker supports. The values must match
52
-	 * the class name of the entity.
53
-	 *
54
-	 * An empty result means the check is universally available.
55
-	 *
56
-	 * @since 18.0.0
57
-	 */
58
-	public function supportedEntities(): array;
50
+    /**
51
+     * returns a list of Entities the checker supports. The values must match
52
+     * the class name of the entity.
53
+     *
54
+     * An empty result means the check is universally available.
55
+     *
56
+     * @since 18.0.0
57
+     */
58
+    public function supportedEntities(): array;
59 59
 
60
-	/**
61
-	 * returns whether the operation can be used in the requested scope.
62
-	 *
63
-	 * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At
64
-	 * time of writing these are SCOPE_ADMIN and SCOPE_USER.
65
-	 *
66
-	 * For possibly unknown future scopes the recommended behaviour is: if
67
-	 * user scope is permitted, the default behaviour should return `true`,
68
-	 * otherwise `false`.
69
-	 *
70
-	 * @since 18.0.0
71
-	 */
72
-	public function isAvailableForScope(int $scope): bool;
60
+    /**
61
+     * returns whether the operation can be used in the requested scope.
62
+     *
63
+     * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At
64
+     * time of writing these are SCOPE_ADMIN and SCOPE_USER.
65
+     *
66
+     * For possibly unknown future scopes the recommended behaviour is: if
67
+     * user scope is permitted, the default behaviour should return `true`,
68
+     * otherwise `false`.
69
+     *
70
+     * @since 18.0.0
71
+     */
72
+    public function isAvailableForScope(int $scope): bool;
73 73
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/IEntityEvent.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@
 block discarded – undo
34 34
  * @since 18.0.0
35 35
  */
36 36
 interface IEntityEvent {
37
-	/**
38
-	 * returns a translated name to be presented in the web interface.
39
-	 *
40
-	 * Example: "created" (en), "kreita" (eo)
41
-	 *
42
-	 * @since 18.0.0
43
-	 */
44
-	public function getDisplayName(): string;
37
+    /**
38
+     * returns a translated name to be presented in the web interface.
39
+     *
40
+     * Example: "created" (en), "kreita" (eo)
41
+     *
42
+     * @since 18.0.0
43
+     */
44
+    public function getDisplayName(): string;
45 45
 
46
-	/**
47
-	 * returns the event name that is emitted by the EventDispatcher, e.g.:
48
-	 *
49
-	 * Example: "OCA\MyApp\Factory\Cats::postCreated"
50
-	 *
51
-	 * @since 18.0.0
52
-	 */
53
-	public function getEventName(): string;
46
+    /**
47
+     * returns the event name that is emitted by the EventDispatcher, e.g.:
48
+     *
49
+     * Example: "OCA\MyApp\Factory\Cats::postCreated"
50
+     *
51
+     * @since 18.0.0
52
+     */
53
+    public function getEventName(): string;
54 54
 }
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/appinfo/routes.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 // @codeCoverageIgnoreStart
23 23
 return [
24
-	'routes' => [
25
-		[
26
-			'name' => 'settings#createCodes',
27
-			'url' => '/settings/create',
28
-			'verb' => 'POST'
29
-		],
30
-	]
24
+    'routes' => [
25
+        [
26
+            'name' => 'settings#createCodes',
27
+            'url' => '/settings/create',
28
+            'verb' => 'POST'
29
+        ],
30
+    ]
31 31
 ];
32 32
 // @codeCoverageIgnoreEnd
Please login to merge, or discard this patch.
apps/workflowengine/lib/Check/FileSize.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	public function supportedEntities(): array {
158
-		return [ File::class ];
158
+		return [File::class];
159 159
 	}
160 160
 
161 161
 	public function isAvailableForScope(int $scope): bool {
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -13,86 +13,86 @@
 block discarded – undo
13 13
 
14 14
 class FileSize implements ICheck {
15 15
 
16
-	/** @var int */
17
-	protected $size;
16
+    /** @var int */
17
+    protected $size;
18 18
 
19
-	/**
20
-	 * @param IL10N $l
21
-	 * @param IRequest $request
22
-	 */
23
-	public function __construct(
24
-		protected IL10N $l,
25
-		protected IRequest $request,
26
-	) {
27
-	}
19
+    /**
20
+     * @param IL10N $l
21
+     * @param IRequest $request
22
+     */
23
+    public function __construct(
24
+        protected IL10N $l,
25
+        protected IRequest $request,
26
+    ) {
27
+    }
28 28
 
29
-	/**
30
-	 * @param string $operator
31
-	 * @param string $value
32
-	 * @return bool
33
-	 */
34
-	public function executeCheck($operator, $value) {
35
-		$size = $this->getFileSizeFromHeader();
29
+    /**
30
+     * @param string $operator
31
+     * @param string $value
32
+     * @return bool
33
+     */
34
+    public function executeCheck($operator, $value) {
35
+        $size = $this->getFileSizeFromHeader();
36 36
 
37
-		$value = Util::computerFileSize($value);
38
-		if ($size !== false) {
39
-			switch ($operator) {
40
-				case 'less':
41
-					return $size < $value;
42
-				case '!less':
43
-					return $size >= $value;
44
-				case 'greater':
45
-					return $size > $value;
46
-				case '!greater':
47
-					return $size <= $value;
48
-			}
49
-		}
50
-		return false;
51
-	}
37
+        $value = Util::computerFileSize($value);
38
+        if ($size !== false) {
39
+            switch ($operator) {
40
+                case 'less':
41
+                    return $size < $value;
42
+                case '!less':
43
+                    return $size >= $value;
44
+                case 'greater':
45
+                    return $size > $value;
46
+                case '!greater':
47
+                    return $size <= $value;
48
+            }
49
+        }
50
+        return false;
51
+    }
52 52
 
53
-	/**
54
-	 * @param string $operator
55
-	 * @param string $value
56
-	 * @throws \UnexpectedValueException
57
-	 */
58
-	public function validateCheck($operator, $value) {
59
-		if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) {
60
-			throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
61
-		}
53
+    /**
54
+     * @param string $operator
55
+     * @param string $value
56
+     * @throws \UnexpectedValueException
57
+     */
58
+    public function validateCheck($operator, $value) {
59
+        if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) {
60
+            throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
61
+        }
62 62
 
63
-		if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) {
64
-			throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2);
65
-		}
66
-	}
63
+        if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) {
64
+            throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2);
65
+        }
66
+    }
67 67
 
68
-	/**
69
-	 * @return string
70
-	 */
71
-	protected function getFileSizeFromHeader() {
72
-		if ($this->size !== null) {
73
-			return $this->size;
74
-		}
68
+    /**
69
+     * @return string
70
+     */
71
+    protected function getFileSizeFromHeader() {
72
+        if ($this->size !== null) {
73
+            return $this->size;
74
+        }
75 75
 
76
-		$size = $this->request->getHeader('OC-Total-Length');
77
-		if ($size === '') {
78
-			if (in_array($this->request->getMethod(), ['POST', 'PUT'])) {
79
-				$size = $this->request->getHeader('Content-Length');
80
-			}
81
-		}
76
+        $size = $this->request->getHeader('OC-Total-Length');
77
+        if ($size === '') {
78
+            if (in_array($this->request->getMethod(), ['POST', 'PUT'])) {
79
+                $size = $this->request->getHeader('Content-Length');
80
+            }
81
+        }
82 82
 
83
-		if ($size === '') {
84
-			$size = false;
85
-		}
83
+        if ($size === '') {
84
+            $size = false;
85
+        }
86 86
 
87
-		$this->size = $size;
88
-		return $this->size;
89
-	}
87
+        $this->size = $size;
88
+        return $this->size;
89
+    }
90 90
 
91
-	public function supportedEntities(): array {
92
-		return [ File::class ];
93
-	}
91
+    public function supportedEntities(): array {
92
+        return [ File::class ];
93
+    }
94 94
 
95
-	public function isAvailableForScope(int $scope): bool {
96
-		return true;
97
-	}
95
+    public function isAvailableForScope(int $scope): bool {
96
+        return true;
97
+    }
98 98
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Check/FileName.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	public function supportedEntities(): array {
158
-		return [ File::class ];
158
+		return [File::class];
159 159
 	}
160 160
 
161 161
 	public function isAvailableForScope(int $scope): bool {
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -16,60 +16,60 @@
 block discarded – undo
16 16
 use OCP\WorkflowEngine\IFileCheck;
17 17
 
18 18
 class FileName extends AbstractStringCheck implements IFileCheck {
19
-	use TFileCheck;
19
+    use TFileCheck;
20 20
 
21
-	/**
22
-	 * @param IL10N $l
23
-	 * @param IRequest $request
24
-	 */
25
-	public function __construct(
26
-		IL10N $l,
27
-		protected IRequest $request,
28
-		private IMountManager $mountManager,
29
-	) {
30
-		parent::__construct($l);
31
-	}
21
+    /**
22
+     * @param IL10N $l
23
+     * @param IRequest $request
24
+     */
25
+    public function __construct(
26
+        IL10N $l,
27
+        protected IRequest $request,
28
+        private IMountManager $mountManager,
29
+    ) {
30
+        parent::__construct($l);
31
+    }
32 32
 
33
-	/**
34
-	 * @return string
35
-	 */
36
-	protected function getActualValue(): string {
37
-		$fileName = $this->path === null ? '' : basename($this->path);
38
-		if ($fileName === '' && (!$this->storage->isLocal() || $this->storage->instanceOfStorage(Local::class))) {
39
-			// Return the mountpoint name of external storage that are not mounted as user home
40
-			$mountPoints = $this->mountManager->findByStorageId($this->storage->getId());
41
-			if (empty($mountPoints) || $mountPoints[0]->getMountType() !== 'external') {
42
-				return $fileName;
43
-			}
44
-			$mountPointPath = rtrim($mountPoints[0]->getMountPoint(), '/');
45
-			$mountPointPieces = explode('/', $mountPointPath);
46
-			$mountPointName = array_pop($mountPointPieces);
47
-			if (!empty($mountPointName) && $mountPointName !== 'files' && count($mountPointPieces) !== 2) {
48
-				return $mountPointName;
49
-			}
50
-		}
51
-		return $fileName;
52
-	}
33
+    /**
34
+     * @return string
35
+     */
36
+    protected function getActualValue(): string {
37
+        $fileName = $this->path === null ? '' : basename($this->path);
38
+        if ($fileName === '' && (!$this->storage->isLocal() || $this->storage->instanceOfStorage(Local::class))) {
39
+            // Return the mountpoint name of external storage that are not mounted as user home
40
+            $mountPoints = $this->mountManager->findByStorageId($this->storage->getId());
41
+            if (empty($mountPoints) || $mountPoints[0]->getMountType() !== 'external') {
42
+                return $fileName;
43
+            }
44
+            $mountPointPath = rtrim($mountPoints[0]->getMountPoint(), '/');
45
+            $mountPointPieces = explode('/', $mountPointPath);
46
+            $mountPointName = array_pop($mountPointPieces);
47
+            if (!empty($mountPointName) && $mountPointName !== 'files' && count($mountPointPieces) !== 2) {
48
+                return $mountPointName;
49
+            }
50
+        }
51
+        return $fileName;
52
+    }
53 53
 
54
-	/**
55
-	 * @param string $operator
56
-	 * @param string $checkValue
57
-	 * @param string $actualValue
58
-	 * @return bool
59
-	 */
60
-	protected function executeStringCheck($operator, $checkValue, $actualValue): bool {
61
-		if ($operator === 'is' || $operator === '!is') {
62
-			$checkValue = mb_strtolower($checkValue);
63
-			$actualValue = mb_strtolower($actualValue);
64
-		}
65
-		return parent::executeStringCheck($operator, $checkValue, $actualValue);
66
-	}
54
+    /**
55
+     * @param string $operator
56
+     * @param string $checkValue
57
+     * @param string $actualValue
58
+     * @return bool
59
+     */
60
+    protected function executeStringCheck($operator, $checkValue, $actualValue): bool {
61
+        if ($operator === 'is' || $operator === '!is') {
62
+            $checkValue = mb_strtolower($checkValue);
63
+            $actualValue = mb_strtolower($actualValue);
64
+        }
65
+        return parent::executeStringCheck($operator, $checkValue, $actualValue);
66
+    }
67 67
 
68
-	public function supportedEntities(): array {
69
-		return [ File::class ];
70
-	}
68
+    public function supportedEntities(): array {
69
+        return [ File::class ];
70
+    }
71 71
 
72
-	public function isAvailableForScope(int $scope): bool {
73
-		return true;
74
-	}
72
+    public function isAvailableForScope(int $scope): bool {
73
+        return true;
74
+    }
75 75
 }
Please login to merge, or discard this patch.
apps/settings/composer/composer/ClassLoader.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
     private function findFileWithExtension($class, $ext)
371 371
     {
372 372
         // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
373
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
374 374
 
375 375
         $first = $class[0];
376 376
         if (isset($this->prefixLengthsPsr4[$first])) {
377 377
             $subPath = $class;
378 378
             while (false !== $lastPos = strrpos($subPath, '\\')) {
379 379
                 $subPath = substr($subPath, 0, $lastPos);
380
-                $search = $subPath . '\\';
380
+                $search = $subPath.'\\';
381 381
                 if (isset($this->prefixDirsPsr4[$search])) {
382
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
382
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
383 383
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
-                        if (file_exists($file = $dir . $pathEnd)) {
384
+                        if (file_exists($file = $dir.$pathEnd)) {
385 385
                             return $file;
386 386
                         }
387 387
                     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         // PSR-4 fallback dirs
393 393
         foreach ($this->fallbackDirsPsr4 as $dir) {
394
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
394
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
395 395
                 return $file;
396 396
             }
397 397
         }
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404 404
         } else {
405 405
             // PEAR-like class name
406
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
406
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
407 407
         }
408 408
 
409 409
         if (isset($this->prefixesPsr0[$first])) {
410 410
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411 411
                 if (0 === strpos($class, $prefix)) {
412 412
                     foreach ($dirs as $dir) {
413
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
413
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
414 414
                             return $file;
415 415
                         }
416 416
                     }
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         // PSR-0 fallback dirs
422 422
         foreach ($this->fallbackDirsPsr0 as $dir) {
423
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
423
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
424 424
                 return $file;
425 425
             }
426 426
         }
Please login to merge, or discard this patch.
apps/settings/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Settings\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Settings\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.