Explorar o código

Fixed initialization for template and partials to avoid thunking defaults added by subclasses.

Justin Hileman %!s(int64=16) %!d(string=hai) anos
pai
achega
e7058fc1d5
Modificáronse 1 ficheiros con 6 adicións e 9 borrados
  1. 6 9
      Mustache.php

+ 6 - 9
Mustache.php

@@ -18,9 +18,9 @@ class Mustache {
 	public $ctag = '}}';
 	protected $tagRegEx;
 
-	protected $template;
-	protected $context;
-	protected $partials;
+	protected $template = '';
+	protected $context  = array();
+	protected $partials = array();
 
 	/**
 	 * Mustache class constructor.
@@ -35,12 +35,9 @@ class Mustache {
 	 * @return void
 	 */
 	public function __construct($template = null, $view = null, $partials = null) {
-		$this->template = $template;
-		$this->partials = $partials;
-
-		if ($view) {
-			$this->context = array($view);
-		}
+		if ($template !== null) $this->template = $template;
+		if ($partials !== null) $this->partials = $partials;
+		if ($view !== null)     $this->context = array($view);
 	}
 
 	/**