66% of 180OPs |
85% of 39Lines |
66% of 47Branches |
7% of 28Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\test\adapter\call\arguments\decorator::decorate() | 180 | 66% | 39 | 85% | 47 | 66% | 28 | 7% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\test\adapter\call\arguments; |
4 |
|
5 |
class decorator |
6 |
{ |
7 |
public function decorate(array $arguments = null)85% |
8 |
{ |
9 |
$string = ''; |
10 |
|
11 |
if ($arguments !== null && sizeof($arguments) > 0) |
12 |
{ |
13 |
$string = array(); |
14 |
|
15 |
foreach ($arguments as $argument) |
16 |
{ |
17 |
switch ($type = gettype($argument)) |
18 |
{ |
19 |
case 'boolean': |
20 |
$string[] = ($argument ? 'TRUE' : 'FALSE'); |
21 |
break; |
22 |
|
23 |
case 'integer': |
24 |
$string[] = 'integer(' . $argument . ')'; |
25 |
break; |
26 |
|
27 |
case 'double': |
28 |
$string[] = 'float(' . $argument . ')'; |
29 |
break; |
30 |
|
31 |
case 'string': |
32 |
$string[] = 'string(' . strlen($argument) . ') "' . $argument . '"'; |
33 |
break; |
34 |
|
35 |
case 'array': |
36 |
$string[] = 'array(' . ($size = sizeof($argument)) . ') {' . ($size <= 0 ? '' : '...') . '}'; |
37 |
break; |
38 |
|
39 |
case 'object': |
40 |
$string[] = 'object(' . get_class($argument) . ')'; |
41 |
break; |
42 |
|
43 |
case 'resource': |
44 |
ob_start(); |
45 |
var_dump($argument); |
46 |
$string[] = ob_get_clean(); |
47 |
break; |
48 |
|
49 |
case 'NULL': |
50 |
$string[] = $type; |
51 |
break; |
52 |
|
53 |
default: |
54 |
$string[] = $type; |
55 |
} |
56 |
} |
57 |
|
58 |
$string = join(', ', $string); |
59 |
} |
60 |
|
61 |
return $string; |
62 |
} |
63 |
} |