Passed
Push — master ( 730af0...3b14ce )
by Roeland
12:25 queued 11s
created
apps/user_ldap/lib/ConnectionFactory.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@
 block discarded – undo
25 25
 
26 26
 
27 27
 class ConnectionFactory {
28
-	/** @var ILDAPWrapper */
29
-	private $ldap;
28
+    /** @var ILDAPWrapper */
29
+    private $ldap;
30 30
 
31
-	public function __construct(ILDAPWrapper $ldap) {
32
-		$this->ldap = $ldap;
33
-	}
31
+    public function __construct(ILDAPWrapper $ldap) {
32
+        $this->ldap = $ldap;
33
+    }
34 34
 
35
-	public function get($prefix) {
36
-		return new Connection($this->ldap, $prefix, 'user_ldap');
37
-	}
35
+    public function get($prefix) {
36
+        return new Connection($this->ldap, $prefix, 'user_ldap');
37
+    }
38 38
 }
Please login to merge, or discard this patch.
apps/files/lib/Service/TagService.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -39,111 +39,111 @@
 block discarded – undo
39 39
  */
40 40
 class TagService {
41 41
 
42
-	/** @var IUserSession */
43
-	private $userSession;
44
-	/** @var IManager */
45
-	private $activityManager;
46
-	/** @var ITags */
47
-	private $tagger;
48
-	/** @var Folder */
49
-	private $homeFolder;
50
-	/** @var EventDispatcherInterface */
51
-	private $dispatcher;
42
+    /** @var IUserSession */
43
+    private $userSession;
44
+    /** @var IManager */
45
+    private $activityManager;
46
+    /** @var ITags */
47
+    private $tagger;
48
+    /** @var Folder */
49
+    private $homeFolder;
50
+    /** @var EventDispatcherInterface */
51
+    private $dispatcher;
52 52
 
53
-	/**
54
-	 * @param IUserSession $userSession
55
-	 * @param IManager $activityManager
56
-	 * @param ITags $tagger
57
-	 * @param Folder $homeFolder
58
-	 * @param EventDispatcherInterface $dispatcher
59
-	 */
60
-	public function __construct(
61
-		IUserSession $userSession,
62
-		IManager $activityManager,
63
-		ITags $tagger,
64
-		Folder $homeFolder,
65
-		EventDispatcherInterface $dispatcher
66
-	) {
67
-		$this->userSession = $userSession;
68
-		$this->activityManager = $activityManager;
69
-		$this->tagger = $tagger;
70
-		$this->homeFolder = $homeFolder;
71
-		$this->dispatcher = $dispatcher;
72
-	}
53
+    /**
54
+     * @param IUserSession $userSession
55
+     * @param IManager $activityManager
56
+     * @param ITags $tagger
57
+     * @param Folder $homeFolder
58
+     * @param EventDispatcherInterface $dispatcher
59
+     */
60
+    public function __construct(
61
+        IUserSession $userSession,
62
+        IManager $activityManager,
63
+        ITags $tagger,
64
+        Folder $homeFolder,
65
+        EventDispatcherInterface $dispatcher
66
+    ) {
67
+        $this->userSession = $userSession;
68
+        $this->activityManager = $activityManager;
69
+        $this->tagger = $tagger;
70
+        $this->homeFolder = $homeFolder;
71
+        $this->dispatcher = $dispatcher;
72
+    }
73 73
 
74
-	/**
75
-	 * Updates the tags of the specified file path.
76
-	 * The passed tags are absolute, which means they will
77
-	 * replace the actual tag selection.
78
-	 *
79
-	 * @param string $path path
80
-	 * @param array  $tags array of tags
81
-	 * @return array list of tags
82
-	 * @throws \OCP\Files\NotFoundException if the file does not exist
83
-	 */
84
-	public function updateFileTags($path, $tags) {
85
-		$fileId = $this->homeFolder->get($path)->getId();
74
+    /**
75
+     * Updates the tags of the specified file path.
76
+     * The passed tags are absolute, which means they will
77
+     * replace the actual tag selection.
78
+     *
79
+     * @param string $path path
80
+     * @param array  $tags array of tags
81
+     * @return array list of tags
82
+     * @throws \OCP\Files\NotFoundException if the file does not exist
83
+     */
84
+    public function updateFileTags($path, $tags) {
85
+        $fileId = $this->homeFolder->get($path)->getId();
86 86
 
87
-		$currentTags = $this->tagger->getTagsForObjects(array($fileId));
87
+        $currentTags = $this->tagger->getTagsForObjects(array($fileId));
88 88
 
89
-		if (!empty($currentTags)) {
90
-			$currentTags = current($currentTags);
91
-		}
89
+        if (!empty($currentTags)) {
90
+            $currentTags = current($currentTags);
91
+        }
92 92
 
93
-		$newTags = array_diff($tags, $currentTags);
94
-		foreach ($newTags as $tag) {
95
-			if ($tag === Tags::TAG_FAVORITE) {
96
-				$this->addActivity(true, $fileId, $path);
97
-			}
98
-			$this->tagger->tagAs($fileId, $tag);
99
-		}
100
-		$deletedTags = array_diff($currentTags, $tags);
101
-		foreach ($deletedTags as $tag) {
102
-			if ($tag === Tags::TAG_FAVORITE) {
103
-				$this->addActivity(false, $fileId, $path);
104
-			}
105
-			$this->tagger->unTag($fileId, $tag);
106
-		}
93
+        $newTags = array_diff($tags, $currentTags);
94
+        foreach ($newTags as $tag) {
95
+            if ($tag === Tags::TAG_FAVORITE) {
96
+                $this->addActivity(true, $fileId, $path);
97
+            }
98
+            $this->tagger->tagAs($fileId, $tag);
99
+        }
100
+        $deletedTags = array_diff($currentTags, $tags);
101
+        foreach ($deletedTags as $tag) {
102
+            if ($tag === Tags::TAG_FAVORITE) {
103
+                $this->addActivity(false, $fileId, $path);
104
+            }
105
+            $this->tagger->unTag($fileId, $tag);
106
+        }
107 107
 
108
-		// TODO: re-read from tagger to make sure the
109
-		// list is up to date, in case of concurrent changes ?
110
-		return $tags;
111
-	}
108
+        // TODO: re-read from tagger to make sure the
109
+        // list is up to date, in case of concurrent changes ?
110
+        return $tags;
111
+    }
112 112
 
113
-	/**
114
-	 * @param bool $addToFavorite
115
-	 * @param int $fileId
116
-	 * @param string $path
117
-	 */
118
-	protected function addActivity($addToFavorite, $fileId, $path) {
119
-		$user = $this->userSession->getUser();
120
-		if (!$user instanceof IUser) {
121
-			return;
122
-		}
113
+    /**
114
+     * @param bool $addToFavorite
115
+     * @param int $fileId
116
+     * @param string $path
117
+     */
118
+    protected function addActivity($addToFavorite, $fileId, $path) {
119
+        $user = $this->userSession->getUser();
120
+        if (!$user instanceof IUser) {
121
+            return;
122
+        }
123 123
 
124
-		$eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite';
125
-		$this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [
126
-			'userId' => $user->getUID(),
127
-			'fileId' => $fileId,
128
-			'path' => $path,
129
-		]));
124
+        $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite';
125
+        $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [
126
+            'userId' => $user->getUID(),
127
+            'fileId' => $fileId,
128
+            'path' => $path,
129
+        ]));
130 130
 
