Nathanmac\Utilities\Parser\Parser::registerFormat PHP Method

registerFormat() public method

Register Format Class.
public registerFormat ( $format, $class ) : self
$format
$class
return self
    public function registerFormat($format, $class)
    {
        if (!class_exists($class)) {
            throw new \InvalidArgumentException("Parser formatter class {$class} not found.");
        }
        if (!is_a($class, 'Nathanmac\\Utilities\\Parser\\Formats\\FormatInterface', true)) {
            throw new \InvalidArgumentException('Parser formatters must implement the Nathanmac\\Utilities\\Parser\\Formats\\FormatInterface interface.');
        }
        $this->supported_formats[$format] = $class;
        return $this;
    }