ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSimpleSAMLphpConfigTemplateHandler.php
Go to the documentation of this file.
1<?php
2
19declare(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}
static getDataDir()
get data directory (outside webspace)
copy(string $sourcePath, string $destinationPath, array $placeholders=[])
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37