Convert an OpenID colon/newline separated string into an
associative array

@static
@access private
@param string $kvs
@param bool $strict
@return array|bool
188724
static function toArray($kvs, $strict=false)
    {
        $lines = explode("\n", $kvs);

        $last = array_pop($lines);
        if ($last !== '') {
            array_push($lines, $last);
            if ($strict) {
                return false;
            }
        }

        $values = array();

        for ($lineno = 0; $lineno < count($lines); $lineno++) {
            $line = $lines[$lineno];
            $kv = explode(':', $line, 2);
            if (count($kv) != 2) {
                if ($strict) {
                    return false;
                }
                continue;
            }

            $key = $kv[0];
            $tkey = trim($key);
            if ($tkey != $key) {
                if ($strict) {
                    return false;
                }
            }

            $value = $kv[1];
            $tval = trim($value);
            if ($tval != $value) {
                if ($strict) {
                    return false;
                }
            }

            $values[$tkey] = $tval;
        }

        return $values;
    }
947315
public static function getStatusBetween($from = null, $to = null, $strict = false, $strictTo = null)
    {
        $statusList = static::getStatusList();

        $strictFrom = $strict;
        $strictTo = isset($strictTo) ? (bool) $strictTo : $strict;

        // Remove status before given $from
        if (isset($from)) {
            static::checkAllowedStatus($from);
            foreach ($statusList as $key => $status) {
                if ($from !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictFrom) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
        }

        // Remove status after given $to
        if (isset($to)) {
            static::checkAllowedStatus($to);
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
            foreach ($statusList as $key => $status) {
                if ($to !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictTo) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
        }

        return array_values($statusList);
    }
336224
public function safeString($str, $strict = false, $extrachars = '')
    {
        return Str::makeSafe($str, $strict, $extrachars);
    }
365317
public function whereIn($key, array $values, bool $strict = true): ArrayCollection
    {
        return $this->filter(function ($item) use ($key, $values, $strict) {
            if (!isset($item[$key])) {
                return false;
            }

            return in_array($item[$key], $values, $strict);
        });
    }
988705
public static function inArray($needle, $haystack, $strict = NULL)
	{
		return static::is_array($haystack) && in_array($needle, $haystack, $strict);
	}
377880
function keysOf ($value, $strict = true)
  {
    $this->A = array_keys ($this->A, $value, $strict);
    return $this;
  }
622780
public function match(Parser $parser, $uri, $params = array(), $strict = false)
    {
        $op = $this->operator;

        // check expression operator first
        if ($op->id && $uri[0] !== $op->id) {
          return array($uri, $params);
        }

        // remove operator from input
        if ($op->id) {
            $uri = substr($uri, 1);
        }

        foreach($this->sortVariables($this->variables) as $var) {
            /** @var \Rize\UriTemplate\Node\Variable $regex */
            $regex = '#'.$op->toRegex($parser, $var).'#';
            $val   = null;

            // do a forward lookup and get just the relevant part
            $remainingUri = '';
            $preparedUri = $uri;
            if ($this->forwardLookupSeparator) {
                $lastOccurrenceOfSeparator = stripos($uri, $this->forwardLookupSeparator);
                $preparedUri = substr($uri, 0, $lastOccurrenceOfSeparator);
                $remainingUri = substr($uri, $lastOccurrenceOfSeparator);
            }

            if (preg_match($regex, $preparedUri, $match)) {

                // remove matched part from input
                $preparedUri = preg_replace($regex, '', $preparedUri, $limit = 1);
                $val = $op->extract($parser, $var, $match[0]);
            }

            // if strict is given, we quit immediately when there's no match
            else if ($strict) {
                return null;
            }

            $uri = $preparedUri . $remainingUri;

            $params[$var->getToken()] = $val;
        }

        return array($uri, $params);
    }
159779
public static function stringToArray($string = false, $delimiter = ' ', $limit = false) {

        if ($string && Validate::isString($string)) {

            if($limit) {

                return explode($delimiter, $string, $limit);
            }

            return explode($delimiter, $string);
        }

        return false;
    }
351773
public static function iin_array($needle, $haystack, bool $strict=true) {
		return (false !== static::array_isearch($needle, $haystack, $strict));
	}
881751
public function formatOptions(bool $strict = false, bool $noBraces = false)
    {
        $colors = [];
        $default = 0;
        foreach ($this->datasets as $dataset) {
            $color = $this->default_colors[$default];
            if (array_key_exists('color', $dataset->options)) {
                $color = $dataset->options['color'];
                unset($dataset->options['color']);
            } else {
                $default++;
            }
            array_push($colors, $color);
        }

        $this->options([
            'colors' => $colors,
        ]);

        return parent::formatOptions($strict, $noBraces);
    }
240637
public static function inArrayRecursive($needle, $haystack, $strict = false)
	{
		foreach ($haystack as $value)
		{
			if (! $strict and $needle == $value)
			{
				return true;
			}
			elseif ($needle === $value)
			{
				return true;
			}
			elseif (is_array($value) and static::inArrayRecursive($needle, $value, $strict))
			{
				return true;
			}
		}

		return false;
	}
583456
public function parseKey(Query $query, $key, $strict = false)
    {
        if (is_numeric($key)) {
            return $key;
        } elseif ($key instanceof Expression) {
            return $key->getValue();
        }

        $key = trim($key);

        if (strpos($key, '->') && false === strpos($key, '(')) {
            // JSON字段支持
            list($field, $name) = explode($key, '->');
            $key                = $field . '."' . $name . '"';
        }

        return $key;
    }
312515
public function text(string $text, $strict = false): ResponseInterface
    {
        return $this->print($text, $strict ? 'text/plain; charset=utf-8' : null);
    }
1027847
function sign($pairs)
    {
        $kv = Auth_OpenID_KVForm::fromArray($pairs);

        /* Invalid association types should be caught at constructor */
        $callback = $this->_macs[$this->assoc_type];

        return call_user_func_array($callback, array($this->secret, $kv));
    }
931522
public static function ucfirst($str, bool $strict=false) {
		ref\mb::ucfirst($str, $strict);
		return $str;
	}
913226
public function where($key, $value, bool $strict = true): ArrayCollection
    {
        return $this->filter(function ($item) use ($key, $value, $strict) {
            if (!isset($item[$key])) {
                return false;
            }

            return $strict ? $item[$key] === $value : $item[$key] == $value;
        });
    }
905210
public static function strtolower(&$str, bool $strict=false) {
		if (\is_array($str)) {
			foreach ($str as $k=>$v) {
				static::strtolower($str[$k], $strict);
			}
		}
		elseif (! $strict || \is_string($str)) {
			cast::string($str, true);

			if ($str) {
				if (
					\function_exists('mb_strtolower') &&
					(
						! \function_exists('mb_check_encoding') ||
						! \mb_check_encoding($str, 'ASCII')
					)
				) {
					$str = \mb_strtolower($str, 'UTF-8');

					// Replace some extra characters.
					$from = \array_keys(constants::CASE_CHARS);
					$to = \array_values(constants::CASE_CHARS);
					$str = \str_replace($from, $to, $str);
				}
				else {
					$str = \strtolower($str);
				}
			}
		}
	}