@param string $file
@param bool   $internalErrors
@param bool   $disableEntities

@return \InvalidArgumentException
346406
private function createException($file, $internalErrors, $disableEntities)
    {
        $errors = [];

        foreach (libxml_get_errors() as $error) {
            $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
                $error->level === LIBXML_ERR_WARNING ? 'WARNING' : 'ERROR',
                $error->code,
                trim($error->message),
                $file,
                $error->line,
                $error->column
            );
        }

        $this->setLibXmlState($internalErrors, $disableEntities);

        return new \InvalidArgumentException(implode(PHP_EOL, $errors));
    }
1299034
public function parse(string $file): array
    {
        if (false === file_exists($file)) {
            throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
        }

        $data = include $file;

        if (false === is_array($data)) {
            throw TypeErrorFactory::createForInvalidFixtureFileReturnedData($file);
        }

        return $data;
    }
1105754
private function getConfigEntityByInternalName($internalName)
    {
        foreach ($this->configuration['entities'] as $class) {
            /** @var AbstractConfig $entity */
            $entity = new $class();

            if ($entity->getInternalName() == $internalName) {
                return $entity;
            }
        }

        throw new NotFoundHttpException();
    }
193303
public function modify(FileNodeInterface $file, array $options = [])
    {
        if (!$this->canModify($file) || !($file instanceof LocalFileNodeInterface)) {
            throw new InvalidArgumentException("The supplied file: '$file' does not implement LocalFileNodeInterface'");
        }

        $file->setCompression($this->getCompression($file));

        return $file;
    }
406195
public function setRunningFile($file)
    {
        if (false === is_file($file)) {
            throw InvalidArgumentException::create(
                'The file "%s" is not a file or it does not exist.',
                $file
            );
        }

        $this->runningFile = $file;
    }
539239
public function onKernelException(GetResponseForExceptionEvent $event)
    {
        if ($event->getException() instanceof InternalErrorException) {
            $this->handleInternalError($event);
        } else {
            $this->handleNativeError($event);
        }
    }
984151
function validateTemplateFile( $file, $returnResourceData = false )
    {
        $this->resetErrorLog();

        if ( !file_exists( $file ) )
            return false;
        $resourceHandler = $this->resourceFor( $file, $resourceName, $templateName );
        if ( !$resourceHandler )
            return false;
        $resourceData = $this->resourceData( $resourceHandler, $file, $resourceName, $templateName );
        $resourceData['key-data'] = "file:" . $file;
        $extraParameters = array();

        // Disable caching/compiling while fetchin the resource
        // It will be restored afterwards
        $isCachingAllowed = $this->IsCachingAllowed;
        $this->IsCachingAllowed = false;

        $resourceHandler->handleResource( $this, $resourceData, eZTemplate::RESOURCE_FETCH, $extraParameters );

        // Restore previous caching flag
        $this->IsCachingAllowed = $isCachingAllowed;

        $root =& $resourceData['root-node'];
        $root = array( eZTemplate::NODE_ROOT, false );
        $templateText = $resourceData["text"];
        $rootNamespace = '';
        $this->parse( $templateText, $root, $rootNamespace, $resourceData );
        if ( eZTemplate::isDebugEnabled() )
        {
            $this->appendDebugNodes( $root, $resourceData );
        }

        $result = !$this->hasErrors() and !$this->hasWarnings();
        if ( $returnResourceData )
        {
            $resourceData['result'] = $result;
            $resourceData['errors'] = $this->ErrorLog();
            $resourceData['warnings'] = $this->WarningLog();
            return $resourceData;
        }
        return $result;
    }
