TYPO3 CMS  TYPO3_7-6
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 
21 {
25  protected $registry;
26 
30  protected $namespaceIdentifier = 'TYPO3\\CMS\\Lang';
31 
35  public function injectRegistry(\TYPO3\CMS\Core\Registry $registry)
36  {
37  $this->registry = $registry;
38  }
39 
46  public function setNamespace($namespace)
47  {
48  $this->namespaceIdentifier = $namespace;
49  }
50 
56  public function getNamespace()
57  {
59  }
60 
68  public function has($name, $namespace = null)
69  {
70  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
71  $value = $this->registry->get($namespace, $name, '__NOTFOUND__');
72  return $value !== '__NOTFOUND__';
73  }
74 
82  public function get($name, $namespace = null)
83  {
84  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
85  return $this->registry->get($namespace, $name);
86  }
87 
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 
109  public function remove($name, $namespace = null)
110  {
111  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
112  $this->registry->remove($namespace, $name);
113  }
114 }
injectRegistry(\TYPO3\CMS\Core\Registry $registry)