Failed Conditions
Push — master ( 9ab98a...04484b )
by Alexander
03:08
created

Container   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 81.25%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 40
ccs 13
cts 16
cp 0.8125
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 32 1
1
<?php
2
/**
3
 * This file is part of the Code-Insight 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/code-insight
9
 */
10
11
namespace ConsoleHelpers\CodeInsight;
12
13
14
use ConsoleHelpers\CodeInsight\KnowledgeBase\DatabaseManager;
15
use ConsoleHelpers\CodeInsight\KnowledgeBase\KnowledgeBaseFactory;
16
use ConsoleHelpers\DatabaseMigration\MigrationManager;
17
use ConsoleHelpers\DatabaseMigration\PhpMigrationRunner;
18
use ConsoleHelpers\DatabaseMigration\SqlMigrationRunner;
19
20
class Container extends \ConsoleHelpers\ConsoleKit\Container
21
{
22
23
	/**
24
	 * {@inheritdoc}
25
	 */
26 22
	public function __construct(array $values = array())
27
	{
28 22
		parent::__construct($values);
29
30 22
		$this['app_name'] = 'Code-Insight';
31 22
		$this['app_version'] = '@git-version@';
32
33 22
		$this['working_directory_sub_folder'] = '.code-insight';
34
35 22
		$this['config_defaults'] = array();
36
37
		$this['project_root_folder'] = function () {
38 22
			return dirname(dirname(__DIR__));
39
		};
40
41
		$this['migration_manager'] = function ($c) {
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $c. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
42 22
			$migrations_directory = $c['project_root_folder'] . '/migrations';
43 22
			$migration_manager = new MigrationManager($migrations_directory, $c);
44 22
			$migration_manager->registerMigrationRunner(new SqlMigrationRunner());
45 22
			$migration_manager->registerMigrationRunner(new PhpMigrationRunner());
46
47 22
			return $migration_manager;
48
		};
49
50
		$this['db_manager'] = function ($c) {
51
			return new DatabaseManager($c['migration_manager']);
52
		};
53
54
		$this['knowledge_base_factory'] = function ($c) {
55
			return new KnowledgeBaseFactory($c['db_manager']);
56
		};
57 22
	}
58
59
}
60