Skip to content
Browse files

Merge pull request #484 from majna/2.1-apidocs

Fixed Folder::tree(), docblocks and removed a bunch of unused code
  • Loading branch information...
2 parents 14228fa + 0cd9a93 commit bc98a5ec650871a17e293206971a23eaf1eb224c @lorenzo lorenzo committed
View
1 lib/Cake/Console/Command/Task/ProjectTask.php
@@ -153,7 +153,6 @@ public function cakeOnIncludePath() {
* Looks for a skeleton template of a Cake application,
* and if not found asks the user for a path. When there is a path
* this method will make a deep copy of the skeleton to the project directory.
- * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
*
* @param string $path Project path
* @param string $skel Path to copy from
View
3 lib/Cake/Console/Command/Task/TestTask.php
@@ -467,8 +467,9 @@ public function generateConstructor($type, $fullClassName) {
* Generate the uses() calls for a type & classname
*
* @param string $type The Type of object you are generating tests for eg. controller
+ * @param string $realType The package name for the class.
* @param string $className The Classname of the class the test is being generated for.
- * @return array Constructor snippets for the thing you are building.
+ * @return array An array containing used classes
*/
public function generateUses($type, $realType, $className) {
$uses = array();
View
1 lib/Cake/Console/Command/TestShell.php
@@ -371,7 +371,6 @@ protected function _mapFileToCase($file, $category, $throwOnMissingFile = true)
}
throw new Exception(__d('cake_dev', 'Test case %s cannot be run via this shell', $testFile));
- return false;
}
}
View
1 lib/Cake/Controller/Component/SecurityComponent.php
@@ -462,7 +462,6 @@ protected function _validatePost($controller) {
);
foreach ($fieldList as $i => $key) {
- $isDisabled = false;
$isLocked = (is_array($locked) && in_array($key, $locked));
if (!empty($unlockedFields)) {
View
1 lib/Cake/Model/Behavior/ContainableBehavior.php
@@ -266,7 +266,6 @@ public function resetBindings($Model) {
public function containments($Model, $contain, $containments = array(), $throwErrors = null) {
$options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery');
$keep = array();
- $depth = array();
if ($throwErrors === null) {
$throwErrors = (empty($this->settings[$Model->alias]) ? true : $this->settings[$Model->alias]['notices']);
}
View
2 lib/Cake/Model/Behavior/TreeBehavior.php
@@ -274,7 +274,7 @@ public function children($Model, $id = null, $direct = false, $fields = null, $o
} elseif (!$id) {
$id = null;
}
- $name = $Model->alias;
+
extract($this->settings[$Model->alias]);
if (!is_null($overrideRecursive)) {
View
2 lib/Cake/Model/Datasource/Database/Mysql.php
@@ -607,10 +607,8 @@ protected function _alterIndexes($table, $indexes) {
*/
public function listDetailedSources($name = null) {
$condition = '';
- $params = array();
if (is_string($name)) {
$condition = ' WHERE name = ' . $this->value($name);
- $params = array($name);
}
$result = $this->_connection->query('SHOW TABLE STATUS ' . $condition, PDO::FETCH_ASSOC);
View
1 lib/Cake/Model/Datasource/Database/Postgres.php
@@ -450,7 +450,6 @@ public function index($model) {
if ($key['indisprimary']) {
$key['relname'] = 'PRIMARY';
}
- $col = array();
preg_match('/\(([^\)]+)\)/', $key['statement'], $indexColumns);
$parsedColumn = $indexColumns[1];
if (strpos($indexColumns[1], ',') !== false) {
View
3 lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -151,7 +151,6 @@ public function listSources($data = null) {
parent::listSources($tables);
return $tables;
}
- return array();
}
/**
@@ -391,8 +390,6 @@ public function buildColumn($column) {
return null;
}
- $real = $this->columns[$type];
- $out = $this->name($name) . ' ' . $real['name'];
if (isset($column['key']) && $column['key'] == 'primary' && $type == 'integer') {
return $this->name($name) . ' ' . $this->columns['primary_key']['name'];
}
View
1 lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -780,7 +780,6 @@ public function dropSchema(CakeSchema $schema, $table = null) {
$out = '';
foreach ($schema->tables as $curTable => $columns) {
if (!$table || $table == $curTable) {
- $t = $this->fullTableName($curTable);
$out .= "IF OBJECT_ID('" . $this->fullTableName($curTable, false). "', 'U') IS NOT NULL DROP TABLE " . $this->fullTableName($curTable) . ";\n";
}
}
View
11 lib/Cake/Model/Datasource/DboSource.php
@@ -391,9 +391,9 @@ public function rawQuery($sql, $params = array()) {
*
* - log - Whether or not the query should be logged to the memory log.
*
- * @param string $sql
+ * @param string $sql SQL statement
* @param array $options
- * @param array $params values to be bided to the query
+ * @param array $params values to be bound to the query
* @return mixed Resource or object representing the result set, or false on failure
*/
public function execute($sql, $options = array(), $params = array()) {
@@ -580,7 +580,6 @@ public function query() {
} else if (isset($args[1]) && !is_array($args[1]) ) {
return $this->fetchAll($args[0], false);
} else if (isset($args[1]) && is_array($args[1])) {
- $offset = 0;
if (isset($args[2])) {
$cache = $args[2];
} else {
@@ -892,6 +891,7 @@ public function showLog($sorted = false) {
* Log given SQL query.
*
* @param string $sql SQL statement
+ * @param array $params Values binded to the query (prepared statements)
* @return void
*/
public function logQuery($sql, $params = array()) {
@@ -2108,9 +2108,6 @@ public function defaultConditions($model, $conditions, $useAlias = true) {
* @return string
*/
public function resolveKey(Model $model, $key, $assoc = null) {
- if (empty($assoc)) {
- $assoc = $model->alias;
- }
if (strpos('.', $key) !== false) {
return $this->name($model->alias) . '.' . $this->name($key);
}
@@ -2235,7 +2232,6 @@ public function fields($model, $alias = null, $fields = array(), $quote = true)
);
$fields[$i] = $this->name(($prefix ? $alias . '.' : '') . $fields[$i]);
} else {
- $value = array();
if (strpos($fields[$i], ',') === false) {
$build = explode('.', $fields[$i]);
if (!Set::numeric($build)) {
@@ -2787,7 +2783,6 @@ public function insertMulti($table, $fields, $values) {
);
$columnMap = array();
- $count = count($values);
$sql = "INSERT INTO {$table} ({$fields}) VALUES ({$holder})";
$statement = $this->_connection->prepare($sql);
$this->begin();
View
6 lib/Cake/Model/Model.php
@@ -745,7 +745,7 @@ public function implementedEvents() {
/**
* Returns the CakeEventManager manager instance that is handling any callbacks.
* You can use this instance to register any new listeners or callbacks to the
- * controller events, or create your own events and trigger them at will.
+ * model events, or create your own events and trigger them at will.
*
* @return CakeEventManager
*/
@@ -896,7 +896,6 @@ public function bindModel($params, $reset = true) {
$assocName = $value;
$value = array();
}
- $modelName = $assocName;
$this->{$assoc}[$assocName] = $value;
if (property_exists($this, $assocName)) {
unset($this->{$assocName});
@@ -1193,7 +1192,6 @@ public function deconstruct($field, $data) {
return $data;
}
- $copy = $data;
$type = $this->getColumnType($field);
if (in_array($type, array('datetime', 'timestamp', 'date', 'time'))) {
@@ -2994,7 +2992,7 @@ public function query($sql) {
*
* Will validate the currently set data. Use Model::set() or Model::create() to set the active data.
*
- * @param string $options An optional array of custom options to be made available in the beforeValidate callback
+ * @param array $options An optional array of custom options to be made available in the beforeValidate callback
* @return boolean True if there are no errors
*/
public function validates($options = array()) {
View
3 lib/Cake/Network/Email/CakeEmail.php
@@ -947,7 +947,8 @@ public function config($config = null) {
/**
* Send an email using the specified content, template and layout
- *
+ *
+ * @param mixed $content String with message or array with messages
* @return array
* @throws SocketException
*/
View
3 lib/Cake/Test/Case/Utility/FolderTest.php
@@ -476,6 +476,9 @@ public function testFolderTreeWithHiddenFiles() {
$result = $Folder->tree(null, true);
$this->assertEquals($expected, $result);
+ $result = $Folder->tree(null, array('.'));
+ $this->assertEquals($expected, $result);
+
$expected = array(
array(
$Folder->path,
View
4 lib/Cake/Utility/CakeTime.php
@@ -327,7 +327,6 @@ public static function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public static function dayAsSql($dateString, $fieldName, $userOffset = null) {
- $date = self::fromString($dateString, $userOffset);
return self::daysAsSql($dateString, $dateString, $fieldName);
}
@@ -559,9 +558,6 @@ public static function timeAgoInWords($dateTime, $options = array()) {
// If more than a week, then take into account the length of months
if ($diff >= 604800) {
- $current = array();
- $date = array();
-
list($future['H'], $future['i'], $future['s'], $future['d'], $future['m'], $future['Y']) = explode('/', date('H/i/s/d/m/Y', $futureTime));
list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $pastTime));
View
6 lib/Cake/Utility/Folder.php
@@ -413,10 +413,6 @@ public function tree($path = null, $exceptions = false, $type = null) {
if (is_array($exceptions)) {
$exceptions = array_flip($exceptions);
- if (isset($exceptions['.'])) {
- $skipHidden = true;
- unset($exceptions['.']);
- }
}
$skipHidden = false;
if ($exceptions === true) {
@@ -435,7 +431,7 @@ public function tree($path = null, $exceptions = false, $type = null) {
}
return array();
}
- $pathLength = strlen($path);
+
foreach ($iterator as $itemPath => $fsIterator) {
if ($skipHidden) {
$subPathName = $fsIterator->getSubPathname();
View
2 lib/Cake/View/Helper/JsBaseEngineHelper.php
@@ -538,7 +538,7 @@ protected function _mapOptions($method, $options) {
*
* @param string $method Name of the method you are preparing callbacks for.
* @param array $options Array of options being parsed
- * @param string $callbacks Additional Keys that contain callbacks
+ * @param array $callbacks Additional Keys that contain callbacks
* @return array Array of options with callbacks added.
*/
protected function _prepareCallbacks($method, $options, $callbacks = array()) {
View
1 lib/Cake/View/View.php
@@ -803,7 +803,6 @@ public function __get($name) {
default:
return $this->{$name};
}
- return null;
}
/**

0 comments on commit bc98a5e

Please sign in to comment.
Something went wrong with that request. Please try again.