src/Helpers/Request/ArrayHelper.php
public function toArray($object, $properties = [], $recursive = true)
    {
        return $this->proxy(__FUNCTION__, [$object, $properties, $recursive]);
    }
public function toArray($object, $properties = [], $recursive = true)
    {
        return $this->proxy(__FUNCTION__, [$object, $properties, $recursive]);
    }
Converts an object or an array of objects into an array.
@param object|array|string $object the object to be converted into an array
@param array $properties a mapping from object class names to the properties that need to put into the resulting arrays.
The properties specified for each class is an array of the following format:

```php
[
'App\Models\Post' => [
'id',
'title',
// the key name in array result => property name
'createTime' => 'created_at',
// the key name in array result => anonymous function
'length' => function ($post) {
return strlen($post->content);
},
],
]
```

The result of `ArrayHelper::toArray($post, $properties)` could be like the following:

```php
[
'id' => 123,
'title' => 'test',
'createTime' => '2013-01-01 12:00AM',
'length' => 301,
]
```

@param bool $recursive whether to recursively converts properties which are objects into arrays.
@return array the array representation of the object
@see \Reaction\Helpers\ArrayHelper::toArray()