Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AddOnsRepository
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 findYearlyByProduct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace App\Http\Repositories;
4
5use App\Http\Models\AddOns;
6use App\Http\Repositories\interfaces\IAddOnsRepository;
7use Illuminate\Support\Collection;
8
9/**
10 * Repository for AddOns data access operations.
11 */
12class AddOnsRepository implements IAddOnsRepository
13{
14    /**
15     * {@inheritDoc}
16     */
17    public function findYearlyByProduct(string $product, array $excludeIdentifiers = []): Collection
18    {
19        $query = AddOns::where('product', $product)
20            ->where('identifier', 'like', '%-yearly');
21
22        if (! empty($excludeIdentifiers)) {
23            $query->whereNotIn('identifier', $excludeIdentifiers);
24        }
25
26        return $query->orderBy('price', 'asc')->get();
27    }
28}