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!
17 use TYPO3\CMS\Core\Registry
;
25 * @var \TYPO3\CMS\Core\Registry
32 protected $namespaceIdentifier = 'TYPO3\\CMS\\Lang';
35 * @param \TYPO3\CMS\Core\Registry $registry
37 public function injectRegistry(Registry
$registry)
39 $this->registry
= $registry;
45 * @param string $namespace The namespace
48 public function setNamespace($namespace)
50 $this->namespaceIdentifier
= $namespace;
56 * @return string The namespace
58 public function getNamespace()
60 return $this->namespaceIdentifier
;
64 * Check for existing registry entry
66 * @param string $name Registry entry name
67 * @param string $namespace Optional namespace
68 * @return bool TRUE if exists
70 public function has($name, $namespace = null)
72 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
73 $value = $this->registry
->get($namespace, $name, '__NOTFOUND__');
74 return ($value !== '__NOTFOUND__');
80 * @param string $name Registry entry name
81 * @param string $namespace Optional namespace
82 * @return mixed Registry content
84 public function get($name, $namespace = null)
86 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
87 return $this->registry
->get($namespace, $name);
91 * Add / override registry entry
93 * @param string $name Registry entry name
94 * @param mixed $value The value
95 * @param string $namespace Optional namespace
98 public function set($name, $value, $namespace = null)
100 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
101 $this->registry
->set($namespace, $name, $value);
105 * Remove registry entry
107 * @param string $name Registry entry name
108 * @param string $namespace Optional namespace
111 public function remove($name, $namespace = null)
113 $namespace = (is_string($namespace) ?
$namespace : $this->namespaceIdentifier
);
114 $this->registry
->remove($namespace, $name);