GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c4aee6...c09989 )
by cao
17:10
created

UpdateSetWhereRule::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 4
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 13 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
namespace PhpBoot\DB\rules\update;
3
use PhpBoot\DB\Context;
4
use PhpBoot\DB\rules\basic\BasicRule;
5
use PhpBoot\DB\rules\basic\WhereRule;
6
use PhpBoot\DB\impls\UpdateSetImpl;
7
use PhpBoot\DB\impls\UpdateImpl;
8
9
10
require_once dirname(__DIR__).'/impls.php';
11
require_once __DIR__.'/basic.php';
12
13
class UpdateRule extends BasicRule
14
{
15
    /**
16
     * update('table')->set('a', 1) => "UPDATE table SET a=1"
17
     * @param string $table
18
     * @return \PhpBoot\DB\rules\update\UpdateSetRule
19
     */
20 11
    public function update($table) {
21 11
        UpdateImpl::update($this->context, $table);
22 11
        return new UpdateSetRule($this->context);
23
    }
24
}
25
26 View Code Duplication
class UpdateSetRule extends BasicRule
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
27
{
28 11
    public function __construct($context){
29 11
        parent::__construct($context);
30 11
        $this->impl = new UpdateSetImpl();
31 11
    }
32
    /**
33
     * update('table')->set(['a'=>1]) => "UPDATE table SET a=1"
34
35
     * update('table')->set('a=?',1) => "UPDATE table SET a=1"
36
     * @param array|string $expr
37
     * @param mixed $_
38
     * @return UpdateSetWhereRule
39
     */
40 11
    public function set($expr, $_=null) {
0 ignored issues
show
Unused Code introduced by
The parameter $_ is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41 11
        $this->impl->set($this->context, $expr, array_slice(func_get_args(), 1));
42 11
        return new UpdateSetWhereRule($this->context, $this->impl);
43
    }
44
    private $impl;
45
}
46
47 View Code Duplication
class UpdateSetWhereRule extends WhereRule
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
48
{
49 11
    public function __construct(Context $context, UpdateSetImpl $impl){
50 11
        parent::__construct($context);
51 11
        $this->impl = $impl;
52 11
    }
53
    /**
54
     * update('table')->set(['a'=>1]) => "UPDATE table SET a=1"
55
56
     * update('table')->set('a=?',1) => "UPDATE table SET a=1"
57
     * @param array|string $expr
58
     * @param mixed $_
59
     * @return WhereRule
60
     */
61
    public function set($expr, $_=null) {
0 ignored issues
show
Unused Code introduced by
The parameter $_ is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
62
        $this->impl->set($this->context, $expr, array_slice(func_get_args(), 1));
63
        return new UpdateSetWhereRule($this->context, $this->impl);
64
    }
65
    private $impl;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
66
}
67
68