From be6cdea87b494e89bbc3d77f06c84bd91491196a Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 8 Jun 2013 22:20:19 +0300 Subject: [PATCH] cleanup --- ipf/orm/configurable.php | 38 +++++++++++++++++++------------------- ipf/orm/connection.php | 4 +--- ipf/orm/formatter.php | 3 +-- ipf/orm/manager.php | 3 ++- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/ipf/orm/configurable.php b/ipf/orm/configurable.php index 0c66614..2a2e759 100644 --- a/ipf/orm/configurable.php +++ b/ipf/orm/configurable.php @@ -108,13 +108,13 @@ abstract class IPF_ORM_Configurable extends IPF_ORM_Locator_Injectable public function getParams($namespace = null) { - if ($namespace == null) { - $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); - } - - if ( ! isset($this->_params[$namespace])) { - return null; - } + if ($namespace == null) { + $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); + } + + if (!isset($this->_params[$namespace])) { + return null; + } return $this->_params[$namespace]; } @@ -126,22 +126,22 @@ abstract class IPF_ORM_Configurable extends IPF_ORM_Locator_Injectable public function setParam($name, $value, $namespace = null) { - if ($namespace == null) { - $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); - } - - $this->_params[$namespace][$name] = $value; - - return $this; + if ($namespace == null) { + $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); + } + + $this->_params[$namespace][$name] = $value; + + return $this; } public function getParam($name, $namespace = null) { - if ($namespace == null) { - $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); - } - - if ( ! isset($this->_params[$name])) { + if ($namespace == null) { + $namespace = $this->getAttribute(IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE); + } + + if (!isset($this->_params[$name])) { if (isset($this->parent)) { return $this->parent->getParam($name, $namespace); } diff --git a/ipf/orm/connection.php b/ipf/orm/connection.php index 7e1cfd8..9a4b4f1 100644 --- a/ipf/orm/connection.php +++ b/ipf/orm/connection.php @@ -200,15 +200,13 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta public function getDbh() { $this->connect(); - return $this->dbh; } public function connect() { - if ($this->isConnected) { + if ($this->isConnected) return false; - } $event = new IPF_ORM_Event($this, IPF_ORM_Event::CONN_CONNECT); diff --git a/ipf/orm/formatter.php b/ipf/orm/formatter.php index c4bf9c7..078f655 100644 --- a/ipf/orm/formatter.php +++ b/ipf/orm/formatter.php @@ -85,8 +85,6 @@ class IPF_ORM_Formatter extends IPF_ORM_Connection_Module case 'gzip': case 'blob': case 'clob': - $this->conn->connect(); - return $this->conn->getDbh()->quote($input); } } @@ -130,3 +128,4 @@ class IPF_ORM_Formatter extends IPF_ORM_Connection_Module $table); } } + diff --git a/ipf/orm/manager.php b/ipf/orm/manager.php index f78e88f..b76b5b0 100644 --- a/ipf/orm/manager.php +++ b/ipf/orm/manager.php @@ -17,7 +17,7 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato public function setDefaultAttributes() { static $init = false; - if ( ! $init) { + if (!$init) { $init = true; $attributes = array( IPF_ORM::ATTR_CACHE => null, @@ -422,3 +422,4 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato return implode("\n",$r); } } + -- 2.49.0