| @@ 42-55 (lines=14) @@ | ||
| 39 | return 'Character'; |
|
| 40 | } |
|
| 41 | ||
| 42 | public function resolveType($object) |
|
| 43 | { |
|
| 44 | $humans = StarWarsData::humans(); |
|
| 45 | $droids = StarWarsData::droids(); |
|
| 46 | ||
| 47 | if (isset($humans[$object])) { |
|
| 48 | return $humans[$object]; |
|
| 49 | } |
|
| 50 | if (isset($droids[$object])) { |
|
| 51 | return $droids[$object]; |
|
| 52 | } |
|
| 53 | ||
| 54 | return null; |
|
| 55 | } |
|
| 56 | ||
| 57 | } |
|
| @@ 115-126 (lines=12) @@ | ||
| 112 | /** |
|
| 113 | * Helper function to get a character by ID. |
|
| 114 | */ |
|
| 115 | static function getCharacter($id) |
|
| 116 | { |
|
| 117 | $humans = self::humans(); |
|
| 118 | $droids = self::droids(); |
|
| 119 | if (isset($humans[$id])) { |
|
| 120 | return $humans[$id]; |
|
| 121 | } |
|
| 122 | if (isset($droids[$id])) { |
|
| 123 | return $droids[$id]; |
|
| 124 | } |
|
| 125 | return null; |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * @param $episode |
|