2 namespace TYPO3\CMS\Lang\Service
;
5 * This file is part of the TYPO3 CMS project.
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.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
20 class RegistryService
{
23 * @var \TYPO3\CMS\Core\Registry
31 protected $namespaceIdentifier = 'TYPO3\\CMS\\Lang';
36 * @param string $namespace The namespace
39 public function setNamespace($namespace) {
40 $this->namespaceIdentifier
= $namespace;
46 * @return string The namespace
48 public function getNamespace() {
49 return $this->namespaceIdentifier
;
53 * Check for existing registry entry
55 * @param string $name Registry entry name
56 * @param string $namespace Optional namespace
57 * @return bool TRUE if exists
59 public function has($name, $namespace = NULL) {
60 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
61 $value = $this->registry
->get($namespace, $name, '__NOTFOUND__');
62 return ($value !== '__NOTFOUND__');
68 * @param string $name Registry entry name
69 * @param string $namespace Optional namespace
70 * @return mixed Registry content
72 public function get($name, $namespace = NULL) {
73 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
74 return $this->registry
->get($namespace, $name);
78 * Add / override registry entry
80 * @param string $name Registry entry name
81 * @param mixed $value The value
82 * @param string $namespace Optional namespace
85 public function set($name, $value, $namespace = NULL) {
86 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
87 $this->registry
->set($namespace, $name, $value);
91 * Remove registry entry
93 * @param string $name Registry entry name
94 * @param string $namespace Optional namespace
97 public function remove($name, $namespace = NULL) {
98 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
99 $this->registry
->remove($namespace, $name);