Skip to content
Permalink
Browse files

Rename variable/class references to collection classes.

Replace many collection based references with the real class changes.
  • Loading branch information...
markstory committed Jul 24, 2013
1 parent 84c627f commit 11658f4645e5adab9e2194adb97863bb96b2cfa6
Showing with 152 additions and 143 deletions.
  1. +3 −3 lib/Cake/Console/Command/AclShell.php
  2. +3 −3 lib/Cake/Console/Command/Task/TestTask.php
  3. +10 −0 lib/Cake/Console/Command/UpgradeShell.php
  4. +2 −2 lib/Cake/Console/Shell.php
  5. +2 −2 lib/Cake/Console/TaskCollection.php
  6. +7 −7 lib/Cake/Controller/Component.php
  7. +3 −3 lib/Cake/Controller/Component/AclComponent.php
  8. +2 −3 lib/Cake/Controller/Component/Auth/ActionsAuthorize.php
  9. +7 −7 lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
  10. +8 −8 lib/Cake/Controller/Component/Auth/BaseAuthorize.php
  11. +4 −4 lib/Cake/Controller/Component/Auth/BasicAuthenticate.php
  12. +4 −4 lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php
  13. +1 −1 lib/Cake/Controller/Component/Auth/ControllerAuthorize.php
  14. +5 −5 lib/Cake/Controller/Component/Auth/CrudAuthorize.php
  15. +4 −4 lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
  16. +1 −1 lib/Cake/Controller/Component/Auth/FormAuthenticate.php
  17. +3 −3 lib/Cake/Controller/Component/AuthComponent.php
  18. +3 −3 lib/Cake/Controller/Component/CookieComponent.php
  19. +3 −3 lib/Cake/Controller/Component/PaginatorComponent.php
  20. +3 −3 lib/Cake/Controller/Component/RequestHandlerComponent.php
  21. +1 −1 lib/Cake/Controller/Component/SecurityComponent.php
  22. +2 −2 lib/Cake/Controller/ComponentCollection.php
  23. +3 −3 lib/Cake/Controller/Controller.php
  24. +2 −2 lib/Cake/Test/TestCase/Console/Command/AclShellTest.php
  25. +3 −3 lib/Cake/Test/TestCase/Console/Command/Task/TestTaskTest.php
  26. +5 −5 lib/Cake/Test/TestCase/Console/TaskCollectionTest.php
  27. +2 −2 lib/Cake/Test/TestCase/Controller/Component/Acl/DbAclTest.php
  28. +2 −2 lib/Cake/Test/TestCase/Controller/Component/Acl/PhpAclTest.php
  29. +3 −3 lib/Cake/Test/TestCase/Controller/Component/AclComponentTest.php
  30. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/ActionsAuthorizeTest.php
  31. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/BasicAuthenticateTest.php
  32. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/BlowfishAuthenticateTest.php
  33. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/ControllerAuthorizeTest.php
  34. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/CrudAuthorizeTest.php
  35. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/DigestAuthenticateTest.php
  36. +1 −1 lib/Cake/Test/TestCase/Controller/Component/Auth/FormAuthenticateTest.php
  37. +2 −2 lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php
  38. +2 −2 lib/Cake/Test/TestCase/Controller/Component/CookieComponentTest.php
  39. +1 −1 lib/Cake/Test/TestCase/Controller/Component/PaginatorComponentTest.php
  40. +2 −2 lib/Cake/Test/TestCase/Controller/Component/RequestHandlerComponentTest.php
  41. +13 −13 lib/Cake/Test/TestCase/Controller/Component/SessionComponentTest.php
  42. +3 −3 lib/Cake/Test/TestCase/Controller/ComponentCollectionTest.php
  43. +5 −5 lib/Cake/Test/TestCase/Controller/ComponentTest.php
  44. +1 −1 lib/Cake/Test/TestCase/Utility/DebuggerTest.php
  45. +5 −5 lib/Cake/Test/TestCase/View/HelperCollectionTest.php
  46. +1 −1 lib/Cake/Test/TestCase/View/XmlViewTest.php
  47. +3 −3 lib/Cake/Utility/ObjectRegistry.php
  48. +1 −1 lib/Cake/View/HelperCollection.php
  49. +5 −5 lib/Cake/View/View.php
