Method boot
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot(): void
{
Validator::extend('unique_email', function ($attribute, $value, $parameters) {
if (isset($parameters[1])) {
$attribute = $parameters[1];
Avoid too many return
statements within this method. Open
return !in_array($value, $names);
The method boot() has 131 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function boot(): void
{
Validator::extend('unique_email', function ($attribute, $value, $parameters) {
if (isset($parameters[1])) {
$attribute = $parameters[1];
- Exclude checks
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('strong_password', function ($attribute, $value, $parameters) {
$easyPasswords = [
'111111', '121212', '123456', 'qwerty', 'polska', 'zaq12wsx', '111111', 'aaaaaa', 'matrix', 'monika', 'marcin',
'misiek', 'master', 'abc123', 'qwerty1', 'qazwsx', 'mateusz', 'strims', 'strimoid', 'qwe123', 'zzzzzz',
];
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('user_password', fn ($attribute, $value, $parameters) => Hash::check($value, Auth::user()->password));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('unique_email', function ($attribute, $value, $parameters) {
if (isset($parameters[1])) {
$attribute = $parameters[1];
}
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Hash' in method 'boot'. Open
Validator::extend('user_password', fn ($attribute, $value, $parameters) => Hash::check($value, Auth::user()->password));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('real_email', function ($attribute, $value, $parameters) {
$blockedDomains = [
// normal mail mail providers (used to spam)
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('reserved_groupnames', function ($attribute, $value, $parameters) {
$names = [
'subscribed', 'moderated', 'blocked', 'random', 'all', 'observed', 'saved',
'subskrybowane', 'moderowane', 'zablokowane', 'blokowane', 'losowa', 'losowe',
'wszystko', 'wszystkie', 'obserwowani', 'obserwowane', 'zapisane', 'folder',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('safe_url', fn ($attribute, $value, $parameters) => Str::startsWith($value, 'http'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Str' in method 'boot'. Open
Validator::extend('safe_url', fn ($attribute, $value, $parameters) => Str::startsWith($value, 'http'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Facades\Validator' in method 'boot'. Open
Validator::extend('url_custom', fn ($attribute, $value, $parameters) => preg_match('@^https?://[^\s/$.?#].[^\s]*$@iS', (string) $value));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Illuminate\Support\Str' in method 'boot'. Open
$parts = explode('.', Str::lower($domain[1]));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}