public static function getCodec($id) { foreach (Codec::getAllCodecs() as $codec) { if ($codec->getID() === $id) { return $codec; } } throw new Exception($id . " is not a known codec ID."); }