Exemplo n.º 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;
 }
Exemplo n.º 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]);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }