classes/phing/Phing.php
public function printTargets($project)
    {
        // find the target with the longest name
        $maxLength = 0;
        $targets = $project->getTargets();
        $targetName = null;
        $targetDescription = null;
        $currentTarget = null;

        // split the targets in top-level and sub-targets depending
        // on the presence of a description

        $subNames = [];
        $topNameDescMap = [];

        foreach ($targets as $currentTarget) {
            $targetName = $currentTarget->getName();
            $targetDescription = $currentTarget->getDescription();
            if ($currentTarget->isHidden()) {
                continue;
            }

            // subtargets are targets w/o descriptions
            if ($targetDescription === null) {
                $subNames[] = $targetName;
            } else {
                // topNames and topDescriptions are handled later
                // here we store in hash map (for sorting purposes)
                $topNameDescMap[$targetName] = $targetDescription;
                if (strlen($targetName) > $maxLength) {
                    $maxLength = strlen($targetName);
                }
            }
        }

        // Sort the arrays
        sort($subNames); // sort array values, resetting keys (which are numeric)
        ksort($topNameDescMap); // sort the keys (targetName) keeping key=>val associations

        $topNames = array_keys($topNameDescMap);
        $topDescriptions = array_values($topNameDescMap);

        $defaultTarget = $project->getDefaultTarget();

        if ($defaultTarget !== null && $defaultTarget !== "") {
            $defaultName = [];
            $defaultDesc = [];
            $defaultName[] = $defaultTarget;

            $indexOfDefDesc = array_search($defaultTarget, $topNames, true);
            if ($indexOfDefDesc !== false && $indexOfDefDesc >= 0) {
                $defaultDesc = [];
                $defaultDesc[] = $topDescriptions[$indexOfDefDesc];
            }

            $this->_printTargets($defaultName, $defaultDesc, "Default target:", $maxLength);
        }
        $this->_printTargets($topNames, $topDescriptions, "Main targets:", $maxLength);
        $this->_printTargets($subNames, null, "Subtargets:", 0);
    }
public function printTargets($project)
    {
        // find the target with the longest name
        $maxLength = 0;
        $targets = $project->getTargets();
        $targetName = null;
        $targetDescription = null;
        $currentTarget = null;

        // split the targets in top-level and sub-targets depending
        // on the presence of a description

        $subNames = [];
        $topNameDescMap = [];

        foreach ($targets as $currentTarget) {
            $targetName = $currentTarget->getName();
            $targetDescription = $currentTarget->getDescription();
            if ($currentTarget->isHidden()) {
                continue;
            }

            // subtargets are targets w/o descriptions
            if ($targetDescription === null) {
                $subNames[] = $targetName;
            } else {
                // topNames and topDescriptions are handled later
                // here we store in hash map (for sorting purposes)
                $topNameDescMap[$targetName] = $targetDescription;
                if (strlen($targetName) > $maxLength) {
                    $maxLength = strlen($targetName);
                }
            }
        }

        // Sort the arrays
        sort($subNames); // sort array values, resetting keys (which are numeric)
        ksort($topNameDescMap); // sort the keys (targetName) keeping key=>val associations

        $topNames = array_keys($topNameDescMap);
        $topDescriptions = array_values($topNameDescMap);

        $defaultTarget = $project->getDefaultTarget();

        if ($defaultTarget !== null && $defaultTarget !== "") {
            $defaultName = [];
            $defaultDesc = [];
            $defaultName[] = $defaultTarget;

            $indexOfDefDesc = array_search($defaultTarget, $topNames, true);
            if ($indexOfDefDesc !== false && $indexOfDefDesc >= 0) {
                $defaultDesc = [];
                $defaultDesc[] = $topDescriptions[$indexOfDefDesc];
            }

            $this->_printTargets($defaultName, $defaultDesc, "Default target:", $maxLength);
        }
        $this->_printTargets($topNames, $topDescriptions, "Main targets:", $maxLength);
        $this->_printTargets($subNames, null, "Subtargets:", 0);
    }
public function printTargets ( $ project ) { // find the target with the longest name $ maxLength = 0 ; $ targets = $ project -> getTargets ( ) ; $ targetName = null ; $ targetDescription = null ; $ currentTarget = null ; // split the targets in top-level and sub-targets depending // on the presence of a description $ subNames = [ ] ; $ topNameDescMap = [ ] ; foreach ( $ targets as $ currentTarget ) { $ targetName = $ currentTarget -> getName ( ) ; $ targetDescription = $ currentTarget -> getDescription ( ) ; if ( $ currentTarget -> isHidden ( ) ) { continue ; } // subtargets are targets w/o descriptions if ( $ targetDescription === null ) { $ subNames [ ] = $ targetName ; } else { // topNames and topDescriptions are handled later // here we store in hash map (for sorting purposes) $ topNameDescMap [ $ targetName ] = $ targetDescription ; if ( strlen ( $ targetName ) > $ maxLength ) { $ maxLength = strlen ( $ targetName ) ; } } } // Sort the arrays sort ( $ subNames ) ; // sort array values, resetting keys (which are numeric) ksort ( $ topNameDescMap ) ; // sort the keys (targetName) keeping key=>val associations $ topNames = array_keys ( $ topNameDescMap ) ; $ topDescriptions = array_values ( $ topNameDescMap ) ; $ defaultTarget = $ project -> getDefaultTarget ( ) ; if ( $ defaultTarget !== null && $ defaultTarget !== "" ) { $ defaultName = [ ] ; $ defaultDesc = [ ] ; $ defaultName [ ] = $ defaultTarget ; $ indexOfDefDesc = array_search ( $ defaultTarget , $ topNames , true ) ; if ( $ indexOfDefDesc !== false && $ indexOfDefDesc >= 0 ) { $ defaultDesc = [ ] ; $ defaultDesc [ ] = $ topDescriptions [ $ indexOfDefDesc ] ; } $ this -> _printTargets ( $ defaultName , $ defaultDesc , "Default target:" , $ maxLength ) ; } $ this -> _printTargets ( $ topNames , $ topDescriptions , "Main targets:" , $ maxLength ) ; $ this -> _printTargets ( $ subNames , null , "Subtargets:" , 0 ) ; }
Print out a list of all targets in the current buildfile

@param $project
Print out a list of all targets in the current buildfile