File manager - Edit - /home/opticamezl/www/newok/Utils.zip
Back
PK G�\�]*;u u ASTHelper.phpnu �[��� <?php namespace YOOtheme\GraphQL\Utils; use YOOtheme\GraphQL\Type\Definition\FieldDefinition; use YOOtheme\GraphQL\Type\Definition\InputObjectField; use YOOtheme\GraphQL\Type\Definition\InputObjectType; use YOOtheme\GraphQL\Type\Definition\ObjectType; class ASTHelper extends AST { public static function objectType(ObjectType $type) { $node = [ 'kind' => 'ObjectTypeDefinition', 'name' => [ 'kind' => 'Name', 'value' => $type->name, ], 'fields' => [], 'interfaces' => [], 'directives' => [], ]; if (isset($type->config['directives'])) { foreach ($type->config['directives'] as $config) { $node['directives'][] = static::directive($config); } } foreach ($type->getFields() as $field) { $field->astNode = static::field($field); } return static::fromArray($node); } public static function inputType(InputObjectType $type) { $node = [ 'kind' => 'InputObjectTypeDefinition', 'name' => [ 'kind' => 'Name', 'value' => $type->name, ], 'fields' => [], 'directives' => [], ]; foreach ($type->config['directives'] ?? [] as $config) { $node['directives'][] = static::directive($config); } foreach ($type->getFields() as $field) { $field->astNode = static::inputField($field); } return static::fromArray($node); } public static function field(FieldDefinition $field) { $node = [ 'kind' => 'FieldDefinition', 'name' => [ 'kind' => 'Name', 'value' => $field->name, ], 'arguments' => [], 'directives' => [], ]; foreach ($field->config['directives'] ?? [] as $config) { $node['directives'][] = static::directive($config); } return static::fromArray($node); } public static function inputField(InputObjectField $field) { $node = [ 'kind' => 'InputValueDefinition', 'name' => [ 'kind' => 'Name', 'value' => $field->name, ], 'directives' => [], ]; foreach ($field->config['directives'] ?? [] as $config) { $node['directives'][] = static::directive($config); } return static::fromArray($node); } public static function directive(array $config) { $directive = [ 'kind' => 'Directive', 'name' => [ 'kind' => 'Name', 'value' => $config['name'], ], ]; foreach ($config['args'] ?? [] as $name => $value) { $directive['arguments'][] = static::argument($name, $value); } return static::fromArray($directive); } public static function argument($name, $value) { $argument = [ 'kind' => 'Argument', 'name' => [ 'kind' => 'Name', 'value' => $name, ], 'value' => [ 'kind' => 'StringValue', 'value' => $value, ], ]; return static::fromArray($argument); } } PK G�\n.$� � Introspection.phpnu �[��� <?php namespace YOOtheme\GraphQL\Utils; use YOOtheme\GraphQL\Type\Definition\ObjectType; use YOOtheme\GraphQL\Type\Introspection as BaseIntrospection; class Introspection extends BaseIntrospection { public static function getIntrospectionQuery(array $options = []): string { $value = fn($val) => is_callable($val) ? $val() : $val; $options += ['defaults' => ['description']]; $fields = []; foreach (static::getTypes() as $name => $type) { if (isset($options[$name]) && $type instanceof ObjectType) { $type->config['fields'] = $value($type->config['fields']) + $options[$name]; $fields[$name] = join( ' ', array_merge($options['defaults'], array_keys($options[$name])), ); } else { $fields[$name] = join(' ', $options['defaults']); } } return <<<EOD query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name {$fields['__Directive']} locations args { ...InputValue } } } } fragment FullType on __Type { kind name {$fields['__Type']} fields(includeDeprecated: true) { name {$fields['__Field']} args { ...InputValue } type { ...TypeRef } } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name {$fields['__EnumValue']} } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name {$fields['__InputValue']} type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } } EOD; } } PK G�\ gǎ� � Middleware.phpnu �[��� <?php namespace YOOtheme\GraphQL\Utils; class Middleware { /** * @var callable|null */ protected $handler; /** * @var array */ protected $stack = []; /** * Constructor. * * @param callable $handler */ public function __construct(?callable $handler = null) { $this->handler = $handler; } /** * Invokes the next middleware handler. * * @param mixed ...$arguments * * @return mixed */ public function __invoke(...$arguments) { if ($this->stack) { $arguments[] = $this; } $handler = array_shift($this->stack) ?: $this->handler; return $handler(...$arguments); } /** * Returns true if handler exists. */ public function hasHandler() { return isset($this->handler); } /** * Sets the middleware handler. * * @param callable $handler */ public function setHandler(callable $handler) { $this->handler = $handler; } /** * Unshift a middleware to the bottom of the stack. * * @param callable $middleware */ public function unshift(callable $middleware) { array_unshift($this->stack, $middleware); } /** * Push a middleware to the top of the stack. * * @param callable $middleware */ public function push(callable $middleware) { $this->stack[] = $middleware; } } PK G�\�]*;u u ASTHelper.phpnu �[��� PK G�\n.$� � � Introspection.phpnu �[��� PK G�\ gǎ� � � Middleware.phpnu �[��� PK � �
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings