AbstractDataCollector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 59
ccs 5
cts 7
cp 0.7143
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A aggregateData() 0 2 1
A getStatistics() 0 3 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;
27
28
	/**
29
	 * Creates data collector instance.
30
	 *
31
	 * @param ExtendedPdoInterface $db Database.
32
	 */
33 22
	public function __construct(ExtendedPdoInterface $db)
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)
0 ignored issues
show
Unused Code introduced by
The parameter $knowledge_base is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
	public function aggregateData(/** @scrutinizer ignore-unused */ KnowledgeBase $knowledge_base)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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