/**
     * @param SchemaRdfaData $schemaData
     */
    public function write(SchemaRdfaData $schemaData)
    {
        foreach ($schemaData->getClassesWithPropertyNames() as $class) {
            $className = $class->name;
            $methods = [];
            if (!empty($class->properties)) {
                foreach ($class->properties as $property) {
                    $propertyName = $property['name'];
                    $propertyNameMethodName = $propertyName;
                    $propertyNameMethodName[0] = strtoupper($propertyNameMethodName[0]);
                    if (empty($usableProperties[$propertyNameMethodName])) {
                        $methods[$propertyName] = <<<PHP
    public function test{$propertyNameMethodName}WillReturnMappingObject()
    {
        \$this->assertInstanceOf(Mapping::class, {$className}::{$propertyName}());
    }
PHP;
                    }
                }
            }
            ksort($methods, SORT_REGULAR);
            $methods = implode("\n\n", $methods);
            $schemaData = (array) $class;
            $phpCode = <<<PHP
<?php
/**
 * Author: Nil Portugués Calderó <*****@*****.**>
 * Date: 12/18/15
 * Time: 11:36 PM.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace NilPortugues\\Tests\\SchemaOrg\\Classes;

use NilPortugues\\SchemaOrg\\Classes\\{$schemaData['name']};
use NilPortugues\\SchemaOrg\\Mapping;

/**
 * Classes {$schemaData['name']}Test
 * @package NilPortugues\\Tests\\SchemaOrg\\Classes
 */
class {$schemaData['name']}Test extends \\PHPUnit_Framework_TestCase
{
    public function testSchemaUrlReturnsExpectedUrl()
    {
        \$this->assertEquals({$schemaData['name']}::schemaUrl(), "{$schemaData['url']}");
    }

{$methods}
}
PHP;
            $this->fileSystem->write($this->savePath . DIRECTORY_SEPARATOR . $className . 'Test.php', $phpCode);
        }
    }
    /**
     * @param SchemaRdfaData $schemaData
     */
    public function write(SchemaRdfaData $schemaData)
    {
        foreach ($schemaData->getProperties() as $property) {
            $className = $property['name'];
            $className[0] = strtoupper($className[0]);
            $allowed = [];
            foreach ($property['usedOnClass'] as $belongs) {
                if ('Type' === substr($belongs, -4)) {
                    $belongs = substr($belongs, 0, -4);
                }
                $allowed[] = "\t\t'" . 'http://schema.org/' . $belongs . "'";
            }
            $allowed = implode(",\n", $allowed);
            $phpPropertyCode = <<<PHP
<?php
/**
 * Author: Nil Portugués Calderó <*****@*****.**>
 * Date: 12/18/15
 * Time: 11:36 PM.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace NilPortugues\\SchemaOrg\\Properties;

use NilPortugues\\SchemaOrg\\SchemaProperty;

/**
 * {$property['doc']}
 */
class {$className}Property extends SchemaProperty
{
    const SCHEMA_URL = "{$property['url']}";
    const PROPERTY_NAME = "{$property['name']}";

    /**
     * A list of schemas allowed to use this property.
     *
     * @var array
     */
    protected static \$allowedSchemas = [
{$allowed}
    ];
}
PHP;
            $this->fileSystem->write($this->savePath . DIRECTORY_SEPARATOR . $className . 'Property.php', $phpPropertyCode);
        }
    }
    /**
     * @param SchemaRdfaData $schemaData
     */
    public function write(SchemaRdfaData $schemaData)
    {
        foreach ($schemaData->getClassesWithPropertyNames() as $class) {
            $className = $class->name;
            $methods = [];
            $usableProperties = [];
            $dynamicCall = [];
            $useProperties = [];
            if (!empty($class->properties)) {
                foreach ($class->properties as $propertyClassName => $property) {
                    $propertyName = $property['name'];
                    $parentClassName = $property['parent'];
                    $propertyNameMethodName = $propertyName;
                    $propertyNameMethodName[0] = strtoupper($propertyNameMethodName[0]);
                    $dynamicCall[] = ' * @method static \\NilPortugues\\SchemaOrg\\Properties\\' . $propertyNameMethodName . 'Property ' . $propertyName . '()';
                    if (empty($usableProperties[$propertyNameMethodName])) {
                        $usableProperties[$propertyNameMethodName] = $propertyClassName;
                        $schemaClass = '\\NilPortugues\\SchemaOrg\\Classes\\' . $className;
                        if ($parentClassName !== $className) {
                            $schemaClass = '\\NilPortugues\\SchemaOrg\\Classes\\' . $parentClassName;
                        }
                        $methods[$propertyName] = "\t\t'{$propertyName}' => [\n\t\t\t'propertyClass' => '\\NilPortugues\\SchemaOrg\\Properties\\{$propertyNameMethodName}Property',\n\t\t\t'schemaClass' => '{$schemaClass}',\n\t\t],";
                    }
                }
            }
            $useProperties[] = 'use NilPortugues\\SchemaOrg\\Mapping;';
            $useProperties[] = 'use NilPortugues\\SchemaOrg\\SchemaClass;';
            sort($useProperties, SORT_REGULAR);
            $useProperties = implode("\n", array_unique($useProperties));
            ksort($methods, SORT_REGULAR);
            $methods = implode("\n", $methods);
            $dynamicCall = implode("\n", $dynamicCall);
            $schemaData = (array) $class;
            $phpCode = <<<PHP
<?php
/**
 * Author: Nil Portugués Calderó <*****@*****.**>
 * Date: 12/18/15
 * Time: 11:36 PM.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace NilPortugues\\SchemaOrg\\Classes;

{$useProperties}

/**
 * METHODSTART.
{$dynamicCall}
 * METHODEND.
 *
 * {$schemaData['doc']}
 */
class {$schemaData['name']} extends SchemaClass
{
    /**
     * @var string
     */
    protected static \$schemaUrl = "{$schemaData['url']}";

    /**
     * @var array
     */
    protected static \$supportedMethods = [
{$methods}
    ];
}
PHP;
            $this->fileSystem->write($this->savePath . DIRECTORY_SEPARATOR . $className . '.php', $phpCode);
        }
    }