mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed some API doc in console.
This commit is contained in:
parent
f9373ff504
commit
a0ee8b49fe
30 changed files with 140 additions and 51 deletions
|
@ -58,6 +58,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Override startup of the Shell
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startup() {
|
||||
parent::startup();
|
||||
|
@ -96,6 +97,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Override main() for help message hook
|
||||
*
|
||||
* @return voids
|
||||
*/
|
||||
public function main() {
|
||||
$this->out($this->OptionParser->help());
|
||||
|
@ -104,6 +106,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Creates an ARO/ACO node
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function create() {
|
||||
extract($this->__dataVars());
|
||||
|
@ -136,6 +139,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Delete an ARO/ACO node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete() {
|
||||
extract($this->__dataVars());
|
||||
|
@ -152,6 +156,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Set parent for an ARO/ACO node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setParent() {
|
||||
extract($this->__dataVars());
|
||||
|
@ -175,6 +180,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Get path to specified ARO/ACO node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getPath() {
|
||||
extract($this->__dataVars());
|
||||
|
@ -217,6 +223,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Check permission for a given ARO to a given ACO.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check() {
|
||||
extract($this->__getParams());
|
||||
|
@ -231,6 +238,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Grant permission for a given ARO to a given ACO.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function grant() {
|
||||
extract($this->__getParams());
|
||||
|
@ -245,6 +253,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Deny access for an ARO to an ACO.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deny() {
|
||||
extract($this->__getParams());
|
||||
|
@ -259,6 +268,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Set an ARO to inherit permission to an ACO.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function inherit() {
|
||||
extract($this->__getParams());
|
||||
|
@ -273,6 +283,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Show a specific ARO/ACO node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function view() {
|
||||
extract($this->__dataVars());
|
||||
|
@ -332,6 +343,7 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Initialize ACL database.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function initdb() {
|
||||
return $this->dispatchShell('schema create DbAcl');
|
||||
|
@ -493,8 +505,6 @@ class AclShell extends Shell {
|
|||
/**
|
||||
* Checks that given node exists
|
||||
*
|
||||
* @param string $type Node type (ARO/ACO)
|
||||
* @param integer $id Node id
|
||||
* @return boolean Success
|
||||
*/
|
||||
public function nodeExists() {
|
||||
|
|
|
@ -36,6 +36,7 @@ class ApiShell extends Shell {
|
|||
/**
|
||||
* Override initialize of the Shell
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->paths = array_merge($this->paths, array(
|
||||
|
@ -53,6 +54,7 @@ class ApiShell extends Shell {
|
|||
/**
|
||||
* Override main() to handle action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function main() {
|
||||
if (empty($this->args)) {
|
||||
|
@ -150,6 +152,7 @@ class ApiShell extends Shell {
|
|||
/**
|
||||
* Show help for this shell.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function help() {
|
||||
$head = "Usage: cake api [<type>] <className> [-m <method>]\n";
|
||||
|
@ -187,7 +190,7 @@ class ApiShell extends Shell {
|
|||
* Parse a given class (located on given file) and get public methods and their
|
||||
* signatures.
|
||||
*
|
||||
* @param object $File File object
|
||||
* @param string $path File path
|
||||
* @param string $class Class name
|
||||
* @return array Methods and signatures indexed by method name
|
||||
*/
|
||||
|
|
|
@ -47,6 +47,7 @@ class BakeShell extends Shell {
|
|||
/**
|
||||
* Assign $this->connection to the active task if a connection param is set.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startup() {
|
||||
parent::startup();
|
||||
|
@ -61,6 +62,7 @@ class BakeShell extends Shell {
|
|||
/**
|
||||
* Override main() to handle action
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function main() {
|
||||
if (!is_dir($this->DbConfig->path)) {
|
||||
|
@ -124,6 +126,7 @@ class BakeShell extends Shell {
|
|||
/**
|
||||
* Quickly bake the MVC
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function all() {
|
||||
$this->out('Bake All');
|
||||
|
|
|
@ -98,6 +98,9 @@ class CommandListShell extends Shell {
|
|||
/**
|
||||
* Scan the provided paths for shells, and append them into $shellList
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $shells
|
||||
* @param array $shellList
|
||||
* @return array
|
||||
*/
|
||||
protected function _appendShells($type, $shells, $shellList) {
|
||||
|
@ -111,6 +114,7 @@ class CommandListShell extends Shell {
|
|||
/**
|
||||
* Output text.
|
||||
*
|
||||
* @param array $shellList
|
||||
* @return void
|
||||
*/
|
||||
protected function _asText($shellList) {
|
||||
|
@ -146,6 +150,7 @@ class CommandListShell extends Shell {
|
|||
/**
|
||||
* Generates the shell list sorted by where the shells are found.
|
||||
*
|
||||
* @param array $shellList
|
||||
* @return void
|
||||
*/
|
||||
protected function _asSorted($shellList) {
|
||||
|
@ -184,6 +189,7 @@ class CommandListShell extends Shell {
|
|||
/**
|
||||
* Output as XML
|
||||
*
|
||||
* @param array $shellList
|
||||
* @return void
|
||||
*/
|
||||
protected function _asXml($shellList) {
|
||||
|
|
|
@ -47,6 +47,7 @@ class ConsoleShell extends Shell {
|
|||
/**
|
||||
* Override initialize of the Shell
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
|
@ -71,6 +72,7 @@ class ConsoleShell extends Shell {
|
|||
/**
|
||||
* Prints the help message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function help() {
|
||||
$out = 'Console help:';
|
||||
|
@ -133,6 +135,8 @@ class ConsoleShell extends Shell {
|
|||
/**
|
||||
* Override main() to handle action
|
||||
*
|
||||
* @param string $command
|
||||
* @return void
|
||||
*/
|
||||
public function main($command = null) {
|
||||
while (true) {
|
||||
|
|
|
@ -40,6 +40,7 @@ class I18nShell extends Shell {
|
|||
/**
|
||||
* Override startup of the Shell
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function startup() {
|
||||
$this->_welcome();
|
||||
|
@ -58,6 +59,7 @@ class I18nShell extends Shell {
|
|||
/**
|
||||
* Override main() for help message hook
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function main() {
|
||||
$this->out(__d('cake_console', '<info>I18n Shell</info>'));
|
||||
|
@ -91,6 +93,7 @@ class I18nShell extends Shell {
|
|||
/**
|
||||
* Initialize I18N database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initdb() {
|
||||
$this->dispatchShell('schema create i18n');
|
||||
|
|
|
@ -47,6 +47,7 @@ class SchemaShell extends Shell {
|
|||
/**
|
||||
* Override initialize
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->_welcome();
|
||||
|
@ -57,6 +58,7 @@ class SchemaShell extends Shell {
|
|||
/**
|
||||
* Override startup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startup() {
|
||||
$name = $path = $connection = $plugin = null;
|
||||
|
@ -103,6 +105,7 @@ class SchemaShell extends Shell {
|
|||
* Read and output contents of schema object
|
||||
* path to read as second arg
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function view() {
|
||||
$File = new File($this->Schema->path . DS . $this->params['file']);
|
||||
|
@ -120,6 +123,7 @@ class SchemaShell extends Shell {
|
|||
* Read database and Write schema object
|
||||
* accepts a connection as first arg or path to save as second arg
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function generate() {
|
||||
$this->out(__d('cake_console', 'Generating Schema...'));
|
||||
|
@ -197,6 +201,7 @@ class SchemaShell extends Shell {
|
|||
* If -write contains a full path name the file will be saved there. If -write only
|
||||
* contains no DS, that will be used as the file name, in the same dir as the schema file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function dump() {
|
||||
$write = false;
|
||||
|
@ -300,6 +305,9 @@ class SchemaShell extends Shell {
|
|||
* Create database from Schema object
|
||||
* Should be called via the run method
|
||||
*
|
||||
* @param CakeSchema $Schema
|
||||
* @param string $table
|
||||
* @return void
|
||||
*/
|
||||
function __create($Schema, $table = null) {
|
||||
$db = ConnectionManager::getDataSource($this->Schema->connection);
|
||||
|
@ -342,6 +350,9 @@ class SchemaShell extends Shell {
|
|||
* Update database with Schema object
|
||||
* Should be called via the run method
|
||||
*
|
||||
* @param CakeSchema $Schema
|
||||
* @param string $table
|
||||
* @return void
|
||||
*/
|
||||
function __update(&$Schema, $table = null) {
|
||||
$db = ConnectionManager::getDataSource($this->Schema->connection);
|
||||
|
@ -383,6 +394,10 @@ class SchemaShell extends Shell {
|
|||
/**
|
||||
* Runs sql from __create() or __update()
|
||||
*
|
||||
* @param array $contents
|
||||
* @param string $event
|
||||
* @param CakeSchema $Schema
|
||||
* @return void
|
||||
*/
|
||||
function __run($contents, $event, &$Schema) {
|
||||
if (empty($contents)) {
|
||||
|
|
|
@ -43,6 +43,7 @@ class ControllerTask extends BakeTask {
|
|||
/**
|
||||
* Override initialize
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->path = current(App::path('Controller'));
|
||||
|
@ -51,6 +52,7 @@ class ControllerTask extends BakeTask {
|
|||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
parent::execute();
|
||||
|
@ -203,6 +205,10 @@ class ControllerTask extends BakeTask {
|
|||
/**
|
||||
* Confirm a to be baked controller with the user
|
||||
*
|
||||
* @param string $controllerName
|
||||
* @param string $useDynamicScaffold
|
||||
* @param array $helpers
|
||||
* @param array $components
|
||||
* @return void
|
||||
*/
|
||||
public function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) {
|
||||
|
@ -299,7 +305,6 @@ class ControllerTask extends BakeTask {
|
|||
* @param string $actions Actions to add, or set the whole controller to use $scaffold (set $actions to 'scaffold')
|
||||
* @param array $helpers Helpers to use in controller
|
||||
* @param array $components Components to use in controller
|
||||
* @param array $uses Models to use in controller
|
||||
* @return string Baked controller
|
||||
*/
|
||||
public function bake($controllerName, $actions = '', $helpers = null, $components = null) {
|
||||
|
@ -378,7 +383,6 @@ class ControllerTask extends BakeTask {
|
|||
* Outputs and gets the list of possible controllers from database
|
||||
*
|
||||
* @param string $useDbConfig Database configuration name
|
||||
* @param boolean $interactive Whether you are using listAll interactively and want options output.
|
||||
* @return array Set of controllers
|
||||
*/
|
||||
public function listAll($useDbConfig = null) {
|
||||
|
@ -462,6 +466,7 @@ class ControllerTask extends BakeTask {
|
|||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function help() {
|
||||
$this->hr();
|
||||
|
|
|
@ -60,7 +60,7 @@ class DbConfigTask extends Shell {
|
|||
/**
|
||||
* initialization callback
|
||||
*
|
||||
* @var string
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->path = APP . 'Config' . DS;
|
||||
|
@ -69,6 +69,7 @@ class DbConfigTask extends Shell {
|
|||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
if (empty($this->args)) {
|
||||
|
@ -197,6 +198,7 @@ class DbConfigTask extends Shell {
|
|||
/**
|
||||
* Output verification message and bake if it looks good
|
||||
*
|
||||
* @param array $config
|
||||
* @return boolean True if user says it looks good, false otherwise
|
||||
*/
|
||||
protected function _verify($config) {
|
||||
|
|
|
@ -377,7 +377,7 @@ class ExtractTask extends Shell {
|
|||
* @param string $field the name of the field that is being processed
|
||||
* @param array $rules the set of validation rules for the field
|
||||
* @param string $file the file name where this validation rule was found
|
||||
* @param string domain default domain to bind the validations to
|
||||
* @param string $domain default domain to bind the validations to
|
||||
* @return void
|
||||
*/
|
||||
protected function _processValidationRules($field, $rules, $file, $domain) {
|
||||
|
@ -433,6 +433,9 @@ class ExtractTask extends Shell {
|
|||
/**
|
||||
* Prepare a file to be stored
|
||||
*
|
||||
* @param string $domain
|
||||
* @param string $header
|
||||
* @param string $sentence
|
||||
* @return void
|
||||
*/
|
||||
protected function _store($domain, $header, $sentence) {
|
||||
|
|
|
@ -50,6 +50,9 @@ class FixtureTask extends BakeTask {
|
|||
/**
|
||||
* Override initialize
|
||||
*
|
||||
* @param ConsoleOutput $stdout A ConsoleOutput object for stdout.
|
||||
* @param ConsoleOutput $stderr A ConsoleOutput object for stderr.
|
||||
* @param ConsoleInput $stdin A ConsoleInput object for stdin.
|
||||
*/
|
||||
public function __construct($stdout = null, $stderr = null, $stdin = null) {
|
||||
parent::__construct($stdout, $stderr, $stdin);
|
||||
|
@ -236,7 +239,7 @@ class FixtureTask extends BakeTask {
|
|||
* Generate the fixture file, and write to disk
|
||||
*
|
||||
* @param string $model name of the model being generated
|
||||
* @param string $fixture Contents of the fixture file.
|
||||
* @param string $otherVars Contents of the fixture file.
|
||||
* @return string Content saved into fixture file.
|
||||
*/
|
||||
public function generateFixtureFile($model, $otherVars) {
|
||||
|
@ -271,7 +274,7 @@ class FixtureTask extends BakeTask {
|
|||
/**
|
||||
* Generates a string representation of a schema.
|
||||
*
|
||||
* @param array $table Table schema array
|
||||
* @param array $tableInfo Table schema array
|
||||
* @return string fields definitions
|
||||
*/
|
||||
protected function _generateSchema($tableInfo) {
|
||||
|
@ -282,7 +285,8 @@ class FixtureTask extends BakeTask {
|
|||
/**
|
||||
* Generate String representation of Records
|
||||
*
|
||||
* @param array $table Table schema array
|
||||
* @param array $tableInfo Table schema array
|
||||
* @param integer $recordCount
|
||||
* @return array Array of records to use in the fixture.
|
||||
*/
|
||||
protected function _generateRecords($tableInfo, $recordCount = 1) {
|
||||
|
|
|
@ -66,6 +66,7 @@ class ModelTask extends BakeTask {
|
|||
/**
|
||||
* Override initialize
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->path = current(App::path('Model'));
|
||||
|
@ -74,6 +75,7 @@ class ModelTask extends BakeTask {
|
|||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
parent::execute();
|
||||
|
@ -127,7 +129,8 @@ class ModelTask extends BakeTask {
|
|||
* Get a model object for a class name.
|
||||
*
|
||||
* @param string $className Name of class you want model to be.
|
||||
* @return object Model instance
|
||||
* @param string $table Table name
|
||||
* @return Model Model instance
|
||||
*/
|
||||
protected function &_getModelObject($className, $table = null) {
|
||||
if (!$table) {
|
||||
|
@ -166,6 +169,7 @@ class ModelTask extends BakeTask {
|
|||
/**
|
||||
* Handles interactive baking
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _interactive() {
|
||||
$this->hr();
|
||||
|
@ -359,6 +363,7 @@ class ModelTask extends BakeTask {
|
|||
*
|
||||
* @param string $fieldName Name of field to be validated.
|
||||
* @param array $metaData metadata for field
|
||||
* @param string $primaryKey
|
||||
* @return array Array of validation for the field.
|
||||
*/
|
||||
public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
|
||||
|
@ -717,6 +722,7 @@ class ModelTask extends BakeTask {
|
|||
*
|
||||
* @param mixed $name Model name or object
|
||||
* @param mixed $data if array and $name is not an object assume bake data, otherwise boolean.
|
||||
* @return string
|
||||
*/
|
||||
public function bake($name, $data = array()) {
|
||||
if (is_object($name)) {
|
||||
|
@ -752,6 +758,7 @@ class ModelTask extends BakeTask {
|
|||
* Assembles and writes a unit test file
|
||||
*
|
||||
* @param string $className Model class name
|
||||
* @return string
|
||||
*/
|
||||
public function bakeTest($className) {
|
||||
$this->Test->interactive = $this->interactive;
|
||||
|
@ -764,6 +771,7 @@ class ModelTask extends BakeTask {
|
|||
* outputs the a list of possible models or controllers from database
|
||||
*
|
||||
* @param string $useDbConfig Database configuration name
|
||||
* @return array
|
||||
*/
|
||||
public function listAll($useDbConfig = null) {
|
||||
$this->_tables = $this->getAllTables($useDbConfig);
|
||||
|
@ -843,6 +851,7 @@ class ModelTask extends BakeTask {
|
|||
/**
|
||||
* Forces the user to specify the model he wants to bake, and returns the selected model name.
|
||||
*
|
||||
* @param string $useDbConfig Database config name
|
||||
* @return string the model name
|
||||
*/
|
||||
public function getName($useDbConfig = null) {
|
||||
|
|
|
@ -65,10 +65,11 @@ class PluginTask extends Shell {
|
|||
/**
|
||||
* Interactive interface
|
||||
*
|
||||
* @param string $plugin
|
||||
* @return void
|
||||
*/
|
||||
protected function _interactive($plugin = null) {
|
||||
while ($plugin === null) {
|
||||
if ($plugin === null) {
|
||||
$plugin = $this->in(__d('cake_console', 'Enter the name of the plugin in CamelCase format'));
|
||||
}
|
||||
|
||||
|
@ -80,8 +81,8 @@ class PluginTask extends Shell {
|
|||
/**
|
||||
* Bake the plugin, create directories and files
|
||||
*
|
||||
* @params $plugin name of the plugin in CamelCased format
|
||||
* @return bool
|
||||
* @param string $plugin Name of the plugin in CamelCased format
|
||||
* @return boolean
|
||||
*/
|
||||
public function bake($plugin) {
|
||||
$pathOptions = App::path('plugins');
|
||||
|
@ -154,6 +155,7 @@ class PluginTask extends Shell {
|
|||
/**
|
||||
* find and change $this->path to the user selection
|
||||
*
|
||||
* @param array $pathOptions
|
||||
* @return string plugin path
|
||||
*/
|
||||
public function findPath($pathOptions) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class ProjectTask extends Shell {
|
|||
* Checks that given project path does not already exist, and
|
||||
* finds the app directory in it. Then it calls bake() with that information.
|
||||
*
|
||||
* @param string $project Project path
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute() {
|
||||
$project = null;
|
||||
|
@ -137,6 +137,7 @@ class ProjectTask extends Shell {
|
|||
* @param string $path Project path
|
||||
* @param string $skel Path to copy from
|
||||
* @param string $skip array of directories to skip when copying
|
||||
* @return mixed
|
||||
*/
|
||||
public function bake($path, $skel = null, $skip = array('empty')) {
|
||||
if (!$skel && !empty($this->params['skel'])) {
|
||||
|
|
|
@ -56,13 +56,14 @@ class TestTask extends BakeTask {
|
|||
/**
|
||||
* Internal list of fixtures that have been added so far.
|
||||
*
|
||||
* @var string
|
||||
* @var array
|
||||
*/
|
||||
protected $_fixtures = array();
|
||||
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute() {
|
||||
parent::execute();
|
||||
|
@ -85,6 +86,8 @@ class TestTask extends BakeTask {
|
|||
/**
|
||||
* Handles interactive baking
|
||||
*
|
||||
* @param string $type
|
||||
* @return string|boolean
|
||||
*/
|
||||
protected function _interactive($type = null) {
|
||||
$this->interactive = true;
|
||||
|
@ -110,6 +113,7 @@ class TestTask extends BakeTask {
|
|||
*
|
||||
* @param string $type Type of object to bake test case for ie. Model, Controller
|
||||
* @param string $className the 'cake name' for the class ie. Posts for the PostsController
|
||||
* @return string|boolean
|
||||
*/
|
||||
public function bake($type, $className) {
|
||||
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
|
||||
|
@ -215,7 +219,6 @@ class TestTask extends BakeTask {
|
|||
* Currently only model, and controller are supported
|
||||
*
|
||||
* @param string $type The Type of object you are generating tests for eg. controller
|
||||
* @param string $className the Classname of the class the test is being generated for.
|
||||
* @return boolean
|
||||
*/
|
||||
public function typeCanDetectFixtures($type) {
|
||||
|
@ -227,7 +230,7 @@ class TestTask extends BakeTask {
|
|||
* Check if a class with the given type is loaded or can be loaded.
|
||||
*
|
||||
* @param string $type The Type of object you are generating tests for eg. controller
|
||||
* @param string $className the Classname of the class the test is being generated for.
|
||||
* @param string $class the Classname of the class the test is being generated for.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLoadableClass($type, $class) {
|
||||
|
@ -398,7 +401,7 @@ class TestTask extends BakeTask {
|
|||
* Generate a constructor code snippet for the type and classname
|
||||
*
|
||||
* @param string $type The Type of object you are generating tests for eg. controller
|
||||
* @param string $className the Classname of the class the test is being generated for.
|
||||
* @param string $fullClassName The Classname of the class the test is being generated for.
|
||||
* @return string Constructor snippet for the thing you are building.
|
||||
*/
|
||||
public function generateConstructor($type, $fullClassName) {
|
||||
|
|
|
@ -72,6 +72,7 @@ class ViewTask extends BakeTask {
|
|||
/**
|
||||
* Override initialize
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->path = current(App::path('View'));
|
||||
|
@ -80,6 +81,7 @@ class ViewTask extends BakeTask {
|
|||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute() {
|
||||
parent::execute();
|
||||
|
@ -188,6 +190,7 @@ class ViewTask extends BakeTask {
|
|||
/**
|
||||
* Handles interactive baking
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _interactive() {
|
||||
$this->hr();
|
||||
|
@ -295,6 +298,7 @@ class ViewTask extends BakeTask {
|
|||
* Bake a view file for each of the supplied actions
|
||||
*
|
||||
* @param array $actions Array of actions to make files for.
|
||||
* @param array $vars
|
||||
* @return void
|
||||
*/
|
||||
public function bakeActions($actions, $vars) {
|
||||
|
@ -436,7 +440,8 @@ class ViewTask extends BakeTask {
|
|||
/**
|
||||
* Returns associations for controllers models.
|
||||
*
|
||||
* @return array $associations
|
||||
* @param Model $model
|
||||
* @return array $associations
|
||||
*/
|
||||
private function __associations($model) {
|
||||
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
|
|
|
@ -30,16 +30,14 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
/**
|
||||
* Standard error stream.
|
||||
*
|
||||
* @var filehandle
|
||||
* @access public
|
||||
* @var ConsoleOutput
|
||||
*/
|
||||
public static $stderr;
|
||||
|
||||
/**
|
||||
* Get the stderr object for the console error handling.
|
||||
*
|
||||
* @param Exception $error Exception to handle.
|
||||
* @param array $messages Error messages
|
||||
* @return ConsoleOutput
|
||||
*/
|
||||
public static function getStderr() {
|
||||
if (empty(self::$stderr)) {
|
||||
|
|
|
@ -131,7 +131,9 @@ class ConsoleInputArgument {
|
|||
/**
|
||||
* Check that $value is a valid choice for this argument.
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
* @throws ConsoleException
|
||||
*/
|
||||
public function validChoice($value) {
|
||||
if (empty($this->_choices)) {
|
||||
|
@ -149,7 +151,7 @@ class ConsoleInputArgument {
|
|||
/**
|
||||
* Append this arguments XML representation to the passed in SimpleXml object.
|
||||
*
|
||||
* @param SimpleXmlElement The parent element.
|
||||
* @param SimpleXmlElement $parent The parent element.
|
||||
* @return SimpleXmlElement The parent with this argument appended.
|
||||
*/
|
||||
public function xml(SimpleXmlElement $parent) {
|
||||
|
|
|
@ -171,7 +171,9 @@ class ConsoleInputOption {
|
|||
/**
|
||||
* Check that a value is a valid choice for this option.
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
* @throws ConsoleException
|
||||
*/
|
||||
public function validChoice($value) {
|
||||
if (empty($this->_choices)) {
|
||||
|
@ -189,7 +191,7 @@ class ConsoleInputOption {
|
|||
/**
|
||||
* Append the option's xml into the parent.
|
||||
*
|
||||
* @param SimpleXmlElement The parent element.
|
||||
* @param SimpleXmlElement $parent The parent element.
|
||||
* @return SimpleXmlElement The parent with this option appended.
|
||||
*/
|
||||
public function xml(SimpleXmlElement $parent) {
|
||||
|
|
|
@ -108,7 +108,7 @@ class ConsoleInputSubcommand {
|
|||
/**
|
||||
* Append this subcommand to the Parent element
|
||||
*
|
||||
* @param SimpleXmlElement The parent element.
|
||||
* @param SimpleXmlElement $parent The parent element.
|
||||
* @return SimpleXmlElement The parent with this subcommand appended.
|
||||
*/
|
||||
public function xml(SimpleXmlElement $parent) {
|
||||
|
|
|
@ -267,8 +267,8 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param mixed $name The long name you want to the value to be parsed out as when options are parsed.
|
||||
* Will also accept an instance of ConsoleInputOption
|
||||
* @param array $params An array of parameters that define the behavior of the option
|
||||
* @return returns $this.
|
||||
* @param array $options An array of parameters that define the behavior of the option
|
||||
* @return ConsoleOptionParser $this.
|
||||
*/
|
||||
public function addOption($name, $options = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputOption) {
|
||||
|
@ -308,7 +308,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param mixed $name The name of the argument. Will also accept an instance of ConsoleInputArgument
|
||||
* @param array $params Parameters for the argument, see above.
|
||||
* @return $this.
|
||||
* @return ConsoleOptionParser $this.
|
||||
*/
|
||||
public function addArgument($name, $params = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputArgument) {
|
||||
|
@ -337,7 +337,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param array $args Array of arguments to add.
|
||||
* @see ConsoleOptionParser::addArgument()
|
||||
* @return $this
|
||||
* @return ConsoleOptionParser $this
|
||||
*/
|
||||
public function addArguments(array $args) {
|
||||
foreach ($args as $name => $params) {
|
||||
|
@ -352,7 +352,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param array $options Array of options to add.
|
||||
* @see ConsoleOptionParser::addOption()
|
||||
* @return $this
|
||||
* @return ConsoleOptionParser $this
|
||||
*/
|
||||
public function addOptions(array $options) {
|
||||
foreach ($options as $name => $params) {
|
||||
|
@ -373,8 +373,8 @@ class ConsoleOptionParser {
|
|||
* it will be used.
|
||||
*
|
||||
* @param mixed $name Name of the subcommand. Will also accept an instance of ConsoleInputSubcommand
|
||||
* @param array $params Array of params, see above.
|
||||
* @return $this.
|
||||
* @param array $options Array of params, see above.
|
||||
* @return ConsoleOptionParser $this.
|
||||
*/
|
||||
public function addSubcommand($name, $options = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputSubcommand) {
|
||||
|
@ -397,7 +397,7 @@ class ConsoleOptionParser {
|
|||
* Add multiple subcommands at once.
|
||||
*
|
||||
* @param array $commands Array of subcommands.
|
||||
* @return $this
|
||||
* @return ConsoleOptionParser $this
|
||||
*/
|
||||
public function addSubcommands(array $commands) {
|
||||
foreach ($commands as $name => $params) {
|
||||
|
@ -489,6 +489,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param string $subcommand If present and a valid subcommand that has a linked parser.
|
||||
* That subcommands help will be shown instead.
|
||||
* @param string $format Define the output format, can be text or xml
|
||||
* @param int $width The width to format user content to. Defaults to 72
|
||||
* @return string Generated help.
|
||||
*/
|
||||
|
@ -551,7 +552,7 @@ class ConsoleOptionParser {
|
|||
/**
|
||||
* Parse an option by its name index.
|
||||
*
|
||||
* @param string $option The option to parse.
|
||||
* @param string $name The name to parse.
|
||||
* @param array $params The params to append the parsed value into
|
||||
* @return array Params with $option added in.
|
||||
*/
|
||||
|
|
|
@ -134,6 +134,7 @@ class HelpFormatter {
|
|||
/**
|
||||
* Iterate over a collection and find the longest named thing.
|
||||
*
|
||||
* @param array $collection
|
||||
* @return integer
|
||||
*/
|
||||
protected function _getMaxLength($collection) {
|
||||
|
|
|
@ -310,9 +310,7 @@ class Shell extends Object {
|
|||
*
|
||||
* `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
|
||||
*
|
||||
* @param mixed $command Either an array of args similar to $argv. Or a string command, that can be
|
||||
* exploded on space to simulate argv.
|
||||
* @return mixed. The return of the other shell.
|
||||
* @return mixed The return of the other shell.
|
||||
*/
|
||||
public function dispatchShell() {
|
||||
$args = func_get_args();
|
||||
|
@ -383,6 +381,7 @@ class Shell extends Object {
|
|||
/**
|
||||
* Display the help in the correct format
|
||||
*
|
||||
* @param string $command
|
||||
* @return void
|
||||
*/
|
||||
protected function _displayHelp($command) {
|
||||
|
@ -410,7 +409,8 @@ class Shell extends Object {
|
|||
/**
|
||||
* Overload get for lazy building of tasks
|
||||
*
|
||||
* @return void
|
||||
* @param string $name
|
||||
* @return Shell Object of Task
|
||||
*/
|
||||
public function __get($name) {
|
||||
if (empty($this->{$name}) && in_array($name, $this->taskNames)) {
|
||||
|
@ -523,7 +523,7 @@ class Shell extends Object {
|
|||
* @param mixed $message A string or a an array of strings to output
|
||||
* @param integer $newlines Number of newlines to append
|
||||
* @param integer $level The message's output level, see above.
|
||||
* @return integer Returns the number of bytes returned from writing to stdout.
|
||||
* @return integer|boolean Returns the number of bytes returned from writing to stdout.
|
||||
*/
|
||||
public function out($message = null, $newlines = 1, $level = Shell::NORMAL) {
|
||||
$currentLevel = Shell::NORMAL;
|
||||
|
@ -545,6 +545,7 @@ class Shell extends Object {
|
|||
*
|
||||
* @param mixed $message A string or a an array of strings to output
|
||||
* @param integer $newlines Number of newlines to append
|
||||
* @return void
|
||||
*/
|
||||
public function err($message = null, $newlines = 1) {
|
||||
$this->stderr->write($message, $newlines);
|
||||
|
@ -554,7 +555,6 @@ class Shell extends Object {
|
|||
* Returns a single or multiple linefeeds sequences.
|
||||
*
|
||||
* @param integer $multiplier Number of times the linefeed sequence should be repeated
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function nl($multiplier = 1) {
|
||||
|
@ -566,6 +566,7 @@ class Shell extends Object {
|
|||
*
|
||||
* @param integer $newlines Number of newlines to pre- and append
|
||||
* @param integer $width Width of the line, defaults to 63
|
||||
* @return void
|
||||
*/
|
||||
public function hr($newlines = 0, $width = 63) {
|
||||
$this->out(null, $newlines);
|
||||
|
@ -579,6 +580,7 @@ class Shell extends Object {
|
|||
*
|
||||
* @param string $title Title of the error
|
||||
* @param string $message An optional error message
|
||||
* @return void
|
||||
*/
|
||||
public function error($title, $message = null) {
|
||||
$this->err(__d('cake_console', '<error>Error:</error> %s', $title));
|
||||
|
|
|
@ -198,8 +198,8 @@ class ShellDispatcher {
|
|||
* All paths in the loaded shell paths are searched.
|
||||
*
|
||||
* @param string $shell Optionally the name of a plugin
|
||||
* @return mixed False if no shell could be found or an object on success
|
||||
* @throws MissingShellFileException, MissingShellClassException when errors are encountered.
|
||||
* @return mixed An object
|
||||
* @throws MissingShellFileException when errors are encountered.
|
||||
*/
|
||||
protected function _getShell($shell) {
|
||||
list($plugin, $shell) = pluginSplit($shell, true);
|
||||
|
@ -221,7 +221,8 @@ class ShellDispatcher {
|
|||
/**
|
||||
* Parses command line options and extracts the directory paths from $params
|
||||
*
|
||||
* @param array $params Parameters to parse
|
||||
* @param array $args Parameters to parse
|
||||
* @return void
|
||||
*/
|
||||
public function parseParams($args) {
|
||||
$this->_parsePaths($args);
|
||||
|
@ -276,6 +277,7 @@ class ShellDispatcher {
|
|||
/**
|
||||
* Parses out the paths from from the argv
|
||||
*
|
||||
* @param array $args
|
||||
* @return void
|
||||
*/
|
||||
protected function _parsePaths($args) {
|
||||
|
@ -316,7 +318,7 @@ class ShellDispatcher {
|
|||
/**
|
||||
* Stop execution of the current script
|
||||
*
|
||||
* @param $status see http://php.net/exit for values
|
||||
* @param integer|string $status see http://php.net/exit for values
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($status = 0) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class TaskCollection extends ObjectCollection {
|
|||
/**
|
||||
* Shell to use to set params to tasks.
|
||||
*
|
||||
* @var array
|
||||
* @var Shell
|
||||
*/
|
||||
protected $_Shell;
|
||||
|
||||
|
@ -41,7 +41,7 @@ class TaskCollection extends ObjectCollection {
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $paths Array of paths to search for tasks on .
|
||||
* @param Shell $Shell
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Shell $Shell) {
|
||||
|
|
|
@ -527,6 +527,7 @@ class App {
|
|||
*
|
||||
* @param string $className the name of the class to configure package for
|
||||
* @param string $location the package name
|
||||
* @return void
|
||||
*/
|
||||
public static function uses($className, $location) {
|
||||
self::$__classMap[$className] = $location;
|
||||
|
@ -539,6 +540,7 @@ class App {
|
|||
* if a class is name `MyCustomClass` the file name should be `MyCustomClass.php`
|
||||
*
|
||||
* @param string $className the name of the class to load
|
||||
* @return boolean
|
||||
*/
|
||||
public static function load($className) {
|
||||
if (!isset(self::$__classMap[$className])) {
|
||||
|
@ -676,7 +678,6 @@ class App {
|
|||
* @param string $name unique name of the file for identifying it inside the application
|
||||
* @param string $plugin camel cased plugin name if any
|
||||
* @param string $type name of the packed where the class is located
|
||||
* @param string $file filename if known, the $name param will be used otherwise
|
||||
* @param string $originalType type name as supplied initially by the user
|
||||
* @param boolean $parent whether to load the class parent or not
|
||||
* @return boolean true indicating the successful load and existence of the class
|
||||
|
|
|
@ -122,7 +122,7 @@ class Object {
|
|||
* Stop execution of the current script. Wraps exit() making
|
||||
* testing easier.
|
||||
*
|
||||
* @param $status see http://php.net/exit for values
|
||||
* @param integer|string $status see http://php.net/exit for values
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($status = 0) {
|
||||
|
|
|
@ -103,6 +103,7 @@ class ErrorHandler {
|
|||
* This will either use an AppError class if your application has one,
|
||||
* or use the default ExceptionRenderer.
|
||||
*
|
||||
* @param Exception $exception
|
||||
* @return void
|
||||
* @see http://php.net/manual/en/function.set-exception-handler.php
|
||||
*/
|
||||
|
|
|
@ -127,7 +127,7 @@ class CakeLog {
|
|||
* Removes a stream from the active streams. Once a stream has been removed
|
||||
* it will no longer have messages sent to it.
|
||||
*
|
||||
* @param string $keyname Key name of a configured stream to remove.
|
||||
* @param string $streamName Key name of a configured stream to remove.
|
||||
* @return void
|
||||
*/
|
||||
public static function drop($streamName) {
|
||||
|
|
|
@ -226,6 +226,7 @@ abstract class ObjectCollection {
|
|||
*
|
||||
* @param string $name Name of the object
|
||||
* @param Object $object The object to use
|
||||
* @return array Loaded objects
|
||||
*/
|
||||
public function set($name = null, $object = null) {
|
||||
if (!empty($name) && !empty($object)) {
|
||||
|
|
Loading…
Reference in a new issue