Ignore:
Timestamp:
Dec 6, 2021, 11:33:48 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Added: Explicit types for better type checking.
  • Fixed: Support for php 8.0.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Process.php

    r93 r95  
    33class Process
    44{
    5   var $Command;
    6   var $Handle;
    7   var $Pipes;
    8   var $Environment;
    9   var $WorkingDir;
    10  
     5  public string $Command;
     6  public $Handle;
     7  public array $Pipes;
     8  public array $Environment;
     9  public ?string $WorkingDir;
     10
    1111  function __construct()
    1212  {
     
    1717    $this->WorkingDir = null;
    1818  }
    19  
    20   function Start()
     19
     20  function Start(): void
    2121  {
    22     if(!$this->IsRunning())
     22    if (!$this->IsRunning())
    2323    {
    2424      $DescriptorSpec = array(
     
    2828      );
    2929
    30       $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes, 
     30      $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes,
    3131        $this->WorkingDir, $this->Environment);
    3232      stream_set_blocking($this->Pipes[0], FALSE);
     
    3535    }
    3636  }
    37  
    38   function Stop()
     37
     38  function Stop(): void
    3939  {
    40     if($this->IsRunning())
     40    if ($this->IsRunning())
    4141    {
    4242      proc_close($this->Handle);
     
    4444    }
    4545  }
    46  
    47   function IsRunning()
     46
     47  function IsRunning(): bool
    4848  {
    49     return(is_resource($this->Handle));
     49    return is_resource($this->Handle);
    5050  }
    5151}
Note: See TracChangeset for help on using the changeset viewer.