Completed
Push — feature/code-analysis ( a26fec...c314d5 )
by Jonathan
07:11
created

Globals   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTree() 0 5 1
A isSearchSpider() 0 5 1
A getController() 0 5 1
A getGlobalFacts() 0 5 1
1
<?php
2
/**
3
 * webtrees-lib: MyArtJaub library for webtrees
4
 *
5
 * @package MyArtJaub\Webtrees
6
 * @author Jonathan Jaubart <[email protected]>
7
 * @copyright Copyright (c) 2015-2016, Jonathan Jaubart
8
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
9
 */
10
namespace MyArtJaub\Webtrees;
11
12
/**
13
 * Class to access global variables defined by webtrees.
14
 * This is bad practice to use global, but the core application uses it,
15
 * so this provide a way to access them.
16
 */
17
class Globals {
18
    
19
    /**
20
     * Get global $WT_TREE variable.
21
     * 
22
     * @return \Fisharebest\Webtrees\Tree|NULL
23
     */
24
    public static function getTree() {
25
        global $WT_TREE;
26
        
27
        return $WT_TREE;
28
    }
29
    
30
    /**
31
     * Check whether the visitor is a bot.
32
     * 
33
     * @return boolean
34
     */
35
    public static function isSearchSpider() {
36
        global $SEARCH_SPIDER;
37
        
38
        return $SEARCH_SPIDER;
39
    }
40
    
41
    /**
42
     * Get the current controller.
43
     * 
44
     * @return \Fisharebest\Webtrees\BaseController
45
     */
46
    public static function getController() {
47
        global $controller;
48
        
49
        return $controller;
50
    }
51
    
52
    /**
53
     * Get the global facts
54
     * 
55
     * @return array
56
     */
57
    public static function getGlobalFacts() {
58
        global $global_facts;
59
        
60
        return $global_facts;
61
    }
62
    
63
}