/** * Generates code from a given model * * @param GenerateableInterface $model * @return string the generated code */ public function generate(GenerateableInterface $model) { if ($this->config->getGenerateDocblock()) { $model->generateDocblock(); } return $this->strategy->generate($model); }
public function testGenerateChangedConstantOrder() { $strategy = new DefaultGeneratorStrategy(); $strategy->setConstantSortFunc(function ($a, $b) { return -1 * strcasecmp($a, $b); }); $strategy->setMethodSortFunc($func = function ($a, $b) { return strcasecmp($a->getName(), $b->getName()); }); $strategy->setPropertySortFunc($func); $this->assertEquals($this->getContent('GenerationTestClass_B.php'), $strategy->generate($this->getClass())); }