$currModeVal) { self::$resizeModes[$currModeVal] = $type; } } } /** * Creates a Resize instance from mode name. * * @param CropMode|string $mode The resize(crop) mode. * @param mixed $width Optional. Width. * @param mixed $height Optional. Height. * * @return BaseResizeAction */ public static function createResize($mode, $width = null, $height = null) { if (empty(self::$resizeModes)) { self::populateModes(); } if (! array_key_exists($mode, self::$resizeModes)) { throw new UnexpectedValueException("Unsupported resize mode {$mode}"); } $resizeType = __NAMESPACE__ . "\\" . self::$resizeModes[$mode]; return new $resizeType($mode, $width, $height); } }