public function retrieve(string $id)
    {
        $data = $this->retrieveAll();

        if (!array_key_exists($id, $data)) {
            throw new \RuntimeException(sprintf('Unable to load object of type "%s" with ID "%s"', $this->className, $id));
        }

        $object = $data[$id];

        Assertion::isInstanceOf($object, $this->className);

        return $object;
    }
public function retrieve(string $id)
    {
        $data = $this->retrieveAll();

        if (!array_key_exists($id, $data)) {
            throw new \RuntimeException(sprintf('Unable to load object of type "%s" with ID "%s"', $this->className, $id));
        }

        $object = $data[$id];

        Assertion::isInstanceOf($object, $this->className);

        return $object;
    }
public function retrieve ( string $ id ) { $ data = $ this -> retrieveAll ( ) ; if ( ! array_key_exists ( $ id , $ data ) ) { throw new \ RuntimeException ( sprintf ( 'Unable to load object of type "%s" with ID "%s"' , $ this -> className , $ id ) ) ; } $ object = $ data [ $ id ] ; Assertion :: isInstanceOf ( $ object , $ this -> className ) ; return $ object ; }
Provide an id and you will retrieve the unserialized version of a previously persisted object.

@param string $id
@return object An object of type $this->className
Provide an id and you will retrieve the unserialized version of a previously persisted object .