diff --git a/README.md b/README.md index 010838e..9cef4b9 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,7 @@ All object inherits from `InputItem` class and will always contain these methods - `getIndex()` - returns the index/key of the input. - `getName()` - returns a human friendly name for the input (company_name will be Company Name etc). -`InputFile` has some of the same methods as above along with some other file-specific methods like: +`InputFile` has the same methods as above along with some other file-specific methods like: - `getTmpName()` - get file temporary name. - `getSize()` - get file size. - `move($destination)` - move file to destination. diff --git a/src/Pecee/Http/Input/Input.php b/src/Pecee/Http/Input/Input.php index 09872be..475b19c 100644 --- a/src/Pecee/Http/Input/Input.php +++ b/src/Pecee/Http/Input/Input.php @@ -155,8 +155,7 @@ class Input { if(!is_array($value['name'])) { // Strip empty values if($value['error'] != '4') { - $file = new InputFile(); - $file->setIndex($key); + $file = new InputFile($key); $file->setName($value['name']); $file->setSize($value['size']); $file->setType($value['type']); @@ -172,8 +171,7 @@ class Input { foreach($value['name'] as $k=>$val) { // Strip empty values if($value['error'][$k] != '4') { - $file = new InputFile(); - $file->setIndex($k); + $file = new InputFile($k); $file->setName($value['name'][$k]); $file->setSize($value['size'][$k]); $file->setType($value['type'][$k]); diff --git a/src/Pecee/Http/Input/InputCollection.php b/src/Pecee/Http/Input/InputCollection.php index d531aba..09d601b 100644 --- a/src/Pecee/Http/Input/InputCollection.php +++ b/src/Pecee/Http/Input/InputCollection.php @@ -32,7 +32,7 @@ class InputCollection implements \IteratorAggregate { /** * @param $index * @throws \InvalidArgumentException - * @return IInputItem + * @return InputItem */ public function __get($index) { $item = $this->findFirst($index); diff --git a/src/Pecee/Http/Input/InputFile.php b/src/Pecee/Http/Input/InputFile.php index 734ffc5..429d3f3 100644 --- a/src/Pecee/Http/Input/InputFile.php +++ b/src/Pecee/Http/Input/InputFile.php @@ -1,26 +1,14 @@ index; - } - - /** - * @return string - */ - public function getName() { - return $this->name; - } - /** * @return string */ @@ -61,14 +49,6 @@ class InputFile { return file_get_contents($this->tmpName); } - public function setIndex($index) { - $this->index = $index; - } - - public function setName($name) { - $this->name = $name; - } - public function setTmpName($name) { $this->tmpName = $name; } diff --git a/src/Pecee/Http/Input/InputItem.php b/src/Pecee/Http/Input/InputItem.php index 3d3e912..8df2c57 100644 --- a/src/Pecee/Http/Input/InputItem.php +++ b/src/Pecee/Http/Input/InputItem.php @@ -7,7 +7,7 @@ class InputItem { protected $name; protected $value; - public function __construct($index, $value) { + public function __construct($index, $value = null) { $this->index = $index; $this->value = $value;