We've got a tree traversal loop running which identifies PHP files all well and good, but for each file we run PHP's FileReflection
against it which requires the file to be included first. For the purpose of this script, we're only interested in files that contain Class
, Interface
or Function
declarations.
Is there a way to identify whether a file includes a Class
, Interface
or Function
declaration before running include()
on it?
My guess is that it'll have to be a regex against the get_file_contents()
value, but I was hoping for a more elegant (read: consistent and reliable) solution.