wfScanEntrypoint.php
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class wfScanEntrypoint {
private $file;
private $included;
public function __construct($file, $included = false) {
$this->file = $file;
$this->included = $included;
}
public function getKey() {
return $this->file->getRealPath();
}
public function setIncluded($included = true) {
$this->included = $included;
return $this;
}
public function isIncluded() {
return $this->included;
}
public function getFile() {
return $this->file;
}
public function addTo(&$entrypoints) {
$key = $this->getKey();
if (array_key_exists($key, $entrypoints)) {
if ($this->isIncluded())
$entrypoints[$key]->setIncluded();
}
else {
$entrypoints[$key] = $this;
}
}
public static function getScannedSkippedFiles($entrypoints) {
$scanned = array();
$skipped = array();
foreach ($entrypoints as $entrypoint) {
if ($entrypoint->isIncluded()) {
$scanned[] = $entrypoint->getFile();
}
else {
$skipped[] = $entrypoint->getFile();
}
}
return array(
'scanned' => $scanned,
'skipped' => $skipped
);
}
}