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

JsonReader::read()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
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\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