<?php

if (!defined('ABSPATH')) { exit; }

class AIEO_MOI_Provider_Registry {

    
    private static $providers = array();

    public static function register(AIEO_MOI_Provider $provider) {
        self::$providers[$provider->slug()] = $provider;
    }

    
    public static function get($slug) {
        $slug = (string) $slug;
        return isset(self::$providers[$slug]) ? self::$providers[$slug] : null;
    }

    
    public static function all() {
        return self::$providers;
    }

    
    public static function choices() {
        $out = array();
        foreach (self::$providers as $slug => $p) {
            $out[$slug] = $p->label();
        }
        return $out;
    }
}
