Code Duplication    Length = 26-36 lines in 3 locations

src/Entities/Payments/ShippingOption.php 1 location

@@ 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

src/Entities/StickerSet.php 1 location

@@ 22-47 (lines=26) @@
19
 * @method string getTitle()         Sticker set title
20
 * @method bool   getContainsMasks() True, if the sticker set contains masks
21
 */
22
class StickerSet extends Entity
23
{
24
    /**
25
     * List of all set stickers
26
     *
27
     * This method overrides the default getStickers method and returns a nice array
28
     *
29
     * @return Sticker[]
30
     */
31
    public function getStickers()
32
    {
33
        $all_stickers = [];
34
35
        if ($these_stickers = $this->getProperty('stickers')) {
36
            foreach ($these_stickers as $stickers) {
37
                $new_stickers = [];
38
                foreach ($stickers as $sticker) {
39
                    $new_stickers[] = new Sticker($sticker);
40
                }
41
                $all_stickers[] = $new_stickers;
42
            }
43
        }
44
45
        return $all_stickers;
46
    }
47
}
48

src/Entities/UserProfilePhotos.php 1 location

@@ 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