*/ namespace NoccyLabs\Gpio\Bus; abstract class Bus implements BusInterface { protected $pins = array(); public function __construct() { $this->configure(); } public function addPin($name) { $this->pins[$name] = null; } public function __set($name, $value) { if (!array_key_exists($name,$this->pins)) { throw new \Exception("No such pin: {$name}"); } $this->pins[$name] = $value; } public function __get($name) { if (!array_key_exists($name,$this->pins)) { throw new \Exception("No such pin: {$name}"); } return $this->pins[$name]; } public function __isSet($name) { return array_key_exists($name,$this->pins); } public function __unset($name) { if (!array_key_exists($name,$this->pins)) { return; } $this->pins[$name] = null; } }