Skip to content

Commit

Permalink
0.9.1
Browse files Browse the repository at this point in the history
`registerPlugin()` - fixed declaration
`TemplateInterface` - added PLUGIN types
`Config->set()` - fixed method
  • Loading branch information
Karel Wintersky committed Mar 10, 2024
1 parent 2004b96 commit 463882b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function set($keys, $value = null)
return $this;
}

$this->options = $value;
$this->options[$keys] = $value;
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public function setForceCompile(bool $force_compile):Template
* @param int $type
* @param string $name
* @param $callback
* @param $cacheable
* @param bool $cacheable
* @param $cache_attr
* @return $this
* @throws SmartyException
*/
public function registerPlugin(int $type, string $name, $callback, $cacheable = true, $cache_attr = null):Template
public function registerPlugin(string $type, string $name, $callback, bool $cacheable = true, $cache_attr = null):Template
{
if (!\is_callable($callback)) {
throw new SmartyException("Plugin '{$name}' not callable");
Expand Down
8 changes: 7 additions & 1 deletion src/TemplateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ interface TemplateInterface
const INDEX_PLUGIN_CACHEABLE = 3;
const INDEX_PLUGIN_CACHEATTR = 4;

const PLUGIN_FUNCTION = 'function';
const PLUGIN_BLOCK = 'block';
const PLUGIN_COMPILER = 'compiler';
const PLUGIN_MODIFIER = 'modifier';
const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';

const CONTENT_TYPE_RSS = 'rss';
const CONTENT_TYPE_JSON = 'json';
const CONTENT_TYPE_HTML = 'html';
Expand All @@ -35,7 +41,7 @@ public function setCompileDir(string $dir):Template;

public function setForceCompile(bool $force_compile):Template;

public function registerPlugin(int $type, string $name, $callback, $cacheable = true, $cache_attr = null):Template;
public function registerPlugin(string $type, string $name, $callback, bool $cacheable = true, $cache_attr = null):Template;

public function setConfigDir(string $config_dir):Template;

Expand Down

0 comments on commit 463882b

Please sign in to comment.