Passed
Push — master ( a40db9...fb5987 )
by Julius
14:20 queued 12s
created
lib/private/DB/OracleConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @param string $table table name without the prefix
83 83
 	 */
84 84
 	public function dropTable($table) {
85
-		$table = $this->tablePrefix . trim($table);
85
+		$table = $this->tablePrefix.trim($table);
86 86
 		$table = $this->quoteIdentifier($table);
87 87
 		$schema = $this->getSchemaManager();
88 88
 		if ($schema->tablesExist([$table])) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @return bool
98 98
 	 */
99 99
 	public function tableExists($table) {
100
-		$table = $this->tablePrefix . trim($table);
100
+		$table = $this->tablePrefix.trim($table);
101 101
 		$table = $this->quoteIdentifier($table);
102 102
 		$schema = $this->getSchemaManager();
103 103
 		return $schema->tablesExist([$table]);
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -28,80 +28,80 @@
 block discarded – undo
28 28
 namespace OC\DB;
29 29
 
30 30
 class OracleConnection extends Connection {
31
-	/**
32
-	 * Quote the keys of the array
33
-	 */
34
-	private function quoteKeys(array $data) {
35
-		$return = [];
36
-		$c = $this->getDatabasePlatform()->getIdentifierQuoteCharacter();
37
-		foreach ($data as $key => $value) {
38
-			if ($key[0] !== $c) {
39
-				$return[$this->quoteIdentifier($key)] = $value;
40
-			} else {
41
-				$return[$key] = $value;
42
-			}
43
-		}
44
-		return $return;
45
-	}
31
+    /**
32
+     * Quote the keys of the array
33
+     */
34
+    private function quoteKeys(array $data) {
35
+        $return = [];
36
+        $c = $this->getDatabasePlatform()->getIdentifierQuoteCharacter();
37
+        foreach ($data as $key => $value) {
38
+            if ($key[0] !== $c) {
39
+                $return[$this->quoteIdentifier($key)] = $value;
40
+            } else {
41
+                $return[$key] = $value;
42
+            }
43
+        }
44
+        return $return;
45
+    }
46 46
 
47
-	/**
48
-	 * {@inheritDoc}
49
-	 */
50
-	public function insert($table, array $data, array $types = []) {
51
-		if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
52
-			$table = $this->quoteIdentifier($table);
53
-		}
54
-		$data = $this->quoteKeys($data);
55
-		return parent::insert($table, $data, $types);
56
-	}
47
+    /**
48
+     * {@inheritDoc}
49
+     */
50
+    public function insert($table, array $data, array $types = []) {
51
+        if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
52
+            $table = $this->quoteIdentifier($table);
53
+        }
54
+        $data = $this->quoteKeys($data);
55
+        return parent::insert($table, $data, $types);
56
+    }
57 57
 
58
-	/**
59
-	 * {@inheritDoc}
60
-	 */
61
-	public function update($table, array $data, array $criteria, array $types = []) {
62
-		if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
63
-			$table = $this->quoteIdentifier($table);
64
-		}
65
-		$data = $this->quoteKeys($data);
66
-		$criteria = $this->quoteKeys($criteria);
67
-		return parent::update($table, $data, $criteria, $types);
68
-	}
58
+    /**
59
+     * {@inheritDoc}
60
+     */
61
+    public function update($table, array $data, array $criteria, array $types = []) {
62
+        if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
63
+            $table = $this->quoteIdentifier($table);
64
+        }
65
+        $data = $this->quoteKeys($data);
66
+        $criteria = $this->quoteKeys($criteria);
67
+        return parent::update($table, $data, $criteria, $types);
68
+    }
69 69
 
70
-	/**
71
-	 * {@inheritDoc}
72
-	 */
73
-	public function delete($table, array $criteria, array $types = []) {
74
-		if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
75
-			$table = $this->quoteIdentifier($table);
76
-		}
77
-		$criteria = $this->quoteKeys($criteria);
78
-		return parent::delete($table, $criteria);
79
-	}
70
+    /**
71
+     * {@inheritDoc}
72
+     */
73
+    public function delete($table, array $criteria, array $types = []) {
74
+        if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
75
+            $table = $this->quoteIdentifier($table);
76
+        }
77
+        $criteria = $this->quoteKeys($criteria);
78
+        return parent::delete($table, $criteria);
79
+    }
80 80
 
81
-	/**
82
-	 * Drop a table from the database if it exists
83
-	 *
84
-	 * @param string $table table name without the prefix
85
-	 */
86
-	public function dropTable($table) {
87
-		$table = $this->tablePrefix . trim($table);
88
-		$table = $this->quoteIdentifier($table);
89
-		$schema = $this->getSchemaManager();
90
-		if ($schema->tablesExist([$table])) {
91
-			$schema->dropTable($table);
92
-		}
93
-	}
81
+    /**
82
+     * Drop a table from the database if it exists
83
+     *
84
+     * @param string $table table name without the prefix
85
+     */
86
+    public function dropTable($table) {
87
+        $table = $this->tablePrefix . trim($table);
88
+        $table = $this->quoteIdentifier($table);
89
+        $schema = $this->getSchemaManager();
90
+        if ($schema->tablesExist([$table])) {
91
+            $schema->dropTable($table);
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * Check if a table exists
97
-	 *
98
-	 * @param string $table table name without the prefix
99
-	 * @return bool
100
-	 */
101
-	public function tableExists($table) {
102
-		$table = $this->tablePrefix . trim($table);
103
-		$table = $this->quoteIdentifier($table);
104
-		$schema = $this->getSchemaManager();
105
-		return $schema->tablesExist([$table]);
106
-	}
95
+    /**
96
+     * Check if a table exists
97
+     *
98
+     * @param string $table table name without the prefix
99
+     * @return bool
100
+     */
101
+    public function tableExists($table) {
102
+        $table = $this->tablePrefix . trim($table);
103
+        $table = $this->quoteIdentifier($table);
104
+        $schema = $this->getSchemaManager();
105
+        return $schema->tablesExist([$table]);
106
+    }
107 107
 }
Please login to merge, or discard this patch.
lib/private/Command/FileAccess.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 trait FileAccess {
28
-	protected function setupFS(IUser $user) {
29
-		\OC_Util::setupFS($user->getUID());
30
-	}
28
+    protected function setupFS(IUser $user) {
29
+        \OC_Util::setupFS($user->getUID());
30
+    }
31 31
 
32
-	protected function getUserFolder(IUser $user) {
33
-		$this->setupFS($user);
34
-		return \OC::$server->getUserFolder($user->getUID());
35
-	}
32
+    protected function getUserFolder(IUser $user) {
33
+        $this->setupFS($user);
34
+        return \OC::$server->getUserFolder($user->getUID());
35
+    }
36 36
 }
Please login to merge, or discard this patch.
lib/private/Memcache/APCu.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	use CADTrait;
38 38
 
39 39
 	public function get($key) {
40
-		$result = apcu_fetch($this->getPrefix() . $key, $success);
40
+		$result = apcu_fetch($this->getPrefix().$key, $success);
41 41
 		if (!$success) {
42 42
 			return null;
43 43
 		}
@@ -45,24 +45,24 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	public function set($key, $value, $ttl = 0) {
48
-		return apcu_store($this->getPrefix() . $key, $value, $ttl);
48
+		return apcu_store($this->getPrefix().$key, $value, $ttl);
49 49
 	}
50 50
 
51 51
 	public function hasKey($key) {
52
-		return apcu_exists($this->getPrefix() . $key);
52
+		return apcu_exists($this->getPrefix().$key);
53 53
 	}
54 54
 
55 55
 	public function remove($key) {
56
-		return apcu_delete($this->getPrefix() . $key);
56
+		return apcu_delete($this->getPrefix().$key);
57 57
 	}
58 58
 
59 59
 	public function clear($prefix = '') {
60
-		$ns = $this->getPrefix() . $prefix;
60
+		$ns = $this->getPrefix().$prefix;
61 61
 		$ns = preg_quote($ns, '/');
62 62
 		if (class_exists('\APCIterator')) {
63
-			$iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
63
+			$iter = new \APCIterator('user', '/^'.$ns.'/', APC_ITER_KEY);
64 64
 		} else {
65
-			$iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
65
+			$iter = new \APCUIterator('/^'.$ns.'/', APC_ITER_KEY);
66 66
 		}
67 67
 		return apcu_delete($iter);
68 68
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return bool
77 77
 	 */
78 78
 	public function add($key, $value, $ttl = 0) {
79
-		return apcu_add($this->getPrefix() . $key, $value, $ttl);
79
+		return apcu_add($this->getPrefix().$key, $value, $ttl);
80 80
 	}
81 81
 
82 82
 	/**
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
101 101
 		 * for details
102 102
 		 */
103
-		return apcu_exists($this->getPrefix() . $key)
104
-			? apcu_inc($this->getPrefix() . $key, $step)
103
+		return apcu_exists($this->getPrefix().$key)
104
+			? apcu_inc($this->getPrefix().$key, $step)
105 105
 			: false;
106 106
 	}
107 107
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
126 126
 		 * for details
127 127
 		 */
128
-		return apcu_exists($this->getPrefix() . $key)
129
-			? apcu_dec($this->getPrefix() . $key, $step)
128
+		return apcu_exists($this->getPrefix().$key)
129
+			? apcu_dec($this->getPrefix().$key, $step)
130 130
 			: false;
131 131
 	}
132 132
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	public function cas($key, $old, $new) {
142 142
 		// apc only does cas for ints
143 143
 		if (is_int($old) and is_int($new)) {
144
-			return apcu_cas($this->getPrefix() . $key, $old, $new);
144
+			return apcu_cas($this->getPrefix().$key, $old, $new);
145 145
 		} else {
146 146
 			return $this->casEmulated($key, $old, $new);
147 147
 		}
Please login to merge, or discard this patch.
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -31,137 +31,137 @@
 block discarded – undo
31 31
 use OCP\IMemcache;
32 32
 
33 33
 class APCu extends Cache implements IMemcache {
34
-	use CASTrait {
35
-		cas as casEmulated;
36
-	}
34
+    use CASTrait {
35
+        cas as casEmulated;
36
+    }
37 37
 
38
-	use CADTrait;
38
+    use CADTrait;
39 39
 
40
-	public function get($key) {
41
-		$result = apcu_fetch($this->getPrefix() . $key, $success);
42
-		if (!$success) {
43
-			return null;
44
-		}
45
-		return $result;
46
-	}
40
+    public function get($key) {
41
+        $result = apcu_fetch($this->getPrefix() . $key, $success);
42
+        if (!$success) {
43
+            return null;
44
+        }
45
+        return $result;
46
+    }
47 47
 
48
-	public function set($key, $value, $ttl = 0) {
49
-		return apcu_store($this->getPrefix() . $key, $value, $ttl);
50
-	}
48
+    public function set($key, $value, $ttl = 0) {
49
+        return apcu_store($this->getPrefix() . $key, $value, $ttl);
50
+    }
51 51
 
52
-	public function hasKey($key) {
53
-		return apcu_exists($this->getPrefix() . $key);
54
-	}
52
+    public function hasKey($key) {
53
+        return apcu_exists($this->getPrefix() . $key);
54
+    }
55 55
 
56
-	public function remove($key) {
57
-		return apcu_delete($this->getPrefix() . $key);
58
-	}
56
+    public function remove($key) {
57
+        return apcu_delete($this->getPrefix() . $key);
58
+    }
59 59
 
60
-	public function clear($prefix = '') {
61
-		$ns = $this->getPrefix() . $prefix;
62
-		$ns = preg_quote($ns, '/');
63
-		if (class_exists('\APCIterator')) {
64
-			$iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
65
-		} else {
66
-			$iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
67
-		}
68
-		return apcu_delete($iter);
69
-	}
60
+    public function clear($prefix = '') {
61
+        $ns = $this->getPrefix() . $prefix;
62
+        $ns = preg_quote($ns, '/');
63
+        if (class_exists('\APCIterator')) {
64
+            $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
65
+        } else {
66
+            $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
67
+        }
68
+        return apcu_delete($iter);
69
+    }
70 70
 
71
-	/**
72
-	 * Set a value in the cache if it's not already stored
73
-	 *
74
-	 * @param string $key
75
-	 * @param mixed $value
76
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
77
-	 * @return bool
78
-	 */
79
-	public function add($key, $value, $ttl = 0) {
80
-		return apcu_add($this->getPrefix() . $key, $value, $ttl);
81
-	}
71
+    /**
72
+     * Set a value in the cache if it's not already stored
73
+     *
74
+     * @param string $key
75
+     * @param mixed $value
76
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
77
+     * @return bool
78
+     */
79
+    public function add($key, $value, $ttl = 0) {
80
+        return apcu_add($this->getPrefix() . $key, $value, $ttl);
81
+    }
82 82
 
83
-	/**
84
-	 * Increase a stored number
85
-	 *
86
-	 * @param string $key
87
-	 * @param int $step
88
-	 * @return int | bool
89
-	 */
90
-	public function inc($key, $step = 1) {
91
-		$this->add($key, 0);
92
-		/**
93
-		 * TODO - hack around a PHP 7 specific issue in APCu
94
-		 *
95
-		 * on PHP 7 the apcu_inc method on a non-existing object will increment
96
-		 * "0" and result in "1" as value - therefore we check for existence
97
-		 * first
98
-		 *
99
-		 * on PHP 5.6 this is not the case
100
-		 *
101
-		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
102
-		 * for details
103
-		 */
104
-		return apcu_exists($this->getPrefix() . $key)
105
-			? apcu_inc($this->getPrefix() . $key, $step)
106
-			: false;
107
-	}
83
+    /**
84
+     * Increase a stored number
85
+     *
86
+     * @param string $key
87
+     * @param int $step
88
+     * @return int | bool
89
+     */
90
+    public function inc($key, $step = 1) {
91
+        $this->add($key, 0);
92
+        /**
93
+         * TODO - hack around a PHP 7 specific issue in APCu
94
+         *
95
+         * on PHP 7 the apcu_inc method on a non-existing object will increment
96
+         * "0" and result in "1" as value - therefore we check for existence
97
+         * first
98
+         *
99
+         * on PHP 5.6 this is not the case
100
+         *
101
+         * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
102
+         * for details
103
+         */
104
+        return apcu_exists($this->getPrefix() . $key)
105
+            ? apcu_inc($this->getPrefix() . $key, $step)
106
+            : false;
107
+    }
108 108
 
109
-	/**
110
-	 * Decrease a stored number
111
-	 *
112
-	 * @param string $key
113
-	 * @param int $step
114
-	 * @return int | bool
115
-	 */
116
-	public function dec($key, $step = 1) {
117
-		/**
118
-		 * TODO - hack around a PHP 7 specific issue in APCu
119
-		 *
120
-		 * on PHP 7 the apcu_dec method on a non-existing object will decrement
121
-		 * "0" and result in "-1" as value - therefore we check for existence
122
-		 * first
123
-		 *
124
-		 * on PHP 5.6 this is not the case
125
-		 *
126
-		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
127
-		 * for details
128
-		 */
129
-		return apcu_exists($this->getPrefix() . $key)
130
-			? apcu_dec($this->getPrefix() . $key, $step)
131
-			: false;
132
-	}
109
+    /**
110
+     * Decrease a stored number
111
+     *
112
+     * @param string $key
113
+     * @param int $step
114
+     * @return int | bool
115
+     */
116
+    public function dec($key, $step = 1) {
117
+        /**
118
+         * TODO - hack around a PHP 7 specific issue in APCu
119
+         *
120
+         * on PHP 7 the apcu_dec method on a non-existing object will decrement
121
+         * "0" and result in "-1" as value - therefore we check for existence
122
+         * first
123
+         *
124
+         * on PHP 5.6 this is not the case
125
+         *
126
+         * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
127
+         * for details
128
+         */
129
+        return apcu_exists($this->getPrefix() . $key)
130
+            ? apcu_dec($this->getPrefix() . $key, $step)
131
+            : false;
132
+    }
133 133
 
134
-	/**
135
-	 * Compare and set
136
-	 *
137
-	 * @param string $key
138
-	 * @param mixed $old
139
-	 * @param mixed $new
140
-	 * @return bool
141
-	 */
142
-	public function cas($key, $old, $new) {
143
-		// apc only does cas for ints
144
-		if (is_int($old) and is_int($new)) {
145
-			return apcu_cas($this->getPrefix() . $key, $old, $new);
146
-		} else {
147
-			return $this->casEmulated($key, $old, $new);
148
-		}
149
-	}
134
+    /**
135
+     * Compare and set
136
+     *
137
+     * @param string $key
138
+     * @param mixed $old
139
+     * @param mixed $new
140
+     * @return bool
141
+     */
142
+    public function cas($key, $old, $new) {
143
+        // apc only does cas for ints
144
+        if (is_int($old) and is_int($new)) {
145
+            return apcu_cas($this->getPrefix() . $key, $old, $new);
146
+        } else {
147
+            return $this->casEmulated($key, $old, $new);
148
+        }
149
+    }
150 150
 
151
-	public static function isAvailable(): bool {
152
-		if (!extension_loaded('apcu')) {
153
-			return false;
154
-		} elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enabled')) {
155
-			return false;
156
-		} elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enable_cli') && \OC::$CLI) {
157
-			return false;
158
-		} elseif (
159
-				version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
160
-				version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1
161
-		) {
162
-			return false;
163
-		} else {
164
-			return true;
165
-		}
166
-	}
151
+    public static function isAvailable(): bool {
152
+        if (!extension_loaded('apcu')) {
153
+            return false;
154
+        } elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enabled')) {
155
+            return false;
156
+        } elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enable_cli') && \OC::$CLI) {
157
+            return false;
158
+        } elseif (
159
+                version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
160
+                version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1
161
+        ) {
162
+            return false;
163
+        } else {
164
+            return true;
165
+        }
166
+    }
167 167
 }
