BasePath::real()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Support\Path;
4
5
use Helldar\LaravelLangPublisher\Constants\Locales;
6
use Helldar\LaravelLangPublisher\Contracts\Pathable;
7
8
abstract class BasePath implements Pathable
9
{
10
    protected $is_json = false;
11 102
12
    protected function real(string $path): string
13 102
    {
14
        return realpath($path);
15
    }
16 102
17
    protected function clean(string $path = null): ?string
18 102
    {
19 102
        return $path
20 102
            ? static::DIVIDER . ltrim($path, ' \\/')
21
            : $path;
22
    }
23 102
24
    protected function getPathForEnglish(string $locale): string
25 102
    {
26 54
        return $locale === Locales::ENGLISH
27 54
            ? '/script/en/'
28 54
            : ($this->is_json ? '/json/' : '/src/' . $locale);
29
    }
30
}
31