Issues (234)

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.

Tests/StarWars/Schema/StarWarsData.php (11 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
 * Date: 07.12.15
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\Tests\StarWars\Schema;
9
10
11
class StarWarsData
12
{
13 View Code Duplication
    private static function luke()
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...
14
    {
15
        return [
16
            'id'         => '1000',
17
            'name'       => 'Luke Skywalker',
18
            'friends'    => ['1002', '1003', '2000', '2001'],
19
            'appearsIn'  => [4, 5, 6],
20
            'homePlanet' => 'Tatooine',
21
        ];
22
    }
23
24 View Code Duplication
    private static function vader()
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...
25
    {
26
        return [
27
            'id'         => '1001',
28
            'name'       => 'Darth Vader',
29
            'friends'    => ['1004'],
30
            'appearsIn'  => [4, 5, 6],
31
            'homePlanet' => 'Tatooine',
32
        ];
33
    }
34
35 View Code Duplication
    private static function han()
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...
36
    {
37
        return [
38
            'id'        => '1002',
39
            'name'      => 'Han Solo',
40
            'friends'   => ['1000', '1003', '2001'],
41
            'appearsIn' => [4, 5, 6],
42
        ];
43
    }
44
45 View Code Duplication
    private static function leia()
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...
46
    {
47
        return [
48
            'id'         => '1003',
49
            'name'       => 'Leia Organa',
50
            'friends'    => ['1000', '1002', '2000', '2001'],
51
            'appearsIn'  => [4, 5, 6],
52
            'homePlanet' => 'Alderaan',
53
        ];
54
    }
55
56
    private static function tarkin()
57
    {
58
        return [
59
            'id'        => '1004',
60
            'name'      => 'Wilhuff Tarkin',
61
            'friends'   => ['1001'],
62
            'appearsIn' => [4],
63
        ];
64
    }
65
66
    static function humans()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
67
    {
68
        return [
69
            '1000' => self::luke(),
70
            '1001' => self::vader(),
71
            '1002' => self::han(),
72
            '1003' => self::leia(),
73
            '1004' => self::tarkin(),
74
        ];
75
    }
76
77 View Code Duplication
    private static function threepio()
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...
78
    {
79
        return [
80
            'id'              => '2000',
81
            'name'            => 'C-3PO',
82
            'friends'         => ['1000', '1002', '1003', '2001'],
83
            'appearsIn'       => [4, 5, 6],
84
            'primaryFunction' => 'Protocol',
85
        ];
86
    }
87
88
    /**
89
     * We export artoo directly because the schema returns him
90
     * from a root field, and hence needs to reference him.
91
     */
92
    static function artoo()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
93
    {
94
        return [
95
96
            'id'              => '2001',
97
            'name'            => 'R2-D2',
98
            'friends'         => ['1000', '1002', '1003'],
99
            'appearsIn'       => [4, 5, 6],
100
            'primaryFunction' => 'Astromech',
101
        ];
102
    }
103
104
    static function droids()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
105
    {
106
        return [
107
            '2000' => self::threepio(),
108
            '2001' => self::artoo(),
109
        ];
110
    }
111
112
    /**
113
     * Helper function to get a character by ID.
114
     */
115
    static function getCharacter($id)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
116
    {
117
        $humans = self::humans();
118
        $droids = self::droids();
119
        if (isset($humans[$id])) {
120
            return $humans[$id];
121
        }
122
        if (isset($droids[$id])) {
123
            return $droids[$id];
124
        }
125
126
        return null;
127
    }
128
129
    /**
130
     * @param $episode
131
     * @return array
132
     */
133
    static function getHero($episode)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
134
    {
135
        if ($episode === 5) {
136
            // Luke is the hero of Episode V.
137
            return self::luke();
138
        }
139
140
        // Artoo is the hero otherwise.
141
        return self::artoo();
142
    }
143
144
    /**
145
     * Allows us to query for a character's friends.
146
     */
147
    static function getFriends($character)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
148
    {
149
        return array_map([__CLASS__, 'getCharacter'], $character['friends']);
150
    }
151
}
152