Revives a marker instance by creating it without constructor invocation.

@param string $typeName
@param array<string, mixed> $params
@return Marker
13997
protected function reviveMarker($typeName, array $params = NULL)
	{
		static $refs = [];
		
		if(empty($refs[$typeName]))
		{
			$refs[$typeName] = new \ReflectionClass($typeName);
		}
		
		$marker = $refs[$typeName]->newInstanceWithoutConstructor();
		
		foreach((array)$params as $k => $v)
		{
			$marker->$k = $v;
		}
		
		return $marker;
	}
60103
public function cursor($typeName, $arg1 = 1, $arg2 = null): self
    {
        if (!isset(self::$ctrlCursorCodes[$typeName])) {
            Cli::stderr("The [$typeName] is not supported cursor control.");
        }

        $code = self::$ctrlCursorCodes[$typeName];

        // allow argument
        if (false !== \strpos($code, '%')) {
            // The special code: ` 'coordinate' => '%dG|%d;%dH' `
            if ($typeName === self::CUR_COORDINATE) {
                $codes = explode('|', $code);

                if (null === $arg2) {
                    $code = sprintf($codes[0], $arg1);
                } else {
                    $code = sprintf($codes[1], $arg1, $arg2);
                }

            } else {
                $code = sprintf($code, $arg1);
            }
        }

        echo self::build($code, '');

        return $this;
    }
255184
public static function typeUrl($value, array $params, array $field)
    {
        return self::typeText($value, $params, $field) && filter_var($value, FILTER_VALIDATE_URL);
    }
1065197
public function screen(string $typeName, $arg = null): self
    {
        if (!isset(self::$ctrlScreenCodes[$typeName])) {
            Cli::stderr("The [$typeName] is not supported cursor control.");
        }

        $code = self::$ctrlScreenCodes[$typeName];

        // allow argument
        if (false !== strpos($code, '%')) {
            $code = sprintf($code, $arg);
        }

        echo self::build($code, '');

        return $this;
    }
106046
public function check($typeName, $value)
    {
        switch ($typeName) {
            case static::SCALAR_STRING:
                return is_string($value);
            case static::SCALAR_INTEGER:
                return is_integer($value);
            case static::SCALAR_FLOAT:
                return is_float($value);
            case static::SCALAR_BOOLEAN:
                return is_bool($value);
            default:
                return false;
        }
    }
556968
public function registerDynamicType($typeName)
    {
        if (isset($this->bindings[$typeName])) {
            throw new \InvalidArgumentException("`$typeName` is already registerd.");
        }

        $type = new \ReflectionClass($typeName);
        $this->bindings[$typeName] = new DynamicService($type);

        return $this;
    }
404710
public static function generate(string $typeName, array $typeFields): string
    {
        $arguments = [];

        foreach ($typeFields as $fieldName => $field) {
            $className = get_class($field);
            // We can generate queries for all but Object types, as Object types are relations
            if (! in_array($className, self::$supportedGraphQLTypes)) {
                continue;
            }

            if ($field instanceof FullTextSearch) {
                $arguments[] = sprintf('%s: %s @fulltext', $fieldName, $field->name);
                continue;
            }

            // Add all our custom directives
            $arguments[] = sprintf('%s: %s @eq', $fieldName, $field->name);
            $arguments[] = sprintf('%s_not: %s @not', $fieldName, $field->name);
            $arguments[] = sprintf('%s_in: [%s] @in', $fieldName, $field->name);
            $arguments[] = sprintf('%s_not_in: [%s] @not_in', $fieldName, $field->name);

            if ($field instanceof EnumType) {
                continue;
            }

            if ($field instanceof StringType) {
                $arguments[] = sprintf('%s_contains: %s @contains', $fieldName, $field->name);
                $arguments[] = sprintf('%s_not_contains: %s @not_contains', $fieldName, $field->name);
                $arguments[] = sprintf('%s_starts_with: %s @starts_with', $fieldName, $field->name);
                $arguments[] = sprintf('%s_not_starts_with: %s @not_starts_with', $fieldName, $field->name);
                $arguments[] = sprintf('%s_ends_with: %s @not_ends_with', $fieldName, $field->name);

                continue;
            }


            $arguments[] = sprintf('%s_lt: %s @lt', $fieldName, $field->name);
            $arguments[] = sprintf('%s_lte: %s @lte', $fieldName, $field->name);
            $arguments[] = sprintf('%s_gt: %s @gt', $fieldName, $field->name);
            $arguments[] = sprintf('%s_gte: %s @gte', $fieldName, $field->name);
        }

        if (count($arguments) < 1) {
            return '';
        }

        $allQueryName = str_plural(lcfirst($typeName));
        $queryArguments = sprintf('(%s)', implode(', ', $arguments));
        $allQuery = sprintf('    %1$s%2$s: [%3$s]! @all(model: "%3$s")', $allQueryName, $queryArguments, $typeName);

        $paginatedQueryName = str_plural(lcfirst($typeName)) . 'Paginated';
        $paginatedQuery = sprintf('    %1$s%2$s: [%3$s]! @paginate(model: "%3$s")', $paginatedQueryName, $queryArguments, $typeName);

        if (config('lighthouse-utils.authorization')) {
            $allPermission = sprintf('All%1$s', str_plural($typeName));
            $allQuery .= sprintf(' @can(if: "%1$s", model: "User")', $allPermission);

            $paginatePermission = sprintf('paginate%1$s', str_plural($typeName));
            $paginatedQuery .= sprintf(' @can(if: "%1$s", model: "User")', $paginatePermission);

            GraphQLSchema::register($allQueryName, $typeName, 'query', $allPermission ?? null);
            GraphQLSchema::register($paginatedQueryName, $typeName, 'query', $paginatePermission ?? null);
        }


        return $allQuery ."\r\n". $paginatedQuery;
    }
