[Phplib-users] indent - help from phplib users?
Brought to you by:
nhruby,
richardarcher
From: Marko K. <Mar...@mc...> - 2002-09-19 09:54:55
|
Hi, I don't use PEAR myself, just phplib, but I found a hint there how to beautify existing PHP code. In the PEAR docs you can find a way how to reformat existing PHP code with the help of the tool 'indent'. On the site below "Documentation/Coding Standards/Indents" you find a call like: indent -nut -bap -br -ce -cli4 -ncs -ss -npcs -saf \ -sai -saw -nprs -bfda -psl -brs \ -lp -nbbo -hnl -i4 -ci4 Well, if you search for proper php code indention tools, it looks like there is no really 100% working possibility available at the moment! Even in PEAR's list archives there is no real help concerning this. But the indent command listed on top has its problems!!! It is known that it breaks the php tag which makes the code unusable: <?php becomes < ? php ==== As well all the array assignments get mixed up,especially in long lines, which are going to be wrapped: --- $t->set_var(array( 'SortLinkNr' => addquery($Lampen_url,'mSort=Nr'), 'SortLinkLampenname' => addquery($Lampen_url,'mSort=Lampenname'), 'SortLinkDatum' => addquery($Lampen_url,'mSort=Datum'), 'LampeFilter_url' => addquery($Experimente_url,'mLampenname=&fLampenname='), --- will result in --- $t->set_var(array('SortLinkNr' = >addquery($Lampen_url, 'mSort=Nr'), 'SortLinkLampenname' = >addquery($Lampen_url, 'mSort=Lampenname'), 'SortLinkDatum' = >addquery($Lampen_url, 'mSort=Datum'), 'LampeFilter_url' = >addquery($Experimente_url, 'mLampenname=&fLampenname='), --- One can see that all the arrows "=>" got torn apart. The ">" seems to be treated as belonging to the following word. So the wrapping of text lets it appear even stranger. This code is not going to run anymore. Any ideas how to avoid these troubles. Marko P.S.: I know that the PHP code beautifier <http://tools.phpedit.net/phpCodeBeautifier/> exists, but since it's under Windows I'd prefer something like indent, if possible. |