From b80ebc96748b45fd2e0ba9323308657c4b00b7ec Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 26 Mar 2020 09:30:18 +0100 Subject: Use the short array syntax, everywhere Signed-off-by: Christoph Wurst --- lib/private/Archive/TAR.php | 20 ++++++++++---------- lib/private/Archive/ZIP.php | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/private/Archive') diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php index 20bab49adf8..08c9d23863e 100644 --- a/lib/private/Archive/TAR.php +++ b/lib/private/Archive/TAR.php @@ -52,7 +52,7 @@ class TAR extends Archive { * @param string $source */ public function __construct($source) { - $types = array(null, 'gz', 'bz2'); + $types = [null, 'gz', 'bz2']; $this->path = $source; $this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]); } @@ -103,7 +103,7 @@ class TAR extends Archive { mkdir($folder); } } - $result = $this->tar->addModify(array($tmpBase . $path), '', $tmpBase); + $result = $this->tar->addModify([$tmpBase . $path], '', $tmpBase); rmdir($tmpBase . $path); $this->fileList = false; $this->cachedHeaders = false; @@ -144,9 +144,9 @@ class TAR extends Archive { rename($tmp . $source, $tmp . $dest); $this->tar = null; unlink($this->path); - $types = array(null, 'gz', 'bz'); + $types = [null, 'gz', 'bz']; $this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]); - $this->tar->createModify(array($tmp), '', $tmp . '/'); + $this->tar->createModify([$tmp], '', $tmp . '/'); $this->fileList = false; $this->cachedHeaders = false; return true; @@ -201,7 +201,7 @@ class TAR extends Archive { */ public function getFolder($path) { $files = $this->getFiles(); - $folderContent = array(); + $folderContent = []; $pathLength = strlen($path); foreach ($files as $file) { if ($file[0] == '/') { @@ -232,7 +232,7 @@ class TAR extends Archive { if (!$this->cachedHeaders) { $this->cachedHeaders = $this->tar->listContent(); } - $files = array(); + $files = []; foreach ($this->cachedHeaders as $header) { $files[] = $header['filename']; } @@ -263,9 +263,9 @@ class TAR extends Archive { return false; } if ($this->fileExists('/' . $path)) { - $success = $this->tar->extractList(array('/' . $path), $tmp); + $success = $this->tar->extractList(['/' . $path], $tmp); } else { - $success = $this->tar->extractList(array($path), $tmp); + $success = $this->tar->extractList([$path], $tmp); } if ($success) { rename($tmp . $path, $dest); @@ -329,7 +329,7 @@ class TAR extends Archive { $this->tar = null; unlink($this->path); $this->reopen(); - $this->tar->createModify(array($tmp), '', $tmp); + $this->tar->createModify([$tmp], '', $tmp); return true; } @@ -378,7 +378,7 @@ class TAR extends Archive { $this->tar->_close(); $this->tar = null; } - $types = array(null, 'gz', 'bz'); + $types = [null, 'gz', 'bz']; $this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]); } } diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index 2c3df550f71..cb04b572c03 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -113,7 +113,7 @@ class ZIP extends Archive{ */ public function getFolder($path) { $files=$this->getFiles(); - $folderContent=array(); + $folderContent=[]; $pathLength=strlen($path); foreach($files as $file) { if(substr($file, 0, $pathLength)==$path and $file!=$path) { @@ -130,7 +130,7 @@ class ZIP extends Archive{ */ public function getFiles() { $fileCount=$this->zip->numFiles; - $files=array(); + $files=[]; for($i=0;$i<$fileCount;$i++) { $files[]=$this->zip->getNameIndex($i); } -- cgit v1.2.3