TableGateway::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace Silk\Database;
4
5
use PhpDocReader\Reader;
6
use Silk\Exceptions\NoTableFoundException;
7
use Zend\Db\TableGateway\AbstractTableGateway;
8
use Zend\Db\TableGateway\Feature\GlobalAdapterFeature;
9
10
/**
11
 * Class TableGateway
12
 * @author  Lucas A. de Araújo <[email protected]>
13
 * @package Silk\Database
14
 */
15
class TableGateway extends AbstractTableGateway
16
{
17
    public function __construct($object)
18
    {
19
        $config = Reader::getConfig($object);
20
21
        if (!array_key_exists('table', $config))
22
            throw new NoTableFoundException();
23
24
        $this->table = $config['table'];
25
        $this->adapter = GlobalAdapterFeature::getStaticAdapter();
26
    }
27
}