| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 18 | 
| Code Lines | 11 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 9 | 
| CRAP Score | 4 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 37 | 21 | public function for(object $object, string $graph = 'default'): Graph | |
| 38 |     { | ||
| 39 | 21 | $className = get_class($object); | |
| 40 | |||
| 41 | 21 |         foreach ($this->graphsByName as $classNameForGraph => $graphs) { | |
| 42 | 21 |             if (! $object instanceof $classNameForGraph) { | |
| 43 | 1 | continue; | |
| 44 | } | ||
| 45 | |||
| 46 | 20 |             if (isset($graphs[$graph])) { | |
| 47 | 19 | return $graphs[$graph]; | |
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | 2 | throw new \RuntimeException(sprintf( | |
| 52 | 2 | 'No graph named "%s" for class named "%s"', | |
| 53 | $graph, | ||
| 54 | $className | ||
| 55 | )); | ||
| 58 |