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


PHP Command::getName方法代码示例

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


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

示例1: add

 /**
  * Add a command to this collection.
  *
  * @param  Command $command  The command to add
  *
  * @return CommandCollection Returns $this for chainability
  *
  * @throws \InvalidArgumentException If a command with the same name has
  *                                   already been set on this collection
  */
 public function add(Command $command)
 {
     if (isset($this->_commands[$command->getName()])) {
         throw new \InvalidArgumentException(sprintf('Command `%s` is already defined', $command->getName()));
     }
     $this->_commands[$command->getName()] = $command;
     return $this;
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:18,代码来源:CommandCollection.php

示例2: invokeCallbacks

 /**
  * Invoke a command by calling all the registered callbacks
  *
  * @param  string|CommandInterface  $command    The command name or a CommandInterface object
  * @param  array|\Traversable       $attributes An associative array or a Traversable object
  * @param  ObjectInterface          $subject    The command subject
  * @return mixed|null If a callback break, returns the break condition. NULL otherwise.
  */
 public function invokeCallbacks($command, $attributes = null, $subject = null)
 {
     //Make sure we have an command object
     if (!$command instanceof CommandInterface) {
         if ($attributes instanceof CommandInterface) {
             $name = $command;
             $command = $attributes;
             $command->setName($name);
         } else {
             $command = new Command($command, $attributes, $subject);
         }
     }
     foreach ($this->getCommandCallbacks($command->getName()) as $handler) {
         $method = $handler['method'];
         $params = $handler['params'];
         if (is_string($method)) {
             $result = $this->invokeCommandCallback($method, $command->append($params));
         } else {
             $result = $method($command->append($params));
         }
         if ($result !== null && $result === $this->getBreakCondition()) {
             return $result;
         }
     }
 }
开发者ID:nooku,项目名称:nooku-framework,代码行数:33,代码来源:abstract.php

示例3: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) == "popup") {
         if ($sender->hasPermission("joinpopup") || $sender->hasPermission("joinpopup.command")) {
             if (isset($args[0]) == "off") {
                 if (isset($this->playersEnabled[$sender->getName()])) {
                     unset($this->playersEnabled[$sender->getName()]);
                     $sender->sendMessage("Popups disabled");
                     return true;
                 } else {
                     $sender->sendMessage("Popups aren't enabled for you");
                     return true;
                 }
             } elseif ($args[0] == "on") {
                 if (isset($this->playersEnabled[$sender->getName()])) {
                     $sender->sendMessage("Popups are already enabled for you");
                     return true;
                 } else {
                     $this->playersEnabled[$sender->getName] = $sender->getName();
                     $sender->sendMessage("Popups has been enabled for you");
                     return true;
                 }
             } else {
                 $sender->sendMessage("Unknown argument: " . $args[0]);
                 return true;
             }
         } else {
             $sender->sendMessage("You don't have permission to use that command!");
             return true;
         }
     }
 }
开发者ID:Blubberboy333,项目名称:JoinPopups,代码行数:32,代码来源:Main.php

示例4: generate

 /**
  * @param Command $command
  *
  * @return string
  */
 public function generate(Command $command)
 {
     $origMethodName = $command->getMethod() ?: $command->getName();
     $methodNameParts = explode('-', $origMethodName);
     $methodNameStart = array_shift($methodNameParts);
     $methodNameEnd = implode('', array_map('ucfirst', $methodNameParts));
     return $methodNameStart . $methodNameEnd . 'Cmd';
 }
开发者ID:alcaeus,项目名称:hipchat-commander,代码行数:13,代码来源:MethodGenerator.php

示例5: testCommand

 public function testCommand()
 {
     $cmd = new Command('cmd', 'description', ['cmd1', 'cmd2'], true, 'cmdMethod');
     $this->assertSame('cmd', $cmd->getName());
     $this->assertSame('description', $cmd->getDescription());
     $this->assertSame(['cmd1', 'cmd2'], $cmd->getAliases());
     $this->assertTrue($cmd->isDefault());
     $this->assertSame('cmdMethod', $cmd->getMethod());
 }
