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

GitHubServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1.006

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 16
ccs 9
cts 11
cp 0.8182
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
crap 1.006
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