TYPO3 CMS  TYPO3_8-7
RegistryService.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 
18 
23 {
27  protected $registry;
28 
32  protected $namespaceIdentifier = 'TYPO3\\CMS\\Lang';
33 
38  {
39  $this->registry = $registry;
40  }
41 
47  public function setNamespace($namespace)
48  {
49  $this->namespaceIdentifier = $namespace;
50  }
51 
57  public function getNamespace()
58  {
60  }
61 
69  public function has($name, $namespace = null)
70  {
71  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
72  $value = $this->registry->get($namespace, $name, '__NOTFOUND__');
73  return $value !== '__NOTFOUND__';
74  }
75 
83  public function get($name, $namespace = null)
84  {
85  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
86  return $this->registry->get($namespace, $name);
87  }
88 
96  public function set($name, $value, $namespace = null)
97  {
98  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
99  $this->registry->set($namespace, $name, $value);
100  }
101 
108  public function remove($name, $namespace = null)
109  {
110  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
111  $this->registry->remove($namespace, $name);
112  }
113 }