1 | <?php |
||
15 | class AspectManager |
||
16 | { |
||
17 | /** |
||
18 | * Gracefully add aspect, this will check |
||
19 | * if model implements AspectsInterface |
||
20 | * and add only if it does. |
||
21 | * |
||
22 | * @see AspectsInterface |
||
23 | * @param AnnotatedInterface $model |
||
24 | * @param $aspect |
||
25 | */ |
||
26 | 119 | public static function addAspect(AnnotatedInterface $model, $aspect) |
|
33 | |||
34 | /** |
||
35 | * Gracefully remove aspect, this will check |
||
36 | * if model implements AspectsInterface |
||
37 | * and remove only if it does. |
||
38 | * |
||
39 | * @see AspectsInterface |
||
40 | * @param AnnotatedInterface $model |
||
41 | * @param $aspect |
||
42 | */ |
||
43 | 119 | public static function removeAspect(AnnotatedInterface $model, $aspect) |
|
50 | |||
51 | /** |
||
52 | * Gracefully check if has aspect, this will check |
||
53 | * if model implements `AspectsInterface` |
||
54 | * and check only if it does. If model does not |
||
55 | * implement AspectsInterface it will return `false`, |
||
56 | * like if it has no such aspect. |
||
57 | * |
||
58 | * @see AspectsInterface |
||
59 | * @param AnnotatedInterface $model |
||
60 | * @param $aspect |
||
61 | * @return bool|string |
||
62 | */ |
||
63 | 27 | public static function hasAspect(AnnotatedInterface $model, $aspect) |
|
71 | } |