Issues (27)

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.

src/Options/UrlOptions.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
namespace Neurony\Url\Options;
4
5
use Exception;
6
7
class UrlOptions
8
{
9
    /**
10
     * The controller where the laravel router should dispatch the request.
11
     * This is used when a URI is accessed by a user.
12
     * The format of this property should be Full\Namespace\Of\Controller.
13
     *
14
     * @var string
15
     */
16
    private $routeController;
17
18
    /**
19
     * The controller where the laravel router should dispatch the request.
20
     * This is used when a URI is accessed by a user.
21
     * The format of this property should be simply the name of the method residing inside the $routeController.
22
     *
23
     * @var string
24
     */
25
    private $routeAction;
26
27
    /**
28
     * The field used to generate the url slug from.
29
     *
30
     * @var string|array|callable
31
     */
32
    private $fromField;
33
34
    /**
35
     * The field where to store the generated url slug.
36
     *
37
     * @var string
38
     */
39
    private $toField;
40
41
    /**
42
     * The prefix that should be prepended to the generated url slug.
43
     *
44
     * @var string|array|callable
45
     */
46
    private $urlPrefix;
47
48
    /**
49
     * The suffix that should be appended to the generated url slug.
50
     *
51
     * @var string|array|callable
52
     */
53
    private $urlSuffix;
54
55
    /**
56
     * The symbol that will be used to glue url segments together.
57
     *
58
     * @var string
59
     */
60
    private $urlGlue = '/';
61
62
    /**
63
     * Flag whether to update children urls on parent url save.
64
     *
65
     * @var bool
66
     */
67
    private $cascadeUpdate = true;
68
69
    /**
70
     * Get the value of a property of this class.
71
     *
72
     * @param $name
73
     * @return mixed
74
     * @throws Exception
75
     */
76 View Code Duplication
    public function __get($name)
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...
77
    {
78
        if (property_exists(static::class, $name)) {
79
            return $this->{$name};
80
        }
81
82
        throw new Exception(
83
            'The property "'.$name.'" does not exist in class "'.static::class.'"'
84
        );
85
    }
86
87
    /**
88
     * Get a fresh instance of this class.
89
     *
90
     * @return UrlOptions
91
     */
92
    public static function instance(): self
93
    {
94
        return new static();
95
    }
96
97
    /**
98
     * Set the $urlRoute to work with in the Neurony\Url\Traits\HasUrl trait.
99
     *
100
     * @param string $controller
101
     * @param string $action
102
     * @return UrlOptions
103
     */
104
    public function routeUrlTo(string $controller, string $action): self
105
    {
106
        $this->routeController = $controller;
107
        $this->routeAction = $action;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Set the $fromField to work with in the Neurony\Url\Traits\HasUrl trait.
114
     *
115
     * @param string|array|callable $field
116
     * @return UrlOptions
117
     */
118
    public function generateUrlSlugFrom($field): self
119
    {
120
        $this->fromField = $field;
121
122
        return $this;
123
    }
124
125
    /**
126
     * Set the $toField to work with in the Neurony\Url\Traits\HasUrl trait.
127
     *
128
     * @param string $field
129
     * @return UrlOptions
130
     */
131
    public function saveUrlSlugTo(string $field): self
132
    {
133
        $this->toField = $field;
134
135
        return $this;
136
    }
137
138
    /**
139
     * Set the $urlPrefix to work with in the Neurony\Url\Traits\HasUrl trait.
140
     *
141
     * @param string|array|callable $prefix
142
     * @return UrlOptions
143
     */
144
    public function prefixUrlWith($prefix): self
145
    {
146
        $this->urlPrefix = $prefix;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Set the $urlSuffix to work with in the Neurony\Url\Traits\HasUrl trait.
153
     *
154
     * @param string|array|callable $suffix
155
     * @return UrlOptions
156
     */
157
    public function suffixUrlWith($suffix): self
158
    {
159
        $this->urlSuffix = $suffix;
160
161
        return $this;
162
    }
163
164
    /**
165
     * Set the $urlGlue to work with in the Neurony\Url\Traits\HasUrl trait.
166
     *
167
     * @param string $glue
168
     * @return UrlOptions
169
     */
170
    public function glueUrlWith(string $glue): self
171
    {
172
        $this->urlGlue = $glue;
173
174
        return $this;
175
    }
176
177
    /**
178
     * Set the $cascadeUpdate to work with in the Neurony\Url\Traits\HasUrl trait.
179
     *
180
     * @return UrlOptions
181
     */
182
    public function doNotUpdateCascading(): self
183
    {
184
        $this->cascadeUpdate = false;
185
186
        return $this;
187
    }
188
}
189