Skip to content

Commit

Permalink
Removed the isInterfaceSupported method. It not make sense in PHP5.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Feb 25, 2011
1 parent 05fc10e commit a091302
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
14 changes: 0 additions & 14 deletions cake/libs/model/datasources/datasource.php
Expand Up @@ -276,20 +276,6 @@ public function enabled() {
return true;
}

/**
* Returns true if the DataSource supports the given interface (method)
*
* @param string $interface The name of the interface (method)
* @return boolean True on success
*/
public function isInterfaceSupported($interface) {
static $methods = false;
if ($methods === false) {
$methods = get_class_methods($this);
}
return in_array($interface, $methods);
}

/**
* Sets the configuration for the DataSource.
* Merges the $config information with the _baseConfig and the existing $config property.
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo_source.php
Expand Up @@ -3065,7 +3065,7 @@ public function buildIndex($indexes, $table = null) {
*/
public function readTableParameters($name) {
$parameters = array();
if ($this->isInterfaceSupported('listDetailedSources')) {
if (method_exists($this, 'listDetailedSources')) {
$currentTableDetails = $this->listDetailedSources($name);
foreach ($this->tableParameters as $paramName => $parameter) {
if (!empty($parameter['column']) && !empty($currentTableDetails[$parameter['column']])) {
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/model.php
Expand Up @@ -798,7 +798,7 @@ public function setSource($tableName) {
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = ($this->cacheSources && $db->cacheSources);

if ($db->isInterfaceSupported('listSources')) {
if (method_exists($db, 'listSources')) {
$sources = $db->listSources();
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
throw new MissingTableException(array(
Expand Down Expand Up @@ -981,7 +981,7 @@ public function schema($field = false) {
if (!is_array($this->_schema) || $field === true) {
$db = $this->getDataSource();
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
if ($db->isInterfaceSupported('describe') && $this->useTable !== false) {
if (method_exists($db, 'describe') && $this->useTable !== false) {
$this->_schema = $db->describe($this, $field);
} elseif ($this->useTable === false) {
$this->_schema = array();
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/view/elements/sql_dump.ctp
Expand Up @@ -26,7 +26,7 @@ if ($noLogs):
$logs = array();
foreach ($sources as $source):
$db =& ConnectionManager::getDataSource($source);
if (!$db->isInterfaceSupported('getLog')):
if (!method_exists($db, 'getLog')):
continue;
endif;
$logs[$source] = $db->getLog();
Expand Down
6 changes: 0 additions & 6 deletions cake/tests/cases/libs/model/model_write.test.php
Expand Up @@ -2987,10 +2987,6 @@ function testSaveAllManyRowsTransactionNoRollback() {
$db = ConnectionManager::create('mock_transaction', array(
'datasource' => 'MockTransactionDbo',
));
$db->expects($this->at(2))
->method('isInterfaceSupported')
->with('describe')
->will($this->returnValue(true));

$db->expects($this->once())
->method('describe')
Expand Down Expand Up @@ -3026,8 +3022,6 @@ function testSaveAllAssociatedTransactionNoRollback() {
$db->columns = $testDb->columns;

$db->expects($this->once())->method('rollback');
$db->expects($this->any())->method('isInterfaceSupported')
->will($this->returnValue(true));
$db->expects($this->any())->method('describe')
->will($this->returnValue(array(
'id' => array('type' => 'integer'),
Expand Down

0 comments on commit a091302

Please sign in to comment.