mnapoli / assembly

[EXPERIMENTAL] Implementation of container-interop/definition-interop
MIT License
7 stars 5 forks source link

Chaining method and create reference from definition #2

Closed Guillaume-Rossignol closed 9 years ago

Guillaume-Rossignol commented 9 years ago

Add some syntaxic sugar to permit :

<?php
$fooInstance = new \Assembly\InstanceDefinition('fooInstance', 'foo');
$xmlClient
    ->addConstructorArgument(2)
    ->addPropertyAssignment(new \Assembly\PropertyAssignment('property', 'value'))
    ->addMethodCall(new \Assembly\MethodCall('method', ['argument']))
;

$barInstance = new \Assembly\InstanceDefinition('barInstace', 'bar');
$barInstance
    ->addConstructorArgument($fooInstance->createReference())
    ->addConstructorArgument('argument')
;