| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function seoData() |
||
| 18 | { |
||
| 19 | $class_name = get_class($this); |
||
| 20 | |||
| 21 | $SeoDataQuery = $this->hasOne(config('seoable.model'), 'seoable_id')->where('seoable_type', $class_name); |
||
|
|
|||
| 22 | |||
| 23 | if (! $SeoDataQuery->exists()) { |
||
| 24 | $SeoData = $SeoDataQuery->make(['meta' => [], 'open_graph' => [], 'twitter' => []]); |
||
| 25 | $SeoData->seoable_type = $class_name; |
||
| 26 | $SeoData->save(); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $SeoDataQuery; |
||
| 30 | } |
||
| 31 | |||
| 47 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.