Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
StockBillMapper
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getStockBeforePivot
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getStockAfterPivot
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   Modules\Billing\Models
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace Modules\Billing\Models;
16
17use phpOMS\DataStorage\Database\Query\Builder;
18
19/**
20 * Mapper class.
21 *
22 * @package Modules\Billing\Models
23 * @license OMS License 2.0
24 * @link    https://jingga.app
25 * @since   1.0.0
26 */
27final class StockBillMapper extends BillMapper
28{
29    /**
30     * Model to use by the mapper.
31     *
32     * @var class-string<T>
33     * @since 1.0.0
34     */
35    public const MODEL = Bill::class;
36
37    /**
38     * Placeholder
39     */
40    public static function getStockBeforePivot(
41        mixed $pivot,
42        string $column = null,
43        int $limit = 50,
44        int $depth = 3,
45        Builder $query = null
46    ) : array
47    {
48        return self::getAll()
49            ->with('type')
50            ->where('id', $pivot, '<')
51            ->where('transferType', BillTransferType::SALES)
52            ->limit($limit)
53            ->execute();
54    }
55
56    /**
57     * Placeholder
58     */
59    public static function getStockAfterPivot(
60        mixed $pivot,
61        string $column = null,
62        int $limit = 50,
63        int $depth = 3,
64        Builder $query = null
65    ) : array
66    {
67        return self::getAll()
68            ->with('type')
69            ->where('id', $pivot, '>')
70            ->where('transferType', BillTransferType::SALES)
71            ->limit($limit)
72            ->execute();
73    }
74}