GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SetXMLPropertyTask::setValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @file
5
 * Contains SetXMLPropertyTask.
6
 */
7
8
require_once 'phing/Task.php';
9
10
/**
11
 * A Phing task to set the value of an XML element attribute.
12
 */
13
class SetXMLPropertyTask extends Task {
14
15
  /**
16
   * The XML file path.
17
   *
18
   * @var string
19
   */
20
  protected $file;
21
22
  /**
23
   * The XPath query for the element to change.
24
   *
25
   * @var string
26
   */
27
  protected $element;
28
29
  /**
30
   * The attribute to change.
31
   *
32
   * @var string
33
   */
34
  protected $attribute;
35
36
  /**
37
   * The value to set.
38
   *
39
   * @var string
40
   */
41
  protected $value;
42
43
  /**
44
   * Sets the XML file path.
45
   *
46
   * @param string $file
47
   *   The XML file path.
48
   */
49
  public function setFile($file) {
50
    $this->file = $file;
51
  }
52
53
  /**
54
   * Sets the XPath element query.
55
   *
56
   * @param string $element
57
   *   The XPath element query.
58
   */
59
  public function setElement($element) {
60
    $this->element = $element;
61
  }
62
63
  /**
64
   * Sets the attribute to change.
65
   *
66
   * @param string $attribute
67
   *   The attribute to change.
68
   */
69
  public function setAttribute($attribute) {
70
    $this->attribute = $attribute;
71
  }
72
73
  /**
74
   * Sets the value to set.
75
   *
76
   * @param string $value
77
   *   The value to set.
78
   */
79
  public function setValue($value) {
80
    $this->value = $value;
81
  }
82
83
  /**
84
   * {@inheritdoc}
85
   */
86
  public function main() {
87
    $doc = new DOMDocument();
88
    $doc->load($this->file);
89
90
    (new DOMXPath($doc))
91
      ->query($this->element)
92
      ->item(0)
93
      ->setAttribute($this->attribute, $this->value);
94
95
    $doc->save($this->file);
96
  }
97
98
}
99