/** * 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; }
/** * 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]); }
/** * 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; }
/** * 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); }
/** * 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); }