Please login to merge, or discard this patch.
lib/private/Group/Backend.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
68 68
 	 */
69 69
 	public function implementsActions($actions) {
70
-		return (bool)($this->getSupportedActions() & $actions);
70
+		return (bool) ($this->getSupportedActions() & $actions);
71 71
 	}
72 72
 
73 73
 	/**
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -29,107 +29,107 @@
 block discarded – undo
29 29
  * Abstract base class for user management
30 30
  */
31 31
 abstract class Backend implements \OCP\GroupInterface {
32
-	/**
33
-	 * error code for functions not provided by the group backend
34
-	 */
35
-	public const NOT_IMPLEMENTED = -501;
32
+    /**
33
+     * error code for functions not provided by the group backend
34
+     */
35
+    public const NOT_IMPLEMENTED = -501;
36 36
 
37
-	protected $possibleActions = [
38
-		self::CREATE_GROUP => 'createGroup',
39
-		self::DELETE_GROUP => 'deleteGroup',
40
-		self::ADD_TO_GROUP => 'addToGroup',
41
-		self::REMOVE_FROM_GOUP => 'removeFromGroup',
42
-		self::COUNT_USERS => 'countUsersInGroup',
43
-		self::GROUP_DETAILS => 'getGroupDetails',
44
-		self::IS_ADMIN => 'isAdmin',
45
-	];
37
+    protected $possibleActions = [
38
+        self::CREATE_GROUP => 'createGroup',
39
+        self::DELETE_GROUP => 'deleteGroup',
40
+        self::ADD_TO_GROUP => 'addToGroup',
41
+        self::REMOVE_FROM_GOUP => 'removeFromGroup',
42
+        self::COUNT_USERS => 'countUsersInGroup',
43
+        self::GROUP_DETAILS => 'getGroupDetails',
44
+        self::IS_ADMIN => 'isAdmin',
45
+    ];
46 46
 
47
-	/**
48
-	 * Get all supported actions
49
-	 * @return int bitwise-or'ed actions
50
-	 *
51
-	 * Returns the supported actions as int to be
52
-	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
53
-	 */
54
-	public function getSupportedActions() {
55
-		$actions = 0;
56
-		foreach ($this->possibleActions as $action => $methodName) {
57
-			if (method_exists($this, $methodName)) {
58
-				$actions |= $action;
59
-			}
60
-		}
47
+    /**
48
+     * Get all supported actions
49
+     * @return int bitwise-or'ed actions
50
+     *
51
+     * Returns the supported actions as int to be
52
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
53
+     */
54
+    public function getSupportedActions() {
55
+        $actions = 0;
56
+        foreach ($this->possibleActions as $action => $methodName) {
57
+            if (method_exists($this, $methodName)) {
58
+                $actions |= $action;
59
+            }
60
+        }
61 61
 
62
-		return $actions;
63
-	}
62
+        return $actions;
63
+    }
64 64
 
65
-	/**
66
-	 * Check if backend implements actions
67
-	 * @param int $actions bitwise-or'ed actions
68
-	 * @return bool
69
-	 *
70
-	 * Returns the supported actions as int to be
71
-	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
72
-	 */
73
-	public function implementsActions($actions) {
74
-		return (bool)($this->getSupportedActions() & $actions);
75
-	}
65
+    /**
66
+     * Check if backend implements actions
67
+     * @param int $actions bitwise-or'ed actions
68
+     * @return bool
69
+     *
70
+     * Returns the supported actions as int to be
71
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
72
+     */
73
+    public function implementsActions($actions) {
74
+        return (bool)($this->getSupportedActions() & $actions);
75
+    }
76 76
 
77
-	/**
78
-	 * is user in group?
79
-	 * @param string $uid uid of the user
80
-	 * @param string $gid gid of the group
81
-	 * @return bool
82
-	 *
83
-	 * Checks whether the user is member of a group or not.
84
-	 */
85
-	public function inGroup($uid, $gid) {
86
-		return in_array($gid, $this->getUserGroups($uid));
87
-	}
77
+    /**
78
+     * is user in group?
79
+     * @param string $uid uid of the user
80
+     * @param string $gid gid of the group
81
+     * @return bool
82
+     *
83
+     * Checks whether the user is member of a group or not.
84
+     */
85
+    public function inGroup($uid, $gid) {
86
+        return in_array($gid, $this->getUserGroups($uid));
87
+    }
88 88
 
89
-	/**
90
-	 * Get all groups a user belongs to
91
-	 * @param string $uid Name of the user
92
-	 * @return array an array of group names
93
-	 *
94
-	 * This function fetches all groups a user belongs to. It does not check
95
-	 * if the user exists at all.
96
-	 */
97
-	public function getUserGroups($uid) {
98
-		return [];
99
-	}
89
+    /**
90
+     * Get all groups a user belongs to
91
+     * @param string $uid Name of the user
92
+     * @return array an array of group names
93
+     *
94
+     * This function fetches all groups a user belongs to. It does not check
95
+     * if the user exists at all.
96
+     */
97
+    public function getUserGroups($uid) {
98
+        return [];
99
+    }
100 100
 
101
-	/**
102
-	 * get a list of all groups
103
-	 * @param string $search
104
-	 * @param int $limit
105
-	 * @param int $offset
106
-	 * @return array an array of group names
107
-	 *
108
-	 * Returns a list with all groups
109
-	 */
101
+    /**
102
+     * get a list of all groups
103
+     * @param string $search
104
+     * @param int $limit
105
+     * @param int $offset
106
+     * @return array an array of group names
107
+     *
108
+     * Returns a list with all groups
109
+     */
110 110
 
111
-	public function getGroups($search = '', $limit = -1, $offset = 0) {
112
-		return [];
113
-	}
111
+    public function getGroups($search = '', $limit = -1, $offset = 0) {
112
+        return [];
113
+    }
114 114
 
115
-	/**
116
-	 * check if a group exists
117
-	 * @param string $gid
118
-	 * @return bool
119
-	 */
120
-	public function groupExists($gid) {
121
-		return in_array($gid, $this->getGroups($gid, 1));
122
-	}
115
+    /**
116
+     * check if a group exists
117
+     * @param string $gid
118
+     * @return bool
119
+     */
120
+    public function groupExists($gid) {
121
+        return in_array($gid, $this->getGroups($gid, 1));
122
+    }
123 123
 
124
-	/**
125
-	 * get a list of all users in a group
126
-	 * @param string $gid
127
-	 * @param string $search
128
-	 * @param int $limit
129
-	 * @param int $offset
130
-	 * @return array an array of user ids
131
-	 */
132
-	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
133
-		return [];
134
-	}
124
+    /**
125
+     * get a list of all users in a group
126
+     * @param string $gid
127
+     * @param string $search
128
+     * @param int $limit
129
+     * @param int $offset
130
+     * @return array an array of user ids
131
+     */
132
+    public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
133
+        return [];
134
+    }
135 135
 }
Please login to merge, or discard this patch.
lib/private/Activity/EventMerger.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Check that all parameters from $event exist in $previousEvent
135 135
 		foreach ($params1 as $key => $parameter) {
136
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
136
+			if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) {
137 137
 				if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
138 138
 					$combined++;
139
-					$params[$mergeParameter . $combined] = $parameter;
139
+					$params[$mergeParameter.$combined] = $parameter;
140 140
 				}
141 141
 				continue;
142 142
 			}
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 
152 152
 		// Check that all parameters from $previousEvent exist in $event
153 153
 		foreach ($params2 as $key => $parameter) {
154
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
154
+			if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) {
155 155
 				if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
156 156
 					$combined++;
157
-					$params[$mergeParameter . $combined] = $parameter;
157
+					$params[$mergeParameter.$combined] = $parameter;
158 158
 				}
159 159
 				continue;
