Completed
Push — develop ( c0e442...ef223d )
by Abdelrahman
13:47
created

HasSocialAttributes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSocialAttribute() 0 4 1
A scopeWithSocial() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Support\Traits;
6
7
use Illuminate\Database\Eloquent\Builder;
8
use Spatie\SchemalessAttributes\SchemalessAttributes;
9
10
trait HasSocialAttributes
11
{
12
    /**
13
     * Escape all values.
14
     *
15
     * @param array $data
0 ignored issues
show
Bug introduced by
There is no parameter named $data. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
16
     *
17
     * @return array
0 ignored issues
show
Documentation introduced by
Should the return type not be SchemalessAttributes?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
18
     */
19
    public function getSocialAttribute(): SchemalessAttributes
20
    {
21
        return SchemalessAttributes::createForModel($this, 'social');
22
    }
23
24
    public function scopeWithSocial(): Builder
25
    {
26
        return SchemalessAttributes::scopeWithSchemalessAttributes('social');
27
    }
28
}
29