GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

HasInDatabaseOnce   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 1 Features 0
Metric Value
dl 0
loc 29
rs 10
c 2
b 1
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matches() 0 9 1
A getEntry() 0 4 1
1
<?php
2
/*
3
 * laravel-money-manager-ex
4
 *
5
 * This File belongs to to Project laravel-money-manager-ex
6
 *
7
 * @author Oliver Kaufmann <[email protected]>
8
 * @version 1.0
9
 */
10
11
namespace Tests\utils;
12
13
use Illuminate\Foundation\Testing\Constraints\HasInDatabase;
14
15
class HasInDatabaseOnce extends HasInDatabase
16
{
17
    private $entry;
18
19
    /**
20
     * Check if the data is found in the given table once and set the entry to private field.
21
     *
22
     * @param string $table
23
     *
24
     * @return bool
25
     */
26
    public function matches($table)
27
    {
28
        $query = $this->database->table($table)->where($this->data);
29
30
        $entries = $query->take(2)->get();
31
        $this->entry = $entries->first();
32
33
        return $entries->count() == 1;
34
    }
35
36
    /**
37
     * Get the Entry based on the given attributes.
38
     */
39
    public function getEntry()
40
    {
41
        return $this->entry;
42
    }
43
}
44