mirror of
https://github.com/friendica/friendica
synced 2025-04-28 21:44:22 +02:00
Refactor Process for new paradigm
This commit is contained in:
parent
0e2e488521
commit
38f70cc55a
14 changed files with 456 additions and 491 deletions
46
src/Core/Worker/Entity/Process.php
Normal file
46
src/Core/Worker/Entity/Process.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Core\Worker\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Friendica\BaseEntity;
|
||||
|
||||
/**
|
||||
* @property-read int $pid
|
||||
* @property-read string $command
|
||||
* @property-read DateTime $created
|
||||
*/
|
||||
class Process extends BaseEntity
|
||||
{
|
||||
/** @var int */
|
||||
protected $pid;
|
||||
/** @var string */
|
||||
protected $command;
|
||||
/** @var DateTime */
|
||||
protected $created;
|
||||
|
||||
/**
|
||||
* @param int $pid
|
||||
* @param string $command
|
||||
* @param DateTime $created
|
||||
*/
|
||||
public function __construct(int $pid, string $command, DateTime $created)
|
||||
{
|
||||
$this->pid = $pid;
|
||||
$this->command = $command;
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Process with the given PID
|
||||
*
|
||||
* @param int $pid
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function withPid(int $pid): Process
|
||||
{
|
||||
return new static($pid, $this->command, new DateTime('now', new \DateTimeZone('URC')));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue