diff --git a/src/Mustache/Cache.php b/src/Mustache/Cache.php index f1c3347..6387872 100644 --- a/src/Mustache/Cache.php +++ b/src/Mustache/Cache.php @@ -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); diff --git a/src/Mustache/Cache/AbstractCache.php b/src/Mustache/Cache/AbstractCache.php index 23977c0..9ee7157 100644 --- a/src/Mustache/Cache/AbstractCache.php +++ b/src/Mustache/Cache/AbstractCache.php @@ -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)) { diff --git a/src/Mustache/Cache/FilesystemCache.php b/src/Mustache/Cache/FilesystemCache.php index e2b353b..a15ef61 100644 --- a/src/Mustache/Cache/FilesystemCache.php +++ b/src/Mustache/Cache/FilesystemCache.php @@ -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) { diff --git a/src/Mustache/Cache/NoopCache.php b/src/Mustache/Cache/NoopCache.php index 87b5649..0056de0 100644 --- a/src/Mustache/Cache/NoopCache.php +++ b/src/Mustache/Cache/NoopCache.php @@ -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) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index b8b4db3..d03d479 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -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()) { diff --git a/src/Mustache/Logger.php b/src/Mustache/Logger.php index d0ed1da..3874bba 100644 --- a/src/Mustache/Logger.php +++ b/src/Mustache/Logger.php @@ -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()); diff --git a/src/Mustache/Logger/AbstractLogger.php b/src/Mustache/Logger/AbstractLogger.php index e0872bf..44f99d3 100644 --- a/src/Mustache/Logger/AbstractLogger.php +++ b/src/Mustache/Logger/AbstractLogger.php @@ -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()) { diff --git a/src/Mustache/Logger/StreamLogger.php b/src/Mustache/Logger/StreamLogger.php index 8955108..c79e6cb 100644 --- a/src/Mustache/Logger/StreamLogger.php +++ b/src/Mustache/Logger/StreamLogger.php @@ -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 */ diff --git a/src/Mustache/Parser.php b/src/Mustache/Parser.php index c624f9e..227e00b 100644 --- a/src/Mustache/Parser.php +++ b/src/Mustache/Parser.php @@ -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. */ diff --git a/src/Mustache/Template.php b/src/Mustache/Template.php index 4ca3e27..8c76916 100644 --- a/src/Mustache/Template.php +++ b/src/Mustache/Template.php @@ -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 */ diff --git a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php index 647905f..5d9e4d1 100644 --- a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php +++ b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php @@ -42,7 +42,6 @@ EOS; $tpl = $m->loadTemplate($src); - $data = new Mustache_Test_Functional_ClassWithLambda(); $this->assertEquals($expected, $tpl->render($data)); } diff --git a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php index 87edf0d..39b5dd9 100644 --- a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php +++ b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php @@ -73,7 +73,6 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra ); } - /** * @group wip * @dataProvider strictCallables diff --git a/test/Mustache/Test/Logger/AbstractLoggerTest.php b/test/Mustache/Test/Logger/AbstractLoggerTest.php index f45bee4..2b66948 100644 --- a/test/Mustache/Test/Logger/AbstractLoggerTest.php +++ b/test/Mustache/Test/Logger/AbstractLoggerTest.php @@ -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()) {