class ObjectHelper

Class ObjectHelper

Methods

static mixed
smartConfigure(mixed $object, array $options)

No description

static mixed
init(mixed $object, array $options)

给对象设置属性值 - 会先尝试用 setter 方法设置属性 - 再尝试直接设置属性

static 
configure($object, array $options)

给对象设置属性值

static 
setAttrs($object, array $options)

给对象设置属性值

static string
encode(mixed $obj)

定义一个用来序列化数据的函数

static mixed
decode(string $txt, bool|array $allowedClasses = false)

反序列化

static array|bool
toArray(iterable|array|Traversable $data, bool $recursive = false)

php对象转换成为数组

static string
hash(mixed $object, bool $unique = true)

No description

static array
getMethodArgs(ReflectionMethod $method, array $extraArgs = [])

No description

static mixed
create(string $class)

从类名创建服务实例对象,会尽可能自动补完构造函数依赖

static mixed
smartCreate(string|array $config)

No description

Details

at line 25
static mixed smartConfigure(mixed $object, array $options)

Parameters

mixed $object An object instance
array $options

Return Value

mixed

at line 38
static mixed init(mixed $object, array $options)

给对象设置属性值 - 会先尝试用 setter 方法设置属性 - 再尝试直接设置属性

Parameters

mixed $object An object instance
array $options

Return Value

mixed

at line 63
static configure($object, array $options)

给对象设置属性值

Parameters

$object
array $options

at line 75
static setAttrs($object, array $options)

给对象设置属性值

Parameters

$object
array $options

at line 85
static string encode(mixed $obj)

定义一个用来序列化数据的函数

Parameters

mixed $obj

Return Value

string

at line 96
static mixed decode(string $txt, bool|array $allowedClasses = false)

反序列化

Parameters

string $txt
bool|array $allowedClasses

Return Value

mixed

at line 107
static array|bool toArray(iterable|array|Traversable $data, bool $recursive = false)

php对象转换成为数组

Parameters

iterable|array|Traversable $data
bool $recursive

Return Value

array|bool

at line 138
static string hash(mixed $object, bool $unique = true)

Parameters

mixed $object
bool $unique

Return Value

string

at line 162
static array getMethodArgs(ReflectionMethod $method, array $extraArgs = [])

Parameters

ReflectionMethod $method Method for which to build the argument array.
array $extraArgs

Return Value

array

Exceptions

DependencyResolutionException

at line 211
static mixed create(string $class)

从类名创建服务实例对象,会尽可能自动补完构造函数依赖

Parameters

string $class a className

Return Value

mixed

Exceptions

DependencyResolutionException

at line 236
static mixed smartCreate(string|array $config)

Parameters

string|array $config

Return Value

mixed