diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-05 15:12:57 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-10-05 20:25:24 +0200 |
commit | d9015a8c94bfd71fe484618a06d276701d3bf9ff (patch) | |
tree | 3f7a1cd6ec2fd982dd02de71b76076f7f01cef70 /lib/private/Archive | |
parent | d357f4b10fe1b59e1e07bb90641d647522c7bfe2 (diff) | |
download | nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.tar.gz nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.zip |
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Archive')
-rw-r--r-- | lib/private/Archive/Archive.php | 2 | ||||
-rw-r--r-- | lib/private/Archive/ZIP.php | 52 |
2 files changed, 27 insertions, 27 deletions
diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php index ee27009ca83..633e5e8ab0e 100644 --- a/lib/private/Archive/Archive.php +++ b/lib/private/Archive/Archive.php @@ -47,7 +47,7 @@ abstract class Archive { * @param string $source either a local file or string data * @return bool */ - abstract public function addFile($path, $source=''); + abstract public function addFile($path, $source = ''); /** * rename a file or folder in the archive * @param string $source diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index 31aea420a3d..fd34f4d4cea 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -39,15 +39,15 @@ class ZIP extends Archive { /** * @var \ZipArchive zip */ - private $zip=null; + private $zip = null; private $path; /** * @param string $source */ public function __construct($source) { - $this->path=$source; - $this->zip=new \ZipArchive(); + $this->path = $source; + $this->zip = new \ZipArchive(); if ($this->zip->open($source, \ZipArchive::CREATE)) { } else { \OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN); @@ -67,11 +67,11 @@ class ZIP extends Archive { * @param string $source either a local file or string data * @return bool */ - public function addFile($path, $source='') { - if ($source and $source[0]=='/' and file_exists($source)) { - $result=$this->zip->addFile($source, $path); + public function addFile($path, $source = '') { + if ($source and $source[0] == '/' and file_exists($source)) { + $result = $this->zip->addFile($source, $path); } else { - $result=$this->zip->addFromString($path, $source); + $result = $this->zip->addFromString($path, $source); } if ($result) { $this->zip->close();//close and reopen to save the zip @@ -86,8 +86,8 @@ class ZIP extends Archive { * @return boolean|null */ public function rename($source, $dest) { - $source=$this->stripPath($source); - $dest=$this->stripPath($dest); + $source = $this->stripPath($source); + $dest = $this->stripPath($dest); $this->zip->renameName($source, $dest); } /** @@ -96,7 +96,7 @@ class ZIP extends Archive { * @return int */ public function filesize($path) { - $stat=$this->zip->statName($path); + $stat = $this->zip->statName($path); return $stat['size']; } /** @@ -113,13 +113,13 @@ class ZIP extends Archive { * @return array */ public function getFolder($path) { - $files=$this->getFiles(); - $folderContent=[]; - $pathLength=strlen($path); + $files = $this->getFiles(); + $folderContent = []; + $pathLength = strlen($path); foreach ($files as $file) { - if (substr($file, 0, $pathLength)==$path and $file!=$path) { - if (strrpos(substr($file, 0, -1), '/')<=$pathLength) { - $folderContent[]=substr($file, $pathLength); + if (substr($file, 0, $pathLength) == $path and $file != $path) { + if (strrpos(substr($file, 0, -1), '/') <= $pathLength) { + $folderContent[] = substr($file, $pathLength); } } } @@ -130,10 +130,10 @@ class ZIP extends Archive { * @return array */ public function getFiles() { - $fileCount=$this->zip->numFiles; - $files=[]; - for ($i=0;$i<$fileCount;$i++) { - $files[]=$this->zip->getNameIndex($i); + $fileCount = $this->zip->numFiles; + $files = []; + for ($i = 0;$i < $fileCount;$i++) { + $files[] = $this->zip->getNameIndex($i); } return $files; } @@ -169,7 +169,7 @@ class ZIP extends Archive { * @return bool */ public function fileExists($path) { - return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false); + return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false); } /** * remove a file or folder from the archive @@ -190,16 +190,16 @@ class ZIP extends Archive { * @return resource */ public function getStream($path, $mode) { - if ($mode=='r' or $mode=='rb') { + if ($mode == 'r' or $mode == 'rb') { return $this->zip->getStream($path); } else { //since we can't directly get a writable stream, //make a temp copy of the file and put it back //in the archive when the stream is closed - if (strrpos($path, '.')!==false) { - $ext=substr($path, strrpos($path, '.')); + if (strrpos($path, '.') !== false) { + $ext = substr($path, strrpos($path, '.')); } else { - $ext=''; + $ext = ''; } $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); if ($this->fileExists($path)) { @@ -225,7 +225,7 @@ class ZIP extends Archive { * @return string */ private function stripPath($path) { - if (!$path || $path[0]=='/') { + if (!$path || $path[0] == '/') { return substr($path, 1); } else { return $path; |