File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,3 @@ APP_ENV=dev
33APP_DEBUG = 1
44APP_SECRET = 67d829bf61dc5f87a73fd814e2c9f622
55# ##< symfony/framework-bundle ###
6-
7- # meetup.com api - from https://www.meetup.com/api/oauth/list/ - complete in .env.local
8- MEETUP_COM_OAUTH_KEY =
9- MEETUP_COM_OAUTH_SECRET =
Original file line number Diff line number Diff line change 1212
1313 steps :
1414 - uses : actions/checkout@v6
15- with :
16- token : ${{ secrets.ACCESS_TOKEN || github.token }}
1715
1816 - uses : shivammathur/setup-php@v2
1917 with :
Original file line number Diff line number Diff line change @@ -19,15 +19,6 @@ cd friendsofphp.org
1919composer install
2020```
2121
22- - Copy ` .env ` to ` .env.local `
23- - Add your [ Meetup.com API keys] ( https://secure.meetup.com/meetup_api/oauth_consumers/ ) :
24-
25- ``` dotenv
26- # .env.local
27- MEETUP_COM_OAUTH_KEY=...
28- MEETUP_COM_OAUTH_SECRET=...
29- ```
30-
3122- Update Meetup Data
3223
3324``` bash
Original file line number Diff line number Diff line change 6262 "sort-packages" : true ,
6363 "allow-plugins" : {
6464 "phpstan/extension-installer" : true
65+ },
66+ "platform" : {
67+ "php" : " 8.3"
6568 }
6669 },
6770 "minimum-stability" : " dev" ,
Original file line number Diff line number Diff line change @@ -51,16 +51,16 @@ public function createFromData(array $data): ?Meetup
5151 $ dateTimeImmutable = new DateTimeImmutable ($ data ['startDate ' ]);
5252
5353 return new Meetup (
54- $ name ,
55- html_entity_decode ((string ) $ data [self ::GROUP ][self ::NAME ]),
56- $ dateTimeImmutable ->setTimezone (new DateTimeZone ('UTC ' )),
57- $ dateTimeImmutable ->format ('Y-m-d ' ),
58- $ dateTimeImmutable ->format ('H:i ' ),
59- $ data ['url ' ],
60- $ location ->getCity (),
61- $ location ->getCountry (),
62- $ location ->getCoordinateLatitude (),
63- $ location ->getCoordinateLongitude (),
54+ name: $ name ,
55+ userGroupName: html_entity_decode ((string ) $ data [self ::GROUP ][self ::NAME ]),
56+ utcStartDateTime: $ dateTimeImmutable ->setTimezone (new DateTimeZone ('UTC ' )),
57+ localDate: $ dateTimeImmutable ->format ('Y-m-d ' ),
58+ localTime: $ dateTimeImmutable ->format ('H:i ' ),
59+ url: $ data ['url ' ],
60+ city: $ location ->getCity (),
61+ country: $ location ->getCountry (),
62+ latitude: $ location ->getCoordinateLatitude (),
63+ longitude: $ location ->getCoordinateLongitude (),
6464 );
6565 }
6666
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ public function getMeetupsByGroupSlug(string $groupSlug): array
3939 continue ;
4040 }
4141
42+ if (! isset ($ schema ['url ' ])) {
43+ continue ;
44+ }
45+
4246 if (! isset ($ schema ['organizer ' ]['url ' ])) {
4347 continue ;
4448 }
@@ -47,7 +51,21 @@ public function getMeetupsByGroupSlug(string $groupSlug): array
4751 continue ;
4852 }
4953
50- $ data [] = $ schema ;
54+ $ crawler = $ this ->httpBrowser ->request ('GET ' , $ schema ['url ' ]);
55+ $ innerStructuredDataElements = $ crawler ->filter ('script[type="application/ld+json"] ' );
56+
57+ foreach ($ innerStructuredDataElements as $ innerStructuredDataElement ) {
58+ $ innerSchema = Json::decode ($ innerStructuredDataElement ->textContent , Json::FORCE_ARRAY );
59+ if (! isset ($ innerSchema ['@type ' ])) {
60+ continue ;
61+ }
62+
63+ if ($ innerSchema ['@type ' ] !== 'Event ' ) {
64+ continue ;
65+ }
66+
67+ $ data [] = $ innerSchema ;
68+ }
5169 }
5270 }
5371
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ public function testGetMeetupsByGroupSlug(): void
1717 {
1818 // Arrange
1919 $ smartFileSystem = new SmartFileSystem ();
20- $ mockResponse = new MockResponse ($ smartFileSystem ->readFile (__DIR__ . '/fixtures/meetup_events.html ' ));
21- $ mockHttpClient = new MockHttpClient ([$ mockResponse ]);
20+ $ mockResponseList = new MockResponse ($ smartFileSystem ->readFile (__DIR__ . '/fixtures/meetup_events.html ' ));
21+ $ mockResponseDetail = new MockResponse ($ smartFileSystem ->readFile (__DIR__ . '/fixtures/meetup_detail.html ' ));
22+ $ mockHttpClient = new MockHttpClient ([$ mockResponseList , $ mockResponseDetail ]);
2223 $ httpBrowser = new HttpBrowser ($ mockHttpClient );
2324 $ meetupComCrawler = new MeetupComCrawler ($ httpBrowser );
2425
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments