| Total Complexity | 6 |
| Total Lines | 83 |
| Duplicated Lines | 0 % |
| Changes | 5 | ||
| Bugs | 3 | Features | 0 |
| 1 | <?php |
||
| 5 | class Request |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * HTTP request's data. |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $requestData = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * HTTP POST data. |
||
| 16 | * |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | protected $postData = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * HTTP GET data. |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | protected $getData = []; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Request constructor. |
||
| 30 | */ |
||
| 31 | public function __construct() |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Set requestData, postData, getData. |
||
| 38 | * |
||
| 39 | * @return null |
||
| 40 | */ |
||
| 41 | public function setData() |
||
| 42 | { |
||
| 43 | if (config('payment.octane',false)) { |
||
|
|
|||
| 44 | $this->requestData = request()->all(); |
||
| 45 | $this->postData = null; |
||
| 46 | $this->getData = null; |
||
| 47 | } else { |
||
| 48 | $this->requestData = $_REQUEST; |
||
| 49 | $this->postData = $_POST; |
||
| 50 | $this->getData = $_GET; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Retrieve HTTP request data. |
||
| 56 | * |
||
| 57 | * @param string $name |
||
| 58 | * |
||
| 59 | * @return mixed|null |
||
| 60 | */ |
||
| 61 | public static function input(string $name) |
||
| 62 | { |
||
| 63 | return (new static)->requestData[$name] ?? null; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Retrieve HTTP POST data. |
||
| 68 | * |
||
| 69 | * @param string $name |
||
| 70 | * |
||
| 71 | * @return void |
||
| 72 | */ |
||
| 73 | public static function post(string $name) |
||
| 74 | { |
||
| 75 | return (new static)->postData[$name] ?? null; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Retrieve HTTP GET data. |
||
| 80 | * |
||
| 81 | * @param string $name |
||
| 82 | * |
||
| 83 | * @return void |
||
| 84 | */ |
||
| 85 | public static function get(string $name) |
||
| 88 | } |
||
| 89 | } |
||
| 90 |