SongRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOneByPath() 0 6 1
A getModelClass() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace App\Repositories;
4
5
use App\Models\Song;
6
use App\Services\HelperService;
7
8
class SongRepository extends AbstractRepository
9
{
10
    private $helperService;
11
12 132
    public function __construct(HelperService $helperService)
13
    {
14 132
        parent::__construct();
15 132
        $this->helperService = $helperService;
16 132
    }
17
18 132
    public function getModelClass(): string
19
    {
20 132
        return Song::class;
21
    }
22
23 3
    public function getOneByPath(string $path): ?Song
24
    {
25
        /** @var Song|null $song */
26 3
        $song = $this->getOneById($this->helperService->getFileHash($path));
27
28 3
        return $song;
29
    }
30
}
31