<commit_before><?php

/**
 * Walrus Framework
 * File maintained by: <NAME> (E-Wok)
 * Created: 13:26 28/01/14
 */

namespace Walrus\core;

use Exception;

/**
 * Class WalrusCLI
 * @package Walrus\core
 */
class WalrusCLI
{
    /**
     * Check argv to execute the right method.
     */
    public static function execute()
    {
        if (count($_SERVER['argv']) == 1) {
            self::help();
        } elseif (count($_SERVER['argv']) === 3) {
            $method = $_SERVER['argv'][1];
            $param = $_SERVER['argv'][2];

            switch ($method) {
                case 'createController':
                    self::createController($param);
                    break;
                case 'createModel':
                    self::createModel($param);
                    break;
                default:
                    self::help();// @TODO: display an intelligent help ?
            }

        } else {
            // @TODO: display an intelligent help ?
            echo 'error';
            echo "\n";
        }
    }

    /**
     * Give explanation about tusk command.
     *
     * In case no command are recognized, the tusk man is displayed.
     */
    private static function help()
    {
        // @TODO: create man
        echo "\n\tTusk is the Walrus Command Line Interface (CLI).\n";
        echo "\tTusk has been made in order to simplify the creation of models, controllers and API.\n";
        echo "\tIt will generate a simple file in a Walrus way.\n\n";
        echo "\tIn order to create a model you just have to write :\n";
        echo "\t\t php tusk createModel {Name}\n\n";
        echo "\tIn order to create a controller you just have to write :\n";
        echo "\t\t php tusk createModel {name}\n\n";
        echo "\tIt is simple as this. Just replace {name} by your real name and that's it !\n\n";
        echo "\n";
    }

    /**
     * Create a controller and a directory in template.
     *
     * @param $name the controller name
     */
    private static function createController ($name)
    {
        if (strpbrk($name, "\\/?%*:|\"<>")) {
            echo $name . ' isn\'t a valid controller name' . "\n";
            return;
        }

        $name = ucwords(strtolower($name));<commit_msg>man tusk fix<commit_after><?php

/**
 * Walrus Framework
 * File maintained by: <NAME> (E-Wok)
 * Created: 13:26 28/01/14
 */

namespace Walrus\core;

use Exception;

/**
 * Class WalrusCLI
 * @package Walrus\core
 */
class WalrusCLI
{
    /**
     * Check argv to execute the right method.
     */
    public static function execute()
    {
        if (count($_SERVER['argv']) == 1) {
            self::help();
        } elseif (count($_SERVER['argv']) === 3) {
            $method = $_SERVER['argv'][1];
            $param = $_SERVER['argv'][2];

            switch ($method) {
                case 'createController':
                    self::createController($param);
                    break;
                case 'createModel':
                    self::createModel($param);
                    break;
                default:
                    self::help();// @TODO: display an intelligent help ?
            }

        } else {
            // @TODO: display an intelligent help ?
            echo 'error';
            echo "\n";
        }
    }

    /**
     * Give explanation about tusk command.
     *
     * In case no command are recognized, the tusk man is displayed.
     */
    private static function help()
    {
        // @TODO: create man
        echo "\n\tTusk is the Walrus Command Line Interface (CLI).\n";
        echo "\tTusk has been made in order to simplify the creation of models, controllers and API.\n";
        echo "\tIt will generate a simple file in a Walrus way.\n\n";
        echo "\tIn order to create a model you just have to write :\n";
        echo "\t\t php tusk createModel {Name}\n\n";
        echo "\tIn order to create a controller you just have to write :\n";
        echo "\t\t php tusk createController {name}\n\n";
        echo "\tIt is simple as this. Just replace {name} by your real name and that's it !\n\n";
        echo "\n";
    }

    /**
     * Create a controller and a directory in template.
     *
     * @param $name the controller name
     */
    private static function createController ($name)
    {
        if (strpbrk($name, "\\/?%*:|\"<>")) {
            echo $name . ' isn\'t a valid controller name' . "\n";
            return;
        }

        $name = ucwords(strtolower($name));
{'fraction_non_alphanumeric': 0.12981834293309702, 'fraction_numerical': 0.006202924235711121, 'mean_word_length': 1.6731793960923624, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3187154', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1255, 'n_words': 435}