Showing 192 of 192 total issues
Avoid using static access to class '\Spatie\Permission\Models\Permission' in method 'run'. Open
Permission::findOrCreate($permission, 'api');
- 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\Cache' in method 'getFieldsMetadata'. Open
$tableExist = Cache::rememberForever('model_fields_metadata_table_exists', function () {
return Schema::hasTable('model_fields_metadata');
});
- 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\Cache' in method 'getExtraAttributesValues'. Open
$modelFields = Cache::rememberForever($key, function () use ($model) {
// @phpstan-ignore-next-line
return $model->fields()->get();
});
- 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 '\EscolaLms\ModelFields\Facades\ModelFields' in method 'getExtraAttributesValues'. Open
return ModelFieldsFacade::getExtraAttributesValues($this);
- 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 '\Spatie\Permission\Models\Role' in method 'run'. Open
$apiAdmin = Role::findOrCreate(UserRole::ADMIN, 'api');
- 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
Line exceeds 120 characters; contains 135 characters Open
return $bool ? $this->sendResponse(true, "meta field deleted successfully") : $this->sendError("meta field delete error", 404);
- Exclude checks
Line exceeds 120 characters; contains 193 characters Open
public function addOrUpdateMetadataField(string $class_type, string $name, string $type, string $default = '', array $rules = null, int $visibility = 1 << 0, array $extra = null): Metadata;
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
public static function firstOrCreate(array $attributes = [], array $values = []): \Illuminate\Database\Eloquent\Model
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$this->extraFields = isset($this->extraFields) ? $this->extraFields->prepend(['name' => $key, 'value' => $value]) : collect([
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
return $this->sendResponseForResource(MetadataResource::make($field), "meta field created or updated successfully");
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
return $this->sendResponseForResource(MetadataResource::collection($metaFields), "metaFields list retrieved successfully");
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator;
- Exclude checks
Line exceeds 120 characters; contains 192 characters Open
public function addOrUpdateMetadataField(string $class_type, string $name, string $type, string $default = '', array $rules = null, int $visibility = 1 << 0, array $extra = null): Metadata
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$this->extraFields = isset($this->extraFields) ? $this->extraFields->prepend(['name' => $key, 'value' => $value]) : collect([
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$metaFields = $this->service->getFieldsMetadataListPaginated($classType, $perPage, OrderDto::instantiateFromRequest($request));
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$classTypes = class_parents($class_type) ? array_merge([$class_type], class_parents($class_type)) : [$class_type];
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
return $this->sendResponseForResource(MetadataResource::collection($metaFields), "metaFields list retrieved successfully");
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
->mapWithKeys(fn($item, $key) => [$item['name'] => self::castField($item['value'], ($fields[$item['name']] ?? null))])
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$classTypes = class_parents($class_type) ? array_merge([$class_type], class_parents($class_type)) : [$class_type];
- Exclude checks