Completed
Push — master ( 821085...d0c0fe )
by joanhey
14s queued 11s
created

WorkerTimer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 7 1
1
<?php
2
/**
3
 * KumbiaPHP web & app Framework
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.
9
 *
10
 * @category   Kumbia
11
 * @package    Core
12
 *
13
 * @copyright  Copyright (c) 2005 - 2020 KumbiaPHP Team (http://www.kumbiaphp.com)
14
 * @license    https://github.com/KumbiaPHP/KumbiaPHP/blob/master/LICENSE   New BSD License
15
 */
16
17
/**
18
 * Este script ejecuta la carga de KumbiaPHP con Workerman
19
 *
20
 * @category   Kumbia
21
 * @package    Core
22
 */
23
24
25
require_once CORE_PATH.'../../autoload.php';
26
27
use Workerman\Protocols\Http;
28
use Workerman\Lib\Timer;
29
30
// Iniciar el buffer de salida
31
//ob_start();
32
const KUMBIA_VERSION = '1.0.0';
33
/**
34
 * Versión de KumbiaPHP
35
 *
36
 * @deprecated 1.1  Use constant KUMBIA_VERSION
37
 * @return string
38
 */
39
function kumbia_version()
0 ignored issues
show
Best Practice introduced by
The function kumbia_version() has been defined more than once; this definition is ignored, only the first definition in core/kumbia/bootstrap.php (L32-35) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
40
{
41
    return KUMBIA_VERSION;
42
}
43
44
/**
45
 * Inicializar el ExceptionHandler TODO
46
 * @see KumbiaException
47
 *
48
 * @return void
49
 */
50
// set_exception_handler(function($e) {
51
//     KumbiaException::handleException($e);
52
// });
53
54
// @see Autoload
55
require CORE_PATH.'kumbia/autoload.php';
56
// @see Config
57
require CORE_PATH.'kumbia/config.php';
58
// No cache in the benchmark
59
// if (PRODUCTION && Config::get('config.application.cache_template')) {
60
//     // @see Cache
61
//     require CORE_PATH.'libs/cache/cache.php';
62
//     //Asigna el driver por defecto usando el config.ini
63
//     if ($config = Config::get('config.application.cache_driver')) {
64
//         Cache::setDefault($config);
65
//     }
66
//     // Verifica si esta cacheado el template
67
//     if ($template = Cache::driver()->get($url, 'kumbia.templates')) {
68
//         //verifica cache de template para la url
69
//         echo $template;
70
//         echo '<!-- Time: ', round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 4), ' ms -->';
71
//         return;
72
//     }
73
// }
74
// @see Router
75
require CORE_PATH.'kumbia/router.php';
76
// @see Controller
77
require APP_PATH.'libs/app_controller.php';
78
// @see KumbiaView
79
require APP_PATH.'libs/view.php';
80
// Ejecuta el request
81
// Dispatch y renderiza la vista
82
//View::render(Router::execute($url));
83
84
function kumbiaSend() {
85
    ob_start();ob_start();
86
    View::render(Router::execute($_SERVER['REQUEST_URI']));
87
    Http::header(WorkerTimer::$date);
88
    return ob_get_clean();
89
}
90
91
class WorkerTimer
92
{
93
    public static $date;
94
95
    public static function init()
96
    {
97
        self::$date = 'Date: '.gmdate('D, d M Y H:i:s').' GMT';
98
        Timer::add(1, function() {
99
            WorkerTimer::$date = 'Date: '.gmdate('D, d M Y H:i:s').' GMT';
100
        });
101
    }
102
}
103
104
function kumbiaInit() {
105
    WorkerTimer::init();
106
107
    Kumbia\ActiveRecord\Db::get();
108
}
109