Translatable::getTexts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EasyPanel\Concerns;
4
5
use EasyPanel\Support\Contract\LangManager;
6
7
trait Translatable
8
{
9
    protected $texts = [];
10
11
    public function addText($text, $key = null)
12
    {
13
        if (array_key_exists($key, $this->texts)){
14
            return;
15
        }
16
17
        $this->texts[$key ?? $text] = $text;
18
    }
19
20
    public function translate()
21
    {
22
        LangManager::updateAll($this->texts);
23
    }
24
25
    public function getTexts()
26
    {
27
        return $this->texts;
28
    }
29
}
30