Failed Conditions
Push — master ( 830d2d...99bc8c )
by Alexander
02:52
created

Container   B

Complexity

Total Complexity 1

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 16

Test Coverage

Coverage 96.55%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 1
c 5
b 0
f 1
lcom 0
cbo 16
dl 0
loc 74
ccs 28
cts 29
cp 0.9655
rs 8.4614

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 66 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\Helper\SizeHelper;
17
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\ClassicMergeSourceDetector;
18
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\InPortalMergeSourceDetector;
19
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\MergeSourceDetectorAggregator;
20
use ConsoleHelpers\SVNBuddy\Process\ProcessFactory;
21
use ConsoleHelpers\SVNBuddy\Repository\Connector\Connector;
22
use ConsoleHelpers\SVNBuddy\Repository\Connector\UrlResolver;
23
use ConsoleHelpers\SVNBuddy\Repository\Parser\RevisionListParser;
24
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\RevisionLogFactory;
25
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
26
use Symfony\Component\Console\Output\OutputInterface;
27
28
class Container extends \ConsoleHelpers\ConsoleKit\Container
29
{
30
31
	/**
0 ignored issues
show
introduced by
Doc comment for parameter "$values" missing
Loading history...
32
	 * {@inheritdoc}
0 ignored issues
show
introduced by
Doc comment short description must start with a capital letter
Loading history...
33
	 */
34 19
	public function __construct(array $values = array())
35 19
	{
36 19
		parent::__construct($values);
37
38 19
		$this['app_name'] = 'SVN-Buddy';
39 19
		$this['app_version'] = '@git-version@';
40
41 19
		$this['working_directory_sub_folder'] = '.svn-buddy';
42
43 19
		$this['config_defaults'] = array(
44 19
			'repository-connector.username' => '',
45 19
			'repository-connector.password' => '',
46 19
			'repository-connector.last-revision-cache-duration' => '10 minutes',
47
		);
48
49
		$this->extend('output', function ($output, $c) {
50
			/** @var OutputInterface $output */
51 5
			$output->getFormatter()->setStyle('debug', new OutputFormatterStyle('white', 'magenta'));
52
53 5
		    return $output;
54 19
		});
55
56
		$this['process_factory'] = function () {
57 3
			return new ProcessFactory();
58 19
		};
59
60
		$this['merge_source_detector'] = function () {
61 1
			$merge_source_detector = new MergeSourceDetectorAggregator(0);
62 1
			$merge_source_detector->add(new ClassicMergeSourceDetector(0));
63 19
			$merge_source_detector->add(new InPortalMergeSourceDetector(50));
64
65 1
			return $merge_source_detector;
66
		};
67
68
		$this['repository_url_resolver'] = function ($c) {
69
			return new UrlResolver($c['repository_connector']);
70
		};
71
72
		$this['cache_manager'] = function ($c) {
73 3
			return new CacheManager($c['working_directory'], $c['size_helper'], $c['io']);
74
		};
75
76
		$this['revision_log_factory'] = function ($c) {
77 1
			return new RevisionLogFactory($c['repository_connector'], $c['cache_manager']);
78
		};
79
80
		$this['revision_list_parser'] = function () {
81 1
			return new RevisionListParser();
82
		};
83
84
		$this['repository_connector'] = function ($c) {
85 2
			return new Connector($c['config_editor'], $c['process_factory'], $c['io'], $c['cache_manager']);
86
		};
87
88
		$this['date_helper'] = function () {
89 1
			return new DateHelper();
90
		};
91
92
		$this['size_helper'] = function () {
93 3
			return new SizeHelper();
94
		};
95
96 1
		$this['editor'] = function () {
97 1
			return new InteractiveEditor();
98
		};
99 19
	}
100
101
}
102