EditableConfig   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 50
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 3 1
A set() 0 3 1
A setData() 0 3 1
A getData() 0 3 1
A save() 0 3 1
1
<?php
2
3
namespace NuvoleWeb\Drupal\Driver\Objects\Drupal8;
4
5
use NuvoleWeb\Drupal\Driver\Objects\EditableConfigInterface;
6
7
/**
8
 * Class EditableConfig
9
 *
10
 * @package NuvoleWeb\Drupal\Driver\Objects\Drupal8
11
 */
12
class EditableConfig implements EditableConfigInterface {
13
14
  protected $config;
15
16
  /**
17
   * EditableConfig constructor.
18
   *
19
   * @param string $name
20
   *   The config name.
21
   */
22
  public function __construct($name) {
23
    $this->config = \Drupal::configFactory()->getEditable($name);
24
  }
25
26
  /**
27
   * {@inheritdoc}
28
   */
29
  public function get($key = '') {
30
    return $this->config->get($key);
31
  }
32
33
  /**
34
   * {@inheritdoc}
35
   */
36
  public function set($key, $value) {
37
    return $this->config->set($key, $value);
38
  }
39
40
  /**
41
   * {@inheritdoc}
42
   */
43
  public function setData(array $data) {
44
    return $this->config->setData($data);
45
  }
46
47
  /**
48
   * {@inheritdoc}
49
   */
50
  public function getData() {
51
    return $this->config->getRawData();
52
  }
53
54
  /**
55
   * {@inheritdoc}
56
   */
57
  public function save() {
58
    return $this->config->save();
59
  }
60
61
}
62