summaryrefslogtreecommitdiffstats
path: root/lib/private/Archive
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-07-23 21:03:26 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-07-24 11:39:29 +0200
commit5f227bd93b23d8a528476e3d9243dae31c9d0050 (patch)
treefaf627e7fbd8c510e897028ac88048d6ae590145 /lib/private/Archive
parent5eee110b15169240134fc54672fe38da63bc7fb1 (diff)
downloadnextcloud-server-5f227bd93b23d8a528476e3d9243dae31c9d0050.tar.gz
nextcloud-server-5f227bd93b23d8a528476e3d9243dae31c9d0050.zip
More phpstorm inspection fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Archive')
-rw-r--r--lib/private/Archive/Archive.php32
-rw-r--r--lib/private/Archive/TAR.php30
-rw-r--r--lib/private/Archive/ZIP.php30
3 files changed, 46 insertions, 46 deletions
diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php
index fadc12d2a24..15ec3e1fe56 100644
--- a/lib/private/Archive/Archive.php
+++ b/lib/private/Archive/Archive.php
@@ -36,100 +36,100 @@ abstract class Archive {
/**
* @param $source
*/
- abstract function __construct($source);
+ public abstract function __construct($source);
/**
* add an empty folder to the archive
* @param string $path
* @return bool
*/
- abstract function addFolder($path);
+ public abstract function addFolder($path);
/**
* add a file to the archive
* @param string $path
* @param string $source either a local file or string data
* @return bool
*/
- abstract function addFile($path, $source='');
+ public abstract function addFile($path, $source='');
/**
* rename a file or folder in the archive
* @param string $source
* @param string $dest
* @return bool
*/
- abstract function rename($source, $dest);
+ public abstract function rename($source, $dest);
/**
* get the uncompressed size of a file in the archive
* @param string $path
* @return int
*/
- abstract function filesize($path);
+ public abstract function filesize($path);
/**
* get the last modified time of a file in the archive
* @param string $path
* @return int
*/
- abstract function mtime($path);
+ public abstract function mtime($path);
/**
* get the files in a folder
* @param string $path
* @return array
*/
- abstract function getFolder($path);
+ public abstract function getFolder($path);
/**
* get all files in the archive
* @return array
*/
- abstract function getFiles();
+ public abstract function getFiles();
/**
* get the content of a file
* @param string $path
* @return string
*/
- abstract function getFile($path);
+ public abstract function getFile($path);
/**
* extract a single file from the archive
* @param string $path
* @param string $dest
* @return bool
*/
- abstract function extractFile($path, $dest);
+ public abstract function extractFile($path, $dest);
/**
* extract the archive
* @param string $dest
* @return bool
*/
- abstract function extract($dest);
+ public abstract function extract($dest);
/**
* check if a file or folder exists in the archive
* @param string $path
* @return bool
*/
- abstract function fileExists($path);
+ public abstract function fileExists($path);
/**
* remove a file or folder from the archive
* @param string $path
* @return bool
*/
- abstract function remove($path);
+ public abstract function remove($path);
/**
* get a file handler
* @param string $path
* @param string $mode
* @return resource
*/
- abstract function getStream($path, $mode);
+ public abstract function getStream($path, $mode);
/**
* add a folder and all its content
* @param string $path
* @param string $source
* @return boolean|null
*/
- function addRecursive($path, $source) {
+ public function addRecursive($path, $source) {
$dh = opendir($source);
if(is_resource($dh)) {
$this->addFolder($path);
while (($file = readdir($dh)) !== false) {
- if($file=='.' or $file=='..') {
+ if($file === '.' || $file === '..') {
continue;
}
if(is_dir($source.'/'.$file)) {
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index 07ccd09f399..e6f7ad2b998 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -52,7 +52,7 @@ class TAR extends Archive {
/**
* @param string $source
*/
- function __construct($source) {
+ public function __construct($source) {
$types = array(null, 'gz', 'bz2');
$this->path = $source;
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
@@ -90,7 +90,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function addFolder($path) {
+ public function addFolder($path) {
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
if (substr($path, -1, 1) != '/') {
$path .= '/';
@@ -120,7 +120,7 @@ class TAR extends Archive {
* @param string $source either a local file or string data
* @return bool
*/
- function addFile($path, $source = '') {
+ public function addFile($path, $source = '') {
if ($this->fileExists($path)) {
$this->remove($path);
}
@@ -140,7 +140,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function rename($source, $dest) {
+ public function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive
$tmp = \OCP\Files::tmpFolder();
$this->tar->extract($tmp);
@@ -180,7 +180,7 @@ class TAR extends Archive {
* @param string $path
* @return int
*/
- function filesize($path) {
+ public function filesize($path) {
$stat = $this->getHeader($path);
return $stat['size'];
}
@@ -191,7 +191,7 @@ class TAR extends Archive {
* @param string $path
* @return int
*/
- function mtime($path) {
+ public function mtime($path) {
$stat = $this->getHeader($path);
return $stat['mtime'];
}
@@ -202,7 +202,7 @@ class TAR extends Archive {
* @param string $path
* @return array
*/
- function getFolder($path) {
+ public function getFolder($path) {
$files = $this->getFiles();
$folderContent = array();
$pathLength = strlen($path);
@@ -228,7 +228,7 @@ class TAR extends Archive {
*
* @return array
*/
- function getFiles() {
+ public function getFiles() {
if ($this->fileList) {
return $this->fileList;
}
@@ -249,7 +249,7 @@ class TAR extends Archive {
* @param string $path
* @return string
*/
- function getFile($path) {
+ public function getFile($path) {
return $this->tar->extractInString($path);
}
@@ -260,7 +260,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function extractFile($path, $dest) {
+ public function extractFile($path, $dest) {
$tmp = \OCP\Files::tmpFolder();
if (!$this->fileExists($path)) {
return false;
@@ -283,7 +283,7 @@ class TAR extends Archive {
* @param string $dest
* @return bool
*/
- function extract($dest) {
+ public function extract($dest) {
return $this->tar->extract($dest);
}
@@ -293,7 +293,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function fileExists($path) {
+ public function fileExists($path) {
$files = $this->getFiles();
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
return true;
@@ -322,7 +322,7 @@ class TAR extends Archive {
* @param string $path
* @return bool
*/
- function remove($path) {
+ public function remove($path) {
if (!$this->fileExists($path)) {
return false;
}
@@ -346,7 +346,7 @@ class TAR extends Archive {
* @param string $mode
* @return resource
*/
- function getStream($path, $mode) {
+ public function getStream($path, $mode) {
if (strrpos($path, '.') !== false) {
$ext = substr($path, strrpos($path, '.'));
} else {
@@ -371,7 +371,7 @@ class TAR extends Archive {
/**
* write back temporary files
*/
- function writeBack($tmpFile, $path) {
+ public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile);
unlink($tmpFile);
}
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index 0ed0f48acc4..8d616a7ef9a 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -43,7 +43,7 @@ class ZIP extends Archive{
/**
* @param string $source
*/
- function __construct($source) {
+ public function __construct($source) {
$this->path=$source;
$this->zip=new \ZipArchive();
if($this->zip->open($source, \ZipArchive::CREATE)) {
@@ -56,7 +56,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function addFolder($path) {
+ public function addFolder($path) {
return $this->zip->addEmptyDir($path);
}
/**
@@ -65,7 +65,7 @@ class ZIP extends Archive{
* @param string $source either a local file or string data
* @return bool
*/
- function addFile($path, $source='') {
+ public function addFile($path, $source='') {
if($source and $source[0]=='/' and file_exists($source)) {
$result=$this->zip->addFile($source, $path);
}else{
@@ -83,7 +83,7 @@ class ZIP extends Archive{
* @param string $dest
* @return boolean|null
*/
- function rename($source, $dest) {
+ public function rename($source, $dest) {
$source=$this->stripPath($source);
$dest=$this->stripPath($dest);
$this->zip->renameName($source, $dest);
@@ -93,7 +93,7 @@ class ZIP extends Archive{
* @param string $path
* @return int
*/
- function filesize($path) {
+ public function filesize($path) {
$stat=$this->zip->statName($path);
return $stat['size'];
}
@@ -102,7 +102,7 @@ class ZIP extends Archive{
* @param string $path
* @return int
*/
- function mtime($path) {
+ public function mtime($path) {
return filemtime($this->path);
}
/**
@@ -110,7 +110,7 @@ class ZIP extends Archive{
* @param string $path
* @return array
*/
- function getFolder($path) {
+ public function getFolder($path) {
$files=$this->getFiles();
$folderContent=array();
$pathLength=strlen($path);
@@ -127,7 +127,7 @@ class ZIP extends Archive{
* get all files in the archive
* @return array
*/
- function getFiles() {
+ public function getFiles() {
$fileCount=$this->zip->numFiles;
$files=array();
for($i=0;$i<$fileCount;$i++) {
@@ -140,7 +140,7 @@ class ZIP extends Archive{
* @param string $path
* @return string
*/
- function getFile($path) {
+ public function getFile($path) {
return $this->zip->getFromName($path);
}
/**
@@ -149,7 +149,7 @@ class ZIP extends Archive{
* @param string $dest
* @return boolean|null
*/
- function extractFile($path, $dest) {
+ public function extractFile($path, $dest) {
$fp = $this->zip->getStream($path);
file_put_contents($dest, $fp);
}
@@ -158,7 +158,7 @@ class ZIP extends Archive{
* @param string $dest
* @return bool
*/
- function extract($dest) {
+ public function extract($dest) {
return $this->zip->extractTo($dest);
}
/**
@@ -166,7 +166,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function fileExists($path) {
+ public function fileExists($path) {
return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
}
/**
@@ -174,7 +174,7 @@ class ZIP extends Archive{
* @param string $path
* @return bool
*/
- function remove($path) {
+ public function remove($path) {
if($this->fileExists($path.'/')) {
return $this->zip->deleteName($path.'/');
}else{
@@ -187,7 +187,7 @@ class ZIP extends Archive{
* @param string $mode
* @return resource
*/
- function getStream($path, $mode) {
+ public function getStream($path, $mode) {
if($mode=='r' or $mode=='rb') {
return $this->zip->getStream($path);
} else {
@@ -213,7 +213,7 @@ class ZIP extends Archive{
/**
* write back temporary files
*/
- function writeBack($tmpFile, $path) {
+ public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile);
unlink($tmpFile);
}