ZendFramework Coding Standards On On
ZendFramework Coding Standards On On
ZendFramework Coding Standards On On
com
<?php
/**
* 'File-level' PHPDoc Block
*/
<< line length 80 characters, max. 120 characters >>
/**
* 'Class-level' PHPDoc Block
*/
class Cs_Example_Xyz
{
....const SAMPLE_FLAG = 'ab';
/**
* @var datatype [description]
*/
camelCaps
public $variableName = null;
private $_listOfElements = null;
protected $_instance = null;
/**
* A description of the method
*
* @param 1..n datatype $parametername [description]
* @return datatype
* @throws exceptionClass [description]
*/
private|protected function _exampleMethod(array $list, $two, $three)
{
....if.(count($list) > 0).{
........// do something
}.else.{
// do something
}
switch.($two).{
case self::SAMPLE_FLAG:
// do something
break;
case 'dc':
// break intentionally omitted
default:
// do something
break;
}
foreach.($list as $elementOfList).{
// do something
}
}
/**
* 'Method-level' PHPDoc Block
*/
public function bundle($name = ‘John Doe’)
{
$greeting = "Hello $name, welcome back!";
$greeting = "Hello {$name}, welcome back!";
$greetingConcatenation = $greeting . ' ' . 'Nice to see you.';
/**
* 'Method-level' PHPDoc Block accessors/mutators
*/
public function get|setListOfElements(|array $list)
{
// access/mutate
}
// Class Filename: Cs/Example/Xyz.php
// Interface Filename: Cs/Example/Interface.php