Oara\Network\Publisher\CommissionJunction::checkConnection PHP Method

checkConnection() public method

public checkConnection ( ) : boolean
return boolean
    public function checkConnection()
    {
        $connection = true;
        $cookieMap = array();
        $cookieContent = $this->_client->getCookies();
        $cookieArray = \explode("\n", $cookieContent);
        for ($i = 4; $i < \count($cookieArray); $i++) {
            $cookieValue = \explode("\t", $cookieArray[$i]);
            if (\count($cookieValue) == 7) {
                $cookieMap[$cookieValue[\count($cookieValue) - 2]] = $cookieValue[\count($cookieValue) - 1];
            }
        }
        if (isset($cookieMap["jsContactId"])) {
            $this->_memberId = $cookieMap["jsContactId"];
        } else {
            return false;
        }
        if (isset($cookieMap["jsCompanyId"])) {
            $this->_accountId = $cookieMap["jsCompanyId"];
        } else {
            return false;
        }
        $result = self::apiCall('https://commission-detail.api.cj.com/v3/commissions?date-type=event');
        if (\preg_match("/error/", $result)) {
            return false;
        }
        return $connection;
    }