Skip to content

Instantly share code, notes, and snippets.

@Schrank
Created June 26, 2011 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Schrank/1047698 to your computer and use it in GitHub Desktop.
Save Schrank/1047698 to your computer and use it in GitHub Desktop.
Simple implementation of a Registry
services:
informationContainer:
class: Digibet\PartnerBundle\DependencyInjection\InformationContainer
calls:
- [ set, ['path', 'Symfony/web/pdf' ] ]
# add "> /dev/null 2>/dev/null &" to use fire and forget
- [ set, ['newsScript', '/home/xxxx/public_html/digibet/Symfony/news %s' ] ]
<?php
namespace MyApp\MyBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
class InformationContainer {
protected $informations = array();
public function set($key, $value) {
$this->informations[$key] = $value;
}
public function get($key) {
if(isset($this->informations[$key])) {
return $this->informations[$key];
}
throw new \InvalidArgumentException($key . ' is not defined.');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment