src/ObjectManager.php
public function getObjects($state = null)
    {
        if (!isset($state)) {
            return $this->objects;
        }

        $objectList = [];
        foreach ($this->objects as $id => $object) {
            if ($this->objectStates[$id] == $state) {
                $objectList[$id] = $object;
            }
        }

        return $objectList;
    }
public function getObjects($state = null)
    {
        if (!isset($state)) {
            return $this->objects;
        }

        $objectList = [];
        foreach ($this->objects as $id => $object) {
            if ($this->objectStates[$id] == $state) {
                $objectList[$id] = $object;
            }
        }

        return $objectList;
    }
public function getObjects ( $ state = null ) { if ( ! isset ( $ state ) ) { return $ this -> objects ; } $ objectList = [ ] ; foreach ( $ this -> objects as $ id => $ object ) { if ( $ this -> objectStates [ $ id ] == $ state ) { $ objectList [ $ id ] = $ object ; } } return $ objectList ; }
Get object with specified state

@param   int     $state  State to search
@return  array
Get object with specified state