Browse Source

Rename classname to className in order to unify the different usage of it.

euromark 12 years ago
parent
commit
e18162f336

+ 1 - 1
src/Cache/CacheRegistry.php

@@ -37,7 +37,7 @@ class CacheRegistry extends ObjectRegistry {
 		if (is_object($class)) {
 			return $class;
 		}
-		return App::classname($class, 'Cache/Engine', 'Engine');
+		return App::className($class, 'Cache/Engine', 'Engine');
 	}
 
 /**

+ 1 - 1
src/Console/Command/Task/CommandTask.php

@@ -151,7 +151,7 @@ class CommandTask extends Shell {
 
 		$name = Inflector::camelize($name);
 		$pluginDot = Inflector::camelize($pluginDot);
-		$class = App::classname($pluginDot . $name, 'Console/Command', 'Shell');
+		$class = App::className($pluginDot . $name, 'Console/Command', 'Shell');
 		if (!$class) {
 			return false;
 		}

+ 1 - 1
src/Console/Command/Task/TestTask.php

@@ -269,7 +269,7 @@ class TestTask extends BakeTask {
 	}
 
 /**
- * Map the types that TestTask uses to concrete types that App::classname can use.
+ * Map the types that TestTask uses to concrete types that App::className can use.
  *
  * @param string $type The type of thing having a test generated.
  * @return string

+ 1 - 1
src/Console/ShellDispatcher.php

@@ -198,7 +198,7 @@ class ShellDispatcher {
 	protected function _shellExists($shell) {
 		$class = array_map('Cake\Utility\Inflector::camelize', explode('.', $shell));
 		$class = implode('.', $class);
-		$class = App::classname($class, 'Console/Command', 'Shell');
+		$class = App::className($class, 'Console/Command', 'Shell');
 		if (class_exists($class)) {
 			return $class;
 		}

+ 1 - 1
src/Console/TaskRegistry.php

@@ -48,7 +48,7 @@ class TaskRegistry extends ObjectRegistry {
  * @return string|false Either the correct classname or false.
  */
 	protected function _resolveClassName($class) {
-		return App::classname($class, 'Console/Command/Task', 'Task');
+		return App::className($class, 'Console/Command/Task', 'Task');
 	}
 
 /**

+ 1 - 1
src/Controller/Component/AclComponent.php

@@ -67,7 +67,7 @@ class AclComponent extends Component {
 		parent::__construct($collection, $config);
 		$classname = $name = Configure::read('Acl.classname');
 		if (!class_exists($classname)) {
-			$classname = App::classname($name, 'Controller/Component/Acl');
+			$classname = App::className($name, 'Controller/Component/Acl');
 			if (!$classname) {
 				throw new Error\Exception(sprintf('Could not find %s.', $name));
 			}

+ 1 - 1
src/Controller/Component/Auth/BaseAuthenticate.php

@@ -155,7 +155,7 @@ abstract class BaseAuthenticate {
 		}
 
 		list($plugin, $class) = pluginSplit($class, true);
-		$className = App::classname($class, 'Controller/Component/Auth', 'PasswordHasher');
+		$className = App::className($class, 'Controller/Component/Auth', 'PasswordHasher');
 		if (!class_exists($className)) {
 			throw new Error\Exception(sprintf('Password hasher class "%s" was not found.', $class));
 		}

+ 2 - 2
src/Controller/Component/AuthComponent.php

@@ -460,7 +460,7 @@ class AuthComponent extends Component {
 			unset($authorize[AuthComponent::ALL]);
 		}
 		foreach ($authorize as $class => $config) {
-			$className = App::classname($class, 'Controller/Component/Auth', 'Authorize');
+			$className = App::className($class, 'Controller/Component/Auth', 'Authorize');
 			if (!class_exists($className)) {
 				throw new Error\Exception(sprintf('Authorization adapter "%s" was not found.', $class));
 			}
@@ -727,7 +727,7 @@ class AuthComponent extends Component {
 			unset($authenticate[AuthComponent::ALL]);
 		}
 		foreach ($authenticate as $class => $config) {
-			$className = App::classname($class, 'Controller/Component/Auth', 'Authenticate');
+			$className = App::className($class, 'Controller/Component/Auth', 'Authenticate');
 			if (!class_exists($className)) {
 				throw new Error\Exception(sprintf('Authentication adapter "%s" was not found.', $class));
 			}

+ 2 - 2
src/Controller/Component/RequestHandlerComponent.php

@@ -514,7 +514,7 @@ class RequestHandlerComponent extends Component {
 		} else {
 			$view = Inflector::classify($type);
 		}
-		$viewClass = App::classname($view, 'View', 'View');
+		$viewClass = App::className($view, 'View', 'View');
 
 		if ($viewClass) {
 			$controller->viewClass = $viewClass;
@@ -540,7 +540,7 @@ class RequestHandlerComponent extends Component {
 		$helper = ucfirst($type);
 
 		if (!in_array($helper, $controller->helpers) && empty($controller->helpers[$helper])) {
-			$helperClass = App::classname($helper, 'View/Helper', 'Helper');
+			$helperClass = App::className($helper, 'View/Helper', 'Helper');
 			if ($helperClass) {
 				$controller->helpers[] = $helper;
 			}

+ 1 - 1
src/Controller/ComponentRegistry.php

@@ -65,7 +65,7 @@ class ComponentRegistry extends ObjectRegistry {
  * @return string|false Either the correct classname or false.
  */
 	protected function _resolveClassName($class) {
-		return App::classname($class, 'Controller/Component', 'Component');
+		return App::className($class, 'Controller/Component', 'Component');
 	}
 
 /**

+ 5 - 5
src/Core/App.php

@@ -66,15 +66,15 @@ class App {
 	protected static $_objectCacheChange = false;
 
 /**
- * Return the classname namespaced. This method checks if the class is defined on the
+ * Return the class name namespaced. This method checks if the class is defined on the
  * application/plugin, otherwise try to load from the CakePHP core
  *
- * @param string $class Classname
+ * @param string $class Class name
  * @param string $type Type of class
- * @param string $suffix Classname suffix
- * @return bool|string False if the class is not found or namespaced classname
+ * @param string $suffix Class name suffix
+ * @return bool|string False if the class is not found or namespaced class name
  */
