Completed
Push — master ( 82c4dd...afc4dc )
by Florian
12s
created

Join   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 15
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A join() 0 4 1
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Implode.
7
 *
8
 * @author    Florian Eckerstorfer
9
 * @copyright 2017 Florian Eckerstorfer
10
 */
11
trait Join
12
{
13
    /**
14
     * Join array elements with a string
15
     *
16
     * @param string $glue
17
     *
18
     * @return string Returns a string containing a string representation of all the array elements in the same order,
19
     *                with the glue string between each element.
20
     */
21 1
    public function join($glue = '')
22
    {
23 1
        return implode($glue, $this->array);
0 ignored issues
show
Bug introduced by
The property array does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
    }
25
}
26