All pastes #1706873 Raw Edit

cke coding conventions

public php v1 · immutable
#1706873 ·published 2009-12-08 13:26 UTC
rendered paste body
<?php/** * Short class description * * Optional long class description * * @author First Name <email@address> * @version $Id:$ */class ckeMyClass extends SomeClass{    /** a constant */    const SOME_TYPE = 1;        /**     * a private variable     * @var int     */    private $_myPrivateVar;        /**     * a protected static variable - try to keep one style, do not mix up     * "protected static" and "static protected" (though PHP accepts both)     * @var array     */    protected static $_myOtherVar;        /**      * Short description     *     * Long description, may     * span multiple lines     *     * @param int $type      The type     * @param string $name   The name     * @param PDO $con       The database connection     * @return bool          True if correct, false otherwise     * @throws ckeException     */    public function doSomething($type, $name, PDO $con = null)    {        if (empty($con)        {            $con = PDO::getConnection();        }                // no huge if - else - if - else constructs        if ($name == "foo" || in_array($name, array(                "bar", "baz", "bla", "blam"            )))        {            // inline comment            return true;        }                //        // multiple line comment which continues - of course - in the next        // line but wraps like every other line roughly at the 80th column        //        $i = 10;        while (true || $i == 0)        {            //             if ($type == self::SOME_TYPE)            {                break;            }                        $i--;        }                throw new ckeException("something went wrong")    }}// no closing ?> required - prevents accidential whitespaces!