[Solar-svn] Revision 2883
pmjones at solarphp.com
pmjones at solarphp.com
Wed Oct 17 08:33:46 CDT 2007
Removing all use of global SOLAR_IGNORE_PARAM constant. The only place that still kind-of needs it is Solar_Sql_Select, so we have an internal constant for that now.
Modified: trunk/Solar/Sql/Select.php
===================================================================
--- trunk/Solar/Sql/Select.php 2007-10-17 13:32:00 UTC (rev 2882)
+++ trunk/Solar/Sql/Select.php 2007-10-17 13:33:46 UTC (rev 2883)
@@ -75,6 +75,19 @@
/**
*
+ * A constant so we can find "ignored" params, to avoid func_num_args().
+ *
+ * The md5() value of 'Solar_Sql_Select::IGNORE', so it should be unique.
+ *
+ * Yes, this is hackery, and perhaps a micro-optimization at that.
+ *
+ * @const
+ *
+ */
+ const IGNORE = '--5a333dc50d9341d8e73e56e2ba591b87';
+
+ /**
+ *
* User-provided configuration.
*
* Keys are ...
@@ -411,13 +424,13 @@
* @return Solar_Sql_Select
*
*/
- public function where($cond, $val = SOLAR_IGNORE_PARAM)
+ public function where($cond, $val = Solar_Sql_Select::IGNORE)
{
if (empty($cond)) {
return $this;
}
- if ($val !== SOLAR_IGNORE_PARAM) {
+ if ($val !== Solar_Sql_Select::IGNORE) {
$cond = $this->_sql->quoteInto($cond, $val);
}
@@ -446,13 +459,13 @@
* @see where()
*
*/
- public function orWhere($cond, $val = SOLAR_IGNORE_PARAM)
+ public function orWhere($cond, $val = Solar_Sql_Select::IGNORE)
{
if (empty($cond)) {
return $this;
}
- if ($val !== SOLAR_IGNORE_PARAM) {
+ if ($val !== Solar_Sql_Select::IGNORE) {
$cond = $this->_sql->quoteInto($cond, $val);
}
@@ -564,13 +577,13 @@
* @return Solar_Sql_Select
*
*/
- public function having($cond, $val = SOLAR_IGNORE_PARAM)
+ public function having($cond, $val = Solar_Sql_Select::IGNORE)
{
if (empty($cond)) {
return $this;
}
- if ($val !== SOLAR_IGNORE_PARAM) {
+ if ($val !== Solar_Sql_Select::IGNORE) {
$cond = $this->_sql->quoteInto($cond, $val);
}
@@ -599,13 +612,13 @@
* @see having()
*
*/
- public function orHaving($cond, $val = SOLAR_IGNORE_PARAM)
+ public function orHaving($cond, $val = Solar_Sql_Select::IGNORE)
{
if (empty($cond)) {
return $this;
}
- if ($val !== SOLAR_IGNORE_PARAM) {
+ if ($val !== Solar_Sql_Select::IGNORE) {
$cond = $this->_sql->quoteInto($cond, $val);
}
Modified: trunk/Solar/View.php
===================================================================
--- trunk/Solar/View.php 2007-10-17 13:32:00 UTC (rev 2882)
+++ trunk/Solar/View.php 2007-10-17 13:33:46 UTC (rev 2883)
@@ -215,7 +215,7 @@
* @return bool True on success, false on failure.
*
*/
- public function assign($spec, $var = SOLAR_IGNORE_PARAM)
+ public function assign($spec, $var = null)
{
// assign from associative array
if (is_array($spec)) {
@@ -252,7 +252,7 @@
}
// assign by name and value
- if (is_string($spec) && $var !== SOLAR_IGNORE_PARAM) {
+ if (is_string($spec)) {
$this->$spec = $var;
return true;
}
Modified: trunk/Solar.php
===================================================================
--- trunk/Solar.php 2007-10-17 13:32:00 UTC (rev 2882)
+++ trunk/Solar.php 2007-10-17 13:33:46 UTC (rev 2883)
@@ -47,14 +47,6 @@
*/
/**
- * Define a random value that lets us avoid having to use func_num_args() and
- * func_get_arg() for optional undefined parameters.
- */
-if (! defined('SOLAR_IGNORE_PARAM')) {
- define('SOLAR_IGNORE_PARAM', uniqid('SOLAR_IGNORE_PARAM' . rand(), true));
-}
-
-/**
* Make sure Solar_Base is loaded even before Solar::start() is called.
* DO NOT use spl_autoload() in this case, it causes segfaults from recursion
* in some environments.
@@ -455,14 +447,14 @@
* @return mixed The value of the configuration group or element.
*
*/
- public static function config($group, $elem = null, $default = SOLAR_IGNORE_PARAM)
+ public static function config($group, $elem = null, $default = null)
{
// are we looking for a group or an element?
if (is_null($elem)) {
// looking for a group. if no default passed, set up an
// empty array.
- if ($default === SOLAR_IGNORE_PARAM) {
+ if ($default === null) {
$default = array();
}
@@ -475,12 +467,6 @@
} else {
- // looking for an element. if no default passed, set up a
- // null.
- if ($default === SOLAR_IGNORE_PARAM) {
- $default = null;
- }
-
// find the requested group and element.
if (! isset(Solar::$config[$group][$elem])) {
return $default;
More information about the Solar-svn
mailing list