GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Ad::getFormattedStringAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * App\Ad
9
 *
10
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Platform[] $platforms
11
 * @mixin \Eloquent
12
 * @property int $id
13
 * @property string $title
14
 * @property string $description
15
 * @property string $img_url
16
 * @property float $price
17
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad whereDescription($value)
18
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad whereId($value)
19
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad whereImgUrl($value)
20
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad wherePrice($value)
21
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad whereTitle($value)
22
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Ad find($value)
23
 */
24
class Ad extends Model
25
{
26
    protected $fillable = ['title', 'description', 'img_url', 'price'];
27
    // Hide those attributes when calling a ->toArray() on the object
28
    protected $hidden = ['id', 'img_url', 'platforms'];
29
30
    public $timestamps = false;
31
32
    public function platforms()
33
    {
34
        return $this->belongsToMany(Platform::class, 'ad_platforms')->withPivot('publication_item_id');
35
    }
36
37
    public function getFormattedStringAttribute()
38
    {
39
        return sprintf(
40
            "%s\n%s\nPrix : %d CHF",
41
            $this->title, $this->description, $this->price
42
        );
43
    }
44
}
45