Completed
Push — 7.x-1.x ( 2f9e3c...1070be )
by Frédéric G.
01:36
created

Variable   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A dump() 0 3 1
A link() 0 3 1
1
<?php
2
/**
3
 * @file
4
 * Variable.php
5
 *
6
 * @author: Frédéric G. MARAND <[email protected]>
7
 *
8
 * @copyright (c) 2014 Ouest Systèmes Informatiques (OSInet).
9
 *
10
 * @license General Public License version 2 or later
11
 */
12
13
namespace Drupal\qa\Plugin\Qa\Control\Variable;
14
15
16
class Variable {
17
  public $is_set;
18
  public $name;
19
  public $value;
20
  public $default;
21
22
  public function __construct($name) {
23
    $this->name = $name;
24
    $this->is_set = isset($GLOBALS['conf'][$name]);
25
    if ($this->is_set) {
26
      $this->value = $GLOBALS['conf'][$name];
27
    }
28
29
    if (function_exists('variable_get_default')) {
30
      $this->default = variable_get_default($name);
31
    }
32
  }
33
34
  public function dump() {
35
    return kprint_r($this->value, TRUE, $this->name);
36
  }
37
38
  public function link() {
39
    return l($this->name, "admin/reports/qa/variable/{$this->name}");
40
  }
41
}
42