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

Config::verifyExecuteQueries()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
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
}