Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

DonorsQuery   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 53
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A type() 0 4 1
A args() 0 17 1
A resolve() 0 21 4
1
<?php
2
3
namespace DoeSangue\GraphQL\Query;
4
5
use GraphQL;
6
use DoeSangue\Models\User;
7
use GraphQL\Type\Definition\Type;
8
use Folklore\GraphQL\Support\Query;
9
10
class DonorsQuery extends Query
11
{
12
13
  protected $attributes = [
14
    'name' => 'donors'
15
  ];
16
17
  public function type()
18
  {
19
    return Type::listOf(GraphQL::type('Donor'));
20
  }
21
22
  public function args()
23
  {
24
    return [
25
      'first_name' => ['name' => 'firs_tname', 'type' => Type::string()],
26
      'last_name' => ['name' => 'last_name', 'type' => Type::string()],
27
      'email' => ['name' => 'email', 'type' => Type::string()],
28
      'username' => ['name' => 'username', 'type' => Type::string()],
29
      'phone' => ['name' => 'phone', 'type' => Type::string()],
30
      'country_code' => ['name' => 'country_code', 'type' => Type::string()],
31
      'bio' => ['name' => 'bio', 'type' => Type::string()],
32
      'birthdate' => ['name' => 'birthdate', 'type' => Type::string()],
33
      'active' => ['name' => 'active', 'type' => Type::string()],
34
      'password' => ['name' => 'password', 'type' => Type::string()],
35
      'blood_type_id' => ['name' => 'blood_type_id', 'type' => Type::string()],
36
      'first' => ['name' => 'first', 'type' => Type::int()],
37
    ];
38
  }
39
40
  public function resolve($root,$args)
41
  {
42
    $donor = new User;
43
44
    // Limit
45
    if (isset($args['first'])) {
46
      $donor = $donor->limit($args['first'])->latest('id');
47
    }
48
49
    if (isset($args['id']))
50
    {
51
      $donor = $donor->where('id', $args['id']);
52
    }
53
54
    if (isset($args['email']))
55
    {
56
      $donor = $donor->where('email', $args['email']);
57
    }
58
59
    return $donor->get();
60
  }
61
62
}
63