Finish any pending activity for this job.

@param array $items
@return bool
549959
public function flush(array $items = [])
    {
        if (! $this->callFunc($items)) {
            $this->handleFailure($this->id, $items);
            return false;
        }
        return true;
    }
243816
private static function result($items)
    {
        if ($items instanceof SuggestResult) {
            return $items->toArray();
        }

        $sr = new SuggestResult($items);

        return $sr->toArray();
    }
850338
public function finish(array $items = []): bool
    {
        $changed = false;

        foreach ($items as $key => $value) {
            $serialized = \serialize($value);

            if (! $this->check($key, $serialized)) {
                $changed = true;

                try {
                    $this->saving($key, $serialized, $this->isNewKey($key));
                } catch (PDOException $e) {
                    // Should be able to ignore failure since it is possible that
                    // the request is done on a read only connection.
                }
            }
        }

        if ($changed && $this->cache instanceof Repository) {
            $this->cache->forget($this->cacheKey);
        }

        return true;
    }
163479
protected function _anyItem($items, $key)
    {
        foreach ($items as $item) {
            if (isset($item[$key]) && $item[$key]) {
                return true;
            }
        }
        return false;
    }
431042
public function hasIn(array $items = [])
    {
        if (\is_null($slug = $this->slug)) {
            return isset($items[$this->value]);
        }

        return isset($items[$slug]);
    }
183527
private function checkItems($items)
    {
        foreach ($items as $item) {
            if ($this->isItemValid($item)) {
                continue;
            }

            throw new \InvalidArgumentException(sprintf(
                'At least one item in collection "%s" is invalid.',
                get_class($this)
            ));
        }
    }
170223
public function replace(array $items = [])
    {
        $this->items = [];

        foreach ($items as $key => $item) {
            $this->set($key, $item);
        }
    }
1321515
public function append($items)
    {
        if ($items instanceof static) {
            $items = $items->toArray();
        }
        $this->items = array_merge($this->items, (array)$items);

        return $this;
    }
498941
public function progress_bar(array $items) {
        foreach ($items as &$item) {
            $text = $item['text'];
            unset($item['text']);
            if (array_key_exists('link', $item)) {
                $link = $item['link'];
                unset($item['link']);
                $item = html_writer::link($link, $text, $item);
            } else {
                $item = html_writer::tag('span', $text, $item);
            }
        }
        return html_writer::tag('div', join(get_separator(), $items), array('class' => 'backup_progress clearfix'));
    }
1303152
public function finalizeRows()
    {
        // Fix rows LOOP_TOTAL if parseResults() did not added all resultsCollection items to the collection array
        // see https://github.com/thelia/thelia/issues/2337
        if (true === $this->countable && $this->getResultDataCollectionCount() !== $realCount = $this->getCount()) {
            foreach ($this->collection as &$item) {
                $item->set('LOOP_TOTAL', $realCount);
            }
        }
    }
608691
protected function processItems(array $items)
    {
        $processedItems = [];

        foreach ($items as $entry) {
            if (isset($entry['metadata']) && is_array($entry['metadata'])) {
                $processedItems[] = new SearchResult($entry);
            }
        }

        $this->items = new ModelCollection($processedItems);
    }
65440
private function hasFinishedSuccessfullyAsync($finalizeResponse)
    {
        // Again using an Iterator function to generate the threads.
        $promises = $this->pollStatusIterator($finalizeResponse);
        $eachPromises = new Promise\EachPromise($promises, [
            'concurrency' => 1,
            'fulfilled' => function ($pollStatus, $i, $promise) {
                if ($pollStatus != null) {
                    if (!empty($pollStatus['itemsDone'])) {
                        $promise->resolve($pollStatus['itemsDone']);
                    }
                    if (!empty($pollStatus['itemsFailed'])) {
                        $promise->resolve(false);
                    }
                }
                return false;
            }
        ]);
        return $eachPromises->promise();
    }
984363
public function updateCartPrices($items)
    {
        // set prices to changed
        $hasChanged = $this->priceCalculation->setPricesOfChanged($items);
        if ($hasChanged) {
            $this->em->flush();
        }

        return $hasChanged;
    }
285776
public function finishProcessing(\ArrayObject $jobs)
    {
        foreach ($jobs as $job) {
            $job->setStatus(JobInterface::STATUS_ACTIVE);
        }

        $this->em->flush();

        return $this;
    }
1143659
public function process(array $items)
    {
        $total = count($items);
        for ($i = 1; $i < $total; $i++) {
            for ($j = 0; $j < $total - $i; $j++) {
                if (!$items[$j]->getDate() || !$items[$j + 1]->getDate()) {
                    continue;
                }
                if ($items[$j]->getDate()->getTimestamp() > $items[$j + 1]->getDate()->getTimestamp()) {
                    continue;
                }
                $aux = $items[$j + 1];
                $items[$j + 1] = $items[$j];
                $items[$j] = $aux;
            }
        }

        return $items;
    }
1040285
public function merge($items)
    {
        if ($items instanceof ArrayInterface) {
            $this->items = array_merge($this->items, $items->all());
        } else {
            $this->items = array_merge($this->items, $items);
        }

        return $this;
    }
1166136
protected function processItems(array $items)
    {
        $processedItems = [];

        foreach ($items as $entry) {
            $processedItems[] = new Account($entry);
        }

        return $processedItems;
    }