Variable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A dump() 0 2 1
A __construct() 0 9 3
A link() 0 2 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;
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);
0 ignored issues
show
Bug introduced by
The function kprint_r was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
    return /** @scrutinizer ignore-call */ kprint_r($this->value, TRUE, $this->name);
Loading history...
36
  }
37
38
  public function link() {
39
    return l($this->name, "/admin/reports/qa/variable/{$this->name}");
0 ignored issues
show
Bug introduced by
The function l was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
    return /** @scrutinizer ignore-call */ l($this->name, "/admin/reports/qa/variable/{$this->name}");
Loading history...
40
  }
41
}
42