Passed
Push — master ( 51edae...d29a9b )
by Curtis
11:52 queued 05:54
created

Reader::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Service\enso\Localisation\Json;
4
5
use LaravelEnso\Helpers\Services\JsonReader;
6
use App\Models\enso\Localisation\Language;
7
use LaravelEnso\Localisation\Services\Traits\JsonFilePathResolver;
8
9
class Reader
10
{
11
    use JsonFilePathResolver;
12
13
    private Language $language;
14
    private string $subDirectory;
15
16
    public function __construct(Language $language, ?string $subDirectory = null)
17
    {
18
        $this->language = $language;
19
        $this->subDirectory = $subDirectory;
20
    }
21
22
    public function get(): string
23
    {
24
        return (new JsonReader($this->filename()))->json();
25
    }
26
27
    private function filename(): string
28
    {
29
        return $this->jsonFileName(
30
            $this->language->name,
31
            $this->subDirectory
32
        );
33
    }
34
}
35