<?php
namespace WPIS;

class EpcImageFilter {

    private static $supportedValues = ['a++', 'a+', 'a', 'b', 'c', 'd', 'e', 'f', 'g'];

    public static function transform( $value ){

        $value = strtolower($value);

        if( ! in_array($value, self::$supportedValues) ){
            return $value;
        }

        if( $value !== '' ){
            $plugin_url = plugin_dir_url( dirname( dirname( __FILE__ ) ) );
            return '<img src="' . $plugin_url . 'dist/img/peb/wal/peb_' . $value . '.svg" title="EPC/PEB" class="epc-label">';
        }

        return 0;
    }
}