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