| Conditions | 3 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 2 | public static function create(array $config, $signer = null) |
|
| 26 | { |
||
| 27 | 2 | if (null === $signer) { |
|
| 28 | 1 | $signer = new HmacSha1Signer; |
|
| 29 | } |
||
| 30 | |||
| 31 | 2 | if (! $signer instanceof SignerInterface) { |
|
| 32 | 1 | throw new InvalidArgumentException('The signer must implement the \Risan\OAuth1\Signature\SignerInterface.'); |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | $configFactory = new ConfigFactory; |
|
| 36 | |||
| 37 | 1 | $protocolParameter = new ProtocolParameter( |
|
| 38 | 1 | $configFactory->createFromArray($config), |
|
| 39 | 1 | $signer, |
|
| 40 | 1 | new NonceGenerator |
|
| 41 | ); |
||
| 42 | |||
| 43 | 1 | $authorizationHeader = new AuthorizationHeader($protocolParameter); |
|
| 44 | |||
| 45 | 1 | $requestFactory = new RequestFactory($authorizationHeader, new UriParser); |
|
| 46 | |||
| 47 | 1 | return new OAuth1(new HttpClient, $requestFactory, new CredentialsFactory); |
|
| 48 | } |
||
| 49 | } |
||
| 50 |