protected function inflateItem ($item)
    {
        if (isset($item->sub_button) & count($item->sub_button) > 0) {
            $object = new MenuItem($item->name, MenuItem::KEYWORD);
            foreach ($item->sub_button as $subItem) {
                $object = $object->withItem($this->inflateItem($subItem));
            }
        } else {
            if (isset($item->url)) {
                $object = new MenuItem($item->name, $item->type, $item->url);
            } elseif (isset($item->key)) {
                $object = new MenuItem($item->name, $item->type, $item->key);
            } else {
                $object = new MenuItem($item->name, $item->type);
            }
        }

        return $object;
    }
protected function inflateItem ($item)
    {
        if (isset($item->sub_button) & count($item->sub_button) > 0) {
            $object = new MenuItem($item->name, MenuItem::KEYWORD);
            foreach ($item->sub_button as $subItem) {
                $object = $object->withItem($this->inflateItem($subItem));
            }
        } else {
            if (isset($item->url)) {
                $object = new MenuItem($item->name, $item->type, $item->url);
            } elseif (isset($item->key)) {
                $object = new MenuItem($item->name, $item->type, $item->key);
            } else {
                $object = new MenuItem($item->name, $item->type);
            }
        }

        return $object;
    }
protected function inflateItem ( $ item ) { if ( isset ( $ item -> sub_button ) & count ( $ item -> sub_button ) > 0 ) { $ object = new MenuItem ( $ item -> name , MenuItem :: KEYWORD ) ; foreach ( $ item -> sub_button as $ subItem ) { $ object = $ object -> withItem ( $ this -> inflateItem ( $ subItem ) ) ; } } else { if ( isset ( $ item -> url ) ) { $ object = new MenuItem ( $ item -> name , $ item -> type , $ item -> url ) ; } elseif ( isset ( $ item -> key ) ) { $ object = new MenuItem ( $ item -> name , $ item -> type , $ item -> key ) ; } else { $ object = new MenuItem ( $ item -> name , $ item -> type ) ; } } return $ object ; }
Inflate the given array representation of an item, and return it as an instance of `Garbetjie\WeChatClient\Menu\MenuItem`.

@param \stdClass $item

@return MenuItem
Inflate the given array representation of an item and return it as an instance of Garbetjie \ WeChatClient \ Menu \ MenuItem .