Example #1
0
 public function testGetReturnsSetValue()
 {
     $registry = new Registry();
     $value = 'myValue';
     $registry->set('key', $value);
     $this->assertEquals($value, $registry->get('key'));
 }
Example #2
0
 /**
  * Chain of command of the class loader
  * @param  array $serviceConfig
  * @param string $serviceName
  * @return object
  */
 protected function loadService($serviceName, $serviceConfig)
 {
     $isSingleton = false;
     if (array_key_exists('singleton', $serviceConfig)) {
         $isSingleton = (bool) $serviceConfig['singleton'];
     }
     $class = $this->activate($serviceName, $serviceConfig);
     if ($isSingleton) {
         // Only store if singleton'ed to spare memory
         $this->registry->set($serviceName, $class);
     }
     $this->inject($class, $serviceConfig);
     $class = $this->encapsulate($class, $serviceConfig);
     return $class;
 }