TYPO3 CMS  TYPO3_8-7
PhpFrontend.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
27 {
35  {
36  parent::__construct($identifier, $backend);
37  }
38 
50  public function set($entryIdentifier, $sourceCode, array $tags = [], $lifetime = null)
51  {
52  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
53  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823);
54  }
55  if (!is_string($sourceCode)) {
56  throw new InvalidDataException('The given source code is not a valid string.', 1264023824);
57  }
58  foreach ($tags as $tag) {
59  if (!$this->isValidTag($tag)) {
60  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825);
61  }
62  }
63  $sourceCode = '<?php' . LF . $sourceCode . LF . '#';
64  $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime);
65  }
66 
74  public function requireOnce($entryIdentifier)
75  {
76  return $this->backend->requireOnce($entryIdentifier);
77  }
78 }
__construct($identifier, PhpCapableBackendInterface $backend)
Definition: PhpFrontend.php:34