Passed
Push — master ( b8ef91...1702ae )
by Thierry
02:46
created

src/Plugin/Plugin.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Plugin.php - Plugin interface
5
 *
6
 * Generic interface for all Jaxon plugins.
7
 *
8
 * @package jaxon-core
9
 * @author Jared White
10
 * @author J. Max Wilson
11
 * @author Joseph Woolley
12
 * @author Steffen Konerow
13
 * @author Thierry Feuzeu <[email protected]>
14
 * @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
15
 * @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
16
 * @copyright 2016 Thierry Feuzeu <[email protected]>
17
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
18
 * @link https://github.com/jaxon-php/jaxon-core
19
 */
20
21
namespace Jaxon\Plugin;
22
23
abstract class Plugin implements Code\Contracts\Generator
24
{
25
    use \Jaxon\Features\Config;
26
27
    /**
28
     * Check if the assets of this plugin shall be included in Jaxon generated code.
29
     *
30
     * @return boolean
31
     */
32
    protected function includeAssets()
33
    {
34
        $sPluginOptionName = 'assets.include.' . $this->getName();
35
        if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName))
36
        {
37
            return false;
38
        }
39
        if($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all'))
40
        {
41
            return false;
42
        }
43
        return true;
44
    }
45
46
    /**
47
     * Get a unique name to identify the plugin.
48
     *
49
     * @return string
50
     */
51
    abstract public function getName();
52
53
    /**
54
     * @inheritDoc
55
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
56
    public final function readyEnabled()
57
    {
58
        // For plugins, the getReadyScript() is always included in the generated code.
59
        return true;
60
    }
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
61
62
    /**
63
     * @inheritDoc
64
     */
65
    public function getHash()
66
    {
67
        return '';
68
    }
69
70
    /**
71
     * @inheritDoc
72
     */
73
    public function getCss()
74
    {
75
        return '';
76
    }
77
78
    /**
79
     * @inheritDoc
80
     */
81
    public function getJs()
82
    {
83
        return '';
84
    }
85
86
    /**
87
     * @inheritDoc
88
     */
89
    public function getScript()
90
    {
91
        return '';
92
    }
93
94
    /**
95
     * @inheritDoc
96
     */
97
    public function getReadyScript()
98
    {
99
        return '';
100
    }
101
}
102