serve/vendor/topthink/think-helper/srchelper.php

Functions

throw_if()

throw_if(mixed  $condition, \Throwable|string  $exception, array  ...$parameters) : mixed

按条件抛异常

Parameters

mixed $condition
\Throwable|string $exception
array $parameters variadic

Throws

\Throwable

Returns

mixed —

throw_unless()

throw_unless(mixed  $condition, \Throwable|string  $exception, array  ...$parameters) : mixed

按条件抛异常

Parameters

mixed $condition
\Throwable|string $exception
array $parameters variadic

Throws

\Throwable

Returns

mixed —

tap()

tap(mixed  $value, callable|null  $callback = null) : mixed

对一个值调用给定的闭包,然后返回该值

Parameters

mixed $value
callable|null $callback

Returns

mixed —

value()

value(mixed  $value) : mixed

Return the default value of the given value.

Parameters

mixed $value

Returns

mixed —

collect()

collect(mixed  $value = null) : \Collection

Create a collection from the given value.

Parameters

mixed $value

Returns

\Collection —

data_fill()

data_fill(mixed  $target, string|array  $key, mixed  $value) : mixed

Fill in data where it's missing.

Parameters

mixed $target
string|array $key
mixed $value

Returns

mixed —

data_get()

data_get(mixed  $target, string|array|int  $key, mixed  $default = null) : mixed

Get an item from an array or object using "dot" notation.

Parameters

mixed $target
string|array|int $key
mixed $default

Returns

mixed —

data_set()

data_set(mixed  $target, string|array  $key, mixed  $value, bool  $overwrite = true) : mixed

Set an item on an array or object using dot notation.

Parameters

mixed $target
string|array $key
mixed $value
bool $overwrite

Returns

mixed —

trait_uses_recursive()

trait_uses_recursive(string  $trait) : array

获取一个trait里所有引用到的trait

Parameters

string $trait

Trait

Returns

array —

class_basename()

class_basename(mixed  $class) : string

获取类名(不包含命名空间)

Parameters

mixed $class

类名

Returns

string —

class_uses_recursive()

class_uses_recursive(mixed  $class) : array

获取一个类里所有用到的trait,包括父类的

Parameters

mixed $class

类名

Returns

array —