Search   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A search() 0 7 1
A searchCollections() 0 7 1
A searchUsers() 0 7 1
1
<?php
2
3
namespace MarkSitko\LaravelUnsplash\Endpoints;
4
5
trait Search
6
{
7
    /**
8
     * Search photos
9
     * Get a single page of photo results for a query.
10
     * @link https://unsplash.com/documentation#search-photos
11
     *
12
     * @return MarkSitko\LaravelUnsplash\Endpoints\Search
13
     */
14
    public function search()
15
    {
16
        $this->apiCall = [
0 ignored issues
show
Bug introduced by
The property apiCall does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
17
            'endpoint' => 'search/photos',
18
        ];
19
        return $this;
20
    }
21
22
    /**
23
     * Search collections
24
     * Get a single page of collection results for a query.
25
     * @link https://unsplash.com/documentation#search-collections
26
     *
27
     * @return MarkSitko\LaravelUnsplash\Endpoints\Search
28
     */
29
    public function searchCollections()
30
    {
31
        $this->apiCall = [
32
            'endpoint' => 'search/collections',
33
        ];
34
        return $this;
35
    }
36
37
    /**
38
     * Search users
39
     * Get a single page of user results for a query.
40
     * @link https://unsplash.com/documentation#search-users
41
     *
42
     * @return MarkSitko\LaravelUnsplash\Endpoints\Search
43
     */
44
    public function searchUsers()
45
    {
46
        $this->apiCall = [
47
            'endpoint' => 'search/users',
48
        ];
49
        return $this;
50
    }
51
52
}
53