开发者

how to generate array that shows reletionship between multiple classes?

I want a PHP script that scans PHP classes files in given directory(sub directories too) and generate relation ship between them in array form. suppose a folder that con开发者_运维技巧tains files and subdirectories( two subfolders).

| | |-class1.php
| | \-class2.php
| |-subdir1
| | |-class11.php
| | \-class22.php
| |-subdir2
| | \-class33.php

it contains total 5 files.

scanning files in directory is not big issue...but how can i deliver a class relationship between them.

i want array in this form.

array([0]=>classname=>class1,extends=>class2,implements=>[0]class11[1]class22,[1]=>classname=>class2,extends=>class33,implements=>NULL)

HINT: it can be done through reflection class.

can anyone help me?i need this script.. thanks


Extract from all the files parts of code that look like class<something but not }>{<something perhaps containing nested {}>} and eval all of those pieces of code.

I guess you will have to determine specific order in which to eval them (you might take a note which files include which to determine this order, or take a look at extends and implements)

Then use reflection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