Overview

Packages

  • Injector

Classes

  • Horde_Injector
  • Horde_Injector_Binder_AnnotatedSetters
  • Horde_Injector_Binder_Closure
  • Horde_Injector_Binder_Factory
  • Horde_Injector_Binder_Implementation
  • Horde_Injector_DependencyFinder
  • Horde_Injector_Exception
  • Horde_Injector_TopLevel

Interfaces

  • Horde_Injector_Binder
  • Horde_Injector_Scope
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Injector_Binder_Factory

A binder object for binding an interface to a factory class and method.

An interface may be bound to a factory class. That factory class must provide a method or methods that accept a Horde_Injector, and return an object that satisfies the instance requirement. For example:

class MyFactory {
  ...
  public function create(Horde_Injector $injector)
  {
    return new MyClass($injector->getInstance('Collaborator'), new MyOtherClass(17));
  }
  ...
}
Horde_Injector_Binder_Factory implements Horde_Injector_Binder
Package: Injector
Category: Horde
Author: Bob Mckee bmckee@bywires.com
Author: James Pepin james@jamespepin.com
Located at Horde/Injector/Binder/Factory.php
Methods summary
public
# __construct( string $factory, string $method )

Create a new Horde_Injector_Binder_Factory instance.

Create a new Horde_Injector_Binder_Factory instance.

Parameters

$factory
The factory class to use for creating objects.
$method
<p>The method on that factory to use for creating objects.</p>
public boolean
# equals( Horde_Injector_Binder $otherBinder )

TODO

TODO

Parameters

$otherBinder
TODO

Returns

boolean
Equality.

Implementation of

Horde_Injector_Binder::equals()
public string
# getFactory( )

Get the factory classname that this binder was bound to.

Get the factory classname that this binder was bound to.

Returns

string
The factory classname this binder is bound to.
public string
# getMethod( )

Get the method that this binder was bound to.

Get the method that this binder was bound to.

Returns

string
The method this binder is bound to.
public TODO
# create( Horde_Injector $injector )

Create instance using a factory method

Create instance using a factory method

If the factory depends on a Horde_Injector we want to limit its scope so it cannot change anything that effects any higher-level scope. A factory should not have the responsibility of making a higher-level scope change. To enforce this we create a new child Horde_Injector. When a Horde_Injector is requested from a Horde_Injector it will return itself. This means that the factory will only ever be able to work on the child Horde_Injector we give it now.

Parameters

$injector
Injector object.

Returns

TODO

Implementation of

Horde_Injector_Binder::create()
API documentation generated by ApiGen