MatthiasMullie\Scrapbook\Scale\Shard::getShards PHP Method

getShards() protected method

Get a [KeyValueStore => array of cache keys] map (SplObjectStorage) for multiple cache keys.
protected getShards ( array $keys ) : SplObjectStorage
$keys array
return SplObjectStorage
    protected function getShards(array $keys)
    {
        $shards = new SplObjectStorage();
        foreach ($keys as $key) {
            $shard = $this->getShard($key);
            if (!isset($shards[$shard])) {
                $shards[$shard] = array();
            }
            $shards[$shard] = array_merge($shards[$shard], array($key));
        }
        return $shards;
    }