1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56:
<?php
namespace Core\Providers;
use Core\ParentModel;
// TODO: Service must retrieve some info from the server.
/**
* Class Service is our core backbone to retrieve information from the server before the instance is finished.
* @package Core
*/
class Service extends ParentModel
{
/**
* @var Service The class instance.
* @internal
*/
protected static $instance;
/**
* @var ParentModel The instance of the ParentModel
*/
protected $model;
/**
* Returns a Service instance, creating it if it did not exist.
* @return Service
*/
public static function singleton() {
if (!self::$instance) {
$v = __CLASS__;
self::$instance = new $v;
}
return self::$instance;
}
public function __construct() {
}
/**
* Returns an array with the parsed translations from the <code>{lang}.ini</code> file.
* @param string $lang The language key
*
* @return array The translations
*/
public static function getLanguage($lang) {
// Server query to retrieve the language array
$translations = [];
// we get the vector $translations from the language file
include (__ROOT__ . '/src/resources/languages/' . $lang . '.php');
return $translations;
// Dummy: This was done by \Core\Language but we've moved it here.
}
}