160 160
 			}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function checkParameterAlreadyExits($parameters, $mergeParameter, $parameter) {
180 180
 		foreach ($parameters as $key => $param) {
181
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
181
+			if (preg_match('/^'.$mergeParameter.'(\d+)?$/', $key)) {
182 182
 				if ($param === $parameter) {
183 183
 					return true;
184 184
 				}
@@ -196,30 +196,30 @@  discard block
 block discarded – undo
196 196
 	protected function getExtendedSubject($subject, $parameter, $counter) {
197 197
 		switch ($counter) {
198 198
 			case 1:
199
-				$replacement = '{' . $parameter . '1}';
199
+				$replacement = '{'.$parameter.'1}';
200 200
 				break;
201 201
 			case 2:
202 202
 				$replacement = $this->l10n->t(
203 203
 					'%1$s and %2$s',
204
-					['{' . $parameter . '2}', '{' . $parameter . '1}']
204
+					['{'.$parameter.'2}', '{'.$parameter.'1}']
205 205
 				);
206 206
 				break;
207 207
 			case 3:
208 208
 				$replacement = $this->l10n->t(
209 209
 					'%1$s, %2$s and %3$s',
210
-					['{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
210
+					['{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}']
211 211
 				);
212 212
 				break;
213 213
 			case 4:
214 214
 				$replacement = $this->l10n->t(
215 215
 					'%1$s, %2$s, %3$s and %4$s',
216
-					['{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
216
+					['{'.$parameter.'4}', '{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}']
217 217
 				);
218 218
 				break;
219 219
 			case 5:
220 220
 				$replacement = $this->l10n->t(
221 221
 					'%1$s, %2$s, %3$s, %4$s and %5$s',
222
-					['{' . $parameter . '5}', '{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
222
+					['{'.$parameter.'5}', '{'.$parameter.'4}', '{'.$parameter.'3}', '{'.$parameter.'2}', '{'.$parameter.'1}']
223 223
 				);
224 224
 				break;
225 225
 			default:
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		}
228 228
 
229 229
 		return str_replace(
230
-			'{' . $parameter . '}',
230
+			'{'.$parameter.'}',
231 231
 			$replacement,
232 232
 			$subject
233 233
 		);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	protected function generateParsedSubject($subject, $parameters) {
242 242
 		$placeholders = $replacements = [];
243 243
 		foreach ($parameters as $placeholder => $parameter) {
244
-			$placeholders[] = '{' . $placeholder . '}';
244
+			$placeholders[] = '{'.$placeholder.'}';
245 245
 			if ($parameter['type'] === 'file') {
246 246
 				$replacements[] = trim($parameter['path'], '/');
247 247
 			} elseif (isset($parameter['name'])) {
Please login to merge, or discard this patch.
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -31,231 +31,231 @@
 block discarded – undo
31 31
 
32 32
 class EventMerger implements IEventMerger {
33 33
 
34
-	/** @var IL10N */
35
-	protected $l10n;
34
+    /** @var IL10N */
35
+    protected $l10n;
36 36
 
37
-	/**
38
-	 * @param IL10N $l10n
39
-	 */
40
-	public function __construct(IL10N $l10n) {
41
-		$this->l10n = $l10n;
42
-	}
37
+    /**
38
+     * @param IL10N $l10n
39
+     */
40
+    public function __construct(IL10N $l10n) {
41
+        $this->l10n = $l10n;
42
+    }
43 43
 
44
-	/**
45
-	 * Combines two events when possible to have grouping:
46
-	 *
47
-	 * Example1: Two events with subject '{user} created {file}' and
48
-	 * $mergeParameter file with different file and same user will be merged
49
-	 * to '{user} created {file1} and {file2}' and the childEvent on the return
50
-	 * will be set, if the events have been merged.
51
-	 *
52
-	 * Example2: Two events with subject '{user} created {file}' and
53
-	 * $mergeParameter file with same file and same user will be merged to
54
-	 * '{user} created {file1}' and the childEvent on the return will be set, if
55
-	 * the events have been merged.
56
-	 *
57
-	 * The following requirements have to be met, in order to be merged:
58
-	 * - Both events need to have the same `getApp()`
59
-	 * - Both events must not have a message `getMessage()`
60
-	 * - Both events need to have the same subject `getSubject()`
61
-	 * - Both events need to have the same object type `getObjectType()`
62
-	 * - The time difference between both events must not be bigger then 3 hours
63
-	 * - Only up to 5 events can be merged.
64
-	 * - All parameters apart from such starting with $mergeParameter must be
65
-	 *   the same for both events.
66
-	 *
67
-	 * @param string $mergeParameter
68
-	 * @param IEvent $event
69
-	 * @param IEvent|null $previousEvent
70
-	 * @return IEvent
71
-	 */
72
-	public function mergeEvents($mergeParameter, IEvent $event, IEvent $previousEvent = null) {
73
-		// No second event => can not combine
74
-		if (!$previousEvent instanceof IEvent) {
75
-			return $event;
76
-		}
44
+    /**
45
+     * Combines two events when possible to have grouping:
46
+     *
47
+     * Example1: Two events with subject '{user} created {file}' and
48
+     * $mergeParameter file with different file and same user will be merged
49
+     * to '{user} created {file1} and {file2}' and the childEvent on the return
50
+     * will be set, if the events have been merged.
51
+     *
52
+     * Example2: Two events with subject '{user} created {file}' and
53
+     * $mergeParameter file with same file and same user will be merged to
54
+     * '{user} created {file1}' and the childEvent on the return will be set, if
55
+     * the events have been merged.
56
+     *
57
+     * The following requirements have to be met, in order to be merged:
58
+     * - Both events need to have the same `getApp()`
59
+     * - Both events must not have a message `getMessage()`
60
+     * - Both events need to have the same subject `getSubject()`
61
+     * - Both events need to have the same object type `getObjectType()`
62
+     * - The time difference between both events must not be bigger then 3 hours
63
+     * - Only up to 5 events can be merged.
64
+     * - All parameters apart from such starting with $mergeParameter must be
65
+     *   the same for both events.
66
+     *
67
+     * @param string $mergeParameter
68
+     * @param IEvent $event
69
+     * @param IEvent|null $previousEvent
70
+     * @return IEvent
71
+     */
72
+    public function mergeEvents($mergeParameter, IEvent $event, IEvent $previousEvent = null) {
73
+        // No second event => can not combine
74
+        if (!$previousEvent instanceof IEvent) {
75
+            return $event;
76
+        }
77 77
 
78
-		// Different app => can not combine
79
-		if ($event->getApp() !== $previousEvent->getApp()) {
80
-			return $event;
81
-		}
78
+        // Different app => can not combine
79
+        if ($event->getApp() !== $previousEvent->getApp()) {
80
+            return $event;
81
+        }
82 82
 
83
-		// Message is set => can not combine
84
-		if ($event->getMessage() !== '' || $previousEvent->getMessage() !== '') {
85
-			return $event;
86
-		}
83
+        // Message is set => can not combine
84
+        if ($event->getMessage() !== '' || $previousEvent->getMessage() !== '') {
85
+            return $event;
86
+        }
87 87
 
88
-		// Different subject => can not combine
89
-		if ($event->getSubject() !== $previousEvent->getSubject()) {
90
-			return $event;
91
-		}
88
+        // Different subject => can not combine
89
+        if ($event->getSubject() !== $previousEvent->getSubject()) {
90
+            return $event;
91
+        }
92 92
 
93
-		// Different object type => can not combine
94
-		if ($event->getObjectType() !== $previousEvent->getObjectType()) {
95
-			return $event;
96
-		}
93
+        // Different object type => can not combine
94
+        if ($event->getObjectType() !== $previousEvent->getObjectType()) {
95
+            return $event;
96
+        }
97 97
 
98
-		// More than 3 hours difference => can not combine
99
-		if (abs($event->getTimestamp() - $previousEvent->getTimestamp()) > 3 * 60 * 60) {
100
-			return $event;
101
-		}
98
+        // More than 3 hours difference => can not combine
99
+        if (abs($event->getTimestamp() - $previousEvent->getTimestamp()) > 3 * 60 * 60) {
100
+            return $event;
101
+        }
102 102
 
103
-		// Other parameters are not the same => can not combine
104
-		try {
105
-			[$combined, $parameters] = $this->combineParameters($mergeParameter, $event, $previousEvent);
106
-		} catch (\UnexpectedValueException $e) {
107
-			return $event;
108
-		}
103
+        // Other parameters are not the same => can not combine
104
+        try {
105
+            [$combined, $parameters] = $this->combineParameters($mergeParameter, $event, $previousEvent);
106
+        } catch (\UnexpectedValueException $e) {
107
+            return $event;
108
+        }
109 109
 
110
-		try {
111
-			$newSubject = $this->getExtendedSubject($event->getRichSubject(), $mergeParameter, $combined);
112
-			$parsedSubject = $this->generateParsedSubject($newSubject, $parameters);
110
+        try {
111
+            $newSubject = $this->getExtendedSubject($event->getRichSubject(), $mergeParameter, $combined);
112
+            $parsedSubject = $this->generateParsedSubject($newSubject, $parameters);
113 113
 
114
-			$event->setRichSubject($newSubject, $parameters)
115
-				->setParsedSubject($parsedSubject)
116
-				->setChildEvent($previousEvent)
117
-				->setTimestamp(max($event->getTimestamp(), $previousEvent->getTimestamp()));
118
-		} catch (\UnexpectedValueException $e) {
119
-			return $event;
120
-		}
114
+            $event->setRichSubject($newSubject, $parameters)
115
+                ->setParsedSubject($parsedSubject)
116
+                ->setChildEvent($previousEvent)
117
+                ->setTimestamp(max($event->getTimestamp(), $previousEvent->getTimestamp()));
118
+        } catch (\UnexpectedValueException $e) {
119
+            return $event;
120
+        }
121 121
 
122
-		return $event;
123
-	}
122
+        return $event;
123
+    }
124 124
 
125
-	/**
126
-	 * @param string $mergeParameter
127
-	 * @param IEvent $event
128
-	 * @param IEvent $previousEvent
129
-	 * @return array
130
-	 * @throws \UnexpectedValueException
131
-	 */
132
-	protected function combineParameters($mergeParameter, IEvent $event, IEvent $previousEvent) {
133
-		$params1 = $event->getRichSubjectParameters();
134
-		$params2 = $previousEvent->getRichSubjectParameters();
135
-		$params = [];
125
+    /**
126
+     * @param string $mergeParameter
127
+     * @param IEvent $event
128
+     * @param IEvent $previousEvent
129
+     * @return array
130
+     * @throws \UnexpectedValueException
131
+     */
132
+    protected function combineParameters($mergeParameter, IEvent $event, IEvent $previousEvent) {
133
+        $params1 = $event->getRichSubjectParameters();
134
+        $params2 = $previousEvent->getRichSubjectParameters();
135
+        $params = [];
136 136
 
137
-		$combined = 0;
137
+        $combined = 0;
138 138
 
139
-		// Check that all parameters from $event exist in $previousEvent
140
-		foreach ($params1 as $key => $parameter) {
141
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
142
-				if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
143
-					$combined++;
144
-					$params[$mergeParameter . $combined] = $parameter;
145
-				}
146
-				continue;
147
-			}
139
+        // Check that all parameters from $event exist in $previousEvent
140
+        foreach ($params1 as $key => $parameter) {
141
+            if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
142
+                if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
143
+                    $combined++;
144
+                    $params[$mergeParameter . $combined] = $parameter;
145
+                }
146
+                continue;
147
+            }
148 148
 
149
-			if (!isset($params2[$key]) || $params2[$key] !== $parameter) {
150
-				// Parameter missing on $previousEvent or different => can not combine
151
-				throw new \UnexpectedValueException();
152
-			}
149
+            if (!isset($params2[$key]) || $params2[$key] !== $parameter) {
150
+                // Parameter missing on $previousEvent or different => can not combine
151
+                throw new \UnexpectedValueException();
152
+            }
153 153
 
154
-			$params[$key] = $parameter;
155
-		}
154
+            $params[$key] = $parameter;
155
+        }
156 156
 
157
-		// Check that all parameters from $previousEvent exist in $event
158
-		foreach ($params2 as $key => $parameter) {
159
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
160
-				if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
161
-					$combined++;
162
-					$params[$mergeParameter . $combined] = $parameter;
163
-				}
164
-				continue;
165
-			}
157
+        // Check that all parameters from $previousEvent exist in $event
158
+        foreach ($params2 as $key => $parameter) {
159
+            if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
160
+                if (!$this->checkParameterAlreadyExits($params, $mergeParameter, $parameter)) {
161
+                    $combined++;
162
+                    $params[$mergeParameter . $combined] = $parameter;
163
+                }
164
+                continue;
165
+            }
166 166
 
167
-			if (!isset($params1[$key]) || $params1[$key] !== $parameter) {
168
-				// Parameter missing on $event or different => can not combine
169
-				throw new \UnexpectedValueException();
170
-			}
167
+            if (!isset($params1[$key]) || $params1[$key] !== $parameter) {
168
+                // Parameter missing on $event or different => can not combine
169
+                throw new \UnexpectedValueException();
170
+            }
171 171
 
172
-			$params[$key] = $parameter;
173
-		}
172
+            $params[$key] = $parameter;
173
+        }
174 174
 
175
-		return [$combined, $params];
176
-	}
175
+        return [$combined, $params];
176
+    }
177 177
 
178
-	/**
179
-	 * @param array[] $parameters
180
-	 * @param string $mergeParameter
181
-	 * @param array $parameter
182
-	 * @return bool
183
-	 */
184
-	protected function checkParameterAlreadyExits($parameters, $mergeParameter, $parameter) {
185
-		foreach ($parameters as $key => $param) {
186
-			if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
187
-				if ($param === $parameter) {
188
-					return true;
189
-				}
190
-			}
191
-		}
192
-		return false;
193
-	}
178
+    /**
179
+     * @param array[] $parameters
180
+     * @param string $mergeParameter
181
+     * @param array $parameter
182
+     * @return bool
183
+     */
184
+    protected function checkParameterAlreadyExits($parameters, $mergeParameter, $parameter) {
185
+        foreach ($parameters as $key => $param) {
186
+            if (preg_match('/^' . $mergeParameter . '(\d+)?$/', $key)) {
187
+                if ($param === $parameter) {
188
+                    return true;
189
+                }
190
+            }
191
+        }
192
+        return false;
193
+    }
194 194
 
195
-	/**
196
-	 * @param string $subject
197
-	 * @param string $parameter
198
-	 * @param int $counter
199
-	 * @return mixed
200
-	 */
201
-	protected function getExtendedSubject($subject, $parameter, $counter) {
202
-		switch ($counter) {
203
-			case 1:
204
-				$replacement = '{' . $parameter . '1}';
205
-				break;
206
-			case 2:
207
-				$replacement = $this->l10n->t(
208
-					'%1$s and %2$s',
209
-					['{' . $parameter . '2}', '{' . $parameter . '1}']
210
-				);
211
-				break;
212
-			case 3:
213
-				$replacement = $this->l10n->t(
214
-					'%1$s, %2$s and %3$s',
215
-					['{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
216
-				);
217
-				break;
218
-			case 4:
219
-				$replacement = $this->l10n->t(
220
-					'%1$s, %2$s, %3$s and %4$s',
221
-					['{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
222
-				);
223
-				break;
224
-			case 5:
225
-				$replacement = $this->l10n->t(
226
-					'%1$s, %2$s, %3$s, %4$s and %5$s',
227
-					['{' . $parameter . '5}', '{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
228
-				);
229
-				break;
230
-			default:
231
-				throw new \UnexpectedValueException();
232
-		}
195
+    /**
196
+     * @param string $subject
197
+     * @param string $parameter
198
+     * @param int $counter
199
+     * @return mixed
200
+     */
201
+    protected function getExtendedSubject($subject, $parameter, $counter) {
202
+        switch ($counter) {
203
+            case 1:
204
+                $replacement = '{' . $parameter . '1}';
205
+                break;
206
+            case 2:
207
+                $replacement = $this->l10n->t(
208
+                    '%1$s and %2$s',
209
+                    ['{' . $parameter . '2}', '{' . $parameter . '1}']
210
+                );
211
+                break;
212
+            case 3:
213
+                $replacement = $this->l10n->t(
214
+                    '%1$s, %2$s and %3$s',
215
+                    ['{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
216
+                );
217
+                break;
218
+            case 4:
219
+                $replacement = $this->l10n->t(
220
+                    '%1$s, %2$s, %3$s and %4$s',
221
+                    ['{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
222
+                );
223
+                break;
224
+            case 5:
225
+                $replacement = $this->l10n->t(
226
+                    '%1$s, %2$s, %3$s, %4$s and %5$s',
227
+                    ['{' . $parameter . '5}', '{' . $parameter . '4}', '{' . $parameter . '3}', '{' . $parameter . '2}', '{' . $parameter . '1}']
228
+                );
229
+                break;
230
+            default:
231
+                throw new \UnexpectedValueException();
232
+        }
233 233
 
234
-		return str_replace(
235
-			'{' . $parameter . '}',
236
-			$replacement,
237
-			$subject
238
-		);
239
-	}
234
+        return str_replace(
235
+            '{' . $parameter . '}',
236
+            $replacement,
237
+            $subject
238
+        );
239
+    }
240 240
 
241
-	/**
242
-	 * @param string $subject
243
-	 * @param array[] $parameters
244
-	 * @return string
245
-	 */
246
-	protected function generateParsedSubject($subject, $parameters) {
247
-		$placeholders = $replacements = [];
248
-		foreach ($parameters as $placeholder => $parameter) {
249
-			$placeholders[] = '{' . $placeholder . '}';
250
-			if ($parameter['type'] === 'file') {
251
-				$replacements[] = trim($parameter['path'], '/');
252
-			} elseif (isset($parameter['name'])) {
253
-				$replacements[] = $parameter['name'];
254
-			} else {
255
-				$replacements[] = $parameter['id'];
256
-			}
257
-		}
241
+    /**
242
+     * @param string $subject
243
+     * @param array[] $parameters
244
+     * @return string
245
+     */
246
+    protected function generateParsedSubject($subject, $parameters) {
247
+        $placeholders = $replacements = [];
248
+        foreach ($parameters as $placeholder => $parameter) {
249
+            $placeholders[] = '{' . $placeholder . '}';
250
+            if ($parameter['type'] === 'file') {
251
+                $replacements[] = trim($parameter['path'], '/');
252
+            } elseif (isset($parameter['name'])) {
253
+                $replacements[] = $parameter['name'];
254
+            } else {
255
+                $replacements[] = $parameter['id'];
256
+            }
257
+        }
258 258
 
259
-		return str_replace($placeholders, $replacements, $subject);
260
-	}
259
+        return str_replace($placeholders, $replacements, $subject);
260
+    }
261 261
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Manager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 	 * @return IEntry[]
90 90
 	 */
91 91
 	private function sortEntries(array $entries) {
92
-		usort($entries, function (IEntry $entryA, IEntry $entryB) {
92
+		usort($entries, function(IEntry $entryA, IEntry $entryB) {
93 93
 			return strcasecmp($entryA->getFullName(), $entryB->getFullName());
94 94
 		});
95 95
 		return $entries;
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -33,90 +33,90 @@
 block discarded – undo
33 33
 
34 34
 class Manager {
35 35
 
36
-	/** @var ContactsStore */
37
-	private $store;
36
+    /** @var ContactsStore */
37
+    private $store;
38 38
 
39
-	/** @var ActionProviderStore */
40
-	private $actionProviderStore;
39
+    /** @var ActionProviderStore */
40
+    private $actionProviderStore;
41 41
 
42
-	/** @var IAppManager */
43
-	private $appManager;
42
+    /** @var IAppManager */
43
+    private $appManager;
44 44
 
45
-	/** @var IConfig */
46
-	private $config;
45
+    /** @var IConfig */
46
+    private $config;
47 47
 
48
-	/**
49
-	 * @param ContactsStore $store
50
-	 * @param ActionProviderStore $actionProviderStore
51
-	 * @param IAppManager $appManager
52
-	 */
53
-	public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager, IConfig $config) {
54
-		$this->store = $store;
55
-		$this->actionProviderStore = $actionProviderStore;
56
-		$this->appManager = $appManager;
57
-		$this->config = $config;
58
-	}
48
+    /**
49
+     * @param ContactsStore $store
50
+     * @param ActionProviderStore $actionProviderStore
51
+     * @param IAppManager $appManager
52
+     */
53
+    public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager, IConfig $config) {
54
+        $this->store = $store;
55
+        $this->actionProviderStore = $actionProviderStore;
56
+        $this->appManager = $appManager;
57
+        $this->config = $config;
58
+    }
59 59
 
60
-	/**
61
-	 * @param IUser $user
62
-	 * @param string|null $filter
63
-	 * @return array
64
-	 */
65
-	public function getEntries(IUser $user, $filter) {
66
-		$maxAutocompleteResults = max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT));
67
-		$minSearchStringLength = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0);
68
-		$topEntries = [];
69
-		if (strlen($filter ?? '') >= $minSearchStringLength) {
70
-			$entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults);
60
+    /**
61
+     * @param IUser $user
62
+     * @param string|null $filter
63
+     * @return array
64
+     */
65
+    public function getEntries(IUser $user, $filter) {
66
+        $maxAutocompleteResults = max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT));
67
+        $minSearchStringLength = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0);
68
+        $topEntries = [];
69
+        if (strlen($filter ?? '') >= $minSearchStringLength) {
70
+            $entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults);
71 71
 
72
-			$sortedEntries = $this->sortEntries($entries);
73
-			$topEntries = array_slice($sortedEntries, 0, $maxAutocompleteResults);
74
-			$this->processEntries($topEntries, $user);
75
-		}
72
+            $sortedEntries = $this->sortEntries($entries);
73
+            $topEntries = array_slice($sortedEntries, 0, $maxAutocompleteResults);
74
+            $this->processEntries($topEntries, $user);
75
+        }
76 76
 
77
-		$contactsEnabled = $this->appManager->isEnabledForUser('contacts', $user);
78
-		return [
79
-			'contacts' => $topEntries,
80
-			'contactsAppEnabled' => $contactsEnabled,
81
-		];
82
-	}
77
+        $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $user);
78
+        return [
79
+            'contacts' => $topEntries,
80
+            'contactsAppEnabled' => $contactsEnabled,
81
+        ];
82
+    }
83 83
 
84
-	/**
85
-	 * @param IUser $user
86
-	 * @param integer $shareType
87
-	 * @param string $shareWith
88
-	 * @return IEntry
89
-	 */
90
-	public function findOne(IUser $user, $shareType, $shareWith) {
91
-		$entry = $this->store->findOne($user, $shareType, $shareWith);
92
-		if ($entry) {
93
-			$this->processEntries([$entry], $user);
94
-		}
84
+    /**
85
+     * @param IUser $user
86
+     * @param integer $shareType
87
+     * @param string $shareWith
88
+     * @return IEntry
89
+     */
90
+    public function findOne(IUser $user, $shareType, $shareWith) {
91
+        $entry = $this->store->findOne($user, $shareType, $shareWith);
92
+        if ($entry) {
93
+            $this->processEntries([$entry], $user);
94
+        }
95 95
 
96
-		return $entry;
97
-	}
96
+        return $entry;
97
+    }
98 98
 
99
-	/**
100
-	 * @param IEntry[] $entries
101
-	 * @return IEntry[]
102
-	 */
103
-	private function sortEntries(array $entries) {
104
-		usort($entries, function (IEntry $entryA, IEntry $entryB) {
105
-			return strcasecmp($entryA->getFullName(), $entryB->getFullName());
106
-		});
107
-		return $entries;
108
-	}
99
+    /**
100
+     * @param IEntry[] $entries
101
+     * @return IEntry[]
102
+     */
103
+    private function sortEntries(array $entries) {
104
+        usort($entries, function (IEntry $entryA, IEntry $entryB) {
105
+            return strcasecmp($entryA->getFullName(), $entryB->getFullName());
106
+        });
107
+        return $entries;
108
+    }
109 109
 
110
-	/**
111
-	 * @param IEntry[] $entries
112
-	 * @param IUser $user
113
-	 */
114
-	private function processEntries(array $entries, IUser $user) {
115
-		$providers = $this->actionProviderStore->getProviders($user);
116
-		foreach ($entries as $entry) {
117
-			foreach ($providers as $provider) {
118
-				$provider->process($entry);
119
-			}
120
-		}
121
-	}
110
+    /**
111
+     * @param IEntry[] $entries
112
+     * @param IUser $user
113
+     */
114
+    private function processEntries(array $entries, IUser $user) {
115
+        $providers = $this->actionProviderStore->getProviders($user);
116
+        foreach ($entries as $entry) {
117
+            foreach ($providers as $provider) {
118
+                $provider->process($entry);
119
+            }
120
+        }
121
+    }
122 122
 }
