PHPCS Notice_bookmark

This commit is contained in:
Evan Prodromou 2010-12-21 10:32:35 -05:00
parent d9ff466d2c
commit b8a182dc44

View File

@ -116,11 +116,21 @@ class Notice_bookmark extends Memcached_DataObject
return array(false, false, false);
}
/**
* Get the bookmark that a user made for an URL
*
* @param User $user User to check for
* @param string $url URL to check for
*
* @return Notice_bookmark bookmark found or null
*/
static function getByURL($user, $url)
{
$file = File::staticGet('url', $url);
if (!empty($file)) {
$f2p = new File_to_post();
$f2p->file_id = $file->id;
if ($f2p->find()) {
while ($f2p->fetch()) {
@ -139,7 +149,21 @@ class Notice_bookmark extends Memcached_DataObject
return null;
}
static function saveNew($user, $title, $url, $rawtags, $description, $options=null)
/**
* Save a new notice bookmark
*
* @param User $user To save the bookmark for
* @param string $title Title of the bookmark
* @param string $url URL of the bookmark
* @param mixed $rawtags array of tags or string
* @param string $description Description of the bookmark
* @param array $options Options for the Notice::saveNew()
*
* @return Notice saved notice
*/
static function saveNew($user, $title, $url, $rawtags, $description,
$options=null)
{
$nb = self::getByURL($user, $url);
@ -212,6 +236,7 @@ class Notice_bookmark extends Memcached_DataObject
if (!empty($saved)) {
$nb = new Notice_bookmark();
$nb->notice_id = $saved->id;
$nb->title = $title;
$nb->description = $description;