PhpBench\Serializer\XmlDecoder::decode PHP Метод

decode() публичный Метод

Decode a PHPBench XML document into a SuiteCollection.
public decode ( PhpBench\Dom\Document $document ) : SuiteCollection
$document PhpBench\Dom\Document
Результат PhpBench\Model\SuiteCollection
    public function decode(Document $document)
    {
        $suites = [];
        foreach ($document->query('//suite') as $suiteEl) {
            $suites[] = $this->processSuite($suiteEl);
        }
        return new SuiteCollection($suites);
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function restore(OutputInterface $output)
 {
     $driver = $this->storageRegistry->getService();
     $iterator = new \DirectoryIterator($this->archivePath);
     $files = $this->filterFiles($iterator);
     $totalCount = count($files);
     $files = $this->filterExisting($driver, $files);
     $count = count($files);
     $output->writeln(sprintf('Restoring %s of %s suites.', $count, $totalCount));
     foreach ($files as $index => $file) {
         $this->writeProgress($output, $index, $count, '.');
         $document = new Document();
         $document->load($file->getPathname());
         $collection = $this->xmlDecoder->decode($document);
         $driver->store($collection);
     }
     $output->write(PHP_EOL);
 }
All Usage Examples Of PhpBench\Serializer\XmlDecoder::decode