Use Pimple instead of Core\Registry and add Monolog for logging
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Core;
|
||||
|
||||
use Pimple\Container;
|
||||
|
||||
/**
|
||||
* Tool class
|
||||
*
|
||||
@@ -37,31 +39,17 @@ class Tool
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param Core\Registry $registry DPI container
|
||||
* @param string $name Model name
|
||||
* @param Pimple\Container $container Container instance
|
||||
* @param string $name Model name
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadModel(Registry $registry, $name)
|
||||
public static function loadModel(Container $container, $name)
|
||||
{
|
||||
if (! isset($registry->$name)) {
|
||||
if (! isset($container[$name])) {
|
||||
$class = '\Model\\'.ucfirst($name);
|
||||
$registry->$name = new $class($registry);
|
||||
$container[$name] = new $class($container);
|
||||
}
|
||||
|
||||
return $registry->shared($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the page is requested through HTTPS
|
||||
*
|
||||
* Note: IIS return the value 'off' and other web servers an empty value when it's not HTTPS
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isHTTPS()
|
||||
{
|
||||
return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== '' && $_SERVER['HTTPS'] !== 'off';
|
||||
return $container[$name];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user