| Total Complexity | 2 |
| Total Lines | 20 |
| Duplicated Lines | 100 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php namespace GeneaLabs\LaravelModelCaching\Tests\Fixtures; |
||
| 7 | class UncachedBook extends CachedModel |
||
| 8 | { |
||
| 9 | protected $dates = [ |
||
| 10 | 'published_at', |
||
| 11 | ]; |
||
| 12 | protected $fillable = [ |
||
| 13 | 'description', |
||
| 14 | 'published_at', |
||
| 15 | 'title', |
||
| 16 | ]; |
||
| 17 | protected $table = 'books'; |
||
| 18 | |||
| 19 | public function author() : BelongsTo |
||
| 20 | { |
||
| 21 | return $this->belongsTo(UncachedAuthor::class); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function stores() : BelongsToMany |
||
| 25 | { |
||
| 26 | return $this->belongsToMany(UncachedStore::class); |
||
| 27 | } |
||
| 29 |