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

RequestLibraryHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A library() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WebServCo\Framework\Helpers;
6
7
use WebServCo\Framework\Libraries\Request;
8
9
abstract class RequestLibraryHelper extends AbstractLibraryHelper
10
{
11
    private static ?Request $object = null;
12
13
    public static function library(): Request
14
    {
15
        if (!self::$object instanceof Request) {
16
            $settings = ConfigLibraryHelper::getSettings('Request');
17
            // phpcs:ignore SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable.DisallowedSuperGlobalVariable
18
            self::$object = new Request($settings, $_SERVER, $_POST);
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\Request. Consider adding an additional type-check to rule them out.
Loading history...
21
    }
22
}
23