ILIAS  release_8 Revision v8.24
class.ilSimpleSAMLphpConfigTemplateHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28{
29 protected Filesystem $fs;
30
31 public function __construct(Filesystem $fs)
32 {
33 $this->fs = $fs;
34 }
35
41 public function copy(string $sourcePath, string $destinationPath, array $placeholders = []): void
42 {
43 if (!$this->fs->has($destinationPath)) {
44 $templateContents = file_get_contents($sourcePath);
45
46 foreach ($placeholders as $placeholder => $value) {
47 if (is_callable($value)) {
48 $value = $value();
49 }
50
51 $templateContents = str_replace('[[' . $placeholder . ']]', $value, $templateContents);
52 }
53
54 // Does not work because of .sec renaming of PHP files
55 //$this->fs->put($destinationPath, $templateContents);
56 file_put_contents(ilFileUtils::getDataDir() . '/' . $destinationPath, $templateContents);
57 }
58 }
59}
static getDataDir()
get data directory (outside webspace)
copy(string $sourcePath, string $destinationPath, array $placeholders=[])
Interface Filesystem.
Definition: Filesystem.php:40
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...