<commit_before><?php
/**
 * Base class for Shells
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.cake.console.libs
 * @since         CakePHP(tm) v 1.2.0.5012
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Base class for command-line utilities for automating programmer chores.
 *
 * @package       cake
 * @subpackage    cake.cake.console.libs
 */
class Shell extends Object {

/**
 * An instance of the ShellDispatcher object that loaded this script
 *
 * @var ShellDispatcher
 * @access public
 */
	var $Dispatch = null;

/**
 * If true, the script will ask for permission to perform actions.
 *
 * @var boolean
 * @access public
 */
	var $interactive = true;

/**
 * Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
 * or the app does not exist.
 *
 * @var DATABASE_CONFIG
 * @access public
 */
	var $DbConfig = null;

/**
 * Contains command switches parsed from the command line.
 *
 * @var array
 * @access public
 */
	var $params = array();

/**
 * Contains arguments parsed from the command line.
 *
 * @var array
 * @access public
 */
	var $args = array();

/**
 * The file name of the shell that was invoked.
 *
 * @var string
 * @access public
 */
	var $shell = null;

/**
 * The class name of the shell that was invoked.
 *
 * @var string
 * @access public
 */
	var $className = null;

/**
 * The command called if public methods are available.
 *
 * @var string
 * @access public
 */
	var $command = null;

/**
 * The name of the shell in camelized.
 *
 * @var string
 * @access public
 */
	var $name = null;

/**
 * An alias for the shell
 *
 * @var string
 * @access public
 */
	var $alias = null;

/**
 * Contains tasks to load and instantiate
 *
 * @var array
 * @access public
 */
	var $tasks = array();

/**
 * Contains the loaded tasks
 *
 * @var array
 * @access public
 */
	var $taskNames = array();

/**
 * Contains models to load and instantiate
 *
 * @var array
 * @access public
 */
	var $uses = array();

/**
 *  Constructs this Shell instance.
 *
 */
	function __construct(&$dispatch) {
		$vars = array('params', 'args', 'shell', 'shellCommand' => 'command');

		foreach ($vars as $key => $var) {
			if (is_string($key)) {
				$this->{$var} =& $dispatch->{$key};
			} else {
				$this->{$var} =& $dispatch->{$var};
			}
		}

		if ($this->name == null) {
			$this->name = get_class($this);
		}

		if ($this->alias == null) {
			$this->alias = $this->name;
		}

		ClassRegistry::addObject($this->name, $this);
		ClassRegistry::map($this->name, $this->alias);

		if (!PHP5 && isset($this->args[0])) {
			if (strpos($this->name, strtolower(Inflector::camelize($this->args[0]))) !== false) {
				$dispatch->shiftArgs();
			}
			if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
				$dispatch->shiftArgs();
			}
		}

		$this->Dispatch =& $dispatch;
	}

/**
 * Initializes the Shell
 * acts as constructor for subclasses
 * allows configuration of tasks prior to shell execution
 *
 * @access public
 */
	function initialize() {
		$this->_loadModels();
	}

/**
 * Starts up the the Shell
 * allows for checking and configuring prior to command or main execution
 * can be overriden in subclasses
 *
 * @access public
 */
	function startup() {
		$this->_welcome();
	}

/**
 * Displays a header for the shell
 *
 * @access protected
 */
	function _welcome() {<commit_msg>Fixing typo in method description.<commit_after><?php
/**
 * Base class for Shells
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.cake.console.libs
 * @since         CakePHP(tm) v 1.2.0.5012
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Base class for command-line utilities for automating programmer chores.
 *
 * @package       cake
 * @subpackage    cake.cake.console.libs
 */
class Shell extends Object {

/**
 * An instance of the ShellDispatcher object that loaded this script
 *
 * @var ShellDispatcher
 * @access public
 */
	var $Dispatch = null;

/**
 * If true, the script will ask for permission to perform actions.
 *
 * @var boolean
 * @access public
 */
	var $interactive = true;

/**
 * Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
 * or the app does not exist.
 *
 * @var DATABASE_CONFIG
 * @access public
 */
	var $DbConfig = null;

/**
 * Contains command switches parsed from the command line.
 *
 * @var array
 * @access public
 */
	var $params = array();

/**
 * Contains arguments parsed from the command line.
 *
 * @var array
 * @access public
 */
	var $args = array();

/**
 * The file name of the shell that was invoked.
 *
 * @var string
 * @access public
 */
	var $shell = null;

/**
 * The class name of the shell that was invoked.
 *
 * @var string
 * @access public
 */
	var $className = null;

/**
 * The command called if public methods are available.
 *
 * @var string
 * @access public
 */
	var $command = null;

/**
 * The name of the shell in camelized.
 *
 * @var string
 * @access public
 */
	var $name = null;

/**
 * An alias for the shell
 *
 * @var string
 * @access public
 */
	var $alias = null;

/**
 * Contains tasks to load and instantiate
 *
 * @var array
 * @access public
 */
	var $tasks = array();

/**
 * Contains the loaded tasks
 *
 * @var array
 * @access public
 */
	var $taskNames = array();

/**
 * Contains models to load and instantiate
 *
 * @var array
 * @access public
 */
	var $uses = array();

/**
 *  Constructs this Shell instance.
 *
 */
	function __construct(&$dispatch) {
		$vars = array('params', 'args', 'shell', 'shellCommand' => 'command');

		foreach ($vars as $key => $var) {
			if (is_string($key)) {
				$this->{$var} =& $dispatch->{$key};
			} else {
				$this->{$var} =& $dispatch->{$var};
			}
		}

		if ($this->name == null) {
			$this->name = get_class($this);
		}

		if ($this->alias == null) {
			$this->alias = $this->name;
		}

		ClassRegistry::addObject($this->name, $this);
		ClassRegistry::map($this->name, $this->alias);

		if (!PHP5 && isset($this->args[0])) {
			if (strpos($this->name, strtolower(Inflector::camelize($this->args[0]))) !== false) {
				$dispatch->shiftArgs();
			}
			if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
				$dispatch->shiftArgs();
			}
		}

		$this->Dispatch =& $dispatch;
	}

/**
 * Initializes the Shell
 * acts as constructor for subclasses
 * allows configuration of tasks prior to shell execution
 *
 * @access public
 */
	function initialize() {
		$this->_loadModels();
	}

/**
 * Starts up the Shell
 * allows for checking and configuring prior to command or main execution
 * can be overriden in subclasses
 *
 * @access public
 */
	function startup() {
		$this->_welcome();
	}

/**
 * Displays a header for the shell
 *
 * @access protected
 */
	function _welcome() {
{'fraction_non_alphanumeric': 0.15113446993975133, 'fraction_numerical': 0.007434944237918215, 'mean_word_length': 3.130227633668608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1850635', 'n_tokens_mistral': 2634, 'n_tokens_neox': 2445, 'n_words': 781}