Failed Conditions
Push — master ( a2f8a2...e02dc1 )
by Alexander
01:53
created

AbstractDataCollector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 62
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
collectData() 0 1 ?
A aggregateData() 0 4 1
deleteData() 0 1 ?
A getStatistics() 0 4 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\KnowledgeBase\DataCollector;
12
13
14
use Aura\Sql\ExtendedPdoInterface;
15
use ConsoleHelpers\CodeInsight\KnowledgeBase\KnowledgeBase;
16
use Go\ParserReflection\ReflectionFileNamespace;
17
18
abstract class AbstractDataCollector
19
{
20
21
	/**
22
	 * Database.
23
	 *
24
	 * @var ExtendedPdoInterface
25
	 */
26
	protected $db;
1 ignored issue
show
Comprehensibility introduced by
Avoid variables with short names like $db. 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...
27
28
	/**
29
	 * Creates data collector instance.
30
	 *
31
	 * @param ExtendedPdoInterface $db Database.
32
	 */
33 22
	public function __construct(ExtendedPdoInterface $db)
1 ignored issue
show
Comprehensibility introduced by
Avoid variables with short names like $db. 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...
34
	{
35 22
		$this->db = $db;
36 22
	}
37
38
	/**
39
	 * Collect data from a namespace.
40
	 *
41
	 * @param integer                 $file_id   File id.
42
	 * @param ReflectionFileNamespace $namespace Namespace.
43
	 *
44
	 * @return void
45
	 */
46
	abstract public function collectData($file_id, ReflectionFileNamespace $namespace);
47
48
	/**
49
	 * Aggregate previously collected data.
50
	 *
51
	 * @param KnowledgeBase $knowledge_base Knowledge base.
52
	 *
53
	 * @return void
54
	 */
55 4
	public function aggregateData(KnowledgeBase $knowledge_base)
56
	{
57
58 4
	}
59
60
	/**
61
	 * Delete previously collected data for a files.
62
	 *
63
	 * @param array $file_ids File IDs.
64
	 *
65
	 * @return void
66
	 */
67
	abstract public function deleteData(array $file_ids);
68
69
	/**
70
	 * Returns statistics about the code.
71
	 *
72
	 * @return array
73
	 */
74
	public function getStatistics()
75
	{
76
		return array();
77
	}
78
79
}
80