Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Adding fileToUploadArray for uploadArray, keeping uploadArray as alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Jan 14, 2016
1 parent 8e08f63 commit cc787f7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Storage/StorageUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ public static function ksortRecursive(&$array, $sortFlags = SORT_REGULAR) {
/**
* Returns an array that matches the structure of a regular upload for a local file
*
* @param $file
* @param string File with path
* @param $file The file you want to get an upload array for.
* @param string Name of the file to use in the upload array.
* @return array Array that matches the structure of a regular upload
*/
public static function uploadArray($file, $filename = null) {
public static function fileToUploadArray($file, $filename = null) {
$File = new File($file);
if (empty($fileName)) {
$filename = basename($file);
Expand All @@ -179,6 +179,17 @@ public static function uploadArray($file, $filename = null) {
];
}

/**
* Convenience alias for fileToUploadArray
*
* @param $file
* @param string File with path
* @return array Array that matches the structure of a regular upload
*/
public static function uploadArray($file, $filename = null) {
return self::fileToUploadArray($file, $filename);
}

/**
* Gets the hash of a file.
*
Expand Down

0 comments on commit cc787f7

Please sign in to comment.