You are here

public function TraversablePatch::apply in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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\ClassPatch

Code

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'));
}