Issues (245)

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/Entities/Definitions/InterfaceDefinition.php (4 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
/**
4
 * \AppserverIo\Doppelgaenger\Entities\Definitions\InterfaceDefinition
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Bernhard Wick <[email protected]>
15
 * @copyright 2015 TechDivision GmbH - <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/doppelgaenger
18
 * @link      http://www.appserver.io/
19
 */
20
21
namespace AppserverIo\Doppelgaenger\Entities\Definitions;
22
23
use AppserverIo\Doppelgaenger\Entities\Lists\AssertionList;
24
use AppserverIo\Doppelgaenger\Entities\Lists\FunctionDefinitionList;
25
use AppserverIo\Doppelgaenger\Entities\Lists\TypedListList;
26
27
/**
28
 * This class acts as a DTO-like (we are not immutable due to protected visibility)
29
 * entity for describing interface definitions
30
 *
31
 * @author    Bernhard Wick <[email protected]>
32
 * @copyright 2015 TechDivision GmbH - <[email protected]>
33
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
 * @link      https://github.com/appserver-io/doppelgaenger
35
 * @link      http://www.appserver.io/
36
 */
37
class InterfaceDefinition extends AbstractStructureDefinition
38
{
39
40
    /**
41
     * @const string TYPE The structure type
42
     */
43
    const TYPE = 'interface';
44
45
    /**
46
     * The parent interfaces (if any)
47
     *
48
     * @var string $extends
49
     */
50
    protected $extends;
51
52
    /**
53
     * Possible constants the interface defines
54
     *
55
     * @var array $constants
56
     */
57
    protected $constants;
58
59
    /**
60
     * Default constructor
61
     *
62
     * TODO The constructor does not use all members
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
63
     *
64
     * @param string                      $docBlock            DocBlock header of the interface
65
     * @param string                      $name                $name Interface name
66
     * @param string                      $namespace           The namespace the definition resides in
67
     * @param array                       $extends             The parent interfaces (if any)
68
     * @param array                       $constants           Possible constants the interface defines
69
     * @param AssertionList|null          $invariantConditions Invariant conditions
70
     * @param AssertionList|null          $ancestralInvariants Ancestral invariants
71
     * @param FunctionDefinitionList|null $functionDefinitions List of functions defined within the interface
72
     */
73
    public function __construct(
74
        $docBlock = '',
75
        $name = '',
76
        $namespace = '',
77
        $extends = array(),
78
        $constants = array(),
79
        $invariantConditions = null,
80
        $ancestralInvariants = null,
81
        $functionDefinitions = null
82
    ) {
83
        $this->docBlock = $docBlock;
84
        $this->name = $name;
85
        $this->namespace = $namespace;
86
        $this->extends = $extends;
0 ignored issues
show
Documentation Bug introduced by
It seems like $extends of type array is incompatible with the declared type string of property $extends.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
87
        $this->constants = $constants;
88
        $this->invariantConditions = is_null($invariantConditions) ? new AssertionList() : $invariantConditions;
89
        $this->ancestralInvariants = is_null($ancestralInvariants) ? new TypedListList() : $ancestralInvariants;
0 ignored issues
show
Documentation Bug introduced by
It seems like is_null($ancestralInvari... : $ancestralInvariants can also be of type object<AppserverIo\Doppe...es\Lists\AssertionList>. However, the property $ancestralInvariants is declared as type object<AppserverIo\Doppe...es\Lists\TypedListList>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
90
        $this->functionDefinitions = is_null(
91
            $functionDefinitions
92
        ) ? new FunctionDefinitionList() : $functionDefinitions;
93
    }
94
95
    /**
96
     * Getter method for attribute $constants
97
     *
98
     * @return array
99
     */
100
    public function getConstants()
101
    {
102
        return $this->constants;
103
    }
104
105
    /**
106
     * Will return a list of all dependencies eg. parent class, interfaces and traits.
107
     *
108
     * @return array
109
     */
110
    public function getDependencies()
111
    {
112
        // Get our interfaces
113
        $result = $this->extends;
114
115
        // We got an error that this is nor array, weird but build up a final frontier here
116
        if (!is_array($result)) {
117
            $result = array($result);
118
        }
119
120
        return $result;
121
    }
122
123
    /**
124
     * Getter method for attribute $extends
125
     *
126
     * @return string
127
     */
128
    public function getExtends()
129
    {
130
        return $this->extends;
131
    }
132
133
    /**
134
     * Setter method for attribute $ancestralInvariants
135
     *
136
     * @param \AppserverIo\Doppelgaenger\Entities\Lists\AssertionList $ancestralInvariants Inherited invariant assertions
137
     *
138
     * @return null
139
     */
140
    public function setAncestralInvariants(AssertionList $ancestralInvariants)
141
    {
142
        $this->ancestralInvariants = $ancestralInvariants;
0 ignored issues
show
Documentation Bug introduced by
It seems like $ancestralInvariants of type object<AppserverIo\Doppe...es\Lists\AssertionList> is incompatible with the declared type object<AppserverIo\Doppe...es\Lists\TypedListList> of property $ancestralInvariants.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
143
    }
144
145
    /**
146
     * Setter method for the $constants property
147
     *
148
     * @param array $constants Constants the class defines
149
     *
150
     * @return null
151
     */
152
    public function setConstants($constants)
153
    {
154
        $this->constants = $constants;
155
    }
156
157
    /**
158
     * Setter method for the $extends property
159
     *
160
     * @param string $extends Potential parent class
161
     *
162
     * @return null
163
     */
164
    public function setExtends($extends)
165
    {
166
        $this->extends = $extends;
167
    }
168
169
    /**
170
     * Setter method for attribute $invariantConditions
171
     *
172
     * @param \AppserverIo\Doppelgaenger\Entities\Lists\AssertionList $invariantConditions List of invariant assertions
173
     *
174
     * @return null
175
     */
176
    public function setInvariantConditions(AssertionList $invariantConditions)
177
    {
178
        $this->invariantConditions = $invariantConditions;
179
    }
180
}
181