public function getServiceInstanceByType($type)
    {
        $services = [];
        $instances  = $this->getServiceInstances();

        foreach ($this->getServiceNamesByType($type) as $name) {
            if (!isset($instances[$name]['instance'])) {
                continue;
            }
            $services[] = $instances[$name]['instance'];
        }

        return $services;
    }
public function getServiceInstanceByType($type)
    {
        $services = [];
        $instances  = $this->getServiceInstances();

        foreach ($this->getServiceNamesByType($type) as $name) {
            if (!isset($instances[$name]['instance'])) {
                continue;
            }
            $services[] = $instances[$name]['instance'];
        }

        return $services;
    }
public function getServiceInstanceByType ( $ type ) { $ services = [ ] ; $ instances = $ this -> getServiceInstances ( ) ; foreach ( $ this -> getServiceNamesByType ( $ type ) as $ name ) { if ( ! isset ( $ instances [ $ name ] [ 'instance' ] ) ) { continue ; } $ services [ ] = $ instances [ $ name ] [ 'instance' ] ; } return $ services ; }
Get multiple service instance by type.

@param $type
The service instance type.

@return array
Get multiple service instance by type .