Skip to content

Commit

Permalink
Added files to parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Pospisil committed Jun 6, 2017
1 parent 1e3d14a commit dba9248
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/IParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface IParameters {

public function post($key = NULL, $isRequired = FALSE, array $validators = null);

public function file($key = NULL, $isRequired = FALSE, array $validators = null);

public function get($key = NULL, $isRequired = FALSE, array $validators = null);

public function path($key, $isRequired = FALSE, array $validators = null);
Expand Down
9 changes: 9 additions & 0 deletions src/Parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public function post($key = NULL, $isRequired = FALSE, array $validators = array
return $return;
}

public function file($key = null, $isRequired = FALSE, array $validators = array()){
if($key)
$return = $this->request->getFile($key);
else
$return = $this->request->getFiles();
$return = $this->validator->validate($key, $isRequired, $validators, $return);
return $return;
}

public function get($key = NULL, $isRequired = FALSE, array $validators = array()){
$return = $this->request->getQuery($key);
$return = $this->validator->validate($key, $isRequired, $validators, $return);
Expand Down

0 comments on commit dba9248

Please sign in to comment.