Raw mode

4 views
Skip to first unread message

shabbyrobe

unread,
Jan 7, 2011, 7:31:38 AM1/7/11
to PHP Addendum library
Hello, great work on this library - it's a must-have tool. The syntax
and flexibility are very nice. This is something PHP should really
support out of the box. Hopefully that RFC gets implemented.

Anyway, I was wondering what the purpose of the raw mode is - I've had
a look through the code and I can see that if raw mode is on addendum
uses its own file parsing code and when it's off it uses
Reflection.*::getDocComment(), but I was just wondering what it is
that getDocComment doesn't do. Is it a PHP version support thing or is
there something else to it?

johno

unread,
Jan 7, 2011, 7:41:27 AM1/7/11
to PHP Addendum library
Hi,

raw mode is needed when some PHP accelerators/precompilers remove
docblocks from source.

johno

shabbyrobe

unread,
Jan 7, 2011, 8:22:43 AM1/7/11
to PHP Addendum library
Cool, thanks for the quick reply. I'm just having a bit of a tinker
with the code as I quite enjoy using Addendum. I'm interested in how
it's put together.

I notice with APC 3.1.4 running on PHP 5.3, the doc blocks are
extracted fine with getDocComment, even though
checkRawDocCommentParsingNeeded resolves to true. Which accelerators
have you noticed strip the doc blocks? I'm vaguely aware that
eAccelerator does it, but do earlier versions of APC do it too?

Jan Suchal

unread,
Jan 7, 2011, 2:13:32 PM1/7/11
to addendum...@googlegroups.com
Hi,

as for architecture - thera are 2 main parts. reflection extending
classes and parser/matcher classes. I've tried to make the test
self-explanatory so if you want to know how it works in depth - start
here
http://code.google.com/p/addendum/source/browse/trunk/annotations/tests/annotation_parser_test.php?r=74

As for performance. Addendum is mainly a parsing library, I do some
caching on per request level, but further caching is not included. There
are too many options to choose from if you want to share state between
requests. Redis/memcached or even plain files just to name a few. Even
more you have to manage cache invalidation. However it is not so hard to
plug in your own caching. Maybe refactoring cache from
AnnotationsBuilder to an adapter will be a good start
http://code.google.com/p/addendum/source/browse/trunk/annotations.php?r=74#148

johno

Jan Suchal

unread,
Jan 7, 2011, 2:13:29 PM1/7/11
to addendum...@googlegroups.com
Hi,

I don't really remember but with --preserve-docs disabled there was a
problem. However here it how it works

1) It checks whether it can get docblock /** Raw mode test */ on
http://code.google.com/p/addendum/source/browse/trunk/annotations.php?r=74#340
2) It its available - we are able to get docblocks from reflection, all
good.
3) If not, raw mode parsing occurs.

johno

On 1/7/2011 2:22 PM, shabbyrobe wrote:

shabbyrobe

unread,
Jan 8, 2011, 10:53:49 AM1/8/11
to PHP Addendum library
Ahh cool, I get it now. Thanks for explaining.

What's --preserve-docs?

On Jan 8, 6:13 am, Jan Suchal <jo...@jsmf.net> wrote:
> Hi,
>
> I don't really remember but with --preserve-docs disabled there was a
> problem. However here it how it works
>
> 1) It checks whether it can get docblock /** Raw mode test */ onhttp://code.google.com/p/addendum/source/browse/trunk/annotations.php...
Reply all
Reply to author
Forward
0 new messages