public function getFormattedImage($format)
    {
        $formatName = $format instanceof FormatInterface
            ? $format->getName()
            : $format
        ;

        return $this->formattedImages
            ->filter(function (FormattedImageInterface $formattedImage) use ($formatName) {
                return ($format = $formattedImage->getFormat())
                    && $format->getName() == $formatName
                ;
            })
            ->first() ?: null // first() returns "false" if collection empty
        ;
    }
public function getFormattedImage($format)
    {
        $formatName = $format instanceof FormatInterface
            ? $format->getName()
            : $format
        ;

        return $this->formattedImages
            ->filter(function (FormattedImageInterface $formattedImage) use ($formatName) {
                return ($format = $formattedImage->getFormat())
                    && $format->getName() == $formatName
                ;
            })
            ->first() ?: null // first() returns "false" if collection empty
        ;
    }
public function getFormattedImage ( $ format ) { $ formatName = $ format instanceof FormatInterface ? $ format -> getName ( ) : $ format ; return $ this -> formattedImages -> filter ( function ( FormattedImageInterface $ formattedImage ) use ( $ formatName ) { return ( $ format = $ formattedImage -> getFormat ( ) ) && $ format -> getName ( ) == $ formatName ; } ) -> first ( ) ? : null // first() returns "false" if collection empty ; }
Returns image formatted for given format name or FormatInterface object.

@param string|FormatInterface $format

@return FormattedImageInterface|null
Returns image formatted for given format name or FormatInterface object .