BasePath   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
c 2
b 0
f 0
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A clean() 0 5 2
A real() 0 3 1
A getPathForEnglish() 0 5 3
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