Conditions | 7 |
Paths | 20 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7.0178 |
Changes | 0 |
1 | <?php |
||
24 | 15 | public static function set(mixed $linkURL = '', mixed $displayName = null, ?Cell $cell = null): string |
|
25 | { |
||
26 | 15 | $linkURL = ($linkURL === null) ? '' : StringHelper::convertToString(Functions::flattenSingleValue($linkURL)); |
|
27 | 15 | $displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName); |
|
28 | |||
29 | 15 | if ((!is_object($cell)) || (trim($linkURL) == '')) { |
|
30 | 3 | return ExcelError::REF(); |
|
31 | } |
||
32 | |||
33 | 12 | if (is_object($displayName)) { |
|
34 | $displayName = $linkURL; |
||
35 | } |
||
36 | 12 | $displayName = StringHelper::convertToString($displayName); |
|
37 | 12 | if (trim($displayName) === '') { |
|
38 | 8 | $displayName = $linkURL; |
|
39 | } |
||
40 | |||
41 | 12 | $cell->getHyperlink() |
|
42 | 12 | ->setUrl($linkURL); |
|
43 | 12 | $cell->getHyperlink()->setTooltip($displayName); |
|
44 | |||
45 | 12 | return $displayName; |
|
46 | } |
||
48 |