public static function instance($type)
	{
		// Sanitize format type.
		$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));

		// Only instantiate the object if it doesn't already exist.
		if (!isset(self::$instances[$type]))
		{
			// Only load the file if the class does not exist.
			$class = __NAMESPACE__ . '\\Processor\\' . ucfirst($type);

			if (!class_exists($class))
			{
				foreach (self::all() as $inst)
				{
					if (in_array($type, $inst->getSupportedExtensions()))
					{
						$class = get_class($inst);
					}
				}

				if (!class_exists($class))
				{
					throw new InvalidArgumentException(sprintf('Unable to load format class for format "%s"', $type), 500);
				}
			}

			self::$instances[$type] = new $class;
		}

		return self::$instances[$type];
	}
public static function instance($type)
	{
		// Sanitize format type.
		$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));

		// Only instantiate the object if it doesn't already exist.
		if (!isset(self::$instances[$type]))
		{
			// Only load the file if the class does not exist.
			$class = __NAMESPACE__ . '\\Processor\\' . ucfirst($type);

			if (!class_exists($class))
			{
				foreach (self::all() as $inst)
				{
					if (in_array($type, $inst->getSupportedExtensions()))
					{
						$class = get_class($inst);
					}
				}

				if (!class_exists($class))
				{
					throw new InvalidArgumentException(sprintf('Unable to load format class for format "%s"', $type), 500);
				}
			}

			self::$instances[$type] = new $class;
		}

		return self::$instances[$type];
	}
public static function instance ( $ type ) { // Sanitize format type. $ type = strtolower ( preg_replace ( '/[^A-Z0-9_]/i' , '' , $ type ) ) ; // Only instantiate the object if it doesn't already exist. if ( ! isset ( self :: $ instances [ $ type ] ) ) { // Only load the file if the class does not exist. $ class = __NAMESPACE__ . '\\Processor\\' . ucfirst ( $ type ) ; if ( ! class_exists ( $ class ) ) { foreach ( self :: all ( ) as $ inst ) { if ( in_array ( $ type , $ inst -> getSupportedExtensions ( ) ) ) { $ class = get_class ( $ inst ) ; } } if ( ! class_exists ( $ class ) ) { throw new InvalidArgumentException ( sprintf ( 'Unable to load format class for format "%s"' , $ type ) , 500 ) ; } } self :: $ instances [ $ type ] = new $ class ; } return self :: $ instances [ $ type ] ; }
Returns a reference to a Processor object, only creating it
if it doesn't already exist.

@param   string  $type  The format to load
@return  object  Registry format handler
@throws  Exception
Returns a reference to a Processor object only creating it if it doesn t already exist .