Please login to merge, or discard this patch.
lib/private/Template/TemplateFileLocator.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -26,37 +26,37 @@
 block discarded – undo
26 26
 namespace OC\Template;
27 27
 
28 28
 class TemplateFileLocator {
29
-	protected $dirs;
30
-	private $path;
29
+    protected $dirs;
30
+    private $path;
31 31
 
32
-	/**
33
-	 * @param string[] $dirs
34
-	 */
35
-	public function __construct($dirs) {
36
-		$this->dirs = $dirs;
37
-	}
32
+    /**
33
+     * @param string[] $dirs
34
+     */
35
+    public function __construct($dirs) {
36
+        $this->dirs = $dirs;
37
+    }
38 38
 
39
-	/**
40
-	 * @param string $template
41
-	 * @return string
42
-	 * @throws \Exception
43
-	 */
44
-	public function find($template) {
45
-		if ($template === '') {
46
-			throw new \InvalidArgumentException('Empty template name');
47
-		}
39
+    /**
40
+     * @param string $template
41
+     * @return string
42
+     * @throws \Exception
43
+     */
44
+    public function find($template) {
45
+        if ($template === '') {
46
+            throw new \InvalidArgumentException('Empty template name');
47
+        }
48 48
 
49
-		foreach ($this->dirs as $dir) {
50
-			$file = $dir.$template.'.php';
51
-			if (is_file($file)) {
52
-				$this->path = $dir;
53
-				return $file;
54
-			}
55
-		}
56
-		throw new \Exception('template file not found: template:'.$template);
57
-	}
49
+        foreach ($this->dirs as $dir) {
50
+            $file = $dir.$template.'.php';
51
+            if (is_file($file)) {
52
+                $this->path = $dir;
53
+                return $file;
54
+            }
55
+        }
56
+        throw new \Exception('template file not found: template:'.$template);
57
+    }
58 58
 
59
-	public function getPath() {
60
-		return $this->path;
61
-	}
59
+    public function getPath() {
60
+        return $this->path;
61
+    }
62 62
 }
