<commit_before><?php
/* SVN FILE: $Id$ */
/**
 * The ControllerTask handles creating and updating controller files.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright 2005-2007,	Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2007, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package			cake
 * @subpackage		cake.cake.console.libs.tasks
 * @since			CakePHP(tm) v 1.2
 * @version			$Revision$
 * @modifiedby		$LastChangedBy$
 * @lastmodified	$Date$
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 * Task class for creating and updating controller files.
 *
 * @package		cake
 * @subpackage	cake.cake.console.libs.tasks
 */
class ControllerTask extends Shell {
/**
 * Tasks to be loaded by this Task
 *
 * @var array
 */
	var $tasks = array('Project');
/**
 * Override initialize
 *
 * @return void
 */
	function initialize() {}
/**
 * Execution method always used for tasks
 *
 * @return void
 */
	function execute() {
		if(empty($this->args)) {
			$this->__interactive();
		}

		if(isset($this->args[0])) {
			$controller = Inflector::camelize($this->args[0]);
			$actions = null;
			if(isset($this->args[1]) && $this->args[1] == 'scaffold') {
				$this->out('Baking scaffold for ' . $controller);
				$actions = $this->__bakeActions($controller);
			} else {
				$actions = 'scaffold';
			}
			if(isset($this->args[2]) && $this->args[2] == 'admin') {
				if($admin = $this->getAdmin()) {
					$this->out('Adding ' . CAKE_ADMIN .' methods');
					$actions .= $this->__bakeActions($controller, $admin);
				}
			}
			$baked = $this->__bake($controller, $actions);
			$this->__bakeTest($controller);
		}
	}
/**
 * Interactive
 *
 * @return void
 */
	function __interactive() {
		$this->hr();
		$this->out('Controller Bake:');
		$this->hr();
		$actions = '';
		$uses = array();
		$helpers = array();
		$components = array();
		$wannaUseSession = 'y';
		$wannaDoAdmin = 'n';<commit_msg>Fixing problem when baking only admin functions<commit_after><?php
/* SVN FILE: $Id$ */
/**
 * The ControllerTask handles creating and updating controller files.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright 2005-2007,	Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2007, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package			cake
 * @subpackage		cake.cake.console.libs.tasks
 * @since			CakePHP(tm) v 1.2
 * @version			$Revision$
 * @modifiedby		$LastChangedBy$
 * @lastmodified	$Date$
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 * Task class for creating and updating controller files.
 *
 * @package		cake
 * @subpackage	cake.cake.console.libs.tasks
 */
class ControllerTask extends Shell {
/**
 * Tasks to be loaded by this Task
 *
 * @var array
 */
	var $tasks = array('Project');
/**
 * Override initialize
 *
 * @return void
 */
	function initialize() {}
/**
 * Execution method always used for tasks
 *
 * @return void
 */
	function execute() {
		if(empty($this->args)) {
			$this->__interactive();
		}

		if(isset($this->args[0])) {
			$controller = Inflector::camelize($this->args[0]);
			$actions = null;
			if(isset($this->args[1]) && $this->args[1] == 'scaffold') {
				$this->out('Baking scaffold for ' . $controller);
				$actions = $this->__bakeActions($controller);
			} else {
				$actions = 'scaffold';
			}
			if(isset($this->args[2]) && $this->args[2] == 'admin') {
				if($admin = $this->getAdmin()) {
					$this->out('Adding ' . CAKE_ADMIN .' methods');
					if ($actions == 'scaffold') {
						$actions = $this->__bakeActions($controller, $admin);
					} else {
						$actions .= $this->__bakeActions($controller, $admin);
					}
				}
			}
			$baked = $this->__bake($controller, $actions);
			$this->__bakeTest($controller);
		}
	}
/**
 * Interactive
 *
 * @return void
 */
	function __interactive() {
		$this->hr();
		$this->out('Controller Bake:');
		$this->hr();
		$actions = '';
		$uses = array();
		$helpers = array();
		$components = array();
		$wannaUseSession = 'y';
		$wannaDoAdmin = 'n';
{'fraction_non_alphanumeric': 0.16970458830923948, 'fraction_numerical': 0.017179970668342762, 'mean_word_length': 3.3919043238270468, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, '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': '4808362', 'n_tokens_mistral': 1838, 'n_tokens_neox': 1575, 'n_words': 382}