PlanFactory.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Membership\Models\Plan; |
| 4 | |
| 5 | use ProfilePress\Core\Membership\Models\FactoryInterface; |
| 6 | use ProfilePress\Core\Membership\Repositories\PlanRepository; |
| 7 | |
| 8 | class PlanFactory implements FactoryInterface |
| 9 | { |
| 10 | /** |
| 11 | * @param $data |
| 12 | * |
| 13 | * @return PlanEntity |
| 14 | */ |
| 15 | public static function make($data) |
| 16 | { |
| 17 | return new PlanEntity($data); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * @param $id |
| 22 | * |
| 23 | * @return PlanEntity |
| 24 | */ |
| 25 | public static function fromId($id) |
| 26 | { |
| 27 | return PlanRepository::init()->retrieve(absint($id)); |
| 28 | } |
| 29 | } |