Code Duplication    Length = 26-31 lines in 23 locations

src/Yandex/DataSync/Models/Database/Delta/RecordFields.php 1 location

@@ 23-48 (lines=26) @@
20
 * @package  Yandex\DataSync\Models\Databas\Delta
21
 * @author   Alexander Khaylo <[email protected]>
22
 */
23
class RecordFields extends ObjectModel
24
{
25
    /**
26
     * @param $items
27
     *
28
     * @return $this
29
     */
30
    public function add($items)
31
    {
32
        if (is_array($items)) {
33
            $this->collection[] = new RecordField($items);
34
        } elseif (is_object($items) && $items instanceof RecordField) {
35
            $this->collection[] = $items;
36
        }
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return RecordField[]
43
     */
44
    public function getAll()
45
    {
46
        return $this->collection;
47
    }
48
}
49

src/Yandex/DataSync/Models/Database/Delta/Records.php 1 location

@@ 23-48 (lines=26) @@
20
 * @package  Yandex\DataSync\Models\Databas\Delta
21
 * @author   Alexander Khaylo <[email protected]>
22
 */
23
class Records extends ObjectModel
24
{
25
    /**
26
     * @param $items
27
     *
28
     * @return $this
29
     */
30
    public function add($items)
31
    {
32
        if (is_array($items)) {
33
            $this->collection[] = new Record($items);
34
        } elseif (is_object($items) && $items instanceof Record) {
35
            $this->collection[] = $items;
36
        }
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return Record[]
43
     */
44
    public function getAll()
45
    {
46
        return $this->collection;
47
    }
48
}
49

src/Yandex/DataSync/Models/Database/Deltas.php 1 location

@@ 23-48 (lines=26) @@
20
 * @package  Yandex\DataSync\Models\Databas\Delta
21
 * @author   Alexander Khaylo <[email protected]>
22
 */
23
class Deltas extends ObjectModel
24
{
25
    /**
26
     * @param $items
27
     *
28
     * @return $this
29
     */
30
    public function add($items)
31
    {
32
        if (is_array($items)) {
33
            $this->collection[] = new Delta($items);
34
        } elseif (is_object($items) && $items instanceof Delta) {
35
            $this->collection[] = $items;
36
        }
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return Delta[]
43
     */
44
    public function getAll()
45
    {
46
        return $this->collection;
47
    }
48
}
49

src/Yandex/Market/Content/Models/Base/Models.php 1 location

@@ 7-37 (lines=31) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Models extends ObjectModel
8
{
9
    /**
10
     * Add category to collection
11
     *
12
     * @param MarketModel|array $model
13
     *
14
     * @return Models
15
     */
16
    public function add($model)
17
    {
18
        if (is_array($model)) {
19
            // @note: add model type validation.
20
            $this->collection[] = MarketModel::getInstance($model);
21
        } elseif (is_object($model) && $model instanceof MarketModel) {
22
            $this->collection[] = $model;
23
        }
24
25
        return $this;
26
    }
27
28
    /**
29
     * Retrieve the collection property
30
     *
31
     * @return Models|null
32
     */
33
    public function getAll()
34
    {
35
        return $this->collection;
36
    }
37
}
38

src/Yandex/Market/Content/Models/Categories.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Categories extends ObjectModel
8
{
9
    /**
10
     * Add category to collection
11
     *
12
     * @param Category|array $category
13
     *
14
     * @return Categories
15
     */
16
    public function add($category)
17
    {
18
        if (is_array($category)) {
19
            $this->collection[] = new Category($category);
20
        } elseif (is_object($category) && $category instanceof Category) {
21
            $this->collection[] = $category;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Categories|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Comments.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Comments extends ObjectModel
8
{
9
    /**
10
     * Add comment to collection
11
     *
12
     * @param Comment|array $comment
13
     *
14
     * @return Comments
15
     */
16
    public function add($comment)
17
    {
18
        if (is_array($comment)) {
19
            $this->collection[] = new Comment($comment);
20
        } elseif (is_object($comment) && $comment instanceof Comment) {
21
            $this->collection[] = $comment;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Comments|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Contras.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Contras extends ObjectModel
8
{
9
    /**
10
     * Add fact to collection
11
     *
12
     * @param Fact|array $fact
13
     *
14
     * @return Contras
15
     */
16
    public function add($fact)
17
    {
18
        if (is_string($fact)) {
19
            $this->collection[] = new Fact(array('fact'=>$fact));
20
        } elseif (is_object($fact) && $fact instanceof Fact) {
21
            $this->collection[] = $fact;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Contras|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/DeliveryMethods.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class DeliveryMethods extends ObjectModel
8
{
9
    /**
10
     * Add method to collection
11
     *
12
     * @param DeliveryMethod|array $method
13
     *
14
     * @return DeliveryMethods
15
     */
16
    public function add($method)
17
    {
18
        if (is_array($method)) {
19
            $this->collection[] = new DeliveryMethod($method);
20
        } elseif (is_object($method) && $method instanceof DeliveryMethod) {
21
            $this->collection[] = $method;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return DeliveryMethods|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Filters.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Filters extends ObjectModel
8
{
9
    /**
10
     * Add filter to collection
11
     *
12
     * @param Filter|array $filter
13
     *
14
     * @return Filters
15
     */
16
    public function add($filter)
17
    {
18
        if (is_array($filter)) {
19
            $this->collection[] = new Filter($filter);
20
        } elseif (is_object($filter) && $filter instanceof Filter) {
21
            $this->collection[] = $filter;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Filters
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/GeoRegions.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class GeoRegions extends ObjectModel
8
{
9
    /**
10
     * Add geo region to collection
11
     *
12
     * @param GeoRegion|array $geoRegion
13
     *
14
     * @return GeoRegions
15
     */
16
    public function add($geoRegion)
17
    {
18
        if (is_array($geoRegion)) {
19
            $this->collection[] = new GeoRegion($geoRegion);
20
        } elseif (is_object($geoRegion) && $geoRegion instanceof GeoRegion) {
21
            $this->collection[] = $geoRegion;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return GeoRegions|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/ModelOpinions.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class ModelOpinions extends ObjectModel
8
{
9
    /**
10
     * Add opinion to collection
11
     *
12
     * @param ModelOpinion|array $opinion
13
     *
14
     * @return ModelOpinions
15
     */
16
    public function add($opinion)
17
    {
18
        if (is_array($opinion)) {
19
            $this->collection[] = new ModelOpinion($opinion);
20
        } elseif (is_object($opinion) && $opinion instanceof ModelOpinion) {
21
            $this->collection[] = $opinion;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return ModelOpinions|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/ModelVisualPhotos.php 1 location

@@ 8-37 (lines=30) @@
5
use Yandex\Common\ObjectModel;
6
use Yandex\Market\Content\Models\ModelVisualPhoto;
7
8
class ModelVisualPhotos extends ObjectModel
9
{
10
    /**
11
     * Add photo to collection
12
     *
13
     * @param ModelVisualPhoto|array $photo
14
     *
15
     * @return ModelVisualPhotos
16
     */
17
    public function add($photo)
18
    {
19
        if (is_array($photo)) {
20
            $this->collection[] = new ModelVisualPhoto($photo);
21
        } elseif (is_object($photo) && $photo instanceof ModelVisualPhoto) {
22
            $this->collection[] = $photo;
23
        }
24
25
        return $this;
26
    }
27
28
    /**
29
     * Retrieve the collection property
30
     *
31
     * @return ModelVisualPhotos|null
32
     */
33
    public function getAll()
34
    {
35
        return $this->collection;
36
    }
37
}
38

src/Yandex/Market/Content/Models/OfferPhotos.php 1 location

@@ 8-37 (lines=30) @@
5
use Yandex\Common\ObjectModel;
6
use Yandex\Market\Content\Models\OfferPhoto;
7
8
class OfferPhotos extends ObjectModel
9
{
10
    /**
11
     * Add photo to collection
12
     *
13
     * @param OfferPhoto|array $photo
14
     *
15
     * @return OfferPhotos
16
     */
17
    public function add($photo)
18
    {
19
        if (is_array($photo)) {
20
            $this->collection[] = new OfferPhoto($photo);
21
        } elseif (is_object($photo) && $photo instanceof OfferPhoto) {
22
            $this->collection[] = $photo;
23
        }
24
25
        return $this;
26
    }
27
28
    /**
29
     * Retrieve the collection property
30
     *
31
     * @return Photos|null
32
     */
33
    public function getAll()
34
    {
35
        return $this->collection;
36
    }
37
}
38

src/Yandex/Market/Content/Models/Offers.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Offers extends ObjectModel
8
{
9
    /**
10
     * Add photo to collection
11
     *
12
     * @param Offer|array $offer
13
     *
14
     * @return Offers
15
     */
16
    public function add($offer)
17
    {
18
        if (is_array($offer)) {
19
            $this->collection[] = new Offer($offer);
20
        } elseif (is_object($offer) && $offer instanceof Offer) {
21
            $this->collection[] = $offer;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Offers|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Options.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Options extends ObjectModel
8
{
9
    /**
10
     * Add photo to collection
11
     *
12
     * @param Option|array $option
13
     *
14
     * @return Options
15
     */
16
    public function add($option)
17
    {
18
        if (is_array($option)) {
19
            $this->collection[] = new Option($option);
20
        } elseif (is_object($option) && $option instanceof Option) {
21
            $this->collection[] = $option;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Options|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Outlets.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Outlets extends ObjectModel
8
{
9
    /**
10
     * Add outlet to collection
11
     *
12
     * @param Outlet|array $outlet
13
     *
14
     * @return Outlets
15
     */
16
    public function add($outlet)
17
    {
18
        if (is_array($outlet)) {
19
            $this->collection[] = new Outlet($outlet);
20
        } elseif (is_object($outlet) && $outlet instanceof Outlet) {
21
            $this->collection[] = $outlet;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Outlets
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Photos.php 1 location

@@ 8-37 (lines=30) @@
5
use Yandex\Common\ObjectModel;
6
use Yandex\Market\Content\Models\Base\Photo;
7
8
class Photos extends ObjectModel
9
{
10
    /**
11
     * Add photo to collection
12
     *
13
     * @param Photo|array $photo
14
     *
15
     * @return Photos
16
     */
17
    public function add($photo)
18
    {
19
        if (is_array($photo)) {
20
            $this->collection[] = new Photo($photo);
21
        } elseif (is_object($photo) && $photo instanceof Photo) {
22
            $this->collection[] = $photo;
23
        }
24
25
        return $this;
26
    }
27
28
    /**
29
     * Retrieve the collection property
30
     *
31
     * @return Photos|null
32
     */
33
    public function getAll()
34
    {
35
        return $this->collection;
36
    }
37
}
38

src/Yandex/Market/Content/Models/Pros.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Pros extends ObjectModel
8
{
9
    /**
10
     * Add fact to collection
11
     *
12
     * @param Fact|array $fact
13
     *
14
     * @return Pros
15
     */
16
    public function add($fact)
17
    {
18
        if (is_string($fact)) {
19
            $this->collection[] = new Fact(array('fact'=>$fact));
20
        } elseif (is_object($fact) && $fact instanceof Fact) {
21
            $this->collection[] = $fact;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Pros|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Reviews.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Reviews extends ObjectModel
8
{
9
    /**
10
     * Add review to collection
11
     *
12
     * @param Review|array $review
13
     *
14
     * @return Reviews
15
     */
16
    public function add($review)
17
    {
18
        if (is_array($review)) {
19
            $this->collection[] = new Review($review);
20
        } elseif (is_object($review) && $review instanceof Review) {
21
            $this->collection[] = $review;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Reviews
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Schedules.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Schedules extends ObjectModel
8
{
9
    /**
10
     * Add review to collection
11
     *
12
     * @param Schedule|array $sсhedule
13
     *
14
     * @return Schedules
15
     */
16
    public function add($sсhedule)
17
    {
18
        if (is_array($sсhedule)) {
19
            $this->collection[] = new Schedule($sсhedule);
20
        } elseif (is_object($sсhedule) && $sсhedule instanceof Schedule) {
21
            $this->collection[] = $sсhedule;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Schedules
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/ShopOpinions.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class ShopOpinions extends ObjectModel
8
{
9
    /**
10
     * Add opinion to collection
11
     *
12
     * @param ShopOpinion|array $opinion
13
     *
14
     * @return ShopOpinions
15
     */
16
    public function add($opinion)
17
    {
18
        if (is_array($opinion)) {
19
            $this->collection[] = new ShopOpinion($opinion);
20
        } elseif (is_object($opinion) && $opinion instanceof ShopOpinion) {
21
            $this->collection[] = $opinion;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return ShopOpinions|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Shops.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Shops extends ObjectModel
8
{
9
    /**
10
     * Add shop to collection
11
     *
12
     * @param Shop|array $shop
13
     *
14
     * @return Shops
15
     */
16
    public function add($shop)
17
    {
18
        if (is_array($shop)) {
19
            $this->collection[] = new Shop($shop);
20
        } elseif (is_object($shop) && $shop instanceof Shop) {
21
            $this->collection[] = $shop;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Shops|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37

src/Yandex/Market/Content/Models/Vendors.php 1 location

@@ 7-36 (lines=30) @@
4
5
use Yandex\Common\ObjectModel;
6
7
class Vendors extends ObjectModel
8
{
9
    /**
10
     * Add vendor to collection
11
     *
12
     * @param Vendor|array $vendor
13
     *
14
     * @return Vendors
15
     */
16
    public function add($vendor)
17
    {
18
        if (is_array($vendor)) {
19
            $this->collection[] = new Vendor($vendor);
20
        } elseif (is_object($vendor) && $vendor instanceof Vendor) {
21
            $this->collection[] = $vendor;
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Retrieve the collection property
29
     *
30
     * @return Vendors|null
31
     */
32
    public function getAll()
33
    {
34
        return $this->collection;
35
    }
36
}
37