| Total Complexity | 4 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class ChangeKernel extends Action |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Action parameter |
||
| 15 | * |
||
| 16 | * @const ACTION |
||
| 17 | */ |
||
| 18 | const ACTION = 'change_kernel'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Action HTTP Method |
||
| 22 | * |
||
| 23 | * @const method |
||
| 24 | */ |
||
| 25 | const METHOD = 'POST'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Unique number used to identify a specific kernel |
||
| 29 | * |
||
| 30 | * @var int kernel |
||
| 31 | */ |
||
| 32 | protected $kernel; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Constructor for change kernel action |
||
| 36 | * |
||
| 37 | * @param array $values |
||
| 38 | * @throws \InvalidArgumentException |
||
| 39 | */ |
||
| 40 | 7 | public function __construct(Array $values) |
|
| 41 | { |
||
| 42 | 7 | if (!isset($values['kernel'])) { |
|
| 43 | 4 | throw new InvalidArgumentException('Kernel argument must be an integer'); |
|
| 44 | } |
||
| 45 | |||
| 46 | 3 | if (!is_int($values['kernel'])) { |
|
| 47 | 1 | throw new InvalidArgumentException('Required value "kernel" is not present'); |
|
| 48 | } |
||
| 49 | |||
| 50 | 2 | $this->kernel = $values['kernel']; |
|
| 51 | 2 | } |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Return the body of the request |
||
| 55 | * |
||
| 56 | * @return string json representation of the body |
||
| 57 | */ |
||
| 58 | 1 | public function getBody() |
|
| 63 | ]); |
||
| 64 | } |
||
| 67 |