本文整理汇总了PHP中Argument::getAllArguments方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::getAllArguments方法的具体用法?PHP Argument::getAllArguments怎么用?PHP Argument::getAllArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Argument
的用法示例。
在下文中一共展示了Argument::getAllArguments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: json_encode
<?php
/**
* Created by IntelliJ IDEA.
* User: Tyler
* Date: 7/12/2015
* Time: 2:04 AM
*/
require_once "../SQLUtil.php";
require_once "../objects/Argument.php";
$json = null;
$args = Argument::getAllArguments();
if ($args != false) {
$json = array('data' => $args);
} else {
$json = "Error getting all arguments.";
}
echo json_encode($json);