public function getElementsByMenuCodeAndStage(
        $menuCode,
        $stage
    ) {
        $elementsByMenuCode = isset($this->elementsStoredByMenuCode[$menuCode])
            ? $this->elementsStoredByMenuCode[$menuCode]
            : [];

        $elementsByStage = isset($this->elementsStoredByStage[$stage])
            ? $this->elementsStoredByStage[$stage]
            : [];

        $elements = array_values(
            array_intersect_key(
                array_merge(
                    $this->allElements,
                    $elementsByMenuCode
                ),
                $elementsByStage
            )
        );

        usort($elements, function ($element1, $element2) {
            $element1Id = spl_object_hash($element1);
            $element2Id = spl_object_hash($element2);

            return $this->priorities[$element1Id] <= $this->priorities[$element2Id];
        });

        return $elements;
    }
public function getElementsByMenuCodeAndStage(
        $menuCode,
        $stage
    ) {
        $elementsByMenuCode = isset($this->elementsStoredByMenuCode[$menuCode])
            ? $this->elementsStoredByMenuCode[$menuCode]
            : [];

        $elementsByStage = isset($this->elementsStoredByStage[$stage])
            ? $this->elementsStoredByStage[$stage]
            : [];

        $elements = array_values(
            array_intersect_key(
                array_merge(
                    $this->allElements,
                    $elementsByMenuCode
                ),
                $elementsByStage
            )
        );

        usort($elements, function ($element1, $element2) {
            $element1Id = spl_object_hash($element1);
            $element2Id = spl_object_hash($element2);

            return $this->priorities[$element1Id] <= $this->priorities[$element2Id];
        });

        return $elements;
    }
public function getElementsByMenuCodeAndStage ( $ menuCode , $ stage ) { $ elementsByMenuCode = isset ( $ this -> elementsStoredByMenuCode [ $ menuCode ] ) ? $ this -> elementsStoredByMenuCode [ $ menuCode ] : [ ] ; $ elementsByStage = isset ( $ this -> elementsStoredByStage [ $ stage ] ) ? $ this -> elementsStoredByStage [ $ stage ] : [ ] ; $ elements = array_values ( array_intersect_key ( array_merge ( $ this -> allElements , $ elementsByMenuCode ) , $ elementsByStage ) ) ; usort ( $ elements , function ( $ element1 , $ element2 ) { $ element1Id = spl_object_hash ( $ element1 ) ; $ element2Id = spl_object_hash ( $ element2 ) ; return $ this -> priorities [ $ element1Id ] <= $ this -> priorities [ $ element2Id ] ; } ) ; return $ elements ; }
Get elements given a stage and the code of the menu.

@param string $menuCode Menu code
@param string $stage    Stage

@return array Elements
Get elements given a stage and the code of the menu .