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

Commit cc787f7

Browse files
author
Florian Krämer
committed
Adding fileToUploadArray for uploadArray, keeping uploadArray as alias
1 parent 8e08f63 commit cc787f7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Storage/StorageUtils.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ public static function ksortRecursive(&$array, $sortFlags = SORT_REGULAR) {
161161
/**
162162
* Returns an array that matches the structure of a regular upload for a local file
163163
*
164-
* @param $file
165-
* @param string File with path
164+
* @param $file The file you want to get an upload array for.
165+
* @param string Name of the file to use in the upload array.
166166
* @return array Array that matches the structure of a regular upload
167167
*/
168-
public static function uploadArray($file, $filename = null) {
168+
public static function fileToUploadArray($file, $filename = null) {
169169
$File = new File($file);
170170
if (empty($fileName)) {
171171
$filename = basename($file);
@@ -179,6 +179,17 @@ public static function uploadArray($file, $filename = null) {
179179
];
180180
}
181181

182+
/**
183+
* Convenience alias for fileToUploadArray
184+
*
185+
* @param $file
186+
* @param string File with path
187+
* @return array Array that matches the structure of a regular upload
188+
*/
189+
public static function uploadArray($file, $filename = null) {
190+
return self::fileToUploadArray($file, $filename);
191+
}
192+
182193
/**
183194
* Gets the hash of a file.
184195
*

0 commit comments

Comments
 (0)