* @return command list
*/
public List<FrameworkCommand> getCommands(PhpModule phpModule) {
List<FrameworkCommand> commands = new ArrayList<FrameworkCommand>();
commands.add(new YiiFrameworkCommand(phpModule, HELP_COMMAND, HELP_COMMAND, HELP_COMMAND));
YiiModule yiiModule = YiiModuleFactory.create(phpModule);
List<FileObject> commandFiles = new LinkedList<FileObject>();
// get core commands
FileObject coreCommandsDirectory = yiiModule.getFileObject(PATH_ALIAS.SYSTEM, "cli/commands"); // NOI18N
if (coreCommandsDirectory != null) {
addCommands(coreCommandsDirectory, commandFiles);
} else {
// add default commands
for (String command : DEFAULT_COMMANDS) {
commands.add(new YiiFrameworkCommand(phpModule, command, command, command));
}
}
// get application commands
FileObject appCommandsDirectory = yiiModule.getFileObject(PATH_ALIAS.APPLICATION, "commands"); // NOI18N
if (appCommandsDirectory != null) {
addCommands(appCommandsDirectory, commandFiles);
}
// sort