@param array $values
@param array $options

@return array
@private
438208
private static function _intersect($values, $options){

		$filtered = [];

		foreach($values as $option){

			$option = static::_nullValue($option);

			if(in_array($option, $options)){

				$filtered[] = $option;
			}
		}

		return $filtered;
	}
924001
public function filter($values)
    {
        if (is_array($values)) {
            foreach ($values as $key => $value) {
                $values[$key] = $this->filterValue($value);
            }
        }

        return $values;
    }
676749
final public function check(array $options) {
        foreach ($options as $property => $value) {
            if ((is_array($value) && !in_array($this->$property, $value)) ||
                    (!is_array($value) && $this->$property !== $value))
                return false;
        }

        return true;
    }
19462
public function apply($value, $options = [])
    {
        $type = isset($options[0]) ? $options[0] : null;
        switch ($type) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'object':
                return is_array($value) ? (object) $value : json_decode($value, false);
            case 'array':
                return json_decode($value, true);
            case 'collection':
                $array = is_array($value) ? $value : json_decode($value, true);
                return new Collection($array);
            default:
                throw new \InvalidArgumentException("Wrong Sanitizer casting format: {$type}.");
        }
    }
123350
public function setOptions(array $options): Options
    {
        foreach ($options as $key => $option) {
            $this->options[$key] = $option;
        }

        return $this;
    }
798539
protected function checkIfOptionsExists(array $values, array $options)
    {
        foreach ($values as $selected) {
            $found = false;

            // walk all options
            foreach ($options as $option) {
                if ($option instanceof Option) {
                    if ($option->getValue() == $selected) {
                        $found = true;
                        break;
                    }
                } elseif ($option instanceof Optgroup) {
                    $options2 = $option->getOptions();
                    foreach ($options2 as $option2) {
                        if ($option2->getValue() == $selected) {
                            $found = true;
                            break 2;
                        }
                    }
                }
            }

            // if not found, then error!
            if (!$found) {
                // troubles? Then you want to probably log something here
                return false;
            }
        }

        return true;
    }
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();
    }
910418
public function tryGetOptionsForValues(array $values): array
    {
        $optionsIndexedByHash = [];

        foreach ($this->getAll() as $option) {
            $optionsIndexedByHash[ValueHasher::hash($option->getValue())] = $option;
        }

        $options = [];

        foreach ($values as $value) {
            $hash = ValueHasher::hash($value);

            if (isset($optionsIndexedByHash[$hash])) {
                $options[] = $optionsIndexedByHash[$hash];
            }
        }

        return $options;
    }
844181
public function loadValues(array $values)
    {
        foreach ($values as $name => $value) {
            $argument = $this->getArgument($name, static::MODE_RETURN_NULL);

            if (null !== $argument) {
                $argument->setValue($value);
            }
        }

        return $this;
    }
1029385
function InListFromValues(array $values)
    {
        if (count($values) == 0)
        {
            return null;
        }
        $list = $this->InList($this->Value($values[0]));
        foreach ($values as $value)
        {
            $list->Add($this->Value($value));
        }
        return $list;
    }
808974
protected function decrypt($value, $options)
    {
        $secure = $this->secure($options);

        return $secure->decrypt($value);
    }
1109730
public function set($name, $value, array $options = [])
    {
        $options = $this->options($options);
        $value   = parent::set($name, $value, $options);

        return setcookie(
            $this->normalize($name),
            $value,
            $options[self::OPTION_EXPIRE],
            $options[self::OPTION_PATH],
            $options[self::OPTION_DOMAIN],
            false,
            $options[self::OPTION_HTTP_ONLY]
        );
    }
867479
public function serialize($value, array $options, $mode) {
        if ($mode === self::TO && $options['encode']) {
            return serialize($value);
        }

        if ($mode === self::FROM && $options['decode']) {
            return @unserialize($value);
        }

        return $value;
    }
458852
public static function MultipleCreate ($values = [], $options = []) {
		if (!static::InTransaction()) {
			throw CoreException::RaiseSystemError('トランザクションが展開されていません。');
		}
		//@TODO EventListにする
		if (method_exists(static::class, 'DefaultFilter')) {
			$default_filter = [static::class, 'DefaultFilter'];
			foreach ($values as $idx => $row) {
				$values[$idx] = $default_filter($row);
			}
		}
		if (method_exists(static::class, 'CreateFilter')) {
			$create_filter = [static::class, 'CreateFilter'];
			foreach ($values as $idx => $row) {
				$values[$idx] = $create_filter($row);
			}
		}
		$options += $options + static::GetDefaultOptions();
		return DBI::Create(static::GetName(), $values, $options);
	}
648004
public function filter($value, $options = [])
    {
        do {
            // Treat $input as buffer on each loop, faster
            // than new var && Remove unwanted tags
            $input  = $value;
            $output = $this->stripTags($input);
            $output = $this->stripEncodedEntities($output);

            // Use 2nd input param if not empty or '0'
            if ($options['safe_level'] !== 0) {
                $output = $this->stripBase64($output);
            }

        } while ($output !== $input);

        return $output;
    }
630674
public function values(array $values)
    {
        $this->sqlParts['values'] = is_array(current($values)) ? $values : [$values];

        return $this;
    }
520528
public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $this->_options[$k] = $v;
        }
        return $this;
    }