<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Request;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Data\Abstraction\DataTypeInterface;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Container\ParameterContainer;
/**
 * Class Request, shares data access methods to request.
 *
 * @package WPDesk\Library\DropshippingExport\Infrastructure\Request
 */
class Request
{
    /**
     * @var ParameterContainer
     */
    private $parameter_container;
    public function __construct()
    {
        $this->parameter_container = new ParameterContainer(['METHOD' => strtoupper(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'), 'GET' => $_GET, 'POST' => $_POST, 'FILES' => $_FILES, 'COOKIE' => $_COOKIE, 'SERVER' => $_SERVER, 'SESSION' => isset($_SESSION) ? $_SESSION : [], 'INPUT' => file_get_contents('php://input')]);
    }
    public function get_param(string $param): DataTypeInterface
    {
        return $this->parameter_container->get_param($param);
    }
}
