-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoltAbstractAction.php
More file actions
38 lines (31 loc) · 927 Bytes
/
BoltAbstractAction.php
File metadata and controls
38 lines (31 loc) · 927 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
37
38
<?php
declare(strict_types=1);
namespace Lit\Bolt;
use Lit\Air\Injection\SetterInjector;
use Lit\Bolt\Middlewares\RequestContext;
use Lit\Voltage\AbstractAction;
use Psr\Http\Message\ResponseFactoryInterface;
/**
* Base action class for bolt
*
* It's strongly recommended to have your own action base class extending this one
*/
abstract class BoltAbstractAction extends AbstractAction
{
public const SETTER_INJECTOR = SetterInjector::class;
/**
* Injector for ResponseFactory
*
* @param ResponseFactoryInterface $responseFactory The ResponseFactory.
* @return $this
*/
public function injectResponseFactory(ResponseFactoryInterface $responseFactory): BoltAbstractAction
{
$this->responseFactory = $responseFactory;
return $this;
}
protected function context(): RequestContext
{
return RequestContext::fromRequest($this->request);
}
}