protected function getInstances($id, $interface)
    {
        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $this->instances[$id] = [];

        if (! $this->hasOption($id)) {
            return $this->instances[$id];
        } else {
            foreach ($this->getOption($id) as $instance) {
                if (is_a($instance, $interface, true)) {
                    $this->instances[$id][] = new $instance();
                }
            }
        }
        return $this->instances[$id];
    }
protected function getInstances($id, $interface)
    {
        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $this->instances[$id] = [];

        if (! $this->hasOption($id)) {
            return $this->instances[$id];
        } else {
            foreach ($this->getOption($id) as $instance) {
                if (is_a($instance, $interface, true)) {
                    $this->instances[$id][] = new $instance();
                }
            }
        }
        return $this->instances[$id];
    }
protected function getInstances ( $ id , $ interface ) { if ( isset ( $ this -> instances [ $ id ] ) ) { return $ this -> instances [ $ id ] ; } $ this -> instances [ $ id ] = [ ] ; if ( ! $ this -> hasOption ( $ id ) ) { return $ this -> instances [ $ id ] ; } else { foreach ( $ this -> getOption ( $ id ) as $ instance ) { if ( is_a ( $ instance , $ interface , true ) ) { $ this -> instances [ $ id ] [ ] = new $ instance ( ) ; } } } return $ this -> instances [ $ id ] ; }
Return config instances

Retrieve instances stored into config
Config $key is scan to take only instances with given $interface

@param $id
@param $interface
@return mixed
Return config instances