Zend Framework coding standards on one page http://raphaelstolt.blogspot.com

fishhookFladgeInternet and Web Development

Dec 13, 2013 (3 years and 7 months ago)

77 views

Zend Framework coding standards on one page
http://raphaelstolt.blogspot.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]
*/
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.';

$sql = "SELECT `id`, `name` FROM `people` "
. "WHERE `name` = 'John Doe'";

$indexed = array(1, 2, 3, 4);
$indexedMultiline = array(1, 2, 3, 4,
'John', 'Doe');
$associative = array('first’

=> 'ab',
'second' => 'cd');
try.{
$this->_exampleMethod($indexed, 'ab', 3);
}.catch.(Exception $e).{
throw new Exception($e->getMessage());
}
}


/**
* 'Method-level' PHPDoc Block accessors/mutators
*/
public function
get
|
set
ListOfElements(|array $list)
{
// access/mutate
}

// Class Filename: Cs/Example/Xyz.php
// Interface Filename: Cs/Example/
Interface
.php
















































































camelCaps