ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilSimpleSAMLphpConfigTemplateHandler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  public function __construct(private Filesystem $fs)
26  {
27  }
28 
32  public function copy(string $sourcePath, string $destinationPath, array $placeholders = []): void
33  {
34  if (!$this->fs->has($destinationPath)) {
35  $templateContents = file_get_contents($sourcePath);
36 
37  foreach ($placeholders as $placeholder => $value) {
38  if (is_callable($value)) {
39  $value = $value();
40  }
41 
42  $templateContents = str_replace('[[' . $placeholder . ']]', $value, $templateContents);
43  }
44 
45  // Does not work because of .sec renaming of PHP files
46  //$this->fs->put($destinationPath, $templateContents);
47  file_put_contents(ilFileUtils::getDataDir() . '/' . $destinationPath, $templateContents);
48  }
49  }
50 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copy(string $sourcePath, string $destinationPath, array $placeholders=[])
static getDataDir()
get data directory (outside webspace)