Get webp size info depending on format type and set size array values

@param string $data Data string
@param string $format Format string
170682
protected function getWebpSize($data, $format)
	{
		switch ($format)
		{
			case self::WEBP_FORMAT_SIMPLE:
				$this->size = unpack('vwidth/vheight', substr($data, 10, 4));
			break;

			case self::WEBP_FORMAT_LOSSLESS:
				// Lossless uses 14-bit values so we'll have to use bitwise shifting
				$this->size = array(
					'width'		=> ord($data[5]) + ((ord($data[6]) & 0x3F) << 8) + 1,
					'height'	=> (ord($data[6]) >> 6) + (ord($data[7]) << 2) + ((ord($data[8]) & 0xF) << 10) + 1,
				);
			break;

			case self::WEBP_FORMAT_EXTENDED:
				// Extended uses 24-bit values cause 14-bit for lossless wasn't weird enough
				$this->size = array(
					'width'		=> ord($data[8]) + (ord($data[9]) << 8) + (ord($data[10]) << 16) + 1,
					'height'	=> ord($data[11]) + (ord($data[12]) << 8) + (ord($data[13]) << 16) + 1,
				);
			break;
		}
	}
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));
    }
23143
public static function fromSql(string $format, $data = null)
    {
        if ($data === null) {
            return null;
        }

        switch ($format) {
            case self::NONE:
                return $data;
            case self::DATE:
                $result = DateTime::createFromFormat($format, $data);
                $result->setTime(0, 0, 0);
                return $result;
            case self::TIMESTAMP:
            case self::TIMETZ:
            case self::TIMEUTZ:
            case self::DATETIMETZ:
            case self::DATETIMEUTZ:
                // Format must match - no auto detection
                return DateTime::createFromFormat($format, $data);
            case self::TIME:
            case self::TIMEU:
                // Includes microseconds?
                $timeFormat = (strlen($data) > 8) ? self::TIMEU : self::TIME;
                return DateTime::createFromFormat($timeFormat, $data);
            case self::DATETIME:
            case self::DATETIMEU:
                // Includes microseconds?
                $dateTimeFormat = (strlen($data) > 19) ? self::DATETIMEU : self::DATETIME;
                return DateTime::createFromFormat($dateTimeFormat, $data);
            case self::INT:
                return (integer)$data;
            case self::BOOL:
                return (bool)$data;
            case self::FLOAT:
                return floatval($data);
            case self::STRING:
                return (string)$data;
            case self::ALPHANUMERIC:
                return preg_replace('/[^a-zA-Z0-9_ ]/', '', $data);
            case self::SERIALIZED:
                return unserialize($data);
            case self::JSON:
                return json_decode($data, true);
            case self::CSV:
                return str_getcsv($data);
            default:
                throw new FormatException ('Unknown format: ' . $format);
        }
    }
18016
private function setRealFormat($format) {
        // try to use the _nomax variant if available
        if (!$this->max && null !== self::getFormatDefinition($format . '_nomax')) {
            $this->format = self::getFormatDefinition($format . '_nomax');
        }
        elseif (null !== self::getFormatDefinition($format)) {
            $this->format = self::getFormatDefinition($format);
        }
        else {
            $this->format = $format;
        }

        $this->formatLineCount = substr_count($this->format, "\n");
    }
15965
public function getFileSetDisplayName($format = 'html')
    {
        $value = tc('FileSetName', $this->getFileSetName());
        switch ($format) {
            case 'html':
                return h($value);
            case 'text':
            default:
            return $value;
        }
    }
1350589
public function setFormat(string $format)
    {
        // Control rendering by requested output format
        $no_render_format = [
            'json',
            'xml',
            'css',
            'js',
            'file'
        ];

        if (in_array($format, $no_render_format)) {
            $this->render = false;
        }

        $this->format = $format;
    }
336957
public function getFormatClass($format = '')
    {
        if ( ! empty($format)) {
            return $this->processContentType($format);
        }

        if (isset($_SERVER['CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['HTTP_CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        return 'Nathanmac\Utilities\Parser\Formats\JSON';
    }
459612
public function loadString($data, $format='Json', array $options=[])
  {
    $handler = Format::getInstance($format);
    
    $obj = $handler->stringToObject($data, $options);
    $this->loadObject($obj);

    return true;
  }
148574
public function decode($data, $format, array $context = array())
    {
        if ($this->native) {
            return yaml_parse($data);
        }

        return $this->decoder->parse($data);
    }
558767
public function encode($data, $format, array $context = array())
    {
        if ($this->native) {
            return yaml_emit($data, YAML_UTF8_ENCODING, YAML_LN_BREAK);
        }

        return $this->encoder->dump($data);
    }
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;
    }
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;
    }
701707
public static function parseFormat($format, $type)
    {
        if (strncmp($format, 'php:', 4) === 0) {
            return substr($format, 4);
        } elseif ($format != '') {
            return FormatConverter::convertDateIcuToPhp($format, $type);
        } else {
            throw new InvalidConfigException("Error parsing '{$type}' format.");
        }
    }
76974
public function getMetaDateFormatted($format = null)
    {
        if ($this->owner->hasMetaDate()) {
            return $this->owner->getMetaDate()->Format($format ? $format : $this->owner->getMetaDateFormat());
        }
    }
1014072
public function setFormat($format = null)
    {
        if ( ! is_null($format)) {
            self::checkFormat($format);
            $this->format = $format;
        }

        return $this;
    }
453224
public function setApiQueryStringRequestFormat($format)
    {
        $this->apiQueryStringRequestFormat = $format;
        return $this->apiQueryStringRequestFormat === $format ? true : false;
    }
616642
public static function formatBytes($size, $precision = 0, $format = 'decimal')
    {
        if (!array_key_exists($format, self::$formats)) {
            throw new \InvalidArgumentException('Not a valid format');
        }

        $format = self::$formats[$format];
        $precision = (int) $precision;

        /** @var float $base */
        $base = log((float) $size, $format['mod']);
        $key = (int) floor($base);

        $value = round(pow($format['mod'], $base - floor($base)), $precision);

        return sprintf('%.' . $precision . 'f %s', $value, $format['units'][$key]);
    }