Issues (33)

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/DogecoindResponse.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 Bouhnosaure\Dogecoin;
4
5
use ArrayAccess;
6
use Countable;
7
use JsonSerializable;
8
use Serializable;
9
10
use Psr\Http\Message\ResponseInterface;
11
12
class DogecoindResponse implements ResponseInterface, ArrayAccess, Countable, Serializable, JsonSerializable
13
{
14
    use MessageTrait, ResponseArrayTrait, ReadOnlyArrayTrait, SerializableContainerTrait;
15
16
    /**
17
     * Response instance.
18
     *
19
     * @var \Psr\Http\Message\ResponseInterface
20
     */
21
    protected $response;
22
23
    /**
24
     * Data container.
25
     *
26
     * @var array
27
     */
28
    protected $container = [];
29
30
    /**
31
     * Current key.
32
     *
33
     * @var string
34
     */
35
    protected $current;
36
37
    /**
38
     * Constructs new json response.
39
     *
40
     * @param \Psr\Http\Message\ResponseInterface $response
41
     *
42
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
43
     */
44 138
    public function __construct(ResponseInterface $response)
45
    {
46 138
        $this->response = $response;
47 138
        $this->container = json_decode($response->getBody(), true);
0 ignored issues
show
Documentation Bug introduced by
It seems like json_decode($response->getBody(), true) of type * is incompatible with the declared type array of property $container.

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...
48 138
    }
49
50
    /**
51
     * Gets raw response.
52
     *
53
     * @return \Psr\Http\Message\ResponseInterface
54
     */
55 3
    public function response()
56
    {
57 3
        return $this->response;
58
    }
59
60
    /**
61
     * Sets response.
62
     *
63
     * @param \Psr\Http\Message\ResponseInterface $response
64
     *
65
     * @return static
66
     */
67 102
    public function setResponse(ResponseInterface $response)
68
    {
69 102
        $this->response = $response;
70
71 102
        return $this;
72
    }
73
74
    /**
75
     * Checks if response has error.
76
     *
77
     * @return bool
78
     */
79 45
    public function hasError()
80
    {
81 45
        return isset($this->container['error']);
82
    }
83
84
    /**
85
     * Gets error object.
86
     *
87
     * @return object|null
88
     */
89 24
    public function error()
90
    {
91 24
        if ($this->hasError()) {
92 21
            return $this->container['error'];
93
        }
94 3
    }
95
96
    /**
97
     * Checks if response has result.
98
     *
99
     * @return bool
100
     */
101 66
    public function hasResult()
102
    {
103 66
        return isset($this->container['result']);
104
    }
105
106
    /**
107
     * Gets result array.
108
     *
109
     * @return array|null
110
     */
111 63
    public function result()
112
    {
113 63
        if ($this->hasResult()) {
114 60
            return $this->container['result'];
115
        }
116 3
    }
117
118
    /**
119
     * Get response status code.
120
     *
121
     * @return int
122
     */
123 42
    public function getStatusCode()
124
    {
125 42
        return $this->response->getStatusCode();
126
    }
127
128
    /**
129
     * Return an instance with the specified status code and, optionally, reason phrase.
130
     *
131
     * @param int $code
132
     * @param string $reasonPhrase
133
     *
134
     * @return static
135
     */
136 3
    public function withStatus($code, $reasonPhrase = '')
137
    {
138 3
        $new = clone $this;
139
140 3
        return $new->setResponse(
141 3
            $this->response->withStatus($code, $reasonPhrase)
142 1
        );
143
    }
144
145
    /**
146
     * Gets the response reason phrase associated with the status code.
147
     *
148
     * @return string
149
     */
150 18
    public function getReasonPhrase()
151
    {
152 18
        return $this->response->getReasonPhrase();
153
    }
154
155
    /**
156
     * Creates new json response from response interface object.
157
     *
158
     * @param \Psr\Http\Message\ResponseInterface $response
159
     *
160
     * @return \Bouhnosaure\Dogecoin\DogecoindResponse
161
     */
162 138
    public static function createFrom(ResponseInterface $response)
163
    {
164 138
        return new self($response);
165
    }
166
}
167