JsonReader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A read() 0 9 2
1
<?php
2
3
namespace Phiber\Util;
4
5
/**
6
 * Classe responsável por ler o arquivo de json especificado.
7
 *
8
 * @package util
9
 */
10
class JsonReader
11
{
12
    /**
13
     * Caminho absoluto para o local do arquivo.
14
     *
15
     * @var string
16
     */
17
    private $file;
18
19
    /**
20
     * JsonReader constructor.
21
     *
22
     * @param string $file
23
     */
24
    public function __construct($file)
25
    {
26
        $this->file = $file;
27
    }
28
29
    /**
30
     * Responsável por retornar o conteúdo do arquivo.
31
     *
32
     * @return array|boolean
33
     */
34
    public function read()
35
    {
36
37
        if ($content = file_get_contents($this->file)) {
38
            $read = json_decode($content);
39
            return $read;
40
        };
41
        return false;
42
    }
43
}
44