malkusch\lock\util\Loop::end PHP Метод

end() публичный Метод

Notifies that this was the last iteration.
public end ( )
    public function end()
    {
        $this->looping = false;
    }

Usage Example

Пример #1
0
 /**
  * Tests that the code is executed more times.
  *
  * @test
  */
 public function testIteration()
 {
     $i = 0;
     $loop = new Loop();
     $loop->execute(function () use($loop, &$i) {
         $i++;
         if ($i > 1) {
             $loop->end();
         }
     });
     $this->assertEquals(2, $i);
 }