When contributing to SmartyBundle you should follow the standards defined in the PSR-0, PSR-1 and PSR-2. documents.
Here’s a short example:
<?php
/**
* This file is part of NoiseLabs-SmartyBundle
*
* NoiseLabs-SmartyBundle is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* NoiseLabs-SmartyBundle is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with NoiseLabs-SmartyBundle; if not, see
* <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2011-2013 Vítor Brandão
*
* @category NoiseLabs
* @package SmartyBundle
* @author Vítor Brandão <vitor@noiselabs.org>
* @copyright (C) 2011-2013 Vítor Brandão <vitor@noiselabs.org>
* @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3
* @link http://www.noiselabs.org
*/
namespace NoiseLabs\Bundle\SmartyBundle;
/**
* This class provides X.
*
* @author John Doe <john@example.com>
*/
class FooBar
{
const SOME_CONST = 42;
private $fooBar;
/**
* @param string $dummy Some argument description
*/
public function __construct($dummy)
{
$this->fooBar = $this->transformText($dummy);
}
/**
* @param string $dummy Some argument description
* @return string|null Transformed input
*/
private function transformText($dummy, $options = array())
{
$mergedOptions = array_merge($options, array(
'some_default' => 'values',
));
if (true === $dummy) {
return;
}
if ('string' === $dummy) {
if ('values' === $mergedOptions['some_default']) {
$dummy = substr($dummy, 0, 5);
} else {
$dummy = ucwords($dummy);
}
}
return $dummy;
}
}
Vítor Brandão - vitor@noiselabs.org ~ twitter.com/noiselabs ~ blog.noiselabs.org
See also the list of contributors who participated in this project.