Completed
Push — master ( 1680b9...7d3d6e )
by Mohamed
15s queued 11s
created

Localization::isRTL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Microboard\Foundations;
4
5
use Illuminate\Support\Collection;
6
7
class Localization
8
{
9
    /**
10
     * @var Collection
11
     */
12
    private $lang;
13
14
    /**
15
     * Localization constructor.
16
     */
17
    public function __construct()
18
    {
19
        $this->lang = collect(config('microboard.localizations', []));
20
    }
21
22
    /**
23
     * @return array
24
     */
25
    public function getLocale()
26
    {
27
        return $this->lang->where('code', app()->getLocale())->first();
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getDirection()
34
    {
35
        return $this->getLocale()['dir'] ?? 'ltr';
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function isRTL()
42
    {
43
        return $this->getDirection() === 'rtl';
44
    }
45
}
46