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