Created
June 26, 2011 15:17
-
-
Save Schrank/1047698 to your computer and use it in GitHub Desktop.
Simple implementation of a Registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ] ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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