Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 64.71% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | trait Slug |
||
20 | { |
||
21 | use AbstractInjectable; |
||
22 | use AbstractBehavior; |
||
23 | use Options; |
||
24 | |||
25 | /** |
||
26 | * Initializing Slug |
||
27 | */ |
||
28 | 2 | public function initializeSlug(?array $options = null): void |
|
29 | { |
||
30 | 2 | $options ??= $this->getOptionsManager()->get('slug') ?? []; |
|
31 | |||
32 | 2 | $field = $options['field'] ?? 'slug'; |
|
33 | |||
34 | 2 | $this->setSlugBehavior(new Transformable([ |
|
35 | 2 | 'beforeValidation' => [ |
|
36 | 2 | $field => function (Model $model, string $field) { |
|
37 | $value = $model->readAttribute($field); |
||
38 | return $value && is_string($value) ? \Zemit\Support\Slug::generate($value) : $value; |
||
39 | 2 | }, |
|
40 | 2 | ], |
|
41 | 2 | ])); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Set Slug Behavior |
||
46 | */ |
||
47 | 2 | public function setSlugBehavior(Transformable $slugBehavior): void |
|
48 | { |
||
49 | 2 | $this->setBehavior('slug', $slugBehavior); |
|
|
|||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Get Slug Behavior |
||
54 | */ |
||
55 | public function getSlugBehavior(): Transformable |
||
60 | } |
||
61 | } |
||
62 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.