Use $var[] = $a instead of array_push - 2x faster
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
b9bbb894f8
commit
870fe20acc
|
@ -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);
|
||||
|
|
|
@ -86,7 +86,7 @@ class BackupCodeStorage {
|
|||
$dbCode->setUsed(0);
|
||||
$this->mapper->insert($dbCode);
|
||||
|
||||
array_push($result, $code);
|
||||
$result[] = $code;
|
||||
}
|
||||
|
||||
$this->publishEvent($user, 'codes_generated');
|
||||
|
|
|
@ -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 = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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(),
|
||||
],
|
||||
]);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
],
|
||||
]);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue