<?php

namespace Miladmodaresi\Taamito\Base;

use WP_REST_Request;

class BaseController
{
    public $request = null;

    public function __construct()
    {
        $method = isset($_SERVER['REQUEST_METHOD']) ? strtoupper($_SERVER['REQUEST_METHOD']) : 'GET';
        $request = $method === 'POST' ? ($_POST ?? []) : ($_GET ?? []);

        if (isset($request['action'])) {
        unset($request['action']);
        }

        $this->request = new WP_REST_Request($method, '', $request);
    }
    
}
