Issues (260)

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.

core/Config.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
/**
3
 * Created by rozbo at 2017/3/19 下午5:09
4
 */
5
6
namespace puck;
7
use puck\tools\Arr;
8
9
class Config {
10
11
    /**
12
     * All of the configuration items.
13
     *
14
     * @var array
15
     */
16
    protected $items = [];
17
18
    /**
19
     * Create a new configuration repository.
20
     *
21
     * @param  array  $items
22
     * @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...
23
     */
24
    public function __construct(array $items = [])
25
    {
26
        $this->items = $items;
27
    }
28
29
    /**
30
     * Determine if the given configuration value exists.
31
     *
32
     * @param  string  $key
33
     * @return bool
34
     */
35
    public function has($key)
36
    {
37
        return Arr::has($this->items, $key);
38
    }
39
40
    /**
41
     * Get the specified configuration value.
42
     *
43
     * @param  string  $key
44
     * @param  mixed   $default
45
     * @return mixed
46
     */
47
    public function get($key, $default = null)
48
    {
49
        return Arr::get($this->items, $key, $default);
50
    }
51
52
    /**
53
     * Set a given configuration value.
54
     *
55
     * @param  array|string  $key
56
     * @param  mixed   $value
57
     * @return void
58
     */
59
    public function set($key, $value = null)
60
    {
61
        $keys = is_array($key) ? $key : [$key => $value];
62
63
        foreach ($keys as $key => $value) {
64
            Arr::set($this->items, $key, $value);
65
        }
66
    }
67
68
    /**
69
     * Prepend a value onto an array configuration value.
70
     *
71
     * @param  string  $key
72
     * @param  mixed  $value
73
     * @return void
74
     */
75
    public function prepend($key, $value)
76
    {
77
        $array = $this->get($key);
78
79
        array_unshift($array, $value);
80
81
        $this->set($key, $array);
82
    }
83
84
    /**
85
     * Push a value onto an array configuration value.
86
     *
87
     * @param  string  $key
88
     * @param  mixed  $value
89
     * @return void
90
     */
91
    public function push($key, $value)
92
    {
93
        $array = $this->get($key);
94
95
        $array[] = $value;
96
97
        $this->set($key, $array);
98
    }
99
100
    /**
101
     * Get all of the configuration items for the application.
102
     *
103
     * @return array
104
     */
105
    public function all()
106
    {
107
        return $this->items;
108
    }
109
110
    /**
111
     * Determine if the given configuration option exists.
112
     *
113
     * @param  string  $key
114
     * @return bool
115
     */
116
    public function offsetExists($key)
117
    {
118
        return $this->has($key);
119
    }
120
121
    /**
122
     * Get a configuration option.
123
     *
124
     * @param  string  $key
125
     * @return mixed
126
     */
127
    public function offsetGet($key)
128
    {
129
        return $this->get($key);
130
    }
131
132
    /**
133
     * Set a configuration option.
134
     *
135
     * @param  string  $key
136
     * @param  mixed  $value
137
     * @return void
138
     */
139
    public function offsetSet($key, $value)
140
    {
141
        $this->set($key, $value);
142
    }
143
144
    /**
145
     * Unset a configuration option.
146
     *
147
     * @param  string  $key
148
     * @return void
149
     */
150
    public function offsetUnset($key)
151
    {
152
        $this->set($key, null);
153
    }
154
}