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 (42)

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/Naneau/FileGen/Structure.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
namespace Naneau\FileGen;
3
4
use Naneau\FileGen\Directory;
5
use Naneau\FileGen\File;
6
use Naneau\FileGen\SymLink;
7
8
use Naneau\FileGen\Parameter\Set as ParameterSet;
9
10
use Naneau\FileGen\Structure\Exception as StructureException;
11
12
/**
13
 * A structure
14
 */
15
class Structure extends Directory
16
{
17
    /**
18
     * The parameter definition
19
     *
20
     * @var ParameterSet
21
     **/
22
    private $parameterDefinition;
23
24
    /**
25
     * Constructor
26
     *
27
     * @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...
28
     **/
29
    public function __construct()
30
    {
31
        // Although the root node (Structure) is a directory, it does not  have
32
        // a "name", relative to the root
33
        parent::__construct('');
34
35
        // Initialize the parameter definition
36
        $this->setParameterDefinition(new ParameterSet);
37
    }
38
39
    /**
40
     * Add a file
41
     *
42
     * @param  string              $name
43
     * @param  FileContents|string $contents
44
     * @param  int                 $mode     mode in octal 0XXX
45
     * @return Structure
46
     **/
47
    public function file($name, $contents = '', $mode = null)
48
    {
49
        // Create the file itself
50
        $file = new File(basename($name), $contents, $mode);
51
52
        $parent = $this->parentDirectory($name);
53
        $parent->addChild($file);
54
55
        return $this;
56
    }
57
58
    /**
59
     * Add a directory
60
     *
61
     * @param  string    $name
62
     * @param  int       $mode mode in octal 0XXX
63
     * @return Structure
64
     **/
65
    public function directory($name, $mode = null)
66
    {
67
        // Create the file itself
68
        $directory = new Directory(basename($name), $mode);
69
70
        $parent = $this->parentDirectory($name);
71
        $parent->addChild($directory);
72
73
        return $this;
74
    }
75
76
    /**
77
     * Create a symlink
78
     *
79
     * @param  string    $from
80
     * @param  string    $to
81
     * @return Structure
82
     **/
83
    public function link($from, $to)
84
    {
85
        // Create the file itself
86
        $link = new SymLink($from, basename($to));
87
88
        $parent = $this->parentDirectory($to);
89
        $parent->addChild($link);
90
91
        return $this;
92
    }
93
94
    /**
95
     * Add a parameter
96
     *
97
     * @param  string    $name        name of the parameter
98
     * @param  string    $description (optional) human readable description
99
     * @return Structure
100
     **/
101
    public function parameter($name, $description = null)
102
    {
103
        $this->getParameterDefinition()->add($name, $description);
104
105
        return $this;
106
    }
107
108
    /**
109
     * Get the parameter definition
110
     *
111
     * @return ParameterSet
112
     */
113
    public function getParameterDefinition()
114
    {
115
        return $this->parameterDefinition;
116
    }
117
118
    /**
119
     * Set the parameter definition
120
     *
121
     * @param  ParameterSet $parameterDefinition
122
     * @return Structure
123
     */
124
    public function setParameterDefinition(ParameterSet $parameterDefinition)
125
    {
126
        $this->parameterDefinition = $parameterDefinition;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Create (and add) a parent directory for a path
133
     *
134
     * @param  string $name
135
     * @return void
136
     **/
137
    private function parentDirectory($name)
138
    {
139
        // Parent path
140
        $parentPath = dirname(trim($name, DIRECTORY_SEPARATOR));
141
142
        // There is no parent path (parent directory is the root)
143
        if ($parentPath === '.') {
144
            return $this;
145
        }
146
147
        // Directories to add
148
        $directories = explode(DIRECTORY_SEPARATOR, $parentPath);
149
150
        $parent = $this;
151
        $dirCount = count($directories);
152
        for ($x = 0; $x < $dirCount; $x++) {
153
154
            // Going through directories, highest level first
155
            $directory = $directories[$x];
156
157
            if ($parent->hasChild($directory)) {
158
                // If the parent already has a child by the name of $directory
159
160
                // Fetch the current child by that name
161
                $childDir = $parent->getChild($directory);
162
163
                // Make sure we get a directory back (it may be a file)
164
                if (!($childDir instanceof Directory)) {
165
                    throw new StructureException(sprintf(
166
                        'Trying to add directory where there is a file already: "%s"',
167
                        $parent->getFullName() . DIRECTORY_SEPARATOR . $directory
168
                    ));
169
                }
170
            } else {
171
                // Child directory does not exist yet, create a new one
172
                $childDir = new Directory($directory);
173
174
                // Add the child to the old parent
175
                $parent->addChild($childDir);
176
            }
177
178
            // Next directory with the new parent
179
            $parent = $childDir;
180
        }
181
182
        return $parent;
183
    }
184
}
185