예제 #1
0
 /**
  * apply operation to list
  *
  * @param Collection $c
  * @return Collection
  */
 public function apply($c) : Collection
 {
     $_func = $this->func;
     foreach ($c->generate() as $key => $item) {
         $_func($item, $key, $c);
     }
     return $c;
 }
예제 #2
0
 /**
  * apply operation to list
  *
  * @param Collection $c
  * @return Collection
  */
 public function apply($c) : Collection
 {
     $_func = $this->func;
     $acc = $this->acc;
     foreach ($c->rgenerate() as $key => $item) {
         $acc = $_func($acc, $item, $key, $c);
     }
     return new Collection([$acc]);
 }
예제 #3
0
 /**
  * apply operation to list
  *
  * @param Collection $c
  * @return Collection
  */
 public function apply($c) : Collection
 {
     $_func = $this->func;
     $newCollection = new Collection();
     foreach ($c->generate() as $item) {
         $newCollection->append($_func($item));
     }
     return $newCollection;
 }
예제 #4
0
 /**
  * apply operation to list
  *
  * @param Collection $c
  * @return Collection
  */
 public function apply($c) : Collection
 {
     $a = $c->toArray();
     asort($a, $this->sort_flags);
     return new Collection($a);
 }
예제 #5
0
 /**
  * apply operation to list
  *
  * @param Collection $c
  * @return Collection
  */
 public function apply($c) : Collection
 {
     $a = $c->toArray();
     uasort($a, $this->compare_func);
     return new Collection($a);
 }