Skip to content

Commit 864a7ef

Browse files
committed
linking
1 parent 0e8a088 commit 864a7ef

3 files changed

Lines changed: 63 additions & 4 deletions

File tree

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ $places = $client->scrapePlaces(
5757
);
5858
```
5959

60+
**Хелперы Place:**
61+
62+
```php
63+
$place->hasContactInfo(); // есть телефоны или email
64+
$place->getFirstPhone(); // первый номер телефона или null
65+
$place->hasWebsite(); // есть ли сайт
66+
$place->getCoordinates(); // ['lat' => float, 'lng' => float] или null
67+
$place->isVerified(); // владелец подтверждён
68+
$place->hasVideos(); // есть ли видео
69+
$place->hasMenu(); // есть ли меню
70+
```
71+
6072
### Отзывы (Яндекс Карты)
6173

6274
```php
@@ -79,6 +91,18 @@ foreach ($reviews as $review) {
7991
}
8092
```
8193

94+
**Хелперы Review:**
95+
96+
```php
97+
$review->hasBusinessReply(); // есть ли ответ компании
98+
$review->getBusinessReplyText(); // текст ответа или null
99+
$review->hasPhotos(); // есть ли фото
100+
$review->hasVideos(); // есть ли видео
101+
$review->isPositive(); // рейтинг >= 4
102+
$review->isNegative(); // рейтинг <= 2
103+
$review->hasTranslation(); // есть ли переводы текста
104+
```
105+
82106
### Товары (Яндекс Маркет)
83107

84108
```php
@@ -107,6 +131,18 @@ foreach ($products as $product) {
107131
}
108132
```
109133

134+
**Хелперы Product:**
135+
136+
```php
137+
$product->hasReviews(); // есть ли отзывы
138+
$product->hasImages(); // есть ли фото
139+
$product->isInStock(); // товар в наличии
140+
$product->getPriceFormatted(); // "54 990 RUB" или null
141+
$product->getYaBankDiscount(); // скидка в % (напр. 10.0) или null
142+
$product->hasUgcImages(); // есть ли пользовательские фото
143+
$product->hasVideos(); // есть ли видео
144+
```
145+
110146
### Недвижимость (Яндекс Недвижимость)
111147

112148
```php
@@ -141,6 +177,29 @@ foreach ($listings as $listing) {
141177
}
142178
```
143179

180+
**Хелперы Listing:**
181+
182+
```php
183+
$listing->getPriceValue(); // цена в рублях или null
184+
$listing->getPriceCurrency(); // валюта ("RUR") или null
185+
$listing->getPriceTrend(); // "INCREASED", "DECREASED", "UNCHANGED" или null
186+
$listing->getPreviousPrice(); // предыдущая цена или null
187+
$listing->getAddress(); // полный адрес или null
188+
$listing->getCoordinates(); // ['lat' => float, 'lng' => float] или null
189+
$listing->getCity(); // город или null
190+
$listing->getRegion(); // регион или null
191+
$listing->getAreaValue(); // площадь в м² или null
192+
$listing->hasPhones(); // есть ли телефоны
193+
$listing->getFirstPhone(); // первый номер или null
194+
$listing->getWhatsAppPhones(); // номера WhatsApp от автора
195+
$listing->hasImages(); // есть ли фото
196+
$listing->hasPriceHistory(); // есть ли история цен
197+
$listing->getSellerName(); // имя продавца/агентства или null
198+
$listing->isFromOwner(); // от собственника (не агентство)
199+
$listing->getBuildingYear(); // год постройки или null
200+
$listing->getPredictedPrice(); // ['min' => int, 'max' => int, 'value' => int] или null
201+
```
202+
144203
## Перечисления
145204

146205
| Enum | Значения |
@@ -189,7 +248,7 @@ try {
189248

190249
## См. также
191250

192-
- [2GIS Parser PHP](https://github.com/Scraper-APIs/2gis-parser-php) — парсинг 2ГИС (организации, отзывы, недвижимость, вакансии)
251+
- [2GIS Parser PHP](https://github.com/Scraper-APIs/2gis-parser-php) — парсинг 2ГИС (организации и отзывы, недвижимость, вакансии)
193252

194253
## Лицензия
195254

src/DTO/Place.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ public function hasWebsite(): bool
295295
/**
296296
* Get coordinates as an associative array, or null if not available.
297297
*
298-
* @return array{lng: float, lat: float}|null
298+
* @return array{lat: float, lng: float}|null
299299
*/
300300
public function getCoordinates(): ?array
301301
{
302302
if ($this->longitude === null || $this->latitude === null) {
303303
return null;
304304
}
305305

306-
return ['lng' => $this->longitude, 'lat' => $this->latitude];
306+
return ['lat' => $this->latitude, 'lng' => $this->longitude];
307307
}
308308

309309
/**

tests/PlaceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
it('gets coordinates', function () {
112112
$place = Place::fromArray(getSamplePlaceData());
113113

114-
expect($place->getCoordinates())->toBe(['lng' => 37.600312, 'lat' => 55.764353]);
114+
expect($place->getCoordinates())->toBe(['lat' => 55.764353, 'lng' => 37.600312]);
115115
});
116116

117117
it('checks verified status', function () {

0 commit comments

Comments
 (0)