Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed the return value of extract to an array if the $files parameter

was an array.


git-svn-id: http://svn.php.net/repository/pear/packages/File_Cabinet/trunk@252832 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 2f9ac6383f082bdaf8b1baf894589c5caebb30aa 1 parent 6356b16
David Sanders authored
Showing with 14 additions and 6 deletions.
  1. +14 −6 Cabinet.php
View
20 Cabinet.php
@@ -192,7 +192,11 @@ public function extract($files = null, $to_directory = null)
* may contain wildcards.
* @param string $to_directory Directory to expand to. Leave null to return
* file contents.
- * @return string File contents if to_directory is null, null otherwise.
+ * @return array/string/null If to_directory is null, the return value will be
+ * the file contents in an array if $files was an
+ * array, else a concatenated string from the glob
+ * result. If to_directory is not null the return
+ * value will be null.
* @access private
*/
private function extractWithCabextract($files = null, $to_directory = null)
@@ -201,9 +205,9 @@ private function extractWithCabextract($files = null, $to_directory = null)
if (is_array($files)) {
// one by one
- $output = '';
+ $output = array();
foreach ($files as $file) {
- $output .= $this->extractWithCabextract($file, $to_directory);
+ $output[] = $this->extractWithCabextract($file, $to_directory);
}
if (is_null($to_directory)) {
return $output;
@@ -245,7 +249,11 @@ private function extractWithCabextract($files = null, $to_directory = null)
* may contain wildcards.
* @param string $to_directory Directory to expand to. Leave null to return
* file contents.
- * @return string File contents if to_directory is null, null otherwise.
+ * @return array/string/null If to_directory is null, the return value will be
+ * the file contents in an array if $files was an
+ * array, else a concatenated string from the glob
+ * result. If to_directory is not null the return
+ * value will be null.
* @access private
*/
private function extractWithExpand($files = null, $to_directory = null)
@@ -254,9 +262,9 @@ private function extractWithExpand($files = null, $to_directory = null)
if (is_array($files)) {
// one by one
- $output = '';
+ $output = array();
foreach ($files as $file) {
- $output .= $this->extractWithExpand($file, $to_directory);
+ $output[] = $this->extractWithExpand($file, $to_directory);
}
if (is_null($to_directory)) {
return $output;
Please sign in to comment.
Something went wrong with that request. Please try again.