-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathPreProcessApiEvent.php
More file actions
36 lines (31 loc) · 1014 Bytes
/
PreProcessApiEvent.php
File metadata and controls
36 lines (31 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace DreamFactory\Core\Events;
use DreamFactory\Core\Contracts\ServiceRequestInterface;
use DreamFactory\Core\Contracts\ServiceResponseInterface;
class PreProcessApiEvent extends InterProcessApiEvent
{
public $request;
public $response;
/**
* Create a new event instance.
*
* @param string $path
* @param ServiceRequestInterface $request
* @param ServiceResponseInterface $response
* @param mixed $resource
*/
public function __construct($path, &$request, &$response, $resource = null)
{
$this->request = $request;
$this->response = $response;
$name = strtolower($path . '.' . str_replace('/', '.', $resource) . '.' . $request->getMethod()) . '.pre_process';
parent::__construct($name, $resource);
}
public function makeData()
{
return [
'request' => $this->request->toArray(),
'resource' => $this->resource,
];
}
}