| @@ 25-60 (lines=36) @@ | ||
| 22 | * @method string getId() Shipping option identifier |
|
| 23 | * @method string getTitle() Option title |
|
| 24 | **/ |
|
| 25 | class ShippingOption extends Entity |
|
| 26 | { |
|
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function subEntities() |
|
| 31 | { |
|
| 32 | return [ |
|
| 33 | 'prices' => LabeledPrice::class, |
|
| 34 | ]; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * List of price portions |
|
| 39 | * |
|
| 40 | * This method overrides the default getPrices method and returns a nice array |
|
| 41 | * |
|
| 42 | * @return LabeledPrice[] |
|
| 43 | */ |
|
| 44 | public function getPrices() |
|
| 45 | { |
|
| 46 | $all_prices = []; |
|
| 47 | ||
| 48 | if ($these_prices = $this->getProperty('prices')) { |
|
| 49 | foreach ($these_prices as $prices) { |
|
| 50 | $new_prices = []; |
|
| 51 | foreach ($prices as $price) { |
|
| 52 | $new_prices[] = new LabeledPrice($price); |
|
| 53 | } |
|
| 54 | $all_prices[] = $new_prices; |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | return $all_prices; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 20-55 (lines=36) @@ | ||
| 17 | * |
|
| 18 | * @method int getTotalCount() Total number of profile pictures the target user has |
|
| 19 | */ |
|
| 20 | class UserProfilePhotos extends Entity |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * {@inheritdoc} |
|
| 24 | */ |
|
| 25 | protected function subEntities() |
|
| 26 | { |
|
| 27 | return [ |
|
| 28 | 'photos' => PhotoSize::class, |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Requested profile pictures (in up to 4 sizes each) |
|
| 34 | * |
|
| 35 | * This method overrides the default getPhotos method and returns a nice array |
|
| 36 | * |
|
| 37 | * @return PhotoSize[] |
|
| 38 | */ |
|
| 39 | public function getPhotos() |
|
| 40 | { |
|
| 41 | $all_photos = []; |
|
| 42 | ||
| 43 | if ($these_photos = $this->getProperty('photos')) { |
|
| 44 | foreach ($these_photos as $photos) { |
|
| 45 | $new_photos = []; |
|
| 46 | foreach ($photos as $photo) { |
|
| 47 | $new_photos[] = new PhotoSize($photo); |
|
| 48 | } |
|
| 49 | $all_photos[] = $new_photos; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | return $all_photos; |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||