summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-01-26 09:41:31 +0100
committerGitHub <noreply@github.com>2018-01-26 09:41:31 +0100
commitaebb443ca5f7909dc1bea663ac0a707bafca07b2 (patch)
tree8208947b3092d6329a989f0154484d09194289dc
parent469b3724b503a19e00040c910b42dc0b06aad23d (diff)
parent870fe20acc90cbfb89bf710f441d62f8bcf92f9d (diff)
downloadnextcloud-server-aebb443ca5f7909dc1bea663ac0a707bafca07b2.tar.gz
nextcloud-server-aebb443ca5f7909dc1bea663ac0a707bafca07b2.zip
Merge pull request #8056 from nextcloud/array-push
Use $var[] = $a instead of array_push - 2x faster
-rw-r--r--apps/files_versions/lib/Storage.php2
-rw-r--r--apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php2
-rw-r--r--lib/private/Activity/Manager.php4
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php2
-rw-r--r--lib/private/AppFramework/Middleware/MiddlewareDispatcher.php2
-rw-r--r--lib/private/Collaboration/Collaborators/GroupPlugin.php4
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php4
7 files changed, 10 insertions, 10 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 4c76c5340fa..6b8a441f7b3 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -566,7 +566,7 @@ class Storage {
$fileData = $file->getData();
$filePath = $dir . '/' . $fileData['name'];
if ($file['type'] === 'dir') {
- array_push($dirs, $filePath);
+ $dirs[] = $filePath;
} else {
$versionsBegin = strrpos($filePath, '.v');
$relPathStart = strlen(self::VERSIONS_ROOT);
diff --git a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
index 84bf54d3379..2fb5fe8a6c0 100644
--- a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
+++ b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
@@ -86,7 +86,7 @@ class BackupCodeStorage {
$dbCode->setUsed(0);
$this->mapper->insert($dbCode);
- array_push($result, $code);
+ $result[] = $code;
}
$this->publishEvent($user, 'codes_generated');
diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php
index 792dea4cff5..1b64fa59a91 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -231,7 +231,7 @@ class Manager implements IManager {
* @param \Closure $callable
*/
public function registerConsumer(\Closure $callable) {
- array_push($this->consumersClosures, $callable);
+ $this->consumersClosures[] = $callable;
$this->consumers = [];
}
@@ -244,7 +244,7 @@ class Manager implements IManager {
* @param \Closure $callable
*/
public function registerExtension(\Closure $callable) {
- array_push($this->extensionsClosures, $callable);
+ $this->extensionsClosures[] = $callable;
$this->extensions = [];
}
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 94c725f3fbc..d9e82819d14 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -335,7 +335,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @return boolean|null
*/
public function registerMiddleWare($middleWare) {
- array_push($this->middleWares, $middleWare);
+ $this->middleWares[] = $middleWare;
}
/**
diff --git a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php
index 306b8095a97..60d2ae8b5c9 100644
--- a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php
+++ b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php
@@ -63,7 +63,7 @@ class MiddlewareDispatcher {
* @param Middleware $middleWare the middleware which will be added
*/
public function registerMiddleware(Middleware $middleWare){
- array_push($this->middlewares, $middleWare);
+ $this->middlewares[] = $middleWare;
}
diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php
index 0b2b3d71028..b147d2d7b58 100644
--- a/lib/private/Collaboration/Collaborators/GroupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php
@@ -102,13 +102,13 @@ class GroupPlugin implements ISearchPlugin {
// user id and if so, we add that to the exact match list
$group = $this->groupManager->get($search);
if ($group instanceof IGroup && (!$this->shareWithGroupOnly || in_array($group->getGID(), $userGroups))) {
- array_push($result['exact'], [
+ $result['exact'][] = [
'label' => $group->getDisplayName(),
'value' => [
'shareType' => Share::SHARE_TYPE_GROUP,
'shareWith' => $group->getGID(),
],
- ]);
+ ];
}
}
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index ad677703547..d2639249d56 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -128,13 +128,13 @@ class UserPlugin implements ISearchPlugin {
}
if ($addUser) {
- array_push($result['exact'], [
+ $result['exact'][] = [
'label' => $user->getDisplayName(),
'value' => [
'shareType' => Share::SHARE_TYPE_USER,
'shareWith' => $user->getUID(),
],
- ]);
+ ];
}
}
}