/** * コンテナを追加 * * @param Object $container コンテナオブジェクト * @return void */ private function setContainer($container) { $container['db.get'] = function ($c) { $obj = new Get($this->pdo); $obj->setDebug(true); return $obj; }; $container['db.post'] = function ($c) { $obj = new Post($this->pdo); $obj->setDebug(true); return $obj; }; $container['db.put'] = function ($c) { $obj = new Put($this->pdo); $obj->setDebug(true); return $obj; }; $container['db.delete'] = function ($c) { $obj = new Delete($this->pdo); $obj->setDebug(true); return $obj; }; $container['mailer'] = function ($c) { $transport = new Init($GLOBALS['MAIL_HOST'], $GLOBALS['MAIL_PORT'], $GLOBALS['MAIL_USER'], $GLOBALS['MAIL_PASS']); $mailer = new Mailer($transport); $mailer->setFrom($GLOBALS['MAIL_FROM']); $mailer->setName($GLOBALS['MAIL_NAME']); return $mailer; }; $container['image.original'] = function ($c) { $original = new Original(); $original->setDestination = './'; $original->setFilename = 'test'; $original->setCompress = 0; $original->setImageType = 'png'; return $original; }; $container['image.thumbnail'] = function ($c) { $thumbnail = new Thumbnail(); $thumbnail->setDestination = './'; $thumbnail->setFilename = 'test'; $thumbnail->setPostfix = '_s'; $thumbnail->setCompress = 70; $thumbnail->setWidth = '200'; $thumbnail->setHeight = '200'; $thumbnail->setImageType = 'jpg'; return $thumbnail; }; }
$pdo = $c->get('db.pdo'); $obj = new Get($pdo); $obj->setDebug($c->get('settings')['debug_mode']); return $obj; }; // POST $container['db.post'] = function ($c) { $pdo = $c->get('db.pdo'); $obj = new Post($pdo); $obj->setDebug($c->get('settings')['debug_mode']); return $obj; }; // PUT $container['db.put'] = function ($c) { $pdo = $c->get('db.pdo'); $obj = new Put($pdo); $obj->setDebug($c->get('settings')['debug_mode']); return $obj; }; // DELETE $container['db.delete'] = function ($c) { $pdo = $c->get('db.pdo'); $obj = new Delete($pdo); $obj->setDebug($c->get('settings')['debug_mode']); return $obj; }; /** * Swift Mailer * * [ e.g. ] * $mailer = $this->get('mailer.text');