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/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 20:57:42
Script start
Timing: Jan 18 2025 20:57:42
Module start 'layout'
Timing: Jan 18 2025 20:57:42
Module start 'content'
Timing: Jan 18 2025 20:57:43
Module end 'content'
Timing: Jan 18 2025 20:57:43
Script end

Main resources:

Total runtime1.0126 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.7891152.6094
Module start 'layout' 0.00510.0032 740.398439.4141
Module start 'content' 0.00841.0027 779.8125535.6953
Module end 'content' 1.01100.0015 1,315.50788.1875
Script end 1.0125  1,323.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2982160.0002
Check MTime0.00120.1202160.0001
Mysql Total
Database connection0.00120.116210.0012
Mysqli_queries0.962895.0889540.0178
Looping result0.00060.0579520.0000
Template Total0.977196.520.4886
Template load0.00230.225520.0011
Template processing0.974896.271420.4874
Template load and register function0.00010.013310.0001
states
state_id_array0.00160.155010.0016
state_identifier_array0.00150.147420.0007
Override
Cache load0.00190.1843190.0001
Sytem overhead
Fetch class attribute can translate value0.00080.076420.0004
Fetch class attribute name0.00130.127340.0003
XML
Image XML parsing0.00110.110720.0006
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00200.1971240.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs