public function bind( $id, $value = null, $singleton = false ) {
		if ( is_string( $id ) && $this->is_singleton( $id ) ) {
			throw new Exception( sprintf( 'Identifier `%s` is a singleton and cannot be rebind', $id ) );
		}

		if ( is_object( $id ) && get_class( $id ) !== false ) {
			$value              = $id;
			$id                 = $this->get_class_prefix( get_class( $id ), false );
			$this->classes[$id] = true;
		}

		if ( $value instanceof Closure ) {
			$closure = $value;
		} else {
			$closure = $this->get_closure( $value, $singleton );
		}

		$this->values[$id] = compact( 'closure', 'singleton' );
		$this->keys[$id]   = true;

		return $value;
	}
public function bind( $id, $value = null, $singleton = false ) {
		if ( is_string( $id ) && $this->is_singleton( $id ) ) {
			throw new Exception( sprintf( 'Identifier `%s` is a singleton and cannot be rebind', $id ) );
		}

		if ( is_object( $id ) && get_class( $id ) !== false ) {
			$value              = $id;
			$id                 = $this->get_class_prefix( get_class( $id ), false );
			$this->classes[$id] = true;
		}

		if ( $value instanceof Closure ) {
			$closure = $value;
		} else {
			$closure = $this->get_closure( $value, $singleton );
		}

		$this->values[$id] = compact( 'closure', 'singleton' );
		$this->keys[$id]   = true;

		return $value;
	}
public function bind ( $ id , $ value = null , $ singleton = false ) { if ( is_string ( $ id ) && $ this -> is_singleton ( $ id ) ) { throw new Exception ( sprintf ( 'Identifier `%s` is a singleton and cannot be rebind' , $ id ) ) ; } if ( is_object ( $ id ) && get_class ( $ id ) !== false ) { $ value = $ id ; $ id = $ this -> get_class_prefix ( get_class ( $ id ) , false ) ; $ this -> classes [ $ id ] = true ; } if ( $ value instanceof Closure ) { $ closure = $ value ; } else { $ closure = $ this -> get_closure ( $ value , $ singleton ) ; } $ this -> values [ $ id ] = compact ( 'closure' , 'singleton' ) ; $ this -> keys [ $ id ] = true ; return $ value ; }
Set a parameter or an object.

@param string $id
@param mixed  $value
@param bool   $singleton

@throws Exception when singleton cannot be rebind.

@return mixed
Set a parameter or an object .