Passed
Push — master ( 94b7c6...9cdec7 )
by Christian
15:16 queued 12s
created

PromotionIndividualCodeCollection::getApiAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Checkout\Promotion\Aggregate\PromotionIndividualCode;
4
5
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
6
7
/**
8
 * @method void                               add(PromotionIndividualCodeEntity $entity)
9
 * @method void                               set(string $key, PromotionIndividualCodeEntity $entity)
10
 * @method PromotionIndividualCodeEntity[]    getIterator()
11
 * @method PromotionIndividualCodeEntity[]    getElements()
12
 * @method PromotionIndividualCodeEntity|null get(string $key)
13
 * @method PromotionIndividualCodeEntity|null first()
14
 * @method PromotionIndividualCodeEntity|null last()
15
 */
16
class PromotionIndividualCodeCollection extends EntityCollection
17
{
18
    public function getApiAlias(): string
19
    {
20
        return 'promotion_individual_code_collection';
21
    }
22
23
    /**
24
     * @returns string[]
25
     */
26
    public function getCodeArray(): array
27
    {
28
        $codes = [];
29
        foreach ($this->getIterator() as $codeEntity) {
30
            $codes[] = $codeEntity->getCode();
31
        }
32
33
        return $codes;
34
    }
35
36
    protected function getExpectedClass(): string
37
    {
38
        return PromotionIndividualCodeEntity::class;
39
    }
40
}
41