Total Complexity | 7 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | abstract class Database { |
||
15 | |||
16 | use Singleton; |
||
17 | |||
18 | /** @var PDO */ |
||
19 | protected $pdo; |
||
20 | |||
21 | /** @var PDOException|null */ |
||
22 | protected $pdoException; |
||
23 | |||
24 | /** |
||
25 | * Cria e retorna conexão PDO |
||
26 | * @param string[] $dbConfig |
||
27 | * @return PDO |
||
28 | */ |
||
29 | abstract protected function createPdo(&$dbConfig); |
||
30 | |||
31 | /** @return PDO */ |
||
32 | final public function getPDO() { |
||
33 | return $this->pdo; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Cria uma conexão com um banco de dados |
||
38 | * @param string[] $dbConfig |
||
39 | */ |
||
40 | public function connect($dbConfig) { |
||
41 | try { |
||
42 | $this->pdo = $this->createPdo($dbConfig); |
||
43 | $this->pdo->exec("set names utf8"); |
||
44 | $this->pdoException = null; |
||
45 | } catch (PDOException $ex) { |
||
46 | $this->pdoException = $ex; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Retorna TRUE caso a conexão tenha sido bem sucedida |
||
52 | * @return boolean |
||
53 | */ |
||
54 | public function isValid() { |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Redireciona para 503 caso a conexão tenha falhado |
||
60 | */ |
||
61 | public function validate() { |
||
65 | endif; |
||
66 | } |
||
67 | |||
69 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.