FlyPhpcr   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 12
c 1
b 0
f 0
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getProvider() 0 20 3
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2018
6
 * @package MW
7
 * @subpackage Filesystem
8
 */
9
10
11
namespace Aimeos\MW\Filesystem;
12
13
use League\Flysystem\Filesystem;
14
use League\Flysystem\Phpcr\PhpcrAdapter;
0 ignored issues
show
Bug introduced by Aimeos
The type League\Flysystem\Phpcr\PhpcrAdapter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Jackalope\RepositoryFactoryDoctrineDBAL;
0 ignored issues
show
Bug introduced by Aimeos
The type Jackalope\RepositoryFactoryDoctrineDBAL was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Doctrine\DBAL\Driver\Connection;
17
use Doctrine\DBAL\DriverManager;
18
19
20
/**
21
 * Implementation of Flysystem PHPCR file system adapter
22
 *
23
 * @package MW
24
 * @subpackage Filesystem
25
 */
26
class FlyPhpcr extends FlyBase implements Iface, DirIface, MetaIface
27
{
28
	private $fs;
29
30
31
	/**
32
	 * Returns the file system provider
33
	 *
34
	 * @return \League\Flysystem\FilesystemInterface File system provider
35
	 */
36
	protected function getProvider()
37
	{
38
		if( !isset( $this->fs ) )
39
		{
40
			$config = $this->getConfig();
41
42
			if( !isset( $config['root'] ) ) {
43
				throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'root' ) );
44
			}
45
46
			$conn = DriverManager::getConnection( $config );
47
			$factory = new RepositoryFactoryDoctrineDBAL();
48
49
			$repo = $factory->getRepository( array( 'jackalope.doctrine_dbal_connection' => $conn ) );
50
			$session = $repo->login( new \PHPCR\SimpleCredentials( null, null ) );
0 ignored issues
show
Bug introduced by Aimeos
The type PHPCR\SimpleCredentials was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
51
52
			$this->fs = new Filesystem( new PhpcrAdapter( $session, $config['root'] ) );
53
		}
54
55
		return $this->fs;
56
	}
57
}
58