protected function compare(AlphabeticalTreeNodeInterface $a, AlphabeticalTreeNodeInterface $b) {

        // Get the paths.
        $pathA = AlphabeticalTreeNodeHelper::getPath($a);
        $pathB = AlphabeticalTreeNodeHelper::getPath($b);

        // Count the path.
        $count = count($pathA);

        // Handle each path.
        for ($i = 0; $i < $count; ++$i) {

            // Get the items.
            $itemA = $pathA[$i];
            $itemB = true === isset($pathB[$i]) ? $pathB[$i] : null;

            // Compare the items.
            if ($itemA !== $itemB) {
                return null !== $itemB ? strcasecmp($itemA->getAlphabeticalTreeNodeLabel(), $itemB->getAlphabeticalTreeNodeLabel()) : 1;
            }
        }

        // Return.
        return 0;
    }
protected function compare(AlphabeticalTreeNodeInterface $a, AlphabeticalTreeNodeInterface $b) {

        // Get the paths.
        $pathA = AlphabeticalTreeNodeHelper::getPath($a);
        $pathB = AlphabeticalTreeNodeHelper::getPath($b);

        // Count the path.
        $count = count($pathA);

        // Handle each path.
        for ($i = 0; $i < $count; ++$i) {

            // Get the items.
            $itemA = $pathA[$i];
            $itemB = true === isset($pathB[$i]) ? $pathB[$i] : null;

            // Compare the items.
            if ($itemA !== $itemB) {
                return null !== $itemB ? strcasecmp($itemA->getAlphabeticalTreeNodeLabel(), $itemB->getAlphabeticalTreeNodeLabel()) : 1;
            }
        }

        // Return.
        return 0;
    }
protected function compare ( AlphabeticalTreeNodeInterface $ a , AlphabeticalTreeNodeInterface $ b ) { // Get the paths. $ pathA = AlphabeticalTreeNodeHelper :: getPath ( $ a ) ; $ pathB = AlphabeticalTreeNodeHelper :: getPath ( $ b ) ; // Count the path. $ count = count ( $ pathA ) ; // Handle each path. for ( $ i = 0 ; $ i < $ count ; ++ $ i ) { // Get the items. $ itemA = $ pathA [ $ i ] ; $ itemB = true === isset ( $ pathB [ $ i ] ) ? $ pathB [ $ i ] : null ; // Compare the items. if ( $ itemA !== $ itemB ) { return null !== $ itemB ? strcasecmp ( $ itemA -> getAlphabeticalTreeNodeLabel ( ) , $ itemB -> getAlphabeticalTreeNodeLabel ( ) ) : 1 ; } } // Return. return 0 ; }
Compare two nodes.

@param AlphabeticalTreeNodeInterface $a The node A.
@param AlphabeticalTreeNodeInterface $b The node B.
@return int Returns
< O: if the node A is lesser than node B
> 0: if the node A is gerater than node B
= 0: if the two nodes are equals
Compare two nodes .