forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParameter.php
More file actions
38 lines (30 loc) · 1.02 KB
/
Copy pathParameter.php
File metadata and controls
38 lines (30 loc) · 1.02 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
<?php
class Parameter
{
public $name; // rect, copy, etc
public $types = []; // an array containing all possible types it can be: string, number, etc
public $help = [];
public $optional = false;
public $default = false; // assigned value is the default value
public function __construct($line)
{
preg_match("/.*(@param)\s?{(\S*)} (\S*)( - ?)?(.*)/", $line, $output);
$this->types = explode('|', $output[2]);
$this->help = $output[5];
$name = $output[3];
if ($name[0] === '[')
{
$this->optional = true;
$name = substr($name, 1, -1);
// Default?
$equals = strpos($name, '=');
if ($equals > 0)
{
$name = substr($name, 0, $equals - 1);
$this->default = substr($name, $equals + 1);
}
}
$this->name = $name;
}
}
?>