GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (56)

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/Converters/Grid/ASCIISyntax.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 Letournel\PathFinder\Converters\Grid;
4
5
use Letournel\PathFinder\Core\Node;
6
use Letournel\PathFinder\Core\NodeGrid;
7
use Letournel\PathFinder\Core\NodePath;
8
use Letournel\PathFinder\ConverterGrid;
9
10
class ASCIISyntax implements ConverterGrid
11
{
12
    const
13
        FREE = ' ',
14
        IN   = '>',
15
        OUT  = '<',
16
        STEP = '.',
17
        WALL = 'X';
18
    
19
    public function convertToGrid($syntax)
20
    {
21
        $matrix = $this->convertToMatrix($syntax);
22
        
23
        foreach($matrix as $x => $line)
24
        {
25
            foreach($line as $y => $char)
26
            {
27
                $matrix[$x][$y] = ($char !== self::WALL) ? 1 : 0;
28
            }
29
        }
30
        
31
        return new NodeGrid($matrix);
32
    }
33
    
34
    public function convertToMatrix($syntax)
35
    {
36
        $matrix = array_filter(explode("\n", $syntax));
37
        
38
        foreach($matrix as $key => $line)
39
        {
40
            $matrix[$key] = array_filter(str_split($line));
41
        }
42
        
43
        return $matrix;
44
    }
45
    
46
    public function convertToSyntax(NodeGrid $grid)
47
    {
48
        $syntax = '';
49
        
50
        $nodes = $grid->getNodes();
51
        foreach($nodes as $line)
52
        {
53
            foreach($line as $node)
54
            {
55
                $syntax .= ($node->isWalkable() ? self::FREE : self::WALL);
56
            }
57
            $syntax .= "\n";
58
        }
59
        
60
        return $syntax;
61
    }
62
    
63
    public function convertToSyntaxWithPath(NodeGrid $grid, NodePath $path)
64
    {
65
        $syntax = '';
66
        
67
        $nodes = $grid->getNodes();
68
        foreach($nodes as $line)
69
        {
70
            foreach($line as $node)
71
            {
72
                if(! $node->isWalkable())
73
                {
74
                    $syntax .= self::WALL;
75
                }
76
                elseif($node->toString() == $path->getStartNode()->toString())
77
                {
78
                    $syntax .= self::IN;
79
                }
80
                elseif($node->toString() == $path->getEndNode()->toString())
81
                {
82
                    $syntax .= self::OUT;
83
                }
84
                elseif($path->contains($node))
85
                {
86
                    $syntax .= self::STEP;
87
                }
88
                else
89
                {
90
                    $syntax .= self::FREE;
91
                }
92
            }
93
            $syntax .= "\n";
94
        }
95
        
96
        return $syntax;
97
    }
98
    
99
    public function findAndCreateNode($syntax, $charToFind)
100
    {
101
        $xCount = count($syntax);
102 View Code Duplication
        for($x = 0; $x < $xCount; $x++)
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...
103
        {
104
            $yCount = count($syntax[$x]);
105
            for($y = 0; $y < $yCount; $y++)
106
            {
107
                if($syntax[$x][$y] === $charToFind)
108
                {
109
                    return new Node($x, $y);
110
                }
111
            }
112
        }
113
    }
114
    
115
    public function findAndCreateNodes($syntax, $charToFind)
116
    {
117
        $nodes = array();
118
        $xCount = count($syntax);
119 View Code Duplication
        for($x = 0; $x < $xCount; $x++)
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...
120
        {
121
            $yCount = count($syntax[$x]);
122
            for($y = 0; $y < $yCount; $y++)
123
            {
124
                if($syntax[$x][$y] === $charToFind)
125
                {
126
                    $nodes[] = new Node($x, $y);
127
                }
128
            }
129
        }
130
        
131
        return $nodes;
132
    }
133
    
134
    public function generateNodePath($matrix)
135
    {
136
        $deltas = array(
137
            array(-1, -1), array(-1, +0), array(-1, +1),
138
            array(+0, -1),                array(+0, +1),
139
            array(+1, -1), array(+1, +0), array(+1, +1),
140
        );
141
        
142
        $node = $this->findAndCreateNode($matrix, self::IN);
143
        $target = $this->findAndCreateNode($matrix, self::OUT);
144
        $path = array($node);
145
        while($node->getId() !== $target->getId())
146
        {
147
            $newNode = null;
148
            foreach($deltas as $delta)
149
            {
150
                $x = $node->getX() + $delta[0];
151
                $y = $node->getY() + $delta[1];
152
                
153
                if(! array_key_exists($x, $matrix))
154
                {
155
                    continue;
156
                }
157
                
158
                if(! array_key_exists($y, $matrix[$x]))
159
                {
160
                    continue;
161
                }
162
                
163
                if($matrix[$x][$y] === self::STEP || $matrix[$x][$y] === self::OUT)
164
                {
165
                    $matrix[$x][$y] = self::FREE;
166
                    $newNode = new Node($x, $y);
167
                    break;
168
                }
169
            }
170
            
171
            if(! $newNode instanceof Node)
172
            {
173
                throw new \RuntimeException('Path is not continous in the grid');
174
            }
175
            
176
            $node = $newNode;
177
            $path[] = $node;
178
        }
179
        
180
        return new NodePath($path);
181
    }
182
}
183