getEntityStoreIds()   A
last analyzed

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 1
1
<?php
2
3
namespace Tkotosz\CatalogRouter\Observer;
4
5
use Magento\Framework\Event\Observer;
6
use Magento\Framework\Model\AbstractModel;
7
use Tkotosz\CatalogRouter\Observer\PathValidatorObserver;
8
9
class ProductUrlPathValidatorObserver extends PathValidatorObserver
10
{
11
    protected function getCurrentEntityType()
12
    {
13
        return 'product';
14
    }
15
16
    protected function getEntity(Observer $observer)
17
    {
18
        return $observer->getEvent()->getProduct();
19
    }
20
21
    protected function getEntityStoreIds(AbstractModel $entity)
22
    {
23
        return $entity->getStoreIds();
24
    }
25
26
    protected function getEntityUrlPath(AbstractModel $entity, int $storeId)
27
    {
28
        return $this->urlPathProvider->getProductUrlPath($entity->getId(), $storeId);
29
    }
30
}
31