Please login to merge, or discard this patch.
lib/private/Template/JSResourceLocator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,20 +77,20 @@
 block discarded – undo
77 77
 
78 78
 		// missing translations files fill be ignored
79 79
 		if (strpos($script, 'l10n/') === 0) {
80
-			$this->appendIfExist($app_path, $script . '.js', $app_url);
80
+			$this->appendIfExist($app_path, $script.'.js', $app_url);
81 81
 			return;
82 82
 		}
83 83
 
84 84
 		if ($app_path === false && $app_url === false) {
85 85
 			$this->logger->error('Could not find resource {resource} to load', [
86
-				'resource' => $app . '/' . $script . '.js',
86
+				'resource' => $app.'/'.$script.'.js',
87 87
 				'app' => 'jsresourceloader',
88 88
 			]);
89 89
 			return;
90 90
 		}
91 91
 
92 92
 		if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
93
-			$this->append($app_path, $script . '.js', $app_url);
93
+			$this->append($app_path, $script.'.js', $app_url);
94 94
 		}
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -31,109 +31,109 @@
 block discarded – undo
31 31
 
32 32
 class JSResourceLocator extends ResourceLocator {
33 33
 
34
-	/** @var JSCombiner */
35
-	protected $jsCombiner;
36
-
37
-	public function __construct(LoggerInterface $logger, $theme, array $core_map, array $party_map, JSCombiner $JSCombiner) {
38
-		parent::__construct($logger, $theme, $core_map, $party_map);
39
-
40
-		$this->jsCombiner = $JSCombiner;
41
-	}
42
-
43
-	/**
44
-	 * @param string $script
45
-	 */
46
-	public function doFind($script) {
47
-		$theme_dir = 'themes/'.$this->theme.'/';
48
-		if (strpos($script, '3rdparty') === 0
49
-			&& $this->appendIfExist($this->thirdpartyroot, $script.'.js')) {
50
-			return;
51
-		}
52
-
53
-		// Extracting the appId and the script file name
54
-		$app = substr($script, 0, strpos($script, '/'));
55
-		$scriptName = basename($script);
56
-
57
-		if (strpos($script, '/l10n/') !== false) {
58
-			// For language files we try to load them all, so themes can overwrite
59
-			// single l10n strings without having to translate all of them.
60
-			$found = 0;
61
-			$found += $this->appendIfExist($this->serverroot, 'core/'.$script.'.js');
62
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js');
63
-			$found += $this->appendIfExist($this->serverroot, $script.'.js');
64
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js');
65
-			$found += $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js');
66
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js');
67
-
68
-			if ($found) {
69
-				return;
70
-			}
71
-		} elseif ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js')
72
-			|| $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js')
73
-			|| $this->appendIfExist($this->serverroot, $script.'.js')
74
-			|| $this->appendIfExist($this->serverroot, "dist/$app-$scriptName.js")
75
-			|| $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js')
76
-			|| $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json')
77
-			|| $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js')
78
-			|| $this->appendIfExist($this->serverroot, 'core/'.$script.'.js')
79
-			|| (strpos($scriptName, '/') === -1 && $this->appendIfExist($this->serverroot, "dist/core-$scriptName.js"))
80
-			|| $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json')
81
-		) {
82
-			return;
83
-		}
84
-
85
-		$script = substr($script, strpos($script, '/') + 1);
86
-		$app_path = \OC_App::getAppPath($app);
87
-		$app_url = \OC_App::getAppWebPath($app);
88
-
89
-		if ($app_path !== false) {
90
-			// Account for the possibility of having symlinks in app path. Only
91
-			// do this if $app_path is set, because an empty argument to realpath
92
-			// gets turned into cwd.
93
-			$app_path = realpath($app_path);
94
-		}
95
-
96
-		// missing translations files fill be ignored
97
-		if (strpos($script, 'l10n/') === 0) {
98
-			$this->appendIfExist($app_path, $script . '.js', $app_url);
99
-			return;
100
-		}
101
-
102
-		if ($app_path === false && $app_url === false) {
103
-			$this->logger->error('Could not find resource {resource} to load', [
104
-				'resource' => $app . '/' . $script . '.js',
105
-				'app' => 'jsresourceloader',
106
-			]);
107
-			return;
108
-		}
109
-
110
-		if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
111
-			$this->append($app_path, $script . '.js', $app_url);
112
-		}
113
-	}
114
-
115
-	/**
116
-	 * @param string $script
117
-	 */
118
-	public function doFindTheme($script) {
119
-	}
120
-
121
-	protected function cacheAndAppendCombineJsonIfExist($root, $file, $app = 'core') {
122
-		if (is_file($root.'/'.$file)) {
123
-			if ($this->jsCombiner->process($root, $file, $app)) {
124
-				$this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), false, false);
125
-			} else {
126
-				// Add all the files from the json
127
-				$files = $this->jsCombiner->getContent($root, $file);
128
-				$app_url = \OC_App::getAppWebPath($app);
129
-
130
-				foreach ($files as $jsFile) {
131
-					$this->append($root, $jsFile, $app_url);
132
-				}
133
-			}
134
-			return true;
135
-		}
136
-
137
-		return false;
138
-	}
34
+    /** @var JSCombiner */
35
+    protected $jsCombiner;
36
+
37
+    public function __construct(LoggerInterface $logger, $theme, array $core_map, array $party_map, JSCombiner $JSCombiner) {
38
+        parent::__construct($logger, $theme, $core_map, $party_map);
39
+
40
+        $this->jsCombiner = $JSCombiner;
41
+    }
42
+
43
+    /**
44
+     * @param string $script
45
+     */
46
+    public function doFind($script) {
47
+        $theme_dir = 'themes/'.$this->theme.'/';
48
+        if (strpos($script, '3rdparty') === 0
49
+            && $this->appendIfExist($this->thirdpartyroot, $script.'.js')) {
50
+            return;
51
+        }
52
+
53
+        // Extracting the appId and the script file name
54
+        $app = substr($script, 0, strpos($script, '/'));
55
+        $scriptName = basename($script);
56
+
57
+        if (strpos($script, '/l10n/') !== false) {
58
+            // For language files we try to load them all, so themes can overwrite
59
+            // single l10n strings without having to translate all of them.
60
+            $found = 0;
61
+            $found += $this->appendIfExist($this->serverroot, 'core/'.$script.'.js');
62
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js');
63
+            $found += $this->appendIfExist($this->serverroot, $script.'.js');
64
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js');
65
+            $found += $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js');
66
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js');
67
+
68
+            if ($found) {
69
+                return;
70
+            }
71
+        } elseif ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js')
72
+            || $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js')
73
+            || $this->appendIfExist($this->serverroot, $script.'.js')
74
+            || $this->appendIfExist($this->serverroot, "dist/$app-$scriptName.js")
75
+            || $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js')
76
+            || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json')
77
+            || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js')
78
+            || $this->appendIfExist($this->serverroot, 'core/'.$script.'.js')
79
+            || (strpos($scriptName, '/') === -1 && $this->appendIfExist($this->serverroot, "dist/core-$scriptName.js"))
80
+            || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json')
81
+        ) {
82
+            return;
83
+        }
84
+
85
+        $script = substr($script, strpos($script, '/') + 1);
86
+        $app_path = \OC_App::getAppPath($app);
87
+        $app_url = \OC_App::getAppWebPath($app);
88
+
89
+        if ($app_path !== false) {
90
+            // Account for the possibility of having symlinks in app path. Only
91
+            // do this if $app_path is set, because an empty argument to realpath
92
+            // gets turned into cwd.
93
+            $app_path = realpath($app_path);
94
+        }
95
+
96
+        // missing translations files fill be ignored
97
+        if (strpos($script, 'l10n/') === 0) {
98
+            $this->appendIfExist($app_path, $script . '.js', $app_url);
99
+            return;
100
+        }
101
+
102
+        if ($app_path === false && $app_url === false) {
103
+            $this->logger->error('Could not find resource {resource} to load', [
104
+                'resource' => $app . '/' . $script . '.js',
105
+                'app' => 'jsresourceloader',
106
+            ]);
107
+            return;
108
+        }
109
+
110
+        if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
111
+            $this->append($app_path, $script . '.js', $app_url);
112
+        }
113
+    }
114
+
115
+    /**
116
+     * @param string $script
117
+     */
118
+    public function doFindTheme($script) {
119
+    }
120
+
121
+    protected function cacheAndAppendCombineJsonIfExist($root, $file, $app = 'core') {
122
+        if (is_file($root.'/'.$file)) {
123
+            if ($this->jsCombiner->process($root, $file, $app)) {
124
+                $this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), false, false);
125
+            } else {
126
+                // Add all the files from the json
127
+                $files = $this->jsCombiner->getContent($root, $file);
128
+                $app_url = \OC_App::getAppWebPath($app);
129
+
130
+                foreach ($files as $jsFile) {
131
+                    $this->append($root, $jsFile, $app_url);
132
+                }
133
+            }
134
+            return true;
135
+        }
136
+
137
+        return false;
138
+    }
139 139
 }
