public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); self::$_instance->_table = 'share_article'; } return self::$_instance; }
private function generateKey() { $id = $this->getParam('id'); $id = intval($id); $article = Application_Model_ArticleRepository::getInstance()->getArticle($id); if (!is_int($id)) { return null; } else { if (!$article) { return null; } else { $key = Application_Model_ShareRepository::getInstance()->getKeyForId($id); if (is_null($key)) { $key = Application_Model_ShareRepository::getInstance()->addArticle($id); } return ['key' => $key, 'article' => $article]; } } }