On   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%
Metric Value
dl 0
loc 26
wmc 4
lcom 1
cbo 0
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toString() 0 13 3
1
<?php
2
3
namespace Muffin\Queries\Snippets;
4
5
use Muffin\Snippet;
6
7
class On implements Snippet
8
{
9
    private
10
        $leftColumn,
11
        $rightColumn;
12
13 24
    public function __construct($leftColumn, $rightColumn)
14
    {
15 24
        $this->leftColumn = (string) $leftColumn;
16 24
        $this->rightColumn = (string) $rightColumn;
17 24
    }
18
19 24
    public function toString()
20
    {
21 24
        if(empty($this->leftColumn) || empty($this->rightColumn))
22 24
        {
23 6
            return '';
24
        }
25
26 18
        return sprintf(
27 18
            'ON %s = %s',
28 18
            $this->leftColumn,
29 18
            $this->rightColumn
30 18
        );
31
    }
32
}
33