Please login to merge, or discard this patch.
lib/private/Template/CSSResourceLocator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 
66 66
 		if ($app_path === false && $app_url === false) {
67 67
 			$this->logger->error('Could not find resource {resource} to load', [
68
-				'resource' => $app . '/' . $style . '.css',
68
+				'resource' => $app.'/'.$style.'.css',
69 69
 				'app' => 'cssresourceloader',
70 70
 			]);
71 71
 			return;
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -35,115 +35,115 @@
 block discarded – undo
35 35
 
36 36
 class CSSResourceLocator extends ResourceLocator {
37 37
 
38
-	/** @var SCSSCacher */
39
-	protected $scssCacher;
38
+    /** @var SCSSCacher */
39
+    protected $scssCacher;
40 40
 
41
-	/**
42
-	 * @param string $theme
43
-	 * @param array $core_map
44
-	 * @param array $party_map
45
-	 * @param SCSSCacher $scssCacher
46
-	 */
47
-	public function __construct(LoggerInterface $logger, $theme, $core_map, $party_map, $scssCacher) {
48
-		$this->scssCacher = $scssCacher;
41
+    /**
42
+     * @param string $theme
43
+     * @param array $core_map
44
+     * @param array $party_map
45
+     * @param SCSSCacher $scssCacher
46
+     */
47
+    public function __construct(LoggerInterface $logger, $theme, $core_map, $party_map, $scssCacher) {
48
+        $this->scssCacher = $scssCacher;
49 49
 
50
-		parent::__construct($logger, $theme, $core_map, $party_map);
51
-	}
50
+        parent::__construct($logger, $theme, $core_map, $party_map);
51
+    }
52 52
 
53
-	/**
54
-	 * @param string $style
55
-	 */
56
-	public function doFind($style) {
57
-		$app = substr($style, 0, strpos($style, '/'));
58
-		if (strpos($style, '3rdparty') === 0
59
-			&& $this->appendIfExist($this->thirdpartyroot, $style.'.css')
60
-			|| $this->cacheAndAppendScssIfExist($this->serverroot, $style.'.scss', $app)
61
-			|| $this->cacheAndAppendScssIfExist($this->serverroot, 'core/'.$style.'.scss')
62
-			|| $this->appendIfExist($this->serverroot, $style.'.css')
63
-			|| $this->appendIfExist($this->serverroot, 'core/'.$style.'.css')
64
-		) {
65
-			return;
66
-		}
67
-		$style = substr($style, strpos($style, '/') + 1);
68
-		$app_path = \OC_App::getAppPath($app);
69
-		$app_url = \OC_App::getAppWebPath($app);
53
+    /**
54
+     * @param string $style
55
+     */
56
+    public function doFind($style) {
57
+        $app = substr($style, 0, strpos($style, '/'));
58
+        if (strpos($style, '3rdparty') === 0
59
+            && $this->appendIfExist($this->thirdpartyroot, $style.'.css')
60
+            || $this->cacheAndAppendScssIfExist($this->serverroot, $style.'.scss', $app)
61
+            || $this->cacheAndAppendScssIfExist($this->serverroot, 'core/'.$style.'.scss')
62
+            || $this->appendIfExist($this->serverroot, $style.'.css')
63
+            || $this->appendIfExist($this->serverroot, 'core/'.$style.'.css')
64
+        ) {
65
+            return;
66
+        }
67
+        $style = substr($style, strpos($style, '/') + 1);
68
+        $app_path = \OC_App::getAppPath($app);
69
+        $app_url = \OC_App::getAppWebPath($app);
70 70
 
71
-		if ($app_path === false && $app_url === false) {
72
-			$this->logger->error('Could not find resource {resource} to load', [
73
-				'resource' => $app . '/' . $style . '.css',
74
-				'app' => 'cssresourceloader',
75
-			]);
76
-			return;
77
-		}
71
+        if ($app_path === false && $app_url === false) {
72
+            $this->logger->error('Could not find resource {resource} to load', [
73
+                'resource' => $app . '/' . $style . '.css',
74
+                'app' => 'cssresourceloader',
75
+            ]);
76
+            return;
77
+        }
78 78
 
79
-		// Account for the possibility of having symlinks in app path. Doing
80
-		// this here instead of above as an empty argument to realpath gets
81
-		// turned into cwd.
82
-		$app_path = realpath($app_path);
79
+        // Account for the possibility of having symlinks in app path. Doing
80
+        // this here instead of above as an empty argument to realpath gets
81
+        // turned into cwd.
82
+        $app_path = realpath($app_path);
83 83
 
84
-		if (!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) {
85
-			$this->append($app_path, $style.'.css', $app_url);
86
-		}
87
-	}
84
+        if (!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) {
85
+            $this->append($app_path, $style.'.css', $app_url);
86
+        }
87
+    }
88 88
 
89
-	/**
90
-	 * @param string $style
91
-	 */
92
-	public function doFindTheme($style) {
93
-		$theme_dir = 'themes/'.$this->theme.'/';
94
-		$this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$style.'.css')
95
-			|| $this->appendIfExist($this->serverroot, $theme_dir.$style.'.css')
96
-			|| $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$style.'.css');
97
-	}
89
+    /**
90
+     * @param string $style
91
+     */
92
+    public function doFindTheme($style) {
93
+        $theme_dir = 'themes/'.$this->theme.'/';
94
+        $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$style.'.css')
95
+            || $this->appendIfExist($this->serverroot, $theme_dir.$style.'.css')
96
+            || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$style.'.css');
97
+    }
98 98
 
