LeagueWrap\Dto\ShardStatus::getService PHP Method

getService() public method

public getService ( $name ) : null | Service
$name
return null | Service
    public function getService($name)
    {
        foreach ($this->services as $service) {
            if ($service->name == $name) {
                return $service;
            }
        }
        return null;
    }

Usage Example

Example #1
0
 public function testGetTranslation()
 {
     $content = json_decode(file_get_contents('tests/Json/shardstatus.euw.json'), true);
     $shardStatus = new ShardStatus($content);
     $service = $shardStatus->getService("Game");
     $incident = $service->incidents[0];
     $message = $incident->updates[0];
     $translation = $message->getTranslationByLocale('de_DE');
     $this->assertTrue($translation instanceof \LeagueWrap\Dto\Translation);
     $this->assertTrue($translation->locale == "de_DE");
 }