public function getAnatomicalPrototypeTreeFromAstExcerpt($fusionAstExcerpt)
    {
        $result = [];

        if (!is_array($fusionAstExcerpt)) {
            return $result;
        }

        foreach ($fusionAstExcerpt as $key => $value) {
            if (substr($key, 0, 2) === '__') {
                continue;
            }

            $anatomy = $this->getAnatomicalPrototypeTreeFromAstExcerpt($value);

            if (array_key_exists('prototypeName', $anatomy)) {
                if ($anatomy['prototypeName'] !== null) {
                    $result[] = $anatomy;
                }
            } else {
                $result = array_merge($result, $anatomy);
            }
        }

        if (!array_key_exists('__objectType', $fusionAstExcerpt)) {
            return $result;
        } else {
            return [
                'prototypeName' => $fusionAstExcerpt['__objectType'],
                'children' => $result
            ];
        }
    }
public function getAnatomicalPrototypeTreeFromAstExcerpt($fusionAstExcerpt)
    {
        $result = [];

        if (!is_array($fusionAstExcerpt)) {
            return $result;
        }

        foreach ($fusionAstExcerpt as $key => $value) {
            if (substr($key, 0, 2) === '__') {
                continue;
            }

            $anatomy = $this->getAnatomicalPrototypeTreeFromAstExcerpt($value);

            if (array_key_exists('prototypeName', $anatomy)) {
                if ($anatomy['prototypeName'] !== null) {
                    $result[] = $anatomy;
                }
            } else {
                $result = array_merge($result, $anatomy);
            }
        }

        if (!array_key_exists('__objectType', $fusionAstExcerpt)) {
            return $result;
        } else {
            return [
                'prototypeName' => $fusionAstExcerpt['__objectType'],
                'children' => $result
            ];
        }
    }
public function getAnatomicalPrototypeTreeFromAstExcerpt ( $ fusionAstExcerpt ) { $ result = [ ] ; if ( ! is_array ( $ fusionAstExcerpt ) ) { return $ result ; } foreach ( $ fusionAstExcerpt as $ key => $ value ) { if ( substr ( $ key , 0 , 2 ) === '__' ) { continue ; } $ anatomy = $ this -> getAnatomicalPrototypeTreeFromAstExcerpt ( $ value ) ; if ( array_key_exists ( 'prototypeName' , $ anatomy ) ) { if ( $ anatomy [ 'prototypeName' ] !== null ) { $ result [ ] = $ anatomy ; } } else { $ result = array_merge ( $ result , $ anatomy ) ; } } if ( ! array_key_exists ( '__objectType' , $ fusionAstExcerpt ) ) { return $ result ; } else { return [ 'prototypeName' => $ fusionAstExcerpt [ '__objectType' ] , 'children' => $ result ] ; } }
Get anatomical prototype tree from fusion AST excerpt

@param array $fusionAstExcerpt
@return array
Get anatomical prototype tree from fusion AST excerpt