131
-		$event = $this->activityManager->generateEvent();
132
-		try {
133
-			$event->setApp('files')
134
-				->setObject('files', $fileId, $path)
135
-				->setType('favorite')
136
-				->setAuthor($user->getUID())
137
-				->setAffectedUser($user->getUID())
138
-				->setTimestamp(time())
139
-				->setSubject(
140
-					$addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED,
141
-					['id' => $fileId, 'path' => $path]
142
-				);
143
-			$this->activityManager->publish($event);
144
-		} catch (\InvalidArgumentException $e) {
145
-		} catch (\BadMethodCallException $e) {
146
-		}
147
-	}
131
+        $event = $this->activityManager->generateEvent();
132
+        try {
133
+            $event->setApp('files')
134
+                ->setObject('files', $fileId, $path)
135
+                ->setType('favorite')
136
+                ->setAuthor($user->getUID())
137
+                ->setAffectedUser($user->getUID())
138
+                ->setTimestamp(time())
139
+                ->setSubject(
140
+                    $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED,
141
+                    ['id' => $fileId, 'path' => $path]
142
+                );
143
+            $this->activityManager->publish($event);
144
+        } catch (\InvalidArgumentException $e) {
145
+        } catch (\BadMethodCallException $e) {
146
+        }
147
+    }
148 148
 }
149 149
 
Please login to merge, or discard this patch.
apps/files_sharing/lib/External/Mount.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -29,53 +29,53 @@
 block discarded – undo
29 29
 
