public function get($key)
    {
        if ($this->has($key)) {
            $flashMessages = $this->storage->get(self::FLASH_KEY);
            $message = $flashMessages[$key];

            $this->remove($key);

            if ($this->translator instanceof TranslatorInterface) {
                $message = $this->translator->translate($message);
            }

            return $message;
        } else {
            throw new RuntimeException(sprintf(
                'Attempted to read non-existing key %s', $key
            ));
        }
    }
public function get($key)
    {
        if ($this->has($key)) {
            $flashMessages = $this->storage->get(self::FLASH_KEY);
            $message = $flashMessages[$key];

            $this->remove($key);

            if ($this->translator instanceof TranslatorInterface) {
                $message = $this->translator->translate($message);
            }

            return $message;
        } else {
            throw new RuntimeException(sprintf(
                'Attempted to read non-existing key %s', $key
            ));
        }
    }
public function get ( $ key ) { if ( $ this -> has ( $ key ) ) { $ flashMessages = $ this -> storage -> get ( self :: FLASH_KEY ) ; $ message = $ flashMessages [ $ key ] ; $ this -> remove ( $ key ) ; if ( $ this -> translator instanceof TranslatorInterface ) { $ message = $ this -> translator -> translate ( $ message ) ; } return $ message ; } else { throw new RuntimeException ( sprintf ( 'Attempted to read non-existing key %s' , $ key ) ) ; } }
Returns a message associated with a given key

@param string $key
@throws \RuntimeException If attempted to read non-existing key
@return string
Returns a message associated with a given key