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

JsonReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

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