Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • Symfony\Component\Yaml\Tests\A
  • Symfony\Component\Yaml\Tests\B
  • Symfony\Component\Yaml\Tests\DumperTest
  • Symfony\Component\Yaml\Tests\InlineTest
  • Symfony\Component\Yaml\Tests\ParseExceptionTest
  • Symfony\Component\Yaml\Tests\ParserTest
  • Symfony\Component\Yaml\Tests\YamlTest
  • Overview
  • Namespace
  • Function
  • Tree
  1: <?php
  2: 
  3: /*
  4:  * This file is part of the Symfony package.
  5:  *
  6:  * (c) Fabien Potencier <fabien@symfony.com>
  7:  *
  8:  * For the full copyright and license information, please view the LICENSE
  9:  * file that was distributed with this source code.
 10:  */
 11: 
 12: namespace Symfony\Component\HttpFoundation\Session;
 13: 
 14: use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
 15: use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
 16: use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
 17: use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
 18: use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
 19: use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
 20: 
 21: /**
 22:  * Session.
 23:  *
 24:  * @author Fabien Potencier <fabien@symfony.com>
 25:  * @author Drak <drak@zikula.org>
 26:  *
 27:  * @api
 28:  */
 29: class Session implements SessionInterface, \IteratorAggregate, \Countable
 30: {
 31:     /**
 32:      * Storage driver.
 33:      *
 34:      * @var SessionStorageInterface
 35:      */
 36:     protected $storage;
 37: 
 38:     /**
 39:      * @var string
 40:      */
 41:     private $flashName;
 42: 
 43:     /**
 44:      * @var string
 45:      */
 46:     private $attributeName;
 47: 
 48:     /**
 49:      * Constructor.
 50:      *
 51:      * @param SessionStorageInterface $storage    A SessionStorageInterface instance.
 52:      * @param AttributeBagInterface   $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
 53:      * @param FlashBagInterface       $flashes    A FlashBagInterface instance (defaults null for default FlashBag)
 54:      */
 55:     public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
 56:     {
 57:         $this->storage = $storage ?: new NativeSessionStorage();
 58: 
 59:         $attributes = $attributes ?: new AttributeBag();
 60:         $this->attributeName = $attributes->getName();
 61:         $this->registerBag($attributes);
 62: 
 63:         $flashes = $flashes ?: new FlashBag();
 64:         $this->flashName = $flashes->getName();
 65:         $this->registerBag($flashes);
 66:     }
 67: 
 68:     /**
 69:      * {@inheritdoc}
 70:      */
 71:     public function start()
 72:     {
 73:         return $this->storage->start();
 74:     }
 75: 
 76:     /**
 77:      * {@inheritdoc}
 78:      */
 79:     public function has($name)
 80:     {
 81:         return $this->storage->getBag($this->attributeName)->has($name);
 82:     }
 83: 
 84:     /**
 85:      * {@inheritdoc}
 86:      */
 87:     public function get($name, $default = null)
 88:     {
 89:         return $this->storage->getBag($this->attributeName)->get($name, $default);
 90:     }
 91: 
 92:     /**
 93:      * {@inheritdoc}
 94:      */
 95:     public function set($name, $value)
 96:     {
 97:         $this->storage->getBag($this->attributeName)->set($name, $value);
 98:     }
 99: 
100:     /**
101:      * {@inheritdoc}
102:      */
103:     public function all()
104:     {
105:         return $this->storage->getBag($this->attributeName)->all();
106:     }
107: 
108:     /**
109:      * {@inheritdoc}
110:      */
111:     public function replace(array $attributes)
112:     {
113:         $this->storage->getBag($this->attributeName)->replace($attributes);
114:     }
115: 
116:     /**
117:      * {@inheritdoc}
118:      */
119:     public function remove($name)
120:     {
121:         return $this->storage->getBag($this->attributeName)->remove($name);
122:     }
123: 
124:     /**
125:      * {@inheritdoc}
126:      */
127:     public function clear()
128:     {
129:         $this->storage->getBag($this->attributeName)->clear();
130:     }
131: 
132:     /**
133:      * {@inheritdoc}
134:      */
135:     public function isStarted()
136:     {
137:         return $this->storage->isStarted();
138:     }
139: 
140:     /**
141:      * Returns an iterator for attributes.
142:      *
143:      * @return \ArrayIterator An \ArrayIterator instance
144:      */
145:     public function getIterator()
146:     {
147:         return new \ArrayIterator($this->storage->getBag($this->attributeName)->all());
148:     }
149: 
150:     /**
151:      * Returns the number of attributes.
152:      *
153:      * @return int The number of attributes
154:      */
155:     public function count()
156:     {
157:         return count($this->storage->getBag($this->attributeName)->all());
158:     }
159: 
160:     /**
161:      * {@inheritdoc}
162:      */
163:     public function invalidate($lifetime = null)
164:     {
165:         $this->storage->clear();
166: 
167:         return $this->migrate(true, $lifetime);
168:     }
169: 
170:     /**
171:      * {@inheritdoc}
172:      */
173:     public function migrate($destroy = false, $lifetime = null)
174:     {
175:         return $this->storage->regenerate($destroy, $lifetime);
176:     }
177: 
178:     /**
179:      * {@inheritdoc}
180:      */
181:     public function save()
182:     {
183:         $this->storage->save();
184:     }
185: 
186:     /**
187:      * {@inheritdoc}
188:      */
189:     public function getId()
190:     {
191:         return $this->storage->getId();
192:     }
193: 
194:     /**
195:      * {@inheritdoc}
196:      */
197:     public function setId($id)
198:     {
199:         $this->storage->setId($id);
200:     }
201: 
202:     /**
203:      * {@inheritdoc}
204:      */
205:     public function getName()
206:     {
207:         return $this->storage->getName();
208:     }
209: 
210:     /**
211:      * {@inheritdoc}
212:      */
213:     public function setName($name)
214:     {
215:         $this->storage->setName($name);
216:     }
217: 
218:     /**
219:      * {@inheritdoc}
220:      */
221:     public function getMetadataBag()
222:     {
223:         return $this->storage->getMetadataBag();
224:     }
225: 
226:     /**
227:      * {@inheritdoc}
228:      */
229:     public function registerBag(SessionBagInterface $bag)
230:     {
231:         $this->storage->registerBag($bag);
232:     }
233: 
234:     /**
235:      * {@inheritdoc}
236:      */
237:     public function getBag($name)
238:     {
239:         return $this->storage->getBag($name);
240:     }
241: 
242:     /**
243:      * Gets the flashbag interface.
244:      *
245:      * @return FlashBagInterface
246:      */
247:     public function getFlashBag()
248:     {
249:         return $this->getBag($this->flashName);
250:     }
251: }
252: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen