Changed the signature of methods to avoid strict messages.

This commit is contained in:
Juan Basso 2011-07-30 19:17:20 -04:00
parent 39b4032820
commit e4a1816557
9 changed files with 44 additions and 32 deletions

View file

@ -45,7 +45,7 @@ class XcacheEngine extends CacheEngine {
* @param array $settings array of setting for the engine * @param array $settings array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not * @return boolean True if the engine has been successfully initialized, false if not
*/ */
public function init($settings) { public function init($settings = array()) {
parent::init(array_merge(array( parent::init(array_merge(array(
'engine' => 'Xcache', 'engine' => 'Xcache',
'prefix' => Inflector::slug(APP_DIR) . '_', 'prefix' => Inflector::slug(APP_DIR) . '_',

View file

@ -682,7 +682,7 @@ class App {
* @param boolean $parent whether to load the class parent or not * @param boolean $parent whether to load the class parent or not
* @return boolean true indicating the successful load and existence of the class * @return boolean true indicating the successful load and existence of the class
*/ */
private function _loadClass($name, $plugin, $type, $originalType, $parent) { private static function _loadClass($name, $plugin, $type, $originalType, $parent) {
if ($type == 'Console/Command' && $name == 'Shell') { if ($type == 'Console/Command' && $name == 'Shell') {
$type = 'Console'; $type = 'Console';
} else if (isset(self::$types[$originalType]['suffix'])) { } else if (isset(self::$types[$originalType]['suffix'])) {

View file

@ -292,7 +292,7 @@ class Mysql extends DboSource {
* @param Model $model Name of database table to inspect or model instance * @param Model $model Name of database table to inspect or model instance
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe(Model $model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -339,7 +339,7 @@ class Mysql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return array * @return array
*/ */
public function update($model, $fields = array(), $values = null, $conditions = null) { public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
if (!$this->_useAlias) { if (!$this->_useAlias) {
return parent::update($model, $fields, $values, $conditions); return parent::update($model, $fields, $values, $conditions);
} }
@ -381,7 +381,7 @@ class Mysql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return boolean Success * @return boolean Success
*/ */
public function delete($model, $conditions = null) { public function delete(Model $model, $conditions = null) {
if (!$this->_useAlias) { if (!$this->_useAlias) {
return parent::delete($model, $conditions); return parent::delete($model, $conditions);
} }

View file

@ -319,9 +319,10 @@ class DboOracle extends DboSource {
* Returns number of rows in previous resultset. If no previous resultset exists, * Returns number of rows in previous resultset. If no previous resultset exists,
* this returns false. * this returns false.
* *
* @param mixed $source
* @return integer Number of rows in resultset * @return integer Number of rows in resultset
*/ */
public function lastNumRows() { public function lastNumRows($source = null) {
return $this->_numRows; return $this->_numRows;
} }
@ -329,9 +330,11 @@ class DboOracle extends DboSource {
* Executes given SQL statement. This is an overloaded method. * Executes given SQL statement. This is an overloaded method.
* *
* @param string $sql SQL statement * @param string $sql SQL statement
* @param array $params list of params to be bound to query
* @param array $prepareOptions Options to be used in the prepare statement
* @return resource Result resource identifier or null * @return resource Result resource identifier or null
*/ */
protected function _execute($sql) { protected function _execute($sql, $params = array(), $prepareOptions = array()) {
$this->_statementId = @ociparse($this->connection, $sql); $this->_statementId = @ociparse($this->connection, $sql);
if (!$this->_statementId) { if (!$this->_statementId) {
$this->_setError($this->connection); $this->_setError($this->connection);
@ -375,10 +378,10 @@ class DboOracle extends DboSource {
/** /**
* Fetch result row * Fetch result row
* *
* @param string $sql
* @return array * @return array
* @access public
*/ */
public function fetchRow() { public function fetchRow($sql = null) {
if ($this->_currentRow >= $this->_numRows) { if ($this->_currentRow >= $this->_numRows) {
ocifreestatement($this->_statementId); ocifreestatement($this->_statementId);
$this->_map = null; $this->_map = null;
@ -452,9 +455,10 @@ class DboOracle extends DboSource {
* Returns an array of tables in the database. If there are no tables, an error is * Returns an array of tables in the database. If there are no tables, an error is
* raised and the application exits. * raised and the application exits.
* *
* @param mixed $source
* @return array tablenames in the database * @return array tablenames in the database
*/ */
public function listSources() { public function listSources($source = null) {
$cache = parent::listSources(); $cache = parent::listSources();
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -479,7 +483,7 @@ class DboOracle extends DboSource {
* @param Model $model instance of a model to inspect * @param Model $model instance of a model to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe(Model $model) {
$table = $this->fullTableName($model, false); $table = $this->fullTableName($model, false);
if (!empty($model->sequence)) { if (!empty($model->sequence)) {
@ -885,7 +889,7 @@ class DboOracle extends DboSource {
* @param string $source * @param string $source
* @return integer|boolean * @return integer|boolean
*/ */
public function lastInsertId($source) { public function lastInsertId($source = null) {
$sequence = $this->_sequenceMap[$source]; $sequence = $this->_sequenceMap[$source];
$sql = "SELECT $sequence.currval FROM dual"; $sql = "SELECT $sequence.currval FROM dual";
@ -902,18 +906,20 @@ class DboOracle extends DboSource {
/** /**
* Returns a formatted error message from previous database operation. * Returns a formatted error message from previous database operation.
* *
* @param PDOStatement $query the query to extract the error from if any
* @return string Error message with error number * @return string Error message with error number
*/ */
public function lastError() { public function lastError(PDOStatement $query = null) {
return $this->_error; return $this->_error;
} }
/** /**
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false. * Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
* *
* @param mixed $source
* @return int Number of affected rows * @return int Number of affected rows
*/ */
public function lastAffected() { public function lastAffected($source = null) {
return $this->_statementId ? ocirowcount($this->_statementId): false; return $this->_statementId ? ocirowcount($this->_statementId): false;
} }

View file

@ -185,7 +185,7 @@ class Postgres extends DboSource {
* @param Model $model Name of database table to inspect * @param Model $model Name of database table to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe(Model $model) {
$fields = parent::describe($model); $fields = parent::describe($model);
$table = $this->fullTableName($model, false); $table = $this->fullTableName($model, false);
$this->_sequenceMap[$table] = array(); $this->_sequenceMap[$table] = array();
@ -267,7 +267,7 @@ class Postgres extends DboSource {
* @param string $field Name of the ID database field. Defaults to "id" * @param string $field Name of the ID database field. Defaults to "id"
* @return integer * @return integer
*/ */
public function lastInsertId($source, $field = 'id') { public function lastInsertId($source = null, $field = 'id') {
$seq = $this->getSequence($source, $field); $seq = $this->getSequence($source, $field);
return $this->_connection->lastInsertId($seq); return $this->_connection->lastInsertId($seq);
} }

View file

@ -162,7 +162,7 @@ class Sqlite extends DboSource {
* @param Model $model * @param Model $model
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe(Model $model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -204,7 +204,7 @@ class Sqlite extends DboSource {
* @return array * @return array
* @access public * @access public
*/ */
public function update($model, $fields = array(), $values = null, $conditions = null) { public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
if (empty($values) && !empty($fields)) { if (empty($values) && !empty($fields)) {
foreach ($fields as $field => $value) { foreach ($fields as $field => $value) {
if (strpos($field, $model->alias . '.') !== false) { if (strpos($field, $model->alias . '.') !== false) {

View file

@ -169,9 +169,10 @@ class Sqlserver extends DboSource {
/** /**
* Returns an array of sources (tables) in the database. * Returns an array of sources (tables) in the database.
* *
* @param mixed $data
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
public function listSources() { public function listSources($data = null) {
$cache = parent::listSources(); $cache = parent::listSources();
if ($cache !== null) { if ($cache !== null) {
return $cache; return $cache;
@ -200,7 +201,7 @@ class Sqlserver extends DboSource {
* @param Model $model Model object to describe * @param Model $model Model object to describe
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe(Model $model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -330,7 +331,7 @@ class Sqlserver extends DboSource {
* @param array $values * @param array $values
* @return array * @return array
*/ */
public function create($model, $fields = null, $values = null) { public function create(Model $model, $fields = null, $values = null) {
if (!empty($values)) { if (!empty($values)) {
$fields = array_combine($fields, $values); $fields = array_combine($fields, $values);
} }
@ -360,7 +361,7 @@ class Sqlserver extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return array * @return array
*/ */
public function update($model, $fields = array(), $values = null, $conditions = null) { public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
if (!empty($values)) { if (!empty($values)) {
$fields = array_combine($fields, $values); $fields = array_combine($fields, $values);
} }
@ -595,7 +596,7 @@ class Sqlserver extends DboSource {
* @param integer $recursive * @param integer $recursive
* @return array Array of resultset rows, or false if no rows matched * @return array Array of resultset rows, or false if no rows matched
*/ */
public function read($model, $queryData = array(), $recursive = null) { public function read(Model $model, $queryData = array(), $recursive = null) {
$results = parent::read($model, $queryData, $recursive); $results = parent::read($model, $queryData, $recursive);
$this->_fieldMappings = array(); $this->_fieldMappings = array();
return $results; return $results;
@ -733,9 +734,10 @@ class Sqlserver extends DboSource {
* Returns number of affected rows in previous database operation. If no previous operation exists, * Returns number of affected rows in previous database operation. If no previous operation exists,
* this returns false. * this returns false.
* *
* @param mixed $source
* @return integer Number of affected rows * @return integer Number of affected rows
*/ */
public function lastAffected() { public function lastAffected($source = null) {
$affected = parent::lastAffected(); $affected = parent::lastAffected();
if ($affected === null && $this->_lastAffected !== false) { if ($affected === null && $this->_lastAffected !== false) {
return $this->_lastAffected; return $this->_lastAffected;

View file

@ -503,9 +503,10 @@ class DboSource extends DataSource {
* Returns number of affected rows in previous database operation. If no previous operation exists, * Returns number of affected rows in previous database operation. If no previous operation exists,
* this returns false. * this returns false.
* *
* @param mixed $source
* @return integer Number of affected rows * @return integer Number of affected rows
*/ */
public function lastAffected() { public function lastAffected($source = null) {
if ($this->hasResult()) { if ($this->hasResult()) {
return $this->_result->rowCount(); return $this->_result->rowCount();
} }
@ -516,9 +517,10 @@ class DboSource extends DataSource {
* Returns number of rows in previous resultset. If no previous resultset exists, * Returns number of rows in previous resultset. If no previous resultset exists,
* this returns false. * this returns false.
* *
* @param mixed $source Not used
* @return integer Number of rows in resultset * @return integer Number of rows in resultset
*/ */
public function lastNumRows() { public function lastNumRows($source = null) {
return $this->lastAffected(); return $this->lastAffected();
} }
@ -990,7 +992,7 @@ class DboSource extends DataSource {
* be used to generate values. * be used to generate values.
* @return boolean Success * @return boolean Success
*/ */
public function create($model, $fields = null, $values = null) { public function create(Model $model, $fields = null, $values = null) {
$id = null; $id = null;
if ($fields == null) { if ($fields == null) {
@ -1037,7 +1039,7 @@ class DboSource extends DataSource {
* @param integer $recursive Number of levels of association * @param integer $recursive Number of levels of association
* @return mixed boolean false on error/failure. An array of results on success. * @return mixed boolean false on error/failure. An array of results on success.
*/ */
public function read($model, $queryData = array(), $recursive = null) { public function read(Model $model, $queryData = array(), $recursive = null) {
$queryData = $this->__scrubQueryData($queryData); $queryData = $this->__scrubQueryData($queryData);
$null = null; $null = null;
@ -1809,7 +1811,7 @@ class DboSource extends DataSource {
* @param mixed $conditions * @param mixed $conditions
* @return boolean Success * @return boolean Success
*/ */
public function update($model, $fields = array(), $values = null, $conditions = null) { public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
if ($values == null) { if ($values == null) {
$combined = $fields; $combined = $fields;
} else { } else {
@ -1886,7 +1888,7 @@ class DboSource extends DataSource {
* @param mixed $conditions * @param mixed $conditions
* @return boolean Success * @return boolean Success
*/ */
public function delete($model, $conditions = null) { public function delete(Model $model, $conditions = null) {
$alias = $joins = null; $alias = $joins = null;
$table = $this->fullTableName($model); $table = $this->fullTableName($model);
$conditions = $this->_matchRecords($model, $conditions); $conditions = $this->_matchRecords($model, $conditions);
@ -2131,7 +2133,7 @@ class DboSource extends DataSource {
* @param string $assoc * @param string $assoc
* @return string * @return string
*/ */
public function resolveKey($model, $key, $assoc = null) { public function resolveKey(Model $model, $key, $assoc = null) {
if (empty($assoc)) { if (empty($assoc)) {
$assoc = $model->alias; $assoc = $model->alias;
} }

View file

@ -86,9 +86,11 @@ class MediaView extends View {
/** /**
* Display or download the given file * Display or download the given file
* *
* @param string $view Not used
* @param string $layout Not used
* @return mixed * @return mixed
*/ */
public function render() { public function render($view = null, $layout = null) {
$name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null; $name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null;
extract($this->viewVars, EXTR_OVERWRITE); extract($this->viewVars, EXTR_OVERWRITE);