| Total Complexity | 11 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class CheckGroupOptionsStep implements Step |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var Array |
||
| 13 | */ |
||
| 14 | private $options; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param array $options |
||
| 18 | */ |
||
| 19 | public function __construct(array $options = null) |
||
| 20 | { |
||
| 21 | $this->options = $options; |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | public function process($item, callable $next) |
||
| 28 | { |
||
| 29 | if ($this->options !== null) { |
||
| 30 | foreach ($this->options as $option) { |
||
| 31 | if (array_key_exists($option, $item)) { |
||
| 32 | $item[$option] = $this->checkValue($item[$option]); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | return $next($item); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Converts the attribute to the appropriate String value 'T' or 'F'. |
||
| 42 | * |
||
| 43 | * @param $attribute |
||
| 44 | */ |
||
| 45 | public function checkValue($attribute) |
||
| 65 | } |
||
| 66 | } |
||
| 67 |