| Total Complexity | 8 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Video extends Model |
||
| 12 | { |
||
| 13 | use LogsActivity, Thumbnail; |
||
| 14 | |||
| 15 | protected $guarded = []; |
||
| 16 | |||
| 17 | // Forget cache on updating or saving and deleting |
||
| 18 | public static function boot() |
||
| 19 | { |
||
| 20 | parent::boot(); |
||
| 21 | |||
| 22 | static::saving(function () { |
||
| 23 | self::cacheKey(); |
||
| 24 | }); |
||
| 25 | |||
| 26 | static::deleting(function () { |
||
| 27 | self::cacheKey(); |
||
| 28 | }); |
||
| 29 | |||
| 30 | Video::creating(function ($model) { |
||
| 31 | $model->position = Video::max('position') + 1; |
||
| 32 | }); |
||
| 33 | } |
||
| 34 | |||
| 35 | // Cache Keys |
||
| 36 | private static function cacheKey() |
||
| 37 | { |
||
| 38 | Cache::has('videos') ? Cache::forget('videos') : ''; |
||
| 39 | } |
||
| 40 | |||
| 41 | // Appends |
||
| 42 | protected $appends = ['video_html', 'network_thumbnail']; |
||
| 43 | |||
| 44 | // Logs |
||
| 45 | protected static $logName = 'video'; |
||
| 46 | |||
| 47 | public function getActivitylogOptions(): LogOptions |
||
| 48 | { |
||
| 49 | return LogOptions::defaults(); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function getVideoHtmlAttribute() |
||
| 53 | { |
||
| 54 | if (isset($this->url)) { |
||
| 55 | return preg_replace("/\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i", '<iframe width="420" height="315" src="//www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $this->url); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | public function getNetworkThumbnailAttribute() |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths