Returns the values from a single column of the input array, identified by the key.

@param array  $values Array to pluck from.
@param string $key    Array key.

@return array
9968
public static function pluck(array $values, $key)
    {
        return array_map(
            function($val) use ($key) {
                return is_object($val) ? $val->{$key} : $val[$key];
            },
            $values
        );
    }
25319
private function sortValues($values)
    {
        if (!($this->orderField && \is_array($this->{$this->orderField}))) {
            return $values;
        }
        /** @var array $orderValues */
        $orderValues = $this->{$this->orderField};
        $result      = [];
        foreach ($orderValues as $i) {
            if (isset($values[$i])) {
                $result[$i] = $values[$i];
                unset($values[$i]);
            }
        }
        if (!empty($values)) {
            foreach ($values as $k => $v) {
                $result[$k] = $v;
            }
        }
        return $result;
    }
332873
public static function getNonEmptyValues(array $values)
    {
        /*
         * No values?
         * Nothing to do
         */
        if (empty($values)) {
            return null;
        }

        return array_filter($values, function ($value) {
            $nonEmptyScalar = is_scalar($value) && '' !== $value;
            $nonEmptyArray = is_array($value) && !empty($value);

            return $nonEmptyScalar || $nonEmptyArray || is_object($value);
        });
    }
925851
public function getValue(string $key, string $table)
    {
        $this->checkTable($table);

        $value = $this->$table->get($key);

        return $value ? json_decode($value['value'], true) : [];
    }
692856
public function appendArrayValues(array $values, $key = null): self
    {
        $this->generatorToArray();

        if ($key !== null) {
            if (
                isset($this->array[$key])
                &&
                \is_array($this->array[$key])
            ) {
                foreach ($values as $value) {
                    $this->array[$key][] = $value;
                }
            } else {
                foreach ($values as $value) {
                    $this->array[$key] = $value;
                }
            }
        } else {
            foreach ($values as $value) {
                $this->array[] = $value;
            }
        }

        return $this;
    }
384491
public function pluck(array $collection, $key)
    {
        $values = [];

        foreach ($collection as $node)
        {
            if ( ! isset($node[$key]))
            {
                continue;
            }

            $values[] = $node[$key];
        }

        return $values;
    }
255889
protected function removeEmptyValues($values)
    {
        if (!is_array($values)) {
            return empty($values) ? null : $values;
        }

        foreach ($values as $key => $value) {
            if (!empty($value)) {
                continue;
            }
            unset($values[$key]);
        }

        return $values;
    }
192802
public static function pluck(array $array, string $key): array
	{
		$plucked = [];

		foreach($array as $value)
		{
			$plucked[] = is_object($value) ? $value->$key : $value[$key];
		}

		return $plucked;
	}
951989
protected function getValues($keys)
	{
		if(empty($keys))
			return array();

		$ids=implode("','",$keys);
		$time=time();
		$sql="SELECT id, value FROM {$this->cacheTableName} WHERE id IN ('$ids') AND (expire=0 OR expire>$time)";

		$db=$this->getDbConnection();
		if($db->queryCachingDuration>0)
		{
			$duration=$db->queryCachingDuration;
			$db->queryCachingDuration=0;
			$rows=$db->createCommand($sql)->queryAll();
			$db->queryCachingDuration=$duration;
		}
		else
			$rows=$db->createCommand($sql)->queryAll();

		$results=array();
		foreach($keys as $key)
			$results[$key]=false;
		foreach($rows as $row)
			$results[$row['id']]=$row['value'];
		return $results;
	}
132611
public function values(?string $key = null) : array
    {
        $value = $this->get($key);

        if (!is_array($value)) {
            throw new InvalidArgumentException(
                'method values() should be called on array'
            );
        }

        return array_values($value);
    }
1011388
public function setArray($key, array $values)
	{
		$this->validateKey($key);
		if (empty($values)) {
			throw new \InvalidArgumentException("Missing value.");
		}
		foreach ($values as $v) {
			$this->validateValue($v);
		}
		$this->params[$key] = [];
		foreach ($values as $v) {
			$this->params[$key][] = $v;
		}
		return $this;
	}
775153
protected function getValue($key, array $array = array())
    {
        $keys = $this->parseKey($key);

        while (count($keys) > 0 and !is_null($array)) {
            $key = array_shift($keys);
            $array = isset($array[$key]) ? $array[$key] : null;
        }

        return $array;
    }
444459
public function orIn($key, array $values)
    {
        if ($values) {
            $value = sprintf('%s IN (%s)', $key, join(', ', array_fill(0, count($values), '?')));
            return $this->orAdd($value, $values);
        } else {
            $value = '0';
            return $this->orAdd($value, $values);
        }
    }
1094735
public function getValue( $key )
	{
		if( !isset( $this->_values[ $key ] ) ) {
			return null;
		}

		return $this->_values[ $key ];
	}
309842
public function whereIn($key,$values=array())
    {
        $dstore= new DataStore;
        $dstore->meta($this->metaData);
        foreach ($this->rows as $row) {
            if (in_array($row[$key], $values)) {
                $dstore->append($row);
            }
        }
        return $dstore;
    }
207384
protected function arrayLookup($key, $keys2Values)
    {
        $keys2Values = array_change_key_case($keys2Values);
        $key = strtolower($key);
        $match = array_key_exists($key, $keys2Values) ? $keys2Values[$key] : null;

        return $match;
    }
186213
public function toKeyValue(array $values)
    {
        $result = [];

        foreach ($values as $key => $value) {
            if (is_array($value)) {
                $result[$key] = $this->toKeyValue($value);
            } elseif (is_object($value)) {
                $result[$key] = $this->toKeyValue((array) $value);
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }