Neos.ContentRepository/Classes/Service/Utility/NodePublishingDependencySolver.php
public function sort(array $nodes)
    {
        $this->buildNodeDependencies($nodes);
        $sortedNodes = $this->resolveDependencies();

        $dependencyCount = array_filter($this->dependenciesOutgoing, function ($a) {
            return $a !== [];
        });
        if (count($dependencyCount) > 0) {
            throw new WorkspaceException('Cannot publish a list of nodes because of cycles', 1416484223);
        }

        return $sortedNodes;
    }
public function sort(array $nodes)
    {
        $this->buildNodeDependencies($nodes);
        $sortedNodes = $this->resolveDependencies();

        $dependencyCount = array_filter($this->dependenciesOutgoing, function ($a) {
            return $a !== [];
        });
        if (count($dependencyCount) > 0) {
            throw new WorkspaceException('Cannot publish a list of nodes because of cycles', 1416484223);
        }

        return $sortedNodes;
    }
public function sort ( array $ nodes ) { $ this -> buildNodeDependencies ( $ nodes ) ; $ sortedNodes = $ this -> resolveDependencies ( ) ; $ dependencyCount = array_filter ( $ this -> dependenciesOutgoing , function ( $ a ) { return $ a !== [ ] ; } ) ; if ( count ( $ dependencyCount ) > 0 ) { throw new WorkspaceException ( 'Cannot publish a list of nodes because of cycles' , 1416484223 ) ; } return $ sortedNodes ; }
Sort nodes by an order suitable for publishing

This makes sure all parent and moved-to relations are resolved and changes that need to be published
before other changes will be published first.

Uses topological sorting of node dependencies (http://en.wikipedia.org/wiki/Topological_sorting) to build a publishable order of nodes.

@param array $nodes Array of nodes to sort, if dependencies are missing in this list an exception will be thrown
@return array Array of nodes sorted by dependencies for publishing
@throws WorkspaceException
Sort nodes by an order suitable for publishing