class Obj extends ObjectHelper

Class Obj alias of the ObjectHelper

Traits

Class ObjectPoolTrait

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

static mixed
get(string $class)

No description

static 
put(stdClass|string $object)

No description

static mixed
use(string $class, Closure $handler)

No description

static SplStack
getStack(string|stdClass $class)

No description

static int
count(null $class = null)

No description

static 
destroy(null $class = null)

No description

static mixed
singleton(string $class)

No description

static mixed
factory(string $class)

No description

static bool
isArrayable($object)

No description

Details

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

Parameters

mixed $object An object instance
array $options

Return Value

mixed

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

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

Parameters

mixed $object An object instance
array $options

Return Value

mixed

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

给对象设置属性值

Parameters

$object
array $options

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

给对象设置属性值

Parameters

$object
array $options

in ObjectHelper at line 85
static string encode(mixed $obj)

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

Parameters

mixed $obj

Return Value

string

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

反序列化

Parameters

string $txt
bool|array $allowedClasses

Return Value

mixed

in ObjectHelper 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

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

Parameters

mixed $object
bool $unique

Return Value

string

in ObjectHelper 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

in ObjectHelper at line 211
static mixed create(string $class)

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

Parameters

string $class a className

Return Value

mixed

Exceptions

DependencyResolutionException

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

Parameters

string|array $config

Return Value

mixed

in ObjectPoolTrait at line 26
static mixed get(string $class)

Parameters

string $class

Return Value

mixed

in ObjectPoolTrait at line 40
static put(stdClass|string $object)

Parameters

stdClass|string $object

in ObjectPoolTrait at line 54
static mixed use(string $class, Closure $handler)

Parameters

string $class
Closure $handler

Return Value

mixed

in ObjectPoolTrait at line 69
static SplStack getStack(string|stdClass $class)

Parameters

string|stdClass $class

Return Value

SplStack

in ObjectPoolTrait at line 85
static int count(null $class = null)

Parameters

null $class

Return Value

int

Exceptions

InvalidArgumentException

in ObjectPoolTrait at line 102
static destroy(null $class = null)

Parameters

null $class

Exceptions

InvalidArgumentException

at line 31
static mixed singleton(string $class)

Parameters

string $class

Return Value

mixed

at line 44
static mixed factory(string $class)

Parameters

string $class

Return Value

mixed

at line 57
static bool isArrayable($object)

Parameters

$object

Return Value

bool