From c74858af68bfb924a8bbc71b1d5f89fd2a0a4625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 11 Aug 2022 10:45:15 +0200 Subject: [PATCH] Repository*: add a 'fileName' property --- src/RepositoryDir.php | 2 ++ src/RepositoryGit.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/RepositoryDir.php b/src/RepositoryDir.php index 07e33667..08f23fd0 100644 --- a/src/RepositoryDir.php +++ b/src/RepositoryDir.php @@ -34,6 +34,7 @@ class RepositoryDir extends RepositoryBase { if (preg_match("/^([0-9a-zA-Z_\-]+)\.json$/", $f, $m) && $f !== 'package.json') { $d1 = json_decode(file_get_contents("{$this->path}/{$f}"), true); $d1['format'] = 'json'; + $d1['fileName'] = $f; if (!$this->isCategory($d1)) { continue; @@ -45,6 +46,7 @@ class RepositoryDir extends RepositoryBase { if (preg_match("/^([0-9a-zA-Z_\-]+)\.yaml$/", $f, $m)) { $d1 = yaml_parse(file_get_contents("{$this->path}/{$f}")); $d1['format'] = 'yaml'; + $d1['fileName'] = $f; if (!$this->isCategory($d1)) { continue; diff --git a/src/RepositoryGit.php b/src/RepositoryGit.php index 6a95c89e..536e9072 100644 --- a/src/RepositoryGit.php +++ b/src/RepositoryGit.php @@ -72,6 +72,7 @@ class RepositoryGit extends RepositoryBase { $d1 = json_decode(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f)), true); $d1['format'] = 'json'; + $d1['fileName'] = $f; if (!$this->isCategory($d1)) { continue; @@ -86,6 +87,7 @@ class RepositoryGit extends RepositoryBase { $d1 = yaml_parse(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f))); $d1['format'] = 'yaml'; + $d1['fileName'] = $f; if (!$this->isCategory($d1)) { continue;