Issues (82)

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/Workflow/Result.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
3
namespace Maketok\DataMigration\Workflow;
4
5
class Result implements ResultInterface
6
{
7
    /**
8
     * @var array
9
     */
10
    protected $participants;
11
    /**
12
     * @var \DateTime
13
     */
14
    protected $startTime;
15
    /**
16
     * @var \DateTime
17
     */
18
    protected $endTime;
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 3
    public function getTotalRowsProcessed()
24
    {
25 3
        $rows = 0;
26 3
        foreach ($this->participants as $key => $data) {
27 3
            $rows += $this->getActionProcessed($key);
28 3
        }
29 3
        return $rows;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 3
    public function getAllErrors()
36
    {
37 3
        $errors = [];
38 3
        foreach ($this->participants as $key => $data) {
39 3
            $errors = array_merge($errors, $this->getActionErrors($key));
40 3
        }
41 3
        return $errors;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 1
    public function getAllExceptions()
48
    {
49 1
        $exceptions = [];
50 1
        foreach ($this->participants as $key => $data) {
51 1
            $exceptions = array_merge($exceptions, $this->getActionExceptions($key));
52 1
        }
53 1
        return $exceptions;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59 1
    public function getParticipants()
60
    {
61 1
        return $this->participants;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 4
    public function getActionProcessed($code)
68
    {
69 4
        return isset($this->participants[$code]['rows_processed']) ?
70 4
            $this->participants[$code]['rows_processed'] : 0;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 4
    public function getActionErrors($code)
77
    {
78 4
        return isset($this->participants[$code]['errors']) ?
79 4
            $this->participants[$code]['errors'] : [];
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85 2
    public function getActionExceptions($code)
86
    {
87 2
        return isset($this->participants[$code]['exceptions']) ?
88 2
            $this->participants[$code]['exceptions'] : [];
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94 4
    public function addActionError($code, $message)
95
    {
96 4
        if (isset($this->participants[$code]['errors'])) {
97 1
            $this->participants[$code]['errors'][] = $message;
98 4
        } elseif (isset($this->participants[$code])) {
99 3
            $this->participants[$code]['errors'] = [$message];
100 3
        } else {
101 2
            $this->participants[$code] = ['errors' => [$message]];
102
        }
103 4
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108 2
    public function addActionException($code, \Exception $ex)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $ex. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
109
    {
110 2
        if (isset($this->participants[$code]['exceptions'])) {
111 1
            $this->participants[$code]['exceptions'][] = $ex;
112 2
        } elseif (isset($this->participants[$code])) {
113 1
            $this->participants[$code]['exceptions'] = [$ex];
114 1
        } else {
115 1
            $this->participants[$code] = ['exceptions' => [$ex]];
116
        }
117 2
    }
118
119
    /**
120
     * {@inheritdoc}
121
     */
122 12
    public function incrementActionProcessed($code, $value = 1)
123
    {
124 12
        if (isset($this->participants[$code]['rows_processed'])) {
125 9
            $this->participants[$code]['rows_processed'] += $value;
126 12
        } elseif (isset($this->participants[$code])) {
127 10
            $this->participants[$code]['rows_processed'] = $value;
128 10
        } else {
129 3
            $this->participants[$code] = ['rows_processed' => $value];
130
        }
131 12
    }
132
133
    /**
134
     * {@inheritdoc}
135
     */
136 1
    public function getStartTime()
137
    {
138 1
        return $this->startTime;
139
    }
140
141
    /**
142
     * {@inheritdoc}
143
     */
144 1
    public function getEndTime()
145
    {
146 1
        return $this->endTime;
147
    }
148
149
    /**
150
     * {@inheritdoc}
151
     */
152 1
    public function getActionStartTime($code)
153
    {
154 1
        return isset($this->participants[$code]['start_time']) ?
155 1
            $this->participants[$code]['start_time'] : null;
156
    }
157
158
    /**
159
     * {@inheritdoc}
160
     */
161 1
    public function getActionEndTime($code)
162
    {
163 1
        return isset($this->participants[$code]['end_time']) ?
164 1
            $this->participants[$code]['end_time'] : null;
165
    }
166
167
    /**
168
     * {@inheritdoc}
169
     */
170 10
    public function setStartTime(\DateTime $time)
171
    {
172 10
        $this->startTime = $time;
173 10
    }
174
175
    /**
176
     * {@inheritdoc}
177
     */
178 10
    public function setEndTime(\DateTime $time)
179
    {
180 10
        $this->endTime = $time;
181 10
    }
182
183
    /**
184
     * {@inheritdoc}
185
     */
186 13
    public function setActionStartTime($code, \DateTime $time)
187
    {
188 13
        if (isset($this->participants[$code])) {
189 2
            $this->participants[$code]['start_time'] = $time;
190 2
        } else {
191 13
            $this->participants[$code] = ['start_time' => $time];
192
        }
193 13
    }
194
195
    /**
196
     * {@inheritdoc}
197
     */
198 13
    public function setActionEndTime($code, \DateTime $time)
199
    {
200 13
        if (isset($this->participants[$code])) {
201 12
            $this->participants[$code]['end_time'] = $time;
202 12
        } else {
203 1
            $this->participants[$code] = ['end_time' => $time];
204
        }
205 13
    }
206
207
    /**
208
     * {@inheritdoc}
209
     */
210 1
    public function getTotalRowsThrough()
211
    {
212 1
        $rows = [];
213 1
        foreach ($this->participants as $key => $data) {
214 1
            $rows[] = $this->getActionProcessed($key);
215 1
        }
216 1
        return min($rows);
217
    }
218
}
219