for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of PHP-Task library.
*
* (c) php-task
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Task;
use Ramsey\Uuid\Uuid;
/**
* Task contains name and workload to run with a handler.
* @author @wachterjohannes <[email protected]>
class Task implements TaskInterface
{
* @var string
private $uuid;
private $taskName;
private $key;
* @var string|\Serializable
private $workload;
* @var \DateTime
private $executionDate;
* @var bool
private $completed = false;
private $result;
public function __construct($taskName, $workload, $uuid = null)
$this->uuid = $uuid ?: Uuid::uuid4()->toString();
$this->taskName = $taskName;
$this->workload = $workload;
$this->executionDate = new \DateTime();
}
* {@inheritdoc}
public function getUuid()
return $this->uuid;
public function getTaskName()
return $this->taskName;
public function getKey()
return $this->key;
public function setKey($key)
$this->key = $key;
return $this;
public function getWorkload()
return $this->workload;
public function isCompleted()
return $this->completed;
public function setCompleted()
$this->completed = true;
public function getResult()
return $this->result;
public function setResult($result)
$this->result = $result;
public function getExecutionDate()
return $this->executionDate;
public function setExecutionDate(\DateTime $executionDate)
$this->executionDate = $executionDate;