src/Dlin/Zendesk/Entity/BaseEntity.php
public function fromArray(array $array)
    {
        foreach ($array as $k => $v) {

            if (!is_null($v) && property_exists(get_class($this), $k)) {

                $meta = new \ReflectionProperty(get_class($this), $k);

                $info = $this->parsePropertyDocComment($meta->getDocComment());

                $type = $info['type'];

                if (strtolower($type) == "array" && $elementType = $info['array_element']) {
                    if (class_exists($elementType)) {
                        $children = array();
                        foreach ($v as $subV) {
                            $newElement = new $elementType();
                            $children[] = $newElement->fromArray($subV);
                        }
                        $this->$k = $children;

                    } else {
                        throw new \Exception('@element Class Not Found:' . $elementType);
                    }

                } else if (class_exists($type)) {
                    $typeObject = new $type();
                    $this->$k = $typeObject->fromArray($v);
                } else {
                    $this->$k = $v;
                }


            }

        }

        return $this;
    }
public function fromArray(array $array)
    {
        foreach ($array as $k => $v) {

            if (!is_null($v) && property_exists(get_class($this), $k)) {

                $meta = new \ReflectionProperty(get_class($this), $k);

                $info = $this->parsePropertyDocComment($meta->getDocComment());

                $type = $info['type'];

                if (strtolower($type) == "array" && $elementType = $info['array_element']) {
                    if (class_exists($elementType)) {
                        $children = array();
                        foreach ($v as $subV) {
                            $newElement = new $elementType();
                            $children[] = $newElement->fromArray($subV);
                        }
                        $this->$k = $children;

                    } else {
                        throw new \Exception('@element Class Not Found:' . $elementType);
                    }

                } else if (class_exists($type)) {
                    $typeObject = new $type();
                    $this->$k = $typeObject->fromArray($v);
                } else {
                    $this->$k = $v;
                }


            }

        }

        return $this;
    }
Load data from the past array into local properties

@param array $array