@@ -19,7 +19,7 @@
namespace Cake\Console\Command;
use Cake\Console\Shell;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Component\AclComponent;
use Cake\Controller\Controller;
use Cake\Core\App;
@@ -97,8 +97,8 @@ public function startup() {
}
if (!in_array($this->command, array('initdb'))) {
$collection = new ComponentCollection();
$this->Acl = new AclComponent($collection);
$registry = new ComponentRegistry();
$this->Acl = new AclComponent($registry);
$controller = new Controller();
$this->Acl->startup($controller);
}
@@ -522,8 +522,8 @@ public function generateConstructor($type, $fullClassName, $plugin) {
$construct = "new {$className}(\$View);\n";
}
if ($type === 'component') {
$pre = "\$Collection = new ComponentCollection();\n";
$construct = "new {$className}(\$Collection);\n";
$pre = "\$registry = new ComponentRegistry();\n";
$construct = "new {$className}(\$registry);\n";
}
return array($pre, $construct, $post);
}
@@ -540,7 +540,7 @@ public function generateUses($type, $realType, $fullClassName) {
$uses = array();
$type = strtolower($type);
if ($type == 'component') {
$uses[] = 'Cake\Controller\ComponentCollection';
$uses[] = 'Cake\Controller\ComponentRegistry';
}
if ($type == 'helper') {
$uses[] = 'Cake\View\View';
@@ -422,6 +422,16 @@ public function rename_collections() {
$this->_findFiles('php');
foreach ($this->_files as $filePath) {
$patterns = [
[
' Replace $this->_Collection with $this->_registry',
'#\$this->_Collection#',
'$this->_registry',
],
[
' Replace ComponentCollection arguments',
'#ComponentCollection\s+\$collection#',
'ComponentRegistry $registry',
],
[
' Rename ComponentCollection',
'#ComponentCollection#',
@@ -138,7 +138,7 @@ class Shell extends Object {
/**
* Task Collection for the command, used to create Tasks.
*
* @var TaskCollection
* @var TaskRegistry
*/
public $Tasks;
@@ -183,7 +183,7 @@ public function __construct($stdout = null, $stderr = null, $stdin = null) {
list(, $class) = namespaceSplit(get_class($this));
$this->name = str_replace(array('Shell', 'Task'), '', $class);
}
$this->Tasks = new TaskCollection($this);
$this->Tasks = new TaskRegistry($this);
$this->stdout = $stdout ? $stdout : new ConsoleOutput('php://stdout');
$this->stderr = $stderr ? $stderr : new ConsoleOutput('php://stderr');
@@ -19,10 +19,10 @@
use Cake\Utility\ObjectRegistry;
/**
* Collection object for Tasks. Provides features
* Registry for Tasks. Provides features
* for lazily loading tasks.
*/
class TaskCollection extends ObjectRegistry {
class TaskRegistry extends ObjectRegistry {
/**
* Shell to use to set params to tasks.
@@ -65,11 +65,11 @@
class Component extends Object implements EventListener {
/**
* Component collection class used to lazy load components.
* Component registry class used to lazy load components.
*
* @var ComponentCollection
* @var ComponentRegistry
*/
protected $_Collection;
protected $_registry;
/**
* Settings for this Component
@@ -95,11 +95,11 @@ class Component extends Object implements EventListener {
/**
* Constructor
*
* @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components
* @param ComponentRegistry $registry A ComponentRegistry this component can use to lazy load its components
* @param array $settings Array of configuration settings.
*/
public function __construct(ComponentCollection $collection, $settings = array()) {
$this->_Collection = $collection;
public function __construct(ComponentRegistry $registry, $settings = []) {
$this->_registry = $registry;
$this->settings = $settings;
$this->_set($settings);
if (!empty($this->components)) {
@@ -116,7 +116,7 @@ public function __construct(ComponentCollection $collection, $settings = array()
public function __get($name) {
if (isset($this->_componentMap[$name]) && !isset($this->{$name})) {
$settings = array_merge((array)$this->_componentMap[$name]['settings'], array('enabled' => false));
$this->{$name} = $this->_Collection->load($this->_componentMap[$name]['class'], $settings);
$this->{$name} = $this->_registry->load($this->_componentMap[$name]['class'], $settings);
}
if (isset($this->{$name})) {
return $this->{$name};
@@ -16,7 +16,7 @@
use Cake\Configure\IniReader;
use Cake\Controller\Component;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Component\Acl\AclInterface;
use Cake\Core\App;
use Cake\Core\Configure;
@@ -61,11 +61,11 @@ class AclComponent extends Component {
/**
* Constructor. Will return an instance of the correct ACL class as defined in `Configure::read('Acl.classname')`
*
* @param ComponentCollection $collection
* @param ComponentRegistry $collection
* @param array $settings
* @throws Cake\Error\Exception when Acl.classname could not be loaded.
*/
public function __construct(ComponentCollection $collection, $settings = array()) {
public function __construct(ComponentRegistry $collection, $settings = array()) {
parent::__construct($collection, $settings);
$classname = $name = Configure::read('Acl.classname');
if (!class_exists($classname)) {
@@ -19,9 +19,8 @@
/**
* An authorization adapter for AuthComponent. Provides the ability to authorize using the AclComponent,
* If AclComponent is not already loaded it will be loaded using the Controller's ComponentCollection.
* If AclComponent is not already loaded it will be loaded using the Controller's ComponentRegistry.
*
* @package Cake.Controller.Component.Auth
* @since 2.0
* @see AuthComponent::$authenticate
* @see AclComponent::check()
@@ -36,7 +35,7 @@ class ActionsAuthorize extends BaseAuthorize {
* @return boolean
*/
public function authorize($user, Request $request) {
$Acl = $this->_Collection->load('Acl');
$Acl = $this->_registry->load('Acl');
$user = array($this->settings['userModel'] => $user);
return $Acl->check($user, $this->action($request));
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Error;
use Cake\Network\Request;
use Cake\Network\Response;
@@ -58,11 +58,11 @@ abstract class BaseAuthenticate {
);
/**
* A Component collection, used to get more components.
* A Component registry, used to get more components.
*
* @var ComponentCollection
* @var ComponentRegistry
*/
protected $_Collection;
protected $_registry;
/**
* Password hasher instance.
@@ -74,11 +74,11 @@ abstract class BaseAuthenticate {
/**
* Constructor
*
* @param ComponentCollection $collection The Component collection used on this request.
* @param ComponentRegistry $registry The Component registry used on this request.
* @param array $settings Array of settings to use.
*/
public function __construct(ComponentCollection $collection, $settings) {
$this->_Collection = $collection;
public function __construct(ComponentRegistry $registry, $settings) {
$this->_registry = $registry;
$this->settings = Hash::merge($this->settings, $settings);
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Error;
use Cake\Network\Request;
@@ -40,11 +40,11 @@ abstract class BaseAuthorize {
protected $_Controller = null;
/**
* Component collection instance for getting more components.
* ComponentRegistry instance for getting more components.
*
* @var ComponentCollection
* @var ComponentRegistry
*/
protected $_Collection;
protected $_registry;
/**
* Settings for authorize objects.
@@ -72,12 +72,12 @@ abstract class BaseAuthorize {
/**
* Constructor
*
* @param ComponentCollection $collection The controller for this request.
* @param ComponentRegistry $registry The controller for this request.
* @param string $settings An array of settings. This class does not use any settings.
*/
public function __construct(ComponentCollection $collection, $settings = array()) {
$this->_Collection = $collection;
$controller = $collection->getController();
public function __construct(ComponentRegistry $registry, $settings = array()) {
$this->_registry = $registry;
$controller = $registry->getController();
$this->controller($controller);
$this->settings = Hash::merge($this->settings, $settings);
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Error;
use Cake\Network\Request;
use Cake\Network\Response;
@@ -50,11 +50,11 @@ class BasicAuthenticate extends BaseAuthenticate {
/**
* Constructor, completes configuration for basic authentication.
*
* @param ComponentCollection $collection The Component collection used on this request.
* @param ComponentRegistry $registry The Component registry used on this request.
* @param array $settings An array of settings.
*/
public function __construct(ComponentCollection $collection, $settings) {
parent::__construct($collection, $settings);
public function __construct(ComponentRegistry $registry, $settings) {
parent::__construct($registry, $settings);
if (empty($this->settings['realm'])) {
$this->settings['realm'] = env('SERVER_NAME');
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Utility\Security;
@@ -48,12 +48,12 @@ class BlowfishAuthenticate extends FormAuthenticate {
/**
* Constructor. Sets default passwordHasher to Blowfish
*
* @param ComponentCollection $collection The Component collection used on this request.
* @param ComponentRegistry $registry The Component registry used on this request.
* @param array $settings Array of settings to use.
*/
public function __construct(ComponentCollection $collection, $settings) {
public function __construct(ComponentRegistry $registry, $settings) {
$this->settings['passwordHasher'] = 'Blowfish';
parent::__construct($collection, $settings);
parent::__construct($registry, $settings);
}
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Error;
use Cake\Network\Request;
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Network\Request;
use Cake\Routing\Router;
@@ -39,11 +39,11 @@ class CrudAuthorize extends BaseAuthorize {
/**
* Sets up additional actionMap values that match the configured `Routing.prefixes`.
*
* @param ComponentCollection $collection The component collection from the controller.
* @param ComponentRegistry $registry The component registry from the controller.
* @param string $settings An array of settings. This class does not use any settings.
*/
public function __construct(ComponentCollection $collection, $settings = array()) {
parent::__construct($collection, $settings);
public function __construct(ComponentRegistry $registry, $settings = array()) {
parent::__construct($registry, $settings);
$this->_setPrefixMappings();
}
@@ -94,7 +94,7 @@ public function authorize($user, Request $request) {
return false;
}
$user = array($this->settings['userModel'] => $user);
$Acl = $this->_Collection->load('Acl');
$Acl = $this->_registry->load('Acl');
return $Acl->check(
$user,
$this->action($request, ':controller'),
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Component\Auth\BasicAuthenticate;
use Cake\Network\Request;
use Cake\Network\Response;
@@ -98,11 +98,11 @@ class DigestAuthenticate extends BasicAuthenticate {
/**
* Constructor, completes configuration for digest authentication.
*
* @param ComponentCollection $collection The Component collection used on this request.
* @param ComponentRegistry $registry The Component registry used on this request.
* @param array $settings An array of settings.
*/
public function __construct(ComponentCollection $collection, $settings) {
parent::__construct($collection, $settings);
public function __construct(ComponentRegistry $registry, $settings) {
parent::__construct($registry, $settings);
if (empty($this->settings['nonce'])) {
$this->settings['nonce'] = uniqid('');
}
@@ -15,7 +15,7 @@
*/
namespace Cake\Controller\Component\Auth;
use Cake\Controller\ComponentCollection;
use Cake\Controller\ComponentRegistry;
use Cake\Network\Request;
use Cake\Network\Response;
Oops, something went wrong.

0 comments on commit 11658f4

Please sign in to comment.
You can’t perform that action at this time.