GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( a1835d...10e84a )
by
unknown
02:48
created

Page::getPresets()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Framework\Http\Router\DataStructures;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Spl\DataStructures\SplArrayObject;
19
use O2System\Spl\Info\SplFileInfo;
20
21
/**
22
 * Class Page
23
 *
24
 * @package O2System\Framework\Http\Router\DataStructures
25
 */
26
class Page extends SplFileInfo
27
{
28
    /**
29
     * Page Variables
30
     *
31
     * @var SplArrayObject
32
     */
33
    private $vars = [];
34
35
    /**
36
     * Page Presets
37
     *
38
     * @var SplArrayObject
39
     */
40
    private $presets;
41
42
    // ------------------------------------------------------------------------
43
44
    /**
45
     * Page::__construct
46
     *
47
     * @param string $filename
48
     */
49
    public function __construct($filename)
50
    {
51
        parent::__construct($filename);
52
53
        if (file_exists(
54
            $propertiesFilePath = $this->getPath() . DIRECTORY_SEPARATOR . str_replace(
55
                    '.phtml',
56
                    '.json',
57
                    strtolower($this->getBasename())
58
                )
59
        )) {
60
            $properties = file_get_contents($propertiesFilePath);
61
            $properties = json_decode($properties, true);
62
63
            if (isset($properties[ 'vars' ])) {
64
                $this->vars = $properties[ 'vars' ];
65
            }
66
67
            if (isset($properties[ 'presets' ])) {
68
                $this->presets = new SplArrayObject($properties[ 'presets' ]);
69
            }
70
        }
71
    }
72
73
    // ------------------------------------------------------------------------
74
75
    /**
76
     * Page::getVars
77
     *
78
     * Gets page variables.
79
     *
80
     * @return \O2System\Spl\DataStructures\SplArrayObject
81
     */
82
    public function getVars()
83
    {
84
        return $this->vars;
85
    }
86
87
    // ------------------------------------------------------------------------
88
89
    /**
90
     * Page::getPresets
91
     *
92
     * Gets page presets.
93
     *
94
     * @return bool|\O2System\Spl\DataStructures\SplArrayObject
95
     */
96
    public function getPresets()
97
    {
98
        if ($this->presets instanceof SplArrayObject) {
0 ignored issues
show
introduced by
$this->presets is always a sub-type of O2System\Spl\DataStructures\SplArrayObject.
Loading history...
99
            return $this->presets;
100
        }
101
102
        return false;
103
    }
104
}