Skip to content

Commit 19b45b1

Browse files
committed
Updating the docs browser.
1 parent 60acef2 commit 19b45b1

2 files changed

Lines changed: 39 additions & 15 deletions

File tree

docgen/src/Processor.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,19 @@ private function scanFile() {
7777
}
7878
else if ($this->blocks[$i]->isMethod)
7979
{
80-
$this->methods[] = new Method($this->blocks[$i]);
80+
$tempMethod = new Method($this->blocks[$i]);
81+
$this->methods[$tempMethod->name] = $tempMethod;
8182
}
8283
else if ($this->blocks[$i]->isProperty)
8384
{
84-
$this->properties[] = new Property($this->blocks[$i]);
85+
$tempProperty = new Property($this->blocks[$i]);
86+
$this->properties[$tempProperty->name] = $tempProperty;
8587
}
8688
}
8789

90+
// Alphabetically sort the arrays based on the key
91+
ksort($this->methods);
92+
8893
}
8994

9095
public function getConstsArray()

docgen/view.php

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
<?php
2+
3+
$src = "loader/Cache";
4+
$method = null;
5+
$property = null;
6+
27
if (isset($_GET['src']))
38
{
4-
$srcfile = $_GET['src'];
9+
$src = $_GET['src'];
510
}
6-
else
11+
12+
if (isset($_GET['method']))
713
{
8-
$srcfile = "loader/Cache";
14+
$method = $_GET['method'];
15+
}
16+
17+
if (isset($_GET['property']))
18+
{
19+
$property = $_GET['property'];
920
}
1021

1122
require 'src/Block.php';
@@ -17,7 +28,7 @@
1728
require 'src/ReturnType.php';
1829
require 'src/Processor.php';
1930

20-
$data = new Processor("../src/" . $srcfile . ".js");
31+
$data = new Processor("../src/" . $src . ".js");
2132
?>
2233
<!doctype html>
2334
<html>
@@ -40,7 +51,16 @@
4051
</head>
4152
<body>
4253

43-
<h1><?php echo $srcfile ?></h1>
54+
<h1><?php echo $src ?></h1>
55+
56+
<?php
57+
if ($method)
58+
{
59+
echo "<pre>";
60+
print_r($data->methods[$method]->getArray());
61+
echo "</pre>";
62+
}
63+
?>
4464

4565
<h2>Constants</h2>
4666

@@ -58,10 +78,9 @@
5878

5979
<ul>
6080
<?php
61-
for ($i = 0; $i < count($data->methods); $i++)
81+
foreach ($data->methods as $methodName => $method)
6282
{
63-
$method = $data->methods[$i];
64-
echo "<li>{$method->name}</li>";
83+
echo "<li><a href=\"view.php?src=$src&amp;method={$method->name}\">{$method->name}</a></li>";
6584
}
6685
?>
6786
</ul>
@@ -70,11 +89,11 @@
7089

7190
<ul>
7291
<?php
73-
for ($i = 0; $i < count($data->properties); $i++)
74-
{
75-
$property = $data->properties[$i];
76-
echo "<li>{$property->name}</li>";
77-
}
92+
// for ($i = 0; $i < count($data->properties); $i++)
93+
// {
94+
// $property = $data->properties[$i];
95+
// echo "<li><a href=\"view.php?src=$src&amp;property={$property->name}\">{$property->name}</a></li>";
96+
// }
7897
?>
7998
</ul>
8099

0 commit comments

Comments
 (0)