@@ 74-85 (lines=12) @@ | ||
71 | * |
|
72 | * @return \Closure |
|
73 | */ |
|
74 | public function __issetHook() |
|
75 | { |
|
76 | return function ($next, $isset, $args) { |
|
77 | $key = $args->get('key'); |
|
78 | ||
79 | if (!$isset && $this->hasMapping($key)) { |
|
80 | return (bool) $this->mapAttribute($key); |
|
81 | } |
|
82 | ||
83 | return $next($isset, $args); |
|
84 | }; |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Register hook on unset call. |
|
@@ 114-125 (lines=12) @@ | ||
111 | * |
|
112 | * @return \Closure |
|
113 | */ |
|
114 | public function getAttribute() |
|
115 | { |
|
116 | return function ($next, $value, $args) { |
|
117 | $key = $args->get('key'); |
|
118 | ||
119 | if ($this->hasMapping($key)) { |
|
120 | $value = $this->mapAttribute($key); |
|
121 | } |
|
122 | ||
123 | return $next($value, $args); |
|
124 | }; |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * Register hook on setAttribute method. |