Passed
Push — master ( 973b57...8e4c63 )
by
unknown
05:03
created

AbstractDeliveryModule::getDeliveryMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/*************************************************************************************/
3
/*      This file is part of the Thelia package.                                     */
4
/*                                                                                   */
5
/*      Copyright (c) OpenStudio                                                     */
6
/*      email : [email protected]                                                       */
7
/*      web : http://www.thelia.net                                                  */
8
/*                                                                                   */
9
/*      For the full copyright and license information, please view the LICENSE.txt  */
10
/*      file that was distributed with this source code.                             */
11
/*************************************************************************************/
12
13
namespace Thelia\Module;
14
15
use Thelia\Model\Area;
16
use Thelia\Model\AreaDeliveryModuleQuery;
17
use Thelia\Model\Country;
18
use Thelia\Model\State;
19
20
abstract class AbstractDeliveryModule extends BaseModule implements DeliveryModuleInterface
21
{
22
    // This class is the base class for delivery modules
23
    // It may contains common methods in the future.
24
25
    /**
26
     * @return bool
27
     */
28
    public function handleVirtualProductDelivery()
29
    {
30
        return false;
31
    }
32
33
    /**
34
     * Return the first area that matches the given  country for the given module
35
     * @param Country $country
36
     * @param BaseModule $module
37
     * @return Area|null
38
     */
39
    public function getAreaForCountry(Country $country)
40
    {
41
        $area = null;
42
43
        if (null !== $areaDeliveryModule = AreaDeliveryModuleQuery::create()->findByCountryAndModule(
44
                $country,
45
                $this->getModuleModel()
46
            )) {
47
            $area = $areaDeliveryModule->getArea();
48
        }
49
50
        return $area;
51
    }
52
53
    public function getDeliveryMode()
54
    {
55
        return "delivery";
56
    }
57
58
    public function getMinimumDeliveryDate(Country $country, State $state = null)
0 ignored issues
show
Unused Code introduced by
The parameter $state is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

58
    public function getMinimumDeliveryDate(Country $country, /** @scrutinizer ignore-unused */ State $state = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $country is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

58
    public function getMinimumDeliveryDate(/** @scrutinizer ignore-unused */ Country $country, State $state = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
59
    {
60
        return null;
61
    }
62
63
    public function getMaximumDeliveryDate(Country $country, State $state = null)
0 ignored issues
show
Unused Code introduced by
The parameter $state is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

63
    public function getMaximumDeliveryDate(Country $country, /** @scrutinizer ignore-unused */ State $state = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $country is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

63
    public function getMaximumDeliveryDate(/** @scrutinizer ignore-unused */ Country $country, State $state = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
    {
65
        return null;
66
    }
67
68
}