| @@ 62-73 (lines=12) @@ | ||
| 59 | * |
|
| 60 | * @return \Closure |
|
| 61 | */ |
|
| 62 | public function __issetHook() |
|
| 63 | { |
|
| 64 | return function ($next, $isset, $args) { |
|
| 65 | $key = $args->get('key'); |
|
| 66 | ||
| 67 | if (!$isset && $this->hasMapping($key)) { |
|
| 68 | return (bool) $this->mapAttribute($key); |
|
| 69 | } |
|
| 70 | ||
| 71 | return $next($isset, $args); |
|
| 72 | }; |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Register hook on unset call. |
|
| @@ 102-113 (lines=12) @@ | ||
| 99 | * |
|
| 100 | * @return \Closure |
|
| 101 | */ |
|
| 102 | public function getAttribute() |
|
| 103 | { |
|
| 104 | return function ($next, $value, $args) { |
|
| 105 | $key = $args->get('key'); |
|
| 106 | ||
| 107 | if ($this->hasMapping($key)) { |
|
| 108 | $value = $this->mapAttribute($key); |
|
| 109 | } |
|
| 110 | ||
| 111 | return $next($value, $args); |
|
| 112 | }; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Register hook on setAttribute method. |
|