Forums / General / PHP Code beautify

PHP Code beautify

Author Message

Tobias Struckmeier

Friday 16 February 2007 8:42:16 am

Waterproof released their nice PHP Code beautifier also as Linux version.
You can fetch it from http://www.waterproof.fr/products/phpCodeBeautifier/
It is really helpful.

I made a tiny shell script that uses it to match with the eZ coding style ( usefull for network etc ).

#!/bin/bash
./phpCB -space-before-end-bracket \
                -space-after-start-bracket \
                -space-after-end-angle-bracket \
                -extra-padding-for-case-statement \
                -one-true-brace-function-declaration \
                -change-shell-comment-to-double-slashes-comment \
                -force-large-php-code-tag \
                -force-true-false-null-contant-lowercase \
                --comment-rendering-style PHPDoc \
                --equal-align-position 50 \
                --padding-char-count 4 \
                $1

I thought you might find that useful. Here an idea how to check coding style:

./beautify ugly.php > beauty.php && diff --side-by-side ugly.php beauty.php

Because it is still just a computer programm, it helps but might also have disadvantages in specific situations.

kracker (the)

Saturday 17 February 2007 3:38:41 am

A simple way to cleanup php code
(in your module, extension, etc)
to meet the eZ publish php code standard!

Hey that's pretty neat!

//kracker

Member since: 2001.07.13 || http://ezpedia.se7enx.com/