/**
* @inheritdoc
*/
public function parse(string $file) : array
{
try {
$realPath = $this->fileLocator->locate($file);
} catch (FileNotFoundException $exception) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file, 0, $exception);
}
if (array_key_exists($realPath, $this->cache)) {
return $this->cache[$realPath];
}
$data = $this->parser->parse($realPath);
if (array_key_exists('include', $data)) {
$data = $this->includeProcessor->process($this, $file, $data);
}
$this->cache[$realPath] = $data;
return $data;
}