Imported code from old repository

This commit is contained in:
2022-11-22 15:46:36 +01:00
parent 976fdc0199
commit 77cf9e05f1
91 changed files with 18969 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
namespace CloudObjects\PhpMAE;
class TwigTemplateFactory {
private $cachePath;
public function __construct($cachePath) {
$this->cachePath = $cachePath;
}
/**
* Creates a Twig template.
*
* @param string $string The template content.
* @param string $id An identifier that is used to cache the compiled template.
* If not provided, a hash of the template content is used instead.
*/
public function fromString(string $string, string $id = null) {
if ($id == null) $id = md5($string);
return new TwigTemplate($id, $string, $this->cachePath);
}
}