Test Failed
Push — master ( b17eba...69b436 )
by Kirill
06:37
created

WhereInProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 42
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A orWhereIn() 0 4 1
A whereIn() 0 4 1
A orWhereNotIn() 0 4 1
A whereNotIn() 0 4 1
1
<?php
2
/**
3
 * This file is part of Hydrogen package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace RDS\Hydrogen\Query\WhereProvider;
11
12
use RDS\Hydrogen\Criteria\Where\Operator;
13
use RDS\Hydrogen\Criteria\Where;
14
use RDS\Hydrogen\Query;
15
16
/**
17
 * Trait WhereBetweenProvider
18
 * @mixin Query\WhereProvider
19
 */
20
trait WhereInProvider
21
{
22
    /**
23
     * @param string $field
24
     * @param iterable $value
25
     * @return Query|$this|self
26
     */
27 1
    public function orWhereIn(string $field, iterable $value): self
28
    {
29 1
        return $this->or()->whereIn($field, $value);
0 ignored issues
show
Bug introduced by
It seems like or() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
30
    }
31
32
    /**
33
     * @param string $field
34
     * @param iterable|array $value
35
     * @return Query|$this|self
36
     */
37 2
    public function whereIn(string $field, iterable $value): self
38
    {
39 2
        return $this->add(new Where($field, Operator::IN, $value, $this->mode()));
0 ignored issues
show
Bug introduced by
It seems like mode() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
Bug introduced by
It seems like add() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
40
    }
41
42
    /**
43
     * @param string $field
44
     * @param iterable $value
45
     * @return Query|$this|self
46
     */
47 1
    public function orWhereNotIn(string $field, iterable $value): self
48
    {
49 1
        return $this->or()->whereNotIn($field, $value);
0 ignored issues
show
Bug introduced by
It seems like or() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
50
    }
51
52
    /**
53
     * @param string $field
54
     * @param iterable $value
55
     * @return Query|$this|self
56
     */
57 2
    public function whereNotIn(string $field, iterable $value): self
58
    {
59 2
        return $this->add(new Where($field, Operator::NOT_IN, $value, $this->mode()));
0 ignored issues
show
Bug introduced by
It seems like mode() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
Bug introduced by
It seems like add() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
60
    }
61
}
62