$directives * @return string */ public function resolveDirectives(array $directives): string { return collect($directives) ->map(function ($args, $directive) { if (filled($args)) { $argsString = collect($args) ->map(fn ($value, $key) => sprintf('%s: %s', $key, json_encode($value))) ->implode(', '); return sprintf('@%s(%s)', $directive, $argsString); } return "@{$directive}"; }) ->implode(' '); } }