Database   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 14.29%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 47
ccs 2
cts 14
cp 0.1429
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getTables() 0 3 1
A getResult() 0 18 3
1
<?php
2
3
namespace Zortje\MySQLKeeper;
4
5
use Zortje\MySQLKeeper\Database\TableCollection;
6
use Zortje\MySQLKeeper\Database\Table;
7
8
/**
9
 * Class Database
10
 *
11
 * @package Zortje\MySQLKeeper
12
 */
13
class Database {
14
15
	/**
16
	 * @var TableCollection Database tables
17
	 */
18
	private $tables;
19
20
	/**
21
	 * @param TableCollection $tables Database tabels
22
	 */
23
	public function __construct(TableCollection $tables) {
24
		$this->tables = $tables;
25
	}
26
27
	/**
28
	 * Get database tables
29
	 *
30
	 * @return TableCollection Database tables
31
	 */
32 1
	public function getTables() {
33 1
		return $this->tables;
34
	}
35
36
	/**
37
	 * Get result for database
38
	 *
39
	 * @return array Result
40
	 */
41
	public function getResult() {
42
		$result = [];
43
44
		/**
45
		 * Go though tables to get results
46
		 *
47
		 * @var Table $table
48
		 */
49
		foreach ($this->tables as $table) {
50
			$tableResult = $table->getResult();
51
52
			if (count($tableResult['issues']) > 0) {
53
				$result[$table->getName()] = $table->getResult();
54
			}
55
		}
56
57
		return $result;
58
	}
59
}
60