99
-	/**
100
-	 * cache and append the scss $file if exist at $root
101
-	 *
102
-	 * @param string $root path to check
103
-	 * @param string $file the filename
104
-	 * @return bool True if the resource was found and cached, false otherwise
105
-	 */
106
-	protected function cacheAndAppendScssIfExist($root, $file, $app = 'core') {
107
-		if (is_file($root.'/'.$file)) {
108
-			if ($this->scssCacher !== null) {
109
-				if ($this->scssCacher->process($root, $file, $app)) {
110
-					$this->append($this->serverroot, $this->scssCacher->getCachedSCSS($app, $file), \OC::$WEBROOT, true, true);
111
-					return true;
112
-				} else {
113
-					$this->logger->warning('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'core']);
114
-					return false;
115
-				}
116
-			} else {
117
-				return true;
118
-			}
119
-		}
120
-		return false;
121
-	}
99
+    /**
100
+     * cache and append the scss $file if exist at $root
101
+     *
102
+     * @param string $root path to check
103
+     * @param string $file the filename
104
+     * @return bool True if the resource was found and cached, false otherwise
105
+     */
106
+    protected function cacheAndAppendScssIfExist($root, $file, $app = 'core') {
107
+        if (is_file($root.'/'.$file)) {
108
+            if ($this->scssCacher !== null) {
109
+                if ($this->scssCacher->process($root, $file, $app)) {
110
+                    $this->append($this->serverroot, $this->scssCacher->getCachedSCSS($app, $file), \OC::$WEBROOT, true, true);
111
+                    return true;
112
+                } else {
113
+                    $this->logger->warning('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'core']);
114
+                    return false;
115
+                }
116
+            } else {
117
+                return true;
118
+            }
119
+        }
120
+        return false;
121
+    }
122 122
 
123
-	public function append($root, $file, $webRoot = null, $throw = true, $scss = false) {
124
-		if (!$scss) {
125
-			parent::append($root, $file, $webRoot, $throw);
126
-		} else {
127
-			if (!$webRoot) {
128
-				$webRoot = $this->findWebRoot($root);
123
+    public function append($root, $file, $webRoot = null, $throw = true, $scss = false) {
124
+        if (!$scss) {
125
+            parent::append($root, $file, $webRoot, $throw);
126
+        } else {
127
+            if (!$webRoot) {
128
+                $webRoot = $this->findWebRoot($root);
129 129
 
130
-				if ($webRoot === null) {
131
-					$webRoot = '';
132
-					$this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [
133
-						'app' => 'lib',
134
-						'root' => $root,
135
-						'file' => $file,
136
-						'webRoot' => $webRoot,
137
-						'throw' => $throw ? 'true' : 'false'
138
-					]);
130
+                if ($webRoot === null) {
131
+                    $webRoot = '';
132
+                    $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [
133
+                        'app' => 'lib',
134
+                        'root' => $root,
135
+                        'file' => $file,
136
+                        'webRoot' => $webRoot,
137
+                        'throw' => $throw ? 'true' : 'false'
138
+                    ]);
139 139
 
140
-					if ($throw && $root === '/') {
141
-						throw new ResourceNotFoundException($file, $webRoot);
142
-					}
143
-				}
144
-			}
140
+                    if ($throw && $root === '/') {
141
+                        throw new ResourceNotFoundException($file, $webRoot);
142
+                    }
143
+                }
144
+            }
145 145
 
146
-			$this->resources[] = [$webRoot ?: \OC::$WEBROOT, $webRoot, $file];
147
-		}
148
-	}
146
+            $this->resources[] = [$webRoot ?: \OC::$WEBROOT, $webRoot, $file];
147
+        }
148
+    }
149 149
 }
Please login to merge, or discard this patch.