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_Closure

A binder object for binding an interface to a closure.

An interface may be bound to a closure. That closure must accept a Horde_Injector and return an object that satisfies the instance requirement. For example:

$injector->bindClosure('database', function($injector) { return new my_mysql(); });
Horde_Injector_Binder_Closure implements Horde_Injector_Binder
Package: Injector
Category: Horde
Author: Bob Mckee bmckee@bywires.com
Author: James Pepin james@jamespepin.com
Author: Chuck Hagenbuch chuck@horde.org
Located at Horde/Injector/Binder/Closure.php
Methods summary
public
# __construct( string $closure )

Create a new Horde_Injector_Binder_Closure instance.

Create a new Horde_Injector_Binder_Closure instance.

Parameters

$closure
The closure to use for creating objects.
public boolean
# equals( Horde_Injector_Binder $otherBinder )

TODO

TODO

Parameters

$otherBinder
TODO

Returns

boolean
Equality.

Implementation of

Horde_Injector_Binder::equals()
public callable
# getClosure( )

Get the closure that this binder was bound to.

Get the closure that this binder was bound to.

Returns

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

Create instance using a closure

Create instance using a closure

If the closure depends on a Horde_Injector we want to limit its scope so it cannot change anything that effects any higher-level scope. A closure 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 closure 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