hiqdev /
billing-hiapi
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * API for Billing |
||
| 4 | * |
||
| 5 | * @link https://github.com/hiqdev/billing-hiapi |
||
| 6 | * @package billing-hiapi |
||
| 7 | * @license BSD-3-Clause |
||
| 8 | * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/) |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace hiqdev\billing\hiapi\action; |
||
| 12 | |||
| 13 | use hiqdev\php\billing\action\ActionState; |
||
| 14 | use hiqdev\yii\DataMapper\hydrator\GeneratedHydrator; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * ActionState Hydrator. |
||
| 18 | * |
||
| 19 | * @author Andrii Vasyliev <[email protected]> |
||
| 20 | */ |
||
| 21 | class ActionStateHydrator extends GeneratedHydrator |
||
| 22 | { |
||
| 23 | public function hydrate(array $data, $object) |
||
| 24 | { |
||
| 25 | return ActionState::fromString($data['state'] ?? reset($data)); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param ActionState $object |
||
| 30 | */ |
||
| 31 | public function extract($object) |
||
| 32 | { |
||
| 33 | return $object->getName(); |
||
|
0 ignored issues
–
show
|
|||
| 34 | } |
||
| 35 | } |
||
| 36 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: