GraphQL\Examples\Blog\Type\ImageType::resolveUrl PHP Method

resolveUrl() public method

public resolveUrl ( Image $value, $args, AppContext $context )
$value GraphQL\Examples\Blog\Data\Image
$context GraphQL\Examples\Blog\AppContext
    public function resolveUrl(Image $value, $args, AppContext $context)
    {
        switch ($value->type) {
            case Image::TYPE_USERPIC:
                $path = "/images/user/{$value->id}-{$value->size}.jpg";
                break;
            default:
                throw new \UnexpectedValueException("Unexpected image type: " . $value->type);
        }
        return $context->rootUrl . $path;
    }