AbstractFactoryFoo.php 558 B

12345678910111213141516171819202122
  1. <?php
  2. namespace ZendBench\ServiceManager\BenchAsset;
  3. use Zend\ServiceManager\AbstractFactoryInterface;
  4. use Zend\ServiceManager\ServiceLocatorInterface;
  5. class AbstractFactoryFoo implements AbstractFactoryInterface
  6. {
  7. public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
  8. {
  9. if ($name != 'foo') {
  10. return false;
  11. }
  12. return true;
  13. }
  14. public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
  15. {
  16. return new Foo();
  17. }
  18. }