repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
php-http/HttplugBundle | src/ClientFactory/MockFactory.php | MockFactory.createClient | public function createClient(array $config = [])
{
if (!class_exists(Client::class)) {
throw new \LogicException('To use the mock adapter you need to install the "php-http/mock-client" package.');
}
if (!$this->client) {
$this->client = new Client();
}
... | php | public function createClient(array $config = [])
{
if (!class_exists(Client::class)) {
throw new \LogicException('To use the mock adapter you need to install the "php-http/mock-client" package.');
}
if (!$this->client) {
$this->client = new Client();
}
... | [
"public",
"function",
"createClient",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"Client",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'To use the mock adapter you need to install ... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/ClientFactory/MockFactory.php#L31-L42 |
php-http/HttplugBundle | src/ClientFactory/Guzzle5Factory.php | Guzzle5Factory.createClient | public function createClient(array $config = [])
{
if (!class_exists('Http\Adapter\Guzzle5\Client')) {
throw new \LogicException('To use the Guzzle5 adapter you need to install the "php-http/guzzle5-adapter" package.');
}
$client = new Client($config);
return new Adapte... | php | public function createClient(array $config = [])
{
if (!class_exists('Http\Adapter\Guzzle5\Client')) {
throw new \LogicException('To use the Guzzle5 adapter you need to install the "php-http/guzzle5-adapter" package.');
}
$client = new Client($config);
return new Adapte... | [
"public",
"function",
"createClient",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Http\\Adapter\\Guzzle5\\Client'",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'To use the Guzzle5 adapter you need t... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/ClientFactory/Guzzle5Factory.php#L30-L39 |
php-http/HttplugBundle | src/ClientFactory/CurlFactory.php | CurlFactory.createClient | public function createClient(array $config = [])
{
if (!class_exists('Http\Client\Curl\Client')) {
throw new \LogicException('To use the Curl client you need to install the "php-http/curl-client" package.');
}
// Try to resolve curl constant names
foreach ($config as $ke... | php | public function createClient(array $config = [])
{
if (!class_exists('Http\Client\Curl\Client')) {
throw new \LogicException('To use the Curl client you need to install the "php-http/curl-client" package.');
}
// Try to resolve curl constant names
foreach ($config as $ke... | [
"public",
"function",
"createClient",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Http\\Client\\Curl\\Client'",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'To use the Curl client you need to instal... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/ClientFactory/CurlFactory.php#L37-L57 |
php-http/HttplugBundle | src/Collector/Formatter.php | Formatter.formatException | public function formatException(Exception $exception)
{
if ($exception instanceof HttpException) {
return $this->formatter->formatResponse($exception->getResponse());
}
if ($exception instanceof TransferException || $exception instanceof NetworkExceptionInterface) {
... | php | public function formatException(Exception $exception)
{
if ($exception instanceof HttpException) {
return $this->formatter->formatResponse($exception->getResponse());
}
if ($exception instanceof TransferException || $exception instanceof NetworkExceptionInterface) {
... | [
"public",
"function",
"formatException",
"(",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"exception",
"instanceof",
"HttpException",
")",
"{",
"return",
"$",
"this",
"->",
"formatter",
"->",
"formatResponse",
"(",
"$",
"exception",
"->",
"getResp... | Formats an exception.
@param Exception $exception
@return string | [
"Formats",
"an",
"exception",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/Formatter.php#L51-L62 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"getConfiguration",
"(",
"$",
"configs",
",",
"$",
"container",
")",
";",
"$",
"config",
"=",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L41-L97 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.configureClients | private function configureClients(ContainerBuilder $container, array $config)
{
$first = null;
$clients = [];
foreach ($config['clients'] as $name => $arguments) {
if (null === $first) {
// Save the name of the first configured client.
$first = $n... | php | private function configureClients(ContainerBuilder $container, array $config)
{
$first = null;
$clients = [];
foreach ($config['clients'] as $name => $arguments) {
if (null === $first) {
// Save the name of the first configured client.
$first = $n... | [
"private",
"function",
"configureClients",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"$",
"first",
"=",
"null",
";",
"$",
"clients",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"config",
"[",
"'clients'",
"]",
"as",
... | Configure client services.
@param ContainerBuilder $container
@param array $config | [
"Configure",
"client",
"services",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L105-L150 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.configurePlugins | private function configurePlugins(ContainerBuilder $container, array $config)
{
if (!empty($config['authentication'])) {
$this->configureAuthentication($container, $config['authentication']);
}
unset($config['authentication']);
foreach ($config as $name => $pluginConfig)... | php | private function configurePlugins(ContainerBuilder $container, array $config)
{
if (!empty($config['authentication'])) {
$this->configureAuthentication($container, $config['authentication']);
}
unset($config['authentication']);
foreach ($config as $name => $pluginConfig)... | [
"private",
"function",
"configurePlugins",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"config",
"[",
"'authentication'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"configureAuthentication... | Configure all Httplug plugins or remove their service definition.
@param ContainerBuilder $container
@param array $config | [
"Configure",
"all",
"Httplug",
"plugins",
"or",
"remove",
"their",
"service",
"definition",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L158-L173 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.configureAuthentication | private function configureAuthentication(ContainerBuilder $container, array $config, $servicePrefix = 'httplug.plugin.authentication')
{
$pluginServices = [];
foreach ($config as $name => $values) {
$authServiceKey = sprintf($servicePrefix.'.%s.auth', $name);
switch ($values... | php | private function configureAuthentication(ContainerBuilder $container, array $config, $servicePrefix = 'httplug.plugin.authentication')
{
$pluginServices = [];
foreach ($config as $name => $values) {
$authServiceKey = sprintf($servicePrefix.'.%s.auth', $name);
switch ($values... | [
"private",
"function",
"configureAuthentication",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
",",
"$",
"servicePrefix",
"=",
"'httplug.plugin.authentication'",
")",
"{",
"$",
"pluginServices",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
... | @param ContainerBuilder $container
@param array $config
@return array list of service ids for the authentication plugins | [
"@param",
"ContainerBuilder",
"$container",
"@param",
"array",
"$config"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L302-L347 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.createUri | private function createUri(ContainerBuilder $container, $serviceId, $uri)
{
$container
->register($serviceId, UriInterface::class)
->setPublic(false)
->setFactory([new Reference('httplug.uri_factory'), 'createUri'])
->addArgument($uri)
;
} | php | private function createUri(ContainerBuilder $container, $serviceId, $uri)
{
$container
->register($serviceId, UriInterface::class)
->setPublic(false)
->setFactory([new Reference('httplug.uri_factory'), 'createUri'])
->addArgument($uri)
;
} | [
"private",
"function",
"createUri",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"serviceId",
",",
"$",
"uri",
")",
"{",
"$",
"container",
"->",
"register",
"(",
"$",
"serviceId",
",",
"UriInterface",
"::",
"class",
")",
"->",
"setPublic",
"(",
"fa... | Create a URI object with the default URI factory.
@param ContainerBuilder $container
@param string $serviceId Name of the private service to create
@param string $uri String representation of the URI | [
"Create",
"a",
"URI",
"object",
"with",
"the",
"default",
"URI",
"factory",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L441-L449 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.configureAutoDiscoveryClients | private function configureAutoDiscoveryClients(ContainerBuilder $container, array $config)
{
$httpClient = $config['discovery']['client'];
if ('auto' !== $httpClient) {
$container->removeDefinition('httplug.auto_discovery.auto_discovered_client');
$container->removeDefinition... | php | private function configureAutoDiscoveryClients(ContainerBuilder $container, array $config)
{
$httpClient = $config['discovery']['client'];
if ('auto' !== $httpClient) {
$container->removeDefinition('httplug.auto_discovery.auto_discovered_client');
$container->removeDefinition... | [
"private",
"function",
"configureAutoDiscoveryClients",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"$",
"httpClient",
"=",
"$",
"config",
"[",
"'discovery'",
"]",
"[",
"'client'",
"]",
";",
"if",
"(",
"'auto'",
"!==",
"... | Make the user can select what client is used for auto discovery. If none is provided, a service will be created
by finding a client using auto discovery.
@param ContainerBuilder $container
@param array $config | [
"Make",
"the",
"user",
"can",
"select",
"what",
"client",
"is",
"used",
"for",
"auto",
"discovery",
".",
"If",
"none",
"is",
"provided",
"a",
"service",
"will",
"be",
"created",
"by",
"finding",
"a",
"client",
"using",
"auto",
"discovery",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L458-L487 |
php-http/HttplugBundle | src/DependencyInjection/HttplugExtension.php | HttplugExtension.configurePlugin | private function configurePlugin(ContainerBuilder $container, $serviceId, $pluginName, array $pluginConfig)
{
$pluginServiceId = $serviceId.'.plugin.'.$pluginName;
$definition = class_exists(ChildDefinition::class)
? new ChildDefinition('httplug.plugin.'.$pluginName)
: new D... | php | private function configurePlugin(ContainerBuilder $container, $serviceId, $pluginName, array $pluginConfig)
{
$pluginServiceId = $serviceId.'.plugin.'.$pluginName;
$definition = class_exists(ChildDefinition::class)
? new ChildDefinition('httplug.plugin.'.$pluginName)
: new D... | [
"private",
"function",
"configurePlugin",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"serviceId",
",",
"$",
"pluginName",
",",
"array",
"$",
"pluginConfig",
")",
"{",
"$",
"pluginServiceId",
"=",
"$",
"serviceId",
".",
"'.plugin.'",
".",
"$",
"plugin... | Configure a plugin using the parent definition from plugins.xml.
@param ContainerBuilder $container
@param string $serviceId
@param string $pluginName
@param array $pluginConfig
@return string configured service id | [
"Configure",
"a",
"plugin",
"using",
"the",
"parent",
"definition",
"from",
"plugins",
".",
"xml",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/DependencyInjection/HttplugExtension.php#L507-L519 |
php-http/HttplugBundle | src/Collector/ProfileClient.php | ProfileClient.sendAsyncRequest | public function sendAsyncRequest(RequestInterface $request)
{
$activateStack = true;
$stack = $this->collector->getActiveStack();
if (null === $stack) {
//When using a discovered client not wrapped in a PluginClient, we don't have a stack from StackPlugin. So
//we cre... | php | public function sendAsyncRequest(RequestInterface $request)
{
$activateStack = true;
$stack = $this->collector->getActiveStack();
if (null === $stack) {
//When using a discovered client not wrapped in a PluginClient, we don't have a stack from StackPlugin. So
//we cre... | [
"public",
"function",
"sendAsyncRequest",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"activateStack",
"=",
"true",
";",
"$",
"stack",
"=",
"$",
"this",
"->",
"collector",
"->",
"getActiveStack",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/ProfileClient.php#L75-L119 |
php-http/HttplugBundle | src/Collector/ProfileClient.php | ProfileClient.getStopwatchEventName | private function getStopwatchEventName(RequestInterface $request)
{
$name = sprintf('%s %s', $request->getMethod(), $request->getUri());
if (isset($this->eventNames[$name])) {
$name .= sprintf(' [#%d]', ++$this->eventNames[$name]);
} else {
$this->eventNames[$name] =... | php | private function getStopwatchEventName(RequestInterface $request)
{
$name = sprintf('%s %s', $request->getMethod(), $request->getUri());
if (isset($this->eventNames[$name])) {
$name .= sprintf(' [#%d]', ++$this->eventNames[$name]);
} else {
$this->eventNames[$name] =... | [
"private",
"function",
"getStopwatchEventName",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"name",
"=",
"sprintf",
"(",
"'%s %s'",
",",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"request",
"->",
"getUri",
"(",
")",
")",
";",
"if... | Generates the event name.
@param RequestInterface $request
@return string | [
"Generates",
"the",
"event",
"name",
"."
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/ProfileClient.php#L200-L211 |
php-http/HttplugBundle | src/Collector/ProfileClientFactory.php | ProfileClientFactory.createClient | public function createClient(array $config = [])
{
$client = is_callable($this->factory) ? call_user_func($this->factory, $config) : $this->factory->createClient($config);
if (!(($client instanceof HttpClient || $client instanceof ClientInterface) && $client instanceof HttpAsyncClient)) {
... | php | public function createClient(array $config = [])
{
$client = is_callable($this->factory) ? call_user_func($this->factory, $config) : $this->factory->createClient($config);
if (!(($client instanceof HttpClient || $client instanceof ClientInterface) && $client instanceof HttpAsyncClient)) {
... | [
"public",
"function",
"createClient",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"client",
"=",
"is_callable",
"(",
"$",
"this",
"->",
"factory",
")",
"?",
"call_user_func",
"(",
"$",
"this",
"->",
"factory",
",",
"$",
"config",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/ProfileClientFactory.php#L61-L70 |
php-http/HttplugBundle | src/ClientFactory/PluginClientFactory.php | PluginClientFactory.createPluginClient | public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = [])
{
if ($factory instanceof ClientFactory) {
$client = $factory->createClient($config);
} elseif (is_callable($factory)) {
$client = $factory($config);
} ... | php | public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = [])
{
if ($factory instanceof ClientFactory) {
$client = $factory->createClient($config);
} elseif (is_callable($factory)) {
$client = $factory($config);
} ... | [
"public",
"static",
"function",
"createPluginClient",
"(",
"array",
"$",
"plugins",
",",
"$",
"factory",
",",
"array",
"$",
"config",
",",
"array",
"$",
"pluginClientOptions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"factory",
"instanceof",
"ClientFactory",... | @param Plugin[] $plugins
@param ClientFactory|callable $factory
@param array $config config to the client factory
@param array $pluginClientOptions config forwarded to the PluginClient
@return PluginClient | [
"@param",
"Plugin",
"[]",
"$plugins",
"@param",
"ClientFactory|callable",
"$factory",
"@param",
"array",
"$config",
"config",
"to",
"the",
"client",
"factory",
"@param",
"array",
"$pluginClientOptions",
"config",
"forwarded",
"to",
"the",
"PluginClient"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/ClientFactory/PluginClientFactory.php#L27-L38 |
php-http/HttplugBundle | src/Collector/PluginClientFactory.php | PluginClientFactory.createClient | public function createClient($client, array $plugins = [], array $options = [])
{
$plugins = array_map(function (Plugin $plugin) {
return new ProfilePlugin($plugin, $this->collector, $this->formatter);
}, $plugins);
$clientName = isset($options['client_name']) ? $options['client... | php | public function createClient($client, array $plugins = [], array $options = [])
{
$plugins = array_map(function (Plugin $plugin) {
return new ProfilePlugin($plugin, $this->collector, $this->formatter);
}, $plugins);
$clientName = isset($options['client_name']) ? $options['client... | [
"public",
"function",
"createClient",
"(",
"$",
"client",
",",
"array",
"$",
"plugins",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"plugins",
"=",
"array_map",
"(",
"function",
"(",
"Plugin",
"$",
"plugin",
")",
"{",
... | @param HttpClient|ClientInterface|HttpAsyncClient $client
@param Plugin[] $plugins
@param array $options {
@var string $client_name to give client a name which may be used when displaying client information like in
the HTTPlugBundle profiler.
}
@s... | [
"@param",
"HttpClient|ClientInterface|HttpAsyncClient",
"$client",
"@param",
"Plugin",
"[]",
"$plugins",
"@param",
"array",
"$options",
"{"
] | train | https://github.com/php-http/HttplugBundle/blob/35d281804a90f0359aa9da5b5b1f55c18aeafaf8/src/Collector/PluginClientFactory.php#L62-L77 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.build | public static function build($list)
{
if (is_string($list)) {
return $list;
}
if ($list instanceof self) {
$list = $list->tokens;
}
$ret = '';
if (is_array($list)) {
foreach ($list as $tok) {
$ret .= $tok->token;
... | php | public static function build($list)
{
if (is_string($list)) {
return $list;
}
if ($list instanceof self) {
$list = $list->tokens;
}
$ret = '';
if (is_array($list)) {
foreach ($list as $tok) {
$ret .= $tok->token;
... | [
"public",
"static",
"function",
"build",
"(",
"$",
"list",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"list",
")",
")",
"{",
"return",
"$",
"list",
";",
"}",
"if",
"(",
"$",
"list",
"instanceof",
"self",
")",
"{",
"$",
"list",
"=",
"$",
"list",
... | Builds an array of tokens by merging their raw value.
@param string|Token[]|TokensList $list the tokens to be built
@return string | [
"Builds",
"an",
"array",
"of",
"tokens",
"by",
"merging",
"their",
"raw",
"value",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L62-L80 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.getNext | public function getNext()
{
for (; $this->idx < $this->count; ++$this->idx) {
if (($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE)
&& ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT)
) {
return $this->tokens[$this->idx++];
... | php | public function getNext()
{
for (; $this->idx < $this->count; ++$this->idx) {
if (($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE)
&& ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT)
) {
return $this->tokens[$this->idx++];
... | [
"public",
"function",
"getNext",
"(",
")",
"{",
"for",
"(",
";",
"$",
"this",
"->",
"idx",
"<",
"$",
"this",
"->",
"count",
";",
"++",
"$",
"this",
"->",
"idx",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"i... | Gets the next token. Skips any irrelevant token (whitespaces and
comments).
@return Token | [
"Gets",
"the",
"next",
"token",
".",
"Skips",
"any",
"irrelevant",
"token",
"(",
"whitespaces",
"and",
"comments",
")",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L98-L109 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.getNextOfType | public function getNextOfType($type)
{
for (; $this->idx < $this->count; ++$this->idx) {
if ($this->tokens[$this->idx]->type === $type) {
return $this->tokens[$this->idx++];
}
}
return null;
} | php | public function getNextOfType($type)
{
for (; $this->idx < $this->count; ++$this->idx) {
if ($this->tokens[$this->idx]->type === $type) {
return $this->tokens[$this->idx++];
}
}
return null;
} | [
"public",
"function",
"getNextOfType",
"(",
"$",
"type",
")",
"{",
"for",
"(",
";",
"$",
"this",
"->",
"idx",
"<",
"$",
"this",
"->",
"count",
";",
"++",
"$",
"this",
"->",
"idx",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"thi... | Gets the next token.
@param int $type the type
@return Token | [
"Gets",
"the",
"next",
"token",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L118-L127 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.getNextOfTypeAndValue | public function getNextOfTypeAndValue($type, $value)
{
for (; $this->idx < $this->count; ++$this->idx) {
if (($this->tokens[$this->idx]->type === $type)
&& ($this->tokens[$this->idx]->value === $value)
) {
return $this->tokens[$this->idx++];
... | php | public function getNextOfTypeAndValue($type, $value)
{
for (; $this->idx < $this->count; ++$this->idx) {
if (($this->tokens[$this->idx]->type === $type)
&& ($this->tokens[$this->idx]->value === $value)
) {
return $this->tokens[$this->idx++];
... | [
"public",
"function",
"getNextOfTypeAndValue",
"(",
"$",
"type",
",",
"$",
"value",
")",
"{",
"for",
"(",
";",
"$",
"this",
"->",
"idx",
"<",
"$",
"this",
"->",
"count",
";",
"++",
"$",
"this",
"->",
"idx",
")",
"{",
"if",
"(",
"(",
"$",
"this",
... | Gets the next token.
@param int $type the type of the token
@param string $value the value of the token
@return Token | [
"Gets",
"the",
"next",
"token",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L137-L148 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.offsetSet | public function offsetSet($offset, $value)
{
if ($offset === null) {
$this->tokens[$this->count++] = $value;
} else {
$this->tokens[$offset] = $value;
}
} | php | public function offsetSet($offset, $value)
{
if ($offset === null) {
$this->tokens[$this->count++] = $value;
} else {
$this->tokens[$offset] = $value;
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"offset",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"count",
"++",
"]",
"=",
"$",
"value",
";",
"}",
"else",
... | Sets an value inside the container.
@param int $offset the offset to be set
@param Token $value the token to be saved | [
"Sets",
"an",
"value",
"inside",
"the",
"container",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L156-L163 |
phpmyadmin/sql-parser | src/TokensList.php | TokensList.offsetUnset | public function offsetUnset($offset)
{
unset($this->tokens[$offset]);
--$this->count;
for ($i = $offset; $i < $this->count; ++$i) {
$this->tokens[$i] = $this->tokens[$i + 1];
}
unset($this->tokens[$this->count]);
} | php | public function offsetUnset($offset)
{
unset($this->tokens[$offset]);
--$this->count;
for ($i = $offset; $i < $this->count; ++$i) {
$this->tokens[$i] = $this->tokens[$i + 1];
}
unset($this->tokens[$this->count]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"offset",
"]",
")",
";",
"--",
"$",
"this",
"->",
"count",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"offset",
";",
"$",
"i",
"<"... | Unsets the value of an offset.
@param int $offset the offset to be unset | [
"Unsets",
"the",
"value",
"of",
"an",
"offset",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/TokensList.php#L194-L202 |
phpmyadmin/sql-parser | src/Components/Expression.php | Expression.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* Whether current tokens make an expression or a table reference.
*
* @var bool
*/
$isExpr = false;
/**
* Whether a period was p... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* Whether current tokens make an expression or a table reference.
*
* @var bool
*/
$isExpr = false;
/**
* Whether a period was p... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * Whether current tokens make an expre... | Possible options:.
`field`
First field to be filled.
If this is not specified, it takes the value of `parseField`.
`parseField`
Specifies the type of the field parsed. It may be `database`,
`table` or `column`. These expressions may not include
parentheses.
`breakOnAlias`
If not empty, breaks when the alias occur... | [
"Possible",
"options",
":",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Expression.php#L158-L425 |
phpmyadmin/sql-parser | src/Components/Expression.php | Expression.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode($component, ', ');
}
if ($component->expr !== '' && ! is_null($component->expr)) {
$ret = $component->expr;
} else {
$fields = [];
... | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode($component, ', ');
}
if ($component->expr !== '' && ! is_null($component->expr)) {
$ret = $component->expr;
} else {
$fields = [];
... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"$",
"component",
",",
"', '",
")",
";",
"... | @param Expression|Expression[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"Expression|Expression",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Expression.php#L433-L460 |
phpmyadmin/sql-parser | src/Parser.php | Parser.parse | public function parse()
{
/**
* Last transaction.
*
* @var TransactionStatement
*/
$lastTransaction = null;
/**
* Last parsed statement.
*
* @var Statement
*/
$lastStatement = null;
/**
* Union... | php | public function parse()
{
/**
* Last transaction.
*
* @var TransactionStatement
*/
$lastTransaction = null;
/**
* Last parsed statement.
*
* @var Statement
*/
$lastStatement = null;
/**
* Union... | [
"public",
"function",
"parse",
"(",
")",
"{",
"/**\n * Last transaction.\n *\n * @var TransactionStatement\n */",
"$",
"lastTransaction",
"=",
"null",
";",
"/**\n * Last parsed statement.\n *\n * @var Statement\n */",
"$",
"... | Builds the parse trees. | [
"Builds",
"the",
"parse",
"trees",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Parser.php#L383-L591 |
phpmyadmin/sql-parser | src/Parser.php | Parser.error | public function error($msg, Token $token = null, $code = 0)
{
$error = new ParserException(
Translator::gettext($msg),
$token,
$code
);
parent::error($error);
} | php | public function error($msg, Token $token = null, $code = 0)
{
$error = new ParserException(
Translator::gettext($msg),
$token,
$code
);
parent::error($error);
} | [
"public",
"function",
"error",
"(",
"$",
"msg",
",",
"Token",
"$",
"token",
"=",
"null",
",",
"$",
"code",
"=",
"0",
")",
"{",
"$",
"error",
"=",
"new",
"ParserException",
"(",
"Translator",
"::",
"gettext",
"(",
"$",
"msg",
")",
",",
"$",
"token",... | Creates a new error log.
@param string $msg the error message
@param Token $token the token that produced the error
@param int $code the code of the error
@throws ParserException throws the exception, if strict mode is enabled | [
"Creates",
"a",
"new",
"error",
"log",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Parser.php#L602-L610 |
phpmyadmin/sql-parser | src/Components/CreateDefinition.php | CreateDefinition.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ ( ]------------------... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ ( ]------------------... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return CreateDefinition[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/CreateDefinition.php#L175-L321 |
phpmyadmin/sql-parser | src/Components/CreateDefinition.php | CreateDefinition.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return "(\n " . implode(",\n ", $component) . "\n)";
}
$tmp = '';
if ($component->isConstraint) {
$tmp .= 'CONSTRAINT ';
}
if (isset($component->na... | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return "(\n " . implode(",\n ", $component) . "\n)";
}
$tmp = '';
if ($component->isConstraint) {
$tmp .= 'CONSTRAINT ';
}
if (isset($component->na... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"\"(\\n \"",
".",
"implode",
"(",
"\",\\n \"",
",",
"$",
"... | @param CreateDefinition|CreateDefinition[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"CreateDefinition|CreateDefinition",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/CreateDefinition.php#L329-L363 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getFlagsSelect | private static function getFlagsSelect($statement, $flags)
{
$flags['querytype'] = 'SELECT';
$flags['is_select'] = true;
if (! empty($statement->from)) {
$flags['select_from'] = true;
}
if ($statement->options->has('DISTINCT')) {
$flags['distinct'] =... | php | private static function getFlagsSelect($statement, $flags)
{
$flags['querytype'] = 'SELECT';
$flags['is_select'] = true;
if (! empty($statement->from)) {
$flags['select_from'] = true;
}
if ($statement->options->has('DISTINCT')) {
$flags['distinct'] =... | [
"private",
"static",
"function",
"getFlagsSelect",
"(",
"$",
"statement",
",",
"$",
"flags",
")",
"{",
"$",
"flags",
"[",
"'querytype'",
"]",
"=",
"'SELECT'",
";",
"$",
"flags",
"[",
"'is_select'",
"]",
"=",
"true",
";",
"if",
"(",
"!",
"empty",
"(",
... | Gets an array with flags select statement has.
@param SelectStatement $statement the statement to be processed
@param array $flags flags set so far
@return array | [
"Gets",
"an",
"array",
"with",
"flags",
"select",
"statement",
"has",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L225-L291 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getFlags | public static function getFlags($statement, $all = false)
{
$flags = ['querytype' => false];
if ($all) {
$flags = self::$ALLFLAGS;
}
if ($statement instanceof AlterStatement) {
$flags['querytype'] = 'ALTER';
$flags['reload'] = true;
} else... | php | public static function getFlags($statement, $all = false)
{
$flags = ['querytype' => false];
if ($all) {
$flags = self::$ALLFLAGS;
}
if ($statement instanceof AlterStatement) {
$flags['querytype'] = 'ALTER';
$flags['reload'] = true;
} else... | [
"public",
"static",
"function",
"getFlags",
"(",
"$",
"statement",
",",
"$",
"all",
"=",
"false",
")",
"{",
"$",
"flags",
"=",
"[",
"'querytype'",
"=>",
"false",
"]",
";",
"if",
"(",
"$",
"all",
")",
"{",
"$",
"flags",
"=",
"self",
"::",
"$",
"AL... | Gets an array with flags this statement has.
@param Statement|null $statement the statement to be processed
@param bool $all if `false`, false values will not be included
@return array | [
"Gets",
"an",
"array",
"with",
"flags",
"this",
"statement",
"has",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L301-L386 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getAll | public static function getAll($query)
{
$parser = new Parser($query);
if (empty($parser->statements[0])) {
return static::getFlags(null, true);
}
$statement = $parser->statements[0];
$ret = static::getFlags($statement, true);
$ret['parser'] = $parser;
... | php | public static function getAll($query)
{
$parser = new Parser($query);
if (empty($parser->statements[0])) {
return static::getFlags(null, true);
}
$statement = $parser->statements[0];
$ret = static::getFlags($statement, true);
$ret['parser'] = $parser;
... | [
"public",
"static",
"function",
"getAll",
"(",
"$",
"query",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"query",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"parser",
"->",
"statements",
"[",
"0",
"]",
")",
")",
"{",
"return",
"static",
... | Parses a query and gets all information about it.
@param string $query the query to be parsed
@return array The array returned is the one returned by
`static::getFlags()`, with the following keys added:
- parser - the parser used to analyze the query;
- statement - the first statement resulted from parsing;
- select_... | [
"Parses",
"a",
"query",
"and",
"gets",
"all",
"information",
"about",
"it",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L403-L476 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getTables | public static function getTables($statement)
{
$expressions = [];
if (($statement instanceof InsertStatement)
|| ($statement instanceof ReplaceStatement)
) {
$expressions = [$statement->into->dest];
} elseif ($statement instanceof UpdateStatement) {
... | php | public static function getTables($statement)
{
$expressions = [];
if (($statement instanceof InsertStatement)
|| ($statement instanceof ReplaceStatement)
) {
$expressions = [$statement->into->dest];
} elseif ($statement instanceof UpdateStatement) {
... | [
"public",
"static",
"function",
"getTables",
"(",
"$",
"statement",
")",
"{",
"$",
"expressions",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"statement",
"instanceof",
"InsertStatement",
")",
"||",
"(",
"$",
"statement",
"instanceof",
"ReplaceStatement",
")",
... | Gets a list of all tables used in this statement.
@param Statement $statement statement to be scanned
@return array | [
"Gets",
"a",
"list",
"of",
"all",
"tables",
"used",
"in",
"this",
"statement",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L485-L525 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getClause | public static function getClause($statement, $list, $clause, $type = 0, $skipFirst = true)
{
/**
* The index of the current clause.
*
* @var int
*/
$currIdx = 0;
/**
* The count of brackets.
* We keep track of them so we won't insert the... | php | public static function getClause($statement, $list, $clause, $type = 0, $skipFirst = true)
{
/**
* The index of the current clause.
*
* @var int
*/
$currIdx = 0;
/**
* The count of brackets.
* We keep track of them so we won't insert the... | [
"public",
"static",
"function",
"getClause",
"(",
"$",
"statement",
",",
"$",
"list",
",",
"$",
"clause",
",",
"$",
"type",
"=",
"0",
",",
"$",
"skipFirst",
"=",
"true",
")",
"{",
"/**\n * The index of the current clause.\n *\n * @var int\n ... | Gets a specific clause.
@param Statement $statement the parsed query that has to be modified
@param TokensList $list the list of tokens
@param string $clause the clause to be returned
@param int|string $type The type of the search.
If int,
-1 for everything that was before
0 only for the clause
1 for... | [
"Gets",
"a",
"specific",
"clause",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L544-L657 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.replaceClause | public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false)
{
// TODO: Update the tokens list and the statement.
if ($new === null) {
$new = $old;
}
if ($onlyType) {
return static::getClause($statement, $list, $old, -1, fals... | php | public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false)
{
// TODO: Update the tokens list and the statement.
if ($new === null) {
$new = $old;
}
if ($onlyType) {
return static::getClause($statement, $list, $old, -1, fals... | [
"public",
"static",
"function",
"replaceClause",
"(",
"$",
"statement",
",",
"$",
"list",
",",
"$",
"old",
",",
"$",
"new",
"=",
"null",
",",
"$",
"onlyType",
"=",
"false",
")",
"{",
"// TODO: Update the tokens list and the statement.",
"if",
"(",
"$",
"new"... | Builds a query by rebuilding the statement from the tokens list supplied
and replaces a clause.
It is a very basic version of a query builder.
@param Statement $statement the parsed query that has to be modified
@param TokensList $list the list of tokens
@param string $old The type of the clause that ... | [
"Builds",
"a",
"query",
"by",
"rebuilding",
"the",
"statement",
"from",
"the",
"tokens",
"list",
"supplied",
"and",
"replaces",
"a",
"clause",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L676-L692 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.replaceClauses | public static function replaceClauses($statement, $list, array $ops)
{
$count = count($ops);
// Nothing to do.
if ($count === 0) {
return '';
}
/**
* Value to be returned.
*
* @var string
*/
$ret = '';
// If t... | php | public static function replaceClauses($statement, $list, array $ops)
{
$count = count($ops);
// Nothing to do.
if ($count === 0) {
return '';
}
/**
* Value to be returned.
*
* @var string
*/
$ret = '';
// If t... | [
"public",
"static",
"function",
"replaceClauses",
"(",
"$",
"statement",
",",
"$",
"list",
",",
"array",
"$",
"ops",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"ops",
")",
";",
"// Nothing to do.",
"if",
"(",
"$",
"count",
"===",
"0",
")",
"{",
... | Builds a query by rebuilding the statement from the tokens list supplied
and replaces multiple clauses.
@param Statement $statement the parsed query that has to be modified
@param TokensList $list the list of tokens
@param array $ops Clauses to be replaced. Contains multiple
arrays having two values: ... | [
"Builds",
"a",
"query",
"by",
"rebuilding",
"the",
"statement",
"from",
"the",
"tokens",
"list",
"supplied",
"and",
"replaces",
"multiple",
"clauses",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L706-L749 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getFirstStatement | public static function getFirstStatement($query, $delimiter = null)
{
$lexer = new Lexer($query, false, $delimiter);
$list = $lexer->list;
/**
* Whether a full statement was found.
*
* @var bool
*/
$fullStatement = false;
/**
* T... | php | public static function getFirstStatement($query, $delimiter = null)
{
$lexer = new Lexer($query, false, $delimiter);
$list = $lexer->list;
/**
* Whether a full statement was found.
*
* @var bool
*/
$fullStatement = false;
/**
* T... | [
"public",
"static",
"function",
"getFirstStatement",
"(",
"$",
"query",
",",
"$",
"delimiter",
"=",
"null",
")",
"{",
"$",
"lexer",
"=",
"new",
"Lexer",
"(",
"$",
"query",
",",
"false",
",",
"$",
"delimiter",
")",
";",
"$",
"list",
"=",
"$",
"lexer",... | Gets the first full statement in the query.
@param string $query the query to be analyzed
@param string $delimiter the delimiter to be used
@return array array containing the first full query, the
remaining part of the query and the last
delimiter | [
"Gets",
"the",
"first",
"full",
"statement",
"in",
"the",
"query",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L761-L818 |
phpmyadmin/sql-parser | src/Utils/Query.php | Query.getClauseStartOffset | public static function getClauseStartOffset($statement, $list, $clause)
{
/**
* The count of brackets.
* We keep track of them so we won't insert the clause in a subquery.
*
* @var int
*/
$brackets = 0;
/**
* The clauses of this type of ... | php | public static function getClauseStartOffset($statement, $list, $clause)
{
/**
* The count of brackets.
* We keep track of them so we won't insert the clause in a subquery.
*
* @var int
*/
$brackets = 0;
/**
* The clauses of this type of ... | [
"public",
"static",
"function",
"getClauseStartOffset",
"(",
"$",
"statement",
",",
"$",
"list",
",",
"$",
"clause",
")",
"{",
"/**\n * The count of brackets.\n * We keep track of them so we won't insert the clause in a subquery.\n *\n * @var int\n ... | Gets a starting offset of a specific clause.
@param Statement $statement the parsed query that has to be modified
@param TokensList $list the list of tokens
@param string $clause the clause to be returned
@return int | [
"Gets",
"a",
"starting",
"offset",
"of",
"a",
"specific",
"clause",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Query.php#L829-L874 |
phpmyadmin/sql-parser | src/Context.php | Context.isKeyword | public static function isKeyword($str, $isReserved = false)
{
$str = strtoupper($str);
if (isset(static::$KEYWORDS[$str])) {
if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) {
return null;
}
return static::$KEYWORDS[... | php | public static function isKeyword($str, $isReserved = false)
{
$str = strtoupper($str);
if (isset(static::$KEYWORDS[$str])) {
if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) {
return null;
}
return static::$KEYWORDS[... | [
"public",
"static",
"function",
"isKeyword",
"(",
"$",
"str",
",",
"$",
"isReserved",
"=",
"false",
")",
"{",
"$",
"str",
"=",
"strtoupper",
"(",
"$",
"str",
")",
";",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"KEYWORDS",
"[",
"$",
"str",
"]",
... | Checks if the given string is a keyword.
@param string $str string to be checked
@param bool $isReserved checks if the keyword is reserved
@return int | [
"Checks",
"if",
"the",
"given",
"string",
"is",
"a",
"keyword",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L273-L286 |
phpmyadmin/sql-parser | src/Context.php | Context.isComment | public static function isComment($str, $end = false)
{
$len = strlen($str);
if ($len === 0) {
return null;
}
if ($str[0] === '#') {
return Token::FLAG_COMMENT_BASH;
} elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
return ((... | php | public static function isComment($str, $end = false)
{
$len = strlen($str);
if ($len === 0) {
return null;
}
if ($str[0] === '#') {
return Token::FLAG_COMMENT_BASH;
} elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
return ((... | [
"public",
"static",
"function",
"isComment",
"(",
"$",
"str",
",",
"$",
"end",
"=",
"false",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"str",
")",
";",
"if",
"(",
"$",
"len",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"... | Checks if the given string is the beginning of a whitespace.
@param string $str string to be checked
@param mixed $end
@return int the appropriate flag for the comment type | [
"Checks",
"if",
"the",
"given",
"string",
"is",
"the",
"beginning",
"of",
"a",
"whitespace",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L333-L355 |
phpmyadmin/sql-parser | src/Context.php | Context.isSymbol | public static function isSymbol($str)
{
if (strlen($str) === 0) {
return null;
}
if ($str[0] === '@') {
return Token::FLAG_SYMBOL_VARIABLE;
} elseif ($str[0] === '`') {
return Token::FLAG_SYMBOL_BACKTICK;
} elseif ($str[0] === ':') {
... | php | public static function isSymbol($str)
{
if (strlen($str) === 0) {
return null;
}
if ($str[0] === '@') {
return Token::FLAG_SYMBOL_VARIABLE;
} elseif ($str[0] === '`') {
return Token::FLAG_SYMBOL_BACKTICK;
} elseif ($str[0] === ':') {
... | [
"public",
"static",
"function",
"isSymbol",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"str",
")",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"str",
"[",
"0",
"]",
"===",
"'@'",
")",
"{",
"return",
"Token",... | Checks if the given character is the beginning of a symbol. A symbol
can be either a variable or a field name.
@param string $str string to be checked
@return int the appropriate flag for the symbol type | [
"Checks",
"if",
"the",
"given",
"character",
"is",
"the",
"beginning",
"of",
"a",
"symbol",
".",
"A",
"symbol",
"can",
"be",
"either",
"a",
"variable",
"or",
"a",
"field",
"name",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L403-L417 |
phpmyadmin/sql-parser | src/Context.php | Context.isString | public static function isString($str)
{
if (strlen($str) === 0) {
return null;
}
if ($str[0] === '\'') {
return Token::FLAG_STRING_SINGLE_QUOTES;
} elseif ($str[0] === '"') {
return Token::FLAG_STRING_DOUBLE_QUOTES;
}
return null;
... | php | public static function isString($str)
{
if (strlen($str) === 0) {
return null;
}
if ($str[0] === '\'') {
return Token::FLAG_STRING_SINGLE_QUOTES;
} elseif ($str[0] === '"') {
return Token::FLAG_STRING_DOUBLE_QUOTES;
}
return null;
... | [
"public",
"static",
"function",
"isString",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"str",
")",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"str",
"[",
"0",
"]",
"===",
"'\\''",
")",
"{",
"return",
"Token... | Checks if the given character is the beginning of a string.
@param string $str string to be checked
@return int the appropriate flag for the string type | [
"Checks",
"if",
"the",
"given",
"character",
"is",
"the",
"beginning",
"of",
"a",
"string",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L429-L441 |
phpmyadmin/sql-parser | src/Context.php | Context.isSeparator | public static function isSeparator($str)
{
// NOTES: Only non alphanumeric ASCII characters may be separators.
// `~` is the last printable ASCII character.
return ($str <= '~') && ($str !== '_')
&& (($str < '0') || ($str > '9'))
&& (($str < 'a') || ($str >... | php | public static function isSeparator($str)
{
// NOTES: Only non alphanumeric ASCII characters may be separators.
// `~` is the last printable ASCII character.
return ($str <= '~') && ($str !== '_')
&& (($str < '0') || ($str > '9'))
&& (($str < 'a') || ($str >... | [
"public",
"static",
"function",
"isSeparator",
"(",
"$",
"str",
")",
"{",
"// NOTES: Only non alphanumeric ASCII characters may be separators.",
"// `~` is the last printable ASCII character.",
"return",
"(",
"$",
"str",
"<=",
"'~'",
")",
"&&",
"(",
"$",
"str",
... | Checks if the given character can be a separator for two lexeme.
@param string $str string to be checked
@return bool | [
"Checks",
"if",
"the",
"given",
"character",
"can",
"be",
"a",
"separator",
"for",
"two",
"lexeme",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L453-L461 |
phpmyadmin/sql-parser | src/Context.php | Context.load | public static function load($context = '')
{
if (empty($context)) {
$context = self::$defaultContext;
}
if ($context[0] !== '\\') {
// Short context name (must be formatted into class name).
$context = self::$contextPrefix . $context;
}
if ... | php | public static function load($context = '')
{
if (empty($context)) {
$context = self::$defaultContext;
}
if ($context[0] !== '\\') {
// Short context name (must be formatted into class name).
$context = self::$contextPrefix . $context;
}
if ... | [
"public",
"static",
"function",
"load",
"(",
"$",
"context",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"context",
")",
")",
"{",
"$",
"context",
"=",
"self",
"::",
"$",
"defaultContext",
";",
"}",
"if",
"(",
"$",
"context",
"[",
"0",
"]"... | Loads the specified context.
Contexts may be used by accessing the context directly.
@param string $context name of the context or full class name that
defines the context
@throws LoaderException if the specified context doesn't exist | [
"Loads",
"the",
"specified",
"context",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L473-L490 |
phpmyadmin/sql-parser | src/Context.php | Context.loadClosest | public static function loadClosest($context = '')
{
$length = strlen($context);
for ($i = $length; $i > 0;) {
try {
/* Trying to load the new context */
static::load($context);
return $context;
} catch (LoaderException $e) {
... | php | public static function loadClosest($context = '')
{
$length = strlen($context);
for ($i = $length; $i > 0;) {
try {
/* Trying to load the new context */
static::load($context);
return $context;
} catch (LoaderException $e) {
... | [
"public",
"static",
"function",
"loadClosest",
"(",
"$",
"context",
"=",
"''",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"context",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"length",
";",
"$",
"i",
">",
"0",
";",
")",
"{",
"try",
"{",
... | Loads the context with the closest version to the one specified.
The closest context is found by replacing last digits with zero until one
is loaded successfully.
@see Context::load()
@param string $context name of the context or full class name that
defines the context
@return string The loaded context. `null` if ... | [
"Loads",
"the",
"context",
"with",
"the",
"closest",
"version",
"to",
"the",
"one",
"specified",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L505-L533 |
phpmyadmin/sql-parser | src/Context.php | Context.setMode | public static function setMode($mode = '')
{
static::$MODE = 0;
if (empty($mode)) {
return;
}
$mode = explode(',', $mode);
foreach ($mode as $m) {
static::$MODE |= constant('static::SQL_MODE_' . $m);
}
} | php | public static function setMode($mode = '')
{
static::$MODE = 0;
if (empty($mode)) {
return;
}
$mode = explode(',', $mode);
foreach ($mode as $m) {
static::$MODE |= constant('static::SQL_MODE_' . $m);
}
} | [
"public",
"static",
"function",
"setMode",
"(",
"$",
"mode",
"=",
"''",
")",
"{",
"static",
"::",
"$",
"MODE",
"=",
"0",
";",
"if",
"(",
"empty",
"(",
"$",
"mode",
")",
")",
"{",
"return",
";",
"}",
"$",
"mode",
"=",
"explode",
"(",
"','",
",",... | Sets the SQL mode.
@param string $mode The list of modes. If empty, the mode is reset. | [
"Sets",
"the",
"SQL",
"mode",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L540-L550 |
phpmyadmin/sql-parser | src/Context.php | Context.escape | public static function escape($str, $quote = '`')
{
if (is_array($str)) {
foreach ($str as $key => $value) {
$str[$key] = static::escape($value);
}
return $str;
}
if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES)
&& (! ... | php | public static function escape($str, $quote = '`')
{
if (is_array($str)) {
foreach ($str as $key => $value) {
$str[$key] = static::escape($value);
}
return $str;
}
if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES)
&& (! ... | [
"public",
"static",
"function",
"escape",
"(",
"$",
"str",
",",
"$",
"quote",
"=",
"'`'",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"str",
")",
")",
"{",
"foreach",
"(",
"$",
"str",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"str",
... | Escapes the symbol by adding surrounding backticks.
@param array|string $str the string to be escaped
@param string $quote quote to be used when escaping
@return string | [
"Escapes",
"the",
"symbol",
"by",
"adding",
"surrounding",
"backticks",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Context.php#L560-L581 |
phpmyadmin/sql-parser | src/Components/Array2d.php | Array2d.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
/**
* The number of values in each set.
*
* @var int
*/
$count = -1;
/**
* The state of the parser.
*
* Below are the stat... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
/**
* The number of values in each set.
*
* @var int
*/
$count = -1;
/**
* The state of the parser.
*
* Below are the stat... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"/**\n * The number of values in each set.\n *\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return ArrayObj[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Array2d.php#L31-L119 |
phpmyadmin/sql-parser | src/Utils/BufferedQuery.php | BufferedQuery.extract | public function extract($end = false)
{
/**
* The last parsed position.
*
* This is statically defined because it is not used outside anywhere
* outside this method and there is probably a (minor) performance
* improvement to it.
*
* @var int
... | php | public function extract($end = false)
{
/**
* The last parsed position.
*
* This is statically defined because it is not used outside anywhere
* outside this method and there is probably a (minor) performance
* improvement to it.
*
* @var int
... | [
"public",
"function",
"extract",
"(",
"$",
"end",
"=",
"false",
")",
"{",
"/**\n * The last parsed position.\n *\n * This is statically defined because it is not used outside anywhere\n * outside this method and there is probably a (minor) performance\n * ... | Extracts a statement from the buffer.
@param bool $end whether the end of the buffer was reached
@return string | [
"Extracts",
"a",
"statement",
"from",
"the",
"buffer",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/BufferedQuery.php#L142-L411 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.getTokens | public static function getTokens($str, $strict = false, $delimiter = null)
{
$lexer = new self($str, $strict, $delimiter);
return $lexer->list;
} | php | public static function getTokens($str, $strict = false, $delimiter = null)
{
$lexer = new self($str, $strict, $delimiter);
return $lexer->list;
} | [
"public",
"static",
"function",
"getTokens",
"(",
"$",
"str",
",",
"$",
"strict",
"=",
"false",
",",
"$",
"delimiter",
"=",
"null",
")",
"{",
"$",
"lexer",
"=",
"new",
"self",
"(",
"$",
"str",
",",
"$",
"strict",
",",
"$",
"delimiter",
")",
";",
... | Gets the tokens list parsed by a new instance of a lexer.
@param string|UtfString $str the query to be lexed
@param bool $strict whether strict mode should be
enabled or not
@param string $delimiter the delimiter to be used
@return TokensList | [
"Gets",
"the",
"tokens",
"list",
"parsed",
"by",
"a",
"new",
"instance",
"of",
"a",
"lexer",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L153-L158 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.lex | public function lex()
{
// TODO: Sometimes, static::parse* functions make unnecessary calls to
// is* functions. For a better performance, some rules can be deduced
// from context.
// For example, in `parseBool` there is no need to compare the token
// every time with `true`... | php | public function lex()
{
// TODO: Sometimes, static::parse* functions make unnecessary calls to
// is* functions. For a better performance, some rules can be deduced
// from context.
// For example, in `parseBool` there is no need to compare the token
// every time with `true`... | [
"public",
"function",
"lex",
"(",
")",
"{",
"// TODO: Sometimes, static::parse* functions make unnecessary calls to",
"// is* functions. For a better performance, some rules can be deduced",
"// from context.",
"// For example, in `parseBool` there is no need to compare the token",
"// every tim... | Parses the string and extracts lexemes. | [
"Parses",
"the",
"string",
"and",
"extracts",
"lexemes",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L207-L346 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.error | public function error($msg, $str = '', $pos = 0, $code = 0)
{
$error = new LexerException(
Translator::gettext($msg),
$str,
$pos,
$code
);
parent::error($error);
} | php | public function error($msg, $str = '', $pos = 0, $code = 0)
{
$error = new LexerException(
Translator::gettext($msg),
$str,
$pos,
$code
);
parent::error($error);
} | [
"public",
"function",
"error",
"(",
"$",
"msg",
",",
"$",
"str",
"=",
"''",
",",
"$",
"pos",
"=",
"0",
",",
"$",
"code",
"=",
"0",
")",
"{",
"$",
"error",
"=",
"new",
"LexerException",
"(",
"Translator",
"::",
"gettext",
"(",
"$",
"msg",
")",
"... | Creates a new error log.
@param string $msg the error message
@param string $str the character that produced the error
@param int $pos the position of the character
@param int $code the code of the error
@throws LexerException throws the exception, if strict mode is enabled | [
"Creates",
"a",
"new",
"error",
"log",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L358-L367 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseKeyword | public function parseKeyword()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $th... | php | public function parseKeyword()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $th... | [
"public",
"function",
"parseKeyword",
"(",
")",
"{",
"$",
"token",
"=",
"''",
";",
"/**\n * Value to be returned.\n *\n * @var Token\n */",
"$",
"ret",
"=",
"null",
";",
"/**\n * The value of `$this->last` where `$token` ends in `$this->str`.... | Parses a keyword.
@return null|Token | [
"Parses",
"a",
"keyword",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L374-L428 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseLabel | public function parseLabel()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $this... | php | public function parseLabel()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $this... | [
"public",
"function",
"parseLabel",
"(",
")",
"{",
"$",
"token",
"=",
"''",
";",
"/**\n * Value to be returned.\n *\n * @var Token\n */",
"$",
"ret",
"=",
"null",
";",
"/**\n * The value of `$this->last` where `$token` ends in `$this->str`.\n... | Parses a label.
@return null|Token | [
"Parses",
"a",
"label",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L435-L473 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseOperator | public function parseOperator()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $t... | php | public function parseOperator()
{
$token = '';
/**
* Value to be returned.
*
* @var Token
*/
$ret = null;
/**
* The value of `$this->last` where `$token` ends in `$this->str`.
*
* @var int
*/
$iEnd = $t... | [
"public",
"function",
"parseOperator",
"(",
")",
"{",
"$",
"token",
"=",
"''",
";",
"/**\n * Value to be returned.\n *\n * @var Token\n */",
"$",
"ret",
"=",
"null",
";",
"/**\n * The value of `$this->last` where `$token` ends in `$this->str`... | Parses an operator.
@return null|Token | [
"Parses",
"an",
"operator",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L480-L509 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseWhitespace | public function parseWhitespace()
{
$token = $this->str[$this->last];
if (! Context::isWhitespace($token)) {
return null;
}
while (++$this->last < $this->len && Context::isWhitespace($this->str[$this->last])) {
$token .= $this->str[$this->last];
}
... | php | public function parseWhitespace()
{
$token = $this->str[$this->last];
if (! Context::isWhitespace($token)) {
return null;
}
while (++$this->last < $this->len && Context::isWhitespace($this->str[$this->last])) {
$token .= $this->str[$this->last];
}
... | [
"public",
"function",
"parseWhitespace",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"str",
"[",
"$",
"this",
"->",
"last",
"]",
";",
"if",
"(",
"!",
"Context",
"::",
"isWhitespace",
"(",
"$",
"token",
")",
")",
"{",
"return",
"null",
";",... | Parses a whitespace.
@return null|Token | [
"Parses",
"a",
"whitespace",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L516-L531 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseComment | public function parseComment()
{
$iBak = $this->last;
$token = $this->str[$this->last];
// Bash style comments. (#comment\n)
if (Context::isComment($token)) {
while (++$this->last < $this->len
&& $this->str[$this->last] !== "\n"
) {
... | php | public function parseComment()
{
$iBak = $this->last;
$token = $this->str[$this->last];
// Bash style comments. (#comment\n)
if (Context::isComment($token)) {
while (++$this->last < $this->len
&& $this->str[$this->last] !== "\n"
) {
... | [
"public",
"function",
"parseComment",
"(",
")",
"{",
"$",
"iBak",
"=",
"$",
"this",
"->",
"last",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"str",
"[",
"$",
"this",
"->",
"last",
"]",
";",
"// Bash style comments. (#comment\\n)",
"if",
"(",
"Context",
... | Parses a comment.
@return null|Token | [
"Parses",
"a",
"comment",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L538-L637 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseBool | public function parseBool()
{
if ($this->last + 3 >= $this->len) {
// At least `min(strlen('TRUE'), strlen('FALSE'))` characters are
// required.
return null;
}
$iBak = $this->last;
$token = $this->str[$this->last] . $this->str[++$this->last]
... | php | public function parseBool()
{
if ($this->last + 3 >= $this->len) {
// At least `min(strlen('TRUE'), strlen('FALSE'))` characters are
// required.
return null;
}
$iBak = $this->last;
$token = $this->str[$this->last] . $this->str[++$this->last]
... | [
"public",
"function",
"parseBool",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"last",
"+",
"3",
">=",
"$",
"this",
"->",
"len",
")",
"{",
"// At least `min(strlen('TRUE'), strlen('FALSE'))` characters are",
"// required.",
"return",
"null",
";",
"}",
"$",
"i... | Parses a boolean.
@return null|Token | [
"Parses",
"a",
"boolean",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L644-L668 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseNumber | public function parseNumber()
{
// A rudimentary state machine is being used to parse numbers due to
// the various forms of their notation.
//
// Below are the states of the machines and the conditions to change
// the state.
//
// 1 --------------------... | php | public function parseNumber()
{
// A rudimentary state machine is being used to parse numbers due to
// the various forms of their notation.
//
// Below are the states of the machines and the conditions to change
// the state.
//
// 1 --------------------... | [
"public",
"function",
"parseNumber",
"(",
")",
"{",
"// A rudimentary state machine is being used to parse numbers due to",
"// the various forms of their notation.",
"//",
"// Below are the states of the machines and the conditions to change",
"// the state.",
"//",
"// 1 -------------... | Parses a number.
@return null|Token | [
"Parses",
"a",
"number",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L675-L812 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseString | public function parseString($quote = '')
{
$token = $this->str[$this->last];
if (! ($flags = Context::isString($token)) && $token !== $quote) {
return null;
}
$quote = $token;
while (++$this->last < $this->len) {
if ($this->last + 1 < $this->len
... | php | public function parseString($quote = '')
{
$token = $this->str[$this->last];
if (! ($flags = Context::isString($token)) && $token !== $quote) {
return null;
}
$quote = $token;
while (++$this->last < $this->len) {
if ($this->last + 1 < $this->len
... | [
"public",
"function",
"parseString",
"(",
"$",
"quote",
"=",
"''",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"str",
"[",
"$",
"this",
"->",
"last",
"]",
";",
"if",
"(",
"!",
"(",
"$",
"flags",
"=",
"Context",
"::",
"isString",
"(",
"$",
"... | Parses a string.
@param string $quote additional starting symbol
@return null|Token | [
"Parses",
"a",
"string",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L821-L859 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseSymbol | public function parseSymbol()
{
$token = $this->str[$this->last];
if (! ($flags = Context::isSymbol($token))) {
return null;
}
if ($flags & Token::FLAG_SYMBOL_VARIABLE) {
if ($this->last + 1 < $this->len && $this->str[++$this->last] === '@') {
... | php | public function parseSymbol()
{
$token = $this->str[$this->last];
if (! ($flags = Context::isSymbol($token))) {
return null;
}
if ($flags & Token::FLAG_SYMBOL_VARIABLE) {
if ($this->last + 1 < $this->len && $this->str[++$this->last] === '@') {
... | [
"public",
"function",
"parseSymbol",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"str",
"[",
"$",
"this",
"->",
"last",
"]",
";",
"if",
"(",
"!",
"(",
"$",
"flags",
"=",
"Context",
"::",
"isSymbol",
"(",
"$",
"token",
")",
")",
")",
"{... | Parses a symbol.
@return null|Token | [
"Parses",
"a",
"symbol",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L866-L906 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseUnknown | public function parseUnknown()
{
$token = $this->str[$this->last];
if (Context::isSeparator($token)) {
return null;
}
while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
$token .= $this->str[$this->last];
}
... | php | public function parseUnknown()
{
$token = $this->str[$this->last];
if (Context::isSeparator($token)) {
return null;
}
while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
$token .= $this->str[$this->last];
}
... | [
"public",
"function",
"parseUnknown",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"str",
"[",
"$",
"this",
"->",
"last",
"]",
";",
"if",
"(",
"Context",
"::",
"isSeparator",
"(",
"$",
"token",
")",
")",
"{",
"return",
"null",
";",
"}",
"... | Parses unknown parts of the query.
@return null|Token | [
"Parses",
"unknown",
"parts",
"of",
"the",
"query",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L913-L926 |
phpmyadmin/sql-parser | src/Lexer.php | Lexer.parseDelimiter | public function parseDelimiter()
{
$idx = 0;
while ($idx < $this->delimiterLen && $this->last + $idx < $this->len) {
if ($this->delimiter[$idx] !== $this->str[$this->last + $idx]) {
return null;
}
++$idx;
}
$this->last += $this->d... | php | public function parseDelimiter()
{
$idx = 0;
while ($idx < $this->delimiterLen && $this->last + $idx < $this->len) {
if ($this->delimiter[$idx] !== $this->str[$this->last + $idx]) {
return null;
}
++$idx;
}
$this->last += $this->d... | [
"public",
"function",
"parseDelimiter",
"(",
")",
"{",
"$",
"idx",
"=",
"0",
";",
"while",
"(",
"$",
"idx",
"<",
"$",
"this",
"->",
"delimiterLen",
"&&",
"$",
"this",
"->",
"last",
"+",
"$",
"idx",
"<",
"$",
"this",
"->",
"len",
")",
"{",
"if",
... | Parses the delimiter of the query.
@return null|Token | [
"Parses",
"the",
"delimiter",
"of",
"the",
"query",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Lexer.php#L933-L947 |
phpmyadmin/sql-parser | src/Components/JoinKeyword.php | JoinKeyword.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ JOIN ]---------------... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ JOIN ]---------------... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return JoinKeyword[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/JoinKeyword.php#L101-L207 |
phpmyadmin/sql-parser | src/Components/JoinKeyword.php | JoinKeyword.build | public static function build($component, array $options = [])
{
$ret = [];
foreach ($component as $c) {
$ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
. (! empty($c->on)
? ' ON ' . Condition::build($c->on) : '')
. (! e... | php | public static function build($component, array $options = [])
{
$ret = [];
foreach ($component as $c) {
$ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
. (! empty($c->on)
? ' ON ' . Condition::build($c->on) : '')
. (! e... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"component",
"as",
"$",
"c",
")",
"{",
"$",
"ret",
"[",
"]",
"=",
"array... | @param JoinKeyword[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"JoinKeyword",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/JoinKeyword.php#L215-L227 |
phpmyadmin/sql-parser | src/Components/IntoKeyword.php | IntoKeyword.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ name ]----------------------> 1
*... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -----------------------[ name ]----------------------> 1
*... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * The state of the parser.\n *... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return IntoKeyword | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/IntoKeyword.php#L146-L241 |
phpmyadmin/sql-parser | src/Components/IntoKeyword.php | IntoKeyword.build | public static function build($component, array $options = [])
{
if ($component->dest instanceof Expression) {
$columns = ! empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
return $component->dest . $columns;
} elseif (isset($component->va... | php | public static function build($component, array $options = [])
{
if ($component->dest instanceof Expression) {
$columns = ! empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
return $component->dest . $columns;
} elseif (isset($component->va... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"component",
"->",
"dest",
"instanceof",
"Expression",
")",
"{",
"$",
"columns",
"=",
"!",
"empty",
"(",
"$",
"comp... | @param IntoKeyword $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"IntoKeyword",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/IntoKeyword.php#L272-L296 |
phpmyadmin/sql-parser | src/Components/LockExpression.php | LockExpression.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------- [ tbl_name ] -----------------> 1
* ... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------- [ tbl_name ] -----------------> 1
* ... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * The state of the parser.\n *... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return CaseExpression | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/LockExpression.php#L44-L98 |
phpmyadmin/sql-parser | src/Components/LockExpression.php | LockExpression.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->table . ' ' . $component->type;
} | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->table . ' ' . $component->type;
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"', '",
",",
"$",
"component",
")",
";",
"... | @param LockExpression|LockExpression[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"LockExpression|LockExpression",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/LockExpression.php#L106-L113 |
phpmyadmin/sql-parser | src/UtfString.php | UtfString.offsetGet | public function offsetGet($offset)
{
if (($offset < 0) || ($offset >= $this->charLen)) {
return null;
}
$delta = $offset - $this->charIdx;
if ($delta > 0) {
// Fast forwarding.
while ($delta-- > 0) {
$this->byteIdx += static::getC... | php | public function offsetGet($offset)
{
if (($offset < 0) || ($offset >= $this->charLen)) {
return null;
}
$delta = $offset - $this->charIdx;
if ($delta > 0) {
// Fast forwarding.
while ($delta-- > 0) {
$this->byteIdx += static::getC... | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"(",
"$",
"offset",
"<",
"0",
")",
"||",
"(",
"$",
"offset",
">=",
"$",
"this",
"->",
"charLen",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"delta",
"=",
"$",
"off... | Gets the character at given offset.
@param int $offset the offset to be returned
@return string | [
"Gets",
"the",
"character",
"at",
"given",
"offset",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/UtfString.php#L104-L136 |
phpmyadmin/sql-parser | src/UtfString.php | UtfString.getCharLength | public static function getCharLength($byte)
{
$byte = ord($byte);
if ($byte < 128) {
return 1;
} elseif ($byte < 224) {
return 2;
} elseif ($byte < 240) {
return 3;
} elseif ($byte < 248) {
return 4;
} elseif ($byte < 25... | php | public static function getCharLength($byte)
{
$byte = ord($byte);
if ($byte < 128) {
return 1;
} elseif ($byte < 224) {
return 2;
} elseif ($byte < 240) {
return 3;
} elseif ($byte < 248) {
return 4;
} elseif ($byte < 25... | [
"public",
"static",
"function",
"getCharLength",
"(",
"$",
"byte",
")",
"{",
"$",
"byte",
"=",
"ord",
"(",
"$",
"byte",
")",
";",
"if",
"(",
"$",
"byte",
"<",
"128",
")",
"{",
"return",
"1",
";",
"}",
"elseif",
"(",
"$",
"byte",
"<",
"224",
")"... | Gets the length of an UTF-8 character.
According to RFC 3629, a UTF-8 character can have at most 4 bytes.
However, this implementation supports UTF-8 characters containing up to 6
bytes.
@param string $byte the byte to be analyzed
@see https://tools.ietf.org/html/rfc3629
@return int | [
"Gets",
"the",
"length",
"of",
"an",
"UTF",
"-",
"8",
"character",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/UtfString.php#L176-L192 |
phpmyadmin/sql-parser | src/Components/IndexHint.php | IndexHint.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
$expr->type = isset($options['type']) ? $options['type'] : null;
/**
* The state of the parser.
*
* Below are the states of the parser.
... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
$expr->type = isset($options['type']) ? $options['type'] : null;
/**
* The state of the parser.
*
* Below are the states of the parser.
... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"$",
"... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return IndexHint|Component[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/IndexHint.php#L74-L173 |
phpmyadmin/sql-parser | src/Components/IndexHint.php | IndexHint.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(' ', $component);
}
$ret = $component->type . ' ' . $component->indexOrKey . ' ';
if ($component->for !== null) {
$ret .= 'FOR ' . $component->for . ' '... | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(' ', $component);
}
$ret = $component->type . ' ' . $component->indexOrKey . ' ';
if ($component->for !== null) {
$ret .= 'FOR ' . $component->for . ' '... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"' '",
",",
"$",
"component",
")",
";",
"}... | @param ArrayObj|ArrayObj[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"ArrayObj|ArrayObj",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/IndexHint.php#L181-L192 |
phpmyadmin/sql-parser | src/Components/Limit.php | Limit.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$offset = false;
for (; $list->idx < $list->count; ++$list->idx) {
/**
* Token parsed at this moment.
*
* @var Token
*/
... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$offset = false;
for (; $list->idx < $list->count; ++$list->idx) {
/**
* Token parsed at this moment.
*
* @var Token
*/
... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"$",
"offset",
"=",
"false",
";",
"for",
... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return Limit | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Limit.php#L56-L116 |
phpmyadmin/sql-parser | src/Statement.php | Statement.build | public function build()
{
/**
* Query to be returned.
*
* @var string
*/
$query = '';
/**
* Clauses which were built already.
*
* It is required to keep track of built clauses because some fields,
* for example `join` i... | php | public function build()
{
/**
* Query to be returned.
*
* @var string
*/
$query = '';
/**
* Clauses which were built already.
*
* It is required to keep track of built clauses because some fields,
* for example `join` i... | [
"public",
"function",
"build",
"(",
")",
"{",
"/**\n * Query to be returned.\n *\n * @var string\n */",
"$",
"query",
"=",
"''",
";",
"/**\n * Clauses which were built already.\n *\n * It is required to keep track of built clauses becau... | Builds the string representation of this statement.
@return string | [
"Builds",
"the",
"string",
"representation",
"of",
"this",
"statement",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Statement.php#L99-L186 |
phpmyadmin/sql-parser | src/Statement.php | Statement.parse | public function parse(Parser $parser, TokensList $list)
{
/**
* Array containing all list of clauses parsed.
* This is used to check for duplicates.
*
* @var array
*/
$parsedClauses = [];
// This may be corrected by the parser.
$this->fir... | php | public function parse(Parser $parser, TokensList $list)
{
/**
* Array containing all list of clauses parsed.
* This is used to check for duplicates.
*
* @var array
*/
$parsedClauses = [];
// This may be corrected by the parser.
$this->fir... | [
"public",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
")",
"{",
"/**\n * Array containing all list of clauses parsed.\n * This is used to check for duplicates.\n *\n * @var array\n */",
"$",
"parsedClauses",... | Parses the statements defined by the tokens list.
@param Parser $parser the instance that requests parsing
@param TokensList $list the list of tokens to be parsed | [
"Parses",
"the",
"statements",
"defined",
"by",
"the",
"tokens",
"list",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Statement.php#L194-L405 |
phpmyadmin/sql-parser | src/Statement.php | Statement.validateClauseOrder | public function validateClauseOrder($parser, $list)
{
$clauses = array_flip(array_keys($this->getClauses()));
if (empty($clauses) || count($clauses) === 0) {
return true;
}
$minIdx = -1;
/**
* For tracking JOIN clauses in a query
* = 0 - JOI... | php | public function validateClauseOrder($parser, $list)
{
$clauses = array_flip(array_keys($this->getClauses()));
if (empty($clauses) || count($clauses) === 0) {
return true;
}
$minIdx = -1;
/**
* For tracking JOIN clauses in a query
* = 0 - JOI... | [
"public",
"function",
"validateClauseOrder",
"(",
"$",
"parser",
",",
"$",
"list",
")",
"{",
"$",
"clauses",
"=",
"array_flip",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"getClauses",
"(",
")",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"clauses",
... | Validates the order of the clauses in parsed statement
Ideally this should be called after successfully
completing the parsing of each statement.
@param Parser $parser the instance that requests parsing
@param TokensList $list the list of tokens to be parsed
@return bool | [
"Validates",
"the",
"order",
"of",
"the",
"clauses",
"in",
"parsed",
"statement",
"Ideally",
"this",
"should",
"be",
"called",
"after",
"successfully",
"completing",
"the",
"parsing",
"of",
"each",
"statement",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Statement.php#L461-L543 |
phpmyadmin/sql-parser | src/Statements/MaintenanceStatement.php | MaintenanceStatement.after | public function after(Parser $parser, TokensList $list, Token $token)
{
// [some options] is going to be parsed first.
//
// There is a parser specified in `Parser::$KEYWORD_PARSERS`
// which parses the name of the tables.
//
// Finally, we parse here [some more optio... | php | public function after(Parser $parser, TokensList $list, Token $token)
{
// [some options] is going to be parsed first.
//
// There is a parser specified in `Parser::$KEYWORD_PARSERS`
// which parses the name of the tables.
//
// Finally, we parse here [some more optio... | [
"public",
"function",
"after",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"Token",
"$",
"token",
")",
"{",
"// [some options] is going to be parsed first.",
"//",
"// There is a parser specified in `Parser::$KEYWORD_PARSERS`",
"// which parses the name... | Function called after the token was processed.
Parses the additional options from the end.
@param Parser $parser the instance that requests parsing
@param TokensList $list the list of tokens to be parsed
@param Token $token the token that is being parsed | [
"Function",
"called",
"after",
"the",
"token",
"was",
"processed",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Statements/MaintenanceStatement.php#L44-L60 |
phpmyadmin/sql-parser | src/Components/OrderKeyword.php | OrderKeyword.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 --------------------[ expression ]------------... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 --------------------[ expression ]------------... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return OrderKeyword[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/OrderKeyword.php#L56-L124 |
phpmyadmin/sql-parser | src/Components/OrderKeyword.php | OrderKeyword.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->expr . ' ' . $component->type;
} | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->expr . ' ' . $component->type;
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"', '",
",",
"$",
"component",
")",
";",
"... | @param OrderKeyword|OrderKeyword[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"OrderKeyword|OrderKeyword",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/OrderKeyword.php#L132-L139 |
phpmyadmin/sql-parser | src/Token.php | Token.extract | public function extract()
{
switch ($this->type) {
case self::TYPE_KEYWORD:
$this->keyword = strtoupper($this->token);
if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) {
// Unreserved keywords should stay the way they are because they
... | php | public function extract()
{
switch ($this->type) {
case self::TYPE_KEYWORD:
$this->keyword = strtoupper($this->token);
if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) {
// Unreserved keywords should stay the way they are because they
... | [
"public",
"function",
"extract",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_KEYWORD",
":",
"$",
"this",
"->",
"keyword",
"=",
"strtoupper",
"(",
"$",
"this",
"->",
"token",
")",
";",
"if",
"(",
"!... | Does little processing to the token to extract a value.
If no processing can be done it will return the initial string.
@return mixed | [
"Does",
"little",
"processing",
"to",
"the",
"token",
"to",
"extract",
"a",
"value",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Token.php#L240-L323 |
phpmyadmin/sql-parser | src/Components/UnionKeyword.php | UnionKeyword.build | public static function build($component, array $options = [])
{
$tmp = [];
foreach ($component as $componentPart) {
$tmp[] = $componentPart[0] . ' ' . $componentPart[1];
}
return implode(' ', $tmp);
} | php | public static function build($component, array $options = [])
{
$tmp = [];
foreach ($component as $componentPart) {
$tmp[] = $componentPart[0] . ' ' . $componentPart[1];
}
return implode(' ', $tmp);
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"tmp",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"component",
"as",
"$",
"componentPart",
")",
"{",
"$",
"tmp",
"[",
"]",
"... | @param UnionKeyword[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"UnionKeyword",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/UnionKeyword.php#L26-L34 |
phpmyadmin/sql-parser | src/Components/GroupKeyword.php | GroupKeyword.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return trim((string) $component->expr);
} | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return trim((string) $component->expr);
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"', '",
",",
"$",
"component",
")",
";",
"... | @param GroupKeyword|GroupKeyword[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"GroupKeyword|GroupKeyword",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/GroupKeyword.php#L123-L130 |
phpmyadmin/sql-parser | src/Components/RenameOperation.php | RenameOperation.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------------[ old name ]-------------... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------------[ old name ]-------------... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return RenameOperation[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/RenameOperation.php#L56-L166 |
phpmyadmin/sql-parser | src/Components/RenameOperation.php | RenameOperation.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->old . ' TO ' . $component->new;
} | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->old . ' TO ' . $component->new;
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"', '",
",",
"$",
"component",
")",
";",
"... | @param RenameOperation $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"RenameOperation",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/RenameOperation.php#L174-L181 |
phpmyadmin/sql-parser | src/Components/FunctionCall.php | FunctionCall.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ----------------------[ name ]-----------------------> 1
*... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ----------------------[ name ]-----------------------> 1
*... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * The state of the parser.\n *... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return FunctionCall | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/FunctionCall.php#L60-L107 |
phpmyadmin/sql-parser | src/Components/AlterOperation.php | AlterOperation.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* Counts brackets.
*
* @var int
*/
$brackets = 0;
/**
* The state of the parser.
*
* Below are the states of t... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* Counts brackets.
*
* @var int
*/
$brackets = 0;
/**
* The state of the parser.
*
* Below are the states of t... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * Counts brackets.\n *\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return AlterOperation | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/AlterOperation.php#L182-L310 |
phpmyadmin/sql-parser | src/Components/AlterOperation.php | AlterOperation.build | public static function build($component, array $options = [])
{
$ret = $component->options . ' ';
if ((isset($component->field)) && ($component->field !== '')) {
$ret .= $component->field . ' ';
}
$ret .= TokensList::build($component->unknown);
return $ret;
} | php | public static function build($component, array $options = [])
{
$ret = $component->options . ' ';
if ((isset($component->field)) && ($component->field !== '')) {
$ret .= $component->field . ' ';
}
$ret .= TokensList::build($component->unknown);
return $ret;
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"$",
"component",
"->",
"options",
".",
"' '",
";",
"if",
"(",
"(",
"isset",
"(",
"$",
"component",
"->",
"field... | @param AlterOperation $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"AlterOperation",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/AlterOperation.php#L318-L327 |
phpmyadmin/sql-parser | src/Components/CaseExpression.php | CaseExpression.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* State of parser.
*
* @var int
*/
$state = 0;
/**
* Syntax type (type 0 or type 1).
*
* @var int
*/
... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* State of parser.
*
* @var int
*/
$state = 0;
/**
* Syntax type (type 0 or type 1).
*
* @var int
*/
... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * State of parser.\n *\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return CaseExpression | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/CaseExpression.php#L87-L274 |
phpmyadmin/sql-parser | src/Components/CaseExpression.php | CaseExpression.build | public static function build($component, array $options = [])
{
$ret = 'CASE ';
if (isset($component->value)) {
// Syntax type 0
$ret .= $component->value . ' ';
$val_cnt = count($component->compare_values);
$res_cnt = count($component->results);
... | php | public static function build($component, array $options = [])
{
$ret = 'CASE ';
if (isset($component->value)) {
// Syntax type 0
$ret .= $component->value . ' ';
$val_cnt = count($component->compare_values);
$res_cnt = count($component->results);
... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"'CASE '",
";",
"if",
"(",
"isset",
"(",
"$",
"component",
"->",
"value",
")",
")",
"{",
"// Syntax type 0",
"$",
... | @param CaseExpression $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"CaseExpression",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/CaseExpression.php#L282-L313 |
phpmyadmin/sql-parser | src/Components/DataType.php | DataType.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -------------------[ data type ]--------------------> 1
*
... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 -------------------[ data type ]--------------------> 1
*
... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * The state of the parser.\n *... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return DataType | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/DataType.php#L99-L155 |
phpmyadmin/sql-parser | src/Components/DataType.php | DataType.build | public static function build($component, array $options = [])
{
$name = empty($options['lowercase']) ?
$component->name : strtolower($component->name);
$parameters = '';
if (! empty($component->parameters)) {
$parameters = '(' . implode(',', $component->parameters) .... | php | public static function build($component, array $options = [])
{
$name = empty($options['lowercase']) ?
$component->name : strtolower($component->name);
$parameters = '';
if (! empty($component->parameters)) {
$parameters = '(' . implode(',', $component->parameters) .... | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"name",
"=",
"empty",
"(",
"$",
"options",
"[",
"'lowercase'",
"]",
")",
"?",
"$",
"component",
"->",
"name",
":",
"strtolower... | @param DataType $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"DataType",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/DataType.php#L163-L174 |
phpmyadmin/sql-parser | src/Components/SetOperation.php | SetOperation.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------------[ col_name ]-------------... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ---------------------[ col_name ]-------------... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return SetOperation[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/SetOperation.php#L56-L145 |
phpmyadmin/sql-parser | src/Components/SetOperation.php | SetOperation.build | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->column . ' = ' . $component->value;
} | php | public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(', ', $component);
}
return $component->column . ' = ' . $component->value;
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"component",
")",
")",
"{",
"return",
"implode",
"(",
"', '",
",",
"$",
"component",
")",
";",
"... | @param SetOperation|SetOperation[] $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"SetOperation|SetOperation",
"[]",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/SetOperation.php#L153-L160 |
phpmyadmin/sql-parser | src/Components/Condition.php | Condition.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* Counts brackets.
*
* @var int
*/
$brackets = 0;
/**
* Whether there was a `BETWEEN` keyword before or not... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
/**
* Counts brackets.
*
* @var int
*/
$brackets = 0;
/**
* Whether there was a `BETWEEN` keyword before or not... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"expr",
"=",
"new",
"self",
"(",
")",
";",
"/**\n ... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return Condition[] | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Condition.php#L100-L217 |
phpmyadmin/sql-parser | src/Components/Reference.php | Reference.parse | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ----------------------[ table ]---------------------> 1
*
... | php | public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
/**
* The state of the parser.
*
* Below are the states of the parser.
*
* 0 ----------------------[ table ]---------------------> 1
*
... | [
"public",
"static",
"function",
"parse",
"(",
"Parser",
"$",
"parser",
",",
"TokensList",
"$",
"list",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"/**\n * The state of the parser.\n *... | @param Parser $parser the parser that serves as context
@param TokensList $list the list of tokens that are being parsed
@param array $options parameters for parsing
@return Reference | [
"@param",
"Parser",
"$parser",
"the",
"parser",
"that",
"serves",
"as",
"context",
"@param",
"TokensList",
"$list",
"the",
"list",
"of",
"tokens",
"that",
"are",
"being",
"parsed",
"@param",
"array",
"$options",
"parameters",
"for",
"parsing"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Reference.php#L86-L146 |
phpmyadmin/sql-parser | src/Components/Reference.php | Reference.build | public static function build($component, array $options = [])
{
return trim(
$component->table
. ' (' . implode(', ', Context::escape($component->columns)) . ') '
. $component->options
);
} | php | public static function build($component, array $options = [])
{
return trim(
$component->table
. ' (' . implode(', ', Context::escape($component->columns)) . ') '
. $component->options
);
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"component",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"trim",
"(",
"$",
"component",
"->",
"table",
".",
"' ('",
".",
"implode",
"(",
"', '",
",",
"Context",
"::",
"escape",
"... | @param Reference $component the component to be built
@param array $options parameters for building
@return string | [
"@param",
"Reference",
"$component",
"the",
"component",
"to",
"be",
"built",
"@param",
"array",
"$options",
"parameters",
"for",
"building"
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Components/Reference.php#L154-L161 |
phpmyadmin/sql-parser | src/Utils/Formatter.php | Formatter.getMergedOptions | private function getMergedOptions(array $options)
{
$options = array_merge(
$this->getDefaultOptions(),
$options
);
if (isset($options['formats'])) {
$options['formats'] = self::mergeFormats($this->getDefaultFormats(), $options['formats']);
} else... | php | private function getMergedOptions(array $options)
{
$options = array_merge(
$this->getDefaultOptions(),
$options
);
if (isset($options['formats'])) {
$options['formats'] = self::mergeFormats($this->getDefaultFormats(), $options['formats']);
} else... | [
"private",
"function",
"getMergedOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getDefaultOptions",
"(",
")",
",",
"$",
"options",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"... | The specified formatting options are merged with the default values.
@param array $options
@return array | [
"The",
"specified",
"formatting",
"options",
"are",
"merged",
"with",
"the",
"default",
"values",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Formatter.php#L89-L114 |
phpmyadmin/sql-parser | src/Utils/Formatter.php | Formatter.getDefaultFormats | protected function getDefaultFormats()
{
return [
[
'type' => Token::TYPE_KEYWORD,
'flags' => Token::FLAG_KEYWORD_RESERVED,
'html' => 'class="sql-reserved"',
'cli' => "\x1b[35m",
'function' => 'strtoupper',
... | php | protected function getDefaultFormats()
{
return [
[
'type' => Token::TYPE_KEYWORD,
'flags' => Token::FLAG_KEYWORD_RESERVED,
'html' => 'class="sql-reserved"',
'cli' => "\x1b[35m",
'function' => 'strtoupper',
... | [
"protected",
"function",
"getDefaultFormats",
"(",
")",
"{",
"return",
"[",
"[",
"'type'",
"=>",
"Token",
"::",
"TYPE_KEYWORD",
",",
"'flags'",
"=>",
"Token",
"::",
"FLAG_KEYWORD_RESERVED",
",",
"'html'",
"=>",
"'class=\"sql-reserved\"'",
",",
"'cli'",
"=>",
"\"... | The styles used for HTML formatting.
array($type, $flags, $span, $callback).
@return array | [
"The",
"styles",
"used",
"for",
"HTML",
"formatting",
".",
"array",
"(",
"$type",
"$flags",
"$span",
"$callback",
")",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Formatter.php#L183-L236 |
phpmyadmin/sql-parser | src/Utils/Formatter.php | Formatter.formatList | public function formatList($list)
{
/**
* The query to be returned.
*
* @var string
*/
$ret = '';
/**
* The indentation level.
*
* @var int
*/
$indent = 0;
/**
* Whether the line ended.
... | php | public function formatList($list)
{
/**
* The query to be returned.
*
* @var string
*/
$ret = '';
/**
* The indentation level.
*
* @var int
*/
$indent = 0;
/**
* Whether the line ended.
... | [
"public",
"function",
"formatList",
"(",
"$",
"list",
")",
"{",
"/**\n * The query to be returned.\n *\n * @var string\n */",
"$",
"ret",
"=",
"''",
";",
"/**\n * The indentation level.\n *\n * @var int\n */",
"$",
"inde... | Formats the given list of tokens.
@param TokensList $list the list of tokens
@return string | [
"Formats",
"the",
"given",
"list",
"of",
"tokens",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Formatter.php#L294-L520 |
phpmyadmin/sql-parser | src/Utils/Formatter.php | Formatter.toString | public function toString($token)
{
$text = $token->token;
static $prev;
foreach ($this->options['formats'] as $format) {
if ($token->type === $format['type']
&& ($token->flags & $format['flags']) === $format['flags']
) {
// Running tra... | php | public function toString($token)
{
$text = $token->token;
static $prev;
foreach ($this->options['formats'] as $format) {
if ($token->type === $format['type']
&& ($token->flags & $format['flags']) === $format['flags']
) {
// Running tra... | [
"public",
"function",
"toString",
"(",
"$",
"token",
")",
"{",
"$",
"text",
"=",
"$",
"token",
"->",
"token",
";",
"static",
"$",
"prev",
";",
"foreach",
"(",
"$",
"this",
"->",
"options",
"[",
"'formats'",
"]",
"as",
"$",
"format",
")",
"{",
"if",... | Tries to print the query and returns the result.
@param Token $token the token to be printed
@return string | [
"Tries",
"to",
"print",
"the",
"query",
"and",
"returns",
"the",
"result",
"."
] | train | https://github.com/phpmyadmin/sql-parser/blob/a7c5771e608f2e0204f7896d8661b84ec78414bb/src/Utils/Formatter.php#L604-L649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.