This repository has been archived by the owner on Feb 28, 2018. It is now read-only.
/
Framework.php
89 lines (79 loc) · 2.21 KB
/
Framework.php
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* @package: Sobi Framework
* @author
* Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH
* Email: sobi[at]sigsiu.net
* Url: https://www.Sigsiu.NET
* @copyright Copyright (C) 2006 - 2016 Sigsiu.NET GmbH (https://www.sigsiu.net). All rights reserved.
* @license GNU/LGPL Version 3
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
* See http://www.gnu.org/licenses/lgpl.html and https://www.sigsiu.net/licenses.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* @created Thu, Dec 1, 2016 12:04:19
*/
namespace Sobi;
defined( '_JEXEC' ) || exit( 'Restricted access' );
use Sobi\Autoloader\Autoloader;
use Sobi\Error\Exception;
abstract class Framework
{
/** @var array */
protected static $translator = [];
/** @var array */
protected static $config;
/**
* @param array $callback
*/
public static function SetTranslator( array $callback )
{
self::$translator = $callback;
}
/**
*
*/
public static function Init()
{
define( 'SOBI', true );
include_once dirname( __FILE__ ) . '/Autoloader/Autoloader.php';
Autoloader::getInstance()->register();
}
/**
* @return string
* @throws Exception
*/
public static function Txt()
{
if ( is_array( self::$translator ) && count( self::$translator ) == 2 ) {
$args = func_get_args();
return call_user_func_array( self::$translator, $args );
}
else {
throw new Exception( 'Translator has not been set' );
}
}
/**
* @return string | array
* @throws Exception
*/
public static function Cfg()
{
if ( is_array( self::$config ) && count( self::$config ) == 2 ) {
$args = func_get_args();
return call_user_func_array( self::$config, $args );
}
else {
throw new Exception( 'Config has not been set' );
}
}
/**
* @param array $config
*/
public static function setConfig( array $config )
{
self::$config = $config;
}
}