Sets a format for a given name.

This method also allow you to override an existing format.

@param string $name   The format name
@param string $format A format string
554171
public static function setFormatDefinition(string $name, string $format): void
    {
        if (!self::$formats) {
            self::$formats = self::initFormats();
        }

        self::$formats[$name] = $format;
    }
994203
public function format(string $format) : self
    {
        if (! in_array($format, self::VALID_FORMATS)) {
            throw new Exception('Invalid format provided to path.');
        }

        $this->format = $format;

        return $this;
    }
750669
public function setFieldKeyFormat($format)
    {
        $this->validator->isFormatValid($format);
        $this->fieldKeyFormat = $format;
        return $this;
    }
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;
    }
196695
public function getName($name, $format = Metadata::RAW)
    {
        $names = $this->getNames();
        
        if (isset($names[$name])) {
            switch ($format) {
                case Metadata::RAW:
                    return $names[$name];
                case Metadata::CAMILIZED:
                    return Inflector::camelize($names[$name]);
                case Metadata::CLASSIFIED:
                    return Inflector::classify($names[$name]);
                case Metadata::UNDERSCORED:
                    return Inflector::underscore($names[$name]);
                default:
                    throw new NotFoundException('Unable to find correct inflector formatter');
            }
        }
        
        throw new NotFoundException(sprintf('Unable to find column name for "%s" with format "%s"',
            $name, $format));
    }
914763
public void setFormat(final String format) {
        if (format == null && this.format == null) {
            return;
        } else if (format == null) {
            removeChild(this.format);
            this.format = null;
        } else if (this.format == null) {
            this.format = new KeyValueNode<String>(CommonConstants.CS_FORMAT_TITLE, format);
            appendChild(this.format, false);
        } else {
            this.format.setValue(format);
        }
    }
659281
public function setName($name)
    {
        $nameParts = explode(' ', $name);
        $this->Surname = array_pop($nameParts);
        $this->FirstName = join(' ', $nameParts);
    }
152656
public function setFormat($type, $format)
    {
        if ($this->typeIsAvailable($type)) {
            $this->formats[$type] = $format;
        }

        return $this;
    }
962685
public function setFormat($format)
    {
        $result = true;
        if (($this->debug === true) && !empty($this->evidence) && isset(Formats::$$this->evidence)) {
            if (array_key_exists($format, array_flip(Formats::$$this->evidence))
                === false) {
                $result = false;
            }
        }
        if ($result === true) {
            $this->format = $format;
            $this->updateApiURL();
        }
        return $result;
    }
453224
public function setApiQueryStringRequestFormat($format)
    {
        $this->apiQueryStringRequestFormat = $format;
        return $this->apiQueryStringRequestFormat === $format ? true : false;
    }
1107745
public function register($name, FormatInterface $format)
    {
        if (isset($this->formats[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'Formatter with name "%s" is already registered',
                $name
            ));
        }

        $this->formats[$name] = $format;
    }
1232660
public function setLabel( $name )
	{
		if ( $name == $this->getLabel() ) { return; }

		$this->_values['label'] = (string) $name;
		$this->setModified();
	}
475867
public function setName($name)
    {
        list($domain, $locale, $extention) = explode('.', $name);

        $this->domain = $domain;
        $this->locale = $locale;
        $this->extention = $extention;
    }
455087
protected function setFormParameter(string $name, string $value): void
    {
        $this->formParameters->set($name, $value);
    }
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);
        }
    }
1313200
public function setFormat($format)
    {
        if ($format) {
            $format = strtolower($format);

            if (!in_array($format, static::$validFormats)) {
                throw new Exception("Format {$format} is not supported");
            }

            $this->format = $format;

            if (!$this->suffix) {
                $this->setSuffix(".{$format}");
            }
        }

        return $this;
    }
306718
protected function setFormat($format = null)
    {
        if ($format == '' && $this->image instanceof Image) {
            $format = $this->image->mime;
        }

        $this->format = $format ? $format : 'jpg';

        return $this;
    }