public function getRemoteRepository() { if (!$this->repo) { $this->repo = new SharePointClient(); } if (!$this->repo->isConnected()) { // connect away $this->repo->connect($this->SharePointUrl, $this->SharePointUser, $this->SharePointPass); } return $this->repo; }