@@ -172,18 +172,16 @@ private function scanFile() {
172172
173173 }
174174
175- public function __toString ()
175+ public function getPublicProperties ()
176176 {
177- if ($ this ->corrupted )
178- {
179- return "JSDoc Corrupted Class " ;
180- }
181- else
182- {
183- return "Class: " . $ this ->class ->name . ", Methods: " . count ($ this ->methods ['public ' ]);
184- }
177+ return $ this ->properties ['public ' ];
185178 }
186-
179+
180+ public function getPublicMethods ()
181+ {
182+ return $ this ->methods ['public ' ];
183+ }
184+
187185 public function getArray ()
188186 {
189187 $ consts = [];
@@ -233,23 +231,63 @@ public function getConstsArray()
233231
234232 public function extend ()
235233 {
236- // Need to iterate through all of the classes this may extend from, in order, and build it up
234+ // Quick bailout
235+ if (!$ this ->class ->extendsFrom ())
236+ {
237+ echo "quick bailout \n" ;
238+ return ;
239+ }
237240
238241 $ proc = $ this ;
239- $ parents = [];
240242
241- // while ($proc->class->extendsFrom)
242- // {
243- // $parents[$proc->class->name] = $proc->getArray();
244- // $proc = $this->docgen->get();
243+ do
244+ {
245+ $ extends = $ proc ->class ->extends ;
246+ $ proc = $ this ->docgen ->get ($ extends );
247+ echo "\n\nextend found: " . $ proc ->getName () . "\n" ;
248+
249+ $ this ->merge ($ proc );
250+ }
251+ while ($ proc ->class ->extendsFrom ());
252+
253+ }
254+
255+ public function merge ($ processor )
256+ {
257+ echo "Merging ... \n\n" ;
258+
259+ // We only want to merge in public methods and properties.
260+ // Technically JavaScript merges in bloody everything, but for the sake of docs we'll keep them #public# only.
261+
262+ echo "Methods \n" ;
263+ echo "------- \n" ;
245264
246- // }
265+ $ inheritedMethods = $ processor -> getPublicMethods ();
247266
248- // Is there anything to extend anyway?
249- if ($ this -> class -> extendsFrom )
267+ // Flag them as inherited!
268+ foreach ($ inheritedMethods as $ key => $ method )
250269 {
270+ echo $ method ->name . "\n" ;
271+ $ method ->inherited = true ;
272+ }
273+
274+ $ this ->methods ['public ' ] = array_merge ($ this ->methods ['public ' ], $ inheritedMethods );
275+
276+ echo "\n" ;
277+ echo "Properties \n" ;
278+ echo "---------- \n" ;
251279
280+ $ inheritedProperties = $ processor ->getPublicProperties ();
281+
282+ // Flag them as inherited!
283+ foreach ($ inheritedProperties as $ key => $ property )
284+ {
285+ echo $ property ->name . "\n" ;
286+ $ property ->inherited = true ;
252287 }
288+
289+ $ this ->properties ['public ' ] = array_merge ($ this ->properties ['public ' ], $ inheritedProperties );
290+
253291 }
254292
255293 /**
@@ -273,5 +311,23 @@ public function getLog() {
273311
274312 }
275313
314+ public function getName () {
315+
316+ return $ this ->class ->name ;
317+
318+ }
319+
320+ public function __toString ()
321+ {
322+ if ($ this ->corrupted )
323+ {
324+ return "JSDoc Corrupted Class " ;
325+ }
326+ else
327+ {
328+ return "Class: " . $ this ->class ->name . ", Methods: " . count ($ this ->methods ['public ' ]) . ", Properties: " . count ($ this ->properties ['public ' ]) . "\n" ;
329+ }
330+ }
331+
276332 }
277333?>
0 commit comments