Returns the document as a string

@param  string  $format  the desired format (optional; if omitted, defaults
to 'rtf')
@return  string
@throws  InvalidArgumentException  if $format is not a string
@since  0.1.0
168711
public function write($format = 'rtf')
	{
		$string = '';
		
		// if $format is a string
		if (is_string($format)) {
			$writer = new Writer();
			$string = $writer->write($this->root, $format);	
		} else {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, format, to be a string"
			);
		}
		
		return $string;
	}
453079
public function serialize($data, $format = 'json')
    {
        $jsonContent = $this->getJmsSerializer()->serialize($data, $format);

        return $jsonContent;
    }
814168
public function toString($format = null)
    {
        if ($format) {
            $this->dom->formatOutput = true;
        }
        return $this->dom->saveXML();
    }
1292748
public function getParser(FormatInterface $format)
    {
        switch ($format->getType()) {
            case 'csv':
                if ($format instanceof CsvFormatInterface) {
                    return new CsvParser($format);
                } else {
                    throw new InvalidArgumentException(
                        "Format indicates it is csv but does not implement CsvFormatInterface"
                    );
                }

            // fallthrough
            case 'json':
                if ($format instanceof JsonFormatInterface) {
                    return new JsonParser($format);
                } else {
                    throw new InvalidArgumentexception(
                        "Format indicates it is json but does not implement JsonFormatInterface"
                    );
                }

            // fallthrough
            default:
                throw new InvalidArgumentException("Supplied format: {$format->getType()} is unknown");
        }
    }
1296013
protected static function parseFormat($format)
    {
        static::loadFormats();

        // If the format equals a constant's value, just return it.
        if (in_array($format, static::$formats, true)) {
            return $format;
        }

        // Otherwise we'll assume the format is the constant's name.
        return Arr::get(static::$formats, strtoupper($format));
    }
889931
public function setFormat($format)
    {
        if ($this->app['debug']) {
            if (false === is_string($format)) {
                throw new \InvalidArgumentException(sprintf('Format must be a string, got "%s".', is_object($format) ? get_class($format) : gettype($format)));
            }

            if (false === strpos($format, '%key%')) {
                throw new \InvalidArgumentException(sprintf('Format must contain "%%key%%", got "%s".', $format));
            }

            if (false === strrpos($format, '.')) {
                throw new \InvalidArgumentException(sprintf('Format missing extension, got "%s".', $format));
            }
        }

        $this->format = $format;

        if (strlen($format) > 5 && '.dist' === substr($format, -5)) {
            $format = substr($format, strrpos($format, '.', -6) + 1);
        } else {
            $format = substr($format, strrpos($format, '.') + 1);
        }

        switch ($format) {
            case 'json':
            case 'json.dist':
                $this->loader = new JsonLoader();
                break;
            case 'yml':
            case 'yml.dist':
            case 'yaml':
            case 'yaml.dist':
                if (false === class_exists('Symfony\\Component\\Yaml\\Yaml')) {
                    throw new \RuntimeException('Missing Symfony Yaml component.');
                }

                $this->loader = new YamlLoader();
                break;
            case 'php':
            case 'php.dist':
                $this->loader = new PHPLoader();
                break;
            default:
                throw new \InvalidArgumentException(sprintf('Unsupported file format "%s".', $format));
        }

        $this->flushAll();

        return $this;
    }
945875
public function generateUrl(string $format): string
    {
        switch ($format) {
            case self::FORMAT_EPS:
            case self::FORMAT_PNG:
            case self::FORMAT_SVG:
                break;
            default:
                throw new DiagramException(sprintf('Format "%s" not handled.', $format));
                break;
        }

        $puml    = $this->generatePuml();
        $encoded = encodep($puml);

        return sprintf(self::URL, $format, $encoded);
    }
1322307
public function setFormat($format)
    {
        if (!is_null($format)) {
            $this->format = $format;
            $this->useFormat(false);
        }

        return $this;
    }
356630
public function format($format)
    {
        if(Format::exist($format))
            $this->format = Format::get($format);
        else
            Format::invalidType();

        return $this;
    }
1294170
public function toString($format = 'ignored')
    {
        $this->generate();

        $stringMonth = array();
        foreach ($this->subperiods as $month) {
            $stringMonth[] = $month->getDateStart()->toString("Y") . "-" . $month->getDateStart()->toString("m") . "-01";
        }

        return $stringMonth;
    }
419473
public function setDefaultStringFormat($format)
    {
        $formats = static::getSupportedStringFormats();

        $format = strtoupper($format);
        if (!in_array($format, $formats)) {
            throw new InvalidArgumentException(sprintf('Given "%s" default string format is not supported. Only "%s" are valid string formats.', $format, implode(', ', $formats)));
        }

        $this->defaultStringFormat = $format;
    }
15965
public function getFileSetDisplayName($format = 'html')
    {
        $value = tc('FileSetName', $this->getFileSetName());
        switch ($format) {
            case 'html':
                return h($value);
            case 'text':
            default:
            return $value;
        }
    }
1072826
public function get($format)
    {
        if ('plain' == $format || 'string' == $format) {
            return $this->makePlain();
        }
        if ('json' == $format) {
            return $this->makeJson();
        }

        return json_decode($this->response, true);
    }
522962
public static function toRaw(string $raw, string $format = null): string
    {
        $format = $format ?? self::$format;

        switch ($format) {
            case self::FORMAT_HEX:
                return \hex2bin($raw);

            case self::FORMAT_BASE64:
                return \base64_decode($raw);

            case self::FORMAT_STR:
                return \hex2bin(\str_replace('\x', '', $raw));

            case self::FORMAT_RAW:
                return $raw;

            default:
                throw new InvalidArgumentException("Crypto return format not defined: $format");
        }
    }
465080
public function render($format)
    {
        if (!isset($this->formatters[$format])) {
            throw new \InvalidArgumentException(
                sprintf("Unable to find a formatter service for format '%s'.", $format)
            );
        }

        $formatter = $this->formatters[$format];
        $formatter->setFeed($this);

        return $formatter->render();
    }
721339
public function toString($format='Json', array $options=[])
  {
    $handler = Format::getInstance($format);
    return $handler->objectToString($this->data, $options);
  }
292055
protected function getFormat($format)
    {
        if ($format === false) {
            $format = 'none';
        }
        
        $types = [
            'none' => \IntlDateFormatter::NONE,
            'short' => \IntlDateFormatter::SHORT,
            'medium' => \IntlDateFormatter::MEDIUM,
            'long' => \IntlDateFormatter::LONG,
            'full' => \IntlDateFormatter::FULL
        ];
        
        return isset($types[$format]) ? $types[$format] : null;
    }