1 | <?php |
||
21 | final class Manager extends AbstractManager |
||
22 | { |
||
23 | protected $entity = 'Sku'; |
||
24 | |||
25 | protected $strategy = [ |
||
26 | 'info' => false, |
||
27 | 'pricing' => 'simples', |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * @codeCoverageIgnore |
||
32 | */ |
||
33 | protected function setUp() |
||
37 | |||
38 | /** |
||
39 | * @return Gpupo\Common\Entity\CollectionAbstract|null |
||
40 | */ |
||
41 | 1 | public function findById($itemId) |
|
58 | |||
59 | protected function getDetail(EntityInterface $sku, $type) |
||
60 | { |
||
61 | $response = $this->perform($this->factoryMap('get'.$type, ['sku' => $sku->getId()])); |
||
62 | $className = 'Gpupo\NetshoesSdk\Entity\Product\Sku\\'.$type; |
||
63 | $data = $this->processResponse($response); |
||
64 | |||
65 | $o = new $className($data->toArray()); |
||
66 | |||
67 | $this->log('info', 'Detail', [ |
||
68 | 'sku' => $sku->getId(), |
||
69 | 'typ' => $type, |
||
70 | 'response' => $data, |
||
71 | 'className' => $className, |
||
72 | 'object' => $o, |
||
73 | ]); |
||
74 | |||
75 | return $o; |
||
76 | } |
||
77 | |||
78 | protected function getPriceScheduleCollection(EntityInterface $sku) |
||
79 | { |
||
80 | try { |
||
81 | $response = $this->perform($this->factoryMap('getPriceSchedule', ['sku' => $sku->getId()])); |
||
82 | $data = $this->processResponse($response); |
||
83 | |||
84 | if (empty($data)) { |
||
85 | throw new ManagerException('No price schedule on SKU #'.$sku->getId()); |
||
86 | } |
||
87 | } catch (ManagerException $e) { |
||
88 | $this->log('error', $e->getMessage()); |
||
89 | |||
90 | return; |
||
91 | } |
||
92 | |||
93 | $collection = new PriceScheduleCollection($data->toArray()); |
||
94 | |||
95 | return $collection; |
||
96 | } |
||
97 | |||
98 | public function add(EntityInterface $entity, $productId) |
||
104 | |||
105 | 1 | public function saveDetail(Item $sku, $type) |
|
112 | |||
113 | protected function hydratePriceSchedule(EntityInterface $sku) |
||
114 | { |
||
115 | $ps = $this->getPriceScheduleCollection($sku); |
||
116 | |||
117 | $sku->setPriceSchedule(false); |
||
|
|||
118 | if ($ps instanceof PriceScheduleCollection) { |
||
119 | $sku->setPriceSchedule($ps->getCurrent()); |
||
120 | } |
||
121 | |||
122 | return $sku; |
||
123 | } |
||
124 | |||
125 | public function hydrate(EntityInterface $sku) |
||
126 | { |
||
127 | $sku->setPrice($this->getDetail($sku, 'Price')) |
||
128 | ->setStock($this->getDetail($sku, 'Stock')) |
||
129 | ->setStatus($this->getDetail($sku, 'Status')); |
||
130 | |||
131 | return $this->hydratePriceSchedule($sku); |
||
132 | } |
||
133 | |||
134 | protected function resolvePrevious(Item $entity) |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | 1 | public function update(EntityInterface $entity, EntityInterface $existent = null) |
|
180 | |||
181 | 2 | public function updateInfo(Item $entity, $existent = null, array $response = []) |
|
200 | |||
201 | 2 | public function updateDetails(Item $entity, Item $existent = null, array $response = []) |
|
229 | } |
||
230 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.