Skip to content

Commit

Permalink
Merge branch 'release/2.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Apr 14, 2014
2 parents 996c944 + 003a2ae commit 43dc945
Show file tree
Hide file tree
Showing 76 changed files with 552 additions and 604 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm

matrix:
allow_failures:
- php: hhvm # See https://github.com/facebook/hhvm/pull/1860
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License (MIT)
Copyright (c) 2010 Justin Hileman

Copyright (c) 2010-2014 Justin Hileman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Mustache.php

A [Mustache](http://mustache.github.com/) implementation in PHP.

[![Build Status](https://secure.travis-ci.org/bobthecow/mustache.php.png?branch=dev)](http://travis-ci.org/bobthecow/mustache.php)
[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg)](https://packagist.org/packages/mustache/mustache)
[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg)](http://travis-ci.org/bobthecow/mustache.php)
[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg)](https://packagist.org/packages/mustache/mustache)


Usage
Expand Down
4 changes: 2 additions & 2 deletions bin/build_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -85,7 +85,7 @@ class SymfonyClassCollectionLoader
/*
* This file is part of Mustache.php.
*
* (c) %d Justin Hileman
* (c) 2010-%d Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache/AbstractCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache/FilesystemCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache/NoopCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
19 changes: 12 additions & 7 deletions src/Mustache/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -23,7 +23,7 @@
*/
class Mustache_Engine
{
const VERSION = '2.5.1';
const VERSION = '2.6.0';
const SPEC_VERSION = '1.1.2';

const PRAGMA_FILTERS = 'FILTERS';
Expand All @@ -45,6 +45,11 @@ class Mustache_Engine
private $logger;
private $strictCallables = false;

// Services
private $tokenizer;
private $parser;
private $compiler;

/**
* Mustache class constructor.
*
Expand Down Expand Up @@ -79,12 +84,12 @@ class Mustache_Engine
* // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order
* // sections), or any other valid Mustache context value. They will be prepended to the context stack,
* // so they will be available in any template loaded by this Mustache instance.
* 'helpers' => array('i18n' => function($text) {
* 'helpers' => array('i18n' => function ($text) {
* // do something translatey here...
* }),
*
* // An 'escape' callback, responsible for escaping double-mustache variables.
* 'escape' => function($value) {
* 'escape' => function ($value) {
* return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
* },
*
Expand Down Expand Up @@ -194,7 +199,7 @@ public function render($template, $context = array())
/**
* Get the current Mustache escape callback.
*
* @return mixed Callable or null
* @return callable|null
*/
public function getEscape()
{
Expand Down Expand Up @@ -657,9 +662,9 @@ private function loadSource($source, Mustache_Cache $cache = null)
}

if (!class_exists($className, false)) {
if (!$this->getCache()->load($className)) {
if (!$cache->load($className)) {
$compiled = $this->compile($source);
$this->getCache()->cache($className, $compiled);
$cache->cache($className, $compiled);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/LogicException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 8 additions & 1 deletion src/Mustache/Exception/SyntaxException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,12 +16,19 @@ class Mustache_Exception_SyntaxException extends LogicException implements Musta
{
protected $token;

/**
* @param string $msg
* @param array $token
*/
public function __construct($msg, array $token)
{
$this->token = $token;
parent::__construct($msg);
}

/**
* @return array
*/
public function getToken()
{
return $this->token;
Expand Down
5 changes: 4 additions & 1 deletion src/Mustache/Exception/UnknownFilterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,6 +16,9 @@ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException
{
protected $filterName;

/**
* @param string $filterName
*/
public function __construct($filterName)
{
$this->filterName = $filterName;
Expand Down
5 changes: 4 additions & 1 deletion src/Mustache/Exception/UnknownHelperException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,6 +16,9 @@ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException
{
protected $helperName;

/**
* @param string $helperName
*/
public function __construct($helperName)
{
$this->helperName = $helperName;
Expand Down
5 changes: 4 additions & 1 deletion src/Mustache/Exception/UnknownTemplateException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,6 +16,9 @@ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentExcepti
{
protected $templateName;

/**
* @param string $templateName
*/
public function __construct($templateName)
{
$this->templateName = $templateName;
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/HelperCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions src/Mustache/LambdaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -38,7 +38,7 @@ public function __construct(Mustache_Engine $mustache, Mustache_Context $context
*
* @param string $string
*
* @return Rendered template.
* @return string Rendered template.
*/
public function render($string)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
3 changes: 2 additions & 1 deletion src/Mustache/Loader/ArrayLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -26,6 +26,7 @@
*/
class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader
{
private $templates;

/**
* ArrayLoader constructor.
Expand Down
6 changes: 3 additions & 3 deletions src/Mustache/Loader/CascadingLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -25,7 +25,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader
* new Mustache_Loader_FilesystemLoader(__DIR__.'/templates')
* ));
*
* @param array $loaders An array of Mustache Loader instances
* @param Mustache_Loader[] $loaders
*/
public function __construct(array $loaders = array())
{
Expand All @@ -38,7 +38,7 @@ public function __construct(array $loaders = array())
/**
* Add a Loader instance.
*
* @param Mustache_Loader $loader A Mustache Loader instance
* @param Mustache_Loader $loader
*/
public function addLoader(Mustache_Loader $loader)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of Mustache.php.
*
* (c) 2013 Justin Hileman
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
Loading

0 comments on commit 43dc945

Please sign in to comment.