Move Identity closure to separate factory #4155

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

maxnuf commented Mar 31, 2013

  • Move Identity Controller Plugin to factory
  • Move Identity View Helper to factory
Move Identity closure to separate factory
*   Move Identity Controller Plugin to factory
*   Move Identity View Helper to factory
+ * @var array
+ */
+ protected $factories = array(
+ 'identity' => 'Zend\Mvc\Controller\Plugin\Service\IdentityFactory',
@iquabius

iquabius Mar 31, 2013

Contributor

You can leave just one space here, just align when in the same array.

@@ -65,17 +74,6 @@ class PluginManager extends AbstractPluginManager
public function __construct(ConfigInterface $configuration = null)
{
parent::__construct($configuration);
-
@iquabius

iquabius Mar 31, 2013

Contributor

I'm not sure but I think you can remove the entire __contruct() method here, since it is just calling the parent constructor. Can someone confirm this is right?

@maxnuf

maxnuf Mar 31, 2013

Contributor

I wasn't sure either, but I removed it now

+ if (!$services->has('Zend\Authentication\AuthenticationService')) {
+ return $helper;
+ }
+ $helper->setAuthenticationService($services->get('Zend\Authentication\AuthenticationService'));
@Ocramius

Ocramius Mar 31, 2013

Member

You can simplify it

if ($services->has('Zend\Authentication\AuthenticationService')) {
    $helper->setAuthenticationService($services->get('Zend\Authentication\AuthenticationService'));
}
+ if (!$services->has('Zend\Authentication\AuthenticationService')) {
+ return $helper;
+ }
+ $helper->setAuthenticationService($services->get('Zend\Authentication\AuthenticationService'));
@Ocramius

Ocramius Mar 31, 2013

Member

You can simplify it

if ($services->has('Zend\Authentication\AuthenticationService')) {
    $helper->setAuthenticationService($services->get('Zend\Authentication\AuthenticationService'));
}
+
+class IdentityFactory implements FactoryInterface
+{
+ public function createService(ServiceLocatorInterface $serviceLocator)
@Ocramius

Ocramius Mar 31, 2013

Member

Missing docblock with {@inheritDoc} and proper return type

+
+class IdentityFactory implements FactoryInterface
+{
+ public function createService(ServiceLocatorInterface $serviceLocator)
@Ocramius

Ocramius Mar 31, 2013

Member

Missing docblock with {@inheritDoc} and proper return type

@ghost ghost assigned weierophinney Apr 12, 2013

weierophinney added a commit that referenced this pull request Apr 12, 2013

Merge pull request #4155 from maxnuf/feature/refactor-identity-helper
Move Identity closure to separate factory

weierophinney added a commit that referenced this pull request Apr 12, 2013

Owner

weierophinney commented Apr 12, 2013

Since this introduces a new class (the factory), I've merged it against develop for release with 2.2.0.

Thanks -- this will make it far easier to override what service is used for the helper/plugin!

weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015

Merge pull request zendframework/zendframework#4155 from maxnuf/featu…
…re/refactor-identity-helper

Move Identity closure to separate factory

weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment