Clockwork\Request\Timeline::addEvent PHP Method

addEvent() public method

Add a new event
public addEvent ( $name, $description, $start_time, $end_time, array $data = [] )
$data array
    public function addEvent($name, $description, $start_time, $end_time, array $data = [])
    {
        $this->data[$name] = ['start' => $start_time, 'end' => $end_time, 'duration' => null, 'description' => $description, 'data' => $data];
    }

Usage Example

 /**
  * @param float $start
  * @param float $end
  * @param \Psr\Http\Message\RequestInterface $request
  * @param \Psr\Http\Message\ResponseInterface $response
  */
 public function add($start, $end, RequestInterface $request, ResponseInterface $response = null)
 {
     $description = $this->describe($request, $response);
     $name = spl_object_hash($request);
     $this->timeline->addEvent($name, $description, $start, $end);
 }