AbstractLoggerRequest.php
11 months ago
ActivateRequest.php
11 months ago
DeactivateRequest.php
11 months ago
InstallRequest.php
11 months ago
OptInRequest.php
11 months ago
OptOutRequest.php
11 months ago
UninstallRequest.php
11 months ago
DeactivateRequest.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Analyst\Http\Requests; |
| 4 | |
| 5 | use Analyst\ApiResponse; |
| 6 | use Analyst\Collector; |
| 7 | use Analyst\Contracts\RequestorContract; |
| 8 | |
| 9 | /** |
| 10 | * Class DeactivateRequest |
| 11 | * |
| 12 | * @since 0.9.10 |
| 13 | */ |
| 14 | class DeactivateRequest extends AbstractLoggerRequest |
| 15 | { |
| 16 | /** |
| 17 | * @var string |
| 18 | */ |
| 19 | protected $question; |
| 20 | |
| 21 | /** |
| 22 | * @var string |
| 23 | */ |
| 24 | protected $answer; |
| 25 | |
| 26 | /** |
| 27 | * @param Collector $collector |
| 28 | * @param $pluginId |
| 29 | * @param $path |
| 30 | * @param $question |
| 31 | * @param $answer |
| 32 | * @return static |
| 33 | */ |
| 34 | public static function make(Collector $collector, $pluginId, $path, $question, $answer) |
| 35 | { |
| 36 | return new static($collector, $pluginId, $path, $question, $answer); |
| 37 | } |
| 38 | |
| 39 | public function __construct(Collector $collector, $pluginId, $path, $question, $answer) |
| 40 | { |
| 41 | parent::__construct($collector, $pluginId, $path); |
| 42 | |
| 43 | $this->question = $question; |
| 44 | $this->answer = $answer; |
| 45 | } |
| 46 | |
| 47 | public function toArray() |
| 48 | { |
| 49 | return array_merge(parent::toArray(), [ |
| 50 | 'question' => $this->question, |
| 51 | 'answer' => $this->answer, |
| 52 | ]); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Execute the request |
| 57 | * @param RequestorContract $requestor |
| 58 | * @return ApiResponse |
| 59 | */ |
| 60 | public function execute(RequestorContract $requestor) |
| 61 | { |
| 62 | return $requestor->post('logger/deactivate', $this->toArray()); |
| 63 | } |
| 64 | } |
| 65 |