938164
public function renderScripts($withInternal = false, array $internalAttrs = [])
    {
        $html = [];

        $this->triggerEvent('onAssetRenderScripts', [
            'asset' => $this,
            'withInternal' => &$withInternal,
            'html' => &$html,
        ]);

        foreach ($this->scripts as $url => $script) {
            $defaultAttribs = [
                'src' => $script['url'],
            ];

            $attribs = array_merge($defaultAttribs, $script['attribs']);

            if ($script['options']['version'] !== false) {
                $attribs['src'] = $this->appendVersion($attribs['src']);
            }

            if (isset($script['options']['sri'])) {
                $attribs['integrity']   = $script['options']['sri'];
                $attribs['crossorigin'] = 'anonymous';
            }

            if (isset($script['options']['conditional'])) {
                $html[] = '<!--[if ' . $script['options']['conditional'] . ']>';
            }

            if (isset($script['options']['import'])) {
                $attribs['href'] = $attribs['src'];
                $attribs['rel']  = 'import';
                unset($attribs['src']);
                $html[] = (string) h('link', $attribs, null);
            } else {
                $html[] = (string) h('script', $attribs, null);
            }

            if (isset($script['options']['conditional'])) {
                $html[] = '<![endif]-->';
            }
        }

        if ($withInternal && $this->internalScripts) {
            $html[] = (string) h(
                'script',
                $internalAttrs,
                "\n" . $this->renderInternalScripts() . "\n" . $this->indents
            );
        }

        return implode("\n" . $this->indents, $html);
    }
155459
public function internalError($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_INTERNAL_SERVER_ERROR, $headers);
    }
241214
public function chmod($file, $mode)
    {
        if (!chmod($this->alias->resolve($file), $mode)) {
            throw new RuntimeException(['chmod `:file` file to `:mode` mode failed: :last_error_message', 'file' => $file, 'mode' => $mode]);
        }
    }
103121
public static function parseFile($file, $exceptionOnInvalidType = false, $objectSupport = false)
    {
        if (!is_readable($file)) {
            throw new Exception("File '$file' is not readable");
        }

        return self::parse(file_get_contents($file), $exceptionOnInvalidType, $objectSupport);
    }
718443
public function processFileMethods(array $methods, string $file)
    {
        foreach ($methods as $name => $method) {
            if (is_null($method['docblock'])) {
                $this->errors[] = [
                    'type' => 'method',
                    'file' => $file,
                    'class' => $name,
                    'method' => $name,
                    'line' => $method['line'],
                ];
            }
        }
    }
684619
protected function _throw($file, $errorType)
    {
        if (null !== $file) {
            $this->_value = $file['name'];
        }

        $this->_error($errorType);
        return false;
    }
1306001
public function readPoFile(string $file, ?resource $context = null): void
    {
        $oldEr = error_reporting(E_ALL ^ E_WARNING);
        $source = file_get_contents($file, false, $context);
        error_reporting($oldEr);
        if (false===$source) {
            throw new FileNotReadableException($file);
        }
        $this->parsePoSource($source);
    }
683034
protected String internalExecute(Map<File, File> files, File outputFolder) {
		String firstErrorMessage = null;

		for (final Entry<File, File> entry : files.entrySet()) {
			final File inputFile = entry.getKey();
			try {
				final AbstractMarkerLanguageParser parser = createLanguageParser(inputFile);
				final File sourceFolder = entry.getValue();
				final File relativePath = FileSystem.makeRelative(inputFile, sourceFolder);
				internalExecute(sourceFolder, inputFile, relativePath, outputFolder, parser);
			} catch (Throwable exception) {
				final String errorMessage = formatErrorMessage(inputFile, exception);
				getLog().error(errorMessage);
				if (Strings.isEmpty(firstErrorMessage)) {
					firstErrorMessage = errorMessage;
				}
				getLog().debug(exception);
			}
		}
		return firstErrorMessage;
	}
943523
public function setEmailField($ef)
    {
        $ef = trim(filter_var($ef, FILTER_SANITIZE_STRING));
        if (empty($ef)) {
            throw new InternalServerErrorException('No email field provided.');
        }

        $this->emailField = $ef;
    }
649375
public function parseFile($file)
    {
        $handle = @fopen($file, 'r');
        if (!$handle) {
            throw new ErrorException(sprintf('Unable to open %s', $file));
        }
        try {
            $this->reset();
            while (!feof($handle)) {
                $buffer = fread($handle, 128);
                $this->parse($buffer);
            }
            $this->throwExceptionIfReadingEntry("\0");
        } finally {
            fclose($handle);
        }
    }