Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (23 sloc) 0.623 kb
<?php
namespace FOQ\TyperBundle;
use Symfony\Component\Yaml\Parser;
/**
* Generates code for a class or an interface
*
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
*/
class Generator
{
public function generateFile($file)
{
$parser = new Parser();
$fileContent = file_get_contents($file);
$configArray = array_merge(array(
'file' => $file
), $parser->parse($fileContent));
$config = new ClassDefinition($configArray);
$typer = new Typer($config);
$code = $typer->write();
file_put_contents($file, $code);
}
}
Jump to Line
Something went wrong with that request. Please try again.