Completed
Push — symfony3 ( 405d0c...88ded0 )
by Kamil
32:03 queued 12:32
created

PaymentMethod::getChannels()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Core\Model;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\Common\Collections\Collection;
16
use Sylius\Component\Channel\Model\ChannelInterface as BaseChannelInterface;
17
use Sylius\Component\Payment\Model\PaymentMethod as BasePaymentMethod;
18
use Sylius\Component\Payment\Model\PaymentMethodTranslation;
19
20
/**
21
 * @author Mateusz Zalewski <[email protected]>
22
 */
23
class PaymentMethod extends BasePaymentMethod implements PaymentMethodInterface
24
{
25
    /**
26
     * @var Collection
27
     */
28
    private $channels;
29
30
    public function __construct()
31
    {
32
        parent::__construct();
33
34
        $this->channels = new ArrayCollection();
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getChannels()
41
    {
42
        return $this->channels;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function hasChannel(BaseChannelInterface $channel)
49
    {
50
        return $this->channels->contains($channel);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function addChannel(BaseChannelInterface $channel)
57
    {
58
        if (!$this->hasChannel($channel)) {
59
            $this->channels->add($channel);
60
        }
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function removeChannel(BaseChannelInterface $channel)
67
    {
68
        if ($this->hasChannel($channel)) {
69
            $this->channels->removeElement($channel);
70
        }
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public static function getTranslationClass()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
77
    {
78
        return PaymentMethodTranslation::class;
79
    }
80
}
81