src/Dlin/Zendesk/Entity/BaseEntity.php
public function toArray($changedOnly = false, $extraData = null)
    {
        $vars = get_object_vars($this);
        $object = array();

        if (!is_array($this->_changes)) {
            $this->_changes = array();
        }

        if(is_array($extraData)){
            $vars = array_merge($vars, $extraData);
        }

        foreach ($vars as $k => $v) {
            if (strpos($k, '_') !== 0 && $v !== null && (!$changedOnly || array_key_exists($k, $this->_changes) || array_key_exists($k, $extraData) )) {
                if (is_array($v)) {
                    $subV = array();

                    foreach ($v as $sub) {
                        if (is_a($sub, 'Dlin\Zendesk\Entity\BaseEntity')) {
                            $subV[] = $sub->toArray();
                        } else {
                            $subV[] = $sub;
                        }
                    }
                    $object[$k] = $subV;
                } else if (is_a($v, 'Dlin\Zendesk\Entity\BaseEntity')) {
                    $object[$k] = $v->toArray();
                } else {
                    $object[$k] = $v;
                }
            }
        }



        return $object;
    }
public function toArray($changedOnly = false, $extraData = null)
    {
        $vars = get_object_vars($this);
        $object = array();

        if (!is_array($this->_changes)) {
            $this->_changes = array();
        }

        if(is_array($extraData)){
            $vars = array_merge($vars, $extraData);
        }

        foreach ($vars as $k => $v) {
            if (strpos($k, '_') !== 0 && $v !== null && (!$changedOnly || array_key_exists($k, $this->_changes) || array_key_exists($k, $extraData) )) {
                if (is_array($v)) {
                    $subV = array();

                    foreach ($v as $sub) {
                        if (is_a($sub, 'Dlin\Zendesk\Entity\BaseEntity')) {
                            $subV[] = $sub->toArray();
                        } else {
                            $subV[] = $sub;
                        }
                    }
                    $object[$k] = $subV;
                } else if (is_a($v, 'Dlin\Zendesk\Entity\BaseEntity')) {
                    $object[$k] = $v->toArray();
                } else {
                    $object[$k] = $v;
                }
            }
        }



        return $object;
    }
Convert to an object

@return array