Completed
Push — master ( 6acfe1...0042b2 )
by Radu
11:51 queued 10s
created

I18nLibraryHelper::library()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WebServCo\Framework\Helpers;
6
7
use WebServCo\Framework\Libraries\I18n;
8
9
abstract class I18nLibraryHelper extends AbstractLibraryHelper
10
{
11
    private static ?I18n $object = null;
12
13
    public static function library(): I18n
14
    {
15
        if (!self::$object instanceof I18n) {
16
            self::loadLibraryHelper('I18n');
17
            $settings = ConfigLibraryHelper::getSettings('I18n');
18
            self::$object = new I18n($settings);
19
        }
20
        return self::$object;
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::object could return the type null which is incompatible with the type-hinted return WebServCo\Framework\Libraries\I18n. Consider adding an additional type-check to rule them out.
Loading history...
21
    }
22
}
23