If messages should be excluded from build.

@param string $filePath

@return bool
485947
protected function isMessagesExcluded($filePath)
    {
        if (empty($this->messagesIncluded)) {
            return false;
        }

        $filePath = str_replace(DIRECTORY_SEPARATOR, '/', $filePath);

        $localeDirSeparatorPosition = strpos($filePath, '/');
        $filePath = substr($filePath, $localeDirSeparatorPosition);
        $filePath = ltrim($filePath, '/');
        $filePath = substr($filePath, 0, -4);

        if (in_array($filePath, $this->messagesIncluded)) {
            return false;
        }

        return true;
    }
962776
protected function checkFilePath($filePath)
	{
	    $filePath = rtrim($filePath, '/\\');
	    if (!is_dir($filePath)) {
			mkdir($filePath, 0755, true);
		}
        
		if (!is_writable($filePath)) {
			throw new \RuntimeException(sprintf('The base cache path `%s` is not writable.', $filePath));
		}

		return true;
	}
1314126
public function remove($filePaths)
	{
		foreach ($filePaths as $filePath) {
			$directory = dirname($filePath);
			$this->emptyDirectory($directory, true);
		}
	}
1161173
public static function bindings(string $filePath = null)
    {
        if (is_file($filePath)) {
            /** @noinspection PhpIncludeInspection */
            $bindings = require_once $filePath;

            $bindings = is_array($bindings) ? $bindings : [];

            IOC::addBindings($bindings);

            Event::dispatch('minimal.loaded.bindings', [$filePath, $bindings]);
        }
    }
365903
protected function removeTemporaryFiles($filepath, $force = false)
	{
		if ($force || $filepath !== $this->getUncompressedFilepath($filepath)) {
			$this->getBackupFilesystemInstance()->removeFile($this->getUncompressedFilepath($filepath));
		}
	}
680451
public function removeFile($filePaths, $dirPath = null)
    {
        if (!is_array($filePaths)) {
            $filePaths = (array) $filePaths;
        }

        $result = true;
        foreach ($filePaths as $filePath) {
            if (isset($dirPath)) {
                $filePath = Utils\Util::concatPath($dirPath, $filePath);
            }

            if (file_exists($filePath) && is_file($filePath)) {
                if (function_exists('opcache_invalidate')) {
                    @opcache_invalidate($filePath, true);
                }
                $result &= unlink($filePath);
            }
        }

        return $result;
    }
1234326
public static function isAnimated( $filePath ){
		$content	= file_get_contents( $filePath );
		$pos1		= 0;
		$count		= 0;
		while( $count < 2 ) # There is no point in continuing after we find a 2nd frame
		{
			$pos1	= strpos( $content, "\x00\x21\xF9\x04", $pos1 );
			if( $pos1 === FALSE )
				break;
			$pos2	= strpos( $content, "\x00\x2C", $pos1 );
			if( $pos2 === FALSE )
				break;
			else if( $pos1 + 8 == $pos2 )
				$count++;
			$pos1 = $pos2;
		}
		return $count > 1;
	}
768159
public function obfuscate($filePath)
    {
        if (trim($filePath) == "") {
            $this->_errors[] = "File Name cannot be blank in function: " .
                __FUNCTION__;
            return false;
        }
        if (!is_readable($filePath)) {
            $this->_errors[] = "Failed to open file: $filePath in the function: " .
                __FUNCTION__;
            return false;
        }

        $this->_fileName = trim($filePath);
        $name = explode(".", $this->_fileName);
        $ext = end($name);
        $pos = strrpos($this->_fileName, ".");

        $filePath = substr($this->_fileName, 0, $pos);

        $this->_obfuscateFileName = $obfuscateFileName = $filePath . "." .
            $this->_obfuscatedFileSuffix . "." . $ext;

        if (($fp = fopen($obfuscateFileName, "w+")) === false) {
            $this->_errors[] = "Failed to open file: $obfuscateFileName " .
                "for writing in the function: " . __FUNCTION__;
            return false;
        } else {

            fwrite($fp, "<?php \r\n");
            $line = php_strip_whitespace($this->_fileName);

            $line = $this->preProcessString($line);
            $line = $this->encodeString($line);
            $line .= "\r\n";
            fwrite($fp, $line);
        }

        fclose($fp);

        return $obfuscateFileName;
    }
924813
public static function countLines($filepath)
	{
		$return = false;
		if (file_exists($filepath)) {
			$handle = fopen($filepath, 'r');
			if ($handle) {
				$return = 0;
				while (!feof($handle)) {
					$chunk = fgets($handle, 4096);
					$chunk_count = substr_count($chunk, "\n");
					$return = $return + $chunk_count;
				}
				fclose($handle);
			}
		}
		return $return;
	}
802241
public function removeEmptyDirectory($directoryPath)
    {
        if (is_dir($directoryPath) && $this->isDirEmpty($directoryPath)) {
            if (!$this->removeDirectory($directoryPath)) {
                // @codeCoverageIgnoreStart
                throw new \RuntimeException('Unable to remove the directory : ' . $directoryPath);
                // @codeCoverageIgnoreEnd
            }

            return true;
        }

        return false;
    }
5595
public function equals(FilePathInterface $filePath): bool
    {
        return $this->getDrive() === $filePath->getDrive() && $this->isAbsolute() === $filePath->isAbsolute() && $this->getDirectoryParts() === $filePath->getDirectoryParts() && $this->getFilename() === $filePath->getFilename();
    }
825614
private function deleteCacheSubfoldersIfEmpty($filepath)
    {
        if ($this->cache_path == $filepath) {
            // Do not delete main cache folder itself.
            return true;
        }

        $filepath_exp = explode(DIRECTORY_SEPARATOR, $filepath);
        if (is_array($filepath_exp)) {
            for ($i = count($filepath_exp)-1; $i >= 0 ; $i--) {
                $dir = implode(DIRECTORY_SEPARATOR, $filepath_exp);
                $iterator = new \FilesystemIterator($dir);
                $isDirEmpty = !$iterator->valid();
                unset($iterator);

                if ($this->cache_path == $dir) {
                    // Do not delete main cache folder.
                    return true;
                } elseif (is_dir($dir) && !is_writable($dir)) {
                    // Directory is unable to delete.
                    return false;
                } elseif (is_dir($dir) && $isDirEmpty !== true) {
                    // Directory is not empty.
                    return true;
                } elseif (is_dir($dir) && $isDirEmpty === true && is_writable($dir) && $this->cache_path != $dir) {
                    rmdir($dir);
                    unset($filepath_exp[$i]);
                } else {
                    return true;
                }
            }
            unset($i);
        }
        unset($filepath_exp);

        return true;
    }
906985
public function deleteFile($filePath)
    {
        $this->throwIfOperationNotInBaseFolder($filePath);

        if (file_exists($filePath) && is_file($filePath)) {
            unlink($filePath);
        }
    }
137410
public function compressFile (string $filePath) : bool
    {
        $compressor = $this->getCompressor();

        if (null === $compressor)
        {
            return false;
        }

        $process = new Process(\array_merge($compressor, [$filePath]));
        $process->run();
        return $process->isSuccessful();
    }
132486
def is_excluded_path(args, filepath):
    """"""
    # Try regular expressions first.
    for regexp_exclude_path in args.regexp:
        if re.match(regexp_exclude_path, filepath):
            return True
    abspath = os.path.abspath(filepath)
    if args.include:
        # If the file is outside of any include directories.
        out_of_include_dirs = True
        for incl_path in args.include:
            absolute_include_path = os.path.abspath(os.path.join(args.root, incl_path))
            if is_child_dir(absolute_include_path, abspath):
                out_of_include_dirs = False
                break
        if out_of_include_dirs:
            return True

    excl_rules = create_exclude_rules(args)
    for i, rule in enumerate(excl_rules):
        if rule[0] == abspath:
            return rule[1]
        if is_child_dir(rule[0], abspath):
            # continue to try to longest match.
            last_result = rule[1]
            for j in range(i + 1, len(excl_rules)):
                rule_deep = excl_rules[j]
                if not is_child_dir(rule_deep[0], abspath):
                    break
                last_result = rule_deep[1]
            return last_result
    return False
1246968
public static function isValid(string $filePath): bool
    {
        return self::myFilePathParse(
            DIRECTORY_SEPARATOR,
            $filePath,
            function ($p, $d, &$e) {
                return self::myPartValidator($p, $d, $e);
            });
    }
888610
public function isImage($filepath)
	{
		$this->debug->groupCollapsed(__METHOD__, $filepath);
		$isImage = false;
		if (false && function_exists('exif_imagetype')) {
			$type = exif_imagetype($filepath);
			$isImage = ($type !== false && in_array($type, $this->imagetypes));
		} else {
			$imageInfo = getimagesize($filepath);
			$mime = $imageInfo['mime'];
			// $this->debug->log('imageInfo', $imageInfo);
			$isImage = (isset($this->imageTypes[$mime]) && $imageInfo[0] && $imageInfo[1]);
		}
		$this->debug->groupEnd();
		return $isImage;
	}