Completed
Push — master ( 8ad0a5...af5d94 )
by yuuki
10s
created

QueryPrepared   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A isN1ql() 0 8 2
1
<?php
2
3
/**
4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
 * THE SOFTWARE.
11
 */
12
13
namespace Ytake\LaravelCouchbase\Events;
14
15
/**
16
 * Class QueryPrepared
17
 *
18
 * @author Yuuki Takezawa<[email protected]>
19
 */
20
class QueryPrepared
21
{
22
    /** @var array */
23
    public $object = [];
24
25
    /**
26
     * QueryPrepared constructor.
27
     *
28
     * @param mixed $queryObject
29
     */
30
    public function __construct($queryObject)
31
    {
32
        if ($this->isN1ql($queryObject)) {
33
            $this->object = $queryObject->toObject();
34
        }
35
    }
36
37
    /**
38
     * @param mixed $queryObject
39
     *
40
     * @return bool
41
     */
42
    protected function isN1ql($queryObject)
43
    {
44
        if ($queryObject instanceof \CouchbaseN1qlQuery) {
0 ignored issues
show
Bug introduced by
The class CouchbaseN1qlQuery does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
45
            return true;
46
        }
47
48
        return false;
49
    }
50
}
51