本文整理汇总了PHP中thebuggenie\core\entities\Status::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::has方法的具体用法?PHP Status::has怎么用?PHP Status::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Status
的用法示例。
在下文中一共展示了Status::has方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasValidTarget
public function hasValidTarget()
{
if (!$this->_target_value) {
return true;
}
switch ($this->_action_type) {
case self::ACTION_ASSIGN_ISSUE:
$target_details = explode('_', $this->_target_value);
return (bool) ($target_details[0] == 'user') ? \thebuggenie\core\entities\User::doesIDExist($target_details[1]) : Team::doesIDExist($target_details[1]);
break;
case self::ACTION_SET_PERCENT:
return (bool) ($this->_target_value > -1);
break;
case self::ACTION_SET_MILESTONE:
return (bool) Milestone::doesIDExist($this->_target_value);
break;
case self::ACTION_SET_PRIORITY:
return (bool) Priority::has($this->_target_value);
break;
case self::ACTION_SET_STATUS:
return (bool) Status::has($this->_target_value);
break;
case self::ACTION_SET_REPRODUCABILITY:
return (bool) Reproducability::has($this->_target_value);
break;
case self::ACTION_SET_RESOLUTION:
return (bool) Resolution::has($this->_target_value);
break;
default:
return true;
}
}
示例2: isValid
public function isValid($input)
{
switch ($this->_name) {
case self::RULE_MAX_ASSIGNED_ISSUES:
$num_issues = (int) $this->getRuleValue();
return $num_issues ? (bool) (count(framework\Context::getUser()->getUserAssignedIssues()) < $num_issues) : true;
break;
case self::RULE_TEAM_MEMBERSHIP_VALID:
$valid_items = explode(',', $this->getRuleValue());
$teams = \thebuggenie\core\entities\Team::getAll();
if ($this->isPost()) {
if ($input instanceof \thebuggenie\core\entities\Issue) {
$assignee = $input->getAssignee();
}
}
if (!isset($assignee)) {
$assignee = framework\Context::getUser();
}
if ($assignee instanceof \thebuggenie\core\entities\User) {
if (count($valid_items) == 1 && reset($valid_items) == '') {
return true;
}
foreach ($valid_items as $team_id) {
if ($assignee->isMemberOfTeam($teams[$team_id])) {
return true;
}
}
} elseif ($assignee instanceof \thebuggenie\core\entities\Team) {
foreach ($valid_items as $team_id) {
if ($assignee->getID() == $team_id) {
return true;
}
}
}
return false;
case self::RULE_ISSUE_IN_MILESTONE_VALID:
$valid_items = explode(',', $this->getRuleValue());
if ($input instanceof \thebuggenie\core\entities\Issue) {
$issue = $input;
} else {
if ($input->hasParameter('issue_id')) {
$issue = \thebuggenie\core\entities\Issue::getB2DBTable()->selectByID((int) $input->getParameter('issue_id'));
}
}
if (isset($issue) && $issue instanceof \thebuggenie\core\entities\Issue) {
if (!$issue->getMilestone() instanceof \thebuggenie\core\entities\Milestone) {
return false;
}
if (count($valid_items) == 1 && reset($valid_items) == '') {
return true;
}
return in_array($issue->getMilestone()->getID(), $valid_items);
}
return false;
case self::RULE_STATUS_VALID:
case self::RULE_PRIORITY_VALID:
case self::RULE_RESOLUTION_VALID:
case self::RULE_REPRODUCABILITY_VALID:
$valid_items = explode(',', $this->getRuleValue());
$valid = false;
if ($this->_name == self::RULE_STATUS_VALID) {
$fieldname = 'Status';
$fieldname_small = 'status';
} elseif ($this->_name == self::RULE_RESOLUTION_VALID) {
$fieldname = 'Resolution';
$fieldname_small = 'resolution';
} elseif ($this->_name == self::RULE_REPRODUCABILITY_VALID) {
$fieldname = 'Reproducability';
$fieldname_small = 'reproducability';
} elseif ($this->_name == self::RULE_PRIORITY_VALID) {
$fieldname = 'Priority';
$fieldname_small = 'priority';
} else {
throw new framework\exceptions\ConfigurationException(framework\Context::getI18n()->__('Invalid workflow validation rule: %rule_name', array('%rule_name' => $this->_name)));
}
if (!$this->getRuleValue()) {
if ($input instanceof \thebuggenie\core\entities\Issue) {
$getter = "get{$fieldname}";
if (is_object($input->{$getter}())) {
$valid = true;
}
} elseif ($input instanceof framework\Request) {
if ($input->getParameter("{$fieldname_small}_id") && Status::has($input->getParameter("{$fieldname_small}_id"))) {
$valid = true;
}
}
} else {
foreach ($valid_items as $item) {
if ($input instanceof \thebuggenie\core\entities\Issue) {
$type = "\\thebuggenie\\core\\entities\\{$fieldname}";
$getter = "get{$fieldname}";
if (is_object($input->{$getter}()) && $type::getB2DBTable()->selectByID((int) $item)->getID() == $input->{$getter}()->getID()) {
$valid = true;
break;
}
} elseif ($input instanceof framework\Request) {
if ($input->getParameter("{$fieldname_small}_id") == $item) {
$valid = true;
break;
}
//.........这里部分代码省略.........