<commit_before><?php

class Facade{

    private $array = [];

    private $controller = null;

    private $method = null;

    private $args = null;

    private $url = null;

    public $request = null;

    public $response = null;

    public function __construct()
    {
        // initialize the request and respond objects
        $this->request  = new Request();
        $this->response = new Response();

        // also initiate the starting config array values
        if(!isset($array['routes'])){
            $array['routes'] = require str_replace("\\", "/", dirname(__DIR__)) . "/app/config/Router.php";
        }

        //print_r($array['routes']); echo "<br>";
    }

    public function run()
    {
        // split the requested URL
        // in order to indentify the controllers and the methods
        $this->splitUrl();

        /*
        echo "<hr>";
        echo $this->controller . "<br>";
        echo $this->method . "<br>";
        print_r($this->args) . "<br>";
        echo count($this->args) . "<br>";
        echo "<hr>";
        */

        // check if the controller parameter is defined in the url or not
        if(!empty($this->controller))
        {
            // validate the controller whether the controller exists or not
            if(!self::validateController($this->controller))
            {
                echo "controller tidak ada<br>";
                // throw error exception

            }
            // if controller exists is valid then validate the methods
            else
            {
                //echo "controller ada<br>";

                // check if the method parameter is empty or not
                if(!empty($this->method))
                {
                    // validate method existence in controller
                    if(self::validateMethod($this->controller, $this->method))
                    {
                        //echo "method ditemukan<br>";

                        // validate the number of method's arguments
                        if(self::validateArgs($this->controller, $this->method, $this->args))
                        {
                            //echo "jumlah argumen sesuai<br>";

                            // everything is checked and valid
                            // finally instantiate the controller object, and call it's action method.

                            $this->invoke($this->controller, $this->method, $this->args);
                        }
                        else
                        {
                            echo "jumlah argumen tidak sesuai<br>";
                        }

                    }
                    else
                    {
                        echo "method tidak ditemukan<br>";
                        // throw error exception
                    }
                }
                else
                {
                    $this->method = "index";

                    if(!method_exists($this->controller, $this->method)){
                        echo "method index tidak ada<br>";
                        //return $this->notFound();
                    }

                    return $this->invoke($this->controller, $this->method, $this->args);
                }
            }


        }<commit_msg>Fixed some local language information feedbacks<commit_after><?php

class Facade{

    private $array = [];

    private $controller = null;

    private $method = null;

    private $args = null;

    private $url = null;

    public $request = null;

    public $response = null;

    public function __construct()
    {
        // initialize the request and respond objects
        $this->request  = new Request();
        $this->response = new Response();

        // also initiate the starting config array values
        if(!isset($array['routes'])){
            $array['routes'] = require str_replace("\\", "/", dirname(__DIR__)) . "/app/config/Router.php";
        }

        //print_r($array['routes']); echo "<br>";
    }

    public function run()
    {
        // split the requested URL
        // in order to indentify the controllers and the methods
        $this->splitUrl();

        /*
        echo "<hr>";
        echo $this->controller . "<br>";
        echo $this->method . "<br>";
        print_r($this->args) . "<br>";
        echo count($this->args) . "<br>";
        echo "<hr>";
        */

        // check if the controller parameter is defined in the url or not
        if(!empty($this->controller))
        {
            // validate the controller whether the controller exists or not
            if(!self::validateController($this->controller))
            {
                echo "Controller cannot be found!<br>";
                // throw error exception

            }
            // if controller exists is valid then validate the methods
            else
            {
                // check if the method parameter is empty or not
                if(!empty($this->method))
                {
                    // validate method existence in controller
                    if(self::validateMethod($this->controller, $this->method))
                    {
                        // validate the number of method's arguments
                        if(self::validateArgs($this->controller, $this->method, $this->args))
                        {
                            // everything is checked and valid
                            // finally instantiate the controller object, and call it's action method.

                            $this->invoke($this->controller, $this->method, $this->args);
                        }
                        else
                        {
                            echo "Bad arguments given, arguments number is not valid!<br>";
                        }

                    }
                    else
                    {
                        echo "Cannot find the specific method!<br>";
                        // throw error exception
                    }
                }
                else
                {
                    $this->method = "index";

                    if(!method_exists($this->controller, $this->method)){
                        echo "Index method doesn't exists!<br>";
                        //return $this->notFound();
                    }

                    return $this->invoke($this->controller, $this->method, $this->args);
                }
            }


        }
{'fraction_non_alphanumeric': 0.11311728395061728, 'fraction_numerical': 0.0, 'mean_word_length': 1.1984396200814111, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 82, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '754942', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1411, 'n_words': 424}