Coupon
1 year ago
Customer
1 month ago
Group
3 years ago
Order
1 month ago
Plan
1 month ago
Subscription
1 year ago
AbstractModel.php
3 years ago
FactoryInterface.php
3 years ago
ModelInterface.php
3 years ago
index.php
3 years ago
AbstractModel.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Membership\Models; |
| 4 | |
| 5 | abstract class AbstractModel |
| 6 | { |
| 7 | abstract public function exists(); |
| 8 | |
| 9 | public function __set($key, $value) |
| 10 | { |
| 11 | if (method_exists($this, "set_{$key}")) { |
| 12 | call_user_func([$this, "set_{$key}"], $value); |
| 13 | } else { |
| 14 | $this->$key = $value; |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | public function __get($key) |
| 19 | { |
| 20 | $value = false; |
| 21 | |
| 22 | if (method_exists($this, "get_{$key}")) { |
| 23 | $value = call_user_func([$this, "get_{$key}"]); |
| 24 | } elseif (isset($this->$key)) { |
| 25 | $value = $this->$key; |
| 26 | } |
| 27 | |
| 28 | return $value; |
| 29 | } |
| 30 | |
| 31 | public function __isset($key) |
| 32 | { |
| 33 | return $this->__get($key); |
| 34 | } |
| 35 | } |