ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCertificateValueReplacement.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
13
19 public function __construct(string $clientWebDirectory = '')
20 {
21 if ('' === $clientWebDirectory && true === defined('CLIENT_WEB_DIR')) {
22 $clientWebDirectory = CLIENT_WEB_DIR;
23 }
24 $this->clientWebDirectory = $clientWebDirectory;
25 }
26
34 public function replace(array $placeholderValues, string $certificateContent) : string
35 {
36 foreach ($placeholderValues as $placeholder => $value) {
37 $certificateContent = str_replace('[' . $placeholder . ']', $value, $certificateContent);
38 }
39
40 return $certificateContent;
41 }
42}
An exception for terminatinating execution or to throw for unit testing.
replace(array $placeholderValues, string $certificateContent)
Replaces placeholder in the certificate content with actual values.