-	public static function classname($class, $type = '', $suffix = '') {
+	public static function className($class, $type = '', $suffix = '') {
 		if (strpos($class, '\\') !== false) {
 			return $class;
 		}

+ 1 - 1
src/Datasource/ConnectionRegistry.php

@@ -37,7 +37,7 @@ class ConnectionRegistry extends ObjectRegistry {
 		if (is_object($class)) {
 			return $class;
 		}
-		return App::classname($class, 'Datasource');
+		return App::className($class, 'Datasource');
 	}
 
 /**

+ 1 - 1
src/Error/ErrorHandler.php

@@ -129,7 +129,7 @@ class ErrorHandler extends BaseErrorHandler {
  * @throws \Exception When the chosen exception renderer is invalid.
  */
 	protected function _displayException($exception) {
-		$renderer = App::classname($this->_options['exceptionRenderer'], 'Error');
+		$renderer = App::className($this->_options['exceptionRenderer'], 'Error');
 		try {
 			if (!$renderer) {
 				throw new \Exception("$renderer is an invalid class.");

+ 1 - 1
src/Log/LogEngineRegistry.php

@@ -37,7 +37,7 @@ class LogEngineRegistry extends ObjectRegistry {
 			return $class;
 		}
 
-		return App::classname($class, 'Log/Engine', 'Log');
+		return App::className($class, 'Log/Engine', 'Log');
 	}
 
 /**

+ 3 - 3
src/Network/Email/Email.php

@@ -947,7 +947,7 @@ class Email {
 		}
 
 		$config = static::$_transportConfig[$name];
-		$classname = App::classname($config['className'], 'Network/Email', 'Transport');
+		$classname = App::className($config['className'], 'Network/Email', 'Transport');
 		if (!$classname) {
 			throw new Exception(sprintf('Transport class "%s" not found.', $name));
 		} elseif (!method_exists($classname, 'send')) {
@@ -1685,9 +1685,9 @@ class Email {
 		}
 		$viewClass = $this->_viewRender;
 		if ($viewClass === 'View') {
-			$viewClass = App::classname('View', 'View');
+			$viewClass = App::className('View', 'View');
 		} else {
-			$viewClass = App::classname($viewClass, 'View', 'View');
+			$viewClass = App::className($viewClass, 'View', 'View');
 		}
 		$viewClass = 'Cake\View\View';
 

+ 1 - 1
src/ORM/BehaviorRegistry.php

@@ -77,7 +77,7 @@ class BehaviorRegistry extends ObjectRegistry {
  * @return string|false Either the correct classname or false.
  */
 	protected function _resolveClassName($class) {
-		return App::classname($class, 'Model/Behavior', 'Behavior');
+		return App::className($class, 'Model/Behavior', 'Behavior');
 	}
 
 /**

+ 1 - 1
src/ORM/Table.php

@@ -441,7 +441,7 @@ class Table implements RepositoryInterface, EventListener {
 		}
 
 		if ($name !== null) {
-			$class = App::classname($name, 'Model/Entity');
+			$class = App::className($name, 'Model/Entity');
 			$this->_entityClass = $class;
 		}
 

+ 1 - 1
src/ORM/TableRegistry.php

@@ -153,7 +153,7 @@ class TableRegistry {
 		if (empty($options['className'])) {
 			$options['className'] = Inflector::camelize($name);
 		}
-		$className = App::classname($options['className'], 'Model/Table', 'Table');
+		$className = App::className($options['className'], 'Model/Table', 'Table');
 		$options['className'] = $className ?: 'Cake\ORM\Table';
 
 		if (isset(static::$_config[$alias])) {

+ 2 - 2
src/Routing/Dispatcher.php

@@ -106,7 +106,7 @@ class Dispatcher implements EventListener {
 				$filter = array('callable' => $filter);
 			}
 			if (is_string($filter['callable'])) {
-				$callable = App::classname($filter['callable'], 'Routing/Filter');
+				$callable = App::className($filter['callable'], 'Routing/Filter');
 				if (!$callable) {
 					throw new Error\MissingDispatcherFilterException($filter['callable']);
 				}
@@ -271,7 +271,7 @@ class Dispatcher implements EventListener {
 			$namespace .= '/' . Inflector::camelize($request->params['prefix']);
 		}
 		if ($pluginPath . $controller) {
-			return App::classname($pluginPath . $controller, $namespace, 'Controller');
+			return App::className($pluginPath . $controller, $namespace, 'Controller');
 		}
 		return false;
 	}

+ 1 - 1
src/Routing/Router.php

@@ -340,7 +340,7 @@ class Router {
 		}
 		$routeClass = static::$_routeClass;
 		if (isset($options['routeClass'])) {
-			$routeClass = App::classname($options['routeClass'], 'Routing/Route');
+			$routeClass = App::className($options['routeClass'], 'Routing/Route');
 			$routeClass = static::_validateRouteClass($routeClass);
 			unset($options['routeClass']);
 		}

+ 2 - 2
src/TestSuite/ControllerTestCase.php

@@ -312,7 +312,7 @@ abstract class ControllerTestCase extends TestCase {
  * @throws \Cake\Controller\Error\MissingComponentException When components could not be created.
  */
 	public function generate($controller, array $mocks = array()) {
-		$classname = App::classname($controller, 'Controller', 'Controller');
+		$classname = App::className($controller, 'Controller', 'Controller');
 		if (!$classname) {
 			list($plugin, $controller) = pluginSplit($controller);
 			throw new MissingControllerException(array(
@@ -356,7 +356,7 @@ abstract class ControllerTestCase extends TestCase {
 			if ($methods === true) {
 				$methods = array();
 			}
-			$componentClass = App::classname($component, 'Controller/Component', 'Component');
+			$componentClass = App::className($component, 'Controller/Component', 'Component');
 			list(, $name) = pluginSplit($component, true);
 			if (!$componentClass) {
 				throw new MissingComponentException(array(

+ 1 - 1
src/TestSuite/TestCase.php

@@ -538,7 +538,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
 	public function getMockForModel($alias, array $methods = array(), array $options = array()) {
 		if (empty($options['className'])) {
 			$class = Inflector::camelize($alias);
-			$className = App::classname($class, 'Model/Table', 'Table');
+			$className = App::className($class, 'Model/Table', 'Table');
 			if (!$className) {
 				throw new \Cake\ORM\Error\MissingTableClassException(array($alias));
 			}

+ 1 - 1
src/Validation/Validation.php

@@ -852,7 +852,7 @@ class Validation {
  * @return mixed Return of Passed method, false on failure
  */
 	protected static function _pass($method, $check, $classPrefix) {
-		$className = App::classname($classPrefix, 'Validation', 'Validation');
+		$className = App::className($classPrefix, 'Validation', 'Validation');
 		if (!$className) {
 			trigger_error('Could not find class for validation, unable to complete validation.', E_USER_WARNING);
 			return false;

+ 1 - 1
src/View/CellTrait.php

@@ -64,7 +64,7 @@ trait CellTrait {
 
 		list($plugin, $cellName) = pluginSplit($pluginAndCell);
 
-		$className = App::classname($pluginAndCell, 'View/Cell', 'Cell');
+		$className = App::className($pluginAndCell, 'View/Cell', 'Cell');
 
 		if (!$className) {
 			throw new Error\MissingCellException(array('className' => $pluginAndCell . 'Cell'));

+ 1 - 1
src/View/Helper/NumberHelper.php

@@ -63,7 +63,7 @@ class NumberHelper extends Helper {
 
 		$config = $this->_config;
 
-		$engineClass = App::classname($config['engine'], 'Utility');
+		$engineClass = App::className($config['engine'], 'Utility');
 		if ($engineClass) {
 			$this->_engine = new $engineClass($config);
 		} else {

+ 1 - 1
src/View/Helper/TextHelper.php

@@ -78,7 +78,7 @@ class TextHelper extends Helper {
 		parent::__construct($View, $config);
 
 		$config = $this->_config;
-		$engineClass = App::classname($config['engine'], 'Utility');
+		$engineClass = App::className($config['engine'], 'Utility');
 		if ($engineClass) {
 			$this->_engine = new $engineClass($config);
 		} else {

+ 1 - 1
src/View/HelperRegistry.php

@@ -107,7 +107,7 @@ class HelperRegistry extends ObjectRegistry {
  * @return string|false Either the correct classname or false.
  */
 	protected function _resolveClassName($class) {
-		return App::classname($class, 'View/Helper', 'Helper');
+		return App::className($class, 'View/Helper', 'Helper');
 	}
 
 /**

+ 1 - 1
src/View/ViewVarsTrait.php

@@ -42,7 +42,7 @@ trait ViewVarsTrait {
 			$viewClass = $this->viewClass;
 			if ($this->viewClass !== 'View') {
 				list($plugin, $viewClass) = pluginSplit($viewClass, true);
-				$viewClass = App::classname($viewClass, 'View', 'View');
+				$viewClass = App::className($viewClass, 'View', 'View');
 			}
 		}
 		$viewOptions = array_intersect_key(get_object_vars($this), array_flip($this->_validViewOptions));

+ 1 - 1
src/View/Widget/WidgetRegistry.php

@@ -150,7 +150,7 @@ class WidgetRegistry {
 		}
 
 		$class = array_shift($widget);
-		$className = App::classname($class, 'View/Input');
+		$className = App::className($class, 'View/Input');
 		if ($className === false || !class_exists($className)) {
 			throw new \RuntimeException(sprintf('Unable to locate widget class "%s"', $class));
 		}