Functional\Tests\MemoizeTest::invoke PHP Method

invoke() public static method

public static invoke ( $name )
    public static function invoke($name)
    {
        if (self::$invocation > 0) {
            throw new BadMethodCallException(sprintf('%s called more than once', $name));
        }
        self::$invocation++;
        return self::$invocation;
    }

Usage Example

 public function testMemoizeClosureCall()
 {
     $closure = function () {
         return 'CLOSURE VALUE' . MemoizeTest::invoke('Closure');
     };
     $this->assertSame('CLOSURE VALUE1', memoize($closure));
     $this->assertSame('CLOSURE VALUE1', memoize($closure));
     $this->assertSame('CLOSURE VALUE1', memoize($closure));
 }