483402
public function call($methodName, array $params = array())
    {
        $options = array_merge($this->defaultApiOptions, $this->createConfigByMethodName($methodName));
        if (in_array($methodName, $this->postMethodNames)) {
            if (!($methodName == 'account/settings' && empty($params))) {
                $options['http'] = 'post';
            }
        }
        return $this->internalCall($methodName, $options, $params);
    }
825847
public function createByParams( $params = [], $config = [] ) {

		$params[ 'active' ]	= CoreGlobal::STATUS_ACTIVE;

		return parent::createByParams( $params, $config );
	}
162961
public function create(string $className, string $typeName): Type
    {
        $description = 'To be used as a filter for objects of type `' . Utils::getTypeName($className) . '`';

        $fieldsGetter = function () use ($className, $typeName): array {
            $configuration = [
                [
                    'name' => 'groups',
                    'type' => Type::listOf(Type::nonNull($this->getGroupType($className, $typeName))),
                ],
            ];

            return $configuration;
        };

        $filterType = new InputObjectType([
            'name' => $typeName,
            'description' => $description,
            'fields' => $fieldsGetter,
        ]);
        $this->types->registerInstance($filterType);

        return $filterType;
    }
262894
public function resolve(string $typeName): string
    {
        if (!isset($this->cache[$typeName])) {
            foreach ($this->resourceNamespaces as $resourceNamespace) {
                if (class_exists($this->cache[$typeName] = $this->qualify($resourceNamespace, $typeName))) {
                    return $this->cache[$typeName];
                }
            }

            throw new ClassNotFoundException(
                sprintf(
                    "Did not find type '%s' in namespace(s) '%s'.",
                    $typeName,
                    implode(', ', $this->resourceNamespaces)
                )
            );
        }

        return $this->cache[$typeName];
    }
1040017
static public function create($params, LocatorInterface $locator = null) {
		if (! is_array($params) && ! $params instanceof Traversable) {
			throw new InvalidOptions('Options must be an array or a Traversable implementation');
		}
		
		if ($params instanceof Traversable) {
			$params = Std::iteratorToArray($params);
		}
		
		$translator = new Translator();
		
		foreach ($params as $param => $value) {
			if ($param === 'cacheStrategy') {
				$class = self::NAMESPACE_CACHE . '\Strategy' . ucfirst($value);
				
				$translator->setCache(new $class($locator));
				unset($params[$param]);
				continue;
			}
			
			if ($param === 'resources') {
				if (! is_array($value) && ! $value instanceof Traversable) {
					throw new InvalidOptions('Resources definition must be an array or a Traversable implementation');
				}
				
				$translator->setResources(self::createResources($value));
				unset($params[$param]);
				continue;
			}
			
			if ($param === 'bbcodes') {
				if ($value) {
					$bbcodes = new BBCodes();
					
					if (isset($params['paramsPattern'])) {
						$bbcodes->setParamsPattern($params['paramsPattern']);
					}
					
					$translator->addPlugin($bbcodes, 'bbcodes');
				}
				
				unset($params[$param]);
			}
		}
		
		$translator->setOptions($params, false, false);
		
		return $translator;
	}
728445
protected function initializeProxy($typeName, callable $factory = NULL)
	{
		$proxyName = $this->container->loadScopedProxy($typeName);
		
		if($factory === NULL)
		{
			$factory = function() {
				throw new ScopeNotActiveException(sprintf('Scope "%s" is not active', $this->getScope()));
			};
		}
		
		return new $proxyName(new DelegateBinding($typeName, $this->getScope(), 0, $factory), $this, $this->proxies);
	}
574143
public function add($typeName, $args)
	{
		// set default
		$args = array_merge_recursive(array(
			'public' => true,
			'supports' => array(
				'title',
				'editor',
				'thumbnail',
				'revisions',
			),
			'has_archive' => true,
		), $args);

		$this->posttypes[$typeName] = $args;

		return true;
	}
374606
public function createPhpUse(string $typeName, string $alias = null, string $type = null) {
		$this->phpProperty->createPhpUse($typeName, $alias, $type);
		
		return $this;
	}
278572
public static function generate(string $typeName, array $typeFields): string
    {
        $mutationName = 'create' . $typeName;

        $arguments = RelationArgumentGenerator::generate($typeFields);
        $arguments = array_merge($arguments, InputFieldsArgumentGenerator::generate($typeFields));

        if (count($arguments) < 1) {
            return '';
        }

        $mutation = sprintf('    %s(%s)', $mutationName, implode(', ', $arguments));
        $mutation .= sprintf(': %1$s @create(model: "%1$s")', $typeName);

        if (config('lighthouse-utils.authorization')) {
            $permission = sprintf('create%1$s', $typeName);
            $mutation .= sprintf(' @can(if: "%1$s", model: "User")', $permission);
        }

        GraphQLSchema::register($mutationName, $typeName, 'mutation', $permission ?? null);

        return $mutation;
    }
252961
public function call($name, array $params = [])
    {
        $this->checkName($name);

        array_unshift($params, $this);
        call_user_func_array($this->callbacks[$name], $params);

        return $this;
    }