aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/demo/plugins/resource.mysqls.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/smarty/smarty/demo/plugins/resource.mysqls.php')
-rw-r--r--vendor/smarty/smarty/demo/plugins/resource.mysqls.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/vendor/smarty/smarty/demo/plugins/resource.mysqls.php b/vendor/smarty/smarty/demo/plugins/resource.mysqls.php
index d85aecf31..148a8dd61 100644
--- a/vendor/smarty/smarty/demo/plugins/resource.mysqls.php
+++ b/vendor/smarty/smarty/demo/plugins/resource.mysqls.php
@@ -14,25 +14,39 @@
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
* Demo data:
- * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
+ * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello
+ * world"}{$x}');</pre>
+ *
*
* @package Resource-examples
* @author Rodney Rehm
*/
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
{
- // PDO instance
+ /**
+ * PDO instance
+ *
+ * @var \PDO
+ */
protected $db;
- // prepared fetch() statement
+ /**
+ * prepared fetch() statement
+ *
+ * @var \PDOStatement
+ */
protected $fetch;
+ /**
+ * Smarty_Resource_Mysqls constructor.
+ *
+ * @throws \SmartyException
+ */
public function __construct()
{
try {
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
- }
- catch (PDOException $e) {
+ } catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
@@ -41,9 +55,9 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
/**
* Fetch a template and its modification time from database
*
- * @param string $name template name
- * @param string $source template source
- * @param integer $mtime template modification timestamp (epoch)
+ * @param string $name template name
+ * @param string $source template source
+ * @param integer $mtime template modification timestamp (epoch)
*
* @return void
*/