• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

conedevelopment / bazar / 20694116184

04 Jan 2026 02:08PM UTC coverage: 68.615% (+4.5%) from 64.117%
20694116184

push

github

iamgergo
version

1679 of 2447 relevant lines covered (68.61%)

25.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Listeners/RefreshInventory.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Listeners;
6

7
use Cone\Bazar\Events\PaymentCaptured;
8
use Cone\Bazar\Interfaces\Stockable;
9
use Cone\Bazar\Models\Item;
10

11
class RefreshInventory
12
{
13
    /**
14
     * Handle the event.
15
     */
16
    public function handle(PaymentCaptured $event): void
×
17
    {
18
        $event->order->loadMissing(['items', 'items.buyable']);
×
19

20
        $event->order->items->each(static function (Item $item): void {
×
21
            if (! $item->isFee() && $item->buyable instanceof Stockable && $item->buyable->tracksQuantity()) {
×
22
                $item->buyable->decrementQuantity($item->quantity);
×
23
            }
24
        });
×
25
    }
26
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc