mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
66 lines
1.3 KiB
PHP
66 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Gantry\Framework\Base;
|
|
|
|
/**
|
|
* Mock Gantry class for testing
|
|
*/
|
|
class Gantry
|
|
{
|
|
private static $instance;
|
|
|
|
/**
|
|
* @var \stdClass
|
|
*/
|
|
public $container;
|
|
|
|
private $debugMode = false;
|
|
|
|
/**
|
|
* Constructor.
|
|
*/
|
|
protected function __construct()
|
|
{
|
|
// Create container as a class to allow method calls
|
|
$this->container = new class {
|
|
public $services = ['platform' => 'mock'];
|
|
|
|
public function has($service) {
|
|
return isset($this->services[$service]);
|
|
}
|
|
|
|
public function get($service) {
|
|
return $this->services[$service] ?? null;
|
|
}
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get instance of the Gantry Framework
|
|
*
|
|
* @return Gantry
|
|
*/
|
|
public static function instance()
|
|
{
|
|
if (!self::$instance) {
|
|
self::$instance = new static();
|
|
}
|
|
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Set/Get debug mode.
|
|
*
|
|
* @param bool|null $enabled True to enable debugging, null to ignore.
|
|
* @return bool
|
|
*/
|
|
public function debug($enabled = null)
|
|
{
|
|
if (isset($enabled)) {
|
|
$this->debugMode = (bool) $enabled;
|
|
}
|
|
|
|
return $this->debugMode;
|
|
}
|
|
} |