Skip to content

Commit

Permalink
Add refresh method
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed May 23, 2016
1 parent 4d702ca commit ef515b5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/ResourceGenerator.php
Expand Up @@ -181,6 +181,27 @@ protected function createExtendingClass(string $type, array $yaml)
$class = $factory->class($yaml['class'])
->extend('Base' . $yaml['class']);

$class->addStmt($factory->method('refresh')
->makePublic()
->setReturnType($yaml['class'])
->addStmt(
new Node\Stmt\Return_(
new Node\Expr\MethodCall(
new Node\Expr\Variable('this'),
'wait',
[
new Node\Expr\MethodCall(
new Node\Expr\Variable('this'),
'callAsync',
[
new Node\Scalar\String_('refresh'),
]
),
]
)
)
));

$node = $factory->namespace($yaml['namespace'] . '\\' . $type )
->addStmt($factory->use($yaml['namespace'] . '\\' . $yaml['class'])->as('Base' . $yaml['class']))
->addStmt($class)
Expand Down

0 comments on commit ef515b5

Please sign in to comment.