protected function fetchMockResponse(){
        if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
            $this->log("Attempted to retrieve mock responses, but no mock responses present",'Warning');
            return false;
        }
        if(!array_key_exists($this->mockIndex, $this->mockFiles)){
            $this->log("End of Mock List, resetting to 0");
            $this->resetMock();
        }
        if (!is_numeric($this->mockFiles[$this->mockIndex])){
            $this->log("fetchMockResponse only works with response code numbers",'Warning');
            return false;
        }
        
        $r = array();
        $r['head'] = 'HTTP/1.1 200 OK';
        $r['body'] = '<?xml version="1.0"?><root></root>';
        $r['code'] = $this->mockFiles[$this->mockIndex];
        $this->mockIndex++;
        if ($r['code'] == 200){
            $r['answer'] = 'OK';
            $r['ok'] = 1;
        } else if ($r['code'] == 404){
            $r['answer'] = 'Not Found';
            $r['error'] = 'Not Found';
            $r['ok'] = 0;
        } else if ($r['code'] == 503){
            $r['answer'] = 'Service Unavailable';
            $r['error'] = 'Service Unavailable';
            $r['ok'] = 0;
        } else if ($r['code'] == 400){
            $r['answer'] = 'Bad Request';
            $r['error'] = 'Bad Request';
            $r['ok'] = 0;
        }
        
        if ($r['code'] != 200){
            $r['body'] = '<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
  <Error>
    <Type>Sender</Type>
    <Code>'.$r['error'].'</Code>
    <Message>'.$r['answer'].'</Message>
  </Error>
  <RequestID>123</RequestID>
</ErrorResponse>';
        }
        
        
        $r['headarray'] = array();
        $this->log("Returning Mock Response: ".$r['code']);
        return $r;
    }
protected function fetchMockResponse(){
        if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
            $this->log("Attempted to retrieve mock responses, but no mock responses present",'Warning');
            return false;
        }
        if(!array_key_exists($this->mockIndex, $this->mockFiles)){
            $this->log("End of Mock List, resetting to 0");
            $this->resetMock();
        }
        if (!is_numeric($this->mockFiles[$this->mockIndex])){
            $this->log("fetchMockResponse only works with response code numbers",'Warning');
            return false;
        }
        
        $r = array();
        $r['head'] = 'HTTP/1.1 200 OK';
        $r['body'] = '<?xml version="1.0"?><root></root>';
        $r['code'] = $this->mockFiles[$this->mockIndex];
        $this->mockIndex++;
        if ($r['code'] == 200){
            $r['answer'] = 'OK';
            $r['ok'] = 1;
        } else if ($r['code'] == 404){
            $r['answer'] = 'Not Found';
            $r['error'] = 'Not Found';
            $r['ok'] = 0;
        } else if ($r['code'] == 503){
            $r['answer'] = 'Service Unavailable';
            $r['error'] = 'Service Unavailable';
            $r['ok'] = 0;
        } else if ($r['code'] == 400){
            $r['answer'] = 'Bad Request';
            $r['error'] = 'Bad Request';
            $r['ok'] = 0;
        }
        
        if ($r['code'] != 200){
            $r['body'] = '<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
  <Error>
    <Type>Sender</Type>
    <Code>'.$r['error'].'</Code>
    <Message>'.$r['answer'].'</Message>
  </Error>
  <RequestID>123</RequestID>
</ErrorResponse>';
        }
        
        
        $r['headarray'] = array();
        $this->log("Returning Mock Response: ".$r['code']);
        return $r;
    }
protected function fetchMockResponse ( ) { if ( ! is_array ( $ this -> mockFiles ) || ! array_key_exists ( 0 , $ this -> mockFiles ) ) { $ this -> log ( "Attempted to retrieve mock responses, but no mock responses present" , 'Warning' ) ; return false ; } if ( ! array_key_exists ( $ this -> mockIndex , $ this -> mockFiles ) ) { $ this -> log ( "End of Mock List, resetting to 0" ) ; $ this -> resetMock ( ) ; } if ( ! is_numeric ( $ this -> mockFiles [ $ this -> mockIndex ] ) ) { $ this -> log ( "fetchMockResponse only works with response code numbers" , 'Warning' ) ; return false ; } $ r = array ( ) ; $ r [ 'head' ] = 'HTTP/1.1 200 OK' ; $ r [ 'body' ] = '<?xml version="1.0"?><root></root>' ; $ r [ 'code' ] = $ this -> mockFiles [ $ this -> mockIndex ] ; $ this -> mockIndex ++ ; if ( $ r [ 'code' ] == 200 ) { $ r [ 'answer' ] = 'OK' ; $ r [ 'ok' ] = 1 ; } else if ( $ r [ 'code' ] == 404 ) { $ r [ 'answer' ] = 'Not Found' ; $ r [ 'error' ] = 'Not Found' ; $ r [ 'ok' ] = 0 ; } else if ( $ r [ 'code' ] == 503 ) { $ r [ 'answer' ] = 'Service Unavailable' ; $ r [ 'error' ] = 'Service Unavailable' ; $ r [ 'ok' ] = 0 ; } else if ( $ r [ 'code' ] == 400 ) { $ r [ 'answer' ] = 'Bad Request' ; $ r [ 'error' ] = 'Bad Request' ; $ r [ 'ok' ] = 0 ; } if ( $ r [ 'code' ] != 200 ) { $ r [ 'body' ] = '<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
  <Error>
    <Type>Sender</Type>
    <Code>' . $ r [ 'error' ] . '</Code>
    <Message>' . $ r [ 'answer' ] . '</Message>
  </Error>
  <RequestID>123</RequestID>
</ErrorResponse>' ; } $ r [ 'headarray' ] = array ( ) ; $ this -> log ( "Returning Mock Response: " . $ r [ 'code' ] ) ; return $ r ; }
Generates a fake HTTP response using the mock file list.

This method uses the response codes in the mock file list to generate an
HTTP response. The success or failure of this operation will be recorded
in the log, including the response code returned. This is only used by
a few operations. The response array will contain the following fields:
<ul>
<li><b>head</b> - ignored, but set for the sake of completion</li>
<li><b>body</b> - empty XML, also ignored</li>
<li><b>code</b> - the response code fetched from the list</li>
<li><b>answer</b> - answer message</li>
<li><b>error</b> - error message, same value as answer, not set if status is 200</li>
<li><b>ok</b> - 1 or 0, depending on if the status is 200</li>
</ul>
@return boolean|array An array containing the HTTP response, or simply
the value <b>FALSE</b> if the response could not be found or does not
match the list of valid responses.
Generates a fake HTTP response using the mock file list .