Skip to content

Instantly share code, notes, and snippets.

@ajaxray
Last active December 17, 2015 12:39
Show Gist options
  • Save ajaxray/5611708 to your computer and use it in GitHub Desktop.
Save ajaxray/5611708 to your computer and use it in GitHub Desktop.
This file is a demonestration for PHP Coding Standareds of WNeeds Ltd.
<?php
/*
* This file is a demonestration for PHP Coding Standareds of WNeeds Ltd.
*
* (c) WNeeds Ltd. <anis@wneeds.com>
*/
namespace Wneeds;
/**
* Coding standards demonstration.
*/
class Editor
{
const LE_UNIX = 'unix';
const LE_WIN = 'windows';
private $_sourceCode;
/**
* @var \Wneeds\One\Another
*/
protected $_anotherVar;
/**
* @param string $_sourceCode Some argument description
*/
public function __construct($sourceCodeFile)
{
$this->_sourceCode = $this->_readContent($sourceCodeFile);
}
/**
* @param string $sourceCodeFile Some argument description
* @param array $options List of allowed options
*
* @return string|null Transformed source code file
*/
private function _readContent($sourceCodeFile, $options = array())
{
$mergedOptions = array_merge(
$options,
array(
'language' => 'php',
'file_ending' => $this::LE_UNIX,
)
);
if (true === $this::LE_UNIX) {
// So something to read file
}
// Not real, just to show convensions
if ('string' == $sourceCodeFile) {
if ('values' == $mergedOptions['some_default']) {
$sourceCodeFile = substr($sourceCodeFile, 0, 5);
} else {
$sourceCodeFile = ucwords($sourceCodeFile);
}
} else {
throw new \RuntimeException(sprintf('Unrecognized $sourceCodeFile option "%s"', $sourceCodeFile));
}
return $sourceCodeFile;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment