Issues (4)

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/Gwa/MockeryWpBridge.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
namespace Gwa\Wordpress\WpBridge;
3
4
use Gwa\Wordpress\WpBridge\Contracts\WpBridgeInterface;
5
use Mockery;
6
7
class MockeryWpBridge implements WpBridgeInterface
8
{
9
    /**
10
     * Mockery instance.
11
     *
12
     * @var \Mockery
13
     */
14
    private $mock;
15
16
    /**
17
     * All shortcodes.
18
     *
19
     * @var array
20
     */
21
    private $shortcodes = [];
22
23
    /**
24
     * All filters.
25
     *
26
     * @var array
27
     */
28
    private $filters = [];
29
30
    /**
31
     * All actions.
32
     *
33
     * @var array
34
     */
35
    private $actions = [];
36
37
    /**
38
     * Add a shortcode.
39
     *
40
     * @param string $tag
41
     *
42
     * @param mixed $func
43
     */
44
    public function addShortcode($tag, $func)
45
    {
46
        $this->shortcodes[$tag] = $func;
47
48
        return $this;
49
    }
50
51
    /**
52
     * Check if shortcode exist.
53
     *
54
     * @param string $tag
55
     *
56
     * @return boolean
57
     */
58
    public function hasShortcode($tag)
59
    {
60
        return isset($this->shortcodes[$tag]);
61
    }
62
63
    /**
64
     * Get a shortcode callback.
65
     *
66
     * @param string $tag
67
     *
68
     * @return mixed
69
     */
70
    public function getShortcodeCallback($tag)
71
    {
72
        return isset($this->shortcodes[$tag]) ? $this->shortcodes[$tag] : null;
73
    }
74
75
    /**
76
     * Combines shortcode attributes with known attributes and fills in defaults when needed.
77
     *
78
     * @param array       $pairs
79
     * @param array       $atts
80
     * @param string|null $shortcode
81
     *
82
     * @return array
83
     */
84
    public function shortcodeAtts($pairs, $atts, $shortcode = null)
0 ignored issues
show
The parameter $shortcode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
85
    {
86
        return array_merge($pairs, $atts);
87
    }
88
89
    /* -------- */
90
91
    /**
92
     * Wordpress mock on __() func.
93
     *
94
     * @param  string $text
95
     * @param  string $domain
96
     *
97
     * @return string
98
     */
99
    public function __($text, $domain)
0 ignored issues
show
The parameter $domain is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
This method's name is shorter than the configured minimum length of 3 characters.

Even though PHP does not care about the name of your methods, it is generally a good practice to choose method names which can be easily understood by other human readers.

Loading history...
Method name "MockeryWpBridge::__" is invalid; only PHP magic methods should be prefixed with a double underscore
Loading history...
100
    {
101
        return $text;
102
    }
103
104
    /* -------- */
105
106
    /**
107
     * Wordpress mock on add_filter func.
108
     *
109
     * @param string   $filterName
110
     * @param callback $filterCall
111
     * @param int      $prio
112
     * @param int      $numVars
113
     *
114
     * @return self
115
     */
116
    public function addFilter($filterName, $filterCall, $prio, $numVars)
117
    {
118
        $this->filters[] = $this->add($filterName, $filterCall, $prio, $numVars);
119
120
        return $this;
121
    }
122
123
    /**
124
     * Get all added filters.
125
     *
126
     * @return array
127
     */
128
    public function getAddedFilters()
129
    {
130
        return $this->filters;
131
    }
132
133
    /**
134
     * Wordpress mock on add_action func.
135
     *
136
     * @param string   $filterName
137
     * @param callback $filterCall
138
     * @param int      $prio
139
     * @param int      $numVars
140
     *
141
     * @return self
142
     */
143
    public function addAction($filterName, $filterCall, $prio, $numVars)
144
    {
145
        $this->actions[] = $this->add($filterName, $filterCall, $prio, $numVars);
146
147
        return $this;
148
    }
149
150
    /**
151
     * Get added actions
152
     *
153
     * @return array
154
     */
155
    public function getAddedActions()
156
    {
157
        return $this->actions;
158
    }
159
160
    /**
161
     * add
162
     *
163
     * @param string   $filterName
164
     * @param callback $filterCall
165
     * @param int      $prio
166
     * @param int      $numVars
167
     *
168
     * @return \stdClass
169
     */
170
    private function add($filterName, $filterCall, $prio, $numVars)
171
    {
172
        $data             = new \stdClass();
173
        $data->filtername = $filterName;
174
        $data->callback   = $filterCall;
175
        $data->prio       = $prio;
176
        $data->numvars    = $numVars;
177
178
        return $data;
179
    }
180
181
    public function __call($function, $args)
182
    {
183
        return call_user_func_array([$this->mock, $function], $args);
184
    }
185
186
    public function mock()
187
    {
188
        if (!isset($this->mock)) {
189
            $this->mock = Mockery::mock('WpBridge');
190
        }
191
192
        return $this->mock;
193
    }
194
}
195