connection = new Connection($server, $port, $username, $password, $user); $this->connection->login(); } /** * @param $conection */ public function setConnection($conection) { $this->connection = $conection; } /** * @return Connection */ public function getConnection() { return $this->connection; } /** * * return repository manager * @return Repository */ public function repository() { if(!$this->repository) { $this->repository = new Repository($this); } return $this->repository; } /** * @return Services */ public function service() { if(!$this->service) { $this->service = new Services($this); } return $this->service; } /** * @param $name * @return mixed * @throws \Exception */ public function __get($name) { if(!$this->getStorage()->exists(strtolower($name))) { $class = '\\ThurData\\Servers\\KerioEmail\\App\\Libs\\Kerio\\Components\\Api\\Soap\\Actions\\'.ucfirst($name); if(!class_exists($class)) { throw new \Exception('Action class '.$class.' does not exists'); } $action = new $class($this->connection); $this->getStorage()->set(strtolower($name), $action); }else{ $action = $this->getStorage()->get(strtolower($name)); } return $action; } }