本文整理汇总了PHP中Task::getTaskName方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getTaskName方法的具体用法?PHP Task::getTaskName怎么用?PHP Task::getTaskName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::getTaskName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Perform the work.
*
* @throws BuildException if there is an error.
*/
public function main()
{
$errorMessages = '';
for ($i = 0; $i <= $this->retryCount; $i++) {
try {
$this->nestedTask->perform();
break;
} catch (Exception $e) {
$errorMessages .= $e->getMessage();
if ($i >= $this->retryCount) {
$taskName = $this->nestedTask->getTaskName();
$exceptionMessage = <<<EXCEPTION_MESSAGE
Task [{$taskName}] failed after [{$this->retryCount}] attempts; giving up
Error messages:
{$errorMessages}
EXCEPTION_MESSAGE;
throw new BuildException($exceptionMessage, $this->getLocation());
}
if ($this->retryDelay > 0) {
$msg = sprintf('Attempt [%s]: error occurred; retrying after %s s...', $i, $this->retryDelay);
} else {
$msg = sprintf('Attempt [%s]: error occurred; retrying...', $i);
}
$this->log($msg, Project::MSG_INFO);
$errorMessages .= PHP_EOL;
if ($this->retryDelay > 0) {
sleep($this->retryDelay);
}
}
}
}
示例2: getTaskName
/**
* Get the name of the task to use in logging messages.
*
* @return string The task's name
*/
public function getTaskName()
{
return $this->realThing === null ? parent::getTaskName() : $this->realThing->getTaskName();
}
示例3: getTaskName
/**
* Get the name of the task to use in logging messages.
*
* @return string The task's name
*/
public function getTaskName()
{
return $this->realThing === null || !$this->realThing instanceof Task ? parent::getTaskName() : $this->realThing->getTaskName();
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$task_name = "Wash the dog";
$id = 1;
$due_date = null;
$test_task = new Task($task_name, $id, $due_date);
$test_task->save();
$new_task_name = "Clean the dog";
//Act
$test_task->update($new_task_name);
//Assert
$this->assertEquals("Clean the dog", $test_task->getTaskName());
}