src/DI/Decorator/Immutable.php
protected function forward($callback, $method, $params = [])
    {
        if ($this->isLoaded()) {
            if (!$this->soft) {
                $oldInstance = clone $this->instance;
            }
            $return = $callback();
            if (!$this->soft && $oldInstance != $this->instance) {
                $this->instance = $oldInstance;
                $this->throwImmutableException();
            }
            return $return;
        } else {
            return parent::$method($params);
        }
    }
protected function forward($callback, $method, $params = [])
    {
        if ($this->isLoaded()) {
            if (!$this->soft) {
                $oldInstance = clone $this->instance;
            }
            $return = $callback();
            if (!$this->soft && $oldInstance != $this->instance) {
                $this->instance = $oldInstance;
                $this->throwImmutableException();
            }
            return $return;
        } else {
            return parent::$method($params);
        }
    }
protected function forward ( $ callback , $ method , $ params = [ ] ) { if ( $ this -> isLoaded ( ) ) { if ( ! $ this -> soft ) { $ oldInstance = clone $ this -> instance ; } $ return = $ callback ( ) ; if ( ! $ this -> soft && $ oldInstance != $ this -> instance ) { $ this -> instance = $ oldInstance ; $ this -> throwImmutableException ( ) ; } return $ return ; } else { return parent :: $ method ( $ params ) ; } }
If the object is loaded, call the callback, otherwise we call the parent method
@param $callback
@param $method
@param array $params
@return mixed
If the object is loaded call the callback otherwise we call the parent method