Passed
Push — master ( 1a06f6...56a418 )
by Thierry
02:34
created

Package::readyInlined()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Generator.php - Code generator interface
5
 *
6
 * Any class generating css or js code must implement this interface.
7
 *
8
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
11
 * @link https://github.com/jaxon-php/jaxon-core
12
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
13
14
namespace Jaxon\Plugin;
15
16
use Jaxon\Utils\Config\Config;
17
18
abstract class Package implements Code\Contracts\Generator
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Package
Loading history...
19
{
20
    /**
21
     * The configuration options of the package
22
     *
23
     * @var array
24
     */
25
    protected $aOptions = [];
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
26
27
    /**
28
     * The configuration options of the package
29
     *
30
     * @var Config
31
     */
32
    protected $xConfig;
33
34
    /**
35
     * Whether to include the getReadyScript() in the generated code.
36
     *
37
     * @var boolean
38
     */
39
    protected $bReadyEnabled = false;
40
41
    /**
42
     * Get package options in an array.
43
     *
44
     * @return array
45
     */
46
    public function getOptions()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
47
    {
48
        return $this->aOptions;
49
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
50
51
    /**
52
     * Get package options in a Config object.
53
     *
54
     * @return Config
55
     */
56
    public function getConfig()
57
    {
58
        return $this->xConfig;
59
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
60
61
    /**
62
     * Get the view renderer
63
     *
64
     * @return \Jaxon\Utils\View\Renderer
65
     */
66
    public function view()
67
    {
68
        return jaxon()->view();
69
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
70
71
    /**
72
     * Get the path to the config file
73
     *
74
     * @return string
75
     */
76
    abstract public static function getConfigFile();
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
77
78
    /**
79
     * Include the getReadyScript() in the generated code.
80
     *
81
     * @return void
82
     */
83
    public function ready()
84
    {
85
        $this->bReadyEnabled = true;
86
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
87
88
    /**
89
     * @inheritDoc
90
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
91
    public function readyEnabled()
92
    {
93
        return $this->bReadyEnabled;
94
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
95
96
    /**
97
     * @inheritDoc
98
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
99
    public final function readyInlined()
100
    {
101
        // For packages, the getReadyScript() is never exported to external files.
102
        return true;
103
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
104
105
    /**
106
     * @inheritDoc
107
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
108
    public final function getHash()
109
    {
110
        // Packages do not generate hash on their own. So we make this method final.
111
        return '';
112
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
113
114
    /**
115
     * @inheritDoc
116
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
117
    public function getCss()
118
    {
119
        return '';
120
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
121
122
    /**
123
     * @inheritDoc
124
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
125
    public function getJs()
126
    {
127
        return '';
128
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
129
130
    /**
131
     * @inheritDoc
132
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
133
    public function getScript()
134
    {
135
        return '';
136
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
137
138
    /**
139
     * Get the HTML code of the package home page
140
     *
141
     * @return string
142
     */
143
    abstract public function getHtml();
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
144
}
145