30 30
 class Mount extends MountPoint implements MoveableMount {
31 31
 
32
-	/**
33
-	 * @var \OCA\Files_Sharing\External\Manager
34
-	 */
35
-	protected $manager;
32
+    /**
33
+     * @var \OCA\Files_Sharing\External\Manager
34
+     */
35
+    protected $manager;
36 36
 
37
-	/**
38
-	 * @param string|\OC\Files\Storage\Storage $storage
39
-	 * @param string $mountpoint
40
-	 * @param array $options
41
-	 * @param \OCA\Files_Sharing\External\Manager $manager
42
-	 * @param \OC\Files\Storage\StorageFactory $loader
43
-	 */
44
-	public function __construct($storage, $mountpoint, $options, $manager, $loader = null) {
45
-		parent::__construct($storage, $mountpoint, $options, $loader);
46
-		$this->manager = $manager;
47
-	}
37
+    /**
38
+     * @param string|\OC\Files\Storage\Storage $storage
39
+     * @param string $mountpoint
40
+     * @param array $options
41
+     * @param \OCA\Files_Sharing\External\Manager $manager
42
+     * @param \OC\Files\Storage\StorageFactory $loader
43
+     */
44
+    public function __construct($storage, $mountpoint, $options, $manager, $loader = null) {
45
+        parent::__construct($storage, $mountpoint, $options, $loader);
46
+        $this->manager = $manager;
47
+    }
48 48
 
49
-	/**
50
-	 * Move the mount point to $target
51
-	 *
52
-	 * @param string $target the target mount point
53
-	 * @return bool
54
-	 */
55
-	public function moveMount($target) {
56
-		$result = $this->manager->setMountPoint($this->mountPoint, $target);
57
-		$this->setMountPoint($target);
49
+    /**
50
+     * Move the mount point to $target
51
+     *
52
+     * @param string $target the target mount point
53
+     * @return bool
54
+     */
55
+    public function moveMount($target) {
56
+        $result = $this->manager->setMountPoint($this->mountPoint, $target);
57
+        $this->setMountPoint($target);
58 58
 
59
-		return $result;
60
-	}
59
+        return $result;
60
+    }
61 61
 
62
-	/**
63
-	 * Remove the mount points
64
-	 *
65
-	 * @return mixed
66
-	 * @return bool
67
-	 */
68
-	public function removeMount() {
69
-		return $this->manager->removeShare($this->mountPoint);
70
-	}
62
+    /**
63
+     * Remove the mount points
64
+     *
65
+     * @return mixed
66
+     * @return bool
67
+     */
68
+    public function removeMount() {
69
+        return $this->manager->removeShare($this->mountPoint);
70
+    }
71 71
 
72
-	/**
73
-	 * Get the type of mount point, used to distinguish things like shares and external storages
74
-	 * in the web interface
75
-	 *
76
-	 * @return string
77
-	 */
78
-	public function getMountType() {
79
-		return 'shared';
80
-	}
72
+    /**
73
+     * Get the type of mount point, used to distinguish things like shares and external storages
74
+     * in the web interface
75
+     *
76
+     * @return string
77
+     */
78
+    public function getMountType() {
79
+        return 'shared';
80
+    }
81 81
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,27 +30,27 @@
 block discarded – undo
30 30
 
31 31
 class MySqlExpressionBuilder extends ExpressionBuilder {
32 32
 
33
-	/** @var string */
34
-	protected $charset;
35
-
36
-	/**
37
-	 * @param \OCP\IDBConnection|Connection $connection
38
-	 * @param IQueryBuilder $queryBuilder
39
-	 */
40
-	public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
41
-		parent::__construct($connection, $queryBuilder);
42
-
43
-		$params = $connection->getParams();
44
-		$this->charset = isset($params['charset']) ? $params['charset'] : 'utf8';
45
-	}
46
-
47
-	/**
48
-	 * @inheritdoc
49
-	 */
50
-	public function iLike($x, $y, $type = null) {
51
-		$x = $this->helper->quoteColumnName($x);
52
-		$y = $this->helper->quoteColumnName($y);
53
-		return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y);
54
-	}
33
+    /** @var string */
34
+    protected $charset;
35
+
36
+    /**
37
+     * @param \OCP\IDBConnection|Connection $connection
38
+     * @param IQueryBuilder $queryBuilder
39
+     */
40
+    public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) {
41
+        parent::__construct($connection, $queryBuilder);
42
+
43
+        $params = $connection->getParams();
44
+        $this->charset = isset($params['charset']) ? $params['charset'] : 'utf8';
45
+    }
46
+
47
+    /**
48
+     * @inheritdoc
49
+     */
50
+    public function iLike($x, $y, $type = null) {
51
+        $x = $this->helper->quoteColumnName($x);
52
+        $y = $this->helper->quoteColumnName($y);
53
+        return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y);
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
lib/private/Memcache/APCu.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -30,140 +30,140 @@
 block discarded – undo
30 30
 use OCP\IMemcache;
31 31
 
