DescriptionUtils   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 5
c 1
b 1
f 0
lcom 0
cbo 1
dl 0
loc 28
ccs 12
cts 16
cp 0.75
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B describe() 0 19 5
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * The software is based on the Axon Framework project which is
17
 * licensed under the Apache 2.0 license. For more information on the Axon Framework
18
 * see <http://www.axonframework.org/>.
19
 *
20
 * This software consists of voluntary contributions made by many individuals
21
 * and is licensed under the MIT license. For more information, see
22
 * <http://www.governor-framework.org/>.
23
 */
24
25
namespace Governor\Framework\Test\Saga;
26
27
use Hamcrest\Description;
28
29
abstract class DescriptionUtils
30
{
31
    /**
32
     * Describe the contents of the given <code>list</code> in the given <code>description</code>.
33
     *
34
     * @param array $list The list to describe
35
     * @param Description $description The description to describe to
36
     */
37 1
    public static function describe(array $list, Description $description)
38
    {
39 1
        $counter = 0;
40
41 1
        $description->appendText("List with ");
42 1
        foreach ($list as $item) {
43 1
            $description->appendText("<")
44 1
                ->appendText(null !== $item ? get_class($item) : "null")
45 1
                ->appendText(">");
46 1
            if ($counter === count($list) - 2) {
47
                $description->appendText(" and ");
48
            } else {
49 1
                if ($counter < count($list) - 2) {
50
                    $description->appendText(", ");
51
                }
52
            }
53 1
            $counter++;
54 1
        }
55
    }
56
}