EC-CUBE /
ec-cube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of EC-CUBE |
||
| 5 | * |
||
| 6 | * Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
||
| 7 | * |
||
| 8 | * http://www.lockon.co.jp/ |
||
| 9 | * |
||
| 10 | * For the full copyright and license information, please view the LICENSE |
||
| 11 | * file that was distributed with this source code. |
||
| 12 | */ |
||
| 13 | |||
| 14 | namespace Eccube\Repository; |
||
| 15 | |||
| 16 | use Eccube\Entity\Delivery; |
||
| 17 | use Eccube\Entity\Master\SaleType; |
||
| 18 | use Eccube\Entity\Payment; |
||
| 19 | use Symfony\Bridge\Doctrine\RegistryInterface; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * DelivRepository |
||
| 23 | * |
||
| 24 | * This class was generated by the Doctrine ORM. Add your own custom |
||
| 25 | * repository methods below. |
||
| 26 | */ |
||
| 27 | class DeliveryRepository extends AbstractRepository |
||
| 28 | { |
||
| 29 | 218 | public function __construct(RegistryInterface $registry) |
|
| 30 | { |
||
| 31 | 218 | parent::__construct($registry, Delivery::class); |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @deprecated 呼び出し元で制御する |
||
| 36 | * |
||
| 37 | * @param $id |
||
| 38 | * |
||
| 39 | * @return Delivery|null|object |
||
| 40 | */ |
||
| 41 | 5 | public function findOrCreate($id) |
|
| 42 | { |
||
| 43 | 5 | if ($id == 0) { |
|
| 44 | 5 | $em = $this->getEntityManager(); |
|
| 45 | |||
| 46 | $SaleType = $em |
||
| 47 | 5 | ->getRepository(SaleType::class) |
|
| 48 | 5 | ->findOneBy([], ['sort_no' => 'DESC']); |
|
|
0 ignored issues
–
show
|
|||
| 49 | |||
| 50 | 5 | $Delivery = $this->findOneBy([], ['sort_no' => 'DESC']); |
|
| 51 | |||
| 52 | 5 | $sortNo = 1; |
|
| 53 | 5 | if ($Delivery) { |
|
| 54 | 5 | $sortNo = $Delivery->getSortNo() + 1; |
|
| 55 | } |
||
| 56 | |||
| 57 | 5 | $Delivery = new Delivery(); |
|
| 58 | $Delivery |
||
| 59 | 5 | ->setSortNo($sortNo) |
|
| 60 | 5 | ->setVisible(true) |
|
| 61 | 5 | ->setSaleType($SaleType); |
|
| 62 | } else { |
||
| 63 | $Delivery = $this->find($id); |
||
| 64 | } |
||
| 65 | |||
| 66 | 5 | return $Delivery; |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * 複数の販売種別から配送業者を取得 |
||
| 71 | * |
||
| 72 | * @param $saleTypes |
||
| 73 | * |
||
| 74 | * @return array |
||
| 75 | */ |
||
| 76 | 57 | public function getDeliveries($saleTypes) |
|
| 77 | { |
||
| 78 | 57 | $deliveries = $this->createQueryBuilder('d') |
|
| 79 | 57 | ->where('d.SaleType in (:saleTypes)') |
|
| 80 | 57 | ->andWhere('d.visible = :visible') |
|
| 81 | 57 | ->setParameter('saleTypes', $saleTypes) |
|
| 82 | 57 | ->setParameter('visible', true) |
|
| 83 | 57 | ->orderBy('d.sort_no', 'DESC') |
|
| 84 | 57 | ->getQuery() |
|
| 85 | 57 | ->getResult(); |
|
| 86 | |||
| 87 | 57 | return $deliveries; |
|
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * 選択可能な配送業者を取得 |
||
| 92 | * |
||
| 93 | * @param $saleTypes |
||
| 94 | * @param $payments |
||
| 95 | * |
||
| 96 | * @return array |
||
| 97 | */ |
||
| 98 | 1 | public function findAllowedDeliveries($saleTypes, $payments) |
|
| 99 | { |
||
| 100 | 1 | $d = $this->getDeliveries($saleTypes); |
|
| 101 | 1 | $arr = []; |
|
| 102 | |||
| 103 | 1 | foreach ($d as $Delivery) { |
|
| 104 | $paymentOptions = $Delivery->getPaymentOptions(); |
||
| 105 | |||
| 106 | foreach ($paymentOptions as $PaymentOption) { |
||
| 107 | foreach ($payments as $Payment) { |
||
| 108 | if ($PaymentOption->getPayment() instanceof Payment) { |
||
| 109 | if ($PaymentOption->getPayment()->getId() == $Payment['id']) { |
||
| 110 | $arr[$Delivery->getId()] = $Delivery; |
||
| 111 | break; |
||
| 112 | } |
||
| 113 | } |
||
| 114 | } |
||
| 115 | } |
||
| 116 | } |
||
| 117 | |||
| 118 | 1 | return array_values($arr); |
|
| 119 | } |
||
| 120 | } |
||
| 121 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.