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::getEntry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
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