Issues (18)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Traits/HasLabelTrait.php (1 issue)

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
namespace Sirius\Input\Traits;
3
4
use Sirius\Input\Specs;
5
use Sirius\Input\AttributesContainer;
6
7
trait HasLabelTrait
8
{
9
10 2
    protected function ensureLabelAttributes()
11
    {
12 2
        if (!isset($this[Specs::LABEL_ATTRIBUTES])) {
13 2
            $this[Specs::LABEL_ATTRIBUTES] = new AttributesContainer();
14 2
        }
15 2
    }
16
17
    /**
18
     * Retrieves the label's text
19
     *
20
     * @return string null
21
     */
22 6
    public function getLabel()
23
    {
24 6
        return isset($this[Specs::LABEL]) ? $this[Specs::LABEL] : null;
25
    }
26
27
    /**
28
     * Sets the label's text
29
     *
30
     * @param string $label
31
     *
32
     * @return self
33
     */
34 2
    public function setLabel($label)
35
    {
36 2
        $this[Specs::LABEL] = $label;
37
38 2
        return $this;
39
    }
40
41
    /**
42
     * Retrieve all of the label's attributes
43
     *
44
     * @return mixed
45
     */
46 1
    public function getLabelAttributes()
47
    {
48 1
        $this->ensureLabelAttributes();
49
50 1
        return $this[Specs::LABEL_ATTRIBUTES]->getAll();
51
    }
52
53
    /**
54
     * Sets multiple attributes for the label
55
     *
56
     * @param array $attrs
57
     *
58
     * @return HasLabelTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type HasLabelTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
59
     */
60 1
    public function setLabelAttributes($attrs)
61
    {
62 1
        $this->ensureLabelAttributes();
63 1
        $this[Specs::LABEL_ATTRIBUTES]->set($attrs);
64
65 1
        return $this;
66
    }
67
68
    /**
69
     * Retrieve an attribute from the label
70
     *
71
     * @param string $attr
72
     *
73
     * @return mixed
74
     */
75 2
    public function getLabelAttribute($attr)
76
    {
77 2
        $this->ensureLabelAttributes();
78
79 2
        return $this[Specs::LABEL_ATTRIBUTES]->get($attr);
80
    }
81
82
    /**
83
     * Set/Unset a label attribute
84
     *
85
     * @param string $attr
86
     * @param mixed|null $value
87
     *
88
     * @return self
89
     */
90 1
    public function setLabelAttribute($attr, $value = null)
91
    {
92 1
        $this->ensureLabelAttributes();
93 1
        $this[Specs::LABEL_ATTRIBUTES]->set($attr, $value);
94
95 1
        return $this;
96
    }
97
98
    /**
99
     * Adds a CSS class to the label's "class" attribute
100
     *
101
     * @param string $class
102
     *
103
     * @return self
104
     */
105 1
    public function addLabelClass($class)
106
    {
107 1
        $this->ensureLabelAttributes();
108 1
        $this[Specs::LABEL_ATTRIBUTES]->addClass($class);
109
110 1
        return $this;
111
    }
112
113
    /**
114
     * Removes a CSS class from the label's "class" attribute
115
     *
116
     * @param string $class
117
     *
118
     * @return self
119
     */
120 1
    public function removeLabelClass($class)
121
    {
122 1
        $this->ensureLabelAttributes();
123 1
        $this[Specs::LABEL_ATTRIBUTES]->removeClass($class);
124
125 1
        return $this;
126
    }
127
128
    /**
129
     * Toggles a CSS class to the label's "class" attribute
130
     *
131
     * @param
132
     *            $class
133
     *
134
     * @return self
135
     */
136 1
    public function toggleLabelClass($class)
137
    {
138 1
        $this->ensureLabelAttributes();
139 1
        $this[Specs::LABEL_ATTRIBUTES]->toggleClass($class);
140
141 1
        return $this;
142
    }
143
144
    /**
145
     * Checks if the label has a CSS class on the "class" attribute
146
     *
147
     * @param
148
     *            $class
149
     *
150
     * @return bool
151
     */
152 1
    public function hasLabelClass($class)
153
    {
154 1
        $this->ensureLabelAttributes();
155
156 1
        return $this[Specs::LABEL_ATTRIBUTES]->hasClass($class);
157
    }
158
}
159