Returns non-empty values, e.g. without "" (empty string), null or []

@param array $values The values to filter
@return null|array
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);
        });
    }
464960
public static function notIn($values)
    {
        if ($values instanceof Arrayable) {
            $values = $values->toArray();
        }

        return new Rules\NotIn(is_array($values) ? $values : func_get_args());
    }
951191
public static function only(array $values): array
    {
        $items = [];

        foreach ($values as $value) {
            $item = static::get($value);
            $items[$item->value()] = $item;
        }

        return $items;
    }
312877
public function inputs(array $values = null): array
    {
        if ($values === null) {
            if ($this->all) {
                return $this->input;
            }

            $values = [];
            if ($this->serverRequest->getMethod() !== 'GET') {
                $values = (array) $this->serverRequest->getParsedBody();
            }

            $values += $this->serverRequest->getQueryParams();
            $this->all = true;
        }

        $this->cache = [];

        return $this->input = $values;
    }
146339
public function filterLanguageValues($values)
    {
        return array_unique(preg_split(
            '/\s*,\s*/u',
            preg_replace('/\s+/u', ' ', is_array($values) ? implode(',', $values) : $values),
            -1,
            PREG_SPLIT_NO_EMPTY
        ));
    }
381291
public function valuesArray($values) {
		if ($values instanceof \ArrayObject)
			$this->value = $values->getArrayCopy();
		elseif (is_object($values))
			$this->value = get_object_vars($values);
		elseif (is_array($values))
			$this->value = $values;
		else
			throw new \InvalidArgumentException("Method 'valuesArray' expected an object or array value");
		
		if (is_numeric(key($this->value))) {
			$this->valueList = $this->value;
			$this->value = null;
		}
		
		return $this;
	}
1307351
public function values(array $values)
    {
        foreach( $values as $k => $v ) {
            $this->value($k, $v);
        }
        return $this;
    }
1154326
protected function parseArray(string $values): array
    {
        $parsed = empty($values) === false ? explode(' ', $values) : [];

        return $parsed;
    }
1244366
protected function _emptyValue($value)
    {
        if ($value === true) {
            return ['' => ''];
        }
        if (is_scalar($value)) {
            return ['' => $value];
        }
        if (is_array($value)) {
            return $value;
        }

        return [];
    }
476995
public function getUrlFromPathWithValues(array $values = []){

        $url    = $this->path;
        //$url  = preg_replace($this->regex, $values, $this->path);

        //straightforward match and replace
        preg_match_all('@{([a-zA-Z0-9_]*)}@', $url, $matches);

        if($matches) {
            foreach ($matches[1] as $k=>$optional){
                $url = str_ireplace($matches[0][$k], isset($values[$optional])? $values[$optional] : null , $url );
            }
        }

        //the more complicated stuff;
        preg_match('@{/([a-zA-Z0-9_]*)}@', $url, $expandables);

        if ($expandables) {
            //expand /{foo,bar} type patterns
            $list = explode(',', $expandables[1]);
            $head = '';

            if (substr($url, 0, 2) == '{/') {
                $name = array_shift($list);
                if(isset($values[$name])) {
                    $head = "/{$values[$name]}";
                }
            }

            $tail = '';

            foreach ($list as $name) {
                if(isset($values[$name])) {
                    $head = "/{$values[$name]}";
                }
            }
            $url = str_replace($expandables[0], $head . $tail, $url);
        }

        return $url;
    }
1067242
private static function getValues(array $values)
    {
        $bag = MutableBag::from($values);
        foreach ($bag as $k => $v) {
            /** @var Bag $v */
            if (is_array($v) && !is_callable($v)) {
                $bag[$k] = Bag::from($v)
                    ->call(function (array $a) {
                        return [Json::dump($a)];
                    })
                    ->join(' ')
                ;
            } elseif (is_string($v) || (is_object($v) && method_exists($v, '__toString'))) {
                $bag[$k] = (string) $v;
            } else {
                $bag->remove($k);
            }
        }

        return $bag->immutable();
    }
374378
public function setValues($values=array()) {
		$count=$this->count();
		$isArray=true;
		if (\is_array($values) === false) {
			$values=\array_fill(0, $count, $values);
			$isArray=false;
		}
		if (JArray::dimension($values) == 1 && $isArray)
			$values=[ $values ];

		$count=\min(\sizeof($values), $count);

		for($i=0; $i < $count; $i++) {
			$row=$this->content[$i];
			$row->setValues($values[$i]);
		}
		return $this;
	}
189177
protected function convertValuesForStorage($values) {
    // filter values according to type
    foreach($values as $valueName => $value) {
      $type = $this->getAttribute($valueName)->getType();
      // integer
      if (strpos(strtolower($type), 'int') === 0) {
        $value = (strlen($value) == 0) ? null : intval($value);
        $values[$valueName] = $value;
      }
      // null values
      if ($value === null) {
        $values[$valueName] = SQLConst::NULL();
      }
    }
    return $values;
  }
1165669
public function valufy($values)
    {
        // we'll only deal with arrays so let's turn it into one if it isn't
        if ( ! is_array($values)) $values = [$values];

        // escape and wrap them with a quote.
        $values = array_map(function ($value)
        {
            // First, we check whether we have a date instance so that
            // we take its string representation instead.
            if ($value instanceof DateTime || $value instanceof Carbon)
            {
                $value = $value->format($this->getDateFormat());
            }

            // We need to keep the data type of values
            // except when they're strings, we need to
            // escape wrap them.
            if (is_string($value))
            {
                $value = "'" . addslashes($value) . "'";
            }
            // In order to support boolean value types and not have PHP convert them to their
            // corresponding string values, we'll have to handle boolean values and add their literal string representation.
            elseif (is_bool($value))
            {
                $value = ($value) ? 'true' : 'false';
            }

            return $value;

        }, $values);

        // stringify them.
        return implode(', ', $values);
    }
204453
public static function flattenArrayValues(array $values): array
    {
        $return = [];

        foreach ($values as $key => $value) {
            if (\is_array($value)) {
                $value = implode(', ', $value);
            }

            $return[$key] = $value;
        }

        return $return;
    }
330542
public function except(array $values): self
    {
        return $this->filter(function ($value) use ($values) {
            return !in_array($value, $values);
        });
    }
939838
public static function empty(...$values): bool
    {
        self::handleInvalidArguments($values);

        foreach ($values as $value) {
            if (empty($value) === false) {
                return false;
            }
        }

        return true;
    }