register('html_filter', function() { return new \tts\html_filter(); }); /* Contents of : on_log.php */ \tts\registry::get('di')->register('log', function(array $arg) { $file_name = null; if (isset($arg[0]) && is_string($arg[0])) { $file_name = $arg[0]; // filename } if (isset($arg[1]) && is_int($arg[1])) { $count = $arg[1]; // max count return new \tts\log($file_name, $count); } if (! empty($file_name)) { return new \tts\log($file_name); } return new \tts\log(); }); /* Contents of : on_templates.php */ \tts\registry::get('di')->register('templates', function(array $arg) { $file_type = '.tpl'; if (isset($arg[0]) && is_string($arg[0])) { $file_type = $arg[0]; } return new \tts\liquid_templates($file_type); }); /* Contents of : on_test_db.php */ \tts\registry::get('di')->register('db_mocker', function($args) { try { $conn = new \PDO('sqlite::memory:'); // set the PDO error mode to exception $conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); return $conn; } catch (\PDOException $e) { echo $e->getMessage(); } catch (\Exception $e) { echo $e->getMessage(); } });