| Conditions | 4 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 16 | public function build() |
|
| 38 | { |
||
| 39 | 16 | if (!empty($this->config['marek_toggable']['security']['token'])) { |
|
| 40 | |||
| 41 | 14 | return new ApiToken($this->config['marek_toggable']['security']['token']); |
|
| 42 | |||
| 43 | 2 | } else if (!empty($this->config['marek_toggable']['security']['username']) && !empty($this->config['marek_toggable']['security']['password'])) { |
|
| 44 | |||
| 45 | 1 | return new UsernameAndPasswordToken( |
|
| 46 | 1 | $this->config['marek_toggable']['security']['username'], |
|
| 47 | 1 | $this->config['marek_toggable']['security']['password'] |
|
| 48 | 1 | ); |
|
| 49 | |||
| 50 | } else { |
||
| 51 | |||
| 52 | 1 | throw new InvalidArgumentException('Please provide valid security configuration.'); |
|
| 53 | |||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 |