public function doSort()
    {
        $this->sorted = array();

        foreach ($this->elements as $element) {
            $parents = array();
            $this->visit($element, $parents);
        }

        return $this->sorted;
    }
public function doSort()
    {
        $this->sorted = array();

        foreach ($this->elements as $element) {
            $parents = array();
            $this->visit($element, $parents);
        }

        return $this->sorted;
    }
public function doSort ( ) { $ this -> sorted = array ( ) ; foreach ( $ this -> elements as $ element ) { $ parents = array ( ) ; $ this -> visit ( $ element , $ parents ) ; } return $ this -> sorted ; }
Sorts dependencies and returns internal used data structure.

@return string[]

@throws CircularDependencyException if a circular dependency has been found
@throws ElementNotFoundException if a dependency can not be found
Sorts dependencies and returns internal used data structure .