protected function fetchMockFile($load = true){
        if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
            $this->log("Attempted to retrieve mock files, but no mock files present",'Warning');
            return false;
        }
        if(!array_key_exists($this->mockIndex, $this->mockFiles)){
            $this->log("End of Mock List, resetting to 0");
            $this->resetMock();
        }
        //check for absolute/relative file paths
        if (strpos($this->mockFiles[$this->mockIndex], '/') === 0 || strpos($this->mockFiles[$this->mockIndex], '..') === 0){
            $url = $this->mockFiles[$this->mockIndex];
        } else {
            $url = 'mock/'.$this->mockFiles[$this->mockIndex];
        }
        $this->mockIndex++;
        
        
        if(file_exists($url)){
            
            try{
                $this->log("Fetched Mock File: $url");
                if ($load){
                    $return = simplexml_load_file($url);
                } else {
                    $return = file_get_contents($url);
                }
                return $return;
            } catch (Exception $e){
                $this->log("Error when opening Mock File: $url - ".$e->getMessage(),'Warning');
                return false;
            }
            
        } else {
            $this->log("Mock File not found: $url",'Warning');
            return false;
        }
        
    }
protected function fetchMockFile($load = true){
        if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
            $this->log("Attempted to retrieve mock files, but no mock files present",'Warning');
            return false;
        }
        if(!array_key_exists($this->mockIndex, $this->mockFiles)){
            $this->log("End of Mock List, resetting to 0");
            $this->resetMock();
        }
        //check for absolute/relative file paths
        if (strpos($this->mockFiles[$this->mockIndex], '/') === 0 || strpos($this->mockFiles[$this->mockIndex], '..') === 0){
            $url = $this->mockFiles[$this->mockIndex];
        } else {
            $url = 'mock/'.$this->mockFiles[$this->mockIndex];
        }
        $this->mockIndex++;
        
        
        if(file_exists($url)){
            
            try{
                $this->log("Fetched Mock File: $url");
                if ($load){
                    $return = simplexml_load_file($url);
                } else {
                    $return = file_get_contents($url);
                }
                return $return;
            } catch (Exception $e){
                $this->log("Error when opening Mock File: $url - ".$e->getMessage(),'Warning');
                return false;
            }
            
        } else {
            $this->log("Mock File not found: $url",'Warning');
            return false;
        }
        
    }
protected function fetchMockFile ( $ load = true ) { if ( ! is_array ( $ this -> mockFiles ) || ! array_key_exists ( 0 , $ this -> mockFiles ) ) { $ this -> log ( "Attempted to retrieve mock files, but no mock files present" , 'Warning' ) ; return false ; } if ( ! array_key_exists ( $ this -> mockIndex , $ this -> mockFiles ) ) { $ this -> log ( "End of Mock List, resetting to 0" ) ; $ this -> resetMock ( ) ; } //check for absolute/relative file paths if ( strpos ( $ this -> mockFiles [ $ this -> mockIndex ] , '/' ) === 0 || strpos ( $ this -> mockFiles [ $ this -> mockIndex ] , '..' ) === 0 ) { $ url = $ this -> mockFiles [ $ this -> mockIndex ] ; } else { $ url = 'mock/' . $ this -> mockFiles [ $ this -> mockIndex ] ; } $ this -> mockIndex ++ ; if ( file_exists ( $ url ) ) { try { $ this -> log ( "Fetched Mock File: $url" ) ; if ( $ load ) { $ return = simplexml_load_file ( $ url ) ; } else { $ return = file_get_contents ( $ url ) ; } return $ return ; } catch ( Exception $ e ) { $ this -> log ( "Error when opening Mock File: $url - " . $ e -> getMessage ( ) , 'Warning' ) ; return false ; } } else { $ this -> log ( "Mock File not found: $url" , 'Warning' ) ; return false ; } }
Fetches the given mock file, or attempts to.

This method is only called when Mock Mode is enabled. This is where
files from the mock file list are retrieved and passed back to the caller.
The success or failure of the operation will be recorded in the log,
including the name and path of the file involved. For retrieving response
codes, see <i>fetchMockResponse</i>.
@param boolean $load [optional] <p>Set this to <b>FALSE</b> to prevent the
method from loading the file's contents into a SimpleXMLElement. This is
for when the contents of the file are not in XML format, or if you simply
want to retrieve the raw string of the file.</p>
@return SimpleXMLElement|string|boolean <p>A SimpleXMLElement holding the
contents of the file, or a string of said contents if <i>$load</i> is set to
<b>FALSE</b>. The return will be <b>FALSE</b> if the file cannot be
fetched for any reason.</p>
Fetches the given mock file or attempts to .