| Conditions | 6 | 
| Paths | 5 | 
| Total Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 4 | 
| CRAP Score | 13.776 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 18 | 1 | public function convertToString($source)  | 
            |
| 19 |     { | 
            ||
| 20 | 1 |         if (is_object($source)) { | 
            |
| 21 | 1 |             if ($source instanceof NamedInterface) { | 
            |
| 22 | 1 | return $source->getName();  | 
            |
| 23 |             } elseif (method_exists($source, '__toString')) { | 
            ||
| 24 | return (string) $source;  | 
            ||
| 25 |             } else { | 
            ||
| 26 | return get_class($source);  | 
            ||
| 27 | }  | 
            ||
| 28 |         } elseif (is_scalar($source) || is_null($source)) { | 
            ||
| 29 | return (string) $source;  | 
            ||
| 30 |         } else { | 
            ||
| 31 | return gettype($source);  | 
            ||
| 32 | }  | 
            ||
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 |