(Yaf >=1.0.0)
Yaf_Registry::__construct — Constructor of Yaf_Registry
The constructor is private: Yaf_Registry implements the singleton pattern and cannot be instantiated directly. Use the static methods to read and write registry entries.
Diese Funktion besitzt keine Parameter.
No value is returned.
Beispiel #1 Yaf_Registry::__construct() example
The constructor is private, so direct instantiation is rejected:
<?php
$registry = new Yaf_Registry();
?>Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
PHP Fatal error: Uncaught Error: Call to private Yaf_Registry::__construct() from invalid context
Beispiel #2 Using Yaf_Registry through its static methods
<?php
Yaf_Registry::set("version", Yaf_Application::app()->getConfig()->application->version);
var_dump(Yaf_Registry::get("version"));
?>Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
string(7) "1.0.0.1"