This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Amarkal\UI; |
||
4 | |||
5 | /** |
||
6 | * Implements a Toggle UI component. |
||
7 | */ |
||
8 | class Component_toggle |
||
9 | extends AbstractComponent |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
10 | implements ValueComponentInterface, |
||
0 ignored issues
–
show
|
|||
11 | FilterableComponentInterface, |
||
0 ignored issues
–
show
|
|||
12 | DisableableComponentInterface |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | public $component_type = 'toggle'; |
||
15 | |||
16 | protected function on_created() |
||
17 | { |
||
18 | if($this->multi && !\is_array($this->default) |
||
0 ignored issues
–
show
The property
multi does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
default does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
19 | || !$this->multi && \is_array($this->default)) |
||
0 ignored issues
–
show
The property
multi does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
default does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
20 | { |
||
21 | throw new \RuntimeException("The default value must be an array if multi is set to true, and must be a string otherwise."); |
||
22 | } |
||
23 | } |
||
24 | |||
25 | public function default_model() |
||
26 | { |
||
27 | return array( |
||
28 | 'name' => '', |
||
29 | 'id' => '', |
||
30 | 'disabled' => false, |
||
31 | 'required' => false, |
||
32 | 'readonly' => false, |
||
33 | 'multi' => false, |
||
34 | 'data' => array(), |
||
35 | 'default' => array(), |
||
36 | 'filter' => array( $this, 'filter' ), |
||
37 | 'show' => null |
||
38 | ); |
||
39 | } |
||
40 | |||
41 | public function required_arguments() |
||
42 | { |
||
43 | return array('name','data'); |
||
44 | } |
||
45 | |||
46 | public function get_template_path() |
||
47 | { |
||
48 | return __DIR__.'/template.phtml'; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * This filter is needed when the form is submitted without $.amarkalUIForm, |
||
53 | * since the value of the toggle needs to be splitted into an array (when 'multi' is set to true). |
||
54 | * When using $.amarkalUIForm to submit the form, the component's getValue/setValue will |
||
55 | * handle this. |
||
56 | * |
||
57 | * @param [string|array] $v |
||
0 ignored issues
–
show
The doc-type
[string|array] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
58 | * @return [string|array] |
||
0 ignored issues
–
show
The doc-type
[string|array] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
59 | */ |
||
60 | public function filter($v) |
||
61 | { |
||
62 | if($this->multi && !\is_array($v)) |
||
0 ignored issues
–
show
The property
multi does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
63 | { |
||
64 | return \explode(',', $v); |
||
65 | } |
||
66 | return $v; |
||
67 | } |
||
68 | |||
69 | protected function is_selected( $value ) |
||
70 | { |
||
71 | if($this->multi) |
||
0 ignored issues
–
show
The property
multi does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
72 | { |
||
73 | return \in_array($value, $this->value); |
||
0 ignored issues
–
show
The property
value does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
74 | } |
||
75 | return $value === $this->value; |
||
0 ignored issues
–
show
The property
value does not exist on object<Amarkal\UI\Component_toggle> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
76 | } |
||
77 | } |