Get a subset containing the provided keys with values from the input data.

@param array|mixed $keys

@return array
776589
public function only($keys)
    {
        $keys = is_array($keys) ? $keys : func_get_args();

        $results = [];

        $input = $this->all();

        foreach ($keys as $key) {
            Arr::set($results, $key, data_get($input, $key));
        }

        return $results;
    }
31079
public function just(array $keys = []): array
    {
        if (!is_array($keys) || !count($keys)) {
            return [];
        }
        $just = [];
        foreach ($this->public as $key => $value) {
            if (in_array($key, $keys)) {
                $just[$key] = $value;
            }
        }
        return $just;
    }
463891
public function pick($keys = null)
    {
        if ($keys === null) {
            $attributes = static::getMapper()->getAttributes();
            $keys = [];

            foreach ($attributes as $key => $attribute) {
                if (!$attribute['protected']) {
                    $keys[] = $key;
                }
            }
        } else {
            $keys = is_array($keys) ? $keys : func_get_args();
        }

        $values = [];
        foreach ($keys as $key) {
            if (array_key_exists($key, $this->values)) {
                $values[$key] = $this->get($key);
            }
        }

        return $values;
    }
296355
public function items(array $keys = null): array
    {
        if ($keys != null) {
            $return = [];
            foreach ($keys as $key) {
                $return[$key] = $this->get($key);
            }
        } else {
            $return = $this->data;
        }

        return $return;
    }
310396
private function parseKeys($keys)
    {
        if (is_string($keys)) {
            if (strpos($keys, '[') !== false) {
                $keys = str_replace(']', '', $keys);
                $keys = explode('[', trim($keys, '['));
            } else {
                $keys = (array) $keys;
            }
        }

        return $keys;
    }
745007
protected function getAnyKey(array $keys)
    {
        foreach($keys as $key)
        {
            $value = $this->getValue($key);

            if(!is_null($value))
            {
                return $value;
            }
        }
    }
842165
public function getSubsetByHashes(array $hashes)
    {
        $subset = [];

        foreach ($this->items as $item) {
            $class = get_class($item);

            $mapper = Manager::getMapper($class);

            $keyName = $mapper->getEntityMap()->getKeyName();

            if (in_array($class.'.'.$item->$keyName, $hashes)) {
                $subset[] = $item;
            }
        }

        return $subset;
    }
1199619
public function hasKeys(array $keys): array
    {
        $list = [];
        foreach ($keys as $key) {
            $list[$key] = $this->hasKey((string)$key);
        }

        return $list;
    }
573857
public static function fromKeys($keys){
        $hash = new Dictionary();
        foreach($keys as $key){
            $hash[$key] = NULL;
        }
        return $hash;
    }
241170
private function filterByKeys(array $keys)
    {
        $results = [];

        foreach ($this->items as $key => $value) {
            if (!in_array($key, $keys)) {
                continue;
            }

            $results[$key] = $value;
        }

        return $results;
    }
479231
public function groupBy(...$keys)
    {
        $data = [];

        while ($row = $this->getNextRow()) {

            $position = &$data;

            foreach ($keys as $key) {
                if (is_callable($key)) {
                    $value = $key($row);
                } else {
                    $value = $row[$key];
                }

                if (!array_key_exists($value, $position)) {
                    $position[$value] = [];
                }
                $position = &$position[$value];
            }

            $position[] = $row;
            unset($position);
        }

        return $data;
    }
843739
public function readMany($keys)
    {
        $cacheKeys = [];
        foreach ($keys as $key) {
            $cacheKeys[] = $this->_key($key);
        }

        $values = $this->_Memcached->getMulti($cacheKeys);
        $return = [];
        foreach ($keys as &$key) {
            $return[$key] = array_key_exists($this->_key($key), $values) ?
                $values[$this->_key($key)] : false;
        }

        return $return;
    }
619405
public function mget(array $keys): array
    {
        $result = $this->getFactory()->getRedisClient()->mget($keys);

        return $this->getFactory()->createListConverter()->convertFromList(
            $result
        );
    }
957945
public function only($keys)
    {
        // Convert $keys to array if necessary
        if (!is_array($keys)) {
            $keys = preg_split("/, */", $keys, -1, PREG_SPLIT_NO_EMPTY);
        }

        foreach ($keys as $id => $key) {
            $keys[$id] = $this->normalizeKey($key);
        }

        // Compare filter items by provided keys and return new array
        return array_intersect_key($this->data, array_flip($keys));
    }
1290768
protected function read(array $keys)
    {
        $_res = array();
        $res = apc_fetch($keys);
        foreach ($res as $k => $v) {
            $_res[$k] = $v;
        }

        return $_res;
    }
1138226
public static function wrapMany(array $keys)
    {
        foreach ($keys as &$key) {
            $key = self::wrap($key);
        }

        return $keys;
    }
67160
protected function tagKeys(array $keys)
    {
        $prefix = $this->taggedItemKey('');

        return array_map(function ($key) use ($prefix) {
            return $prefix.$key;
        }, $keys);
    }