Issues (3)

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/BurndownGenerator.php (1 issue)

Labels
Severity

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 TrelloBurndown;
4
5
use Trello\Model\Board;
6
use Trello\Model\Cardlist;
7
use TrelloBurndown\Client\TrelloClient;
8
use TrelloBurndown\Exception\TrelloItemNotFoundException;
9
use TrelloBurndown\Manager\ActionManager;
10
use TrelloBurndown\Manager\BoardManager;
11
use TrelloBurndown\Manager\ListManager;
12
use TrelloBurndown\Manager\StoryPointManager;
13
use TrelloBurndown\Model\Sprint;
14
use TrelloBurndown\Model\StoryPointBurndown;
15
16
/**
17
 * Class BurndownGenerator.
18
 */
19
class BurndownGenerator
20
{
21
    /**
22
     * @var TrelloClient
23
     */
24
    private $client;
25
26
    /**
27
     * @var BoardManager
28
     */
29
    private $boardManager;
30
31
    /**
32
     * @var ListManager
33
     */
34
    private $listManager;
35
36
    /**
37
     * @var ActionManager
38
     */
39
    private $actionManager;
40
41
    /**
42
     * @var StoryPointManager
43
     */
44
    private $storyPointManager;
45
46
    /**
47
     * @var array
48
     */
49
    private $boards = [];
50
51
    /**
52
     * @var array
53
     */
54
    private $todoLists = [];
55
56
    /**
57
     * @var array
58
     */
59
    private $wipLists = [];
60
61
    /**
62
     * @var array
63
     */
64
    private $doneLists = [];
65
66
    /**
67
     * BurndownGenerator constructor.
68
     *
69
     * @param TrelloClient $client
70
     */
71 12
    public function __construct(TrelloClient $client)
72
    {
73 12
        $this->client = $client;
74 12
        $this->boardManager = new BoardManager($this->client);
75 12
        $this->listManager = new ListManager($this->client);
76 12
        $this->actionManager = new ActionManager($this->client);
77 12
        $this->storyPointManager = new StoryPointManager($this->client, $this->actionManager);
78 12
    }
79
80
    /**
81
     * @param string $boardName
82
     *
83
     * @throws \Exception
84
     */
85 10
    public function addBoard(String $boardName)
86
    {
87 10
        $board = $this->boardManager->getBoard($boardName);
88 10
        if ($board ==  null || !$board instanceof Board) {
89 1
            throw new TrelloItemNotFoundException('board', $boardName);
90
        }
91 9
        $this->boards[] = $board;
92 9
    }
93
94
    /**
95
     * @param array  $lists
96
     * @param string $listName
97
     * @param $boardName
98
     *
99
     * @throws \Exception
100
     */
101 9
    private function addList(array &$lists, String $listName, $boardName)
102
    {
103 9
        if ($boardName !== null) {
104 5
            $board = $this->boardManager->getBoard($boardName);
105
106 5
            if ($board ==  null || !$board instanceof Board) {
107 1
                throw new TrelloItemNotFoundException('board', $boardName);
108
            }
109
110 4
            $list = $this->listManager->getListFromBoard($listName, $board);
111
112 4
            if ($list == null || !$list instanceof Cardlist) {
113
                throw new TrelloItemNotFoundException('list', $listName);
114
            }
115
116 4
            $lists[] = $list;
117
        } else {
118 4
            $list = $this->listManager->getList($listName, $this->boards);
119 4
            if ($list == null || !$list instanceof Cardlist) {
120 1
                throw new TrelloItemNotFoundException('list', $listName);
121
            }
122 3
            $lists[] = $list;
123
        }
124 7
    }
125
126
    /**
127
     * @param string      $listName
128
     * @param string|null $boardName
129
     */
130 3
    public function addTodoList(String $listName, String $boardName = null)
131
    {
132 3
        $this->addList($this->todoLists, $listName, $boardName);
133 3
    }
134
135
    /**
136
     * @param string      $listName
137
     * @param string|null $boardName
138
     */
139 5
    public function addWipList(String $listName, String $boardName = null)
140
    {
141 5
        $this->addList($this->wipLists, $listName, $boardName);
142 3
    }
143
144
    /**
145
     * @param string      $listName
146
     * @param string|null $boardName
147
     */
148 3
    public function addDoneList(String $listName, String $boardName = null)
149
    {
150 3
        $this->addList($this->doneLists, $listName, $boardName);
151 3
    }
152
153
    /**
154
     * @return array
155
     */
156 5
    public function getBoards()
157
    {
158 5
        return $this->boards;
159
    }
160
161
    /**
162
     * @return array
163
     */
164 2
    public function getTodoLists()
165
    {
166 2
        return $this->todoLists;
167
    }
168
169
    /**
170
     * @return array
171
     */
172 2
    public function getWipLists()
173
    {
174 2
        return $this->wipLists;
175
    }
176
177
    /**
178
     * @return array
179
     */
180 2
    public function getDoneLists()
181
    {
182 2
        return $this->doneLists;
183
    }
184
185
    /**
186
     * @param Sprint $sprint
187
     *
188
     * @return StoryPointBurndown
189
     */
190 1
    public function getStoryPointBurndown(Sprint $sprint)
191
    {
192 1
        $doneSP = $this->storyPointManager->getDoneStoryPoints($this->todoLists, $this->wipLists, $this->doneLists, $sprint);
193 1
        $total = $this->storyPointManager->getTotalSprintStoryPoints($this->todoLists, $this->wipLists, $this->doneLists, $sprint);
194 1
        $average = $this->storyPointManager->getAverageStoryPointsPerDay($total, $sprint);
195
196 1
        $burndown = new StoryPointBurndown($sprint, $total, $doneSP, $average);
0 ignored issues
show
It seems like $doneSP defined by $this->storyPointManager...is->doneLists, $sprint) on line 192 can also be of type null; however, TrelloBurndown\Model\Sto...Burndown::__construct() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
197
198 1
        return $burndown;
199
    }
200
}
201