public function addElement(
        $element,
        $menus,
        $stage,
        $priority = 0
    ) {
        $priority = (int) $priority;
        $elementId = spl_object_hash($element);
        $menus = is_array($menus)
            ? $menus
            : [$menus];

        if (empty($menus)) {
            $this->allElements[$elementId] = $element;
        } else {
            foreach ($menus as $menu) {
                $this->addElementByMenuCode(
                    $element,
                    $menu
                );
            }
        }

        $this->addElementByStage(
            $element,
            $stage
        );

        $this->priorities[$elementId] = $priority;

        return $this;
    }