| 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 | 10 | public function __construct($method, array $attributes = []) { |
|
| 32 | 10 | if (!is_string($method)) { |
|
| 33 | throw new \InvalidArgumentException('Parameter "method" should be a string, ' . gettype($method) . ' given.'); |
||
| 34 | } |
||
| 35 | 10 | $method = mb_strtoupper($method); |
|
| 36 | 10 | if (!in_array($method, [self::METHOD_GET, self::METHOD_POST])) { |
|
| 37 | 1 | throw new \InvalidArgumentException('Invalid http method name.'); |
|
| 38 | } |
||
| 39 | 9 | $this->method = $method; |
|
| 40 | 9 | $this->attributes = $attributes; |
|
| 41 | 9 | } |
|
| 42 | |||
| 87 | } |