Goetas\Xsd\XsdToPhp\Jms\YamlConverter::convert PHP Метод

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

public convert ( array $schemas )
$schemas array
    public function convert(array $schemas)
    {
        $visited = array();
        $this->classes = array();
        foreach ($schemas as $schema) {
            $this->navigate($schema, $visited);
        }
        return $this->getTypes();
    }

Usage Example

Пример #1
0
 public function testMissingClass()
 {
     $expectedItems = array('Epa\\Schema\\AdditionalIdentifier', 'Epa\\Schema\\AdditionalIdentifierType', 'Epa\\Schema\\AdditionalIdentifierTypes', 'Epa\\Schema\\AdditionalIdentifiers');
     $expectedItems = array_combine($expectedItems, $expectedItems);
     $reader = new SchemaReader();
     $schema = $reader->readFile(__DIR__ . '/data.xsd');
     $yamlConv = new YamlConverter(new ShortNamingStrategy());
     $yamlConv->addNamespace('', 'Epa\\Schema');
     $yamlItems = $yamlConv->convert([$schema]);
     $this->assertCount(count($expectedItems), $yamlItems);
     $this->assertEmpty(array_diff_key($expectedItems, $yamlItems));
     $phpConv = new PhpConverter(new ShortNamingStrategy());
     $phpConv->addNamespace('', 'Epa\\Schema');
     $phpClasses = $phpConv->convert([$schema]);
     $this->assertCount(count($expectedItems), $phpClasses);
     $this->assertEmpty(array_diff_key($expectedItems, $phpClasses));
     $yamlClass = $yamlItems['Epa\\Schema\\AdditionalIdentifier']['Epa\\Schema\\AdditionalIdentifier'];
     $yamlProperty = $yamlClass['properties']['additionalIdentifierType'];
     /** @var PHPClass $phpClass */
     $phpClass = $phpClasses['Epa\\Schema\\AdditionalIdentifier'];
     /** @var PHPProperty $phpProperty */
     $phpProperty = $phpClass->getProperty('additionalIdentifierType');
     /** @var PHPClass $phpType */
     $phpType = $phpProperty->getType();
     $this->assertSame($yamlProperty['type'], $phpType->getFullName());
 }
All Usage Examples Of Goetas\Xsd\XsdToPhp\Jms\YamlConverter::convert