32 32
 class APCu extends Cache implements IMemcache {
33
-	use CASTrait {
34
-		cas as casEmulated;
35
-	}
33
+    use CASTrait {
34
+        cas as casEmulated;
35
+    }
36 36
 
37
-	use CADTrait;
37
+    use CADTrait;
38 38
 
39
-	public function get($key) {
40
-		$result = apcu_fetch($this->getPrefix() . $key, $success);
41
-		if (!$success) {
42
-			return null;
43
-		}
44
-		return $result;
45
-	}
39
+    public function get($key) {
40
+        $result = apcu_fetch($this->getPrefix() . $key, $success);
41
+        if (!$success) {
42
+            return null;
43
+        }
44
+        return $result;
45
+    }
46 46
 
47
-	public function set($key, $value, $ttl = 0) {
48
-		return apcu_store($this->getPrefix() . $key, $value, $ttl);
49
-	}
47
+    public function set($key, $value, $ttl = 0) {
48
+        return apcu_store($this->getPrefix() . $key, $value, $ttl);
49
+    }
50 50
 
51
-	public function hasKey($key) {
52
-		return apcu_exists($this->getPrefix() . $key);
53
-	}
51
+    public function hasKey($key) {
52
+        return apcu_exists($this->getPrefix() . $key);
53
+    }
54 54
 
55
-	public function remove($key) {
56
-		return apcu_delete($this->getPrefix() . $key);
57
-	}
55
+    public function remove($key) {
56
+        return apcu_delete($this->getPrefix() . $key);
57
+    }
58 58
 
59
-	public function clear($prefix = '') {
60
-		$ns = $this->getPrefix() . $prefix;
61
-		$ns = preg_quote($ns, '/');
62
-		if(class_exists('\APCIterator')) {
63
-			$iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
64
-		} else {
65
-			$iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
66
-		}
67
-		return apcu_delete($iter);
68
-	}
59
+    public function clear($prefix = '') {
60
+        $ns = $this->getPrefix() . $prefix;
61
+        $ns = preg_quote($ns, '/');
62
+        if(class_exists('\APCIterator')) {
63
+            $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
64
+        } else {
65
+            $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
66
+        }
67
+        return apcu_delete($iter);
68
+    }
69 69
 
70
-	/**
71
-	 * Set a value in the cache if it's not already stored
72
-	 *
73
-	 * @param string $key
74
-	 * @param mixed $value
75
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
76
-	 * @return bool
77
-	 */
78
-	public function add($key, $value, $ttl = 0) {
79
-		return apcu_add($this->getPrefix() . $key, $value, $ttl);
80
-	}
70
+    /**
71
+     * Set a value in the cache if it's not already stored
72
+     *
73
+     * @param string $key
74
+     * @param mixed $value
75
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
76
+     * @return bool
77
+     */
78
+    public function add($key, $value, $ttl = 0) {
79
+        return apcu_add($this->getPrefix() . $key, $value, $ttl);
80
+    }
81 81
 
82
-	/**
83
-	 * Increase a stored number
84
-	 *
85
-	 * @param string $key
86
-	 * @param int $step
87
-	 * @return int | bool
88
-	 */
89
-	public function inc($key, $step = 1) {
90
-		$this->add($key, 0);
91
-		/**
92
-		 * TODO - hack around a PHP 7 specific issue in APCu
93
-		 *
94
-		 * on PHP 7 the apcu_inc method on a non-existing object will increment
95
-		 * "0" and result in "1" as value - therefore we check for existence
96
-		 * first
97
-		 *
98
-		 * on PHP 5.6 this is not the case
99
-		 *
100
-		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
101
-		 * for details
102
-		 */
103
-		return apcu_exists($this->getPrefix() . $key)
104
-			? apcu_inc($this->getPrefix() . $key, $step)
105
-			: false;
106
-	}
82
+    /**
83
+     * Increase a stored number
84
+     *
85
+     * @param string $key
86
+     * @param int $step
87
+     * @return int | bool
88
+     */
89
+    public function inc($key, $step = 1) {
90
+        $this->add($key, 0);
91
+        /**
92
+         * TODO - hack around a PHP 7 specific issue in APCu
93
+         *
94
+         * on PHP 7 the apcu_inc method on a non-existing object will increment
95
+         * "0" and result in "1" as value - therefore we check for existence
96
+         * first
97
+         *
98
+         * on PHP 5.6 this is not the case
99
+         *
100
+         * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
101
+         * for details
102
+         */
103
+        return apcu_exists($this->getPrefix() . $key)
104
+            ? apcu_inc($this->getPrefix() . $key, $step)
105
+            : false;
106
+    }
107 107
 
108
-	/**
109
-	 * Decrease a stored number
110
-	 *
111
-	 * @param string $key
112
-	 * @param int $step
113
-	 * @return int | bool
114
-	 */
115
-	public function dec($key, $step = 1) {
116
-		/**
117
-		 * TODO - hack around a PHP 7 specific issue in APCu
118
-		 *
119
-		 * on PHP 7 the apcu_dec method on a non-existing object will decrement
120
-		 * "0" and result in "-1" as value - therefore we check for existence
121
-		 * first
122
-		 *
123
-		 * on PHP 5.6 this is not the case
124
-		 *
125
-		 * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
126
-		 * for details
127
-		 */
128
-		return apcu_exists($this->getPrefix() . $key)
129
-			? apcu_dec($this->getPrefix() . $key, $step)
130
-			: false;
131
-	}
108
+    /**
109
+     * Decrease a stored number
110
+     *
111
+     * @param string $key
112
+     * @param int $step
113
+     * @return int | bool
114
+     */
115
+    public function dec($key, $step = 1) {
116
+        /**
117
+         * TODO - hack around a PHP 7 specific issue in APCu
118
+         *
119
+         * on PHP 7 the apcu_dec method on a non-existing object will decrement
120
+         * "0" and result in "-1" as value - therefore we check for existence
121
+         * first
122
+         *
123
+         * on PHP 5.6 this is not the case
124
+         *
125
+         * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
126
+         * for details
127
+         */
128
+        return apcu_exists($this->getPrefix() . $key)
129
+            ? apcu_dec($this->getPrefix() . $key, $step)
130
+            : false;
131
+    }
132 132
 
133
-	/**
134
-	 * Compare and set
135
-	 *
136
-	 * @param string $key
137
-	 * @param mixed $old
138
-	 * @param mixed $new
139
-	 * @return bool
140
-	 */
141
-	public function cas($key, $old, $new) {
142
-		// apc only does cas for ints
143
-		if (is_int($old) and is_int($new)) {
144
-			return apcu_cas($this->getPrefix() . $key, $old, $new);
145
-		} else {
146
-			return $this->casEmulated($key, $old, $new);
147
-		}
148
-	}
133
+    /**
134
+     * Compare and set
135
+     *
136
+     * @param string $key
137
+     * @param mixed $old
138
+     * @param mixed $new
139
+     * @return bool
140
+     */
141
+    public function cas($key, $old, $new) {
142
+        // apc only does cas for ints
143
+        if (is_int($old) and is_int($new)) {
144
+            return apcu_cas($this->getPrefix() . $key, $old, $new);
145
+        } else {
146
+            return $this->casEmulated($key, $old, $new);
147
+        }
148
+    }
149 149
 
150
-	/**
151
-	 * @return bool
152
-	 */
153
-	static public function isAvailable() {
154
-		if (!extension_loaded('apcu')) {
155
-			return false;
156
-		} elseif (!\OC::$server->getIniWrapper()->getBool('apc.enabled')) {
157
-			return false;
158
-		} elseif (!\OC::$server->getIniWrapper()->getBool('apc.enable_cli') && \OC::$CLI) {
159
-			return false;
160
-		} elseif (
161
-				version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
162
-				version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1
163
-		) {
164
-			return false;
165
-		} else {
166
-			return true;
167
-		}
168
-	}
150
+    /**
151
+     * @return bool
152
+     */
153
+    static public function isAvailable() {
154
+        if (!extension_loaded('apcu')) {
155
+            return false;
156
+        } elseif (!\OC::$server->getIniWrapper()->getBool('apc.enabled')) {
157
+            return false;
158
+        } elseif (!\OC::$server->getIniWrapper()->getBool('apc.enable_cli') && \OC::$CLI) {
159
+            return false;
160
+        } elseif (
161
+                version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
162
+                version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1
163
+        ) {
164
+            return false;
165
+        } else {
166
+            return true;
167
+        }
168
+    }
169 169
 }
