for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of graze/unicontroller-client.
*
* Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
* @link https://github.com/graze/unicontroller-client
*/
namespace Graze\UnicontrollerClient\ClassGenerator\Generator;
use Graze\UnicontrollerClient\ClassGenerator\Generator\AbstractGenerator;
use Graze\UnicontrollerClient\ClassGenerator\Generator\GeneratorInterface;
use Graze\UnicontrollerClient\ClassGenerator\Definition\DefinitionProperty;
class GeneratorParser extends AbstractGenerator implements GeneratorInterface
{
const OUTPUT_PATH = 'src/Parser/Parser/Parser%s.php';
* @var array
private $properties = [];
* @param string $name
* @return string
public function generateClass($name)
return sprintf(
$this->getTemplate('Parser/ParserClass'),
$name,
implode(",\n", $this->properties),
$name
);
}
* @param DefinitionProperty $property
public function addProperty(DefinitionProperty $property)
$this->properties[] = sprintf(" '%s'", lcfirst($property->getName()));
public function getOutputPath($name)
return sprintf(self::OUTPUT_PATH, $name);