InteractsWithDatabase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 16
ccs 2
cts 2
cp 1
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A castAsJson() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Testing\Concerns;
6
7
use Illuminate\Support\Facades\DB;
8
9
trait InteractsWithDatabase
10
{
11
    /**
12
     * Cast a JSON string to a database compatible type.
13
     * Supported for backwards compatibility in existing projects.
14
     * No cast is necessary as json is a first class citizen in ArangoDB.
15
     *
16
     * @param  array<mixed>|object|string  $value
17
     * @param string|null $connection
18
     * @return \Illuminate\Contracts\Database\Query\Expression
19
     *
20
     * @SuppressWarnings("PHPMD.UnusedFormalParameter")
21
     */
22 1
    public function castAsJson($value, $connection = null)
0 ignored issues
show
Unused Code introduced by
The parameter $connection is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

22
    public function castAsJson($value, /** @scrutinizer ignore-unused */ $connection = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24 1
        return DB::raw($value);
25
    }
26
}
27