Manager   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 11
c 4
b 0
f 0
dl 0
loc 31
ccs 0
cts 10
cp 0
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCache() 0 8 2
A describeTable() 0 8 2
1
<?php
2
3
namespace Nip\Database\Metadata;
4
5
use Nip\Database\Connections\HasConnectionTrait;
6
7
/**
8
 * Class Manager
9
 * @package Nip\Database\Metadata
10
 */
11
class Manager
12
{
13
    use HasConnectionTrait;
14
15
    protected $_cache;
16
17
    /**
18
     * @param $table
19
     * @return bool|mixed
20
     */
21
    public function describeTable($table)
22
    {
23
        $data = $this->getCache()->describeTable($table);
24
        if (!is_array($data)) {
25
            return trigger_error("Cannot load metadata for table [$table]", E_USER_ERROR);
26
        }
27
28
        return $data;
29
    }
30
31
    /**
32
     * @return Cache
33
     */
34
    public function getCache()
35
    {
36
        if (!$this->_cache) {
37
            $this->_cache = new Cache();
38
            $this->_cache->setMetadata($this);
39
        }
40
41
        return $this->_cache;
42
    }
43
}
44