Issues (26)

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/Feature/Feature.php (19 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 Feature;
4
5
use Feature\Contracts\User;
6
use Feature\Contracts\World;
7
8
/**
9
 * Class Feature
10
 * @package Feature
11
 */
12
final class Feature
13
{
14
    /**
15
     * @var self
16
     */
17
    private static $instance;
18
19
    /**
20
     * @var World
21
     */
22
    private $world;
23
24
    /**
25
     * @var array
26
     */
27
    private $stanza;
28
29
    /**
30
     * @var array
31
     */
32
    private static $config = [];
33
34
    /**
35
     * @param World $world
36
     * @param array $stanza
37
     */
38
    private function __construct(World $world, array $stanza)
39
    {
40
        $this->world = $world;
41
        $this->stanza = $stanza;
42
    }
43
44
    /**
45
     * @param World $world
46
     * @param array $stanza
47
     * @return Feature
48
     */
49
    public static function create(World $world, array $stanza)
50
    {
51
        if (static::$instance) {
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
52
            return static::$instance;
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
53
        }
54
55
        static::$instance = new static($world, $stanza);
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
56
57
        return static::$instance;
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
58
    }
59
60
    /**
61
     * @param $feature
62
     * @return bool
63
     */
64
    public static function isEnabled($feature)
65
    {
66
        return static::createConfig($feature)->isEnabled();
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
67
    }
68
69
    /**
70
     * @param $feature
71
     * @param User $user
72
     * @return bool
73
     */
74
    public static function isEnabledFor($feature, User $user)
75
    {
76
        return static::createConfig($feature)->isEnabledFor($user);
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
77
    }
78
79
    /**
80
     * @param $feature
81
     * @param $bucketId
82
     * @return bool
83
     */
84
    public static function isEnabledBucketingBy($feature, $bucketId)
85
    {
86
        return static::createConfig($feature)->isEnabledBucketingBy($bucketId);
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
87
    }
88
89
    /**
90
     * @param $feature
91
     * @return string
92
     */
93
    public static function variant($feature)
94
    {
95
        return static::createConfig($feature)->variant();
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
96
    }
97
98
    /**
99
     * @param $feature
100
     * @param User $user
101
     * @return string
102
     */
103
    public static function variantFor($feature, User $user)
104
    {
105
        return static::createConfig($feature)->variantFor($user);
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
106
    }
107
108
    /**
109
     * @param $feature
110
     * @param $bucketId
111
     * @return string
112
     */
113
    public static function variantBucketingBy($feature, $bucketId)
114
    {
115
        return static::createConfig($feature)->variantBucketingBy($bucketId);
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
116
    }
117
118
    /**
119
     * @param $feature
120
     * @return mixed|null
121
     */
122
    public static function description($feature)
123
    {
124
        return static::createConfig($feature)->description();
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
125
    }
126
127
    /**
128
     * clear config
129
     */
130
    public static function clear()
131
    {
132
        static::$config = [];
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
133
        static::$instance = null;
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
134
    }
135
136
    /**
137
     * @param $feature
138
     * @return Config
139
     */
140
    private static function createConfig($feature)
141
    {
142
        if (array_key_exists($feature, static::$config)) {
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
143
            return static::$config[$feature];
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
144
        }
145
146
        static::$config[$feature] = new Config(
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
147
            $feature,
148
            static::$instance->stanza[$feature],
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
149
            static::$instance->world
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
150
        );
151
152
        return static::$config[$feature];
0 ignored issues
show
Comprehensibility introduced by
Since Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.

Late static binding only has effect in subclasses. A final class cannot be extended anymore so late static binding cannot occurr. Consider replacing static:: with self::.

To learn more about late static binding, please refer to the PHP core documentation.

Loading history...
153
    }
154
}
155