| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | trait IpTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @param $name |
||
| 9 | * @return mixed |
||
| 10 | * @throws \Exception |
||
| 11 | */ |
||
| 12 | public function __get($name) |
||
| 13 | { |
||
| 14 | if (method_exists($this, $name)) { |
||
| 15 | return $this->$name(); |
||
| 16 | } |
||
| 17 | |||
| 18 | foreach (array('get', 'to') as $prefix) { |
||
| 19 | $method = $prefix . ucfirst($name); |
||
| 20 | if (method_exists($this, $method)) { |
||
| 21 | return $this->$method(); |
||
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | throw new \Exception(sprintf('%s is an undefined property', $name)); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param $name |
||
| 30 | * @param $value |
||
| 31 | * @throws \Exception |
||
| 32 | */ |
||
| 33 | public function __set($name, $value) |
||
| 42 | } |
||
| 43 | |||
| 45 |