private function getClassBody()
    {

        // sort the class components by their name
        $this->classComponents->sort(
            function( PhpClassComponent $a, PhpClassComponent $b ) {
                if ($a::SORT_ORDERING == $b::SORT_ORDERING) {
                    return $a->name < $b->name ? -1 : 1;
                }
                return ($a::SORT_ORDERING < $b::SORT_ORDERING) ? -1 : 1;
            }
        );

        $output = [];
        $lastType = null;
        $lastNumLines = null;
        foreach( $this->classComponents as $component ) {

            // manage strategy for adding new lines
            $componentAsLines = $component->content->toArray();
            if( !$lastType || !$component instanceof $lastType ) {
                $output[] = "\n";
            } elseif( count($componentAsLines) > 1 or $lastNumLines > 1 ) {
                $output[] = "\n";
            }
            $lastType = get_class( $component );
            $lastNumLines = count( $componentAsLines );

            // build the output;
            $output = array_merge( $output, $componentAsLines );

        }
        $output[] = "\n";
        return new Format( $output );

    }
private function getClassBody()
    {

        // sort the class components by their name
        $this->classComponents->sort(
            function( PhpClassComponent $a, PhpClassComponent $b ) {
                if ($a::SORT_ORDERING == $b::SORT_ORDERING) {
                    return $a->name < $b->name ? -1 : 1;
                }
                return ($a::SORT_ORDERING < $b::SORT_ORDERING) ? -1 : 1;
            }
        );

        $output = [];
        $lastType = null;
        $lastNumLines = null;
        foreach( $this->classComponents as $component ) {

            // manage strategy for adding new lines
            $componentAsLines = $component->content->toArray();
            if( !$lastType || !$component instanceof $lastType ) {
                $output[] = "\n";
            } elseif( count($componentAsLines) > 1 or $lastNumLines > 1 ) {
                $output[] = "\n";
            }
            $lastType = get_class( $component );
            $lastNumLines = count( $componentAsLines );

            // build the output;
            $output = array_merge( $output, $componentAsLines );

        }
        $output[] = "\n";
        return new Format( $output );

    }
private function getClassBody ( ) { // sort the class components by their name $ this -> classComponents -> sort ( function ( PhpClassComponent $ a , PhpClassComponent $ b ) { if ( $ a :: SORT_ORDERING == $ b :: SORT_ORDERING ) { return $ a -> name < $ b -> name ? - 1 : 1 ; } return ( $ a :: SORT_ORDERING < $ b :: SORT_ORDERING ) ? - 1 : 1 ; } ) ; $ output = [ ] ; $ lastType = null ; $ lastNumLines = null ; foreach ( $ this -> classComponents as $ component ) { // manage strategy for adding new lines $ componentAsLines = $ component -> content -> toArray ( ) ; if ( ! $ lastType || ! $ component instanceof $ lastType ) { $ output [ ] = "\n" ; } elseif ( count ( $ componentAsLines ) > 1 or $ lastNumLines > 1 ) { $ output [ ] = "\n" ; } $ lastType = get_class ( $ component ) ; $ lastNumLines = count ( $ componentAsLines ) ; // build the output; $ output = array_merge ( $ output , $ componentAsLines ) ; } $ output [ ] = "\n" ; return new Format ( $ output ) ; }
Get class body
@return Bond\Format
Get class body