Completed
Push — master ( 2df1ff...31a2b9 )
by Michael
04:54
created

getStatisticsRepositoryService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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\Database\DatabaseInterface;
12
use Joomla\DI\Container;
13
use Joomla\DI\ServiceProviderInterface;
14
use Joomla\StatsServer\Repositories\StatisticsRepository;
15
16
/**
17
 * Repository service provider
18
 */
19 View Code Duplication
class RepositoryServiceProvider implements ServiceProviderInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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 12
	public function register(Container $container): void
29
	{
30 12
		$container->share(StatisticsRepository::class, [$this, 'getStatisticsRepositoryService']);
31 12
	}
32
33
	/**
34
	 * Get the StatisticsRepository service
35
	 *
36
	 * @param   Container  $container  The DI container.
37
	 *
38
	 * @return  StatisticsRepository
39
	 */
40 8
	public function getStatisticsRepositoryService(Container $container): StatisticsRepository
41
	{
42 8
		return new StatisticsRepository(
43 8
			$container->get(DatabaseInterface::class)
44
		);
45
	}
46
}
47