1 | <?php |
||
16 | class JsValidatorFactory |
||
17 | { |
||
18 | /** |
||
19 | * The application instance. |
||
20 | * |
||
21 | * @var \Illuminate\Contracts\Container\Container |
||
22 | */ |
||
23 | protected $app; |
||
24 | |||
25 | /** |
||
26 | * Configuration options. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $options; |
||
31 | |||
32 | /** |
||
33 | * Create a new Validator factory instance. |
||
34 | * |
||
35 | * @param \Illuminate\Contracts\Container\Container $app |
||
36 | * @param array $options |
||
37 | */ |
||
38 | public function __construct($app, array $options = []) |
||
43 | |||
44 | protected function setOptions($options) { |
||
49 | |||
50 | |||
51 | /** |
||
52 | * Creates JsValidator instance based on rules and message arrays. |
||
53 | * |
||
54 | * @param array $rules |
||
55 | * @param array $messages |
||
56 | * @param array $customAttributes |
||
57 | * @param null|string $selector |
||
58 | * |
||
59 | * @return \Proengsoft\JsValidation\Manager |
||
60 | */ |
||
61 | public function make(array $rules, array $messages = array(), array $customAttributes = array(), $selector = null) |
||
67 | |||
68 | /** |
||
69 | * Get the validator instance for the request. |
||
70 | * |
||
71 | * @return \Illuminate\Validation\Validator |
||
72 | */ |
||
73 | protected function getValidatorInstance(array $rules, array $messages = array(), array $customAttributes = array()) |
||
82 | |||
83 | /** |
||
84 | * Creates JsValidator instance based on FormRequest. |
||
85 | * |
||
86 | * @param $formRequest |
||
87 | * @param null $selector |
||
88 | * |
||
89 | * @return JavascriptValidator |
||
90 | * |
||
91 | * @throws FormRequestArgumentException |
||
92 | */ |
||
93 | public function formRequest($formRequest, $selector = null) |
||
109 | |||
110 | /** |
||
111 | * Creates and initializes an Form Request instance. |
||
112 | * |
||
113 | * @param string $class |
||
114 | * |
||
115 | * @return FormRequest |
||
116 | */ |
||
117 | protected function createFormRequest($class) |
||
132 | |||
133 | /** |
||
134 | * Creates JsValidator instance based on Validator. |
||
135 | * |
||
136 | * @param \Illuminate\Validation\Validator $validator |
||
137 | * @param string|null $selector |
||
138 | * |
||
139 | * @return JavascriptValidator |
||
140 | */ |
||
141 | public function validator(Validator $validator, $selector = null) |
||
145 | |||
146 | /** |
||
147 | * Creates JsValidator instance based on Validator. |
||
148 | * |
||
149 | * @param \Illuminate\Validation\Validator $validator |
||
150 | * @param string|null $selector |
||
151 | * |
||
152 | * @return JavascriptValidator |
||
153 | */ |
||
154 | protected function jsValidator(Validator $validator, $selector = null) |
||
170 | |||
171 | /** |
||
172 | * Get and encrypt token from session store. |
||
173 | * |
||
174 | * @return null|string |
||
175 | */ |
||
176 | protected function getSessionToken() |
||
189 | |||
190 | } |
||
191 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: