Completed
Push — master ( d6a52e...9b4e23 )
by Michael
02:57
created

FlysystemServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 52
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A getMigrationsFilesystemService() 0 4 1
A getSnapshotFilesystemService() 0 4 1
A getVersionsFilesystemService() 0 4 1
1
<?php
2
/**
3
 * Joomla! Statistics Server
4
 *
5
 * @copyright  Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved.
6
 * @license    http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later
7
 */
8
9
namespace Joomla\StatsServer\Providers;
10
11
use Joomla\DI\Container;
12
use Joomla\DI\ServiceProviderInterface;
13
use League\Flysystem\Adapter\Local;
14
use League\Flysystem\Filesystem;
15
16
/**
17
 * Flysystem service provider
18
 */
19
class FlysystemServiceProvider implements ServiceProviderInterface
20
{
21
	/**
22
	 * Registers the service provider with a DI container.
23
	 *
24
	 * @param   Container  $container  The DI container.
25
	 *
26
	 * @return  void
27
	 */
28 4
	public function register(Container $container): void
29
	{
30 4
		$container->share('filesystem.migrations', [$this, 'getMigrationsFilesystemService']);
31 4
		$container->share('filesystem.snapshot', [$this, 'getSnapshotFilesystemService']);
32 4
		$container->share('filesystem.versions', [$this, 'getVersionsFilesystemService']);
33 4
	}
34
35
	/**
36
	 * Get the `filesystem.migrations` service
37
	 *
38
	 * @param   Container  $container  The DI container.
39
	 *
40
	 * @return  Filesystem
41
	 */
42
	public function getMigrationsFilesystemService(Container $container): Filesystem
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
	{
44
		return new Filesystem(new Local(APPROOT . '/etc/migrations'));
45
	}
46
47
	/**
48
	 * Get the `filesystem.snapshot` service
49
	 *
50
	 * @param   Container  $container  The DI container.
51
	 *
52
	 * @return  Filesystem
53
	 */
54
	public function getSnapshotFilesystemService(Container $container): Filesystem
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
	{
56
		return new Filesystem(new Local(APPROOT . '/snapshots'));
57
	}
58
59
	/**
60
	 * Get the `filesystem.versions` service
61
	 *
62
	 * @param   Container  $container  The DI container.
63
	 *
64
	 * @return  Filesystem
65
	 */
66
	public function getVersionsFilesystemService(Container $container): Filesystem
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
	{
68
		return new Filesystem(new Local(APPROOT . '/versions'));
69
	}
70
}
71