Changeset 828

Show
Ignore:
Timestamp:
08/14/07 21:25:20 (1 year ago)
Author:
schst
Message:

Added support for toInstance()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ioc/injection/stubBinding.php

    r825 r828  
    5656 
    5757    /** 
     58     * Instance this type is bound to 
     59     * 
     60     * @var object 
     61     */ 
     62    protected $instance = null; 
     63 
     64    /** 
    5865     * Create a new binding 
    5966     * 
     
    8895 
    8996    /** 
     97     * Set the concrete instance 
     98     * 
     99     * @param object $impl 
     100     * @return stubBinding 
     101     */ 
     102    public function toInstance($instance) { 
     103        $this->instance = $instance; 
     104        return $this; 
     105    } 
     106 
     107    /** 
    90108     * Set the scope 
    91109     * 
     
    115133     */ 
    116134    public function getInstance() { 
     135        if ($this->instance != null) { 
     136            return $this->instance; 
     137        } 
     138 
    117139        if (is_string($this->impl)) { 
    118140            $this->impl = new stubReflectionClass($this->impl);