Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class FlysystemStrategy extends MergeStrategy |
||
8 | { |
||
9 | /** |
||
10 | * {@inheritdoc} |
||
11 | */ |
||
12 | protected function mergeChunks(string $destination, array $chunks): bool |
||
13 | { |
||
14 | if (! $this->chunksManager->chunksFilesystem()->concatenate($destination, $chunks)) { |
||
|
|||
15 | throw new StrategyException('Unable to concatenate chunks'); |
||
16 | } |
||
17 | |||
18 | return true; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | public function merge(): string |
||
25 | { |
||
26 | // Retrieve chunks |
||
27 | $chunks = $this->chunksManager->temporaryFiles( |
||
28 | $this->chunksFolder() |
||
29 | )->values(); |
||
30 | $chunk = $this->chunksManager->chunks( |
||
31 | $this->chunksFolder() |
||
32 | )->first(); |
||
33 | |||
34 | // Merge chunks |
||
35 | $this->mergeChunks($chunk->getPath(), $chunks->toArray()); |
||
36 | |||
37 | // Move chunks to destination |
||
38 | $origin = $this->chunksManager->chunk($chunk); |
||
39 | $path = $this->mergeManager->store( |
||
40 | $this->destination, |
||
41 | $origin, |
||
42 | $this->mergeManager->getMergeOptions() |
||
43 | ); |
||
44 | |||
45 | if (! $path) { |
||
46 | throw new StrategyException('An error occurred while moving merge to destination'); |
||
47 | } |
||
48 | |||
49 | // Cleanup |
||
50 | $this->chunksManager->deleteChunkFolder($this->folder); |
||
51 | |||
52 | return $path; |
||
53 | } |
||
54 | |||
55 | public static function instance() |
||
58 | } |
||
59 | } |
||
60 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.