Пример #1
0
 public static function getMergedFromArrays(array $meetupEvent = [], array $dbEvent = null)
 {
     if (empty($meetupEvent)) {
         $supporter = new NullSupporter();
         $date = new \DateTime();
         $talk = new NullTalk();
         $venue = new NullVenue();
         $model = new EventModel($talk, $date, $venue, $supporter);
         return $model;
     }
     if (!is_null($dbEvent)) {
         $speaker = new Speaker($dbEvent['first_name'], $dbEvent['last_name'], new Email($dbEvent['email']), new Twitter($dbEvent['twitter']), $dbEvent['avatar']);
         $speaker->setId($dbEvent['speaker_id']);
         $supporter = new Supporter($dbEvent['supporter_name'], $dbEvent['supporter_url'], new Twitter($dbEvent['supporter_twitter']), new Email($dbEvent['supporter_email']), $dbEvent['supporter_logo']);
         $supporter->setId($dbEvent['supporter_id']);
     } else {
         $speaker = new NullSpeaker();
         $supporter = new NullSupporter();
     }
     $talk = new Talk($meetupEvent['subject'], $meetupEvent['description'], $speaker);
     $venue = new Venue($meetupEvent['venue_name'], $meetupEvent['venue_address']);
     $venue->setId($meetupEvent['venue_id']);
     $date = \DateTime::createFromFormat('F jS Y g:ia', $meetupEvent['date'] . ' ' . $meetupEvent['time']);
     $event = new EventModel($talk, $date, $venue, $supporter);
     $event->setName($meetupEvent['group']);
     $event->setMindsUrl($meetupEvent['minds_url']);
     $event->setMeetupID($meetupEvent['id']);
     $event->setMeetupURL($meetupEvent['event_url']);
     return $event;
 }
Пример #2
0
 protected function getEvent()
 {
     $email = new Email('*****@*****.**');
     $twitter = new Twitter('@PHPMiNDS');
     $startDate = '2017-03-10';
     $startTime = '20:00';
     $eventDuration = 'PT2H';
     $speaker = new Speaker('AnAwesome', 'Speaker', $email, $twitter);
     $speaker->setId(300);
     $talk = new Talk('A title', 'A description. But I think we need a much longer description in order for joind.in to accept this talk...', $speaker, $eventDuration);
     $talk->setId(200);
     $venue = new Venue('JH', 'by the sidewalk', 'Europe');
     $venue->setId(100);
     $supporter = new Supporter('a big fan', 'youareawso.me', $twitter, $email, 'http://nolo.go');
     $supporter->setId(350);
     return new EventModel($talk, $startDate, $startTime, $venue, $supporter);
 }
Пример #3
0
 public function testCreateInstanceWithNoParamsReturnsNullObject()
 {
     $supporter = Supporter::create();
     $this->assertFalse($supporter->exists());
 }
Пример #4
0
 /**
  * @param $supporterID
  * @return Supporter
  */
 public function getSupporterByID($supporterID) : SupporterInterface
 {
     return Supporter::create($this->getById($supporterID));
 }