Updating PHPDoc and method visibility.

This commit is contained in:
Juan Basso 2011-05-21 22:18:57 -04:00
parent 3e4cd4fdbb
commit 11d249e43b
2 changed files with 42 additions and 69 deletions

View file

@ -93,7 +93,6 @@ class Mssql extends DboSource {
* Index of basic SQL commands * Index of basic SQL commands
* *
* @var array * @var array
* @access protected
*/ */
protected $_commands = array( protected $_commands = array(
'begin' => 'BEGIN TRANSACTION', 'begin' => 'BEGIN TRANSACTION',
@ -105,7 +104,6 @@ class Mssql extends DboSource {
* Define if the last query had error * Define if the last query had error
* *
* @var string * @var string
* @access private
*/ */
private $__lastQueryHadError = false; private $__lastQueryHadError = false;
@ -114,7 +112,7 @@ class Mssql extends DboSource {
* *
* @return boolean True if the database could be connected, else false * @return boolean True if the database could be connected, else false
*/ */
function connect() { public function connect() {
$config = $this->config; $config = $this->config;
$this->connected = false; $this->connected = false;
try { try {
@ -180,7 +178,7 @@ class Mssql 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
*/ */
function describe($model) { public function describe($model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -230,7 +228,7 @@ class Mssql extends DboSource {
* @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided * @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided
* @return string Quoted and escaped data * @return string Quoted and escaped data
*/ */
function value($data, $column = null, $safe = false) { public function value($data, $column = null, $safe = false) {
$parent = parent::value($data, $column, $safe); $parent = parent::value($data, $column, $safe);
if ($column === 'float' && strpos($data, '.') !== false) { if ($column === 'float' && strpos($data, '.') !== false) {
@ -279,7 +277,7 @@ class Mssql extends DboSource {
* @param mixed $fields * @param mixed $fields
* @return array * @return array
*/ */
function fields($model, $alias = null, $fields = array(), $quote = true) { public function fields($model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) { if (empty($alias)) {
$alias = $model->alias; $alias = $model->alias;
} }
@ -345,7 +343,7 @@ class Mssql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return array * @return array
*/ */
function create($model, $fields = null, $values = null) { public function create($model, $fields = null, $values = null) {
if (!empty($values)) { if (!empty($values)) {
$fields = array_combine($fields, $values); $fields = array_combine($fields, $values);
} }
@ -375,7 +373,7 @@ class Mssql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return array * @return array
*/ */
function update($model, $fields = array(), $values = null, $conditions = null) { public function update($model, $fields = array(), $values = null, $conditions = null) {
if (!empty($values)) { if (!empty($values)) {
$fields = array_combine($fields, $values); $fields = array_combine($fields, $values);
} }
@ -395,7 +393,7 @@ class Mssql extends DboSource {
* @param integer $offset Offset from which to start results * @param integer $offset Offset from which to start results
* @return string SQL limit/offset statement * @return string SQL limit/offset statement
*/ */
function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = '';
if (!strpos(strtolower($limit), 'top') || strpos(strtolower($limit), 'top') === 0) { if (!strpos(strtolower($limit), 'top') || strpos(strtolower($limit), 'top') === 0) {
@ -416,7 +414,7 @@ class Mssql extends DboSource {
* @param string $real Real database-layer column type (i.e. "varchar(255)") * @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string") * @return string Abstract column type (i.e. "string")
*/ */
function column($real) { public function column($real) {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
@ -460,7 +458,7 @@ class Mssql extends DboSource {
* *
* @param PDOStatement $results * @param PDOStatement $results
*/ */
function resultSet($results) { public function resultSet($results) {
$this->map = array(); $this->map = array();
$numFields = $results->columnCount(); $numFields = $results->columnCount();
$index = 0; $index = 0;
@ -492,7 +490,7 @@ class Mssql extends DboSource {
* @param array $data Query data * @param array $data Query data
* @return string * @return string
*/ */
function renderStatement($type, $data) { public function renderStatement($type, $data) {
switch (strtolower($type)) { switch (strtolower($type)) {
case 'select': case 'select':
extract($data); extract($data);
@ -542,9 +540,8 @@ class Mssql extends DboSource {
* *
* @param string $order * @param string $order
* @return string * @return string
* @access private
*/ */
function __switchSort($order) { private function __switchSort($order) {
$order = preg_replace('/\s+ASC/i', '__tmp_asc__', $order); $order = preg_replace('/\s+ASC/i', '__tmp_asc__', $order);
$order = preg_replace('/\s+DESC/i', ' ASC', $order); $order = preg_replace('/\s+DESC/i', ' ASC', $order);
return preg_replace('/__tmp_asc__/', ' DESC', $order); return preg_replace('/__tmp_asc__/', ' DESC', $order);
@ -555,9 +552,8 @@ class Mssql extends DboSource {
* *
* @param string $sql A snippet of SQL representing an ORDER or WHERE statement * @param string $sql A snippet of SQL representing an ORDER or WHERE statement
* @return string The value of $sql with field names replaced * @return string The value of $sql with field names replaced
* @access private
*/ */
function __mapFields($sql) { private function __mapFields($sql) {
if (empty($sql) || empty($this->_fieldMappings)) { if (empty($sql) || empty($this->_fieldMappings)) {
return $sql; return $sql;
} }
@ -576,7 +572,7 @@ class Mssql extends DboSource {
* @param boolean $cache Enables returning/storing cached query results * @param boolean $cache Enables returning/storing cached query results
* @return array Array of resultset rows, or false if no rows matched * @return array Array of resultset rows, or false if no rows matched
*/ */
function read($model, $queryData = array(), $recursive = null) { public function read($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;
@ -587,7 +583,7 @@ class Mssql extends DboSource {
* *
* @return mixed * @return mixed
*/ */
function fetchResult() { public function fetchResult() {
if ($row = $this->_result->fetch()) { if ($row = $this->_result->fetch()) {
$resultRow = array(); $resultRow = array();
foreach ($this->map as $col => $meta) { foreach ($this->map as $col => $meta) {
@ -633,7 +629,7 @@ class Mssql extends DboSource {
* where options can be 'default', 'length', or 'key'. * where options can be 'default', 'length', or 'key'.
* @return string * @return string
*/ */
function buildColumn($column) { public function buildColumn($column) {
$result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column)); $result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
if (strpos($result, 'DEFAULT NULL') !== false) { if (strpos($result, 'DEFAULT NULL') !== false) {
if (isset($column['default']) && $column['default'] === '') { if (isset($column['default']) && $column['default'] === '') {
@ -654,7 +650,7 @@ class Mssql extends DboSource {
* @param string $table * @param string $table
* @return string * @return string
*/ */
function buildIndex($indexes, $table = null) { public function buildIndex($indexes, $table = null) {
$join = array(); $join = array();
foreach ($indexes as $name => $value) { foreach ($indexes as $name => $value) {
@ -679,10 +675,9 @@ class Mssql extends DboSource {
* Makes sure it will return the primary key * Makes sure it will return the primary key
* *
* @param mixed $model Model instance of table name * @param mixed $model Model instance of table name
* @access protected
* @return string * @return string
*/ */
function _getPrimaryKey($model) { protected function _getPrimaryKey($model) {
if (!is_object($model)) { if (!is_object($model)) {
$model = new Model(false, $model); $model = new Model(false, $model);
} }

View file

@ -31,7 +31,6 @@ class MssqlTestDb extends Mssql {
* simulated property * simulated property
* *
* @var array * @var array
* @access public
*/ */
public $simulated = array(); public $simulated = array();
@ -39,7 +38,6 @@ class MssqlTestDb extends Mssql {
* execute results stack * execute results stack
* *
* @var array * @var array
* @access public
*/ */
public $executeResultsStack = array(); public $executeResultsStack = array();
@ -47,10 +45,9 @@ class MssqlTestDb extends Mssql {
* execute method * execute method
* *
* @param mixed $sql * @param mixed $sql
* @access protected * @return mixed
* @return void
*/ */
function _execute($sql) { protected function _execute($sql) {
$this->simulated[] = $sql; $this->simulated[] = $sql;
return empty($this->executeResultsStack) ? null : array_pop($this->executeResultsStack); return empty($this->executeResultsStack) ? null : array_pop($this->executeResultsStack);
} }
@ -59,20 +56,18 @@ class MssqlTestDb extends Mssql {
* fetchAll method * fetchAll method
* *
* @param mixed $sql * @param mixed $sql
* @access protected
* @return void * @return void
*/ */
function _matchRecords($model, $conditions = null) { protected function _matchRecords($model, $conditions = null) {
return $this->conditions(array('id' => array(1, 2))); return $this->conditions(array('id' => array(1, 2)));
} }
/** /**
* getLastQuery method * getLastQuery method
* *
* @access public * @return string
* @return void
*/ */
function getLastQuery() { public function getLastQuery() {
return $this->simulated[count($this->simulated) - 1]; return $this->simulated[count($this->simulated) - 1];
} }
@ -80,20 +75,18 @@ class MssqlTestDb extends Mssql {
* getPrimaryKey method * getPrimaryKey method
* *
* @param mixed $model * @param mixed $model
* @access public * @return string
* @return void
*/ */
function getPrimaryKey($model) { public function getPrimaryKey($model) {
return parent::_getPrimaryKey($model); return parent::_getPrimaryKey($model);
} }
/** /**
* clearFieldMappings method * clearFieldMappings method
* *
* @access public
* @return void * @return void
*/ */
function clearFieldMappings() { public function clearFieldMappings() {
$this->_fieldMappings = array(); $this->_fieldMappings = array();
} }
@ -101,10 +94,9 @@ class MssqlTestDb extends Mssql {
* describe method * describe method
* *
* @param object $model * @param object $model
* @access public
* @return void * @return void
*/ */
function describe($model) { public function describe($model) {
return empty($this->describe) ? parent::describe($model) : $this->describe; return empty($this->describe) ? parent::describe($model) : $this->describe;
} }
} }
@ -120,7 +112,6 @@ class MssqlTestModel extends Model {
* name property * name property
* *
* @var string 'MssqlTestModel' * @var string 'MssqlTestModel'
* @access public
*/ */
public $name = 'MssqlTestModel'; public $name = 'MssqlTestModel';
@ -128,7 +119,6 @@ class MssqlTestModel extends Model {
* useTable property * useTable property
* *
* @var bool false * @var bool false
* @access public
*/ */
public $useTable = false; public $useTable = false;
@ -136,7 +126,6 @@ class MssqlTestModel extends Model {
* _schema property * _schema property
* *
* @var array * @var array
* @access protected
*/ */
protected $_schema = array( protected $_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
@ -163,7 +152,6 @@ class MssqlTestModel extends Model {
* belongsTo property * belongsTo property
* *
* @var array * @var array
* @access public
*/ */
public $belongsTo = array( public $belongsTo = array(
'MssqlClientTestModel' => array( 'MssqlClientTestModel' => array(
@ -177,10 +165,9 @@ class MssqlTestModel extends Model {
* @param mixed $fields * @param mixed $fields
* @param mixed $order * @param mixed $order
* @param mixed $recursive * @param mixed $recursive
* @access public
* @return void * @return void
*/ */
function find($conditions = null, $fields = null, $order = null, $recursive = null) { public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
return $conditions; return $conditions;
} }
@ -191,10 +178,9 @@ class MssqlTestModel extends Model {
* @param mixed $fields * @param mixed $fields
* @param mixed $order * @param mixed $order
* @param mixed $recursive * @param mixed $recursive
* @access public * @return array
* @return void
*/ */
function findAll($conditions = null, $fields = null, $order = null, $recursive = null) { public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
return $conditions; return $conditions;
} }
} }
@ -209,21 +195,20 @@ class MssqlClientTestModel extends Model {
* name property * name property
* *
* @var string 'MssqlAssociatedTestModel' * @var string 'MssqlAssociatedTestModel'
* @access public
*/ */
public $name = 'MssqlClientTestModel'; public $name = 'MssqlClientTestModel';
/** /**
* useTable property * useTable property
* *
* @var bool false * @var bool false
* @access public
*/ */
public $useTable = false; public $useTable = false;
/** /**
* _schema property * _schema property
* *
* @var array * @var array
* @access protected
*/ */
protected $_schema = array( protected $_schema = array(
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
@ -243,7 +228,7 @@ class MssqlTestResultIterator extends ArrayIterator {
/** /**
* closeCursor method * closeCursor method
* *
* @access public * @return void
*/ */
public function closeCursor() {} public function closeCursor() {}
} }
@ -259,7 +244,6 @@ class MssqlTest extends CakeTestCase {
* The Dbo instance to be tested * The Dbo instance to be tested
* *
* @var DboSource * @var DboSource
* @access public
*/ */
public $db = null; public $db = null;
@ -267,14 +251,13 @@ class MssqlTest extends CakeTestCase {
* autoFixtures property * autoFixtures property
* *
* @var bool false * @var bool false
* @access public
*/ */
public $autoFixtures = false; public $autoFixtures = false;
/** /**
* fixtures property * fixtures property
* *
* @var array * @var array
* @access public
*/ */
public $fixtures = array('core.category'); public $fixtures = array('core.category');
@ -294,21 +277,20 @@ class MssqlTest extends CakeTestCase {
/** /**
* tearDown method * tearDown method
* *
* @access public
* @return void * @return void
*/ */
function tearDown() { public function tearDown() {
unset($this->db->describe); unset($this->Dbo);
unset($this->db);
unset($this->model); unset($this->model);
} }
/** /**
* testQuoting method * testQuoting method
* *
* @access public
* @return void * @return void
*/ */
function testQuoting() { public function testQuoting() {
$expected = "1.2"; $expected = "1.2";
$result = $this->db->value(1.2, 'float'); $result = $this->db->value(1.2, 'float');
$this->assertIdentical($expected, $result); $this->assertIdentical($expected, $result);
@ -332,10 +314,9 @@ class MssqlTest extends CakeTestCase {
/** /**
* testFields method * testFields method
* *
* @access public
* @return void * @return void
*/ */
function testFields() { public function testFields() {
$fields = array( $fields = array(
'[MssqlTestModel].[id] AS [MssqlTestModel__0]', '[MssqlTestModel].[id] AS [MssqlTestModel__0]',
'[MssqlTestModel].[client_id] AS [MssqlTestModel__1]', '[MssqlTestModel].[client_id] AS [MssqlTestModel__1]',
@ -387,10 +368,9 @@ class MssqlTest extends CakeTestCase {
/** /**
* testDistinctFields method * testDistinctFields method
* *
* @access public
* @return void * @return void
*/ */
function testDistinctFields() { public function testDistinctFields() {
$result = $this->db->fields($this->model, null, array('DISTINCT Car.country_code')); $result = $this->db->fields($this->model, null, array('DISTINCT Car.country_code'));
$expected = array('DISTINCT [Car].[country_code] AS [Car__0]'); $expected = array('DISTINCT [Car].[country_code] AS [Car__0]');
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
@ -403,10 +383,9 @@ class MssqlTest extends CakeTestCase {
/** /**
* testDistinctWithLimit method * testDistinctWithLimit method
* *
* @access public
* @return void * @return void
*/ */
function testDistinctWithLimit() { public function testDistinctWithLimit() {
$this->db->read($this->model, array( $this->db->read($this->model, array(
'fields' => array('DISTINCT MssqlTestModel.city', 'MssqlTestModel.country'), 'fields' => array('DISTINCT MssqlTestModel.city', 'MssqlTestModel.country'),
'limit' => 5 'limit' => 5
@ -418,10 +397,9 @@ class MssqlTest extends CakeTestCase {
/** /**
* testDescribe method * testDescribe method
* *
* @access public
* @return void * @return void
*/ */
function testDescribe() { public function testDescribe() {
$MssqlTableDescription = new MssqlTestResultIterator(array( $MssqlTableDescription = new MssqlTestResultIterator(array(
(object) array( (object) array(
'Default' => '((0))', 'Default' => '((0))',
@ -448,7 +426,7 @@ class MssqlTest extends CakeTestCase {
/** /**
* testBuildColumn * testBuildColumn
* *
* @return unknown_type * @return void
*/ */
public function testBuildColumn() { public function testBuildColumn() {
$column = array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '8', 'key' => 'primary'); $column = array('name' => 'id', 'type' => 'integer', 'null' => false, 'default' => '', 'length' => '8', 'key' => 'primary');