Decides which validation function to use

@param	string	$sourceFile		Source file for comparison
@param	string	$originFile		File to validate
@return	null
160339
public function validate($sourceFile, $originFile)
	{
		$this->validateLineEndings($originFile);
		if (substr($originFile, -4) === '.php')
		{
			$this->validateDefinedInPhpbb($originFile);
			$this->validateUtf8withoutbom($originFile);
			$this->validateNoPhpClosingTag($originFile);
		}

		if (strpos($originFile, $this->originLanguagePath . 'email/') === 0 && substr($originFile, -4) === '.txt')
		{
			$this->validateEmail($sourceFile, $originFile);
		}
		else if (strpos($originFile, $this->originLanguagePath . 'help_') === 0 && substr($originFile, -4) === '.php')
		{
			$this->validateHelpFile($sourceFile, $originFile);
		}
		else if ($originFile == $this->originLanguagePath . 'search_synonyms.php')
		{
			$this->validateSearchSynonymsFile($originFile);
		}
		else if ($originFile == $this->originLanguagePath . 'search_ignore_words.php')
		{
			$this->validateSearchIgnoreWordsFile($originFile);
		}
		else if (substr($originFile, -4) === '.php')
		{
			$this->validateLangFile($sourceFile, $originFile);
		}
		else if (substr($originFile, -9) === 'index.htm')
		{
			$this->validateIndexFile($originFile);
		}
		else if ($originFile === $this->originLanguagePath . 'LICENSE')
		{
			$this->validateLicenseFile($originFile);
		}
		else if ($originFile === $this->originLanguagePath . 'iso.txt')
		{
			$this->validateIsoFile($originFile);
		}
		else if (substr($originFile, -4) === '.css')
		{
			$this->validateUtf8withoutbom($originFile);
			$this->validateCSSFile($sourceFile, $originFile);
		}
		else
		{
			$this->output->addMessage(Output::NOTICE, 'File is not validated', $originFile);
		}
	}
1339561
public function checkConnection( $checkResource = TRUE, $checkAuthentication = TRUE )
	{
		if( $checkResource && !$this->resource )
			throw new RuntimeException( "No Connection to FTP Server established" );
		if( $checkAuthentication && !$this->auth )
			throw new RuntimeException( "Not authenticated onto FTP Server" );
	}
342594
public static void copy(File sourceFile, File targetFile) throws IOException {
	FileInputStream in = new FileInputStream(sourceFile);
	try {
	    FileOutputStream out = new FileOutputStream(targetFile);
	    try {
		copy(in, out);
	    } finally {
		out.close();
	    }
	} finally {
	    in.close();
	}
    }
521364
public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $typePointer): void
    {
        $tokens = $phpcsFile->getTokens();

        /** @var int $namePointer */
        $namePointer = TokenHelper::findNext($phpcsFile, T_STRING, $typePointer + 1);
        $namespacePointer = TokenHelper::findPrevious($phpcsFile, T_NAMESPACE, $typePointer - 1);

        if (!$this->hasNamespace($namespacePointer)) {
            return;
        }

        $typeName = NamespaceHelper::normalizeToCanonicalName(
            ClassHelper::getFullyQualifiedName($phpcsFile, $typePointer)
        );

        $rootDirectory = \getcwd() . \DIRECTORY_SEPARATOR;
        $fileInfo = new \SplFileInfo($phpcsFile->getFilename());

        foreach ($this->rootNamespaces as $directory => $namespace) {
            if ($this->shouldSkip($directory)) {
                return;
            }

            if (StringHelper::startsWith($typeName, $namespace)) {
                $expectedTypeName = rtrim($fileInfo->getPathname(), '.' . $fileInfo->getExtension());
                $expectedTypeName = \str_replace($rootDirectory . $directory, '', $expectedTypeName);
                $expectedTypeName = \str_replace(\DIRECTORY_SEPARATOR, '\\', $expectedTypeName);
                $expectedTypeName = $namespace . '\\' . ltrim($expectedTypeName, '\\');

                if (strcasecmp($typeName, $expectedTypeName) === 0) {
                    return;
                }
            }
        }

        $phpcsFile->addError(
            sprintf(
                '%s name %s does not match filepath %s.',
                ucfirst($tokens[$typePointer]['content']),
                $typeName,
                $phpcsFile->getFilename()
            ),
            $namePointer,
            self::CODE_NO_MATCH_BETWEEN_TYPE_NAME_AND_FILE_NAME
        );
    }
118214
public function putFile(string $sourcefile)
    {
        if (file_exists($sourcefile)) {
            if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
                ($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
            ) {
                $this->grantHash();
                $nb_icontact->grantStorageFolder();
                $base_path = $nb_icontact->getBasePath();
                move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
            } else {
                throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
            }
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
        }
    }
584922
public function symlinkFile($sourceFile, $file)
    {
        if (false === $this->createDirectory(dirname($file))) {
            return false;
        }

        if (true === $this->isFileAlreadyExist($file)) {
            return true;
        }

        return $this->filesystem->relativeSymlink($sourceFile, $file);
    }
200322
public function validate(FileAbstraction $entity, $typeName, $sourceFilePath = null)
	{
		$siblings = $entity->getSiblings();
		$creatingFilename = $entity->getFileName();

		foreach ($siblings as $record) {
			/* @var $record File */
			
			if ( ! $record->equals($entity)) {
				$recordName = $record->getFileName();
				
				$creatingFilename = mb_strtolower($creatingFilename);
				$recordName = mb_strtolower($recordName);

				if ($creatingFilename == $recordName) {
					$message = $typeName . ' with this name already exists.';
					
					throw new Exception\DuplicateFileNameException(self::EXCEPTION_MESSAGE_KEY, $message);
				}
			}
		}
	}
