Completed
Push — master ( bbe544...1bc078 )
by ReliQ
03:23 queued 11s
created

LanguageCodeChecker::getLanguageNameByCode()   A

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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\DirectTranslator\Utility;
6
7
use ReliqArts\DirectTranslator\Constant\LanguageCodes;
8
9
class LanguageCodeChecker
10
{
11
    /**
12
     * @param string $code
13
     *
14
     * @return bool
15
     */
16
    public function languageCodeExists(string $code): bool
17
    {
18
        return !empty($this->getLanguageNameByCode($code));
19
    }
20
21
    /**
22
     * @param string $code
23
     *
24
     * @return string
25
     */
26
    private function getLanguageNameByCode(string $code): string
27
    {
28
        return LanguageCodes::ISO6391[$code] ?? '';
29
    }
30
}
31