| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.0123 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 28 | public function __construct($method, array $attributes = []) { |
|
| 32 | 28 | if (!is_string($method)) { |
|
| 33 | throw new \InvalidArgumentException('Parameter "method" should be a string, ' . gettype($method) . ' given.'); |
||
| 34 | } |
||
| 35 | 28 | $method = strtoupper($method); |
|
| 36 | 28 | if (!in_array($method, [self::METHOD_GET, self::METHOD_POST])) { |
|
| 37 | 1 | throw new \InvalidArgumentException('Invalid http method name.'); |
|
| 38 | } |
||
| 39 | 27 | $this->method = $method; |
|
| 40 | 27 | $this->data = $attributes; |
|
| 41 | 27 | } |
|
| 42 | |||
| 91 | } |