Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
- Some suggested by php-cs-fixer
- Others to reduce nesting of conditionals
  • Loading branch information
weierophinney committed May 6, 2015
1 parent b087040 commit fd2782f
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/BaseInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\InitializableInterface;

/**
* @todo How should we deal with required input when data is missing?
* should a message be returned? if so, what message?
*/
class BaseInputFilter implements
InputFilterInterface,
UnknownInputsCapableInterface,
Expand Down Expand Up @@ -316,29 +312,30 @@ public function setValidationGroup($name)
if (is_array($name)) {
$inputs = array();
foreach ($name as $key => $value) {
if (!$this->has($key)) {
if (! $this->has($key)) {
$inputs[] = $value;
} else {
$inputs[] = $key;

if (!$this->inputs[$key] instanceof InputFilterInterface) {
throw new Exception\InvalidArgumentException(
sprintf(
'Input "%s" must implement InputFilterInterface',
$key
)
);
}
// Recursively populate validation groups for sub input filters
$this->inputs[$key]->setValidationGroup($value);
continue;
}
}

$inputs[] = $key;

if (! $this->inputs[$key] instanceof InputFilterInterface) {
throw new Exception\InvalidArgumentException(
sprintf(
'Input "%s" must implement InputFilterInterface',
$key
)
);
}

// Recursively populate validation groups for sub input filters
$this->inputs[$key]->setValidationGroup($value);
}
} else {
$inputs = func_get_args();
}

if (!empty($inputs)) {
if (! empty($inputs)) {
$this->validateValidationGroup($inputs);
$this->validationGroup = $inputs;
}
Expand Down

0 comments on commit fd2782f

Please sign in to comment.