Passed
Push — master ( db71b9...272130 )
by Darío
04:27
created

GatewayAdapter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Auth\Model;
4
5
use Drone\Db\TableGateway\TableGateway;
6
use Drone\Db\Entity;
7
8
class GatewayAdapter extends TableGateway
9
{
10
    /**
11
     * Constructor
12
     *
13
     * @return null
14
     */
15
    public function __construct(Entity $entity)
16
    {
17
        parent::__construct($entity, false);
18
19
        $this->getDriver()->getDb()->setDbUser($_COOKIE["username"]);
20
        $this->getDriver()->getDb()->setDbpass($_COOKIE["password"]);
21
22
        if (!$this->getDriver()->getDb()->connect())
23
        {
24
            $errors = $this->getDriver()->getDb()->getErrors();
25
            throw new \Exception(array_shift($errors));
26
        }
27
    }
28
}