Creates new instance of \Google\Protobuf\Compiler\CodeGeneratorResponse\File

@throws \InvalidArgumentException

@return File
504509
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new File();
			case 1:
				return new File(func_get_arg(0));
			case 2:
				return new File(func_get_arg(0), func_get_arg(1));
			case 3:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
1209594
public function createNew()
    {
        $resource = $this->traitCreateNew();

        if (!$resource instanceof TranslatableInterface) {
            throw new \InvalidArgumentException('Resource must implement TranslatableInterface.');
        }

        $resource->setCurrentLocale($this->localeProvider->getCurrentLocale());
        $resource->setFallbackLocale($this->localeProvider->getFallbackLocale());

        return $resource;
    }
718950
public static function file()
    {
        if (!isset(self::core()->file)) {
            //====================================================================//
            // Initialize Tasks List
            self::core()->file = new FileManager();

            //====================================================================//
            //  Load Translation File
            self::translator()->load('file');
        }

        return self::core()->file;
    }
232097
public function generate()
    {
        if (!$this->filesystem->exists($path = $this->getPath())) {
            return $this->filesystem->put($path, $this->getContents());
        }

        throw new FileAlreadyExistException('File already exists!');
    }
301429
public static function instance($filename)
    {
        if (!\is_string($filename) && $filename) {
            throw new \InvalidArgumentException('Filename should be non-empty string');
        }
        if (!isset(static::$instances[$filename])) {
            static::$instances[$filename] = new static;
            static::$instances[$filename]->init($filename);
        }
        return static::$instances[$filename];
    }
346020
public function create()
    {
        $file = $this->ensureEloquentFile($this->nodeRepository->make());
        $this->callBeforeListeners('create', [$file]);
        $this->callAfterListeners('create', [$file]);
        return $file;
    }
1203584
public function initFile()
    {
        
    	if ($this->maxFileSize > 0 && file_exists($this->filename) && filesize($this->filename) >= $this->maxFileSize) {
	    	
	    	if ($this->compression == self::COMPRESSION_ZIP) {
	    		$zip = new ZipArchive;
				$res = $zip->open($this->getAvailableArchiveFileName(), ZipArchive::CREATE);
				if ($res === true) {
				    $zip->addFile($this->filename, basename($this->filename));
				    $zip->close();
				    unlink($this->filename);
				} else {
					//fail silently
					return false;
				}	
	    	} elseif ($this->compression == self::COMPRESSION_NONE) {
	    		$success = rename($this->filename, $this->getAvailableArchiveFileName());
	    		if (!$success) {
					//fail silently
					return false;
	    		}
	    	} else {
				//fail silently
				return false;
	    	}
    	}
    	$this->filehandle = @fopen($this->filename, 'a');
        

    }
692037
public function setOutputFile($file)
    {
        $dir = dirname($file);
        if (is_file($file)) {
            throw new \InvalidArgumentException('File exists: '.$file, ErrorCodes::FILE_EXISTS);
        }
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException('Directory not exists: '.$dir, ErrorCodes::DIR_NOT_FOUND);
        }
        if (!is_writable($dir)) {
            throw new \InvalidArgumentException('Directory not writeable: '.$dir, ErrorCodes::DIR_NOT_WRITEABLE);
        }
        $this->outputFile = $file;
        return $this;
    }
29980
public function setFile($file)
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException('File not found: '.$file, ErrorCodes::FILE_NOT_FOUND);
        }
        if (!is_readable($file)) {
            throw new \InvalidArgumentException('File is not readable: '.$file, ErrorCodes::FILE_NOT_READABLE);
        }
        $this->file = $file;
        return $this;
    }
