Skip to content

Commit 753936b

Browse files
eliurkisjnunez28
andauthored
Add method list field from template (#4)
* Update src/PHPJasper.php Co-authored-by: Josue <josueperezn2901@gmail.com>
1 parent 2add463 commit 753936b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/PHPJasper.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,22 @@ protected function validateFormat($format)
210210
}
211211
}
212212

213+
/**
214+
* @param string $input
215+
* @return mixed
216+
* @throws Exception\InvalidInputFile
217+
*/
218+
public function listFields(string $input)
219+
{
220+
if (!is_file($input)) {
221+
throw new Exception\InvalidInputFile();
222+
}
223+
224+
preg_match_all("/<field name=\"(.*?)\"/s", file_get_contents($input), $matches);
225+
226+
return $matches[1] ?? [];
227+
}
228+
213229
/**
214230
* @param string $input
215231
* @return $this

0 commit comments

Comments
 (0)