开发者ID:alcaeus,项目名称:hipchat-commander,代码行数:9,代码来源:CommandTest.php

示例6: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch (strtolower($command->getName())) {
         case "changepw":
             //Change password...
             break;
         case "unregister":
             //Unregister...
             break;
     }
 }
开发者ID:Jackboy320,项目名称:xAuth,代码行数:11,代码来源:CommandManager.php

示例7: displayCommand

 /**
  * @param SmartyHelper $smartyHelper
  * @param Command $cmd
  */
 public static function displayCommand(SmartyHelper $smartyHelper, Command $cmd, $isManager, $selectedFilters = '')
 {
     if ($isManager) {
         $smartyHelper->assign('isManager', true);
     }
     $smartyHelper->assign('cmdid', $cmd->getId());
     $smartyHelper->assign('cmdName', $cmd->getName());
     $smartyHelper->assign('cmdReference', $cmd->getReference());
     $smartyHelper->assign('cmdVersion', $cmd->getVersion());
     $smartyHelper->assign('cmdReporter', $cmd->getReporter());
     $smartyHelper->assign('cmdStateList', self::getCommandStateList($cmd));
     $smartyHelper->assign('cmdState', Command::$stateNames[$cmd->getState()]);
     $smartyHelper->assign('cmdAverageDailyRate', $cmd->getAverageDailyRate());
     $smartyHelper->assign('cmdCurrency', $cmd->getCurrency());
     if (!is_null($cmd->getStartDate())) {
         $smartyHelper->assign('cmdStartDate', date("Y-m-d", $cmd->getStartDate()));
     }
     if (!is_null($cmd->getDeadline())) {
         $smartyHelper->assign('cmdDeadline', date("Y-m-d", $cmd->getDeadline()));
     }
     $smartyHelper->assign('cmdDesc', $cmd->getDesc());
     $smartyHelper->assign('cmdProvisionList', self::getProvisionList($cmd));
     $smartyHelper->assign('cmdProvisionTypeMngt', CommandProvision::provision_mngt);
     $smartyHelper->assign('cmdProvisionTotalList', self::getProvisionTotalList($cmd));
     $cmdTotalSoldDays = $cmd->getTotalSoldDays();
     $smartyHelper->assign('cmdTotalSoldDays', $cmdTotalSoldDays);
     // --------------
     // TODO math should not be in here !
     $mgrEE = $cmd->getIssueSelection()->mgrEffortEstim;
     $cmdProvAndMeeCost = $mgrEE * $cmd->getAverageDailyRate() + $cmd->getProvisionBudget(TRUE);
     $smartyHelper->assign('cmdProvAndMeeCost', round($cmdProvAndMeeCost, 2));
     $cmdProvAndMeeDays = $mgrEE + $cmd->getProvisionDays(TRUE);
     $smartyHelper->assign('cmdProvAndMeeDays', round($cmdProvAndMeeDays, 2));
     // TODO math should not be in here !
     $cmdTotalReestimated = $cmd->getIssueSelection()->getReestimated();
     $smartyHelper->assign('cmdTotalReestimated', $cmdTotalReestimated);
     $cmdTotalReestimatedCost = $cmdTotalReestimated * $cmd->getAverageDailyRate();
     $smartyHelper->assign('cmdTotalReestimatedCost', $cmdTotalReestimatedCost);
     // TODO math should not be in here !
     #$cmdTotalElapsed = $cmd->getIssueSelection()->getElapsed();
     #$cmdOutlayCost = $cmdTotalElapsed * $cmd->getAverageDailyRate();
     #$smartyHelper->assign('cmdOutlayCost',$cmdOutlayCost);
     #$smartyHelper->assign('cmdTotalElapsed',$cmdTotalElapsed);
     // TODO math should not be in here !
     $cmdTotalDrift = round($cmdTotalReestimated - $cmdProvAndMeeDays, 2);
     $cmdTotalDriftCost = round($cmdTotalReestimatedCost - $cmdProvAndMeeCost, 2);
     $cmdTotalDriftPercent = 0 == $cmdProvAndMeeDays ? 0 : round($cmdTotalDrift * 100 / $cmdProvAndMeeDays, 2);
     $smartyHelper->assign('cmdTotalDrift', $cmdTotalDrift);
     $smartyHelper->assign('cmdTotalDriftCost', $cmdTotalDriftCost);
     $smartyHelper->assign('cmdTotalDriftPercent', $cmdTotalDriftPercent);
     #$color1 = ($cmdOutlayCost > $cmdProvAndMeeCost) ? "fcbdbd" : "bdfcbd";
     #$smartyHelper->assign('cmdOutlayCostColor', $color1);
     #$color2 = ($cmdTotalElapsed > $cmdProvAndMeeDays) ? "fcbdbd" : "bdfcbd";
     #$smartyHelper->assign('cmdTotalElapsedColor',$color2);
     $color3 = $cmdTotalReestimated > $cmdProvAndMeeDays ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalReestimatedColor', $color3);
     $color4 = $cmdTotalReestimatedCost > $cmdProvAndMeeCost ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalReestimatedCostColor', $color4);
     $color5 = $cmdTotalDrift >= 0 ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalDriftColor', $color5);
     // --------------
     // set CommandSets I belong to
     $smartyHelper->assign('parentCmdSets', self::getParentCommandSets($cmd));
     // set task list
     $cmdIssueSel = $cmd->getIssueSelection();
     $smartyHelper->assign('cmdNbIssues', $cmdIssueSel->getNbIssues());
     $smartyHelper->assign('cmdIssues', self::getCommandIssues($cmd));
     // used to create mantis link to view_all_bug_page.php:
     // view_all_set.php?type=1&temporary=y&FilterBugList_list=5079,5073,5108,5107,49396,5006
     $mantisFilterBugList = implode(',', array_keys($cmdIssueSel->getIssueList()));
     $smartyHelper->assign('mantisFilterBugList', $mantisFilterBugList);
     // --------------
     // Indicators & statistics
     // DetailedChargesIndicator
     $data = self::getDetailedCharges($cmd, $isManager, $selectedFilters);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
开发者ID:dfuzeau,项目名称:codev,代码行数:83,代码来源:command_tools.php

示例8: addCommand

 protected function addCommand(Command $command)
 {
     $command->setDeps($this);
     $this->commands[$command->getName()] = $command;
 }
开发者ID:Rhoban,项目名称:deps,代码行数:5,代码来源:Deps.php

示例9: add

 /**
  * Adds command to te stack
  *
  * Adds command with name (if possible)
  * to allow to override the command with the same name
  *
  * @param Command $command A Command object
  *
  * @return Command The registered command
  */
 public function add(Command $command)
 {
     $command->setTransaction($this);
     if ($command->getName()) {
         $this->commands[$command->getName()] = $command;
     } else {
         $this->commands[] = $command;
     }
     return $command;
 }
开发者ID:devster,项目名称:ika,代码行数:20,代码来源:Transaction.php

示例10: equals

 /**
  * Safe comparator.
  * @param Command $command The commande to compare to.
  * @return boolean True if the compared command is the same of command parameter, false otherwise.
  */
 public function equals($command)
 {
     return $command->getName() == $this->name;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:9,代码来源:Command.php

示例11: addCommand

 public function addCommand(Command $cmd)
 {
     $this->commands[$cmd->getName()] = $cmd;
 }
开发者ID:rbello,项目名称:ent,代码行数:4,代码来源:CommandHandler.php


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