예제 #1
0
 /**
  * @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
 /**
  * @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()));
 }