Database::getTables()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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