<commit_before><?php
/**
 * This class helps you quickly write simple yet powerful web services and APIs.
 *
 * @package Advandz
 * @subpackage Advandz.app.facades
 * @copyright Copyright (c) 2012-2017 CyanDark, Inc. All Rights Reserved.
 * @license https://opensource.org/licenses/MIT The MIT License (MIT)
 * @author The Advandz Team <<EMAIL>>
 */

namespace Advandz\App\Facade;

final class App
{
    /**
     * Protected constructor to prevent instance creation.
     */
    protected function __construct()
    {
        // Nothing to do
    }

    /**
     * Process the GET requests.
     *
     * @param string $pattern The URI pattern to execute the request
     */
    final public static function get($pattern, $callable)
    {
        if (self::getMethod() === 'GET' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the POST requests.
     *
     * @param string $pattern The URI pattern to execute the request
     */
    final public static function post($pattern, $callable)
    {
        if (self::getMethod() === 'POST' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the PUT requests.
     *
     * @param string $pattern The URI pattern to execute the request
     */
    final public static function put($pattern, $callable)
    {
        if (self::getMethod() === 'PUT' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the PATCH requests.
     *
     * @param string $pattern The URI pattern to execute the request
     */
    final public static function patch($pattern, $callable)
    {
        if (self::getMethod() === 'PATCH' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the DELETE requests.
     *
     * @param string $pattern The URI pattern to execute the request
     */
    final public static function delete($pattern, $callable)
    {
        if (self::getMethod() === 'DELETE' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Returns the HTTP method used to access this page.
     */
    final public static function getMethod()
    {
        return filter_input(INPUT_SERVER, 'REQUEST_METHOD');
    }

    /**
     * Returns the URI which was given in order to access this page.
     */
    final public static function getUri()<commit_msg>Update app.php<commit_after><?php
/**
 * This class helps you quickly write simple yet powerful web services and APIs.
 *
 * @package Advandz
 * @subpackage Advandz.app.facades
 * @copyright Copyright (c) 2012-2017 CyanDark, Inc. All Rights Reserved.
 * @license https://opensource.org/licenses/MIT The MIT License (MIT)
 * @author The Advandz Team <<EMAIL>>
 */

namespace Advandz\App\Facade;

final class App
{
    /**
     * Protected constructor to prevent instance creation.
     */
    protected function __construct()
    {
        // Nothing to do
    }

    /**
     * Process the GET requests.
     *
     * @param string $pattern The URI pattern to execute the request
     * @param callable $callable The anonymous function to process the request
     */
    final public static function get($pattern, $callable)
    {
        if (self::getMethod() === 'GET' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the POST requests.
     *
     * @param string $pattern The URI pattern to execute the request
     * @param callable $callable The anonymous function to process the request
     */
    final public static function post($pattern, $callable)
    {
        if (self::getMethod() === 'POST' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the PUT requests.
     *
     * @param string $pattern The URI pattern to execute the request
     * @param callable $callable The anonymous function to process the request
     */
    final public static function put($pattern, $callable)
    {
        if (self::getMethod() === 'PUT' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the PATCH requests.
     *
     * @param string $pattern The URI pattern to execute the request
     * @param callable $callable The anonymous function to process the request
     */
    final public static function patch($pattern, $callable)
    {
        if (self::getMethod() === 'PATCH' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Process the DELETE requests.
     *
     * @param string $pattern The URI pattern to execute the request
     * @param callable $callable The anonymous function to process the request
     */
    final public static function delete($pattern, $callable)
    {
        if (self::getMethod() === 'DELETE' && self::validatePattern($pattern)) {
            if (is_callable($callable)) {
                $parameters = self::parsePattern($pattern);

                call_user_func_array($callable, $parameters);
            }
        }
    }

    /**
     * Returns the HTTP method used to access this page.
     */
    final public static function getMethod()
    {
        return filter_input(INPUT_SERVER, 'REQUEST_METHOD');
    }

    /**
     * Returns the URI which was given in order to access this page.
     */
    final public static function getUri()
{'fraction_non_alphanumeric': 0.11404280269715626, 'fraction_numerical': 0.0023453532688361184, 'mean_word_length': 2.2108235294117646, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6675269', 'n_tokens_mistral': 1851, 'n_tokens_neox': 1790, 'n_words': 528}