<?php
namespace Enum;

enum TypeSourceEnum : string {
    case Movie = 'movie';
    case VideoGame = 'video-game';
    case Anime = 'anime';
    case Serie = 'serie';

    public static function fromName(string $name): string
    {
        foreach (self::cases() as $status) {
            if( $name === $status->name ){
                return $status->value;
            }
        }
        throw new \ValueError("$name is not a valid backing value for enum " . self::class );
    }
}