Please login to merge, or discard this patch.
lib/private/App/CodeChecker/DatabaseSchemaChecker.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -25,81 +25,81 @@
 block discarded – undo
25 25
 
26 26
 class DatabaseSchemaChecker {
27 27
 
28
-	/**
29
-	 * @param string $appId
30
-	 * @return array
31
-	 */
32
-	public function analyse($appId) {
33
-		$appPath = \OC_App::getAppPath($appId);
34
-		if ($appPath === false) {
35
-			throw new \RuntimeException("No app with given id <$appId> known.");
36
-		}
37
-
38
-		if (!file_exists($appPath . '/appinfo/database.xml')) {
39
-			return ['errors' => [], 'warnings' => []];
40
-		}
41
-
42
-		libxml_use_internal_errors(true);
43
-		$loadEntities = libxml_disable_entity_loader(false);
44
-		$xml = simplexml_load_file($appPath . '/appinfo/database.xml');
45
-		libxml_disable_entity_loader($loadEntities);
46
-
47
-
48
-		$errors = $warnings = [];
49
-
50
-		foreach ($xml->table as $table) {
51
-			// Table names
52
-			if (strpos((string)$table->name, '*dbprefix*') !== 0) {
53
-				$errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*';
54
-			}
55
-			$tableName = substr((string)$table->name, strlen('*dbprefix*'));
56
-			if (strpos($tableName, '*dbprefix*') !== false) {
57
-				$warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name;
58
-			}
59
-
60
-			if (strlen($tableName) > 27) {
61
-				$errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
62
-			}
63
-
64
-			$hasAutoIncrement = false;
65
-
66
-			// Column names
67
-			foreach ($table->declaration->field as $column) {
68
-				if (strpos((string)$column->name, '*dbprefix*') !== false) {
69
-					$warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name;
70
-				}
71
-
72
-				if (strlen((string)$column->name) > 30) {
73
-					$errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed';
74
-				}
75
-
76
-				if ($column->autoincrement) {
77
-					if ($hasAutoIncrement) {
78
-						$errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns';
79
-					}
80
-
81
-					if (strlen($tableName) > 21) {
82
-						$errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
83
-					}
84
-
85
-					$hasAutoIncrement = true;
86
-				}
87
-			}
88
-
89
-			// Index names
90
-			foreach ($table->declaration->index as $index) {
91
-				$hasPrefix = strpos((string)$index->name, '*dbprefix*');
92
-				if ($hasPrefix !== false && $hasPrefix !== 0) {
93
-					$warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name;
94
-				}
95
-
96
-				$indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name;
97
-				if (strlen($indexName) > 27) {
98
-					$errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed';
99
-				}
100
-			}
101
-		}
102
-
103
-		return ['errors' => $errors, 'warnings' => $warnings];
104
-	}
28
+    /**
29
+     * @param string $appId
30
+     * @return array
31
+     */
32
+    public function analyse($appId) {
33
+        $appPath = \OC_App::getAppPath($appId);
34
+        if ($appPath === false) {
35
+            throw new \RuntimeException("No app with given id <$appId> known.");
36
+        }
37
+
38
+        if (!file_exists($appPath . '/appinfo/database.xml')) {
39
+            return ['errors' => [], 'warnings' => []];
40
+        }
41
+
42
+        libxml_use_internal_errors(true);
43
+        $loadEntities = libxml_disable_entity_loader(false);
44
+        $xml = simplexml_load_file($appPath . '/appinfo/database.xml');
45
+        libxml_disable_entity_loader($loadEntities);
46
+
47
+
48
+        $errors = $warnings = [];
49
+
50
+        foreach ($xml->table as $table) {
51
+            // Table names
52
+            if (strpos((string)$table->name, '*dbprefix*') !== 0) {
53
+                $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*';
54
+            }
55
+            $tableName = substr((string)$table->name, strlen('*dbprefix*'));
56
+            if (strpos($tableName, '*dbprefix*') !== false) {
57
+                $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name;
58
+            }
59
+
60
+            if (strlen($tableName) > 27) {
61
+                $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
62
+            }
63
+
64
+            $hasAutoIncrement = false;
65
+
66
+            // Column names
67
+            foreach ($table->declaration->field as $column) {
68
+                if (strpos((string)$column->name, '*dbprefix*') !== false) {
69
+                    $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name;
70
+                }
71
+
72
+                if (strlen((string)$column->name) > 30) {
73
+                    $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed';
74
+                }
75
+
76
+                if ($column->autoincrement) {
77
+                    if ($hasAutoIncrement) {
78
+                        $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns';
79
+                    }
80
+
81
+                    if (strlen($tableName) > 21) {
82
+                        $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed';
83
+                    }
84
+
85
+                    $hasAutoIncrement = true;
86
+                }
87
+            }
88
+
89
+            // Index names
90
+            foreach ($table->declaration->index as $index) {
91
+                $hasPrefix = strpos((string)$index->name, '*dbprefix*');
92
+                if ($hasPrefix !== false && $hasPrefix !== 0) {
93
+                    $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name;
94
+                }
95
+
96
+                $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name;
97
+                if (strlen($indexName) > 27) {
98
+                    $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed';
99
+                }
100
+            }
101
+        }
102
+
103
+        return ['errors' => $errors, 'warnings' => $warnings];
104
+    }
105 105
 }
