Failed Conditions
Push — master ( 7cda88...e9e1eb )
by Alexander
02:49
created

Container   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 15

Test Coverage

Coverage 96.3%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 1
c 4
b 0
f 1
lcom 0
cbo 15
dl 0
loc 70
ccs 26
cts 27
cp 0.963
rs 9.1666

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 62 1
1
<?php
2
/**
3
 * This file is part of the SVN-Buddy library.
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @copyright Alexander Obuhovich <[email protected]>
8
 * @link      https://github.com/console-helpers/svn-buddy
9
 */
10
11
namespace ConsoleHelpers\SVNBuddy;
12
13
14
use ConsoleHelpers\SVNBuddy\Cache\CacheManager;
15
use ConsoleHelpers\SVNBuddy\Helper\DateHelper;
16
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\ClassicMergeSourceDetector;
17
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\InPortalMergeSourceDetector;
18
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\MergeSourceDetectorAggregator;
19
use ConsoleHelpers\SVNBuddy\Process\ProcessFactory;
20
use ConsoleHelpers\SVNBuddy\Repository\Connector\Connector;
21
use ConsoleHelpers\SVNBuddy\Repository\Connector\UrlResolver;
22
use ConsoleHelpers\SVNBuddy\Repository\Parser\RevisionListParser;
23
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\RevisionLogFactory;
24
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
25
use Symfony\Component\Console\Output\OutputInterface;
26
27
class Container extends \ConsoleHelpers\ConsoleKit\Container
28
{
29
30
	/**
0 ignored issues
show
introduced by
Doc comment for parameter "$values" missing
Loading history...
31
	 * {@inheritdoc}
0 ignored issues
show
introduced by
Doc comment short description must start with a capital letter
Loading history...
32
	 */
33 19
	public function __construct(array $values = array())
34 19
	{
35 19
		parent::__construct($values);
36
37 19
		$this['app_name'] = 'SVN-Buddy';
38 19
		$this['app_version'] = '@git-version@';
39
40 19
		$this['working_directory_sub_folder'] = '.svn-buddy';
41
42 19
		$this['config_defaults'] = array(
43 19
			'repository-connector.username' => '',
44 19
			'repository-connector.password' => '',
45 19
			'repository-connector.last-revision-cache-duration' => '10 minutes',
46
		);
47
48
		$this->extend('output', function ($output, $c) {
1 ignored issue
show
Unused Code introduced by
The parameter $c 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...
49
			/** @var OutputInterface $output */
50 19
			$output->getFormatter()->setStyle('debug', new OutputFormatterStyle('white', 'magenta'));
51
52 5
		    return $output;
53 19
		});
54
55
		$this['process_factory'] = function () {
56 3
			return new ProcessFactory();
57
		};
58
59
		$this['merge_source_detector'] = function () {
60 1
			$merge_source_detector = new MergeSourceDetectorAggregator(0);
61 1
			$merge_source_detector->add(new ClassicMergeSourceDetector(0));
62 1
			$merge_source_detector->add(new InPortalMergeSourceDetector(50));
63
64 1
			return $merge_source_detector;
65
		};
66
67
		$this['repository_url_resolver'] = function ($c) {
68
			return new UrlResolver($c['repository_connector']);
69
		};
70
71
		$this['cache_manager'] = function ($c) {
72 3
			return new CacheManager($c['working_directory'], $c['io']);
73
		};
74
75
		$this['revision_log_factory'] = function ($c) {
76 1
			return new RevisionLogFactory($c['repository_connector'], $c['cache_manager']);
77
		};
78
79
		$this['revision_list_parser'] = function () {
80 1
			return new RevisionListParser();
81
		};
82
83
		$this['repository_connector'] = function ($c) {
84 2
			return new Connector($c['config_editor'], $c['process_factory'], $c['io'], $c['cache_manager']);
85
		};
86
87
		$this['date_helper'] = function () {
88 1
			return new DateHelper();
89
		};
90
91 1
		$this['editor'] = function () {
92 1
			return new InteractiveEditor();
93
		};
94 19
	}
95
96
}
97