private function fetchUser($username, $password)
    {
        if (!empty($username) && !empty($password) && is_numeric($this->userId)) {

            //Create login post data
            $data = array(
                'username' => $username,
                'password' => $password
            );

            //Json handler
            $response = new Helper\Response();

            //Make Curl
            $result = $this->curl->request('POST', rtrim(AD_INTEGRATION_URL, "/") . '/user/current', $data, 'json', array('Content-Type: application/json'));

            //Is curl error
            if(is_wp_error($result)) {
                return false; 
            }

            //Is json error
            if ($response::isJsonError($result)) {
                return false;
            }

            //Decode
            $result = json_decode($result);

            //Return result
            if (is_array($result)) {
                $result = array_pop($result);
            }

            return $result;
        }

        return false;
    }
private function fetchUser($username, $password)
    {
        if (!empty($username) && !empty($password) && is_numeric($this->userId)) {

            //Create login post data
            $data = array(
                'username' => $username,
                'password' => $password
            );

            //Json handler
            $response = new Helper\Response();

            //Make Curl
            $result = $this->curl->request('POST', rtrim(AD_INTEGRATION_URL, "/") . '/user/current', $data, 'json', array('Content-Type: application/json'));

            //Is curl error
            if(is_wp_error($result)) {
                return false; 
            }

            //Is json error
            if ($response::isJsonError($result)) {
                return false;
            }

            //Decode
            $result = json_decode($result);

            //Return result
            if (is_array($result)) {
                $result = array_pop($result);
            }

            return $result;
        }

        return false;
    }
private function fetchUser ( $ username , $ password ) { if ( ! empty ( $ username ) && ! empty ( $ password ) && is_numeric ( $ this -> userId ) ) { //Create login post data $ data = array ( 'username' => $ username , 'password' => $ password ) ; //Json handler $ response = new Helper \ Response ( ) ; //Make Curl $ result = $ this -> curl -> request ( 'POST' , rtrim ( AD_INTEGRATION_URL , "/" ) . '/user/current' , $ data , 'json' , array ( 'Content-Type: application/json' ) ) ; //Is curl error if ( is_wp_error ( $ result ) ) { return false ; } //Is json error if ( $ response :: isJsonError ( $ result ) ) { return false ; } //Decode $ result = json_decode ( $ result ) ; //Return result if ( is_array ( $ result ) ) { $ result = array_pop ( $ result ) ; } return $ result ; } return false ; }
Get information from the api-service
@return object / false
Get information from the api - service