FluidXml\FluidXml::load PHP Method

load() public static method

public static load ( $document )
    public static function load($document)
    {
        $file = $document;
        $document = \file_get_contents($file);
        // file_get_contents() returns false in case of error.
        if (!$document) {
            throw new \Exception("File '{$file}' not accessible.");
        }
        return (new FluidXml(null))->addChild($document);
    }

Usage Example

 /**
  * @dataProvider data_provider
  * @param array $questionsAndAnswers
  * @param string $xpath
  * @param int $expectedCount
  */
 public function test_factory_question(array $questionsAndAnswers, $xpath, $expectedCount)
 {
     foreach ($questionsAndAnswers as $question => $answer) {
         $this->mock_question_helper($question, $answer);
     }
     $xml = $this->call_create_on_sut();
     $fluidXml = FluidXml::load($xml);
     $results = $fluidXml->query($xpath);
     self::assertCount($expectedCount, $results);
 }
All Usage Examples Of FluidXml\FluidXml::load