PHP 클래스 Horde_Injector_Binder_Factory, horde

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));
  }
  ...
}
저자: Bob Mckee ([email protected])
저자: James Pepin ([email protected])
상속: implements Horde_Injector_Binder
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $factory, string $method ) Create a new Horde_Injector_Binder_Factory instance.
create ( Horde_Injector $injector ) : Horde_Injector Create instance using a factory method
equals ( Horde_Injector_Binder $otherBinder ) : boolean
getFactory ( ) : string Get the factory classname that this binder was bound to.
getMethod ( ) : string Get the method that this binder was bound to.

메소드 상세

__construct() 공개 메소드

Create a new Horde_Injector_Binder_Factory instance.
public __construct ( string $factory, string $method )
$factory string The factory class to use for creating objects.
$method string The method on that factory to use for creating objects.

create() 공개 메소드

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.
public create ( Horde_Injector $injector ) : Horde_Injector
$injector Horde_Injector Injector object.
리턴 Horde_Injector

equals() 공개 메소드

public equals ( Horde_Injector_Binder $otherBinder ) : boolean
$otherBinder Horde_Injector_Binder
리턴 boolean Equality.

getFactory() 공개 메소드

Get the factory classname that this binder was bound to.
public getFactory ( ) : string
리턴 string The factory classname this binder is bound to.

getMethod() 공개 메소드

Get the method that this binder was bound to.
public getMethod ( ) : string
리턴 string The method this binder is bound to.