Passed
Push — master ( 894e98...cda682 )
by Aimeos
18:42 queued 10:10
created

FlyPhpcr::getProvider()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 3
nop 0
dl 0
loc 20
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2022
6
 * @package Base
7
 * @subpackage Filesystem
8
 */
9
10
11
namespace Aimeos\Base\Filesystem;
12
13
use League\Flysystem\Filesystem;
14
use League\Flysystem\Phpcr\PhpcrAdapter;
0 ignored issues
show
Bug introduced by
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
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 Base
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
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