2010-12-01 17:18


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 contains 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.


HINT: it can be done through reflection class.

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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • duan1979768678 duan1979768678 11年前

    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.

    点赞 评论 复制链接分享