Completed
Push — master ( 98a82f...7bd861 )
by Márcio Lucas R.
11s
created

Config   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A verifyExecuteQueries() 0 7 2
1
<?php
2
3
/**
4
 * Copyright (c) 2017. Este código foi feito por @marciioluucas, sob licença MIT
5
 */
6
namespace Phiber\ORM;
7
8
use Phiber\Util\JsonReader;
9
10
/**
11
 * Classe responsável por recuperar as informações de configuração do Phiber
12
 * 
13
 * @package bin
14
 */
15
class Config
16
{
17
    /**
18
     * @var JsonReader
19
     */
20
    private $phiberConfig;
21
22
    /**
23
     * Config constructor.
24
     */
25
    public function __construct()
26
    {
27
        $this->phiberConfig = new JsonReader(BASE_DIR . "/phiber_config.json");
28
29
        if (!empty(glob(dirname(__DIR__, 4) . "/phiber_config.json")[0])) {
30
            $this->phiberConfig = new JsonReader(glob(dirname(__DIR__, 4) . "/phiber_config.json")[0]);
31
        }
32
    }
33
34
    /**
35
     * Retorna se é para executar as queries ou não.
36
     * 
37
     * @return bool
38
     */
39
    public function verifyExecuteQueries()
40
    {
41
        if ($this->phiberConfig->read()->phiber->execute_querys == 1) {
42
            return true;
43
        }
44
        return false;
45
    }
46
}