Youshido\Tests\StarWars\Schema\StarWarsData::humans PHP Method

humans() static public method

static public humans ( )
    static function humans()
    {
        return ['1000' => self::luke(), '1001' => self::vader(), '1002' => self::han(), '1003' => self::leia(), '1004' => self::tarkin()];
    }

Usage Example

Beispiel #1
0
 public function build($config)
 {
     $config->addField('hero', ['type' => new CharacterInterface(), 'args' => ['episode' => ['type' => new EpisodeEnum()]], 'resolve' => function ($root, $args) {
         return StarWarsData::getHero(isset($args['episode']) ? $args['episode'] : null);
     }])->addField(new Field(['name' => 'human', 'type' => new HumanType(), 'args' => ['id' => new IdType()], 'resolve' => function ($value = null, $args = []) {
         $humans = StarWarsData::humans();
         return isset($humans[$args['id']]) ? $humans[$args['id']] : null;
     }]))->addField(new Field(['name' => 'droid', 'type' => new DroidType(), 'args' => ['id' => new IdType()], 'resolve' => function ($value = null, $args = []) {
         $droids = StarWarsData::droids();
         return isset($droids[$args['id']]) ? $droids[$args['id']] : null;
     }]));
 }
All Usage Examples Of Youshido\Tests\StarWars\Schema\StarWarsData::humans