Video::setUrlTagAttribute()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6667
cc 3
eloc 6
nc 2
nop 1
1
<?php namespace WITR;
2
3
use Illuminate\Database\Eloquent\Model;
4
5
class Video extends Model {
6
7
	/**
8
	 * The database table used by the model.
9
	 *
10
	 * @var string
11
	 */
12
	protected $table = 'videos';
13
14
	/**
15
	 * The attributes that are mass assignable.
16
	 *
17
	 * @var array
18
	 */
19
	protected $fillable = ['artist', 'song', 'album', 'review', 'url_tag'];
20
21
	public $timestamps = false;
22
23
	public function setUrlTagAttribute($value)
24
    {
25
    	parse_str( parse_url( $value, PHP_URL_QUERY ), $params );
26
		if (isset($params['v']) || array_key_exists('v', $params)) {
27
			$this->attributes['url_tag'] = $params['v'];
28
		} else {
29
			$this->attributes['url_tag'] = $value;
30
		}	
31
    }
32
}
33