Set formats for a given types.

@param $formats
@return \Krucas\Notification\NotificationsBag
776327
public function setFormats($formats)
    {
        foreach ($formats as $type => $format) {
            $this->setFormat($type, $format);
        }

        return $this;
    }
1344272
public function setFormats($formats)
    {
        $this->formats = Type::forceAndReturn($formats, ArrayAccess::class);
        $this->formatCache = [];
        return $this;
    }
93774
public function setFormat($format)
    {
        if (!in_array($format, self::$supportedFormats)) {
            throw new BuildException(
                sprintf(
                    'Invalid output format "%s", allowed are: %s',
                    $format,
                    implode(', ', self::$supportedFormats)
                )
            );
        }
        $this->format = $format;
    }
665950
public function addFormatters(FormatterInterface ...$formatters): self
    {
        foreach ($formatters as $formatter) {
            foreach ($formatter->contentTypes() as $contentType) {
                $this->formatters[$contentType] = $formatter;
            }
        }

        return $this;
    }
41238
public function addFormat($format, $mime_types)
    {
        static::$_formats[$format] = is_array($mime_types) ? $mime_types : array($mime_types);
        return $this;
    }
1185995
public function setFormat(FormatInterface $format)
    {
        $this->formatId = $format->getName();

        return parent::setFormat($format);
    }
1115802
public function format($format)
    {
        switch ($format) {
            case 'png':
                $this->writer->setRenderer(new Png());
                break;
            case 'eps':
                $this->writer->setRenderer(new Eps());
                break;
            case 'svg':
                $this->writer->setRenderer(new Svg());
                break;
            default:
                throw new \InvalidArgumentException('Invalid format provided.');
        }

        return $this;
    }
1322307
public function setFormat($format)
    {
        if (!is_null($format)) {
            $this->format = $format;
            $this->useFormat(false);
        }

        return $this;
    }
721492
public static function registerFormat( $format )
    {
        $object = new $format();
        if(!($object instanceof FormatInterface)) {
            return false;
        }

        foreach ( forward_static_call(array($format, 'getFormats')) as $type ) {
            array_push(self::$supported, $type);
            self::$formatMap[$type] = $format;
        }

        return true;
    }
1110673
public function setFormat($name, FormatInterface $format)
    {
        // If name is int or null, get name from Format object.
        $name = (is_numeric($name) || !$name) ? $format->getName() : $name;

        $this->formats[$name] = $format;

        return $this;
    }
1099597
public function setFormat($format)
    {
        $this->format = (string) $format;

        foreach ($this->items as $time) {

            $time->setFormat($format);
        }

        return $this;
    }
1293996
public function format($format = true)
    {
        if (!is_bool($format)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be boolean, %s given', __METHOD__, gettype($format)));
        }

        $this->document->formatOutput = $format;

        return $this;
    }
632319
public function setFormat($format)
    {
        if (in_array($format, TextFormat::asArray()) === true) {
            $this->format = $format;
        } else {
            $msg = "The 'format' argument must be a value from the TextFormat enumeration, '" . gettype($format) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
299595
public function setFormat($format) {
        if ($format === null) {
            $format = [];
        } else if ( ! is_array($format)) {
            $format = [$format];
        }

        $this->format = $format;

        return $this;
    }
311726
public function setEmailFormat($format)
    {
        if (!in_array($format, $this->_emailFormatAvailable)) {
            throw new InvalidArgumentException('Format not available.');
        }
        $this->_emailFormat = $format;

        return $this;
    }
1032891
public function setFormat($format)
    {
        $this->request->setFormat($format);
        $this->baseRenderingContext->getTemplatePaths()->setFormat($format);
    }
525208
public function setFormat($format)
    {
        switch ($format) {
            case self::FORMAT_BASE32:
                $this->encoder = new Base32Encoder();
                break;
            case self::FORMAT_HEX:
                $this->encoder = new HexEncoder();
                break;
            case self::FORMAT_RAW:
            default:
                $this->encoder = new RawEncoder();
        }

        return $this;
    }