for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace devtoolboxuk\internetaddress;
trait IpTrait
{
/**
* @param $name
* @return mixed
* @throws \Exception
*/
public function __get($name)
if (method_exists($this, $name)) {
return $this->$name();
}
foreach (array('get', 'to') as $prefix) {
$method = $prefix . ucfirst($name);
if (method_exists($this, $method)) {
return $this->$method();
throw new \Exception(sprintf('%s is an undefined property', $name));
* @param $value
public function __set($name, $value)
$method = 'set' . ucfirst($name);
$this->$method($value);
return;