public function createInstance($file, $type = null, array $options = array())
    {
        if (!is_file($file) && $type === null) {
            throw new \InvalidArgumentException(
                'You must enter a $type if the file does not exist yet.'
            );
        }

        $type = pathinfo($file, PATHINFO_EXTENSION);

        switch ($type) {
            case self::JSON_TYPE:
                $file = new Json($file, $options);

                break;
            case self::YAML_TYPE:
                $file = new Yaml($file, $options);

                break;
            default:
                throw UnsupportedFileTypeException::create($type);
        }

        return $file;
    }