Passed
Push — master ( f0e277...a14668 )
by Rougin
03:58
created

Result::model()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Rougin\Windstorm\Eloquent;
4
5
use Illuminate\Support\Collection;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Collection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Rougin\Windstorm\QueryInterface;
7
use Rougin\Windstorm\ResultInterface;
8
9
/**
10
 * Result
11
 *
12
 * @package Windstorm
13
 * @author  Rougin Gutib <[email protected]>
14
 */
15
class Result implements ResultInterface
16
{
17
    /**
18
     * @var \Illuminate\Support\Collection
19
     */
20
    protected $result;
21
22
    /**
23
     * Returns a number of affected rows.
24
     *
25
     * @return integer
26
     */
27
    public function affected()
28
    {
29
        return $this->result->count();
30
    }
31
32
    /**
33
     * Returns a result from a query instance.
34
     *
35
     * @param  \Rougin\Windstorm\QueryInterface $query
36
     * @return \Rougin\Windstorm\ResultInterface
37
     */
38
    public function execute(QueryInterface $query)
39
    {
40
        $this->result = $query->instance()->get();
41
42
        return $this;
43
    }
44
45
    /**
46
     * Returns the first row from result.
47
     *
48
     * @return mixed
49
     */
50
    public function first()
51
    {
52
        return $this->result->first();
53
    }
54
55
    /**
56
     * Returns the first row from result.
57
     *
58
     * @return mixed
59
     */
60
    public function items()
61
    {
62
        return $this->result;
63
    }
64
}
65