| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.0218 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 4 | public static function __callStatic($name, array $arguments) |
|
| 36 | { |
||
| 37 | 4 | $providerClassName = '\\Risan\\OAuth1\\Provider\\' . ucfirst($name); |
|
| 38 | |||
| 39 | 4 | if (! class_exists($providerClassName)) { |
|
| 40 | 2 | throw new InvalidArgumentException("Class {$providerClassName} is not exists."); |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | if (! isset($arguments[0])) { |
|
| 44 | 1 | throw new InvalidArgumentException("You need to pass the configuration array to ProviderFactory::{$name} method."); |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | if (! is_array($arguments[0])) { |
|
| 48 | throw new InvalidArgumentException('The configuration parameter must be an array.'); |
||
| 49 | } |
||
| 50 | |||
| 51 | 1 | return static::create(new $providerClassName(), $arguments[0]); |
|
| 52 | } |
||
| 54 |