Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update docblocks

  • Loading branch information...
commit 3d4c3d19c4a520776161e5b994a36ca1e1524f6f 1 parent 09c0e55
@mrook mrook authored
Showing with 122 additions and 147 deletions.
  1. +122 −147 Archive/Tar.php
View
269 Archive/Tar.php
@@ -115,7 +115,6 @@ class Archive_Tar extends PEAR
*/
public $error_object = null;
- // {{{ constructor
/**
* Archive_Tar Class constructor. This flavour of the constructor only
* declare a new Archive_Tar object, identifying it by the name of the
@@ -129,7 +128,7 @@ class Archive_Tar extends PEAR
* is required. For compatibility reason the
* boolean value 'true' means 'gz'.
*
- * @access public
+ * @return bool
*/
public function Archive_Tar($p_tarname, $p_compress = null)
{
@@ -224,9 +223,6 @@ public function Archive_Tar($p_tarname, $p_compress = null)
}
}
- // }}}
-
- // {{{ destructor
public function _Archive_Tar()
{
$this->_close();
@@ -237,17 +233,11 @@ public function _Archive_Tar()
$this->_PEAR();
}
- // }}}
-
- // {{{ PHP5-compatible destructor
public function __destruct()
{
$this->_Archive_Tar();
}
- // }}}
-
- // {{{ create()
/**
* This method creates the archive file and add the files / directories
* that are listed in $p_filelist.
@@ -268,16 +258,12 @@ public function __destruct()
*
* @return true on success, false on error.
* @see createModify()
- * @access public
*/
public function create($p_filelist)
{
return $this->createModify($p_filelist, '', '');
}
- // }}}
-
- // {{{ add()
/**
* This method add the files / directories that are listed in $p_filelist in
* the archive. If the archive does not exist it is created.
@@ -299,17 +285,19 @@ public function add($p_filelist)
return $this->addModify($p_filelist, '', '');
}
- // }}}
-
- // {{{ extract()
+ /**
+ * @param string $p_path
+ * @param bool $p_preserve
+ * @return bool
+ */
public function extract($p_path = '', $p_preserve = false)
{
return $this->extractModify($p_path, '', $p_preserve);
}
- // }}}
-
- // {{{ listContent()
+ /**
+ * @return array|int
+ */
public function listContent()
{
$v_list_detail = array();
@@ -325,9 +313,6 @@ public function listContent()
return $v_list_detail;
}
- // }}}
-
- // {{{ createModify()
/**
* This method creates the archive file and add the files / directories
* that are listed in $p_filelist.
@@ -361,7 +346,6 @@ public function listContent()
* element in the list, when relevant.
*
* @return boolean true on success, false on error.
- * @access public
* @see addModify()
*/
public function createModify($p_filelist, $p_add_dir, $p_remove_dir = '')
@@ -396,9 +380,6 @@ public function createModify($p_filelist, $p_add_dir, $p_remove_dir = '')
return $v_result;
}
- // }}}
-
- // {{{ addModify()
/**
* This method add the files / directories listed in $p_filelist at the
* end of the existing archive. If the archive does not yet exists it
@@ -438,7 +419,6 @@ public function createModify($p_filelist, $p_add_dir, $p_remove_dir = '')
* relevant.
*
* @return true on success, false on error.
- * @access public
*/
public function addModify($p_filelist, $p_add_dir, $p_remove_dir = '')
{
@@ -466,9 +446,6 @@ public function addModify($p_filelist, $p_add_dir, $p_remove_dir = '')
return $v_result;
}
- // }}}
-
- // {{{ addString()
/**
* This method add a single string as a file at the
* end of the existing archive. If the archive does not yet exists it
@@ -479,7 +456,7 @@ public function addModify($p_filelist, $p_add_dir, $p_remove_dir = '')
* with the string.
* @param string $p_string The content of the file added in
* the archive.
- * @param int $p_datetime A custom date/time (unix timestamp)
+ * @param bool|int $p_datetime A custom date/time (unix timestamp)
* for the file (optional).
* @param array $p_params An array of optional params:
* stamp => the datetime (replaces
@@ -495,7 +472,6 @@ public function addModify($p_filelist, $p_add_dir, $p_remove_dir = '')
* (default = 0 = root)
*
* @return true on success, false on error.
- * @access public
*/
public function addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
{
@@ -527,9 +503,6 @@ public function addString($p_filename, $p_string, $p_datetime = false, $p_params
return $v_result;
}
- // }}}
-
- // {{{ extractModify()
/**
* This method extract all the content of the archive in the directory
* indicated by $p_path. When relevant the memorized path of the
@@ -562,7 +535,6 @@ public function addString($p_filename, $p_string, $p_datetime = false, $p_params
* @param boolean $p_preserve Preserve user/group ownership of files
*
* @return boolean true on success, false on error.
- * @access public
* @see extractList()
*/
public function extractModify($p_path, $p_remove_path, $p_preserve = false)
@@ -585,9 +557,6 @@ public function extractModify($p_path, $p_remove_path, $p_preserve = false)
return $v_result;
}
- // }}}
-
- // {{{ extractInString()
/**
* This method extract from the archive one file identified by $p_filename.
* The return value is a string with the file content, or NULL on error.
@@ -595,7 +564,6 @@ public function extractModify($p_path, $p_remove_path, $p_preserve = false)
* @param string $p_filename The path of the file to extract in a string.
*
* @return a string with the file content or NULL.
- * @access public
*/
public function extractInString($p_filename)
{
@@ -609,9 +577,6 @@ public function extractInString($p_filename)
return $v_result;
}
- // }}}
-
- // {{{ extractList()
/**
* This method extract from the archive only the files indicated in the
* $p_filelist. These files are extracted in the current directory or
@@ -630,7 +595,6 @@ public function extractInString($p_filename)
* @param boolean $p_preserve Preserve user/group ownership of files
*
* @return true on success, false on error.
- * @access public
* @see extractModify()
*/
public function extractList($p_filelist, $p_path = '', $p_remove_path = '', $p_preserve = false)
@@ -662,18 +626,12 @@ public function extractList($p_filelist, $p_path = '', $p_remove_path = '', $p_p
return $v_result;
}
- // }}}
-
- // {{{ setAttribute()
/**
* This method set specific attributes of the archive. It uses a variable
* list of parameters, in the format attribute code + attribute values :
* $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
*
- * @param mixed $argv variable list of attributes and values
- *
* @return true on success, false on error.
- * @access public
*/
public function setAttribute()
{
@@ -721,26 +679,18 @@ public function setAttribute()
return $v_result;
}
- // }}}
-
- // {{{ setIgnoreRegexp()
/**
* This method sets the regular expression for ignoring files and directories
* at import, for example:
* $arch->setIgnoreRegexp("#CVS|\.svn#");
*
* @param string $regexp regular expression defining which files or directories to ignore
- *
- * @access public
*/
public function setIgnoreRegexp($regexp)
{
$this->_ignore_regexp = $regexp;
}
- // }}}
-
- // {{{ setIgnoreList()
/**
* This method sets the regular expression for ignoring all files and directories
* matching the filenames in the array list at import, for example:
@@ -757,25 +707,26 @@ public function setIgnoreList($list)
$this->setIgnoreRegexp($regexp);
}
- // }}}
-
- // {{{ _error()
+ /**
+ * @param string $p_message
+ */
public function _error($p_message)
{
$this->error_object = $this->raiseError($p_message);
}
- // }}}
-
- // {{{ _warning()
+ /**
+ * @param string $p_message
+ */
public function _warning($p_message)
{
$this->error_object = $this->raiseError($p_message);
}
- // }}}
-
- // {{{ _isArchive()
+ /**
+ * @param string $p_filename
+ * @return bool
+ */
public function _isArchive($p_filename = null)
{
if ($p_filename == null) {
@@ -785,9 +736,9 @@ public function _isArchive($p_filename = null)
return @is_file($p_filename) && !@is_link($p_filename);
}
- // }}}
-
- // {{{ _openWrite()
+ /**
+ * @return bool
+ */
public function _openWrite()
{
if ($this->_compress_type == 'gz' && function_exists('gzopen')) {
@@ -823,9 +774,9 @@ public function _openWrite()
return true;
}
- // }}}
-
- // {{{ _openRead()
+ /**
+ * @return bool
+ */
public function _openRead()
{
if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
@@ -894,9 +845,9 @@ public function _openRead()
return true;
}
- // }}}
-
- // {{{ _openReadWrite()
+ /**
+ * @return bool
+ */
public function _openReadWrite()
{
if ($this->_compress_type == 'gz') {
@@ -940,9 +891,9 @@ public function _openReadWrite()
return true;
}
- // }}}
-
- // {{{ _close()
+ /**
+ * @return bool
+ */
public function _close()
{
//if (isset($this->_file)) {
@@ -981,9 +932,9 @@ public function _close()
return true;
}
- // }}}
-
- // {{{ _cleanFile()
+ /**
+ * @return bool
+ */
public function _cleanFile()
{
$this->_close();
@@ -1002,9 +953,11 @@ public function _cleanFile()
return true;
}
- // }}}
-
- // {{{ _writeBlock()
+ /**
+ * @param mixed $p_binary_data
+ * @param integer $p_len
+ * @return bool
+ */
public function _writeBlock($p_binary_data, $p_len = null)
{
if (is_resource($this->_file)) {
@@ -1055,9 +1008,9 @@ public function _writeBlock($p_binary_data, $p_len = null)
return true;
}
- // }}}
-
- // {{{ _readBlock()
+ /**
+ * @return null|string
+ */
public function _readBlock()
{
$v_block = null;
@@ -1086,9 +1039,10 @@ public function _readBlock()
return $v_block;
}
- // }}}
-
- // {{{ _jumpBlock()
+ /**
+ * @param null $p_len
+ * @return bool
+ */
public function _jumpBlock($p_len = null)
{
if (is_resource($this->_file)) {
@@ -1126,9 +1080,9 @@ public function _jumpBlock($p_len = null)
return true;
}
- // }}}
-
- // {{{ _writeFooter()
+ /**
+ * @return bool
+ */
public function _writeFooter()
{
if (is_resource($this->_file)) {
@@ -1139,9 +1093,12 @@ public function _writeFooter()
return true;
}
- // }}}
-
- // {{{ _addList()
+ /**
+ * @param array $p_list
+ * @param string $p_add_dir
+ * @param string $p_remove_dir
+ * @return bool
+ */
public function _addList($p_list, $p_add_dir, $p_remove_dir)
{
$v_result = true;
@@ -1220,9 +1177,14 @@ public function _addList($p_list, $p_add_dir, $p_remove_dir)
return $v_result;
}
- // }}}
-
- // {{{ _addFile()
+ /**
+ * @param string $p_filename
+ * @param mixed $p_header
+ * @param string $p_add_dir
+ * @param string $p_remove_dir
+ * @param null $v_stored_filename
+ * @return bool
+ */
public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename = null)
{
if (!$this->_file) {
@@ -1295,9 +1257,13 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_
return true;
}
- // }}}
-
- // {{{ _addString()
+ /**
+ * @param string $p_filename
+ * @param string $p_string
+ * @param bool $p_datetime
+ * @param array $p_params
+ * @return bool
+ */
public function _addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
{
$p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time());
@@ -1345,9 +1311,11 @@ public function _addString($p_filename, $p_string, $p_datetime = false, $p_param
return true;
}
- // }}}
-
- // {{{ _writeHeader()
+ /**
+ * @param string $p_filename
+ * @param string $p_stored_filename
+ * @return bool
+ */
public function _writeHeader($p_filename, $p_stored_filename)
{
if ($p_stored_filename == '') {
@@ -1456,9 +1424,16 @@ public function _writeHeader($p_filename, $p_stored_filename)
return true;
}
- // }}}
-
- // {{{ _writeHeaderBlock()
+ /**
+ * @param string $p_filename
+ * @param int $p_size
+ * @param int $p_mtime
+ * @param int $p_perms
+ * @param string $p_type
+ * @param int $p_uid
+ * @param int $p_gid
+ * @return bool
+ */
public function _writeHeaderBlock(
$p_filename,
$p_size,
@@ -1563,9 +1538,10 @@ public function _writeHeaderBlock(
return true;
}
- // }}}
-
- // {{{ _writeLongHeader()
+ /**
+ * @param string $p_filename
+ * @return bool
+ */
public function _writeLongHeader($p_filename)
{
$v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
@@ -1647,9 +1623,11 @@ public function _writeLongHeader($p_filename)
return true;
}
- // }}}
-
- // {{{ _readHeader()
+ /**
+ * @param mixed $v_binary_data
+ * @param mixed $v_header
+ * @return bool
+ */
public function _readHeader($v_binary_data, &$v_header)
{
if (strlen($v_binary_data) == 0) {
@@ -1745,9 +1723,6 @@ public function _readHeader($v_binary_data, &$v_header)
return true;
}
- // }}}
-
- // {{{ _maliciousFilename()
/**
* Detect and report a malicious file name
*
@@ -1766,9 +1741,10 @@ private function _maliciousFilename($file)
return false;
}
- // }}}
-
- // {{{ _readLongHeader()
+ /**
+ * @param $v_header
+ * @return bool
+ */
public function _readLongHeader(&$v_header)
{
$v_filename = '';
@@ -1803,9 +1779,6 @@ public function _readLongHeader(&$v_header)
return true;
}
- // }}}
-
- // {{{ _extractInString()
/**
* This method extract from the archive one file identified by $p_filename.
* The return value is a string with the file content, or null on error.
@@ -1864,9 +1837,15 @@ private function _extractInString($p_filename)
return null;
}
- // }}}
-
- // {{{ _extractList()
+ /**
+ * @param string $p_path
+ * @param string $p_list_detail
+ * @param string $p_mode
+ * @param string $p_file_list
+ * @param string $p_remove_path
+ * @param bool $p_preserve
+ * @return bool
+ */
public function _extractList(
$p_path,
&$p_list_detail,
@@ -2143,9 +2122,9 @@ public function _extractList(
return true;
}
- // }}}
-
- // {{{ _openAppend()
+ /**
+ * @return bool
+ */
public function _openAppend()
{
if (filesize($this->_tarname) == 0) {
@@ -2280,9 +2259,12 @@ public function _openAppend()
return true;
}
- // }}}
-
- // {{{ _append()
+ /**
+ * @param $p_filelist
+ * @param string $p_add_dir
+ * @param string $p_remove_dir
+ * @return bool
+ */
public function _append($p_filelist, $p_add_dir = '', $p_remove_dir = '')
{
if (!$this->_openAppend()) {
@@ -2298,10 +2280,6 @@ public function _append($p_filelist, $p_add_dir = '', $p_remove_dir = '')
return true;
}
- // }}}
-
- // {{{ _dirCheck()
-
/**
* Check if a directory exists and create it (including parent
* dirs) if not.
@@ -2334,10 +2312,6 @@ public function _dirCheck($p_dir)
return true;
}
- // }}}
-
- // {{{ _pathReduction()
-
/**
* Compress path by changing for example "/dir/foo/../bar" to "/dir/bar",
* rand emove double slashes.
@@ -2388,9 +2362,11 @@ private function _pathReduction($p_dir)
return $v_result;
}
- // }}}
-
- // {{{ _translateWinPath()
+ /**
+ * @param $p_path
+ * @param bool $p_remove_disk_letter
+ * @return string
+ */
public function _translateWinPath($p_path, $p_remove_disk_letter = true)
{
if (defined('OS_WINDOWS') && OS_WINDOWS) {
@@ -2407,5 +2383,4 @@ public function _translateWinPath($p_path, $p_remove_disk_letter = true)
}
return $p_path;
}
- // }}}
}
Please sign in to comment.
Something went wrong with that request. Please try again.