| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.3244 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 3 | public function build(array $config): AdapterInterface |
|
| 37 | { |
||
| 38 | 3 | if (!class_exists(ReplicateAdapter::class)) { |
|
| 39 | throw PackageRequiredException::fromAdapterAndPackageNames( |
||
| 40 | 'replicate', |
||
| 41 | 'league/flysystem-replicate-adapter' |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | 3 | if (!isset($config['source']) || !isset($config['target'])) { |
|
| 46 | 2 | throw new FactoryException( |
|
| 47 | 2 | 'You must configure `source` and `target`' |
|
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | 1 | return new ReplicateAdapter( |
|
| 52 | 1 | $config['source'], |
|
| 53 | 1 | $config['target'] |
|
| 54 | ); |
||
| 57 |