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.

ModuleOptions::setJqueryValidateRulePlugins()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * Defines all possible options for the module
4
 *
5
 * @category  StrokerForm
6
 * @package   StrokerForm\Options
7
 * @copyright 2012 Bram Gerritsen
8
 * @version   SVN: $Id$
9
 */
10
11
namespace StrokerForm\Options;
12
13
use InvalidArgumentException;
14
use Zend\ServiceManager\Config;
15
use Zend\ServiceManager\ConfigInterface;
16
use Zend\Stdlib\AbstractOptions;
17
18
class ModuleOptions extends AbstractOptions
19
{
20
    /**
21
     * @var array
22
     */
23
    private $activeRenderers = [];
24
25
    /**
26
     * @var array
27
     */
28
    private $forms = [];
29
30
    /**
31
     * @var array
32
     */
33
    private $rendererOptions = [];
34
35
    /** @var array */
36
    private $jqueryValidateRulePlugins = [];
37
38
    /**
39
     * @return array
40
     */
41
    public function getActiveRenderers()
42
    {
43
        return $this->activeRenderers;
44
    }
45
46
    /**
47
     * @param array
48
     */
49
    public function setActiveRenderers(array $activeRenderers)
50
    {
51
        $this->activeRenderers = $activeRenderers;
52
    }
53
54
    /**
55
     * @return ConfigInterface
56
     * @throws InvalidArgumentException
57
     */
58
    public function getForms()
59
    {
60
        if (is_array($this->forms)) {
61
            $this->forms = new Config($this->forms);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Zend\ServiceManager\Config($this->forms) of type object<Zend\ServiceManager\Config> is incompatible with the declared type array of property $forms.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
62
        }
63
64
        if (!$this->forms instanceof ConfigInterface) {
65
            throw new InvalidArgumentException('Plugins argument must be an array or instanceof Zend\ServiceManager\ConfigInterface');
66
        }
67
68
        return $this->forms;
69
    }
70
71
    /**
72
     * @param array $forms
73
     */
74
    public function setForms($forms)
75
    {
76
        $this->forms = $forms;
77
    }
78
79
    /**
80
     * @param array $options
81
     */
82
    public function setRendererOptions(array $options)
83
    {
84
        $this->rendererOptions = [];
85
        foreach ($options as $renderer => $rendererOptions) {
86
            $this->addRendererOptions($renderer, $rendererOptions);
87
        }
88
    }
89
90
    /**
91
     * @param  string $renderer
92
     * @param  array  $options
93
     *
94
     * @throws \InvalidArgumentException
95
     */
96
    public function addRendererOptions($renderer, $options)
97
    {
98
        if (!is_array($options)) {
99
            throw new \InvalidArgumentException('No options given for renderer ' . $renderer);
100
        }
101
        if (!isset($options['options_class'])) {
102
            throw new \InvalidArgumentException('No options_class configured for renderer ' . $renderer);
103
        }
104
105
        $optionsClass = $options['options_class'];
106
        unset($options['options_class']);
107
        $options = new $optionsClass($options);
108
109
        $this->rendererOptions[$renderer] = $options;
110
    }
111
112
    /**
113
     * @param string $renderer
114
     *
115
     * @return null|AbstractOptions
116
     * @throws \InvalidArgumentException
117
     */
118
    public function getRendererOptions($renderer)
119
    {
120
        return $this->rendererOptions[$renderer];
121
    }
122
123
    /**
124
     * @return array
125
     */
126
    public function getJqueryValidateRulePlugins()
127
    {
128
        return $this->jqueryValidateRulePlugins;
129
    }
130
131
    /**
132
     * @param array $jqueryValidateRulePlugins
133
     */
134
    public function setJqueryValidateRulePlugins(array $jqueryValidateRulePlugins)
135
    {
136
        $this->jqueryValidateRulePlugins = $jqueryValidateRulePlugins;
137
    }
138
}
139