/** * @test * @testdox Can construct with identity and access it externally */ public function contextCanBeConstructWithIdentity() { $context = new RegionContext('some-id', 'default', 'default'); $this->assertEquals('some-id', $context->getIdentity()); $this->assertEquals('default', $context->getRendererIdentity()); $this->assertEquals('default', $context->getLoaderIdentity()); }
public function addRegionContext(RegionContext $context) { // If pooling is disabled then we should request the context be populated instantly. // When pooling is enabled we delegate the request to a batch method on first render. if (!$this->pooling && !isset($this->regionContexts[$context->getIdentity()])) { $this->loadRegionContext($context); } // Do not override contexts, instead check if the context has not been listed. if (!isset($this->regionContexts[$context->getIdentity()])) { $this->regionContexts[$context->getIdentity()] = $context; } }
/** * {@inheritdoc} */ public function single(RegionContext $context) { $context->setData(sprintf('%s-data', $context->getIdentity())); }