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

Variable::link()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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