Gc\Core\Object::__toArray PHP Method

__toArray() public method

Convert object attributes to array
public __toArray ( array $array = [] ) : array
$array array array of required attributes
return array
    public function __toArray(array $array = array())
    {
        if (empty($array)) {
            return $this->data;
        }
        $arrayResult = array();
        foreach ($array as $attribute) {
            if (isset($this->data[$attribute])) {
                $arrayResult[$attribute] = $this->data[$attribute];
            } else {
                $arrayResult[$attribute] = null;
            }
        }
        return $arrayResult;
    }