416455
public function minifyJs($sourceFileList, $targetFile) {
        $sourceFileList = (array)$sourceFileList;
        $sourceFileList = array_map(array($this, '_createFullPath'), $sourceFileList);
        $sourceFileList = implode(' ', $sourceFileList);
        $targetFile = $this->_createFullPath($targetFile);

        $uglifyJsCommand = 'uglifyjs '.$sourceFileList.' -o '.$targetFile.' -c -m';
        `$uglifyJsCommand`;
    }
1083535
async function isValidOrigin(origin, sourceOrigin) {
    // This will fetch the caches from https://cdn.ampproject.org/caches.json the first time it's
    // called. Subsequent calls will receive a cached version.
    const officialCacheList = await caches.list();
    // Calculate the cache specific origin
    const cacheSubdomain = `https://${await createCacheSubdomain(sourceOrigin)}.`;
    // Check all caches listed on ampproject.org
    for (const cache of officialCacheList) {
      const cachedOrigin = cacheSubdomain + cache.cacheDomain;
      if (origin === cachedOrigin) {
        return true;
      }
    }
    return false;
  }
255975
public static function convertIniToXml( $sourceFile, $targetFile )
	{
		$data	= self::loadIni( $sourceFile );
		return self::saveXml( $targetFile, $data );
	}
96432
public function validateOrigin($origin)
    {
        if (empty($origin)) {
            $this->addError('origin', 'Origin cannot be empty');
            return false;
        }

        if (!in_array($origin, array('http', 'cli', 'cron'))) {
            $this->addError('origin', 'Origin must be either "http", "cli" or "cron"');
            return false;
        }

        return true;
    }
617599
public static function convertIniToJson( $sourceFile, $targetFile )
	{
		$data	= self::loadIni( $sourceFile );
		return self::saveJson( $targetFile, $data );
	}
605540
function validate (rootPath) {
  var manifest;
  var webextensionManifest;

  var errors = {};

  try {
    manifest = JSON.parse(fs.readFileSync(join(rootPath, "package.json")));
  } catch (e) {
    errors.parsing = utils.getErrorMessage("COULD_NOT_PARSE") + "\n" + e.message;
    return errors;
  }

  if (!validateID(manifest)) {
    errors.id = utils.getErrorMessage("INVALID_ID");
  }

  if (!validateMain(rootPath)) {
    errors.main = utils.getErrorMessage("MAIN_DNE");
  }

  if (!validateTitle(manifest)) {
    errors.title = utils.getErrorMessage("INVALID_TITLE");
  }

  if (!validateName(manifest)) {
    errors.name = utils.getErrorMessage("INVALID_NAME");
  }

  if (!validateVersion(manifest)) {
    errors.version = utils.getErrorMessage("INVALID_VERSION");
  }

  // If both a package.json and a manifest.json files exists in the addon
  // root dir, raise an helpful error message that suggest to use web-ext instead.
  if (fs.existsSync(join(rootPath, "manifest.json"))) {
    errors.webextensionManifestFound = utils.getErrorMessage("WEBEXT_ERROR");
  }

  return errors;
}
911350
public static void appendFile(File sourceFile, File destinationFile) {
        ValidationUtils.assertNotNull(destinationFile, "destFile");
        ValidationUtils.assertNotNull(sourceFile, "sourceFile");
        if (!FileLocks.lock(sourceFile)) {
            throw new FileLockException("Fail to lock " + sourceFile);
        }
        if (!FileLocks.lock(destinationFile)) {
            throw new FileLockException("Fail to lock " + destinationFile);
        }

        FileChannel in = null;
        FileChannel out = null;
        try {
            in = new FileInputStream(sourceFile).getChannel();
            out = new FileOutputStream(destinationFile, true).getChannel();
            final long size = in.size();
            // In some Windows platforms, copying large files fail due to insufficient system resources.
            // Limit copy size to 32 MB in each transfer
            final long count = 32 * MB;
            long position = 0;

            while (position < size) {
                position += in.transferTo(position, count, out);
            }
        } catch (IOException e) {
            throw new SdkClientException("Unable to append file " + sourceFile.getAbsolutePath()
                    + "to destination file " + destinationFile.getAbsolutePath() + "\n" + e.getMessage(), e);
        } finally {
            closeQuietly(out, LOG);
            closeQuietly(in, LOG);
            FileLocks.unlock(sourceFile);
            FileLocks.unlock(destinationFile);
            try {
                if (!sourceFile.delete()) {
                    LOG.warn("Failed to delete file " + sourceFile.getAbsolutePath());
                }
            } catch (SecurityException exception) {
                LOG.warn("Security manager denied delete access to file " + sourceFile.getAbsolutePath());
            }
        }
    }
1268000
public function storeFileData(File $file, $sourceFilePath)
	{
		$this->validateFileUpload($file, $sourceFilePath);

		$this->createBothFoldersInFileSystem($file);

		$filePath = $this->getFilesystemPath($file);

		if ( ! copy($sourceFilePath, $filePath)) {
			throw new Exception\RuntimeException('Failed to copy file form "' . $sourceFilePath . '" to "' . $filePath . '"');
		} else {
			chmod($filePath, $this->fileAccessMode);
		}
	}
404456
protected function copyFile($sourceFile, $destFile) {
        $status = copy($sourceFile, $destFile);

        if ($status === false) {
            throw new Exception(sprintf(
                'Unable to copy file "%s" to "%s"',
                $sourceFile,
                $destFile
            ), ExitApp::RUNTIME_ERROR);
        }

        return $this;
    }
816008
public function validateFile(Entity\File $file, $sourceFilePath = null)
	{
		$this->validate($file, self::TYPE_FILE, $sourceFilePath);
	}