Please login to merge, or discard this patch.
core/Command/Maintenance/UpdateHtaccess.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@
 block discarded – undo
32 32
 
33 33
 class UpdateHtaccess extends Command {
34 34
 
35
-	protected function configure() {
36
-		$this
37
-			->setName('maintenance:update:htaccess')
38
-			->setDescription('Updates the .htaccess file');
39
-	}
35
+    protected function configure() {
36
+        $this
37
+            ->setName('maintenance:update:htaccess')
38
+            ->setDescription('Updates the .htaccess file');
39
+    }
40 40
 
41
-	protected function execute(InputInterface $input, OutputInterface $output) {
42
-		if (\OC\Setup::updateHtaccess()) {
43
-			$output->writeln('.htaccess has been updated');
44
-			return 0;
45
-		} else {
46
-			$output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>');
47
-			return 1;
48
-		}
49
-	}
41
+    protected function execute(InputInterface $input, OutputInterface $output) {
42
+        if (\OC\Setup::updateHtaccess()) {
43
+            $output->writeln('.htaccess has been updated');
44
+            return 0;
45
+        } else {
46
+            $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>');
47
+            return 1;
48
+        }
49
+    }
50 50
 }
Please login to merge, or discard this patch.
lib/public/IImage.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -29,164 +29,164 @@
 block discarded – undo
29 29
  * @since 8.1.0
30 30
  */
