コード例 #1
0
 public function testBefore()
 {
     $salary = 0;
     $askForRaise = function () use(&$salary) {
         return ++$salary;
     };
     $monthlyMeeting = Functions::before(3, $askForRaise);
     $monthlyMeeting();
     $monthlyMeeting();
     // $salary = 2
     $monthlyMeeting();
     // memoized
     $this->assertEquals(2, $salary);
 }
コード例 #2
0
 /**
  * Removes all falsey values.
  *
  * @param Collection $collection
  * @return Collection
  */
 public function __invoke($collection)
 {
     $filter = new FilterMutator();
     return $filter($collection, Functions::nop());
 }