forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProperty.php
More file actions
59 lines (48 loc) · 1.74 KB
/
Copy pathProperty.php
File metadata and controls
59 lines (48 loc) · 1.74 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
59
<?php
class Property
{
public $line; // number, line number in the source file this is found on?
public $name; // visible, name, parent
public $types = []; // an array containing all possible types it can be: string, number, etc
public $default = false; // assigned value is the default value
public $help = [];
public $inlineHelp = '';
public $isPublic = true;
public $isProtected = false;
public $isPrivate = false;
public $isReadOnly = false;
public function __construct($block)
{
// Because zero offset + allowing for final line
$this->line = $block->end + 2;
preg_match("/(@.*){(\S*)} (\S*)( - ?)?(.*)/", $block->getLine('@property'), $output);
$this->types = explode('|', $output[2]);
$this->name = $output[3];
$this->inlineHelp = $output[5];
if ($block->getTypeBoolean('@protected'))
{
$this->isPublic = false;
$this->isProtected = true;
}
else if ($block->getTypeBoolean('@private'))
{
$this->isPublic = false;
$this->isPrivate = true;
}
// Default?
if ($block->getTypeBoolean('@default'))
{
preg_match("/= (.*);/", $block->code, $defaultType);
if ($defaultType && isset($defaultType[1]))
{
$this->default = $defaultType[1];
}
}
$this->help = $block->cleanContent();
if ($block->getTypeBoolean('@readonly'))
{
$this->isReadOnly = true;
}
}
}
?>