コード例 #1
0
ファイル: Link.php プロジェクト: vincecore/sharemonkey
 /**
  * @param $slackId
  * @param $title
  * @param $url
  * @param array $tags
  * @return Link
  */
 public static function fromSlack(MessageId $slackId, User $user, Datetime $createdTs, $title, $url, array $tags = array())
 {
     $link = new Link();
     $link->slackId = $slackId->getValue();
     $link->user = $user;
     $link->createdTs = $createdTs;
     $link->title = $title;
     $link->url = $url;
     $link->author = $user->getName();
     foreach ($tags as $tag) {
         $link->addTag(new Tag($tag));
     }
     return $link;
 }
コード例 #2
0
ファイル: Message.php プロジェクト: vincecore/sharemonkey
 /**
  * @param $timestamp
  * @return Message
  */
 public static function fromSlack($text, $timestamp, $user)
 {
     $message = new Message();
     $message->text = new Text($text);
     $message->createdAt = \DateTime::createFromFormat('U.u', $timestamp);
     $message->createdAt->setTimezone(new \DateTimeZone(date_default_timezone_get()));
     $message->userId = new UserId($user);
     $message->id = MessageId::fromTimeStamp($timestamp);
     return $message;
 }
コード例 #3
0
 /**
  * @param MessageId $messageId
  * @return Link|null
  */
 public function findOneBySlackMessageId(MessageId $messageId)
 {
     return $this->findOneBy(array('slackId' => $messageId->getValue()));
 }