TYPO3 CMS  TYPO3_7-6
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 
51  public function set($entryIdentifier, $sourceCode, array $tags = [], $lifetime = null)
52  {
53  if (!$this->isValidEntryIdentifier($entryIdentifier)) {
54  throw new \InvalidArgumentException('"' . $entryIdentifier . '" is not a valid cache entry identifier.', 1264023823);
55  }
56  if (!is_string($sourceCode)) {
57  throw new InvalidDataException('The given source code is not a valid string.', 1264023824);
58  }
59  foreach ($tags as $tag) {
60  if (!$this->isValidTag($tag)) {
61  throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1264023825);
62  }
63  }
64  $sourceCode = '<?php' . LF . $sourceCode . LF . '#';
65  $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime);
66  }
67 
75  public function requireOnce($entryIdentifier)
76  {
77  return $this->backend->requireOnce($entryIdentifier);
78  }
79 }
__construct($identifier, PhpCapableBackendInterface $backend)
Definition: PhpFrontend.php:34