Issues (10)

Security Analysis    not enabled

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/Response/BatchStatusResponse/Details.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 declare(strict_types=1);
2
namespace Loevgaard\Linkmobility\Response\BatchStatusResponse;
3
4
use Assert\Assert;
5
6
class Details
7
{
8
    /**
9
     * The batch is ready for processing. The batch will be processed shortly after sendtime has passed.
10
     */
11
    const STATE_QUEUED = 'QUEUED';
12
13
    /**
14
     * The batch is currently processing. Messages are being sent, and the "buffered",
15
     * "received" and "rejected" numbers will be updated as it is processed.
16
     */
17
    const STATE_RUNNING = 'RUNNING';
18
19
    /**
20
     * The batch has finished processing. Up to 48 hours after this the messages will still be sent out for delivery.
21
     */
22
    const STATE_DONE = 'DONE';
23
24
    /**
25
     * @var \DateTimeImmutable
26
     */
27
    protected $sendTime;
28
29
    /**
30
     * @var int
31
     */
32
    protected $batchId;
33
34
    /**
35
     * @var string
36
     */
37
    protected $state;
38
39 1
    public function __construct(array $data)
40
    {
41 1
        Assert::that($data)
42 1
            ->keyExists('sendtime')
43 1
            ->keyExists('batchid')
44 1
            ->keyExists('state')
45
        ;
46
47 1
        Assert::that($data['state'])->choice(self::getStates());
48
49 1
        $this->sendTime = \DateTimeImmutable::createFromFormat('d-m-Y H:i:s', $data['sendtime']);
50 1
        Assert::that($this->sendTime)->isInstanceOf(\DateTimeImmutable::class, '`sendtime` does not have the correct format. Value given: '.$data['sendtime']);
51
52 1
        $this->batchId = (int)$data['batchid'];
53 1
        $this->state = $data['state'];
54 1
    }
55
56 1 View Code Duplication
    public static function getStates() : array
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...
57
    {
58
        return [
59 1
            self::STATE_DONE => self::STATE_DONE,
60 1
            self::STATE_QUEUED => self::STATE_QUEUED,
61 1
            self::STATE_RUNNING => self::STATE_RUNNING,
62
        ];
63
    }
64
65 1
    public function isState(string $state) : bool
66
    {
67 1
        return $this->state === $state;
68
    }
69
70
    /**
71
     * @return bool
72
     */
73 1
    public function isDone() : bool
74
    {
75 1
        return $this->isState(self::STATE_DONE);
76
    }
77
78
    /**
79
     * @return bool
80
     */
81 1
    public function isQueued() : bool
82
    {
83 1
        return $this->isState(self::STATE_QUEUED);
84
    }
85
86
    /**
87
     * @return bool
88
     */
89 1
    public function isRunning() : bool
90
    {
91 1
        return $this->isState(self::STATE_RUNNING);
92
    }
93
94
    /**
95
     * @return \DateTimeImmutable
96
     */
97 1
    public function getSendTime(): \DateTimeImmutable
98
    {
99 1
        return $this->sendTime;
100
    }
101
102
    /**
103
     * @return int
104
     */
105 1
    public function getBatchId(): int
106
    {
107 1
        return $this->batchId;
108
    }
109
110
    /**
111
     * @return string
112
     */
113 1
    public function getState(): string
114
    {
115 1
        return $this->state;
116
    }
117
}
118