Properties

$type

$type : string

Message type.

Type

string

$id

$id : integer

Message id.

Type

integer

$to

$to : string

Message target user open id.

Type

string

$from

$from : string

Message sender open id.

Type

string

$properties

$properties : array

Message attributes.

Type

array

$aliases

$aliases : array

Attributes alias.

Type

array

$snakeable

$snakeable : boolean

Auto snake attribute name.

Type

boolean

$requirements

$requirements : array

Required attributes.

Type

array

$items

$items : array

The collection data.

Type

array

Methods

getType()

getType() : string

Return type name message.

Returns

string

__get()

__get(string  $key) : mixed

Get a data by key.

Parameters

string $key

Returns

mixed

__set()

__set(string  $key, mixed  $value) 

Assigns a value to the specified data.

Parameters

string $key
mixed $value

__construct()

__construct(mixed  $items = array()) 

set data.

Parameters

mixed $items

setAttribute()

setAttribute(string  $attribute, string  $value) : \EasyWeChat\Support\Attribute

Set attribute.

Parameters

string $attribute
string $value

Returns

\EasyWeChat\Support\Attribute

getAttribute()

getAttribute(string  $attribute, mixed  $default) : mixed

Get attribute.

Parameters

string $attribute
mixed $default

Returns

mixed

with()

with(string  $attribute, mixed  $value) : \EasyWeChat\Support\Attribute

Set attribute.

Parameters

string $attribute
mixed $value

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException

Returns

\EasyWeChat\Support\Attribute

set()

set(string  $key, mixed  $value) 

Set the item value.

Parameters

string $key
mixed $value

get()

get(string  $key, mixed  $default = null) : mixed

Retrieve item from Collection.

Parameters

string $key
mixed $default

Returns

mixed

__call()

__call(string  $method, array  $args) : \EasyWeChat\Support\Attribute

Magic call.

Parameters

string $method
array $args

Returns

\EasyWeChat\Support\Attribute

__isset()

__isset(string  $key) : boolean

Whether or not an data exists by key.

Parameters

string $key

Returns

boolean

all()

all() : array

Return all items.

Returns

array

only()

only(array  $keys) : array

Return specific items.

Parameters

array $keys

Returns

array

except()

except(mixed  $keys) : static

Get all items except for those with the specified keys.

Parameters

mixed $keys

Returns

static

has()

has(string  $key) : boolean

To determine Whether the specified element exists.

Parameters

string $key

Returns

boolean

first()

first() : mixed

Retrieve the first item.

Returns

mixed

last()

last() : boolean

Retrieve the last item.

Returns

boolean

add()

add(string  $key, mixed  $value) 

add the item value.

Parameters

string $key
mixed $value

forget()

forget(string  $key) 

Remove item form Collection.

Parameters

string $key

toArray()

toArray() : array

Build to array.

Returns

array

toJson()

toJson(integer  $option = JSON_UNESCAPED_UNICODE) : string

Build to json.

Parameters

integer $option

Returns

string

__toString()

__toString() : string

To string.

Returns

string

jsonSerialize()

jsonSerialize() : mixed

(PHP 5 &gt;= 5.4.0)<br/> Specify data which should be serialized to JSON.

Returns

mixed —

data which can be serialized by json_encode, which is a value of any type other than a resource

serialize()

serialize() : string

(PHP 5 &gt;= 5.1.0)<br/> String representation of object.

Returns

string —

the string representation of the object or null

getIterator()

getIterator() : \EasyWeChat\Support\Traversable

(PHP 5 &gt;= 5.0.0)<br/> Retrieve an external iterator.

Returns

\EasyWeChat\Support\Traversable —

An instance of an object implementing Iterator or Traversable

count()

count() : integer

(PHP 5 &gt;= 5.1.0)<br/> Count elements of an object.

Returns

integer —

The custom count as an integer.

The return value is cast to an integer

unserialize()

unserialize(string  $serialized) : mixed|void

(PHP 5 &gt;= 5.1.0)<br/> Constructs the object.

Parameters

string $serialized

The string representation of the object.

Returns

mixed|void

__unset()

__unset(string  $key) 

Unsets an data by key.

Parameters

string $key

__set_state()

__set_state() : array

var_export.

Returns

array

offsetExists()

offsetExists(mixed  $offset) : boolean

(PHP 5 &gt;= 5.0.0)<br/> Whether a offset exists.

Parameters

mixed $offset

An offset to check for.

Returns

boolean —

true on success or false on failure. The return value will be casted to boolean if non-boolean was returned

offsetUnset()

offsetUnset(mixed  $offset) 

(PHP 5 &gt;= 5.0.0)<br/> Offset to unset.

Parameters

mixed $offset

The offset to unset.

offsetGet()

offsetGet(mixed  $offset) : mixed

(PHP 5 &gt;= 5.0.0)<br/> Offset to retrieve.

Parameters

mixed $offset

The offset to retrieve.

Returns

mixed —

Can return all value types

offsetSet()

offsetSet(mixed  $offset, mixed  $value) 

(PHP 5 &gt;= 5.0.0)<br/> Offset to set.

Parameters

mixed $offset

The offset to assign the value to.

mixed $value

The value to set.

thumb()

thumb(string  $mediaId) : $this

小程序卡片图片的媒体ID,小程序卡片图片建议大小为520*416 mediaId需后台通过api上传后获取.

Parameters

string $mediaId

Returns

$this

validate()

validate(string  $attribute, mixed  $value) : boolean

Attribute validation.

Parameters

string $attribute
mixed $value

Returns

boolean

getRealKey()

getRealKey(string  $key) : string

Return the raw name of attribute.

Parameters

string $key

Returns

string

checkRequiredAttributes()

checkRequiredAttributes() 

Check required attributes.

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException