| Total Complexity | 4 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class CustomCondition implements ConditionInterface { |
||
| 18 | /** |
||
| 19 | * Callable to use |
||
| 20 | * |
||
| 21 | * @var callable |
||
| 22 | */ |
||
| 23 | protected $callable = null; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Arguments to pass to the callable and controller |
||
| 27 | * |
||
| 28 | * @var array |
||
| 29 | */ |
||
| 30 | protected $arguments = []; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Constructor |
||
| 34 | * |
||
| 35 | * @codeCoverageIgnore |
||
| 36 | * @param callable $callable |
||
| 37 | * @param mixed ...$arguments |
||
| 38 | */ |
||
| 39 | public function __construct( $callable ) { |
||
| 40 | $this->callable = $callable; |
||
| 41 | $this->arguments = array_values( array_slice( func_get_args(), 1 ) ); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritDoc} |
||
| 46 | */ |
||
| 47 | 1 | public function isSatisfied( RequestInterface $request ) { |
|
| 48 | 1 | return call_user_func_array( $this->callable, $this->arguments ); |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritDoc} |
||
| 53 | */ |
||
| 54 | 1 | public function getArguments( RequestInterface $request ) { |
|
| 55 | 1 | return $this->arguments; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Get the assigned callable |
||
| 60 | * |
||
| 61 | * @return callable |
||
| 62 | */ |
||
| 63 | 1 | public function getCallable() { |
|
| 65 | } |
||
| 66 | } |
||
| 67 |