From aae695088981af37193fc7064a21578e3583aadf Mon Sep 17 00:00:00 2001 From: meus Date: Thu, 20 Sep 2007 21:47:24 +0000 Subject: [PATCH] fixing coding standard $_ infront of private var and removing \e from pcre call due to incompatibility with suhosin --- lib/Doctrine.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/Doctrine.php b/lib/Doctrine.php index e60f89164..3c4be6159 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -391,7 +391,7 @@ final class Doctrine /** * @var string $path doctrine root directory */ - private static $path; + private static $_path; /** * @var boolean $_debug */ @@ -412,10 +412,10 @@ final class Doctrine */ public static function getPath() { - if ( ! self::$path) { - self::$path = dirname(__FILE__); + if ( ! self::$_path) { + self::$_path = dirname(__FILE__); } - return self::$path; + return self::$_path; } /** * loadAll @@ -591,10 +591,10 @@ final class Doctrine if (class_exists($classname, false)) { return false; } - if ( ! self::$path) { - self::$path = dirname(__FILE__); + if ( ! self::$_path) { + self::$_path = dirname(__FILE__); } - $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; + $class = self::$_path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; if ( ! file_exists($class)) { return false; @@ -653,7 +653,19 @@ final class Doctrine */ public static function classify($tablename) { - return preg_replace('~(_?)(_)([\w])~e', '"$1".strtoupper("$3")', ucfirst($tablename)); + echo "rat"; + return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine", "classifyCallback"), ucfirst($tablename)); + } + + /** + * Callback function to classify a classname propperly. + * + * @param array $matches An array of matches from a pcre_replace call + * @return string A string with matches 1 and mathces 3 in upper case. + */ + public static function classifyCallback($matches) + { + return $matches[1] . strtoupper($matches[3]); } /** * checks for valid class name (uses camel case and underscores) @@ -669,4 +681,4 @@ final class Doctrine return true; } -} \ No newline at end of file +}