| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace AnyCloud\Service\File\Store; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use AnyCloud\File\Store\AnyCloud; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use AnyCloud\Service\File\Adapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use AnyCloud\Traits\CommonTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use League\Flysystem\Filesystem; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Interop\Container\ContainerInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Zend\ServiceManager\Factory\FactoryInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class AnyCloudFactory implements FactoryInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     use CommonTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     protected $options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     private $filesystem; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     private $uri; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     private $tempUri; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     private $adapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * @param ContainerInterface $serviceLocator | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * @param string             $requestedName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * @param array|null         $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @return AnyCloud|object | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 28 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |     public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null) | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |         $this->options = $serviceLocator->get('Omeka\Settings'); | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |         $this->createFilesystem(); | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |         $this->createUri(); | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         return new AnyCloud($this->filesystem, $this->options, $this->uri, $this->adapter); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * Create the Filesystem object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     private function createFilesystem() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $adapterName = $this->getAdapter(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         switch ($adapterName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             case 'aws': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             case 'digital_ocean': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             case 'scaleway': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                 $aws = new Adapter\AwsAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                 $this->adapter = $aws->createAdapter($this->options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             case 'azure': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |                 $azure = new Adapter\AzureAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |                 $this->adapter = $azure->createAdapter($this->options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |                 $this->tempUri = $azure->getUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             case 'rackspace': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |                 $rackspace = new Adapter\RackspaceAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |                 $this->adapter = $rackspace->createAdapter($this->options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |                 $this->tempUri = $rackspace->getUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             case 'dropbox': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |                 $dropbox = new Adapter\DropboxAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |                 $this->adapter = $dropbox->createAdapter($this->options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             case 'google': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                 $google = new Adapter\GoogleAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                 $this->adapter = $google->createAdapter($this->options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                 $this->tempUri = $google->getUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |                 $this->adapter = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $this->filesystem = new Filesystem($this->adapter); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * Create URI for file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     private function createUri() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $adapterName = $this->getAdapter(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         if($adapterName == 'aws' || $adapterName == 'digital_ocean' || $adapterName == 'scaleway') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             $this->uri = dirname($this->filesystem->getAdapter()->getClient()->getObjectUrl($this->getSetting('bucket'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |                 $this->getSetting('key'))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |             $this->uri = $this->tempUri; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 90 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 91 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths