5���#��a`,>����������1T���W�����{X�ɘ�}G�4�"��ҕ4z�5F>e6*��[��\�;��%*U0LUUr2�cp�n��ݢ�kɜ��Y��͌3��+bG�����0#el���۴�o�e,,�jO�*M���1X��/3�z�)W^�,p>��s{��İQs��:�ޝd|w
���:f�I��e$���~�+ajX�jnT8����0'���S��>KI�UP���&���kN
Server IP : 78.111.106.131 / Your IP : 216.73.216.91 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 PHP/7.2.34 System : User : nobody ( 99) PHP Version : 7.2.34 Disable Function : proc_open,system,passthru,exec,popen,shell_exec,dbmopen,suexec,escapeshellcmd,show_source,escapeshellarg,symlink,eval,php_uname,pcntl_exec MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /webler/tggtd.org/core/vendor/symfony/http-foundation/Session/Attribute/ |
Upload File : |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Session\Attribute; /** * This class provides structured storage of session attributes using * a name spacing character in the key. * * @author Drak <drak@zikula.org> */ class NamespacedAttributeBag extends AttributeBag { private $namespaceCharacter; /** * @param string $storageKey Session storage key * @param string $namespaceCharacter Namespace character to use in keys */ public function __construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/') { $this->namespaceCharacter = $namespaceCharacter; parent::__construct($storageKey); } /** * {@inheritdoc} */ public function has($name) { // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is $attributes = $this->resolveAttributePath($name); $name = $this->resolveKey($name); if (null === $attributes) { return false; } return \array_key_exists($name, $attributes); } /** * {@inheritdoc} */ public function get($name, $default = null) { // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is $attributes = $this->resolveAttributePath($name); $name = $this->resolveKey($name); if (null === $attributes) { return $default; } return \array_key_exists($name, $attributes) ? $attributes[$name] : $default; } /** * {@inheritdoc} */ public function set($name, $value) { $attributes = &$this->resolveAttributePath($name, true); $name = $this->resolveKey($name); $attributes[$name] = $value; } /** * {@inheritdoc} */ public function remove($name) { $retval = null; $attributes = &$this->resolveAttributePath($name); $name = $this->resolveKey($name); if (null !== $attributes && \array_key_exists($name, $attributes)) { $retval = $attributes[$name]; unset($attributes[$name]); } return $retval; } /** * Resolves a path in attributes property and returns it as a reference. * * This method allows structured namespacing of session attributes. * * @param string $name Key name * @param bool $writeContext Write context, default false * * @return array */ protected function &resolveAttributePath($name, $writeContext = false) { $array = &$this->attributes; $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; // Check if there is anything to do, else return if (!$name) { return $array; } $parts = explode($this->namespaceCharacter, $name); if (\count($parts) < 2) { if (!$writeContext) { return $array; } $array[$parts[0]] = []; return $array; } unset($parts[\count($parts) - 1]); foreach ($parts as $part) { if (null !== $array && !\array_key_exists($part, $array)) { if (!$writeContext) { $null = null; return $null; } $array[$part] = []; } $array = &$array[$part]; } return $array; } /** * Resolves the key from the name. * * This is the last part in a dot separated string. * * @param string $name * * @return string */ protected function resolveKey($name) { if (false !== $pos = strrpos($name, $this->namespaceCharacter)) { $name = substr($name, $pos + 1); } return $name; } }