Create a Size Instance by string WordPress style

@param string $name
@return Size
@throws InvalidArgumentException
322037
public static function createBySizeName(string $name): self
    {
        $registeredImageSizes = get_intermediate_image_sizes();
        $additionalImageSizes = wp_get_additional_image_sizes();

        Assert::oneOf(
            $name,
            $registeredImageSizes,
            "{$name} size not found on WordPress registered sizes."
        );

        if ($additionalImageSizes[$name] ?? false) {
            return new self(
                (int)$additionalImageSizes[$name]['width'],
                (int)$additionalImageSizes[$name]['height']
            );
        }

        return new self(
            (int)get_option("{$name}_size_w", null),
            (int)get_option("{$name}_size_h", null)
        );
    }
1191235
public static function createByName($name)
    {
        $constants = static::getConstantsByName();

        if (!array_key_exists($name, $constants)) {
            throw new UnexpectedValueException("Name '{$name}' is not exists in the enum constants list " . get_called_class());
        }

        return new static($constants[$name]);
    }
95339
public function getSize($name = null)
    {
        if (null === $name) {
            $name = 'current';
        }

        $response = $this->browser->request('GET', 'window/'.urlencode($name).'/size');
        $body = json_decode($response->getContent(), true);

        return array($body['value']['width'], $body['value']['height']);
    }
1004578
public function resize($width = null, $height = null) {
        $params = array();

        if ($width) {
            $params[] = 'width=' . (int) $width;
        }

        if ($height) {
            $params[] = 'height=' . (int) $height;
        }

        if (!$params) {
            throw new InvalidArgumentException('width and/or height must be specified');
        }

        return $this->addTransformation(sprintf('resize:%s', implode(',', $params)));
    }
348645
public static function create($name) {
    if (is_string($name)) {
      $name = NameNode::create($name);
    }
    /** @var ConstantNode $node */
    $node = new static();
    $node->addChild($name, 'constantName');
    return $node;
  }
1016050
public function getColumnSize($name)
    {
        if (isset($this->indexColumnSizes[$name])) {
            return $this->indexColumnSizes[$name];
        }

        return null; // just to be explicit
    }
255904
public function createThumbnail($name, $width, $height)
    {
        $this->addAction('thumbnail', $name, $width, $height);
        return $this;
    }
1001366
public function setSize($size) {
		if (is_int($size)) {
			return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination"));
		}
		if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="")
			$size="pagination-".$size;
		return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination"));
	}
647248
public function get(string $name): CompressionMethod
    {
        if (!$this->has($name)) {
            throw new \InvalidArgumentException(\sprintf('The compression method "%s" is not supported.', $name));
        }

        return $this->compressionMethods[$name];
    }
897628
public function setSize($size)
    {
        if (!is_numeric($size) || $size < 1) {
            throw new \InvalidArgumentException(
                "An invalid identicon size was specified. ".
                "A numeric value >= 1 was expected. Specified value: $size.");
        }
        
        $this->size = (int)$size;
    }
790166
public function setSize($size)
    {
        if (!is_int($size)) {
            throw new \InvalidArgumentException('The attribute size on the class Attribute has to be integer (' . gettype($size) . ('object' === gettype($size) ? ' ' . get_class($size) : '') . ' given).');
        }

        $this->size = $size;

        return $this;
    }
208234
public static function createFromName($name)
    {
        $value = array_search($name, static::$names, true);

        if (!$value) {
            throw new InvalidArgumentException(sprintf(
                'Level with name "%s" is not in list: %s',
                $name,
                implode(', ', static::$names)
            ));
        }

        return new static($value);
    }
426921
final public function getColumn(string $name): Column
    {
        if (!array_key_exists($name, $this->columns)) {
            throw new InvalidArgumentException('Column '.$name.' not added');
        }

        return $this->columns[$name];
    }
1125854
public static function createFromName($name = self::WGS84)
    {
        $name = trim($name);

        if (empty($name)) {
            throw new InvalidArgumentException('Please provide an ellipsoid name !');
        }

        if (!array_key_exists($name, self::$referenceEllipsoids)) {
            throw new InvalidArgumentException(
                sprintf('%s ellipsoid does not exist in selected reference ellipsoids !', $name)
            );
        }

        return self::createFromArray(self::$referenceEllipsoids[$name]);
    }
517151
public static function getTypeFromName(string $name): int
    {
        $type = array_search(strtoupper(trim($name)), self::$names);
        if (false === $type || !is_int($type)) {
            throw new \InvalidArgumentException(sprintf('RData type "%s" is not defined.', $name));
        }

        return $type;
    }
224391
public static function size_for_name($sizename) {
        for ($size = self::MIN_SIZE; $size <= self::MAX_SIZE; $size++) {
            if ($sizename == get_string('shortsize_' . $size, 'tool_generator')) {
                return $size;
            }
        }
        throw new coding_exception("Unknown size name '$sizename'");
    }
1201954
public function create($name)
    {
        $response = giga_facebook_post('me/custom_labels', compact('name'));

        if (isset($response->error)) {
            $message = isset($response->error->error_user_msg) ? $response->error->error_user_msg : $response->message;
            throw new \Exception($message);
        }

        if (isset($response->id)) {
            return $response->id;
        }
    }