Clean up comments, standardize whitespace.

This commit is contained in:
Justin Hileman
2013-09-18 23:49:44 -07:00
parent 0d161cc7d2
commit cb2a6b5a03
13 changed files with 98 additions and 64 deletions
+5 -3
View File
@@ -20,7 +20,8 @@ interface Mustache_Cache
/**
* Load a compiled Mustache_Template class from cache.
*
* @param string $key
* @param string $key
*
* @return boolean indicates successfully class load
*/
public function load($key);
@@ -28,8 +29,9 @@ interface Mustache_Cache
/**
* Cache and load a compiled Mustache_Template class.
*
* @param string $key
* @param string $value
* @param string $key
* @param string $value
*
* @return void
*/
public function cache($key, $value);
+17
View File
@@ -20,11 +20,21 @@ abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
{
private $logger = null;
/**
* Get the current logger instance.
*
* @return Mustache_Logger|Psr\Log\LoggerInterface
*/
public function getLogger()
{
return $this->logger;
}
/**
* Set a logger instance.
*
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
*/
public function setLogger($logger = null)
{
if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
@@ -34,6 +44,13 @@ abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
$this->logger = $logger;
}
/**
* Add a log record if logging is enabled.
*
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
*/
protected function log($level, $message, array $context = array())
{
if (isset($this->logger)) {
+19 -13
View File
@@ -27,8 +27,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
/**
* Filesystem cache constructor.
*
* @param string $baseDir Directory for compiled templates.
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask.
* @param string $baseDir Directory for compiled templates.
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask.
*/
public function __construct($baseDir, $fileMode = null)
{
@@ -39,7 +39,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
/**
* Load the class from cache using `require_once`.
*
* @param string $key
* @param string $key
*
* @return boolean
*/
public function load($key)
@@ -57,8 +58,9 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
/**
* Cache and load the compiled class
*
* @param string $key
* @param string $value
* @param string $key
* @param string $value
*
* @return void
*/
public function cache($key, $value)
@@ -79,7 +81,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
* Build the cache filename.
* Subclasses should override for custom cache directory structures.
*
* @param string $name
* @param string $name
*
* @return string
*/
protected function getCacheFilename($name)
@@ -90,10 +93,11 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
/**
* Create cache directory
*
* @param string $fileName
* @return string
*
* @throws Mustache_Exception_RuntimeException If unable to create directory
*
* @param string $fileName
*
* @return string
*/
private function buildDirectoryForFilename($fileName)
{
@@ -110,17 +114,19 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
}
}
return $dirName;
}
/**
* Write cache file
*
* @param string $fileName
* @param string $value
* @return void
*
* @throws Mustache_Exception_RuntimeException If unable to write file
*
* @param string $fileName
* @param string $value
*
* @return void
*/
private function writeFile($fileName, $value)
{
+5 -3
View File
@@ -20,7 +20,8 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
/**
* Loads nothing. Move along.
*
* @param string $key
* @param string $key
*
* @return boolean
*/
public function load($key)
@@ -31,8 +32,9 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
/**
* Loads the compiled Mustache Template class without caching.
*
* @param string $key
* @param string $compiled
* @param string $key
* @param string $compiled
*
* @return void
*/
public function cache($key, $compiled)
+5 -5
View File
@@ -53,7 +53,7 @@ class Mustache_Engine
* 'template_class_prefix' => '__MyTemplates_',
*
* // A Mustache cache instance or a cache directory string for compiled templates.
* // Mustache will not cache templates unless this is set
* // Mustache will not cache templates unless this is set.
* 'cache' => dirname(__FILE__).'/tmp/cache/mustache',
*
* // Override default permissions for cache files. Defaults to using the system-defined umask. It is
@@ -172,7 +172,7 @@ class Mustache_Engine
* @see Mustache_Template::render
*
* @param string $template
* @param mixed $context (default: array())
* @param mixed $context (default: array())
*
* @return string Rendered template
*/
@@ -689,9 +689,9 @@ class Mustache_Engine
/**
* Add a log record if logging is enabled.
*
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
*/
private function log($level, $message, array $context = array())
{
+19 -10
View File
@@ -44,7 +44,8 @@ interface Mustache_Logger
* System is unusable.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function emergency($message, array $context = array());
@@ -56,7 +57,8 @@ interface Mustache_Logger
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function alert($message, array $context = array());
@@ -67,7 +69,8 @@ interface Mustache_Logger
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function critical($message, array $context = array());
@@ -77,7 +80,8 @@ interface Mustache_Logger
* be logged and monitored.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function error($message, array $context = array());
@@ -89,7 +93,8 @@ interface Mustache_Logger
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function warning($message, array $context = array());
@@ -98,7 +103,8 @@ interface Mustache_Logger
* Normal but significant events.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function notice($message, array $context = array());
@@ -109,7 +115,8 @@ interface Mustache_Logger
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function info($message, array $context = array());
@@ -118,7 +125,8 @@ interface Mustache_Logger
* Detailed debug information.
*
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function debug($message, array $context = array());
@@ -126,9 +134,10 @@ interface Mustache_Logger
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @param array $context
*
* @return null
*/
public function log($level, $message, array $context = array());
+8 -8
View File
@@ -24,7 +24,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* System is unusable.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function emergency($message, array $context = array())
{
@@ -38,7 +38,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function alert($message, array $context = array())
{
@@ -51,7 +51,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function critical($message, array $context = array())
{
@@ -63,7 +63,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* be logged and monitored.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function error($message, array $context = array())
{
@@ -77,7 +77,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function warning($message, array $context = array())
{
@@ -88,7 +88,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* Normal but significant events.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function notice($message, array $context = array())
{
@@ -101,7 +101,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function info($message, array $context = array())
{
@@ -112,7 +112,7 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
* Detailed debug information.
*
* @param string $message
* @param array $context
* @param array $context
*/
public function debug($message, array $context = array())
{
+12 -12
View File
@@ -66,7 +66,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
*
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
*
* @param integer $level The minimum logging level which will be written
* @param integer $level The minimum logging level which will be written
*/
public function setLevel($level)
{
@@ -92,9 +92,9 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
*
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @param array $context
*/
public function log($level, $message, array $context = array())
{
@@ -113,9 +113,9 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present.
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened.
*
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
*/
protected function writeLog($level, $message, array $context = array())
{
@@ -140,7 +140,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
*
* @throws InvalidArgumentException if the logging level is unknown.
*
* @param integer $level
* @param integer $level
*
* @return string
*/
@@ -152,9 +152,9 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
/**
* Format a log line for output.
*
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
*
* @return string
*/
@@ -170,8 +170,8 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
/**
* Interpolate context values into the message placeholders.
*
* @param string $message
* @param array $context
* @param string $message
* @param array $context
*
* @return string
*/
+3 -3
View File
@@ -40,7 +40,7 @@ class Mustache_Parser
* @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered.
*
* @param array &$tokens Set of Mustache tokens
* @param array $parent Parent token (default: null)
* @param array $parent Parent token (default: null)
*
* @return array Mustache Token parse tree
*/
@@ -121,8 +121,8 @@ class Mustache_Parser
*
* Returns a whitespace token for indenting partials, if applicable.
*
* @param array $nodes Parsed nodes.
* @param array $tokens Tokens to be parsed.
* @param array $nodes Parsed nodes.
* @param array $tokens Tokens to be parsed.
*
* @return array Resulting indent token, if any.
*/
+3 -3
View File
@@ -158,9 +158,9 @@ abstract class Mustache_Template
*
* Invoke the value if it is callable, otherwise return the value.
*
* @param mixed $value
* @param Mustache_Context $context
* @param string $indent
* @param mixed $value
* @param Mustache_Context $context
* @param string $indent
*
* @return string
*/
@@ -42,7 +42,6 @@ EOS;
$tpl = $m->loadTemplate($src);
$data = new Mustache_Test_Functional_ClassWithLambda();
$this->assertEquals($expected, $tpl->render($data));
}
@@ -73,7 +73,6 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
);
}
/**
* @group wip
* @dataProvider strictCallables
@@ -49,9 +49,9 @@ class Mustache_Test_Logger_TestLogger extends Mustache_Logger_AbstractLogger
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param mixed $level
* @param string $message
* @param array $context
* @param array $context
*/
public function log($level, $message, array $context = array())
{