public function setGlobPatternFromFile($file)
    {
        if (!is_file($file)) {
            $message = "Glob pattern file {$file} doesn't exist.";
            throw new NonExistentGlobPatternFile($message);
        }

        $globPatternContent = (string) file_get_contents($file);

        $globPatternLines = preg_split(
            '/\\r\\n|\\r|\\n/',
            $globPatternContent
        );

        $globPatterns = [];
        array_filter($globPatternLines, function ($line) use (&$globPatterns) {
            if (trim($line) !== '') {
                $globPatterns[] = trim($line);
            }
        });

        $globPattern = '{' . implode(',', $globPatterns) . '}*';

        try {
            $this->setGlobPattern($globPattern);

            return $this;
        } catch (InvalidGlobPattern $e) {
            $message = "Glob pattern file '{$file}' is invalid.";
            throw new InvalidGlobPatternFile($message);
        }
    }