Completed
Push — master ( da17ac...286914 )
by George
03:50
created

GitHubServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 81.82%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 1
c 2
b 0
f 2
lcom 0
cbo 3
dl 0
loc 28
ccs 9
cts 11
cp 0.8182
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php
2
3
namespace Stats\Providers;
4
5
use Joomla\DI\Container;
6
use Joomla\DI\ServiceProviderInterface;
7
use Joomla\Github\Github as BaseGithub;
8
use Stats\GitHub\GitHub;
9
10
/**
11
 * GitHub service provider
12
 *
13
 * @since  1.0
14
 */
15
class GitHubServiceProvider implements ServiceProviderInterface
16
{
17
	/**
18
	 * Registers the service provider with a DI container.
19
	 *
20
	 * @param   Container  $container  The DI container.
21
	 *
22
	 * @return  void
23
	 *
24
	 * @since   1.0
25
	 */
26 1
	public function register(Container $container)
27
	{
28 1
		$container->alias('github', BaseGithub::class)
29 1
			->alias(GitHub::class, BaseGithub::class)
30 1
			->share(
31 1
				BaseGithub::class,
32 1
				function (Container $container)
33
				{
34
					/** @var \Joomla\Registry\Registry $config */
35
					$config = $container->get('config');
36
37
					return new GitHub($config->extract('github'));
38 1
				},
39
				true
40 1
			);
41 1
	}
42
}
43