public function TraversablePatch::apply in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php \Prophecy\Doubler\ClassPatch\TraversablePatch::apply()
Forces class to implement Iterator interface.
Parameters
ClassNode $node:
Overrides ClassPatchInterface::apply
File
- vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ ClassPatch/ TraversablePatch.php, line 63
Class
- TraversablePatch
- Traversable interface patch. Forces classes that implement interfaces, that extend Traversable to also implement Iterator.
Namespace
Prophecy\Doubler\ClassPatchCode
public function apply(ClassNode $node) {
$node
->addInterface('Iterator');
$node
->addMethod(new MethodNode('current'));
$node
->addMethod(new MethodNode('key'));
$node
->addMethod(new MethodNode('next'));
$node
->addMethod(new MethodNode('rewind'));
$node
->addMethod(new MethodNode('valid'));
}