Skip to content

Commit f73bf70

Browse files
committed
docgen updates and preparing to parse Pixi source.
1 parent 15a0ae6 commit f73bf70

4 files changed

Lines changed: 55 additions & 7 deletions

File tree

docgen/index.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
function dirToArray($dir) {
2626

27-
$ignore = array('.', '..', 'pixi');
27+
// $ignore = array('.', '..', 'pixi');
28+
$ignore = array('.', '..');
2829
$fileIgnore = array('p2.js');
2930
$result = array();
3031
$root = scandir($dir);
@@ -51,20 +52,35 @@ function dirToArray($dir) {
5152
return $result;
5253
}
5354

54-
function displaySection($title, $files) {
55+
function displaySection($title, $files, $parent = "") {
56+
57+
if ($title === "")
58+
{
59+
echo "<h1>Phaser v2.1.1</h1>";
60+
}
61+
else
62+
{
63+
echo "<h2>$title</h2>";
64+
}
5565

56-
echo "<h2>$title</h2>";
5766
echo "<ul>";
5867

5968
foreach ($files as $key => $file)
6069
{
6170
if (is_array($file))
6271
{
63-
displaySection($key, $file);
72+
displaySection($key, $file, $title);
6473
}
6574
else
6675
{
67-
echo "<li><a href=\"view.php?src=$title/$file\">$file</a></li>";
76+
$src = $title . "/" . $file;
77+
78+
if ($parent !== "")
79+
{
80+
$src = $parent . "/" . $src;
81+
}
82+
83+
echo "<li><a href=\"view.php?src=$src\">$file</a></li>";
6884
}
6985
}
7086

@@ -75,7 +91,7 @@ function displaySection($title, $files) {
7591
$path = realpath('../src');
7692
$files = dirToArray($path);
7793

78-
displaySection("Phaser v2.1.1", $files);
94+
displaySection("", $files, "");
7995

8096
// echo "<pre>";
8197
// print_r($files);

docgen/src/Method.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Method
1212
public $isProtected = false;
1313
public $isPrivate = false;
1414

15+
public $isStatic = false;
16+
1517
public function __construct($block)
1618
{
1719
// Because zero offset + allowing for final line
@@ -25,6 +27,25 @@ public function __construct($block)
2527
{
2628
$name = substr($name, $equals + 1);
2729
}
30+
else
31+
{
32+
$equals = strrpos($name, '.');
33+
34+
if ($equals > 0)
35+
{
36+
$name = substr($name, $equals + 1);
37+
}
38+
else
39+
{
40+
// No # and no . so we'll assume "@method name" format
41+
$equals = strrpos($name, ' ');
42+
43+
if ($equals > 0)
44+
{
45+
$name = substr($name, $equals + 1);
46+
}
47+
}
48+
}
2849

2950
$this->name = $name;
3051

@@ -46,6 +67,11 @@ public function __construct($block)
4667
$this->isPrivate = true;
4768
}
4869

70+
if ($block->getTypeBoolean('@static'))
71+
{
72+
$this->isStatic = true;
73+
}
74+
4975
$this->title = array("name" => $this->name, "visibility" => $this->getVisibility());
5076

5177
$this->help = $block->cleanContent();
@@ -77,6 +103,7 @@ public function getArray()
77103
{
78104
return array(
79105
'title' => $this->title,
106+
'static' => $this->isStatic,
80107
'returns' => $this->returns,
81108
'help' => implode('\n', $this->help),
82109
'line' => $this->line,

docgen/src/Processor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ private function scanFile() {
6060
// The first element is always the opening /** so remove it
6161
array_shift($chunk);
6262

63-
$this->blocks[] = new Block($openLine, $closeLine, $js[$i + 1], $chunk);
63+
if (isset($js[$i + 1]))
64+
{
65+
$this->blocks[] = new Block($openLine, $closeLine, $js[$i + 1], $chunk);
66+
}
6467
}
6568
else
6669
{

docgen/view.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
</head>
5252
<body>
5353

54+
<a href="index.php">Index</a>
55+
5456
<h1><?php echo $src ?></h1>
5557

5658
<?php

0 commit comments

Comments
 (0)