forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethod.php
More file actions
79 lines (62 loc) · 2.08 KB
/
Copy pathMethod.php
File metadata and controls
79 lines (62 loc) · 2.08 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
class Method
{
public $line; // number, line number in the source file this is found on?
public $name; // bringToTop, kill, etc
public $parameters = []; // an array containing the parameters
public $help = [];
public $returns = false;
public $isPublic = true;
public $isProtected = false;
public $isPrivate = false;
public function getArray()
{
$a = array(
'name' => $this->name,
'returns' => $this->returns,
'help' => implode('\n', $this->help),
'line' => $this->line,
'public' => $this->isPublic,
'protected' => $this->isProtected,
'private' => $this->isPrivate,
);
return $a;
}
public function getJSON()
{
return json_encode($this->getArray());
}
public function __construct($block)
{
// Because zero offset + allowing for final line
$this->line = $block->end + 2;
$name = $block->getLine('@method');
$equals = strpos($name, '#');
if ($equals > 0)
{
$name = substr($name, $equals + 1);
}
$this->name = $name;
$params = $block->getLines('@param');
for ($i = 0; $i < count($params); $i++)
{
$this->parameters[] = new Parameter($params[$i]);
}
if ($block->getTypeBoolean('@protected'))
{
$this->isPublic = false;
$this->isProtected = true;
}
else if ($block->getTypeBoolean('@private'))
{
$this->isPublic = false;
$this->isPrivate = true;
}
$this->help = $block->cleanContent();
if ($block->getTypeBoolean('@return'))
{
$this->returns = new ReturnType($block->getLine('@return'));
}
}
}
?>