当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::getAllCommands方法代码示例

本文整理汇总了PHP中Command::getAllCommands方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::getAllCommands方法的具体用法?PHP Command::getAllCommands怎么用?PHP Command::getAllCommands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Command的用法示例。


在下文中一共展示了Command::getAllCommands方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: json_encode

<?php

/**
 * Created by IntelliJ IDEA.
 * User: Tyler
 * Date: 7/11/2015
 * Time: 8:41 PM
 */
require_once "../SQLUtil.php";
require_once "../objects/Command.php";
$json = null;
$commands = Command::getAllCommands();
if ($commands != false) {
    $json = array('data' => $commands);
} else {
    $json = "Error getting all commands.";
}
echo json_encode($json);
开发者ID:TylerSouthmayd,项目名称:PersonalSite,代码行数:18,代码来源:allCommands.php

示例2: getCommandList

 public function getCommandList()
 {
     $commandStructure = array();
     $commands = Command::getAllCommands();
     $arguments = Argument::getAllArguments();
     $commandOptions = CommandOption::getAllCommandOptions();
     $argumentOptions = ArgumentOption::getAllArgumentOptions();
     foreach ($commands as $cmd) {
         $tier1Args = array();
         $tier2Args = array();
         //            $tier3Args = array();
         $cmdOpts = array();
         $argOpts = array();
         foreach ($arguments as $arg) {
             if ($arg["command_name"] == $cmd["name"]) {
                 foreach ($argumentOptions as $argOpt) {
                     if ($argOpt["argument_id"] == $arg["argument_id"]) {
                         array_push($argOpts, array("option_id" => $argOpt["argument_option_id"], "option" => $argOpt["argument_option_name"], "option_short" => $argOpt["argument_option_short_name"], "argument_id" => $argOpt["argument_id"]));
                     }
                 }
                 if ($arg["requires_option"] == 0) {
                     $needsOp = false;
                 } else {
                     $needsOp = true;
                 }
                 if ($arg["argument_tier"] == 1) {
                     array_push($tier1Args, array("argument_id" => $arg["argument_id"], "argument" => $arg["argument_name"], "command_name" => $arg["command_name"], "has_child" => $arg["requires_argument_child"] == '0' ? false : true, "options" => $argOpts, "requires_option" => $needsOp, "user_defined" => $arg["user_defined"] == '0' ? false : true, "tier" => 1));
                 } else {
                     if ($arg["argument_tier"] == 2) {
                         array_push($tier2Args, array("argument_id" => $arg["argument_id"], "argument" => $arg["argument_name"], "argument_parent_id" => $arg["argument_parent"], "has_child" => $arg["requires_argument_child"] == '0' ? false : true, "options" => $argOpts, "requires_option" => $needsOp, "user_defined" => $arg["user_defined"] == '0' ? false : true, "tier" => 2));
                     }
                 }
                 //                    else if($arg["argument_tier"] == 3)
                 //                    {
                 //                        array_push($tier3Args, array(
                 //                            "argument_id" => $arg["argument_id"],
                 //                            "argument" => $arg["argument_name"],
                 //                            "argument_parent_id" => $arg["argument_parent"],
                 //                            "argument_parent" => $arg["command_name"],
                 //                            "has_child" => $arg["requires_argument_child"] == '0' ? false : true,
                 //                            "options" => $argOpts,
                 //                            "requires_option" => $needsOp
                 //                        ));
                 //                    }
                 $argOpts = array();
             }
         }
         foreach ($commandOptions as $cmdOpt) {
             if ($cmdOpt["command_name"] == $cmd["name"]) {
                 array_push($cmdOpts, array("option_id" => $cmdOpt["command_option_id"], "option" => $cmdOpt["command_option_name"], "option_short" => $cmdOpt["command_option_short_name"]));
             }
         }
         if ($cmd["requires_option"] == 0) {
             $needsOp = false;
         } else {
             $needsOp = true;
         }
         array_push($commandStructure, array("command_id" => $cmd["id"], "command" => $cmd["name"], "tier1_arguments" => $tier1Args, "tier2_arguments" => $tier2Args, "options" => $cmdOpts, "requires_option" => $needsOp));
     }
     return $commandStructure;
 }
开发者ID:TylerSouthmayd,项目名称:PersonalSite,代码行数:61,代码来源:Command.php


注:本文中的Command::getAllCommands方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。