31 31
 interface IImage {
32
-	/**
33
-	 * Determine whether the object contains an image resource.
34
-	 *
35
-	 * @return bool
36
-	 * @since 8.1.0
37
-	 */
38
-	public function valid();
39
-
40
-	/**
41
-	 * Returns the MIME type of the image or an empty string if no image is loaded.
42
-	 *
43
-	 * @return string
44
-	 * @since 8.1.0
45
-	 */
46
-	public function mimeType();
47
-
48
-	/**
49
-	 * Returns the width of the image or -1 if no image is loaded.
50
-	 *
51
-	 * @return int
52
-	 * @since 8.1.0
53
-	 */
54
-	public function width();
55
-
56
-	/**
57
-	 * Returns the height of the image or -1 if no image is loaded.
58
-	 *
59
-	 * @return int
60
-	 * @since 8.1.0
61
-	 */
62
-	public function height();
63
-
64
-	/**
65
-	 * Returns the width when the image orientation is top-left.
66
-	 *
67
-	 * @return int
68
-	 * @since 8.1.0
69
-	 */
70
-	public function widthTopLeft();
71
-
72
-	/**
73
-	 * Returns the height when the image orientation is top-left.
74
-	 *
75
-	 * @return int
76
-	 * @since 8.1.0
77
-	 */
78
-	public function heightTopLeft();
79
-
80
-	/**
81
-	 * Outputs the image.
82
-	 *
83
-	 * @param string $mimeType
84
-	 * @return bool
85
-	 * @since 8.1.0
86
-	 */
87
-	public function show($mimeType = null);
88
-
89
-	/**
90
-	 * Saves the image.
91
-	 *
92
-	 * @param string $filePath
93
-	 * @param string $mimeType
94
-	 * @return bool
95
-	 * @since 8.1.0
96
-	 */
97
-	public function save($filePath = null, $mimeType = null);
98
-
99
-	/**
100
-	 * @return resource Returns the image resource in any.
101
-	 * @since 8.1.0
102
-	 */
103
-	public function resource();
104
-
105
-	/**
106
-	 * @return string Returns the raw data mimetype
107
-	 * @since 13.0.0
108
-	 */
109
-	public function dataMimeType();
110
-
111
-	/**
112
-	 * @return string Returns the raw image data.
113
-	 * @since 8.1.0
114
-	 */
115
-	public function data();
116
-
117
-	/**
118
-	 * (I'm open for suggestions on better method name ;)
119
-	 * Get the orientation based on EXIF data.
120
-	 *
121
-	 * @return int The orientation or -1 if no EXIF data is available.
122
-	 * @since 8.1.0
123
-	 */
124
-	public function getOrientation();
125
-
126
-	/**
127
-	 * (I'm open for suggestions on better method name ;)
128
-	 * Fixes orientation based on EXIF data.
129
-	 *
130
-	 * @return bool
131
-	 * @since 8.1.0
132
-	 */
133
-	public function fixOrientation();
134
-
135
-	/**
136
-	 * Resizes the image preserving ratio.
137
-	 *
138
-	 * @param integer $maxSize The maximum size of either the width or height.
139
-	 * @return bool
140
-	 * @since 8.1.0
141
-	 */
142
-	public function resize($maxSize);
143
-
144
-	/**
145
-	 * @param int $width
146
-	 * @param int $height
147
-	 * @return bool
148
-	 * @since 8.1.0
149
-	 */
150
-	public function preciseResize(int $width, int $height): bool;
151
-
152
-	/**
153
-	 * Crops the image to the middle square. If the image is already square it just returns.
154
-	 *
155
-	 * @param int $size maximum size for the result (optional)
156
-	 * @return bool for success or failure
157
-	 * @since 8.1.0
158
-	 */
159
-	public function centerCrop($size = 0);
160
-
161
-	/**
162
-	 * Crops the image from point $x$y with dimension $wx$h.
163
-	 *
164
-	 * @param int $x Horizontal position
165
-	 * @param int $y Vertical position
166
-	 * @param int $w Width
167
-	 * @param int $h Height
168
-	 * @return bool for success or failure
169
-	 * @since 8.1.0
170
-	 */
171
-	public function crop(int $x, int $y, int $w, int $h): bool;
172
-
173
-	/**
174
-	 * Resizes the image to fit within a boundary while preserving ratio.
175
-	 *
176
-	 * @param integer $maxWidth
177
-	 * @param integer $maxHeight
178
-	 * @return bool
179
-	 * @since 8.1.0
180
-	 */
181
-	public function fitIn($maxWidth, $maxHeight);
182
-
183
-	/**
184
-	 * Shrinks the image to fit within a boundary while preserving ratio.
185
-	 *
186
-	 * @param integer $maxWidth
187
-	 * @param integer $maxHeight
188
-	 * @return bool
189
-	 * @since 8.1.0
190
-	 */
191
-	public function scaleDownToFit($maxWidth, $maxHeight);
32
+    /**
33
+     * Determine whether the object contains an image resource.
34
+     *
35
+     * @return bool
36
+     * @since 8.1.0
37
+     */
38
+    public function valid();
39
+
40
+    /**
41
+     * Returns the MIME type of the image or an empty string if no image is loaded.
42
+     *
43
+     * @return string
44
+     * @since 8.1.0
45
+     */
46
+    public function mimeType();
47
+
48
+    /**
49
+     * Returns the width of the image or -1 if no image is loaded.
50
+     *
51
+     * @return int
52
+     * @since 8.1.0
53
+     */
54
+    public function width();
55
+
56
+    /**
57
+     * Returns the height of the image or -1 if no image is loaded.
58
+     *
59
+     * @return int
60
+     * @since 8.1.0
61
+     */
62
+    public function height();
63
+
64
+    /**
65
+     * Returns the width when the image orientation is top-left.
66
+     *
67
+     * @return int
68
+     * @since 8.1.0
69
+     */
70
+    public function widthTopLeft();
71
+
72
+    /**
73
+     * Returns the height when the image orientation is top-left.
74
+     *
75
+     * @return int
76
+     * @since 8.1.0
77
+     */
78
+    public function heightTopLeft();
79
+
80
+    /**
81
+     * Outputs the image.
82
+     *
83
+     * @param string $mimeType
84
+     * @return bool
85
+     * @since 8.1.0
86
+     */
87
+    public function show($mimeType = null);
88
+
89
+    /**
90
+     * Saves the image.
91
+     *
92
+     * @param string $filePath
93
+     * @param string $mimeType
94
+     * @return bool
95
+     * @since 8.1.0
96
+     */
97
+    public function save($filePath = null, $mimeType = null);
98
+
99
+    /**
100
+     * @return resource Returns the image resource in any.
101
+     * @since 8.1.0
102
+     */
103
+    public function resource();
104
+
105
+    /**
106
+     * @return string Returns the raw data mimetype
107
+     * @since 13.0.0
108
+     */
109
+    public function dataMimeType();
110
+
111
+    /**
112
+     * @return string Returns the raw image data.
113
+     * @since 8.1.0
114
+     */
115
+    public function data();
116
+
117
+    /**
118
+     * (I'm open for suggestions on better method name ;)
119
+     * Get the orientation based on EXIF data.
120
+     *
121
+     * @return int The orientation or -1 if no EXIF data is available.
122
+     * @since 8.1.0
123
+     */
124
+    public function getOrientation();
125
+
126
+    /**
127
+     * (I'm open for suggestions on better method name ;)
128
+     * Fixes orientation based on EXIF data.
129
+     *
130
+     * @return bool
131
+     * @since 8.1.0
132
+     */
133
+    public function fixOrientation();
134
+
135
+    /**
136
+     * Resizes the image preserving ratio.
137
+     *
138
+     * @param integer $maxSize The maximum size of either the width or height.
139
+     * @return bool
140
+     * @since 8.1.0
141
+     */
142
+    public function resize($maxSize);
143
+
144
+    /**
145
+     * @param int $width
146
+     * @param int $height
147
+     * @return bool
148
+     * @since 8.1.0
149
+     */
150
+    public function preciseResize(int $width, int $height): bool;
151
+
152
+    /**
153
+     * Crops the image to the middle square. If the image is already square it just returns.
154
+     *
155
+     * @param int $size maximum size for the result (optional)
156
+     * @return bool for success or failure
157
+     * @since 8.1.0
158
+     */
159
+    public function centerCrop($size = 0);
160
+
161
+    /**
162
+     * Crops the image from point $x$y with dimension $wx$h.
163
+     *
164
+     * @param int $x Horizontal position
165
+     * @param int $y Vertical position
166
+     * @param int $w Width
167
+     * @param int $h Height
168
+     * @return bool for success or failure
169
+     * @since 8.1.0
170
+     */
171
+    public function crop(int $x, int $y, int $w, int $h): bool;
172
+
173
+    /**
174
+     * Resizes the image to fit within a boundary while preserving ratio.
175
+     *
176
+     * @param integer $maxWidth
177
+     * @param integer $maxHeight
178
+     * @return bool
179
+     * @since 8.1.0
180
+     */
181
+    public function fitIn($maxWidth, $maxHeight);
182
+
183
+    /**
184
+     * Shrinks the image to fit within a boundary while preserving ratio.
185
+     *
186
+     * @param integer $maxWidth
187
+     * @param integer $maxHeight
188
+     * @return bool
189
+     * @since 8.1.0
190
+     */
191
+    public function scaleDownToFit($maxWidth, $maxHeight);
192 192
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/IAppContainer.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -37,31 +37,31 @@
 block discarded – undo
37 37
  */
38 38
 interface IAppContainer extends IContainer {
39 39
 
40
-	/**
41
-	 * used to return the appname of the set application
42
-	 * @return string the name of your application
43
-	 * @since 6.0.0
44
-	 */
45
-	public function getAppName();
40
+    /**
41
+     * used to return the appname of the set application
42
+     * @return string the name of your application
43
+     * @since 6.0.0
44
+     */
45
+    public function getAppName();
46 46
 
47
-	/**
48
-	 * @return \OCP\IServerContainer
49
-	 * @since 6.0.0
50
-	 */
51
-	public function getServer();
47
+    /**
48
+     * @return \OCP\IServerContainer
49
+     * @since 6.0.0
50
+     */
51
+    public function getServer();
52 52
 
53
-	/**
54
-	 * @param string $middleWare
55
-	 * @return boolean
56
-	 * @since 6.0.0
57
-	 */
58
-	public function registerMiddleWare($middleWare);
53
+    /**
54
+     * @param string $middleWare
55
+     * @return boolean
56
+     * @since 6.0.0
57
+     */
58
+    public function registerMiddleWare($middleWare);
59 59
 
60
-	/**
61
-	 * Register a capability
62
-	 *
63
-	 * @param string $serviceName e.g. 'OCA\Files\Capabilities'
64
-	 * @since 8.2.0
65
-	 */
66
-	 public function registerCapability($serviceName);
60
+    /**
61
+     * Register a capability
62
+     *
63
+     * @param string $serviceName e.g. 'OCA\Files\Capabilities'
64
+     * @since 8.2.0
65
+     */
66
+        public function registerCapability($serviceName);
67 67
 }
Please login to merge, or discard this patch.