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.
Completed
Push — master ( 75c075...24724c )
by Rudie
02:13
created

RegexTargetConfigJsonListener::startDocument()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace rdx\jsonpathstreamer;
4
5
use rdx\jsonpathstreamer\PathAwareJsonListener;
6
7
abstract class RegexTargetConfigJsonListener extends PathAwareJsonListener {
8
9
	protected $regexes = [];
10
11
	/**
12
	 *
13
	 */
14
	public function __construct() {
15
		parent::__construct();
16
17
		$this->regexes = $this->getRules();
18
	}
19
20
	/**
21
	 * Implements PathAwareJsonListener::gotPath().
22
	 */
23
	public function gotPath(array $path) {
24
		// Ignore empty non-scalars
25
	}
26
27
	/**
28
	 * Implements PathAwareJsonListener::gotValue().
29
	 */
30
	public function gotValue(array $path, $value) {
31
		foreach ($this->regexes as $regex => $target) {
32
			$pathString = implode($this->separator, $path);
33
			if (($targetString = preg_replace($regex, $target, $pathString)) != $pathString) {
34
				$target = explode($this->separator, $targetString);
35
				return $this->rememberValue($target, $value);
36
			}
37
		}
38
	}
39
40
	/**
41
	 * Get the configured rules: regexes of savable paths.
42
	 *
43
	 * @return array
44
	 */
45
	abstract public function getRules();
46
47
}
48