Issues (10)

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/CardAttribute.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
namespace NotificationChannels\HipChat;
4
5
class CardAttribute
6
{
7
    /**
8
     * @var string
9
     */
10
    public $value;
11
12
    /**
13
     * @var string
14
     */
15
    public $label;
16
17
    /**
18
     * @var string
19
     */
20
    public $url;
21
22
    /**
23
     * @var string
24
     */
25
    public $style;
26
27
    /**
28
     * @var string
29
     */
30
    public $icon;
31
32
    /**
33
     * @var string
34
     */
35
    public $icon2;
36
37
    /**
38
     * Sets the textual value of the attribute.
39
     *
40
     * @param string $value
41
     * @return $this
42
     */
43 9
    public function value($value)
44
    {
45 9
        $this->value = trim($value);
46
47 9
        return $this;
48
    }
49
50
    /**
51
     * Sets the label of the attribute.
52
     *
53
     * @param string $label
54
     * @return $this
55
     */
56 9
    public function label($label)
57
    {
58 9
        $this->label = trim($label);
59
60 9
        return $this;
61
    }
62
63
    /**
64
     * @param string $url
65
     * @return $this
66
     */
67 2
    public function url($url)
68
    {
69 2
        $this->url = trim($url);
70
71 2
        return $this;
72
    }
73
74
    /**
75
     * Sets the style for the attribute.
76
     *
77
     * @param string $style
78
     * @return $this
79
     */
80 2
    public function style($style)
81
    {
82 2
        $this->style = trim($style);
83
84 2
        return $this;
85
    }
86
87
    /**
88
     * Sets the icon for the attribute.
89
     *
90
     * @param string $icon
91
     * @param string|null $icon2
92
     * @return $this
93
     */
94 3 View Code Duplication
    public function icon($icon, $icon2 = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
95
    {
96 3
        $this->icon = trim($icon);
97
98 3
        if (! str_empty($icon2)) {
99 2
            $this->icon2 = trim($icon2);
100
        }
101
102 3
        return $this;
103
    }
104
105
    /**
106
     * Create a new instance of the attribute.
107
     *
108
     * @param string $label
109
     * @param string $value
110
     */
111 9
    public function __construct($value = null, $label = null)
112
    {
113 9
        $this->value($value);
114 9
        $this->label($label);
115 9
    }
116
117
    /**
118
     * Create a new instance of the attribute.
119
     *
120
     * @param string $value
121
     * @param string $label
122
     * @return static
123
     */
124 7
    public static function create($value = null, $label = null)
125
    {
126 7
        return new static($value, $label);
127
    }
128
129 5
    public function toArray()
130
    {
131
        $attribute = [
132 5
            'value' => str_array_filter([
133 5
                'label' => $this->value,
134 5
                'url' => $this->url,
135 5
                'style' => $this->style,
136
            ]),
137
        ];
138
139 5 View Code Duplication
        if (! str_empty($this->icon)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
140 3
            $attribute['value']['icon'] = str_array_filter([
141 3
                'url' => $this->icon,
142 3
                'url@2x' => $this->icon2,
143
            ]);
144
        }
145
146 5
        if (! str_empty($this->label)) {
147 4
            $attribute['label'] = $this->label;
148
        }
149
150 5
        return $attribute;
151
    }
152
}
153