TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
RegistryService.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Lang\Service;
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 
48  public function setNamespace($namespace)
49  {
50  $this->namespaceIdentifier = $namespace;
51  }
52 
58  public function getNamespace()
59  {
61  }
62 
70  public function has($name, $namespace = null)
71  {
72  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
73  $value = $this->registry->get($namespace, $name, '__NOTFOUND__');
74  return $value !== '__NOTFOUND__';
75  }
76 
84  public function get($name, $namespace = null)
85  {
86  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
87  return $this->registry->get($namespace, $name);
88  }
89 
98  public function set($name, $value, $namespace = null)
99  {
100  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
101  $this->registry->set($namespace, $name, $value);
102  }
103 
111  public function remove($name, $namespace = null)
112  {
113  $namespace = (is_string($namespace) ? $namespace : $this->namespaceIdentifier);
114  $this->registry->remove($namespace, $name);
115  }
116 }
set($name, $value, $namespace=null)