886278
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new CodeGeneratorResponse();
			case 1:
				return new CodeGeneratorResponse(func_get_arg(0));
			case 2:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1));
			case 3:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new CodeGeneratorResponse(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
922853
public function getFile() {

		if(null === $this -> file) {

			$file = $this -> getFileName();
			$this -> file = new File($this -> directory . $file);
		}

		return $this -> file;
	}
855093
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new CodeGeneratorRequest();
			case 1:
				return new CodeGeneratorRequest(func_get_arg(0));
			case 2:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1));
			case 3:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new CodeGeneratorRequest(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
636550
public function getFile()
    {
        if (!$this->hasGetParameter('uri')) {
            throw new \common_exception_Error('invalid media identifier');
        }
        $uri = urldecode($this->getGetParameter('uri'));

        $mediaSource = new MediaSource(array());
        $fileInfo = $mediaSource->getFileInfo($uri);

        $fileManagement = $this->getServiceLocator()->get(FileManagement::SERVICE_ID);
        $stream = $fileManagement->getFileStream($fileInfo['link']);
        if ($fileInfo['mime'] === 'application/qti+xml') {
            $this->response = $this->getPsrResponse()->withBody($stream);
        } elseif ($this->hasGetParameter('xml')) {
            $this->returnJson(htmlentities((string)$stream));
        } else {
            $this->setContentHeader($fileInfo['mime']);
            $this->response = $this->getPsrResponse()->withBody($stream);
        }
    }
242112
public static function create() {
    // This gets substituted with git version when DCG is packaged to PHAR file.
    $version = '@git-version@';
    // Fallback for composer installation.
    if (!is_numeric($version[0])) {
      $version = 'UNKNOWN';
    }
    $application = new Application('Drupal Code Generator', $version);

    $helper_set = new HelperSet([
      new QuestionHelper(),
      new Dumper(new Filesystem()),
      // We cannot reference the TwigEnvironment class with use statement
      // because of a PHP bug.
      // @see https://bugs.php.net/bug.php?id=66773
      // @codingStandardsIgnoreStart
      new Renderer(new \DrupalCodeGenerator\Twig\TwigEnvironment(new \Twig_Loader_Filesystem())),
      // @codingStandardsIgnoreEnd
      new InputHandler(),
      new OutputHandler(),
    ]);
    $application->setHelperSet($helper_set);

    return $application;
  }
1374585
public function getFile()
    {
        if (is_null($this->file)) {
            $referencer = $this->getServiceLocator()->get(FileReferenceSerializer::SERVICE_ID);
            $this->file = $referencer->unserialize($this->getFileSerial());
        }
        return $this->file;
    }
823031
public function resolve()
    {
        if ($this->physicalFile) {
            $this->file = $this->fileDomain->create($this->physicalFile);
        }
        if (!$this->file) {
            throw new \BadMethodCallException(sprintf(
                'You cannot resolve Image CreateAction without giving a %s physical File or a %s logical File.',
                PhysicalFile::class,
                File::class
            ));
        }

        $this->image = (new $this->imageClass())
            ->setFile($this->file)
            ->setName($this->name ?: $this->file->getOriginalName())
            ->setTitle($this->title ?: $this->name)
            ->setTags($this->tags)
            ->setHeadline($this->headline)
            ->setAlt($this->alt)
        ;

        $this->assertEntityIsValid($this->image, array('Image', 'creation'));

        $this->fireEvent(
            ImageEvents::IMAGE_CREATED,
            new ImageEvent($this->image, $this)
        );

        return $this->image;
    }
1275446
public function create($params)
    {
        Util::verifyKeys(self::createSignature(), $params);

        $file = $params['file'];

        if (!is_resource($file)) {
            throw new InvalidArgumentException('file must be a stream resource');
        }

        $payload = [
            'document_upload[kind]' => $params['kind']
        ];
        $path = $this->_config->merchantPath() . '/document_uploads/';
        $response = $this->_http->postMultipart($path, $payload, $file);

        if (isset($response['apiErrorResponse'])) {
            return new Result\Error($response['apiErrorResponse']);
        }

        if (isset($response['documentUpload'])) {
            $documentUpload = DocumentUpload::factory($response['documentUpload']);
            return new Result\Successful($documentUpload);
        }
    }