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/SlugOptions.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 SlugOptions
8
{
9
    /**
10
     * The field used to generate the slug from.
11
     *
12
     * @var string|array|callable
13
     */
14
    private $fromField;
15
16
    /**
17
     * The field where to store the generated slug.
18
     *
19
     * @var string
20
     */
21
    private $toField;
22
23
    /**
24
     * Flag whether slugs should be unique or not.
25
     *
26
     * @var bool
27
     */
28
    private $uniqueSlugs = true;
29
30
    /**
31
     * The separator used between words in the slug.
32
     *
33
     * @var string
34
     */
35
    private $slugSeparator = '-';
36
37
    /**
38
     * The language used to transform the UTF-8 slug to ASCII.
39
     *
40
     * @var string
41
     */
42
    private $slugLanguage = 'en';
43
44
    /**
45
     * Flag whether to generate slug on model create event or not.
46
     *
47
     * @var bool
48
     */
49
    private $generateSlugOnCreate = true;
50
51
    /**
52
     * Flag whether to generate slug on model update event or not.
53
     *
54
     * @var bool
55
     */
56
    private $generateSlugOnUpdate = true;
57
58
    /**
59
     * Get the value of a property of this class.
60
     *
61
     * @param $name
62
     * @return mixed
63
     * @throws Exception
64
     */
65 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...
66
    {
67
        if (property_exists(static::class, $name)) {
68
            return $this->{$name};
69
        }
70
71
        throw new Exception(
72
            'The property "'.$name.'" does not exist in class "'.static::class.'"'
73
        );
74
    }
75
76
    /**
77
     * Get a fresh instance of this class.
78
     *
79
     * @return SlugOptions
80
     */
81
    public static function instance(): self
82
    {
83
        return new static();
84
    }
85
86
    /**
87
     * Set the $fromField to work with in the Neurony\Url\Traits\HasSlug trait.
88
     *
89
     * @param string|array|callable $field
90
     * @return SlugOptions
91
     */
92
    public function generateSlugFrom($field): self
93
    {
94
        if (is_string($field)) {
95
            $field = [$field];
96
        }
97
98
        $this->fromField = $field;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Set the $toField to work with in the Neurony\Url\Traits\HasSlug trait.
105
     *
106
     * @param string $field
107
     * @return SlugOptions
108
     */
109
    public function saveSlugTo(string $field): self
110
    {
111
        $this->toField = $field;
112
113
        return $this;
114
    }
115
116
    /**
117
     * Set the $uniqueSlugs to work with in the Neurony\Url\Traits\HasSlug trait.
118
     *
119
     * @return SlugOptions
120
     */
121
    public function allowDuplicateSlugs(): self
122
    {
123
        $this->uniqueSlugs = false;
124
125
        return $this;
126
    }
127
128
    /**
129
     * Set the $slugSeparator to work with in the Neurony\Url\Traits\HasSlug trait.
130
     *
131
     * @param string $separator
132
     * @return SlugOptions
133
     */
134
    public function usingSeparator(string $separator): self
135
    {
136
        $this->slugSeparator = $separator;
137
138
        return $this;
139
    }
140
141
    /**
142
     * Set the $slugLanguage to work with in the Neurony\Url\Traits\HasSlug trait.
143
     *
144
     * @param string $separator
145
     * @return SlugOptions
146
     */
147
    public function usingLanguage(string $separator): self
148
    {
149
        $this->slugLanguage = $separator;
150
151
        return $this;
152
    }
153
154
    /**
155
     * Set the $generateSlugOnCreate to work with in the Neurony\Url\Traits\HasSlug trait.
156
     *
157
     * @return SlugOptions
158
     */
159
    public function doNotGenerateSlugOnCreate(): self
160
    {
161
        $this->generateSlugOnCreate = false;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Set the $generateSlugOnUpdate to work with in the Neurony\Url\Traits\HasSlug trait.
168
     *
169
     * @return SlugOptions
170
     */
171
    public function doNotGenerateSlugOnUpdate(): self
172
    {
173
        $this->generateSlugOnUpdate = false;
174
175
        return $this;
176
    }
177
}
178