@@ -8,110 +8,110 @@ |
||
| 8 | 8 | class MysqlYouTubeRepository implements YouTubeRepositoryInterface |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** @var ConnectionLocator */ |
|
| 12 | - protected $connections; |
|
| 11 | + /** @var ConnectionLocator */ |
|
| 12 | + protected $connections; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @param ConnectonLocator $connections |
|
| 16 | - */ |
|
| 17 | - public function __construct(ConnectionLocator $connections) |
|
| 18 | - { |
|
| 19 | - $this->connections = $connections; |
|
| 20 | - } |
|
| 14 | + /** |
|
| 15 | + * @param ConnectonLocator $connections |
|
| 16 | + */ |
|
| 17 | + public function __construct(ConnectionLocator $connections) |
|
| 18 | + { |
|
| 19 | + $this->connections = $connections; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public function getYouTubes($limit = null, $offset = 0) |
|
| 23 | - { |
|
| 24 | - $query = " |
|
| 22 | + public function getYouTubes($limit = null, $offset = 0) |
|
| 23 | + { |
|
| 24 | + $query = " |
|
| 25 | 25 | SELECT `id`, `video_id`, `datetime` |
| 26 | 26 | FROM `jpemeric_stream`.`youtube` |
| 27 | 27 | ORDER BY `datetime` DESC"; |
| 28 | - if (!is_null($limit)) { |
|
| 29 | - $query .= " |
|
| 28 | + if (!is_null($limit)) { |
|
| 29 | + $query .= " |
|
| 30 | 30 | LIMIT {$offset}, {$limit}"; |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - return $this |
|
| 34 | - ->connections |
|
| 35 | - ->getRead() |
|
| 36 | - ->fetchAll($query); |
|
| 37 | - } |
|
| 33 | + return $this |
|
| 34 | + ->connections |
|
| 35 | + ->getRead() |
|
| 36 | + ->fetchAll($query); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param integer $id |
|
| 41 | - * |
|
| 42 | - * @return array|false |
|
| 43 | - */ |
|
| 44 | - public function getYouTubeById($id) |
|
| 45 | - { |
|
| 46 | - $query = " |
|
| 39 | + /** |
|
| 40 | + * @param integer $id |
|
| 41 | + * |
|
| 42 | + * @return array|false |
|
| 43 | + */ |
|
| 44 | + public function getYouTubeById($id) |
|
| 45 | + { |
|
| 46 | + $query = " |
|
| 47 | 47 | SELECT * |
| 48 | 48 | FROM `jpemeric_stream`.`youtube` |
| 49 | 49 | WHERE `id` = :id |
| 50 | 50 | LIMIT 1"; |
| 51 | - $bindings = [ |
|
| 52 | - 'id' => $id, |
|
| 53 | - ]; |
|
| 51 | + $bindings = [ |
|
| 52 | + 'id' => $id, |
|
| 53 | + ]; |
|
| 54 | 54 | |
| 55 | - return $this |
|
| 56 | - ->connections |
|
| 57 | - ->getRead() |
|
| 58 | - ->fetchOne($query, $bindings); |
|
| 59 | - } |
|
| 55 | + return $this |
|
| 56 | + ->connections |
|
| 57 | + ->getRead() |
|
| 58 | + ->fetchOne($query, $bindings); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param string $title |
|
| 63 | - * |
|
| 64 | - * @return array|false |
|
| 65 | - */ |
|
| 66 | - public function getYouTubeByVideoId($videoId) |
|
| 67 | - { |
|
| 68 | - $query = " |
|
| 61 | + /** |
|
| 62 | + * @param string $title |
|
| 63 | + * |
|
| 64 | + * @return array|false |
|
| 65 | + */ |
|
| 66 | + public function getYouTubeByVideoId($videoId) |
|
| 67 | + { |
|
| 68 | + $query = " |
|
| 69 | 69 | SELECT * |
| 70 | 70 | FROM `jpemeric_stream`.`youtube` |
| 71 | 71 | WHERE `video_id` = :video_id |
| 72 | 72 | LIMIT 1"; |
| 73 | - $bindings = [ |
|
| 74 | - 'video_id' => $videoId, |
|
| 75 | - ]; |
|
| 73 | + $bindings = [ |
|
| 74 | + 'video_id' => $videoId, |
|
| 75 | + ]; |
|
| 76 | 76 | |
| 77 | - return $this |
|
| 78 | - ->connections |
|
| 79 | - ->getRead() |
|
| 80 | - ->fetchOne($query, $bindings); |
|
| 81 | - } |
|
| 77 | + return $this |
|
| 78 | + ->connections |
|
| 79 | + ->getRead() |
|
| 80 | + ->fetchOne($query, $bindings); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - public function getYouTubesUpdatedSince(DateTime $datetime) |
|
| 84 | - { |
|
| 85 | - $query = " |
|
| 83 | + public function getYouTubesUpdatedSince(DateTime $datetime) |
|
| 84 | + { |
|
| 85 | + $query = " |
|
| 86 | 86 | SELECT * |
| 87 | 87 | FROM `jpemeric_stream`.`youtube` |
| 88 | 88 | WHERE `updated_at` >= :last_update"; |
| 89 | - $bindings = [ |
|
| 90 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 91 | - ]; |
|
| 92 | - return $this |
|
| 93 | - ->connections |
|
| 94 | - ->getRead() |
|
| 95 | - ->fetchAll($query, $bindings); |
|
| 96 | - } |
|
| 89 | + $bindings = [ |
|
| 90 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 91 | + ]; |
|
| 92 | + return $this |
|
| 93 | + ->connections |
|
| 94 | + ->getRead() |
|
| 95 | + ->fetchAll($query, $bindings); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
| 99 | - { |
|
| 100 | - $query = " |
|
| 98 | + public function insertVideo($videoId, DateTime $datetime, array $metadata) |
|
| 99 | + { |
|
| 100 | + $query = " |
|
| 101 | 101 | INSERT INTO `jpemeric_stream`.`youtube` |
| 102 | 102 | (`video_id`, `datetime`, `metadata`) |
| 103 | 103 | VALUES |
| 104 | 104 | (:video_id, :datetime, :metadata)"; |
| 105 | 105 | |
| 106 | - $bindings = [ |
|
| 107 | - 'video_id' => $videoId, |
|
| 108 | - 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 109 | - 'metadata' => json_encode($metadata), |
|
| 110 | - ]; |
|
| 106 | + $bindings = [ |
|
| 107 | + 'video_id' => $videoId, |
|
| 108 | + 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 109 | + 'metadata' => json_encode($metadata), |
|
| 110 | + ]; |
|
| 111 | 111 | |
| 112 | - return $this |
|
| 113 | - ->connections |
|
| 114 | - ->getWrite() |
|
| 115 | - ->perform($query, $bindings); |
|
| 116 | - } |
|
| 112 | + return $this |
|
| 113 | + ->connections |
|
| 114 | + ->getWrite() |
|
| 115 | + ->perform($query, $bindings); |
|
| 116 | + } |
|
| 117 | 117 | } |
@@ -8,104 +8,104 @@ |
||
| 8 | 8 | class MysqlGithubRepository implements GithubRepositoryInterface |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** @var ConnectionLocator */ |
|
| 12 | - protected $connections; |
|
| 11 | + /** @var ConnectionLocator */ |
|
| 12 | + protected $connections; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @param ConnectonLocator $connections |
|
| 16 | - */ |
|
| 17 | - public function __construct(ConnectionLocator $connections) |
|
| 18 | - { |
|
| 19 | - $this->connections = $connections; |
|
| 20 | - } |
|
| 14 | + /** |
|
| 15 | + * @param ConnectonLocator $connections |
|
| 16 | + */ |
|
| 17 | + public function __construct(ConnectionLocator $connections) |
|
| 18 | + { |
|
| 19 | + $this->connections = $connections; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @param integer $limit |
|
| 24 | - * @param integer $offset |
|
| 25 | - * |
|
| 26 | - * @return array|false |
|
| 27 | - */ |
|
| 28 | - public function getEvents($limit = null, $offset = 0) |
|
| 29 | - { |
|
| 30 | - $query = " |
|
| 22 | + /** |
|
| 23 | + * @param integer $limit |
|
| 24 | + * @param integer $offset |
|
| 25 | + * |
|
| 26 | + * @return array|false |
|
| 27 | + */ |
|
| 28 | + public function getEvents($limit = null, $offset = 0) |
|
| 29 | + { |
|
| 30 | + $query = " |
|
| 31 | 31 | SELECT `id`, `event_id`, `datetime` |
| 32 | 32 | FROM `jpemeric_stream`.`github` |
| 33 | 33 | ORDER BY `datetime` DESC"; |
| 34 | - if (!is_null($limit)) { |
|
| 35 | - $query .= " |
|
| 34 | + if (!is_null($limit)) { |
|
| 35 | + $query .= " |
|
| 36 | 36 | LIMIT {$offset}, {$limit}"; |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - return $this |
|
| 40 | - ->connections |
|
| 41 | - ->getRead() |
|
| 42 | - ->fetchAll($query); |
|
| 43 | - } |
|
| 39 | + return $this |
|
| 40 | + ->connections |
|
| 41 | + ->getRead() |
|
| 42 | + ->fetchAll($query); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param integer $eventId |
|
| 47 | - * |
|
| 48 | - * @return array|false |
|
| 49 | - */ |
|
| 50 | - public function getEventByEventId($eventId) |
|
| 51 | - { |
|
| 52 | - $query = " |
|
| 45 | + /** |
|
| 46 | + * @param integer $eventId |
|
| 47 | + * |
|
| 48 | + * @return array|false |
|
| 49 | + */ |
|
| 50 | + public function getEventByEventId($eventId) |
|
| 51 | + { |
|
| 52 | + $query = " |
|
| 53 | 53 | SELECT * |
| 54 | 54 | FROM `jpemeric_stream`.`github` |
| 55 | 55 | WHERE `event_id` = :event_id |
| 56 | 56 | LIMIT 1"; |
| 57 | 57 | |
| 58 | - $bindings = [ |
|
| 59 | - 'event_id' => $eventId, |
|
| 60 | - ]; |
|
| 58 | + $bindings = [ |
|
| 59 | + 'event_id' => $eventId, |
|
| 60 | + ]; |
|
| 61 | 61 | |
| 62 | - return $this |
|
| 63 | - ->connections |
|
| 64 | - ->getRead() |
|
| 65 | - ->fetchOne($query, $bindings); |
|
| 66 | - } |
|
| 62 | + return $this |
|
| 63 | + ->connections |
|
| 64 | + ->getRead() |
|
| 65 | + ->fetchOne($query, $bindings); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function getGithubsUpdatedSince(DateTime $datetime) |
|
| 69 | - { |
|
| 70 | - $query = " |
|
| 68 | + public function getGithubsUpdatedSince(DateTime $datetime) |
|
| 69 | + { |
|
| 70 | + $query = " |
|
| 71 | 71 | SELECT * |
| 72 | 72 | FROM `jpemeric_stream`.`github` |
| 73 | 73 | WHERE `updated_at` >= :last_update"; |
| 74 | - $bindings = [ |
|
| 75 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 76 | - ]; |
|
| 77 | - return $this |
|
| 78 | - ->connections |
|
| 79 | - ->getRead() |
|
| 80 | - ->fetchAll($query, $bindings); |
|
| 81 | - } |
|
| 74 | + $bindings = [ |
|
| 75 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 76 | + ]; |
|
| 77 | + return $this |
|
| 78 | + ->connections |
|
| 79 | + ->getRead() |
|
| 80 | + ->fetchAll($query, $bindings); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @param integer $eventId |
|
| 85 | - * @param string $eventType |
|
| 86 | - * @param DateTime $datetime |
|
| 87 | - * @param array $metadata |
|
| 88 | - * |
|
| 89 | - * @return |
|
| 90 | - */ |
|
| 91 | - public function insertEvent($eventId, $eventType, DateTime $datetime, array $metadata) |
|
| 92 | - { |
|
| 93 | - $query = " |
|
| 83 | + /** |
|
| 84 | + * @param integer $eventId |
|
| 85 | + * @param string $eventType |
|
| 86 | + * @param DateTime $datetime |
|
| 87 | + * @param array $metadata |
|
| 88 | + * |
|
| 89 | + * @return |
|
| 90 | + */ |
|
| 91 | + public function insertEvent($eventId, $eventType, DateTime $datetime, array $metadata) |
|
| 92 | + { |
|
| 93 | + $query = " |
|
| 94 | 94 | INSERT INTO `jpemeric_stream`.`github` |
| 95 | 95 | (`event_id`, `type`, `datetime`, `metadata`) |
| 96 | 96 | VALUES |
| 97 | 97 | (:event_id, :event_type, :datetime, :metadata)"; |
| 98 | 98 | |
| 99 | - $bindings = [ |
|
| 100 | - 'event_id' => $eventId, |
|
| 101 | - 'event_type' => $eventType, |
|
| 102 | - 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 103 | - 'metadata' => json_encode($metadata), |
|
| 104 | - ]; |
|
| 99 | + $bindings = [ |
|
| 100 | + 'event_id' => $eventId, |
|
| 101 | + 'event_type' => $eventType, |
|
| 102 | + 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 103 | + 'metadata' => json_encode($metadata), |
|
| 104 | + ]; |
|
| 105 | 105 | |
| 106 | - return $this |
|
| 107 | - ->connections |
|
| 108 | - ->getWrite() |
|
| 109 | - ->perform($query, $bindings); |
|
| 110 | - } |
|
| 106 | + return $this |
|
| 107 | + ->connections |
|
| 108 | + ->getWrite() |
|
| 109 | + ->perform($query, $bindings); |
|
| 110 | + } |
|
| 111 | 111 | } |
@@ -8,150 +8,150 @@ |
||
| 8 | 8 | class MysqlTwitterRepository implements TwitterRepositoryInterface |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** @var ConnectionLocator */ |
|
| 12 | - protected $connections; |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * @param ConnectonLocator $connections |
|
| 16 | - */ |
|
| 17 | - public function __construct(ConnectionLocator $connections) |
|
| 18 | - { |
|
| 19 | - $this->connections = $connections; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * @param integer $id |
|
| 24 | - * |
|
| 25 | - * @return array|false |
|
| 26 | - */ |
|
| 27 | - public function getTwitterById($id) |
|
| 28 | - { |
|
| 29 | - $query = " |
|
| 11 | + /** @var ConnectionLocator */ |
|
| 12 | + protected $connections; |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param ConnectonLocator $connections |
|
| 16 | + */ |
|
| 17 | + public function __construct(ConnectionLocator $connections) |
|
| 18 | + { |
|
| 19 | + $this->connections = $connections; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * @param integer $id |
|
| 24 | + * |
|
| 25 | + * @return array|false |
|
| 26 | + */ |
|
| 27 | + public function getTwitterById($id) |
|
| 28 | + { |
|
| 29 | + $query = " |
|
| 30 | 30 | SELECT * |
| 31 | 31 | FROM `jpemeric_stream`.`twitter` |
| 32 | 32 | WHERE `id` = :id |
| 33 | 33 | LIMIT 1"; |
| 34 | - $bindings = [ |
|
| 35 | - 'id' => $id, |
|
| 36 | - ]; |
|
| 37 | - |
|
| 38 | - return $this |
|
| 39 | - ->connections |
|
| 40 | - ->getRead() |
|
| 41 | - ->fetchOne($query, $bindings); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - public function getTwitterByTweetId($tweetId) |
|
| 45 | - { |
|
| 46 | - $query = " |
|
| 34 | + $bindings = [ |
|
| 35 | + 'id' => $id, |
|
| 36 | + ]; |
|
| 37 | + |
|
| 38 | + return $this |
|
| 39 | + ->connections |
|
| 40 | + ->getRead() |
|
| 41 | + ->fetchOne($query, $bindings); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + public function getTwitterByTweetId($tweetId) |
|
| 45 | + { |
|
| 46 | + $query = " |
|
| 47 | 47 | SELECT `id`, `tweet_id`, `datetime`, `metadata` |
| 48 | 48 | FROM `jpemeric_stream`.`twitter2` |
| 49 | 49 | WHERE `tweet_id` = :tweet_id |
| 50 | 50 | LIMIT 1"; |
| 51 | 51 | |
| 52 | - $bindings = [ |
|
| 53 | - 'tweet_id' => $tweetId, |
|
| 54 | - ]; |
|
| 55 | - |
|
| 56 | - return $this |
|
| 57 | - ->connections |
|
| 58 | - ->getRead() |
|
| 59 | - ->fetchOne($query, $bindings); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @param DateTime $date |
|
| 64 | - * @param string $text |
|
| 65 | - * |
|
| 66 | - * @return array|false |
|
| 67 | - */ |
|
| 68 | - public function getTwitterByFields(DateTime $date, $text) |
|
| 69 | - { |
|
| 70 | - $query = " |
|
| 52 | + $bindings = [ |
|
| 53 | + 'tweet_id' => $tweetId, |
|
| 54 | + ]; |
|
| 55 | + |
|
| 56 | + return $this |
|
| 57 | + ->connections |
|
| 58 | + ->getRead() |
|
| 59 | + ->fetchOne($query, $bindings); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param DateTime $date |
|
| 64 | + * @param string $text |
|
| 65 | + * |
|
| 66 | + * @return array|false |
|
| 67 | + */ |
|
| 68 | + public function getTwitterByFields(DateTime $date, $text) |
|
| 69 | + { |
|
| 70 | + $query = " |
|
| 71 | 71 | SELECT * |
| 72 | 72 | FROM `jpemeric_stream`.`twitter` |
| 73 | 73 | WHERE `date` = :date AND `text` = :text |
| 74 | 74 | LIMIT 1"; |
| 75 | - $bindings = [ |
|
| 76 | - 'date' => $date->format('Y-m-d H:i:s'), |
|
| 77 | - 'text' => $text, |
|
| 78 | - ]; |
|
| 79 | - |
|
| 80 | - return $this |
|
| 81 | - ->connections |
|
| 82 | - ->getRead() |
|
| 83 | - ->fetchOne($query, $bindings); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @return array|false |
|
| 88 | - */ |
|
| 89 | - public function getUnmappedTwitters() |
|
| 90 | - { |
|
| 91 | - $query = " |
|
| 75 | + $bindings = [ |
|
| 76 | + 'date' => $date->format('Y-m-d H:i:s'), |
|
| 77 | + 'text' => $text, |
|
| 78 | + ]; |
|
| 79 | + |
|
| 80 | + return $this |
|
| 81 | + ->connections |
|
| 82 | + ->getRead() |
|
| 83 | + ->fetchOne($query, $bindings); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @return array|false |
|
| 88 | + */ |
|
| 89 | + public function getUnmappedTwitters() |
|
| 90 | + { |
|
| 91 | + $query = " |
|
| 92 | 92 | SELECT `id`, `date` |
| 93 | 93 | FROM `jpemeric_stream`.`twitter` |
| 94 | 94 | LEFT JOIN `jpemeric_stream`.`post` |
| 95 | 95 | ON `post`.`type_id` = `twitter`.`id` AND `post`.`id` IS NULL"; |
| 96 | 96 | |
| 97 | - return $this |
|
| 98 | - ->connections |
|
| 99 | - ->getRead() |
|
| 100 | - ->fetchAll($query); |
|
| 101 | - } |
|
| 97 | + return $this |
|
| 98 | + ->connections |
|
| 99 | + ->getRead() |
|
| 100 | + ->fetchAll($query); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - public function getTwittersUpdatedSince(DateTime $datetime) |
|
| 104 | - { |
|
| 105 | - $query = " |
|
| 103 | + public function getTwittersUpdatedSince(DateTime $datetime) |
|
| 104 | + { |
|
| 105 | + $query = " |
|
| 106 | 106 | SELECT * |
| 107 | 107 | FROM `jpemeric_stream`.`twitter2` |
| 108 | 108 | WHERE `updated_at` >= :last_update"; |
| 109 | 109 | |
| 110 | - $bindings = [ |
|
| 111 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 112 | - ]; |
|
| 110 | + $bindings = [ |
|
| 111 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
| 112 | + ]; |
|
| 113 | 113 | |
| 114 | - return $this |
|
| 115 | - ->connections |
|
| 116 | - ->getRead() |
|
| 117 | - ->fetchAll($query, $bindings); |
|
| 118 | - } |
|
| 114 | + return $this |
|
| 115 | + ->connections |
|
| 116 | + ->getRead() |
|
| 117 | + ->fetchAll($query, $bindings); |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - public function insertTweet($tweetId, DateTime $datetime, array $metadata) |
|
| 121 | - { |
|
| 122 | - $query = " |
|
| 120 | + public function insertTweet($tweetId, DateTime $datetime, array $metadata) |
|
| 121 | + { |
|
| 122 | + $query = " |
|
| 123 | 123 | INSERT INTO `jpemeric_stream`.`twitter2` |
| 124 | 124 | (`tweet_id`, `datetime`, `metadata`) |
| 125 | 125 | VALUES |
| 126 | 126 | (:tweet_id, :datetime, :metadata)"; |
| 127 | 127 | |
| 128 | - $bindings = [ |
|
| 129 | - 'tweet_id' => $tweetId, |
|
| 130 | - 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 131 | - 'metadata' => json_encode($metadata), |
|
| 132 | - ]; |
|
| 133 | - |
|
| 134 | - return $this |
|
| 135 | - ->connections |
|
| 136 | - ->getWrite() |
|
| 137 | - ->perform($query, $bindings); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - public function updateTweetMetadata($tweetId, array $metadata) |
|
| 141 | - { |
|
| 142 | - $query = " |
|
| 128 | + $bindings = [ |
|
| 129 | + 'tweet_id' => $tweetId, |
|
| 130 | + 'datetime' => $datetime->format('Y-m-d H:i:s'), |
|
| 131 | + 'metadata' => json_encode($metadata), |
|
| 132 | + ]; |
|
| 133 | + |
|
| 134 | + return $this |
|
| 135 | + ->connections |
|
| 136 | + ->getWrite() |
|
| 137 | + ->perform($query, $bindings); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + public function updateTweetMetadata($tweetId, array $metadata) |
|
| 141 | + { |
|
| 142 | + $query = " |
|
| 143 | 143 | UPDATE `jpemeric_stream`.`twitter2` |
| 144 | 144 | SET `metadata` = :metadata |
| 145 | 145 | WHERE `tweet_id` = :tweet_id"; |
| 146 | 146 | |
| 147 | - $bindings = [ |
|
| 148 | - 'metadata' => json_encode($metadata), |
|
| 149 | - 'tweet_id' => $tweetId, |
|
| 150 | - ]; |
|
| 147 | + $bindings = [ |
|
| 148 | + 'metadata' => json_encode($metadata), |
|
| 149 | + 'tweet_id' => $tweetId, |
|
| 150 | + ]; |
|
| 151 | 151 | |
| 152 | - return $this |
|
| 153 | - ->connections |
|
| 154 | - ->getWrite() |
|
| 155 | - ->perform($query, $bindings); |
|
| 156 | - } |
|
| 152 | + return $this |
|
| 153 | + ->connections |
|
| 154 | + ->getWrite() |
|
| 155 | + ->perform($query, $bindings); |
|
| 156 | + } |
|
| 157 | 157 | } |
@@ -11,44 +11,44 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $lastBlogActivity = $activityRepository->getActivityLastUpdateByType('blog'); |
| 13 | 13 | if ($lastBlogActivity === false) { |
| 14 | - $lastBlogActivityDateTime = new DateTime('2008-05-03'); |
|
| 14 | + $lastBlogActivityDateTime = new DateTime('2008-05-03'); |
|
| 15 | 15 | } else { |
| 16 | - $lastBlogActivityDateTime = new DateTime($lastBlogActivity['updated_at']); |
|
| 17 | - $lastBlogActivityDateTime->modify('-5 days'); |
|
| 16 | + $lastBlogActivityDateTime = new DateTime($lastBlogActivity['updated_at']); |
|
| 17 | + $lastBlogActivityDateTime->modify('-5 days'); |
|
| 18 | 18 | } |
| 19 | 19 | $newBlogActivity = $blogRepository->getBlogsUpdatedSince($lastBlogActivityDateTime); |
| 20 | 20 | foreach ($newBlogActivity as $blog) { |
| 21 | - $uniqueBlogCheck = $activityRepository->getActivityByTypeId('blog', $blog['id']); |
|
| 22 | - if ($uniqueBlogCheck !== false) { |
|
| 23 | - continue; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - $blogData = json_decode($blog['metadata'], true); |
|
| 27 | - $message = sprintf( |
|
| 28 | - 'Blogged about %s: <a href="%s" title="Jacob Emerick\'s Blog | %s">%s</a>.', |
|
| 29 | - str_replace('-', ' ', $blogData['category']), |
|
| 30 | - $blogData['link'], |
|
| 31 | - $blogData['title'], |
|
| 32 | - $blogData['title'] |
|
| 33 | - ); |
|
| 34 | - $messageLong = sprintf( |
|
| 35 | - "<h4><a href=\"%s\" title=\"Jacob Emerick's Blog | %s\">%s</a></h4>\n" . |
|
| 36 | - "<p>%s [<a href=\"%s\">read more</a></a>]</p>", |
|
| 37 | - $blogData['link'], |
|
| 38 | - $blogData['title'], |
|
| 39 | - $blogData['title'], |
|
| 40 | - htmlentities($blogData['description']), |
|
| 41 | - $blogData['link'] |
|
| 42 | - ); |
|
| 43 | - |
|
| 44 | - $activityRepository->insertActivity( |
|
| 45 | - $message, |
|
| 46 | - $messageLong, |
|
| 47 | - (new DateTime($blog['datetime'])), |
|
| 48 | - [], |
|
| 49 | - 'blog', |
|
| 50 | - $blog['id'] |
|
| 51 | - ); |
|
| 21 | + $uniqueBlogCheck = $activityRepository->getActivityByTypeId('blog', $blog['id']); |
|
| 22 | + if ($uniqueBlogCheck !== false) { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + $blogData = json_decode($blog['metadata'], true); |
|
| 27 | + $message = sprintf( |
|
| 28 | + 'Blogged about %s: <a href="%s" title="Jacob Emerick\'s Blog | %s">%s</a>.', |
|
| 29 | + str_replace('-', ' ', $blogData['category']), |
|
| 30 | + $blogData['link'], |
|
| 31 | + $blogData['title'], |
|
| 32 | + $blogData['title'] |
|
| 33 | + ); |
|
| 34 | + $messageLong = sprintf( |
|
| 35 | + "<h4><a href=\"%s\" title=\"Jacob Emerick's Blog | %s\">%s</a></h4>\n" . |
|
| 36 | + "<p>%s [<a href=\"%s\">read more</a></a>]</p>", |
|
| 37 | + $blogData['link'], |
|
| 38 | + $blogData['title'], |
|
| 39 | + $blogData['title'], |
|
| 40 | + htmlentities($blogData['description']), |
|
| 41 | + $blogData['link'] |
|
| 42 | + ); |
|
| 43 | + |
|
| 44 | + $activityRepository->insertActivity( |
|
| 45 | + $message, |
|
| 46 | + $messageLong, |
|
| 47 | + (new DateTime($blog['datetime'])), |
|
| 48 | + [], |
|
| 49 | + 'blog', |
|
| 50 | + $blog['id'] |
|
| 51 | + ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | use Jacobemerick\Web\Domain\Stream\BlogComment\MysqlBlogCommentRepository as BlogCommentRepository; |
@@ -56,30 +56,30 @@ discard block |
||
| 56 | 56 | $blogCommentActivity = $blogCommentRepository->getBlogComments(); |
| 57 | 57 | $blogCommentHolder = []; |
| 58 | 58 | foreach ($blogCommentActivity as $blogComment) { |
| 59 | - $blogPermalink = $blogComment['permalink']; |
|
| 60 | - $blogPermalink = explode('#', $blogPermalink); |
|
| 61 | - $blogPermalink = current($blogPermalink); |
|
| 62 | - |
|
| 63 | - $blog = $blogRepository->getBlogByPermalink($blogPermalink); |
|
| 64 | - if (!array_key_exists($blog['id'], $blogCommentHolder)) { |
|
| 65 | - $blogCommentHolder[$blog['id']] = 1; |
|
| 66 | - } else { |
|
| 67 | - $blogCommentHolder[$blog['id']]++; |
|
| 68 | - } |
|
| 59 | + $blogPermalink = $blogComment['permalink']; |
|
| 60 | + $blogPermalink = explode('#', $blogPermalink); |
|
| 61 | + $blogPermalink = current($blogPermalink); |
|
| 62 | + |
|
| 63 | + $blog = $blogRepository->getBlogByPermalink($blogPermalink); |
|
| 64 | + if (!array_key_exists($blog['id'], $blogCommentHolder)) { |
|
| 65 | + $blogCommentHolder[$blog['id']] = 1; |
|
| 66 | + } else { |
|
| 67 | + $blogCommentHolder[$blog['id']]++; |
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | foreach ($blogCommentHolder as $blogId => $commentCount) { |
| 72 | - $blogActivity = $activityRepository->getActivityByTypeId('blog', $blogId); |
|
| 73 | - $blogActivityMetadata = json_decode($blogActivity['metadata'], true); |
|
| 74 | - if ( |
|
| 75 | - !isset($blogActivityMetadata['comments']) || |
|
| 76 | - $blogActivityMetadata['comments'] != $commentCount |
|
| 77 | - ) { |
|
| 78 | - $activityRepository->updateActivityMetadata( |
|
| 79 | - $blogActivity['id'], |
|
| 80 | - ['comments' => $commentCount] |
|
| 81 | - ); |
|
| 82 | - } |
|
| 72 | + $blogActivity = $activityRepository->getActivityByTypeId('blog', $blogId); |
|
| 73 | + $blogActivityMetadata = json_decode($blogActivity['metadata'], true); |
|
| 74 | + if ( |
|
| 75 | + !isset($blogActivityMetadata['comments']) || |
|
| 76 | + $blogActivityMetadata['comments'] != $commentCount |
|
| 77 | + ) { |
|
| 78 | + $activityRepository->updateActivityMetadata( |
|
| 79 | + $blogActivity['id'], |
|
| 80 | + ['comments' => $commentCount] |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // distance |
@@ -88,67 +88,67 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $lastDailyMileActivity = $activityRepository->getActivityLastUpdateByType('distance'); |
| 90 | 90 | if ($lastDailyMileActivity === false) { |
| 91 | - $lastDailyMileActivityDateTime = new DateTime('2008-05-03'); |
|
| 91 | + $lastDailyMileActivityDateTime = new DateTime('2008-05-03'); |
|
| 92 | 92 | } else { |
| 93 | - $lastDailyMileActivityDateTime = new DateTime($lastDailyMileActivity['updated_at']); |
|
| 94 | - $lastDailyMileActivityDateTime->modify('-5 days'); |
|
| 93 | + $lastDailyMileActivityDateTime = new DateTime($lastDailyMileActivity['updated_at']); |
|
| 94 | + $lastDailyMileActivityDateTime->modify('-5 days'); |
|
| 95 | 95 | } |
| 96 | 96 | $newDailyMileActivity = $dailyMileRepository->getDailyMilesUpdatedSince($lastDailyMileActivityDateTime); |
| 97 | 97 | foreach ($newDailyMileActivity as $dailyMile) { |
| 98 | - $uniqueDailyMileCheck = $activityRepository->getActivityByTypeId('distance', $dailyMile['id']); |
|
| 99 | - if ($uniqueDailyMileCheck !== false) { |
|
| 100 | - continue; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - $dailyMileData = json_decode($dailyMile['metadata'], true); |
|
| 104 | - if ($dailyMile['type'] == 'Hiking') { |
|
| 105 | - $message = sprintf( |
|
| 106 | - '%s %.2f %s and felt %s.', |
|
| 107 | - 'Hiked', |
|
| 108 | - $dailyMileData['workout']['distance']['value'], |
|
| 109 | - $dailyMileData['workout']['distance']['units'], |
|
| 110 | - $dailyMileData['workout']['felt'] |
|
| 111 | - ); |
|
| 112 | - $messageLong = "<p>{$message}</p>"; |
|
| 113 | - if (isset($dailyMileData['workout']['title'])) { |
|
| 114 | - $messageLong .= "\n<p>I was hiking up around the {$dailyMileData['workout']['title']} area.</p>"; |
|
| 115 | - } |
|
| 116 | - } else if ($dailyMile['type'] == 'Running') { |
|
| 117 | - $message = sprintf( |
|
| 118 | - '%s %.2f %s and felt %s.', |
|
| 119 | - 'Ran', |
|
| 120 | - $dailyMileData['workout']['distance']['value'], |
|
| 121 | - $dailyMileData['workout']['distance']['units'], |
|
| 122 | - $dailyMileData['workout']['felt'] |
|
| 123 | - ); |
|
| 124 | - $messageLong = "<p>{$message}</p>"; |
|
| 125 | - if (isset($dailyMileData['message'])) { |
|
| 126 | - $messageLong .= "\n<p>Afterwards, I was all like '{$dailyMileData['message']}'.</p>"; |
|
| 127 | - } |
|
| 128 | - } else if ($dailyMile['type'] == 'Walking') { |
|
| 129 | - $message = sprintf( |
|
| 130 | - '%s %.2f %s and felt %s.', |
|
| 131 | - 'Walked', |
|
| 132 | - $dailyMileData['workout']['distance']['value'], |
|
| 133 | - $dailyMileData['workout']['distance']['units'], |
|
| 134 | - $dailyMileData['workout']['felt'] |
|
| 135 | - ); |
|
| 136 | - $messageLong = "<p>{$message}</p>"; |
|
| 137 | - if (isset($dailyMileData['message'])) { |
|
| 138 | - $messageLong .= "\n<p>{$dailyMileData['message']}</p>"; |
|
| 139 | - } |
|
| 140 | - } else { |
|
| 141 | - continue; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $activityRepository->insertActivity( |
|
| 145 | - $message, |
|
| 146 | - $messageLong, |
|
| 147 | - (new DateTime($dailyMile['datetime'])), |
|
| 148 | - [], |
|
| 149 | - 'distance', |
|
| 150 | - $dailyMile['id'] |
|
| 151 | - ); |
|
| 98 | + $uniqueDailyMileCheck = $activityRepository->getActivityByTypeId('distance', $dailyMile['id']); |
|
| 99 | + if ($uniqueDailyMileCheck !== false) { |
|
| 100 | + continue; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + $dailyMileData = json_decode($dailyMile['metadata'], true); |
|
| 104 | + if ($dailyMile['type'] == 'Hiking') { |
|
| 105 | + $message = sprintf( |
|
| 106 | + '%s %.2f %s and felt %s.', |
|
| 107 | + 'Hiked', |
|
| 108 | + $dailyMileData['workout']['distance']['value'], |
|
| 109 | + $dailyMileData['workout']['distance']['units'], |
|
| 110 | + $dailyMileData['workout']['felt'] |
|
| 111 | + ); |
|
| 112 | + $messageLong = "<p>{$message}</p>"; |
|
| 113 | + if (isset($dailyMileData['workout']['title'])) { |
|
| 114 | + $messageLong .= "\n<p>I was hiking up around the {$dailyMileData['workout']['title']} area.</p>"; |
|
| 115 | + } |
|
| 116 | + } else if ($dailyMile['type'] == 'Running') { |
|
| 117 | + $message = sprintf( |
|
| 118 | + '%s %.2f %s and felt %s.', |
|
| 119 | + 'Ran', |
|
| 120 | + $dailyMileData['workout']['distance']['value'], |
|
| 121 | + $dailyMileData['workout']['distance']['units'], |
|
| 122 | + $dailyMileData['workout']['felt'] |
|
| 123 | + ); |
|
| 124 | + $messageLong = "<p>{$message}</p>"; |
|
| 125 | + if (isset($dailyMileData['message'])) { |
|
| 126 | + $messageLong .= "\n<p>Afterwards, I was all like '{$dailyMileData['message']}'.</p>"; |
|
| 127 | + } |
|
| 128 | + } else if ($dailyMile['type'] == 'Walking') { |
|
| 129 | + $message = sprintf( |
|
| 130 | + '%s %.2f %s and felt %s.', |
|
| 131 | + 'Walked', |
|
| 132 | + $dailyMileData['workout']['distance']['value'], |
|
| 133 | + $dailyMileData['workout']['distance']['units'], |
|
| 134 | + $dailyMileData['workout']['felt'] |
|
| 135 | + ); |
|
| 136 | + $messageLong = "<p>{$message}</p>"; |
|
| 137 | + if (isset($dailyMileData['message'])) { |
|
| 138 | + $messageLong .= "\n<p>{$dailyMileData['message']}</p>"; |
|
| 139 | + } |
|
| 140 | + } else { |
|
| 141 | + continue; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $activityRepository->insertActivity( |
|
| 145 | + $message, |
|
| 146 | + $messageLong, |
|
| 147 | + (new DateTime($dailyMile['datetime'])), |
|
| 148 | + [], |
|
| 149 | + 'distance', |
|
| 150 | + $dailyMile['id'] |
|
| 151 | + ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // github |
@@ -157,127 +157,127 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $lastGithubActivity = $activityRepository->getActivityLastUpdateByType('git'); |
| 159 | 159 | if ($lastGithubActivity === false) { |
| 160 | - $lastGithubActivityDateTime = new DateTime('2015-10-01'); |
|
| 160 | + $lastGithubActivityDateTime = new DateTime('2015-10-01'); |
|
| 161 | 161 | } else { |
| 162 | - $lastGithubActivityDateTime = new DateTime($lastGithubActivity['updated_at']); |
|
| 163 | - $lastGithubActivityDateTime->modify('-5 days'); |
|
| 162 | + $lastGithubActivityDateTime = new DateTime($lastGithubActivity['updated_at']); |
|
| 163 | + $lastGithubActivityDateTime->modify('-5 days'); |
|
| 164 | 164 | } |
| 165 | 165 | $newGithubActivity = $githubRepository->getGithubsUpdatedSince($lastGithubActivityDateTime); |
| 166 | 166 | foreach ($newGithubActivity as $github) { |
| 167 | - $uniqueGithubCheck = $activityRepository->getActivityByTypeId('git', $github['id']); |
|
| 168 | - if ($uniqueGithubCheck !== false) { |
|
| 169 | - continue; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - $githubData = json_decode($github['metadata'], true); |
|
| 173 | - |
|
| 174 | - if ($github['type'] == 'CreateEvent') { |
|
| 175 | - if ( |
|
| 176 | - $githubData['payload']['ref_type'] == 'branch' || |
|
| 177 | - $githubData['payload']['ref_type'] == 'tag' |
|
| 178 | - ) { |
|
| 179 | - $message = sprintf( |
|
| 180 | - 'Created %s %s at %s.', |
|
| 181 | - $githubData['payload']['ref_type'], |
|
| 182 | - $githubData['payload']['ref'], |
|
| 183 | - $githubData['repo']['name'] |
|
| 184 | - ); |
|
| 185 | - $messageLong = sprintf( |
|
| 186 | - '<p>Created %s %s at <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 187 | - $githubData['payload']['ref_type'], |
|
| 188 | - $githubData['payload']['ref'], |
|
| 189 | - "https://github.com/{$githubData['repo']['name']}", |
|
| 190 | - $githubData['repo']['name'], |
|
| 191 | - $githubData['repo']['name'] |
|
| 192 | - ); |
|
| 193 | - } else if ($githubData['payload']['ref_type'] == 'repository') { |
|
| 194 | - $message = sprintf( |
|
| 195 | - 'Created %s %s.', |
|
| 196 | - $githubData['payload']['ref_type'], |
|
| 197 | - $githubData['repo']['name'] |
|
| 198 | - ); |
|
| 199 | - $messageLong = sprintf( |
|
| 200 | - '<p>Created %s <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 201 | - $githubData['payload']['ref_type'], |
|
| 202 | - "https://github.com/{$githubData['repo']['name']}", |
|
| 203 | - $githubData['repo']['name'], |
|
| 204 | - $githubData['repo']['name'] |
|
| 205 | - ); |
|
| 206 | - } else { |
|
| 207 | - continue; |
|
| 208 | - } |
|
| 209 | - } else if ($github['type'] == 'ForkEvent') { |
|
| 210 | - $message = sprintf( |
|
| 211 | - 'Forked %s to %s', |
|
| 212 | - $githubData['repo']['name'], |
|
| 213 | - $githubData['payload']['forkee']['full_name'] |
|
| 214 | - ); |
|
| 215 | - $messageLong = sprintf( |
|
| 216 | - '<p>Forked <a href="%s" target="_blank" title="Github | %s">%s</a> to <a href="%s" target="_blank" title="Github | %s">%s</a>.', |
|
| 217 | - "https://github.com/{$githubData['repo']['name']}", |
|
| 218 | - $githubData['repo']['name'], |
|
| 219 | - $githubData['repo']['name'], |
|
| 220 | - $githubData['payload']['forkee']['html_url'], |
|
| 221 | - $githubData['payload']['forkee']['full_name'], |
|
| 222 | - $githubData['payload']['forkee']['full_name'] |
|
| 223 | - ); |
|
| 224 | - } else if ($github['type'] == 'PullRequestEvent') { |
|
| 225 | - $message = sprintf( |
|
| 226 | - '%s a pull request at %s', |
|
| 227 | - ucwords($githubData['payload']['action']), |
|
| 228 | - $githubData['repo']['name'] |
|
| 229 | - ); |
|
| 230 | - $messageLong = sprintf( |
|
| 231 | - '<p>%s pull request <a href="%s" target="_blank" title="Github | %s PR %d">%d</a> at <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 232 | - ucwords($githubData['payload']['action']), |
|
| 233 | - $githubData['payload']['pull_request']['html_url'], |
|
| 234 | - $githubData['repo']['name'], |
|
| 235 | - $githubData['payload']['number'], |
|
| 236 | - $githubData['payload']['number'], |
|
| 237 | - "https://github.com/{$githubData['repo']['name']}", |
|
| 238 | - $githubData['repo']['name'], |
|
| 239 | - $githubData['repo']['name'] |
|
| 240 | - ); |
|
| 241 | - } else if ($github['type'] == 'PushEvent') { |
|
| 242 | - $message = sprintf( |
|
| 243 | - 'Pushed some code at %s.', |
|
| 244 | - $githubData['repo']['name'] |
|
| 245 | - ); |
|
| 246 | - $messageLong = sprintf( |
|
| 247 | - "<p>Pushed some code at <a href=\"%s\" target=\"_blank\" title=\"Github | %s\">%s</a>.</p>\n", |
|
| 248 | - $githubData['payload']['ref'], |
|
| 249 | - "https://github.com/{$githubData['repo']['name']}", |
|
| 250 | - $githubData['repo']['name'], |
|
| 251 | - $githubData['repo']['name'] |
|
| 252 | - ); |
|
| 253 | - $messageLong .= "<ul>\n"; |
|
| 254 | - foreach ($githubData['payload']['commits'] as $commit) { |
|
| 255 | - $messageShort = $commit['message']; |
|
| 256 | - $messageShort = strtok($messageShort, "\n"); |
|
| 257 | - if (strlen($messageShort) > 72) { |
|
| 258 | - $messageShort = wordwrap($messageShort, 65); |
|
| 259 | - $messageShort = strtok($messageShort, "\n"); |
|
| 260 | - $messageShort .= '...'; |
|
| 261 | - } |
|
| 262 | - $messageLong .= sprintf( |
|
| 263 | - "<li><a href=\"%s\" target=\"_blank\" title=\"Github | %s\">%s</a> %s.</p>\n", |
|
| 264 | - "https://github.com/{$githubData['repo']['name']}/commit/{$commit['sha']}", |
|
| 265 | - substr($commit['sha'], 0, 7), |
|
| 266 | - substr($commit['sha'], 0, 7), |
|
| 267 | - $messageShort |
|
| 268 | - ); |
|
| 269 | - } |
|
| 270 | - $messageLong .= "</ul>"; |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - $activityRepository->insertActivity( |
|
| 274 | - $message, |
|
| 275 | - $messageLong, |
|
| 276 | - (new DateTime($github['datetime'])), |
|
| 277 | - [], |
|
| 278 | - 'git', |
|
| 279 | - $github['id'] |
|
| 280 | - ); |
|
| 167 | + $uniqueGithubCheck = $activityRepository->getActivityByTypeId('git', $github['id']); |
|
| 168 | + if ($uniqueGithubCheck !== false) { |
|
| 169 | + continue; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + $githubData = json_decode($github['metadata'], true); |
|
| 173 | + |
|
| 174 | + if ($github['type'] == 'CreateEvent') { |
|
| 175 | + if ( |
|
| 176 | + $githubData['payload']['ref_type'] == 'branch' || |
|
| 177 | + $githubData['payload']['ref_type'] == 'tag' |
|
| 178 | + ) { |
|
| 179 | + $message = sprintf( |
|
| 180 | + 'Created %s %s at %s.', |
|
| 181 | + $githubData['payload']['ref_type'], |
|
| 182 | + $githubData['payload']['ref'], |
|
| 183 | + $githubData['repo']['name'] |
|
| 184 | + ); |
|
| 185 | + $messageLong = sprintf( |
|
| 186 | + '<p>Created %s %s at <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 187 | + $githubData['payload']['ref_type'], |
|
| 188 | + $githubData['payload']['ref'], |
|
| 189 | + "https://github.com/{$githubData['repo']['name']}", |
|
| 190 | + $githubData['repo']['name'], |
|
| 191 | + $githubData['repo']['name'] |
|
| 192 | + ); |
|
| 193 | + } else if ($githubData['payload']['ref_type'] == 'repository') { |
|
| 194 | + $message = sprintf( |
|
| 195 | + 'Created %s %s.', |
|
| 196 | + $githubData['payload']['ref_type'], |
|
| 197 | + $githubData['repo']['name'] |
|
| 198 | + ); |
|
| 199 | + $messageLong = sprintf( |
|
| 200 | + '<p>Created %s <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 201 | + $githubData['payload']['ref_type'], |
|
| 202 | + "https://github.com/{$githubData['repo']['name']}", |
|
| 203 | + $githubData['repo']['name'], |
|
| 204 | + $githubData['repo']['name'] |
|
| 205 | + ); |
|
| 206 | + } else { |
|
| 207 | + continue; |
|
| 208 | + } |
|
| 209 | + } else if ($github['type'] == 'ForkEvent') { |
|
| 210 | + $message = sprintf( |
|
| 211 | + 'Forked %s to %s', |
|
| 212 | + $githubData['repo']['name'], |
|
| 213 | + $githubData['payload']['forkee']['full_name'] |
|
| 214 | + ); |
|
| 215 | + $messageLong = sprintf( |
|
| 216 | + '<p>Forked <a href="%s" target="_blank" title="Github | %s">%s</a> to <a href="%s" target="_blank" title="Github | %s">%s</a>.', |
|
| 217 | + "https://github.com/{$githubData['repo']['name']}", |
|
| 218 | + $githubData['repo']['name'], |
|
| 219 | + $githubData['repo']['name'], |
|
| 220 | + $githubData['payload']['forkee']['html_url'], |
|
| 221 | + $githubData['payload']['forkee']['full_name'], |
|
| 222 | + $githubData['payload']['forkee']['full_name'] |
|
| 223 | + ); |
|
| 224 | + } else if ($github['type'] == 'PullRequestEvent') { |
|
| 225 | + $message = sprintf( |
|
| 226 | + '%s a pull request at %s', |
|
| 227 | + ucwords($githubData['payload']['action']), |
|
| 228 | + $githubData['repo']['name'] |
|
| 229 | + ); |
|
| 230 | + $messageLong = sprintf( |
|
| 231 | + '<p>%s pull request <a href="%s" target="_blank" title="Github | %s PR %d">%d</a> at <a href="%s" target="_blank" title="Github | %s">%s</a>.</p>', |
|
| 232 | + ucwords($githubData['payload']['action']), |
|
| 233 | + $githubData['payload']['pull_request']['html_url'], |
|
| 234 | + $githubData['repo']['name'], |
|
| 235 | + $githubData['payload']['number'], |
|
| 236 | + $githubData['payload']['number'], |
|
| 237 | + "https://github.com/{$githubData['repo']['name']}", |
|
| 238 | + $githubData['repo']['name'], |
|
| 239 | + $githubData['repo']['name'] |
|
| 240 | + ); |
|
| 241 | + } else if ($github['type'] == 'PushEvent') { |
|
| 242 | + $message = sprintf( |
|
| 243 | + 'Pushed some code at %s.', |
|
| 244 | + $githubData['repo']['name'] |
|
| 245 | + ); |
|
| 246 | + $messageLong = sprintf( |
|
| 247 | + "<p>Pushed some code at <a href=\"%s\" target=\"_blank\" title=\"Github | %s\">%s</a>.</p>\n", |
|
| 248 | + $githubData['payload']['ref'], |
|
| 249 | + "https://github.com/{$githubData['repo']['name']}", |
|
| 250 | + $githubData['repo']['name'], |
|
| 251 | + $githubData['repo']['name'] |
|
| 252 | + ); |
|
| 253 | + $messageLong .= "<ul>\n"; |
|
| 254 | + foreach ($githubData['payload']['commits'] as $commit) { |
|
| 255 | + $messageShort = $commit['message']; |
|
| 256 | + $messageShort = strtok($messageShort, "\n"); |
|
| 257 | + if (strlen($messageShort) > 72) { |
|
| 258 | + $messageShort = wordwrap($messageShort, 65); |
|
| 259 | + $messageShort = strtok($messageShort, "\n"); |
|
| 260 | + $messageShort .= '...'; |
|
| 261 | + } |
|
| 262 | + $messageLong .= sprintf( |
|
| 263 | + "<li><a href=\"%s\" target=\"_blank\" title=\"Github | %s\">%s</a> %s.</p>\n", |
|
| 264 | + "https://github.com/{$githubData['repo']['name']}/commit/{$commit['sha']}", |
|
| 265 | + substr($commit['sha'], 0, 7), |
|
| 266 | + substr($commit['sha'], 0, 7), |
|
| 267 | + $messageShort |
|
| 268 | + ); |
|
| 269 | + } |
|
| 270 | + $messageLong .= "</ul>"; |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + $activityRepository->insertActivity( |
|
| 274 | + $message, |
|
| 275 | + $messageLong, |
|
| 276 | + (new DateTime($github['datetime'])), |
|
| 277 | + [], |
|
| 278 | + 'git', |
|
| 279 | + $github['id'] |
|
| 280 | + ); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // books |
@@ -286,46 +286,46 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | $lastGoodreadActivity = $activityRepository->getActivityLastUpdateByType('book'); |
| 288 | 288 | if ($lastGoodreadActivity === false) { |
| 289 | - $lastGoodreadActivityDateTime = new DateTime('2010-08-28'); |
|
| 289 | + $lastGoodreadActivityDateTime = new DateTime('2010-08-28'); |
|
| 290 | 290 | } else { |
| 291 | - $lastGoodreadActivityDateTime = new DateTime($lastGoodreadActivity['updated_at']); |
|
| 292 | - $lastGoodreadActivityDateTime->modify('-5 days'); |
|
| 291 | + $lastGoodreadActivityDateTime = new DateTime($lastGoodreadActivity['updated_at']); |
|
| 292 | + $lastGoodreadActivityDateTime->modify('-5 days'); |
|
| 293 | 293 | } |
| 294 | 294 | $newGoodreadActivity = $goodreadRepository->getGoodreadsUpdatedSince($lastGoodreadActivityDateTime); |
| 295 | 295 | foreach ($newGoodreadActivity as $goodread) { |
| 296 | - $uniqueGoodreadCheck = $activityRepository->getActivityByTypeId('book', $goodread['id']); |
|
| 297 | - if ($uniqueGoodreadCheck !== false) { |
|
| 298 | - continue; |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - $goodreadData = json_decode($goodread['metadata'], true); |
|
| 302 | - |
|
| 303 | - if (empty($goodreadData['user_read_at'])) { |
|
| 304 | - continue; |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - $message = sprintf( |
|
| 308 | - 'Just finished reading %s by %s.', |
|
| 309 | - $goodreadData['title'], |
|
| 310 | - $goodreadData['author_name'] |
|
| 311 | - ); |
|
| 312 | - if (isset($goodreadData['book_large_image_url'])) { |
|
| 313 | - $messageLong = sprintf( |
|
| 314 | - "<img alt=\"Goodreads | %s\" src=\"%s\" />\n", |
|
| 315 | - $goodreadData['title'], |
|
| 316 | - $goodreadData['book_large_image_url'] |
|
| 317 | - ); |
|
| 318 | - } |
|
| 319 | - $messageLong .= "<p>{$message}</p>"; |
|
| 320 | - |
|
| 321 | - $activityRepository->insertActivity( |
|
| 322 | - $message, |
|
| 323 | - $messageLong, |
|
| 324 | - (new DateTime($goodread['datetime'])), |
|
| 325 | - [], |
|
| 326 | - 'book', |
|
| 327 | - $goodread['id'] |
|
| 328 | - ); |
|
| 296 | + $uniqueGoodreadCheck = $activityRepository->getActivityByTypeId('book', $goodread['id']); |
|
| 297 | + if ($uniqueGoodreadCheck !== false) { |
|
| 298 | + continue; |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + $goodreadData = json_decode($goodread['metadata'], true); |
|
| 302 | + |
|
| 303 | + if (empty($goodreadData['user_read_at'])) { |
|
| 304 | + continue; |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + $message = sprintf( |
|
| 308 | + 'Just finished reading %s by %s.', |
|
| 309 | + $goodreadData['title'], |
|
| 310 | + $goodreadData['author_name'] |
|
| 311 | + ); |
|
| 312 | + if (isset($goodreadData['book_large_image_url'])) { |
|
| 313 | + $messageLong = sprintf( |
|
| 314 | + "<img alt=\"Goodreads | %s\" src=\"%s\" />\n", |
|
| 315 | + $goodreadData['title'], |
|
| 316 | + $goodreadData['book_large_image_url'] |
|
| 317 | + ); |
|
| 318 | + } |
|
| 319 | + $messageLong .= "<p>{$message}</p>"; |
|
| 320 | + |
|
| 321 | + $activityRepository->insertActivity( |
|
| 322 | + $message, |
|
| 323 | + $messageLong, |
|
| 324 | + (new DateTime($goodread['datetime'])), |
|
| 325 | + [], |
|
| 326 | + 'book', |
|
| 327 | + $goodread['id'] |
|
| 328 | + ); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
@@ -334,96 +334,96 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $lastTwitterActivity = $activityRepository->getActivityLastUpdateByType('twitter'); |
| 336 | 336 | if ($lastTwitterActivity === false) { |
| 337 | - $lastTwitterActivityDateTime = new DateTime('2010-03-10'); |
|
| 337 | + $lastTwitterActivityDateTime = new DateTime('2010-03-10'); |
|
| 338 | 338 | } else { |
| 339 | - $lastTwitterActivityDateTime = new DateTime($lastTwitterActivity['updated_at']); |
|
| 340 | - $lastTwitterActivityDateTime->modify('-5 days'); |
|
| 339 | + $lastTwitterActivityDateTime = new DateTime($lastTwitterActivity['updated_at']); |
|
| 340 | + $lastTwitterActivityDateTime->modify('-5 days'); |
|
| 341 | 341 | } |
| 342 | 342 | $newTwitterActivity = $twitterRepository->getTwittersUpdatedSince($lastTwitterActivityDateTime); |
| 343 | 343 | foreach ($newTwitterActivity as $twitter) { |
| 344 | - $uniqueTwitterCheck = $activityRepository->getActivityByTypeId('twitter', $twitter['id']); |
|
| 345 | - if ($uniqueTwitterCheck !== false) { |
|
| 346 | - // check for metadata update |
|
| 347 | - continue; |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - $twitterData = json_decode($twitter['metadata'], true); |
|
| 351 | - |
|
| 352 | - $message = $twitterData['text']; |
|
| 353 | - |
|
| 354 | - $hashtag_link_pattern = '<a href="http://twitter.com/search?q=%%23%s&src=hash" rel="nofollow" target="_blank">#%s</a>'; |
|
| 355 | - $url_link_pattern = '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>'; |
|
| 356 | - $user_mention_link_pattern = '<a href="http://twitter.com/%s" rel="nofollow" target="_blank" title="%s">@%s</a>'; |
|
| 357 | - $media_link_pattern = '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>'; |
|
| 358 | - |
|
| 359 | - $entityHolder = []; |
|
| 360 | - foreach ($twitterData['entities'] as $entityType => $entities) { |
|
| 361 | - foreach ($entities as $entity) { |
|
| 362 | - if ($entityType == 'hashtags') { |
|
| 363 | - $replace = sprintf( |
|
| 364 | - '<a href="https://twitter.com/search?q=%%23%s&src=hash" rel="nofollow" target="_blank">#%s</a>', |
|
| 365 | - $entity['text'], |
|
| 366 | - $entity['text'] |
|
| 367 | - ); |
|
| 368 | - } else if ($entityType == 'urls') { |
|
| 369 | - $replace = sprintf( |
|
| 370 | - '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>', |
|
| 371 | - $entity['url'], |
|
| 372 | - $entity['expanded_url'], |
|
| 373 | - $entity['display_url'] |
|
| 374 | - ); |
|
| 375 | - } else if ($entityType == 'user_mentions') { |
|
| 376 | - $replace = sprintf( |
|
| 377 | - '<a href="https://twitter.com/%s" rel="nofollow" target="_blank" title="Twitter | %s">@%s</a>', |
|
| 378 | - strtolower($entity['screen_name']), |
|
| 379 | - $entity['name'], |
|
| 380 | - $entity['screen_name'] |
|
| 381 | - ); |
|
| 382 | - } else if ($entityType == 'media') { |
|
| 383 | - $replace = sprintf( |
|
| 384 | - "<a href=\"%s\" rel=\"nofollow\" target=\"_blank\" title=\"%s\">\n" . |
|
| 385 | - "<img src=\"%s:%s\" alt=\"%s\" height=\"%s\" width=\"%s\" />\n" . |
|
| 386 | - "</a>", |
|
| 387 | - $entity['url'], |
|
| 388 | - $entity['display_url'], |
|
| 389 | - $entity['media_url'], |
|
| 390 | - 'large', |
|
| 391 | - $entity['display_url'], |
|
| 392 | - $entity['sizes']['large']['h'], |
|
| 393 | - $entity['sizes']['large']['w'] |
|
| 394 | - ); |
|
| 395 | - } else { |
|
| 396 | - continue 2; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - $entityHolder[$entity['indices'][0]] = [ |
|
| 400 | - 'start' => $entity['indices'][0], |
|
| 401 | - 'end' => $entity['indices'][1], |
|
| 402 | - 'replace' => $replace, |
|
| 403 | - ]; |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - $messageLong = $twitterData['text']; |
|
| 408 | - krsort($entityHolder); |
|
| 409 | - foreach($entityHolder as $entity) |
|
| 410 | - { |
|
| 411 | - $messageLong = substr_replace( |
|
| 412 | - $messageLong, |
|
| 413 | - $entity['replace'], |
|
| 414 | - $entity['start'], |
|
| 415 | - $entity['end'] - $entity['start'] |
|
| 416 | - ); |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - $activityRepository->insertActivity( |
|
| 420 | - $message, |
|
| 421 | - $messageLong, |
|
| 422 | - (new DateTime($twitter['datetime'])), |
|
| 423 | - [], // metadata |
|
| 424 | - 'twitter', |
|
| 425 | - $twitter['id'] |
|
| 426 | - ); |
|
| 344 | + $uniqueTwitterCheck = $activityRepository->getActivityByTypeId('twitter', $twitter['id']); |
|
| 345 | + if ($uniqueTwitterCheck !== false) { |
|
| 346 | + // check for metadata update |
|
| 347 | + continue; |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + $twitterData = json_decode($twitter['metadata'], true); |
|
| 351 | + |
|
| 352 | + $message = $twitterData['text']; |
|
| 353 | + |
|
| 354 | + $hashtag_link_pattern = '<a href="http://twitter.com/search?q=%%23%s&src=hash" rel="nofollow" target="_blank">#%s</a>'; |
|
| 355 | + $url_link_pattern = '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>'; |
|
| 356 | + $user_mention_link_pattern = '<a href="http://twitter.com/%s" rel="nofollow" target="_blank" title="%s">@%s</a>'; |
|
| 357 | + $media_link_pattern = '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>'; |
|
| 358 | + |
|
| 359 | + $entityHolder = []; |
|
| 360 | + foreach ($twitterData['entities'] as $entityType => $entities) { |
|
| 361 | + foreach ($entities as $entity) { |
|
| 362 | + if ($entityType == 'hashtags') { |
|
| 363 | + $replace = sprintf( |
|
| 364 | + '<a href="https://twitter.com/search?q=%%23%s&src=hash" rel="nofollow" target="_blank">#%s</a>', |
|
| 365 | + $entity['text'], |
|
| 366 | + $entity['text'] |
|
| 367 | + ); |
|
| 368 | + } else if ($entityType == 'urls') { |
|
| 369 | + $replace = sprintf( |
|
| 370 | + '<a href="%s" rel="nofollow" target="_blank" title="%s">%s</a>', |
|
| 371 | + $entity['url'], |
|
| 372 | + $entity['expanded_url'], |
|
| 373 | + $entity['display_url'] |
|
| 374 | + ); |
|
| 375 | + } else if ($entityType == 'user_mentions') { |
|
| 376 | + $replace = sprintf( |
|
| 377 | + '<a href="https://twitter.com/%s" rel="nofollow" target="_blank" title="Twitter | %s">@%s</a>', |
|
| 378 | + strtolower($entity['screen_name']), |
|
| 379 | + $entity['name'], |
|
| 380 | + $entity['screen_name'] |
|
| 381 | + ); |
|
| 382 | + } else if ($entityType == 'media') { |
|
| 383 | + $replace = sprintf( |
|
| 384 | + "<a href=\"%s\" rel=\"nofollow\" target=\"_blank\" title=\"%s\">\n" . |
|
| 385 | + "<img src=\"%s:%s\" alt=\"%s\" height=\"%s\" width=\"%s\" />\n" . |
|
| 386 | + "</a>", |
|
| 387 | + $entity['url'], |
|
| 388 | + $entity['display_url'], |
|
| 389 | + $entity['media_url'], |
|
| 390 | + 'large', |
|
| 391 | + $entity['display_url'], |
|
| 392 | + $entity['sizes']['large']['h'], |
|
| 393 | + $entity['sizes']['large']['w'] |
|
| 394 | + ); |
|
| 395 | + } else { |
|
| 396 | + continue 2; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + $entityHolder[$entity['indices'][0]] = [ |
|
| 400 | + 'start' => $entity['indices'][0], |
|
| 401 | + 'end' => $entity['indices'][1], |
|
| 402 | + 'replace' => $replace, |
|
| 403 | + ]; |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + $messageLong = $twitterData['text']; |
|
| 408 | + krsort($entityHolder); |
|
| 409 | + foreach($entityHolder as $entity) |
|
| 410 | + { |
|
| 411 | + $messageLong = substr_replace( |
|
| 412 | + $messageLong, |
|
| 413 | + $entity['replace'], |
|
| 414 | + $entity['start'], |
|
| 415 | + $entity['end'] - $entity['start'] |
|
| 416 | + ); |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + $activityRepository->insertActivity( |
|
| 420 | + $message, |
|
| 421 | + $messageLong, |
|
| 422 | + (new DateTime($twitter['datetime'])), |
|
| 423 | + [], // metadata |
|
| 424 | + 'twitter', |
|
| 425 | + $twitter['id'] |
|
| 426 | + ); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | // youtube |
@@ -432,39 +432,39 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | $lastYouTubeActivity = $activityRepository->getActivityLastUpdateByType('youtube'); |
| 434 | 434 | if ($lastYouTubeActivity === false) { |
| 435 | - $lastYouTubeActivityDateTime = new DateTime('2010-08-28'); |
|
| 435 | + $lastYouTubeActivityDateTime = new DateTime('2010-08-28'); |
|
| 436 | 436 | } else { |
| 437 | - $lastYouTubeActivityDateTime = new DateTime($lastYouTubeActivity['updated_at']); |
|
| 438 | - $lastYouTubeActivityDateTime->modify('-5 days'); |
|
| 437 | + $lastYouTubeActivityDateTime = new DateTime($lastYouTubeActivity['updated_at']); |
|
| 438 | + $lastYouTubeActivityDateTime->modify('-5 days'); |
|
| 439 | 439 | } |
| 440 | 440 | $newYouTubeActivity = $youTubeRepository->getYouTubesUpdatedSince($lastYouTubeActivityDateTime); |
| 441 | 441 | foreach ($newYouTubeActivity as $youTube) { |
| 442 | - $uniqueYouTubeCheck = $activityRepository->getActivityByTypeId('youtube', $youTube['id']); |
|
| 443 | - if ($uniqueYouTubeCheck !== false) { |
|
| 444 | - continue; |
|
| 445 | - } |
|
| 446 | - |
|
| 447 | - $youTubeData = json_decode($youTube['metadata'], true); |
|
| 448 | - |
|
| 449 | - $message = sprintf( |
|
| 450 | - 'Favorited %s on YouTube.', |
|
| 451 | - $youTubeData['snippet']['title'] |
|
| 452 | - ); |
|
| 453 | - $messageLong = sprintf( |
|
| 454 | - "<iframe src=\"%s\" frameborder=\"0\" allowfullscreen></iframe>\n" . |
|
| 455 | - "<p>Favorited <a href=\"%s\" target=\"_blank\" title=\"YouTube | %s\">%s</a> on YouTube.</p>", |
|
| 456 | - "https://www.youtube.com/embed/{$youTubeData['contentDetails']['videoId']}", |
|
| 457 | - "https://youtu.be/{$youTubeData['contentDetails']['videoId']}", |
|
| 458 | - $youTubeData['snippet']['title'], |
|
| 459 | - $youTubeData['snippet']['title'] |
|
| 460 | - ); |
|
| 461 | - |
|
| 462 | - $activityRepository->insertActivity( |
|
| 463 | - $message, |
|
| 464 | - $messageLong, |
|
| 465 | - (new DateTime($youTube['datetime'])), |
|
| 466 | - [], |
|
| 467 | - 'youtube', |
|
| 468 | - $youTube['id'] |
|
| 469 | - ); |
|
| 442 | + $uniqueYouTubeCheck = $activityRepository->getActivityByTypeId('youtube', $youTube['id']); |
|
| 443 | + if ($uniqueYouTubeCheck !== false) { |
|
| 444 | + continue; |
|
| 445 | + } |
|
| 446 | + |
|
| 447 | + $youTubeData = json_decode($youTube['metadata'], true); |
|
| 448 | + |
|
| 449 | + $message = sprintf( |
|
| 450 | + 'Favorited %s on YouTube.', |
|
| 451 | + $youTubeData['snippet']['title'] |
|
| 452 | + ); |
|
| 453 | + $messageLong = sprintf( |
|
| 454 | + "<iframe src=\"%s\" frameborder=\"0\" allowfullscreen></iframe>\n" . |
|
| 455 | + "<p>Favorited <a href=\"%s\" target=\"_blank\" title=\"YouTube | %s\">%s</a> on YouTube.</p>", |
|
| 456 | + "https://www.youtube.com/embed/{$youTubeData['contentDetails']['videoId']}", |
|
| 457 | + "https://youtu.be/{$youTubeData['contentDetails']['videoId']}", |
|
| 458 | + $youTubeData['snippet']['title'], |
|
| 459 | + $youTubeData['snippet']['title'] |
|
| 460 | + ); |
|
| 461 | + |
|
| 462 | + $activityRepository->insertActivity( |
|
| 463 | + $message, |
|
| 464 | + $messageLong, |
|
| 465 | + (new DateTime($youTube['datetime'])), |
|
| 466 | + [], |
|
| 467 | + 'youtube', |
|
| 468 | + $youTube['id'] |
|
| 469 | + ); |
|
| 470 | 470 | } |
@@ -406,7 +406,7 @@ |
||
| 406 | 406 | |
| 407 | 407 | $messageLong = $twitterData['text']; |
| 408 | 408 | krsort($entityHolder); |
| 409 | - foreach($entityHolder as $entity) |
|
| 409 | + foreach ($entityHolder as $entity) |
|
| 410 | 410 | { |
| 411 | 411 | $messageLong = substr_replace( |
| 412 | 412 | $messageLong, |