Oara\Network\Publisher\SkyParkSecure::checkConnection PHP Метод

checkConnection() публичный Метод

public checkConnection ( ) : boolean
Результат boolean
    public function checkConnection()
    {
        //If not login properly the construct launch an exception
        $connection = true;
        $urls = array();
        $urls[] = new \Oara\Curl\Request('http://agents.skyparksecure.com/bookings', array());
        $exportReport = $this->_client->get($urls);
        if (!\preg_match("/Logout/", $exportReport[0], $match)) {
            $connection = false;
        }
        //Getting APIKEY
        if ($connection) {
            if (!\preg_match("/self.api_key\\s*=\\s*'(.*)?';/", $exportReport[0], $match)) {
                $connection = false;
            } else {
                $this->_apiKey = $match[1];
            }
        }
        if ($connection) {
            if (!\preg_match("/self.agent\\s*=\\s*'(.*)?';self.date1/", $exportReport[0], $match)) {
                if (!\preg_match("/self.agent\\s*=\\s*'(.*)?';/", $exportReport[0], $match)) {
                    $connection = false;
                } else {
                    $this->_agent = $match[1];
                }
            } else {
                $this->_agent = $match[1];
            }
        }
        return $connection;
    }