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 |
|---|---|---|---|---|---|---|---|---|---|---|
ptrofimov/beanstalk_console | lib/Pheanstalk/Socket/NativeSocket.php | Pheanstalk_Socket_NativeSocket.write | public function write($data)
{
$history = new Pheanstalk_Socket_WriteHistory(self::WRITE_RETRIES);
for ($written = 0, $fwrite = 0; $written < strlen($data); $written += $fwrite)
{
$fwrite = $this->_wrapper()
->fwrite($this->_socket, substr($data, $written));
$history->log($fwrite);
if ($history->... | php | public function write($data)
{
$history = new Pheanstalk_Socket_WriteHistory(self::WRITE_RETRIES);
for ($written = 0, $fwrite = 0; $written < strlen($data); $written += $fwrite)
{
$fwrite = $this->_wrapper()
->fwrite($this->_socket, substr($data, $written));
$history->log($fwrite);
if ($history->... | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
"{",
"$",
"history",
"=",
"new",
"Pheanstalk_Socket_WriteHistory",
"(",
"self",
"::",
"WRITE_RETRIES",
")",
";",
"for",
"(",
"$",
"written",
"=",
"0",
",",
"$",
"fwrite",
"=",
"0",
";",
"$",
"writte... | /* (non-phpdoc)
@see Pheanstalk_Socket::write() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Socket/NativeSocket.php#L46-L65 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Socket/NativeSocket.php | Pheanstalk_Socket_NativeSocket.read | public function read($length)
{
$read = 0;
$parts = array();
while ($read < $length && !$this->_wrapper()->feof($this->_socket))
{
$data = $this->_wrapper()
->fread($this->_socket, $length - $read);
if ($data === false)
{
throw new Pheanstalk_Exception_SocketException('fread() returned false... | php | public function read($length)
{
$read = 0;
$parts = array();
while ($read < $length && !$this->_wrapper()->feof($this->_socket))
{
$data = $this->_wrapper()
->fread($this->_socket, $length - $read);
if ($data === false)
{
throw new Pheanstalk_Exception_SocketException('fread() returned false... | [
"public",
"function",
"read",
"(",
"$",
"length",
")",
"{",
"$",
"read",
"=",
"0",
";",
"$",
"parts",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"read",
"<",
"$",
"length",
"&&",
"!",
"$",
"this",
"->",
"_wrapper",
"(",
")",
"->",
"feof",
... | /* (non-phpdoc)
@see Pheanstalk_Socket::write() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Socket/NativeSocket.php#L70-L90 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Socket/NativeSocket.php | Pheanstalk_Socket_NativeSocket.getLine | public function getLine($length = null)
{
do
{
$data = isset($length) ?
$this->_wrapper()->fgets($this->_socket, $length) :
$this->_wrapper()->fgets($this->_socket);
if ($this->_wrapper()->feof($this->_socket))
{
throw new Pheanstalk_Exception_ConnectionException(666, "Socket closed by server... | php | public function getLine($length = null)
{
do
{
$data = isset($length) ?
$this->_wrapper()->fgets($this->_socket, $length) :
$this->_wrapper()->fgets($this->_socket);
if ($this->_wrapper()->feof($this->_socket))
{
throw new Pheanstalk_Exception_ConnectionException(666, "Socket closed by server... | [
"public",
"function",
"getLine",
"(",
"$",
"length",
"=",
"null",
")",
"{",
"do",
"{",
"$",
"data",
"=",
"isset",
"(",
"$",
"length",
")",
"?",
"$",
"this",
"->",
"_wrapper",
"(",
")",
"->",
"fgets",
"(",
"$",
"this",
"->",
"_socket",
",",
"$",
... | /* (non-phpdoc)
@see Pheanstalk_Socket::write() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Socket/NativeSocket.php#L95-L111 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Command/ReserveCommand.php | Pheanstalk_Command_ReserveCommand.parseResponse | public function parseResponse($responseLine, $responseData)
{
if ($responseLine === Pheanstalk_Response::RESPONSE_DEADLINE_SOON ||
$responseLine === Pheanstalk_Response::RESPONSE_TIMED_OUT)
{
return $this->_createResponse($responseLine);
}
list($code, $id) = explode(' ', $responseLine);
return $this-... | php | public function parseResponse($responseLine, $responseData)
{
if ($responseLine === Pheanstalk_Response::RESPONSE_DEADLINE_SOON ||
$responseLine === Pheanstalk_Response::RESPONSE_TIMED_OUT)
{
return $this->_createResponse($responseLine);
}
list($code, $id) = explode(' ', $responseLine);
return $this-... | [
"public",
"function",
"parseResponse",
"(",
"$",
"responseLine",
",",
"$",
"responseData",
")",
"{",
"if",
"(",
"$",
"responseLine",
"===",
"Pheanstalk_Response",
"::",
"RESPONSE_DEADLINE_SOON",
"||",
"$",
"responseLine",
"===",
"Pheanstalk_Response",
"::",
"RESPONS... | /* (non-phpdoc)
@see Pheanstalk_ResponseParser::parseRespose() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Command/ReserveCommand.php#L43-L57 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Command/PeekCommand.php | Pheanstalk_Command_PeekCommand.getCommandLine | public function getCommandLine()
{
return isset($this->_jobId) ?
sprintf('peek %d', $this->_jobId) :
sprintf('peek-%s', $this->_subcommand);
} | php | public function getCommandLine()
{
return isset($this->_jobId) ?
sprintf('peek %d', $this->_jobId) :
sprintf('peek-%s', $this->_subcommand);
} | [
"public",
"function",
"getCommandLine",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_jobId",
")",
"?",
"sprintf",
"(",
"'peek %d'",
",",
"$",
"this",
"->",
"_jobId",
")",
":",
"sprintf",
"(",
"'peek-%s'",
",",
"$",
"this",
"->",
"_subcom... | /* (non-phpdoc)
@see Pheanstalk_Command::getCommandLine() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Command/PeekCommand.php#L55-L60 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Command/PeekCommand.php | Pheanstalk_Command_PeekCommand.parseResponse | public function parseResponse($responseLine, $responseData)
{
if ($responseLine == Pheanstalk_Response::RESPONSE_NOT_FOUND)
{
if (isset($this->_jobId))
{
$message = sprintf(
'%s: Job %d does not exist.',
$responseLine,
$this->_jobId
);
}
else
{
$message = sprintf(
"%s... | php | public function parseResponse($responseLine, $responseData)
{
if ($responseLine == Pheanstalk_Response::RESPONSE_NOT_FOUND)
{
if (isset($this->_jobId))
{
$message = sprintf(
'%s: Job %d does not exist.',
$responseLine,
$this->_jobId
);
}
else
{
$message = sprintf(
"%s... | [
"public",
"function",
"parseResponse",
"(",
"$",
"responseLine",
",",
"$",
"responseData",
")",
"{",
"if",
"(",
"$",
"responseLine",
"==",
"Pheanstalk_Response",
"::",
"RESPONSE_NOT_FOUND",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_jobId",
")",... | /* (non-phpdoc)
@see Pheanstalk_ResponseParser::parseRespose() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Command/PeekCommand.php#L65-L98 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Command/IgnoreCommand.php | Pheanstalk_Command_IgnoreCommand.parseResponse | public function parseResponse($responseLine, $responseData)
{
if (preg_match('#^WATCHING (\d+)$#', $responseLine, $matches))
{
return $this->_createResponse('WATCHING', array(
'count' => (int)$matches[1]
));
}
elseif ($responseLine == Pheanstalk_Response::RESPONSE_NOT_IGNORED)
{
throw new Pheans... | php | public function parseResponse($responseLine, $responseData)
{
if (preg_match('#^WATCHING (\d+)$#', $responseLine, $matches))
{
return $this->_createResponse('WATCHING', array(
'count' => (int)$matches[1]
));
}
elseif ($responseLine == Pheanstalk_Response::RESPONSE_NOT_IGNORED)
{
throw new Pheans... | [
"public",
"function",
"parseResponse",
"(",
"$",
"responseLine",
",",
"$",
"responseData",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'#^WATCHING (\\d+)$#'",
",",
"$",
"responseLine",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_createRes... | /* (non-phpdoc)
@see Pheanstalk_ResponseParser::parseRespose() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Command/IgnoreCommand.php#L36-L53 |
ptrofimov/beanstalk_console | lib/BeanstalkInterface.class.php | BeanstalkInterface._peek | private function _peek($tube, $method) {
try {
$job = $this->_client->useTube($tube)->{$method}();
$peek = array(
'id' => $job->getId(),
'data' => $job->getData(),
'stats' => $this->_client->statsJob($job));
} catch (Exception $ex) ... | php | private function _peek($tube, $method) {
try {
$job = $this->_client->useTube($tube)->{$method}();
$peek = array(
'id' => $job->getId(),
'data' => $job->getData(),
'stats' => $this->_client->statsJob($job));
} catch (Exception $ex) ... | [
"private",
"function",
"_peek",
"(",
"$",
"tube",
",",
"$",
"method",
")",
"{",
"try",
"{",
"$",
"job",
"=",
"$",
"this",
"->",
"_client",
"->",
"useTube",
"(",
"$",
"tube",
")",
"->",
"{",
"$",
"method",
"}",
"(",
")",
";",
"$",
"peek",
"=",
... | Pheanstalk class instance
@var Pheanstalk | [
"Pheanstalk",
"class",
"instance"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/BeanstalkInterface.class.php#L206-L220 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Socket/WriteHistory.php | Pheanstalk_Socket_WriteHistory.log | public function log($write)
{
if ($this->isFull())
array_shift($this->_data);
$this->_data []= (int)$write;
return $write;
} | php | public function log($write)
{
if ($this->isFull())
array_shift($this->_data);
$this->_data []= (int)$write;
return $write;
} | [
"public",
"function",
"log",
"(",
"$",
"write",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFull",
"(",
")",
")",
"array_shift",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"$",
"this",
"->",
"_data",
"[",
"]",
"=",
"(",
"int",
")",
"$",
"write",... | Logs the return value from a write call.
Returns the input value. | [
"Logs",
"the",
"return",
"value",
"from",
"a",
"write",
"call",
".",
"Returns",
"the",
"input",
"value",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Socket/WriteHistory.php#L52-L60 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.bury | public function bury($job, $priority = self::DEFAULT_PRIORITY)
{
$this->_dispatch(new Pheanstalk_Command_BuryCommand($job, $priority));
} | php | public function bury($job, $priority = self::DEFAULT_PRIORITY)
{
$this->_dispatch(new Pheanstalk_Command_BuryCommand($job, $priority));
} | [
"public",
"function",
"bury",
"(",
"$",
"job",
",",
"$",
"priority",
"=",
"self",
"::",
"DEFAULT_PRIORITY",
")",
"{",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_BuryCommand",
"(",
"$",
"job",
",",
"$",
"priority",
")",
")",
";",
"}"
... | Puts a job into a 'buried' state, revived only by 'kick' command.
@param Pheanstalk_Job $job
@return void | [
"Puts",
"a",
"job",
"into",
"a",
"buried",
"state",
"revived",
"only",
"by",
"kick",
"command",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L50-L53 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.peek | public function peek($jobId)
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand($jobId)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | php | public function peek($jobId)
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand($jobId)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | [
"public",
"function",
"peek",
"(",
"$",
"jobId",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_PeekCommand",
"(",
"$",
"jobId",
")",
")",
";",
"return",
"new",
"Pheanstalk_Job",
"(",
"$",
"response",
"[",
... | Inspect a job in the system, regardless of what tube it is in.
@param int $jobId
@return object Pheanstalk_Job | [
"Inspect",
"a",
"job",
"in",
"the",
"system",
"regardless",
"of",
"what",
"tube",
"it",
"is",
"in",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L162-L169 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.peekReady | public function peekReady()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_READY)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | php | public function peekReady()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_READY)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | [
"public",
"function",
"peekReady",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_PeekCommand",
"(",
"Pheanstalk_Command_PeekCommand",
"::",
"TYPE_READY",
")",
")",
";",
"return",
"new",
"Pheanstalk_Job",
"(",
... | Inspect the next ready job in the currently used tube.
@return object Pheanstalk_Job | [
"Inspect",
"the",
"next",
"ready",
"job",
"in",
"the",
"currently",
"used",
"tube",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L176-L183 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.peekDelayed | public function peekDelayed()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_DELAYED)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | php | public function peekDelayed()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_DELAYED)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | [
"public",
"function",
"peekDelayed",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_PeekCommand",
"(",
"Pheanstalk_Command_PeekCommand",
"::",
"TYPE_DELAYED",
")",
")",
";",
"return",
"new",
"Pheanstalk_Job",
"... | Inspect the shortest-remaining-delayed job in the currently used tube.
@return object Pheanstalk_Job | [
"Inspect",
"the",
"shortest",
"-",
"remaining",
"-",
"delayed",
"job",
"in",
"the",
"currently",
"used",
"tube",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L190-L197 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.peekBuried | public function peekBuried()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_BURIED)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | php | public function peekBuried()
{
$response = $this->_dispatch(
new Pheanstalk_Command_PeekCommand(Pheanstalk_Command_PeekCommand::TYPE_BURIED)
);
return new Pheanstalk_Job($response['id'], $response['jobdata']);
} | [
"public",
"function",
"peekBuried",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_PeekCommand",
"(",
"Pheanstalk_Command_PeekCommand",
"::",
"TYPE_BURIED",
")",
")",
";",
"return",
"new",
"Pheanstalk_Job",
"("... | Inspect the next job in the list of buried jobs of the currently used tube.
@return object Pheanstalk_Job | [
"Inspect",
"the",
"next",
"job",
"in",
"the",
"list",
"of",
"buried",
"jobs",
"of",
"the",
"currently",
"used",
"tube",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L204-L211 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.put | public function put(
$data,
$priority = self::DEFAULT_PRIORITY,
$delay = self::DEFAULT_DELAY,
$ttr = self::DEFAULT_TTR
)
{
$response = $this->_dispatch(
new Pheanstalk_Command_PutCommand($data, $priority, $delay, $ttr)
);
return $response['id'];
} | php | public function put(
$data,
$priority = self::DEFAULT_PRIORITY,
$delay = self::DEFAULT_DELAY,
$ttr = self::DEFAULT_TTR
)
{
$response = $this->_dispatch(
new Pheanstalk_Command_PutCommand($data, $priority, $delay, $ttr)
);
return $response['id'];
} | [
"public",
"function",
"put",
"(",
"$",
"data",
",",
"$",
"priority",
"=",
"self",
"::",
"DEFAULT_PRIORITY",
",",
"$",
"delay",
"=",
"self",
"::",
"DEFAULT_DELAY",
",",
"$",
"ttr",
"=",
"self",
"::",
"DEFAULT_TTR",
")",
"{",
"$",
"response",
"=",
"$",
... | Puts a job on the queue.
@param string $data The job data
@param int $priority From 0 (most urgent) to 0xFFFFFFFF (least urgent)
@param int $delay Seconds to wait before job becomes ready
@param int $ttr Time To Run: seconds a job can be reserved for
@return int The new job ID | [
"Puts",
"a",
"job",
"on",
"the",
"queue",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L222-L234 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.release | public function release(
$job,
$priority = self::DEFAULT_PRIORITY,
$delay = self::DEFAULT_DELAY
)
{
$this->_dispatch(
new Pheanstalk_Command_ReleaseCommand($job, $priority, $delay)
);
return $this;
} | php | public function release(
$job,
$priority = self::DEFAULT_PRIORITY,
$delay = self::DEFAULT_DELAY
)
{
$this->_dispatch(
new Pheanstalk_Command_ReleaseCommand($job, $priority, $delay)
);
return $this;
} | [
"public",
"function",
"release",
"(",
"$",
"job",
",",
"$",
"priority",
"=",
"self",
"::",
"DEFAULT_PRIORITY",
",",
"$",
"delay",
"=",
"self",
"::",
"DEFAULT_DELAY",
")",
"{",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_ReleaseCommand",
"... | Puts a reserved job back into the ready queue.
Marks the jobs state as "ready" to be run by any client.
It is normally used when the job fails because of a transitory error.
@param object $job Pheanstalk_Job
@param int $priority From 0 (most urgent) to 0xFFFFFFFF (least urgent)
@param int $delay Seconds to wait befor... | [
"Puts",
"a",
"reserved",
"job",
"back",
"into",
"the",
"ready",
"queue",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L247-L258 |
ptrofimov/beanstalk_console | lib/Pheanstalk.php | Pheanstalk.reserve | public function reserve($timeout = null)
{
$response = $this->_dispatch(
new Pheanstalk_Command_ReserveCommand($timeout)
);
$falseResponses = array(
Pheanstalk_Response::RESPONSE_DEADLINE_SOON,
Pheanstalk_Response::RESPONSE_TIMED_OUT,
);
if (in_array($response->getResponseName(), $falseResponses))... | php | public function reserve($timeout = null)
{
$response = $this->_dispatch(
new Pheanstalk_Command_ReserveCommand($timeout)
);
$falseResponses = array(
Pheanstalk_Response::RESPONSE_DEADLINE_SOON,
Pheanstalk_Response::RESPONSE_TIMED_OUT,
);
if (in_array($response->getResponseName(), $falseResponses))... | [
"public",
"function",
"reserve",
"(",
"$",
"timeout",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_dispatch",
"(",
"new",
"Pheanstalk_Command_ReserveCommand",
"(",
"$",
"timeout",
")",
")",
";",
"$",
"falseResponses",
"=",
"array",
"("... | Reserves/locks a ready job in a watched tube.
A non-null timeout uses the 'reserve-with-timeout' instead of 'reserve'.
A timeout value of 0 will cause the server to immediately return either a
response or TIMED_OUT. A positive value of timeout will limit the amount of
time the client will block on the reserve reques... | [
"Reserves",
"/",
"locks",
"a",
"ready",
"job",
"in",
"a",
"watched",
"tube",
"."
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk.php#L273-L292 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Command/KickCommand.php | Pheanstalk_Command_KickCommand.parseResponse | public function parseResponse($responseLine, $responseData)
{
list($code, $count) = explode(' ', $responseLine);
return $this->_createResponse($code, array(
'kicked' => (int)$count,
));
} | php | public function parseResponse($responseLine, $responseData)
{
list($code, $count) = explode(' ', $responseLine);
return $this->_createResponse($code, array(
'kicked' => (int)$count,
));
} | [
"public",
"function",
"parseResponse",
"(",
"$",
"responseLine",
",",
"$",
"responseData",
")",
"{",
"list",
"(",
"$",
"code",
",",
"$",
"count",
")",
"=",
"explode",
"(",
"' '",
",",
"$",
"responseLine",
")",
";",
"return",
"$",
"this",
"->",
"_create... | /* (non-phpdoc)
@see Pheanstalk_ResponseParser::parseRespose() | [
"/",
"*",
"(",
"non",
"-",
"phpdoc",
")"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Command/KickCommand.php#L38-L45 |
ptrofimov/beanstalk_console | lib/Pheanstalk/Connection.php | Pheanstalk_Connection._getSocket | private function _getSocket()
{
if (!isset($this->_socket))
{
$this->_socket = new Pheanstalk_Socket_NativeSocket(
$this->_hostname,
$this->_port,
$this->_connectTimeout
);
}
return $this->_socket;
} | php | private function _getSocket()
{
if (!isset($this->_socket))
{
$this->_socket = new Pheanstalk_Socket_NativeSocket(
$this->_hostname,
$this->_port,
$this->_connectTimeout
);
}
return $this->_socket;
} | [
"private",
"function",
"_getSocket",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_socket",
")",
")",
"{",
"$",
"this",
"->",
"_socket",
"=",
"new",
"Pheanstalk_Socket_NativeSocket",
"(",
"$",
"this",
"->",
"_hostname",
",",
"$",
"t... | Socket handle for the connection to beanstalkd
@return Pheanstalk_Socket
@throws Pheanstalk_Exception_ConnectionException | [
"Socket",
"handle",
"for",
"the",
"connection",
"to",
"beanstalkd"
] | train | https://github.com/ptrofimov/beanstalk_console/blob/829dd83e920f76244a0a1b266b25bbca27c879a6/lib/Pheanstalk/Connection.php#L130-L142 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/SQLProcessor.php | SQLProcessor.process | public function process($tokens) {
$prev_category = "";
$token_category = "";
$skip_next = 0;
$out = false;
// $tokens may come as a numeric indexed array starting with an index greater than 0 (or as a boolean)
$tokenCount = count($tokens);
if ( is_array($tokens) ){
... | php | public function process($tokens) {
$prev_category = "";
$token_category = "";
$skip_next = 0;
$out = false;
// $tokens may come as a numeric indexed array starting with an index greater than 0 (or as a boolean)
$tokenCount = count($tokens);
if ( is_array($tokens) ){
... | [
"public",
"function",
"process",
"(",
"$",
"tokens",
")",
"{",
"$",
"prev_category",
"=",
"\"\"",
";",
"$",
"token_category",
"=",
"\"\"",
";",
"$",
"skip_next",
"=",
"0",
";",
"$",
"out",
"=",
"false",
";",
"// $tokens may come as a numeric indexed array star... | This function breaks up the SQL statement into logical sections.
Some sections are delegated to specialized processors. | [
"This",
"function",
"breaks",
"up",
"the",
"SQL",
"statement",
"into",
"logical",
"sections",
".",
"Some",
"sections",
"are",
"delegated",
"to",
"specialized",
"processors",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/SQLProcessor.php#L58-L514 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/SetProcessor.php | SetProcessor.processAssignment | protected function processAssignment($base_expr) {
$assignment = $this->processExpressionList($this->splitSQLIntoTokens($base_expr));
// TODO: if the left side of the assignment is a reserved keyword, it should be changed to colref
return array('expr_type' => ExpressionType::EXPRESSION, 'base_... | php | protected function processAssignment($base_expr) {
$assignment = $this->processExpressionList($this->splitSQLIntoTokens($base_expr));
// TODO: if the left side of the assignment is a reserved keyword, it should be changed to colref
return array('expr_type' => ExpressionType::EXPRESSION, 'base_... | [
"protected",
"function",
"processAssignment",
"(",
"$",
"base_expr",
")",
"{",
"$",
"assignment",
"=",
"$",
"this",
"->",
"processExpressionList",
"(",
"$",
"this",
"->",
"splitSQLIntoTokens",
"(",
"$",
"base_expr",
")",
")",
";",
"// TODO: if the left side of the... | A SET list is simply a list of key = value expressions separated by comma (,).
This function produces a list of the key/value expressions. | [
"A",
"SET",
"list",
"is",
"simply",
"a",
"list",
"of",
"key",
"=",
"value",
"expressions",
"separated",
"by",
"comma",
"(",
")",
".",
"This",
"function",
"produces",
"a",
"list",
"of",
"the",
"key",
"/",
"value",
"expressions",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/SetProcessor.php#L54-L61 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/lexer/LexerSplitter.php | LexerSplitter.convertSplittersToRegexPattern | public function convertSplittersToRegexPattern( $splitters ) {
$regex_parts = array();
foreach ( $splitters as $part ) {
$part = preg_quote( $part );
switch ( $part ) {
case "\r\n":
$part = '\r\n';
break;
case "\t":
$part = '\t';
break;
case "\... | php | public function convertSplittersToRegexPattern( $splitters ) {
$regex_parts = array();
foreach ( $splitters as $part ) {
$part = preg_quote( $part );
switch ( $part ) {
case "\r\n":
$part = '\r\n';
break;
case "\t":
$part = '\t';
break;
case "\... | [
"public",
"function",
"convertSplittersToRegexPattern",
"(",
"$",
"splitters",
")",
"{",
"$",
"regex_parts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"splitters",
"as",
"$",
"part",
")",
"{",
"$",
"part",
"=",
"preg_quote",
"(",
"$",
"part",
")"... | Convert an array of splitter tokens to a regex pattern string.
@param array $splitters
@return string | [
"Convert",
"an",
"array",
"of",
"splitter",
"tokens",
"to",
"a",
"regex",
"pattern",
"string",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/lexer/LexerSplitter.php#L90-L125 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/UnionProcessor.php | UnionProcessor.processMySQLUnion | protected function processMySQLUnion($queries) {
$unionTypes = array('UNION', 'UNION ALL');
foreach ($unionTypes as $unionType) {
if (empty($queries[$unionType])) {
continue;
}
foreach ($queries[$unionType] as $key => $tokenList) {
fo... | php | protected function processMySQLUnion($queries) {
$unionTypes = array('UNION', 'UNION ALL');
foreach ($unionTypes as $unionType) {
if (empty($queries[$unionType])) {
continue;
}
foreach ($queries[$unionType] as $key => $tokenList) {
fo... | [
"protected",
"function",
"processMySQLUnion",
"(",
"$",
"queries",
")",
"{",
"$",
"unionTypes",
"=",
"array",
"(",
"'UNION'",
",",
"'UNION ALL'",
")",
";",
"foreach",
"(",
"$",
"unionTypes",
"as",
"$",
"unionType",
")",
"{",
"if",
"(",
"empty",
"(",
"$",... | MySQL supports a special form of UNION:
(select ...)
union
(select ...)
This function handles this query syntax. Only one such subquery
is supported in each UNION block. (select)(select)union(select) is not legal.
The extra queries will be silently ignored. | [
"MySQL",
"supports",
"a",
"special",
"form",
"of",
"UNION",
":",
"(",
"select",
"...",
")",
"union",
"(",
"select",
"...",
")"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/UnionProcessor.php#L83-L111 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/UnionProcessor.php | UnionProcessor.splitUnionRemainder | protected function splitUnionRemainder($queries, $unionType, $outputArray)
{
$finalQuery = [];
//If this token contains a matching pair of brackets at the start and end, use it as the final query
$finalQueryFound = false;
if (count($outputArray) === 1) {
$tokenAsArray = ... | php | protected function splitUnionRemainder($queries, $unionType, $outputArray)
{
$finalQuery = [];
//If this token contains a matching pair of brackets at the start and end, use it as the final query
$finalQueryFound = false;
if (count($outputArray) === 1) {
$tokenAsArray = ... | [
"protected",
"function",
"splitUnionRemainder",
"(",
"$",
"queries",
",",
"$",
"unionType",
",",
"$",
"outputArray",
")",
"{",
"$",
"finalQuery",
"=",
"[",
"]",
";",
"//If this token contains a matching pair of brackets at the start and end, use it as the final query",
"$",... | Moves the final union query into a separate output, so the remainder (such as ORDER BY) can
be processed separately. | [
"Moves",
"the",
"final",
"union",
"query",
"into",
"a",
"separate",
"output",
"so",
"the",
"remainder",
"(",
"such",
"as",
"ORDER",
"BY",
")",
"can",
"be",
"processed",
"separately",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/UnionProcessor.php#L117-L158 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/ExplainProcessor.php | ExplainProcessor.process | public function process($tokens, $keys = array()) {
$base_expr = "";
$expr = array();
$currCategory = "";
if ($this->isStatement($keys)) {
foreach ($tokens as $token) {
$trim = trim($token);
$base_expr .= $token;
if ($trim =... | php | public function process($tokens, $keys = array()) {
$base_expr = "";
$expr = array();
$currCategory = "";
if ($this->isStatement($keys)) {
foreach ($tokens as $token) {
$trim = trim($token);
$base_expr .= $token;
if ($trim =... | [
"public",
"function",
"process",
"(",
"$",
"tokens",
",",
"$",
"keys",
"=",
"array",
"(",
")",
")",
"{",
"$",
"base_expr",
"=",
"\"\"",
";",
"$",
"expr",
"=",
"array",
"(",
")",
";",
"$",
"currCategory",
"=",
"\"\"",
";",
"if",
"(",
"$",
"this",
... | TODO: refactor that function | [
"TODO",
":",
"refactor",
"that",
"function"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/ExplainProcessor.php#L63-L148 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Classes/ClassDeclarationSniff.php | PhOSCo_Sniffs_Classes_ClassDeclarationSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
$errorData = array($tokens[$stackPtr]['content']);
if (isset($tokens[$stackPtr]['scope_opener']) === false) {
$error = 'Possible parse error: %s missing opening or closing brace'... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
$errorData = array($tokens[$stackPtr]['content']);
if (isset($tokens[$stackPtr]['scope_opener']) === false) {
$error = 'Possible parse error: %s missing opening or closing brace'... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"$",
"errorData",
"=",
"array",
"(",
"$",
"tokens",
"[",
"$",
"stackPt... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param integer $stackPtr The position of the current token in the
stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Classes/ClassDeclarationSniff.php#L58-L95 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/AbstractProcessor.php | AbstractProcessor.revokeQuotation | protected function revokeQuotation($sql) {
$tmp = trim($sql);
$result = array();
$quote = false;
$start = 0;
$i = 0;
$len = strlen($tmp);
while ($i < $len) {
$char = $tmp[$i];
switch ($char) {
case '`':
case '\'':... | php | protected function revokeQuotation($sql) {
$tmp = trim($sql);
$result = array();
$quote = false;
$start = 0;
$i = 0;
$len = strlen($tmp);
while ($i < $len) {
$char = $tmp[$i];
switch ($char) {
case '`':
case '\'':... | [
"protected",
"function",
"revokeQuotation",
"(",
"$",
"sql",
")",
"{",
"$",
"tmp",
"=",
"trim",
"(",
"$",
"sql",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"quote",
"=",
"false",
";",
"$",
"start",
"=",
"0",
";",
"$",
"i",
"=",
... | Revokes the quoting characters from an expression
Possibibilies:
`a`
'a'
"a"
`a`.`b`
`a.b`
a.`b`
`a`.b
It is also possible to have escaped quoting characters
within an expression part:
`a``b` => a`b
And you can use whitespace between the parts:
a . `b` => [a,b] | [
"Revokes",
"the",
"quoting",
"characters",
"from",
"an",
"expression",
"Possibibilies",
":",
"a",
"a",
"a",
"a",
".",
"b",
"a",
".",
"b",
"a",
".",
"b",
"a",
".",
"b",
"It",
"is",
"also",
"possible",
"to",
"have",
"escaped",
"quoting",
"characters",
... | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/AbstractProcessor.php#L103-L166 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/AbstractProcessor.php | AbstractProcessor.removeParenthesisFromStart | protected function removeParenthesisFromStart($token) {
$parenthesisRemoved = 0;
$trim = trim($token);
if ($trim !== '' && $trim[0] === '(') { // remove only one parenthesis pair now!
$parenthesisRemoved++;
$trim[0] = ' ';
$trim = trim($trim);
}
... | php | protected function removeParenthesisFromStart($token) {
$parenthesisRemoved = 0;
$trim = trim($token);
if ($trim !== '' && $trim[0] === '(') { // remove only one parenthesis pair now!
$parenthesisRemoved++;
$trim[0] = ' ';
$trim = trim($trim);
}
... | [
"protected",
"function",
"removeParenthesisFromStart",
"(",
"$",
"token",
")",
"{",
"$",
"parenthesisRemoved",
"=",
"0",
";",
"$",
"trim",
"=",
"trim",
"(",
"$",
"token",
")",
";",
"if",
"(",
"$",
"trim",
"!==",
"''",
"&&",
"$",
"trim",
"[",
"0",
"]"... | This method removes parenthesis from start of the given string.
It removes also the associated closing parenthesis. | [
"This",
"method",
"removes",
"parenthesis",
"from",
"start",
"of",
"the",
"given",
"string",
".",
"It",
"removes",
"also",
"the",
"associated",
"closing",
"parenthesis",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/AbstractProcessor.php#L172-L224 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/AbstractProcessor.php | AbstractProcessor.toArray | public function toArray($tokenList) {
$expr = array();
foreach ($tokenList as $token) {
if ($token instanceof \PHPSQLParser\utils\ExpressionToken) {
$expr[] = $token->toArray();
} else {
$expr[] = $token;
}
}
return $exp... | php | public function toArray($tokenList) {
$expr = array();
foreach ($tokenList as $token) {
if ($token instanceof \PHPSQLParser\utils\ExpressionToken) {
$expr[] = $token->toArray();
} else {
$expr[] = $token;
}
}
return $exp... | [
"public",
"function",
"toArray",
"(",
"$",
"tokenList",
")",
"{",
"$",
"expr",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"tokenList",
"as",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"token",
"instanceof",
"\\",
"PHPSQLParser",
"\\",
"utils",
"\... | translates an array of objects into an associative array | [
"translates",
"an",
"array",
"of",
"objects",
"into",
"an",
"associative",
"array"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/AbstractProcessor.php#L312-L322 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/lexer/PHPSQLLexer.php | PHPSQLLexer.balanceCharacter | protected function balanceCharacter($tokens, $idx, $char) {
$token_count = count($tokens);
$i = $idx + 1;
while ($i < $token_count) {
if (!isset($tokens[$i])) {
$i++;
continue;
}
$token = $tokens[$i];
$tokens[$idx... | php | protected function balanceCharacter($tokens, $idx, $char) {
$token_count = count($tokens);
$i = $idx + 1;
while ($i < $token_count) {
if (!isset($tokens[$i])) {
$i++;
continue;
}
$token = $tokens[$i];
$tokens[$idx... | [
"protected",
"function",
"balanceCharacter",
"(",
"$",
"tokens",
",",
"$",
"idx",
",",
"$",
"char",
")",
"{",
"$",
"token_count",
"=",
"count",
"(",
"$",
"tokens",
")",
";",
"$",
"i",
"=",
"$",
"idx",
"+",
"1",
";",
"while",
"(",
"$",
"i",
"<",
... | to re-combine some tokens | [
"to",
"re",
"-",
"combine",
"some",
"tokens"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/lexer/PHPSQLLexer.php#L309-L331 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/lexer/PHPSQLLexer.php | PHPSQLLexer.concatColReferences | protected function concatColReferences($tokens) {
$cnt = count($tokens);
$i = 0;
while ($i < $cnt) {
if (!isset($tokens[$i])) {
$i++;
continue;
}
if ($tokens[$i][0] === ".") {
// concat the previous tokens, t... | php | protected function concatColReferences($tokens) {
$cnt = count($tokens);
$i = 0;
while ($i < $cnt) {
if (!isset($tokens[$i])) {
$i++;
continue;
}
if ($tokens[$i][0] === ".") {
// concat the previous tokens, t... | [
"protected",
"function",
"concatColReferences",
"(",
"$",
"tokens",
")",
"{",
"$",
"cnt",
"=",
"count",
"(",
"$",
"tokens",
")",
";",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"$",
"i",
"<",
"$",
"cnt",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",... | This function concats some tokens to a column reference.
There are two different cases:
1. If the current token ends with a dot, we will add the next token
2. If the next token starts with a dot, we will add it to the previous token | [
"This",
"function",
"concats",
"some",
"tokens",
"to",
"a",
"column",
"reference",
".",
"There",
"are",
"two",
"different",
"cases",
":"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/lexer/PHPSQLLexer.php#L341-L388 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/SelectExpressionProcessor.php | SelectExpressionProcessor.process | public function process($expression) {
$tokens = $this->splitSQLIntoTokens($expression);
$token_count = count($tokens);
if ($token_count === 0) {
return null;
}
/*
* Determine if there is an explicit alias after the AS clause.
* If AS is found, then... | php | public function process($expression) {
$tokens = $this->splitSQLIntoTokens($expression);
$token_count = count($tokens);
if ($token_count === 0) {
return null;
}
/*
* Determine if there is an explicit alias after the AS clause.
* If AS is found, then... | [
"public",
"function",
"process",
"(",
"$",
"expression",
")",
"{",
"$",
"tokens",
"=",
"$",
"this",
"->",
"splitSQLIntoTokens",
"(",
"$",
"expression",
")",
";",
"$",
"token_count",
"=",
"count",
"(",
"$",
"tokens",
")",
";",
"if",
"(",
"$",
"token_cou... | This fuction processes each SELECT clause.
We determine what (if any) alias
is provided, and we set the type of expression. | [
"This",
"fuction",
"processes",
"each",
"SELECT",
"clause",
".",
"We",
"determine",
"what",
"(",
"if",
"any",
")",
"alias",
"is",
"provided",
"and",
"we",
"set",
"the",
"type",
"of",
"expression",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/SelectExpressionProcessor.php#L55-L162 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/HavingProcessor.php | HavingProcessor.logError | protected function logError($sql) {
Analog::log("The alias clause of a colref is empty, this should not occur.", Analog::ALERT);
Analog::log("Please create an issue on GitHub or GoogleCode with your SQL statement.", Analog::ALERT);
Analog::log(print_r($sql, true), Analog::ALERT);
} | php | protected function logError($sql) {
Analog::log("The alias clause of a colref is empty, this should not occur.", Analog::ALERT);
Analog::log("Please create an issue on GitHub or GoogleCode with your SQL statement.", Analog::ALERT);
Analog::log(print_r($sql, true), Analog::ALERT);
} | [
"protected",
"function",
"logError",
"(",
"$",
"sql",
")",
"{",
"Analog",
"::",
"log",
"(",
"\"The alias clause of a colref is empty, this should not occur.\"",
",",
"Analog",
"::",
"ALERT",
")",
";",
"Analog",
"::",
"log",
"(",
"\"Please create an issue on GitHub or Go... | helper function to find an example for issue 10 on GitHub.com | [
"helper",
"function",
"to",
"find",
"an",
"example",
"for",
"issue",
"10",
"on",
"GitHub",
".",
"com"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/HavingProcessor.php#L57-L61 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Functions/FunctionDeclarationSniff.php | PhOSCo_Sniffs_Functions_FunctionDeclarationSniff.processMultiLineDeclaration | public function processMultiLineDeclaration(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) {
// We need to work out how far indented the function
// declaration itself is, so we can work out how far to
// indent parameters.
$functionIndent = 0;
for ($i = ($stackPtr - 1); $i... | php | public function processMultiLineDeclaration(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) {
// We need to work out how far indented the function
// declaration itself is, so we can work out how far to
// indent parameters.
$functionIndent = 0;
for ($i = ($stackPtr - 1); $i... | [
"public",
"function",
"processMultiLineDeclaration",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
",",
"$",
"tokens",
")",
"{",
"// We need to work out how far indented the function",
"// declaration itself is, so we can work out how far to",
"// indent para... | Processes mutli-line declarations.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@param array $tokens The stack of tokens that make up
the file.
@return void | [
"Processes",
"mutli",
"-",
"line",
"declarations",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Functions/FunctionDeclarationSniff.php#L168-L292 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/PHPSQLParser.php | PHPSQLParser.parse | public function parse($sql, $calcPositions = false) {
$processor = new DefaultProcessor($this->options);
$queries = $processor->process($sql);
// calc the positions of some important tokens
if ($calcPositions) {
$calculator = new PositionCalculator();
$queries =... | php | public function parse($sql, $calcPositions = false) {
$processor = new DefaultProcessor($this->options);
$queries = $processor->process($sql);
// calc the positions of some important tokens
if ($calcPositions) {
$calculator = new PositionCalculator();
$queries =... | [
"public",
"function",
"parse",
"(",
"$",
"sql",
",",
"$",
"calcPositions",
"=",
"false",
")",
"{",
"$",
"processor",
"=",
"new",
"DefaultProcessor",
"(",
"$",
"this",
"->",
"options",
")",
";",
"$",
"queries",
"=",
"$",
"processor",
"->",
"process",
"(... | It parses the given SQL statement and generates a detailled
output array for every part of the statement. The method can
also generate [position] fields within the output, which hold
the character position for every statement part. The calculation
of the positions needs some time, if you don't need positions in
your ap... | [
"It",
"parses",
"the",
"given",
"SQL",
"statement",
"and",
"generates",
"a",
"detailled",
"output",
"array",
"for",
"every",
"part",
"of",
"the",
"statement",
".",
"The",
"method",
"can",
"also",
"generate",
"[",
"position",
"]",
"fields",
"within",
"the",
... | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/PHPSQLParser.php#L92-L106 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/ControlStructures/MultiLineConditionSniff.php | PhOSCo_Sniffs_ControlStructures_MultiLineConditionSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// We need to work out how far indented the if statement
// itself is, so we can work out how far to indent conditions.
$statementIndent = 0;
for ($i = ($stackPtr - 1); $... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
// We need to work out how far indented the if statement
// itself is, so we can work out how far to indent conditions.
$statementIndent = 0;
for ($i = ($stackPtr - 1); $... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"// We need to work out how far indented the if statement",
"// itself is, so we can w... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/ControlStructures/MultiLineConditionSniff.php#L63-L184 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/ClassCommentSniff.php | PhOSCo_Sniffs_Commenting_ClassCommentSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$this->currentFile = $phpcsFile;
$tokens = $phpcsFile->getTokens();
$type = strtolower($tokens[$stackPtr]['content']);
$errorData = array($type);
$find = array(T_ABSTRACT, T_WHITESPACE, T_FINAL,);
//... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$this->currentFile = $phpcsFile;
$tokens = $phpcsFile->getTokens();
$type = strtolower($tokens[$stackPtr]['content']);
$errorData = array($type);
$find = array(T_ABSTRACT, T_WHITESPACE, T_FINAL,);
//... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"this",
"->",
"currentFile",
"=",
"$",
"phpcsFile",
";",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"$",
"ty... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/ClassCommentSniff.php#L70-L182 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$this->currentFile = $phpcsFile;
// We are only interested if this is the first open tag.
if ($stackPtr !== 0) {
if ($phpcsFile->findPrevious(T_OPEN_TAG, ($stackPtr - 1)) !== false) {
return;
... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$this->currentFile = $phpcsFile;
// We are only interested if this is the first open tag.
if ($stackPtr !== 0) {
if ($phpcsFile->findPrevious(T_OPEN_TAG, ($stackPtr - 1)) !== false) {
return;
... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"this",
"->",
"currentFile",
"=",
"$",
"phpcsFile",
";",
"// We are only interested if this is the first open tag.",
"if",
"(",
"$",
"stackPtr",
"!==... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L98-L237 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processPHPVersion | protected function processPHPVersion($commentStart, $commentEnd, $commentText) {
if (strstr(strtolower($commentText), 'php version') === false) {
$error = 'PHP version not specified';
$this->currentFile->addWarning($error, $commentEnd, 'MissingVersion');
}
} | php | protected function processPHPVersion($commentStart, $commentEnd, $commentText) {
if (strstr(strtolower($commentText), 'php version') === false) {
$error = 'PHP version not specified';
$this->currentFile->addWarning($error, $commentEnd, 'MissingVersion');
}
} | [
"protected",
"function",
"processPHPVersion",
"(",
"$",
"commentStart",
",",
"$",
"commentEnd",
",",
"$",
"commentText",
")",
"{",
"if",
"(",
"strstr",
"(",
"strtolower",
"(",
"$",
"commentText",
")",
",",
"'php version'",
")",
"===",
"false",
")",
"{",
"$... | Check that the PHP version is specified.
@param int $commentStart Position in the stack where the comment started.
@param int $commentEnd Position in the stack where the comment ended.
@param string $commentText The text of the function comment.
@return void | [
"Check",
"that",
"the",
"PHP",
"version",
"is",
"specified",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L248-L254 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processTags | protected function processTags($commentStart, $commentEnd) {
$docBlock = (get_class($this) === 'PhOSCo_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class';
$foundTags = $this->commentParser->getTagOrders();
$orderIndex = 0;
$indentation = array();
$longestTag = 0;
$er... | php | protected function processTags($commentStart, $commentEnd) {
$docBlock = (get_class($this) === 'PhOSCo_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class';
$foundTags = $this->commentParser->getTagOrders();
$orderIndex = 0;
$indentation = array();
$longestTag = 0;
$er... | [
"protected",
"function",
"processTags",
"(",
"$",
"commentStart",
",",
"$",
"commentEnd",
")",
"{",
"$",
"docBlock",
"=",
"(",
"get_class",
"(",
"$",
"this",
")",
"===",
"'PhOSCo_Sniffs_Commenting_FileCommentSniff'",
")",
"?",
"'file'",
":",
"'class'",
";",
"$... | Processes each required or optional tag.
@param int $commentStart Position in the stack where the comment started.
@param int $commentEnd Position in the stack where the comment ended.
@return void | [
"Processes",
"each",
"required",
"or",
"optional",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L264-L389 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.getIndentation | protected function getIndentation($tagName, $tagElement) {
if ($tagElement instanceof PHP_CodeSniffer_CommentParser_SingleElement) {
if ($tagElement->getContent() !== '') {
return (strlen($tagName) + substr_count($tagElement->getWhitespaceBeforeContent(), ' '));
}
... | php | protected function getIndentation($tagName, $tagElement) {
if ($tagElement instanceof PHP_CodeSniffer_CommentParser_SingleElement) {
if ($tagElement->getContent() !== '') {
return (strlen($tagName) + substr_count($tagElement->getWhitespaceBeforeContent(), ' '));
}
... | [
"protected",
"function",
"getIndentation",
"(",
"$",
"tagName",
",",
"$",
"tagElement",
")",
"{",
"if",
"(",
"$",
"tagElement",
"instanceof",
"PHP_CodeSniffer_CommentParser_SingleElement",
")",
"{",
"if",
"(",
"$",
"tagElement",
"->",
"getContent",
"(",
")",
"!=... | Get the indentation information of each tag.
@param string $tagName The name of the
doc comment
element.
@param PHP_CodeSniffer_CommentParser_DocElement $tagElement The doc comment
element.
@return void | [
"Get",
"the",
"indentation",
"information",
"of",
"each",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L402-L415 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processCategory | protected function processCategory($errorPos) {
$category = $this->commentParser->getCategory();
if ($category !== null) {
$content = $category->getContent();
if ($content !== '') {
if (PHP_CodeSniffer::isUnderscoreName($content) !== true) {
$n... | php | protected function processCategory($errorPos) {
$category = $this->commentParser->getCategory();
if ($category !== null) {
$content = $category->getContent();
if ($content !== '') {
if (PHP_CodeSniffer::isUnderscoreName($content) !== true) {
$n... | [
"protected",
"function",
"processCategory",
"(",
"$",
"errorPos",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getCategory",
"(",
")",
";",
"if",
"(",
"$",
"category",
"!==",
"null",
")",
"{",
"$",
"content",
"=",
"$",
"ca... | Process the category tag.
@param int $errorPos The line number where the error occurs.
@return void | [
"Process",
"the",
"category",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L424-L449 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processPackage | protected function processPackage($errorPos) {
$package = $this->commentParser->getPackage();
if ($package === null) {
return;
}
$content = $package->getContent();
if ($content === '') {
$error = '@package tag must contain a name';
$this->curr... | php | protected function processPackage($errorPos) {
$package = $this->commentParser->getPackage();
if ($package === null) {
return;
}
$content = $package->getContent();
if ($content === '') {
$error = '@package tag must contain a name';
$this->curr... | [
"protected",
"function",
"processPackage",
"(",
"$",
"errorPos",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getPackage",
"(",
")",
";",
"if",
"(",
"$",
"package",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"content... | Process the package tag.
@param int $errorPos The line number where the error occurs.
@return void | [
"Process",
"the",
"package",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L458-L489 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processAuthors | protected function processAuthors($commentStart) {
$authors = $this->commentParser->getAuthors();
// Report missing return.
if (empty($authors) === false) {
foreach ($authors as $author) {
$errorPos = ($commentStart + $author->getLine());
$content = $a... | php | protected function processAuthors($commentStart) {
$authors = $this->commentParser->getAuthors();
// Report missing return.
if (empty($authors) === false) {
foreach ($authors as $author) {
$errorPos = ($commentStart + $author->getLine());
$content = $a... | [
"protected",
"function",
"processAuthors",
"(",
"$",
"commentStart",
")",
"{",
"$",
"authors",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getAuthors",
"(",
")",
";",
"// Report missing return.",
"if",
"(",
"empty",
"(",
"$",
"authors",
")",
"===",
"fals... | Process the author tag(s) that this header comment has.
This function is different from other _process functions
as $authors is an array of SingleElements, so we work out
the errorPos for each element separately
@param int $commentStart The position in the stack where
the comment started.
@return void | [
"Process",
"the",
"author",
"tag",
"(",
"s",
")",
"that",
"this",
"header",
"comment",
"has",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L537-L564 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processCopyrights | protected function processCopyrights($commentStart) {
$copyrights = $this->commentParser->getCopyrights();
foreach ($copyrights as $copyright) {
$errorPos = ($commentStart + $copyright->getLine());
$content = $copyright->getContent();
if ($content !== '') {
... | php | protected function processCopyrights($commentStart) {
$copyrights = $this->commentParser->getCopyrights();
foreach ($copyrights as $copyright) {
$errorPos = ($commentStart + $copyright->getLine());
$content = $copyright->getContent();
if ($content !== '') {
... | [
"protected",
"function",
"processCopyrights",
"(",
"$",
"commentStart",
")",
"{",
"$",
"copyrights",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getCopyrights",
"(",
")",
";",
"foreach",
"(",
"$",
"copyrights",
"as",
"$",
"copyright",
")",
"{",
"$",
"e... | Process the copyright tags.
@param int $commentStart The position in the stack where
the comment started.
@return void | [
"Process",
"the",
"copyright",
"tags",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L574-L604 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processLicense | protected function processLicense($errorPos) {
$license = $this->commentParser->getLicense();
if ($license !== null) {
$value = $license->getValue();
$comment = $license->getComment();
if ($value === '' || $comment === '') {
$error = '@license tag must... | php | protected function processLicense($errorPos) {
$license = $this->commentParser->getLicense();
if ($license !== null) {
$value = $license->getValue();
$comment = $license->getComment();
if ($value === '' || $comment === '') {
$error = '@license tag must... | [
"protected",
"function",
"processLicense",
"(",
"$",
"errorPos",
")",
"{",
"$",
"license",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getLicense",
"(",
")",
";",
"if",
"(",
"$",
"license",
"!==",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"license"... | Process the license tag.
@param int $errorPos The line number where the error occurs.
@return void | [
"Process",
"the",
"license",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L613-L624 |
greenlion/PHP-SQL-Parser | libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php | PhOSCo_Sniffs_Commenting_FileCommentSniff.processVersion | protected function processVersion($errorPos) {
$version = $this->commentParser->getVersion();
if ($version !== null) {
$content = $version->getContent();
$matches = array();
if (empty($content) === true) {
$error = 'Content missing for @version tag in ... | php | protected function processVersion($errorPos) {
$version = $this->commentParser->getVersion();
if ($version !== null) {
$content = $version->getContent();
$matches = array();
if (empty($content) === true) {
$error = 'Content missing for @version tag in ... | [
"protected",
"function",
"processVersion",
"(",
"$",
"errorPos",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"commentParser",
"->",
"getVersion",
"(",
")",
";",
"if",
"(",
"$",
"version",
"!==",
"null",
")",
"{",
"$",
"content",
"=",
"$",
"versio... | Process the version tag.
@param int $errorPos The line number where the error occurs.
@return void | [
"Process",
"the",
"version",
"tag",
"."
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/libs/codesniffer/PhOSCo/Sniffs/Commenting/FileCommentSniff.php#L633-L649 |
greenlion/PHP-SQL-Parser | src/PHPSQLParser/processors/IntoProcessor.php | IntoProcessor.process | public function process($tokenList) {
$unparsed = $tokenList['INTO'];
foreach ($unparsed as $k => $token) {
if ($this->isWhitespaceToken($token) || $this->isCommaToken($token)) {
unset($unparsed[$k]);
}
}
$tokenList['INTO'] = array_values($unparsed... | php | public function process($tokenList) {
$unparsed = $tokenList['INTO'];
foreach ($unparsed as $k => $token) {
if ($this->isWhitespaceToken($token) || $this->isCommaToken($token)) {
unset($unparsed[$k]);
}
}
$tokenList['INTO'] = array_values($unparsed... | [
"public",
"function",
"process",
"(",
"$",
"tokenList",
")",
"{",
"$",
"unparsed",
"=",
"$",
"tokenList",
"[",
"'INTO'",
"]",
";",
"foreach",
"(",
"$",
"unparsed",
"as",
"$",
"k",
"=>",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isWhite... | TODO: This is a dummy function, we cannot parse INTO as part of SELECT
at the moment | [
"TODO",
":",
"This",
"is",
"a",
"dummy",
"function",
"we",
"cannot",
"parse",
"INTO",
"as",
"part",
"of",
"SELECT",
"at",
"the",
"moment"
] | train | https://github.com/greenlion/PHP-SQL-Parser/blob/249e8342c9b29e7444090bc66da5e870a0b28b8c/src/PHPSQLParser/processors/IntoProcessor.php#L48-L57 |
shopware/platform | src/Core/Profiling/Twig/DoctrineExtension.php | DoctrineExtension.escapeFunction | public static function escapeFunction($parameter): string
{
$result = $parameter;
switch (true) {
// Check if result is non-unicode string using PCRE_UTF8 modifier
case is_string($result) && !preg_match('//u', $result):
$result = '0x' . strtoupper(bin2hex($re... | php | public static function escapeFunction($parameter): string
{
$result = $parameter;
switch (true) {
// Check if result is non-unicode string using PCRE_UTF8 modifier
case is_string($result) && !preg_match('//u', $result):
$result = '0x' . strtoupper(bin2hex($re... | [
"public",
"static",
"function",
"escapeFunction",
"(",
"$",
"parameter",
")",
":",
"string",
"{",
"$",
"result",
"=",
"$",
"parameter",
";",
"switch",
"(",
"true",
")",
"{",
"// Check if result is non-unicode string using PCRE_UTF8 modifier",
"case",
"is_string",
"(... | Escape parameters of a SQL query
DON'T USE THIS FUNCTION OUTSIDE ITS INTENDED SCOPE
@internal | [
"Escape",
"parameters",
"of",
"a",
"SQL",
"query",
"DON",
"T",
"USE",
"THIS",
"FUNCTION",
"OUTSIDE",
"ITS",
"INTENDED",
"SCOPE"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Profiling/Twig/DoctrineExtension.php#L85-L121 |
shopware/platform | src/Core/Profiling/Twig/DoctrineExtension.php | DoctrineExtension.replaceQueryParameters | public function replaceQueryParameters(string $query, $parameters): string
{
$values = $parameters;
if ($parameters instanceof Data) {
$values = $parameters->getValue(true);
}
$i = 0;
if (!array_key_exists(0, $values) && array_key_exists(1, $values)) {
... | php | public function replaceQueryParameters(string $query, $parameters): string
{
$values = $parameters;
if ($parameters instanceof Data) {
$values = $parameters->getValue(true);
}
$i = 0;
if (!array_key_exists(0, $values) && array_key_exists(1, $values)) {
... | [
"public",
"function",
"replaceQueryParameters",
"(",
"string",
"$",
"query",
",",
"$",
"parameters",
")",
":",
"string",
"{",
"$",
"values",
"=",
"$",
"parameters",
";",
"if",
"(",
"$",
"parameters",
"instanceof",
"Data",
")",
"{",
"$",
"values",
"=",
"$... | Return a query with the parameters replaced
@param array|Data $parameters | [
"Return",
"a",
"query",
"with",
"the",
"parameters",
"replaced"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Profiling/Twig/DoctrineExtension.php#L128-L158 |
shopware/platform | src/Core/System/StateMachine/Util/StateMachineGraphvizDumper.php | StateMachineGraphvizDumper.dump | public function dump(StateMachineEntity $stateMachine, array $options = []): string
{
$places = $this->findStates($stateMachine);
$edges = $this->findEdges($stateMachine);
$options = array_replace_recursive(self::$defaultOptions, $options);
return $this->startDot($options)
... | php | public function dump(StateMachineEntity $stateMachine, array $options = []): string
{
$places = $this->findStates($stateMachine);
$edges = $this->findEdges($stateMachine);
$options = array_replace_recursive(self::$defaultOptions, $options);
return $this->startDot($options)
... | [
"public",
"function",
"dump",
"(",
"StateMachineEntity",
"$",
"stateMachine",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"places",
"=",
"$",
"this",
"->",
"findStates",
"(",
"$",
"stateMachine",
")",
";",
"$",
"edges",
"... | Dumps the workflow as a graphviz graph.
Available options:
* graph: The default options for the whole graph
* node: The default options for nodes (places)
* edge: The default options for edges | [
"Dumps",
"the",
"workflow",
"as",
"a",
"graphviz",
"graph",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/System/StateMachine/Util/StateMachineGraphvizDumper.php#L26-L37 |
shopware/platform | src/Core/Checkout/Order/Api/OrderTransactionActionController.php | OrderTransactionActionController.getAvailableTransitions | public function getAvailableTransitions(Request $request, Context $context, string $transactionId): Response
{
$transaction = $this->getOrderTransaction($transactionId, $context);
$baseUrl = $this->generateUrl('api.order_transaction.transition_state', [
'transactionId' => $transaction->... | php | public function getAvailableTransitions(Request $request, Context $context, string $transactionId): Response
{
$transaction = $this->getOrderTransaction($transactionId, $context);
$baseUrl = $this->generateUrl('api.order_transaction.transition_state', [
'transactionId' => $transaction->... | [
"public",
"function",
"getAvailableTransitions",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"string",
"$",
"transactionId",
")",
":",
"Response",
"{",
"$",
"transaction",
"=",
"$",
"this",
"->",
"getOrderTransaction",
"(",
"$",
"trans... | @Route("/api/v{version}/_action/order-transaction/{transactionId}/state", name="api.order_transaction.get_state", methods={"GET"})
@throws InconsistentCriteriaIdsException
@throws ResourceNotFoundException
@throws StateMachineNotFoundException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"-",
"transaction",
"/",
"{",
"transactionId",
"}",
"/",
"state",
"name",
"=",
"api",
".",
"order_transaction",
".",
"get_state",
"methods",
"=",
"{",
"GET",
"}",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderTransactionActionController.php#L48-L61 |
shopware/platform | src/Core/Checkout/Order/Api/OrderTransactionActionController.php | OrderTransactionActionController.transitionOrderState | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $transactionId,
?string $transition = null
): Response {
$transaction = $this->getOrderTransaction($transactionId, $context);
$toPlace ... | php | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $transactionId,
?string $transition = null
): Response {
$transaction = $this->getOrderTransaction($transactionId, $context);
$toPlace ... | [
"public",
"function",
"transitionOrderState",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"ResponseFactoryInterface",
"$",
"responseFactory",
",",
"string",
"$",
"transactionId",
",",
"?",
"string",
"$",
"transition",
"=",
"null",
")",
"... | @Route("/api/v{version}/_action/order-transaction/{transactionId}/state/{transition?}", name="api.order_transaction.transition_state", methods={"POST"})
@throws InconsistentCriteriaIdsException
@throws ResourceNotFoundException
@throws IllegalTransitionException
@throws StateMachineNotFoundException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"-",
"transaction",
"/",
"{",
"transactionId",
"}",
"/",
"state",
"/",
"{",
"transition?",
"}",
"name",
"=",
"api",
".",
"order_transaction",
".",
"transition_state",... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderTransactionActionController.php#L71-L96 |
shopware/platform | src/Core/Framework/Struct/Serializer/StructNormalizer.php | StructNormalizer.normalize | public function normalize($data, $format = null, array $context = [])
{
$encoder = new JsonEncode();
return (new JsonDecode([JsonDecode::ASSOCIATIVE => true]))->decode($encoder->encode($data, 'json'), 'json');
} | php | public function normalize($data, $format = null, array $context = [])
{
$encoder = new JsonEncode();
return (new JsonDecode([JsonDecode::ASSOCIATIVE => true]))->decode($encoder->encode($data, 'json'), 'json');
} | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"encoder",
"=",
"new",
"JsonEncode",
"(",
")",
";",
"return",
"(",
"new",
"JsonDecode",
"(",
"[",
"Jso... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Struct/Serializer/StructNormalizer.php#L24-L29 |
shopware/platform | src/Core/Framework/Struct/Serializer/StructNormalizer.php | StructNormalizer.supportsDenormalization | public function supportsDenormalization($data, $type, $format = null): bool
{
return \is_array($data) && array_key_exists('_class', $data);
} | php | public function supportsDenormalization($data, $type, $format = null): bool
{
return \is_array($data) && array_key_exists('_class', $data);
} | [
"public",
"function",
"supportsDenormalization",
"(",
"$",
"data",
",",
"$",
"type",
",",
"$",
"format",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"\\",
"is_array",
"(",
"$",
"data",
")",
"&&",
"array_key_exists",
"(",
"'_class'",
",",
"$",
"data",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Struct/Serializer/StructNormalizer.php#L71-L74 |
shopware/platform | src/Core/Checkout/Cart/Price/PercentagePriceCalculator.php | PercentagePriceCalculator.calculate | public function calculate(float $percentage, PriceCollection $prices, SalesChannelContext $context): CalculatedPrice
{
$price = $prices->sum();
$discount = $this->rounding->round(
$price->getTotalPrice() / 100 * $percentage,
$context->getContext()->getCurrencyPrecision()
... | php | public function calculate(float $percentage, PriceCollection $prices, SalesChannelContext $context): CalculatedPrice
{
$price = $prices->sum();
$discount = $this->rounding->round(
$price->getTotalPrice() / 100 * $percentage,
$context->getContext()->getCurrencyPrecision()
... | [
"public",
"function",
"calculate",
"(",
"float",
"$",
"percentage",
",",
"PriceCollection",
"$",
"prices",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"CalculatedPrice",
"{",
"$",
"price",
"=",
"$",
"prices",
"->",
"sum",
"(",
")",
";",
"$",
"dis... | Provide a negative percentage value for discount or a positive percentage value for a surcharge
@param float $percentage 10.00 for 10%, -10.0 for -10% | [
"Provide",
"a",
"negative",
"percentage",
"value",
"for",
"discount",
"or",
"a",
"positive",
"percentage",
"value",
"for",
"a",
"surcharge"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Cart/Price/PercentagePriceCalculator.php#L43-L57 |
shopware/platform | src/Core/Framework/Filesystem/FilesystemFactory.php | FilesystemFactory.checkDuplicates | private function checkDuplicates(iterable $adapterFactories): void
{
$dupes = [];
foreach ($adapterFactories as $adapter) {
$type = strtolower($adapter->getType());
if (array_key_exists($type, $dupes)) {
throw new DuplicateFilesystemFactoryException($type);
... | php | private function checkDuplicates(iterable $adapterFactories): void
{
$dupes = [];
foreach ($adapterFactories as $adapter) {
$type = strtolower($adapter->getType());
if (array_key_exists($type, $dupes)) {
throw new DuplicateFilesystemFactoryException($type);
... | [
"private",
"function",
"checkDuplicates",
"(",
"iterable",
"$",
"adapterFactories",
")",
":",
"void",
"{",
"$",
"dupes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"adapterFactories",
"as",
"$",
"adapter",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$"... | @param AdapterFactoryInterface[]|iterable $adapterFactories
@throws DuplicateFilesystemFactoryException | [
"@param",
"AdapterFactoryInterface",
"[]",
"|iterable",
"$adapterFactories"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Filesystem/FilesystemFactory.php#L61-L72 |
shopware/platform | src/Core/Checkout/Cart/Delivery/Struct/DeliveryCollection.php | DeliveryCollection.sortDeliveries | public function sortDeliveries(): self
{
$this->sort(function (Delivery $a, Delivery $b) {
if ($a->getLocation() !== $b->getLocation()) {
return -1;
}
return $a->getDeliveryDate()->getEarliest() > $b->getDeliveryDate()->getEarliest();
});
... | php | public function sortDeliveries(): self
{
$this->sort(function (Delivery $a, Delivery $b) {
if ($a->getLocation() !== $b->getLocation()) {
return -1;
}
return $a->getDeliveryDate()->getEarliest() > $b->getDeliveryDate()->getEarliest();
});
... | [
"public",
"function",
"sortDeliveries",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"sort",
"(",
"function",
"(",
"Delivery",
"$",
"a",
",",
"Delivery",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getLocation",
"(",
")",
"!==",
"$",
"b",
"... | Sorts the delivery collection by earliest delivery date | [
"Sorts",
"the",
"delivery",
"collection",
"by",
"earliest",
"delivery",
"date"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Cart/Delivery/Struct/DeliveryCollection.php#L24-L35 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Write/WriteCommandExtractor.php | WriteCommandExtractor.getFieldsForPrimaryKeyMapping | private function getFieldsForPrimaryKeyMapping(array $fields): array
{
$primaryKeys = array_filter($fields, function (Field $field) {
return $field->is(PrimaryKey::class);
});
$references = array_filter($fields, function (Field $field) {
return $field instanceof Many... | php | private function getFieldsForPrimaryKeyMapping(array $fields): array
{
$primaryKeys = array_filter($fields, function (Field $field) {
return $field->is(PrimaryKey::class);
});
$references = array_filter($fields, function (Field $field) {
return $field instanceof Many... | [
"private",
"function",
"getFieldsForPrimaryKeyMapping",
"(",
"array",
"$",
"fields",
")",
":",
"array",
"{",
"$",
"primaryKeys",
"=",
"array_filter",
"(",
"$",
"fields",
",",
"function",
"(",
"Field",
"$",
"field",
")",
"{",
"return",
"$",
"field",
"->",
"... | Returns all fields which are relevant to extract and map the primary key data of an entity definition data array.
In case a primary key consist of Foreign Key fields, the corresponding association for these foreign keys must be
returned in order to guarantee the creation of these sub entities and to extract the corresp... | [
"Returns",
"all",
"fields",
"which",
"are",
"relevant",
"to",
"extract",
"and",
"map",
"the",
"primary",
"key",
"data",
"of",
"an",
"entity",
"definition",
"data",
"array",
".",
"In",
"case",
"a",
"primary",
"key",
"consist",
"of",
"Foreign",
"Key",
"field... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Write/WriteCommandExtractor.php#L257-L283 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Write/WriteCommandExtractor.php | WriteCommandExtractor.getMainFields | private function getMainFields(array $fields): array
{
$main = [];
foreach ($fields as $field) {
if ($field instanceof ChildrenAssociationField) {
continue;
}
if ($field->is(Deferred::class)) {
continue;
}
... | php | private function getMainFields(array $fields): array
{
$main = [];
foreach ($fields as $field) {
if ($field instanceof ChildrenAssociationField) {
continue;
}
if ($field->is(Deferred::class)) {
continue;
}
... | [
"private",
"function",
"getMainFields",
"(",
"array",
"$",
"fields",
")",
":",
"array",
"{",
"$",
"main",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceof",
"ChildrenAssociationField",
... | @param Field[] $fields
@return Field[] | [
"@param",
"Field",
"[]",
"$fields"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Write/WriteCommandExtractor.php#L304-L327 |
shopware/platform | src/Core/Content/Media/DataAbstractionLayer/MediaRepositoryDecorator.php | MediaRepositoryDecorator.aggregate | public function aggregate(Criteria $criteria, Context $context): AggregatorResult
{
return $this->innerRepo->aggregate($criteria, $context);
} | php | public function aggregate(Criteria $criteria, Context $context): AggregatorResult
{
return $this->innerRepo->aggregate($criteria, $context);
} | [
"public",
"function",
"aggregate",
"(",
"Criteria",
"$",
"criteria",
",",
"Context",
"$",
"context",
")",
":",
"AggregatorResult",
"{",
"return",
"$",
"this",
"->",
"innerRepo",
"->",
"aggregate",
"(",
"$",
"criteria",
",",
"$",
"context",
")",
";",
"}"
] | Unchanged methods | [
"Unchanged",
"methods"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Media/DataAbstractionLayer/MediaRepositoryDecorator.php#L94-L97 |
shopware/platform | src/Core/Framework/Framework.php | Framework.build | public function build(ContainerBuilder $container): void
{
$container->setParameter('locale', 'en-GB');
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection/'));
$loader->load('services.xml');
$loader->load('api.xml');
$loader->load('custom... | php | public function build(ContainerBuilder $container): void
{
$container->setParameter('locale', 'en-GB');
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection/'));
$loader->load('services.xml');
$loader->load('api.xml');
$loader->load('custom... | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"$",
"container",
"->",
"setParameter",
"(",
"'locale'",
",",
"'en-GB'",
")",
";",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Framework.php#L36-L61 |
shopware/platform | src/Core/System/StateMachine/Command/WorkflowDumpCommand.php | WorkflowDumpCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$workflowName = $input->getArgument('name');
$context = Context::createDefaultContext();
$stateMachine = $this->stateMachineRegistry->getStateMachine($workflowName, $context);
$dumper = new StateMachineGrap... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$workflowName = $input->getArgument('name');
$context = Context::createDefaultContext();
$stateMachine = $this->stateMachineRegistry->getStateMachine($workflowName, $context);
$dumper = new StateMachineGrap... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"workflowName",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'name'",
")",
";",
"$",
"context",
"=",
"Context",
"::",
"createDefau... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/System/StateMachine/Command/WorkflowDumpCommand.php#L51-L67 |
shopware/platform | src/Core/Checkout/Promotion/PromotionGateway.php | PromotionGateway.getAutomaticPromotions | public function getAutomaticPromotions(SalesChannelContext $context): EntityCollection
{
// add conditional OR filter to either get an entry that matches any existing rule,
// or promotions that don't have ANY rules and thus are used globally
$criteria = new Criteria([]);
$criteria->... | php | public function getAutomaticPromotions(SalesChannelContext $context): EntityCollection
{
// add conditional OR filter to either get an entry that matches any existing rule,
// or promotions that don't have ANY rules and thus are used globally
$criteria = new Criteria([]);
$criteria->... | [
"public",
"function",
"getAutomaticPromotions",
"(",
"SalesChannelContext",
"$",
"context",
")",
":",
"EntityCollection",
"{",
"// add conditional OR filter to either get an entry that matches any existing rule,",
"// or promotions that don't have ANY rules and thus are used globally",
"$"... | Gets a list of all available active promotions that do not
require a code within the current checkout context.
@throws InconsistentCriteriaIdsException
@throws \Exception | [
"Gets",
"a",
"list",
"of",
"all",
"available",
"active",
"promotions",
"that",
"do",
"not",
"require",
"a",
"code",
"within",
"the",
"current",
"checkout",
"context",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/PromotionGateway.php#L35-L60 |
shopware/platform | src/Core/Checkout/Promotion/PromotionGateway.php | PromotionGateway.getDateRangeFilter | private function getDateRangeFilter(): Filter
{
$today = new \DateTime();
$today = $today->setTimezone(new \DateTimeZone('UTC'));
$todayStart = $today->format('Y-m-d H:i:s 0:0:0');
$todayEnd = $today->format('Y-m-d H:i:s 23:59:59');
$filterNoDateRange = new MultiFilter(
... | php | private function getDateRangeFilter(): Filter
{
$today = new \DateTime();
$today = $today->setTimezone(new \DateTimeZone('UTC'));
$todayStart = $today->format('Y-m-d H:i:s 0:0:0');
$todayEnd = $today->format('Y-m-d H:i:s 23:59:59');
$filterNoDateRange = new MultiFilter(
... | [
"private",
"function",
"getDateRangeFilter",
"(",
")",
":",
"Filter",
"{",
"$",
"today",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"today",
"=",
"$",
"today",
"->",
"setTimezone",
"(",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
")",
";",
... | This is the basic filter that can be added
to get only promotions valid for the current time period. | [
"This",
"is",
"the",
"basic",
"filter",
"that",
"can",
"be",
"added",
"to",
"get",
"only",
"promotions",
"valid",
"for",
"the",
"current",
"time",
"period",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/PromotionGateway.php#L101-L152 |
shopware/platform | src/Core/Checkout/Order/Api/OrderActionController.php | OrderActionController.getAvailableTransitions | public function getAvailableTransitions(Request $request, Context $context, string $orderId): Response
{
$order = $this->getOrder($orderId, $context);
$baseUrl = $this->generateUrl('api.action.order.transition_state', [
'orderId' => $order->getId(),
'version' => $request->ge... | php | public function getAvailableTransitions(Request $request, Context $context, string $orderId): Response
{
$order = $this->getOrder($orderId, $context);
$baseUrl = $this->generateUrl('api.action.order.transition_state', [
'orderId' => $order->getId(),
'version' => $request->ge... | [
"public",
"function",
"getAvailableTransitions",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"string",
"$",
"orderId",
")",
":",
"Response",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrder",
"(",
"$",
"orderId",
",",
"$",
"c... | @Route("/api/v{version}/_action/order/{orderId}/state", name="api.action.order.get-state", methods={"GET"})
@throws ResourceNotFoundException
@throws InconsistentCriteriaIdsException
@throws StateMachineNotFoundException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"/",
"{",
"orderId",
"}",
"/",
"state",
"name",
"=",
"api",
".",
"action",
".",
"order",
".",
"get",
"-",
"state",
"methods",
"=",
"{",
"GET",
"}",
")"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderActionController.php#L48-L63 |
shopware/platform | src/Core/Checkout/Order/Api/OrderActionController.php | OrderActionController.transitionOrderState | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $orderId,
?string $transition = null
): Response {
$order = $this->getOrder($orderId, $context);
$toPlace = $this->stateMachineRegistry... | php | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $orderId,
?string $transition = null
): Response {
$order = $this->getOrder($orderId, $context);
$toPlace = $this->stateMachineRegistry... | [
"public",
"function",
"transitionOrderState",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"ResponseFactoryInterface",
"$",
"responseFactory",
",",
"string",
"$",
"orderId",
",",
"?",
"string",
"$",
"transition",
"=",
"null",
")",
":",
... | @Route("/api/v{version}/_action/order/{orderId}/state/{transition?}", name="api.action.order.transition_state", methods={"POST"})
@throws InconsistentCriteriaIdsException
@throws ResourceNotFoundException
@throws StateMachineNotFoundException
@throws IllegalTransitionException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"/",
"{",
"orderId",
"}",
"/",
"state",
"/",
"{",
"transition?",
"}",
"name",
"=",
"api",
".",
"action",
".",
"order",
".",
"transition_state",
"methods",
"=",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderActionController.php#L73-L98 |
shopware/platform | src/Storefront/PageController/CheckoutPageController.php | CheckoutPageController.finish | public function finish(Request $request, SalesChannelContext $context): Response
{
if (!$context->getCustomer()) {
return $this->redirectToRoute('frontend.checkout.register.page');
}
$page = $this->finishPageLoader->load($request, $context);
return $this->renderStorefro... | php | public function finish(Request $request, SalesChannelContext $context): Response
{
if (!$context->getCustomer()) {
return $this->redirectToRoute('frontend.checkout.register.page');
}
$page = $this->finishPageLoader->load($request, $context);
return $this->renderStorefro... | [
"public",
"function",
"finish",
"(",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"if",
"(",
"!",
"$",
"context",
"->",
"getCustomer",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirectToRoute",
... | @Route("/checkout/finish", name="frontend.checkout.finish.page", options={"seo"="false"}, methods={"GET"})
@throws CustomerNotLoggedInException
@throws MissingRequestParameterException
@throws OrderNotFoundException | [
"@Route",
"(",
"/",
"checkout",
"/",
"finish",
"name",
"=",
"frontend",
".",
"checkout",
".",
"finish",
".",
"page",
"options",
"=",
"{",
"seo",
"=",
"false",
"}",
"methods",
"=",
"{",
"GET",
"}",
")"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/CheckoutPageController.php#L190-L199 |
shopware/platform | src/Storefront/PageController/CheckoutPageController.php | CheckoutPageController.addLineItems | public function addLineItems(RequestDataBag $requestDataBag, Request $request, SalesChannelContext $context): Response
{
/** @var RequestDataBag|null $lineItems */
$lineItems = $requestDataBag->get('lineItems');
if (!$lineItems) {
throw new MissingRequestParameterException('lineI... | php | public function addLineItems(RequestDataBag $requestDataBag, Request $request, SalesChannelContext $context): Response
{
/** @var RequestDataBag|null $lineItems */
$lineItems = $requestDataBag->get('lineItems');
if (!$lineItems) {
throw new MissingRequestParameterException('lineI... | [
"public",
"function",
"addLineItems",
"(",
"RequestDataBag",
"$",
"requestDataBag",
",",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"/** @var RequestDataBag|null $lineItems */",
"$",
"lineItems",
"=",
"$",
"reques... | @Route("/checkout/line-item/add", name="frontend.checkout.line-item.add", methods={"POST"}, defaults={"XmlHttpRequest"=true})
requires the provided items in the following form
'lineItems' => [
'anyKey' => [
'id' => 'someKey'
'quantity' => 2,
'type' => 'someType'
],
'randomKey' => [
'id' => 'otherKey'
'quantity' => 2,
... | [
"@Route",
"(",
"/",
"checkout",
"/",
"line",
"-",
"item",
"/",
"add",
"name",
"=",
"frontend",
".",
"checkout",
".",
"line",
"-",
"item",
".",
"add",
"methods",
"=",
"{",
"POST",
"}",
"defaults",
"=",
"{",
"XmlHttpRequest",
"=",
"true",
"}",
")"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/CheckoutPageController.php#L450-L484 |
shopware/platform | src/Core/Checkout/Order/Api/OrderDeliveryActionController.php | OrderDeliveryActionController.getAvailableTransitions | public function getAvailableTransitions(Request $request, Context $context, string $deliveryId): Response
{
$delivery = $this->getOrderDelivery($deliveryId, $context);
$baseUrl = $this->generateUrl('api.action.order_delivery.transition_state', [
'deliveryId' => $delivery->getId(),
... | php | public function getAvailableTransitions(Request $request, Context $context, string $deliveryId): Response
{
$delivery = $this->getOrderDelivery($deliveryId, $context);
$baseUrl = $this->generateUrl('api.action.order_delivery.transition_state', [
'deliveryId' => $delivery->getId(),
... | [
"public",
"function",
"getAvailableTransitions",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"string",
"$",
"deliveryId",
")",
":",
"Response",
"{",
"$",
"delivery",
"=",
"$",
"this",
"->",
"getOrderDelivery",
"(",
"$",
"deliveryId",
... | @Route("/api/v{version}/_action/order-delivery/{deliveryId}/state", name="api.action.order_delivery.state", methods={"GET"})
@throws StateMachineNotFoundException
@throws ResourceNotFoundException
@throws InconsistentCriteriaIdsException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"-",
"delivery",
"/",
"{",
"deliveryId",
"}",
"/",
"state",
"name",
"=",
"api",
".",
"action",
".",
"order_delivery",
".",
"state",
"methods",
"=",
"{",
"GET",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderDeliveryActionController.php#L49-L62 |
shopware/platform | src/Core/Checkout/Order/Api/OrderDeliveryActionController.php | OrderDeliveryActionController.transitionOrderState | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $deliveryId,
?string $transition = null
): Response {
$delivery = $this->getOrderDelivery($deliveryId, $context);
$toPlace = $this->sta... | php | public function transitionOrderState(
Request $request,
Context $context,
ResponseFactoryInterface $responseFactory,
string $deliveryId,
?string $transition = null
): Response {
$delivery = $this->getOrderDelivery($deliveryId, $context);
$toPlace = $this->sta... | [
"public",
"function",
"transitionOrderState",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"ResponseFactoryInterface",
"$",
"responseFactory",
",",
"string",
"$",
"deliveryId",
",",
"?",
"string",
"$",
"transition",
"=",
"null",
")",
":",... | @Route("/api/v{version}/_action/order-delivery/{deliveryId}/state/{transition?}", name="api.action.order_delivery.transition_state", methods={"POST"})
@throws StateMachineNotFoundException
@throws IllegalTransitionException
@throws ResourceNotFoundException
@throws InconsistentCriteriaIdsException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"order",
"-",
"delivery",
"/",
"{",
"deliveryId",
"}",
"/",
"state",
"/",
"{",
"transition?",
"}",
"name",
"=",
"api",
".",
"action",
".",
"order_delivery",
".",
"transiti... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Order/Api/OrderDeliveryActionController.php#L72-L98 |
shopware/platform | src/Core/Framework/Api/Controller/SalesChannelProxyController.php | SalesChannelProxyController.proxy | public function proxy(string $_path, string $salesChannelId, Request $request, Context $context): Response
{
/** @var SalesChannelEntity|null $salesChannel */
$salesChannel = $this->salesChannelRepository->search(new Criteria([$salesChannelId]), $context)->get($salesChannelId);
if (!$salesC... | php | public function proxy(string $_path, string $salesChannelId, Request $request, Context $context): Response
{
/** @var SalesChannelEntity|null $salesChannel */
$salesChannel = $this->salesChannelRepository->search(new Criteria([$salesChannelId]), $context)->get($salesChannelId);
if (!$salesC... | [
"public",
"function",
"proxy",
"(",
"string",
"$",
"_path",
",",
"string",
"$",
"salesChannelId",
",",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
")",
":",
"Response",
"{",
"/** @var SalesChannelEntity|null $salesChannel */",
"$",
"salesChannel",
"... | @Route("/api/v{version}/_proxy/sales-channel-api/{salesChannelId}/{_path}", name="api.proxy.sales-channel", requirements={"_path" = ".*"})
@throws InvalidSalesChannelIdException
@throws InconsistentCriteriaIdsException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_proxy",
"/",
"sales",
"-",
"channel",
"-",
"api",
"/",
"{",
"salesChannelId",
"}",
"/",
"{",
"_path",
"}",
"name",
"=",
"api",
".",
"proxy",
".",
"sales",
"-",
"channel",
"requirement... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/SalesChannelProxyController.php#L54-L82 |
shopware/platform | src/Core/Kernel.php | Kernel.getKernelParameters | protected function getKernelParameters(): array
{
$parameters = parent::getKernelParameters();
$activePluginMeta = [];
foreach (self::getPlugins()->getActives() as $namespace => $plugin) {
$pluginName = $plugin->getName();
$activePluginMeta[$pluginName] = [
... | php | protected function getKernelParameters(): array
{
$parameters = parent::getKernelParameters();
$activePluginMeta = [];
foreach (self::getPlugins()->getActives() as $namespace => $plugin) {
$pluginName = $plugin->getName();
$activePluginMeta[$pluginName] = [
... | [
"protected",
"function",
"getKernelParameters",
"(",
")",
":",
"array",
"{",
"$",
"parameters",
"=",
"parent",
"::",
"getKernelParameters",
"(",
")",
";",
"$",
"activePluginMeta",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"getPlugins",
"(",
")",
"-... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Kernel.php#L197-L218 |
shopware/platform | src/Storefront/PageletController/CheckoutPageletController.php | CheckoutPageletController.infoAction | public function infoAction(Request $request, SalesChannelContext $context): Response
{
$page = $this->infoLoader->load($request, $context);
return $this->renderStorefront('@Storefront/layout/header/actions/cart-widget.html.twig', ['page' => $page]);
} | php | public function infoAction(Request $request, SalesChannelContext $context): Response
{
$page = $this->infoLoader->load($request, $context);
return $this->renderStorefront('@Storefront/layout/header/actions/cart-widget.html.twig', ['page' => $page]);
} | [
"public",
"function",
"infoAction",
"(",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"infoLoader",
"->",
"load",
"(",
"$",
"request",
",",
"$",
"context",
")",
";"... | @Route("/widgets/checkout/info", name="widgets.checkout.info", methods={"GET"}, defaults={"XmlHttpRequest"=true})
@throws CartTokenNotFoundException | [
"@Route",
"(",
"/",
"widgets",
"/",
"checkout",
"/",
"info",
"name",
"=",
"widgets",
".",
"checkout",
".",
"info",
"methods",
"=",
"{",
"GET",
"}",
"defaults",
"=",
"{",
"XmlHttpRequest",
"=",
"true",
"}",
")"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageletController/CheckoutPageletController.php#L38-L43 |
shopware/platform | src/Storefront/PageletController/CheckoutPageletController.php | CheckoutPageletController.ajaxCart | public function ajaxCart(Request $request, SalesChannelContext $context): Response
{
$page = $this->ajaxCartLoader->load($request, $context);
return $this->renderStorefront('@Storefront/layout/header/offcanvas-cart.html.twig', ['page' => $page]);
} | php | public function ajaxCart(Request $request, SalesChannelContext $context): Response
{
$page = $this->ajaxCartLoader->load($request, $context);
return $this->renderStorefront('@Storefront/layout/header/offcanvas-cart.html.twig', ['page' => $page]);
} | [
"public",
"function",
"ajaxCart",
"(",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"ajaxCartLoader",
"->",
"load",
"(",
"$",
"request",
",",
"$",
"context",
")",
"... | @Route("/checkout/ajax-cart", name="frontend.cart.detail", options={"seo"="false"}, methods={"GET"}, defaults={"XmlHttpRequest"=true})
@throws CartTokenNotFoundException | [
"@Route",
"(",
"/",
"checkout",
"/",
"ajax",
"-",
"cart",
"name",
"=",
"frontend",
".",
"cart",
".",
"detail",
"options",
"=",
"{",
"seo",
"=",
"false",
"}",
"methods",
"=",
"{",
"GET",
"}",
"defaults",
"=",
"{",
"XmlHttpRequest",
"=",
"true",
"}",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageletController/CheckoutPageletController.php#L50-L55 |
shopware/platform | src/Core/Framework/Snippet/SnippetService.php | SnippetService.getList | public function getList(int $page, int $limit, Context $context, array $requestFilters, array $sort): array
{
--$page;
$metaData = $this->getSetMetaData($context);
$isoList = $this->createIsoList($metaData);
$languageFiles = $this->getSnippetFilesByIso($isoList);
$fileSnipp... | php | public function getList(int $page, int $limit, Context $context, array $requestFilters, array $sort): array
{
--$page;
$metaData = $this->getSetMetaData($context);
$isoList = $this->createIsoList($metaData);
$languageFiles = $this->getSnippetFilesByIso($isoList);
$fileSnipp... | [
"public",
"function",
"getList",
"(",
"int",
"$",
"page",
",",
"int",
"$",
"limit",
",",
"Context",
"$",
"context",
",",
"array",
"$",
"requestFilters",
",",
"array",
"$",
"sort",
")",
":",
"array",
"{",
"--",
"$",
"page",
";",
"$",
"metaData",
"=",
... | filters: [
'isCustom' => bool,
'isEmpty' => bool,
'term' => string,
'namespaces' => array,
'authors' => array,
'translationKeys' => array,
]
sort: [
'column' => NULL || the string -> 'translationKey' || setId
'direction' => 'ASC' || 'DESC'
] | [
"filters",
":",
"[",
"isCustom",
"=",
">",
"bool",
"isEmpty",
"=",
">",
"bool",
"term",
"=",
">",
"string",
"namespaces",
"=",
">",
"array",
"authors",
"=",
">",
"array",
"translationKeys",
"=",
">",
"array",
"]"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Snippet/SnippetService.php#L74-L104 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.getField | public function getField(string $fieldName, EntityDefinition $definition, string $root): ?Field
{
$original = $fieldName;
$prefix = $root . '.';
if (strpos($fieldName, $prefix) === 0) {
$fieldName = substr($fieldName, \strlen($prefix));
}
$fields = $definition->... | php | public function getField(string $fieldName, EntityDefinition $definition, string $root): ?Field
{
$original = $fieldName;
$prefix = $root . '.';
if (strpos($fieldName, $prefix) === 0) {
$fieldName = substr($fieldName, \strlen($prefix));
}
$fields = $definition->... | [
"public",
"function",
"getField",
"(",
"string",
"$",
"fieldName",
",",
"EntityDefinition",
"$",
"definition",
",",
"string",
"$",
"root",
")",
":",
"?",
"Field",
"{",
"$",
"original",
"=",
"$",
"fieldName",
";",
"$",
"prefix",
"=",
"$",
"root",
".",
"... | Returns the field instance of the provided fieldName.
@example
fieldName => 'product.name'
Returns the (new TranslatedField('name')) declaration
Allows additionally nested referencing
fieldName => 'category.products.name'
Returns as well the above field definition | [
"Returns",
"the",
"field",
"instance",
"of",
"the",
"provided",
"fieldName",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L90-L129 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.getFieldAccessor | public function getFieldAccessor(string $fieldName, EntityDefinition $definition, string $root, Context $context): string
{
$fieldName = str_replace('extensions.', '', $fieldName);
$original = $fieldName;
$prefix = $root . '.';
if (strpos($fieldName, $prefix) === 0) {
$... | php | public function getFieldAccessor(string $fieldName, EntityDefinition $definition, string $root, Context $context): string
{
$fieldName = str_replace('extensions.', '', $fieldName);
$original = $fieldName;
$prefix = $root . '.';
if (strpos($fieldName, $prefix) === 0) {
$... | [
"public",
"function",
"getFieldAccessor",
"(",
"string",
"$",
"fieldName",
",",
"EntityDefinition",
"$",
"definition",
",",
"string",
"$",
"root",
",",
"Context",
"$",
"context",
")",
":",
"string",
"{",
"$",
"fieldName",
"=",
"str_replace",
"(",
"'extensions.... | Builds the sql field accessor for the provided field.
@example
fieldName => product.taxId
root => product
returns => `product`.`tax_id`
This function is also used for complex field accessors like JsonArray Field, JsonObject fields.
It considers the translation and parent-child inheritance.
fieldName => produ... | [
"Builds",
"the",
"sql",
"field",
"accessor",
"for",
"the",
"provided",
"field",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L149-L200 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.getBaseQuery | public function getBaseQuery(QueryBuilder $query, EntityDefinition $definition, Context $context): QueryBuilder
{
$table = $definition->getEntityName();
$query->from(self::escape($table));
$useVersionFallback = (
// only applies for versioned entities
$definition->i... | php | public function getBaseQuery(QueryBuilder $query, EntityDefinition $definition, Context $context): QueryBuilder
{
$table = $definition->getEntityName();
$query->from(self::escape($table));
$useVersionFallback = (
// only applies for versioned entities
$definition->i... | [
"public",
"function",
"getBaseQuery",
"(",
"QueryBuilder",
"$",
"query",
",",
"EntityDefinition",
"$",
"definition",
",",
"Context",
"$",
"context",
")",
":",
"QueryBuilder",
"{",
"$",
"table",
"=",
"$",
"definition",
"->",
"getEntityName",
"(",
")",
";",
"$... | Creates the basic root query for the provided entity definition and application context.
It considers the current context version. | [
"Creates",
"the",
"basic",
"root",
"query",
"for",
"the",
"provided",
"entity",
"definition",
"and",
"application",
"context",
".",
"It",
"considers",
"the",
"current",
"context",
"version",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L206-L245 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.resolveAccessor | public function resolveAccessor(
string $fieldName,
EntityDefinition $definition,
string $root,
QueryBuilder $query,
Context $context
): void {
$fieldName = str_replace('extensions.', '', $fieldName);
//example: `product.manufacturer.media.name`
$orig... | php | public function resolveAccessor(
string $fieldName,
EntityDefinition $definition,
string $root,
QueryBuilder $query,
Context $context
): void {
$fieldName = str_replace('extensions.', '', $fieldName);
//example: `product.manufacturer.media.name`
$orig... | [
"public",
"function",
"resolveAccessor",
"(",
"string",
"$",
"fieldName",
",",
"EntityDefinition",
"$",
"definition",
",",
"string",
"$",
"root",
",",
"QueryBuilder",
"$",
"query",
",",
"Context",
"$",
"context",
")",
":",
"void",
"{",
"$",
"fieldName",
"=",... | Used for dynamic sql joins. In case that the given fieldName is unknown or event nested with multiple association
roots, the function can resolve each association part of the field name, even if one part of the fieldName contains a translation or event inherited data field. | [
"Used",
"for",
"dynamic",
"sql",
"joins",
".",
"In",
"case",
"that",
"the",
"given",
"fieldName",
"is",
"unknown",
"or",
"event",
"nested",
"with",
"multiple",
"association",
"roots",
"the",
"function",
"can",
"resolve",
"each",
"association",
"part",
"of",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L306-L363 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.addTranslationSelect | public function addTranslationSelect(
string $root,
EntityDefinition $definition,
QueryBuilder $query,
Context $context
): void {
$translationDefinition = $definition->getTranslationDefinition();
$fields = $translationDefinition->getFields();
$chain = self::b... | php | public function addTranslationSelect(
string $root,
EntityDefinition $definition,
QueryBuilder $query,
Context $context
): void {
$translationDefinition = $definition->getTranslationDefinition();
$fields = $translationDefinition->getFields();
$chain = self::b... | [
"public",
"function",
"addTranslationSelect",
"(",
"string",
"$",
"root",
",",
"EntityDefinition",
"$",
"definition",
",",
"QueryBuilder",
"$",
"query",
",",
"Context",
"$",
"context",
")",
":",
"void",
"{",
"$",
"translationDefinition",
"=",
"$",
"definition",
... | Adds the full translation select part to the provided sql query.
Considers the parent-child inheritance and provided context language inheritance.
The raw parameter allows to skip the parent-child inheritance. | [
"Adds",
"the",
"full",
"translation",
"select",
"part",
"to",
"the",
"provided",
"sql",
"query",
".",
"Considers",
"the",
"parent",
"-",
"child",
"inheritance",
"and",
"provided",
"context",
"language",
"inheritance",
".",
"The",
"raw",
"parameter",
"allows",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L381-L416 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php | EntityDefinitionQueryHelper.addRuleCondition | private function addRuleCondition(QueryBuilder $query, EntityDefinition $definition, Context $context): void
{
if ($definition->isBlacklistAware() && $context->getRuleIds()) {
$wheres = [];
$accessor = $this->getFieldAccessor('blacklistIds', $definition, $definition->getEntityName()... | php | private function addRuleCondition(QueryBuilder $query, EntityDefinition $definition, Context $context): void
{
if ($definition->isBlacklistAware() && $context->getRuleIds()) {
$wheres = [];
$accessor = $this->getFieldAccessor('blacklistIds', $definition, $definition->getEntityName()... | [
"private",
"function",
"addRuleCondition",
"(",
"QueryBuilder",
"$",
"query",
",",
"EntityDefinition",
"$",
"definition",
",",
"Context",
"$",
"context",
")",
":",
"void",
"{",
"if",
"(",
"$",
"definition",
"->",
"isBlacklistAware",
"(",
")",
"&&",
"$",
"con... | Adds a blacklist and whitelist where condition to the provided query.
This function is only for internal usage for the root entity of the query. | [
"Adds",
"a",
"blacklist",
"and",
"whitelist",
"where",
"condition",
"to",
"the",
"provided",
"query",
".",
"This",
"function",
"is",
"only",
"for",
"internal",
"usage",
"for",
"the",
"root",
"entity",
"of",
"the",
"query",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php#L511-L560 |
shopware/platform | src/Core/Framework/Api/Controller/ApiController.php | ApiController.clone | public function clone(Context $context, string $entity, string $id): JsonResponse
{
$entity = $this->urlToSnakeCase($entity);
$definition = $this->definitionRegistry->getByEntityName($entity);
$eventContainer = $this->definitionRegistry->getRepository($definition->getEntityName())->clone($... | php | public function clone(Context $context, string $entity, string $id): JsonResponse
{
$entity = $this->urlToSnakeCase($entity);
$definition = $this->definitionRegistry->getByEntityName($entity);
$eventContainer = $this->definitionRegistry->getRepository($definition->getEntityName())->clone($... | [
"public",
"function",
"clone",
"(",
"Context",
"$",
"context",
",",
"string",
"$",
"entity",
",",
"string",
"$",
"id",
")",
":",
"JsonResponse",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"urlToSnakeCase",
"(",
"$",
"entity",
")",
";",
"$",
"definitio... | @Route("/api/v{version}/_action/clone/{entity}/{id}", name="api.clone", methods={"POST"}, requirements={
"version"="\d+", "entity"="[a-zA-Z-]+", "id"="[0-9a-f]{32}"
})
@throws DefinitionNotFoundException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"clone",
"/",
"{",
"entity",
"}",
"/",
"{",
"id",
"}",
"name",
"=",
"api",
".",
"clone",
"methods",
"=",
"{",
"POST",
"}",
"requirements",
"=",
"{",
"version",
"=",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/ApiController.php#L107-L123 |
shopware/platform | src/Core/Framework/Api/Controller/ApiController.php | ApiController.createVersion | public function createVersion(Request $request, Context $context, string $entity, string $id): Response
{
$versionId = $request->query->get('versionId');
$versionName = $request->query->get('versionName');
if ($versionId !== null && !Uuid::isValid($versionId)) {
throw new Invali... | php | public function createVersion(Request $request, Context $context, string $entity, string $id): Response
{
$versionId = $request->query->get('versionId');
$versionName = $request->query->get('versionName');
if ($versionId !== null && !Uuid::isValid($versionId)) {
throw new Invali... | [
"public",
"function",
"createVersion",
"(",
"Request",
"$",
"request",
",",
"Context",
"$",
"context",
",",
"string",
"$",
"entity",
",",
"string",
"$",
"id",
")",
":",
"Response",
"{",
"$",
"versionId",
"=",
"$",
"request",
"->",
"query",
"->",
"get",
... | @Route("/api/v{version}/_action/version/{entity}/{id}", name="api.createVersion", methods={"POST"},
requirements={"version"="\d+", "entity"="[a-zA-Z-]+", "id"="[0-9a-f]{32}"
})
@throws InvalidUuidException
@throws InvalidVersionNameException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"version",
"/",
"{",
"entity",
"}",
"/",
"{",
"id",
"}",
"name",
"=",
"api",
".",
"createVersion",
"methods",
"=",
"{",
"POST",
"}",
"requirements",
"=",
"{",
"version",... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/ApiController.php#L133-L160 |
shopware/platform | src/Core/Framework/Api/Controller/ApiController.php | ApiController.mergeVersion | public function mergeVersion(Context $context, string $entity, string $versionId): JsonResponse
{
if (!Uuid::isValid($versionId)) {
throw new InvalidUuidException($versionId);
}
$entityDefinition = $this->getEntityDefinition($entity);
$repository = $this->definitionRegis... | php | public function mergeVersion(Context $context, string $entity, string $versionId): JsonResponse
{
if (!Uuid::isValid($versionId)) {
throw new InvalidUuidException($versionId);
}
$entityDefinition = $this->getEntityDefinition($entity);
$repository = $this->definitionRegis... | [
"public",
"function",
"mergeVersion",
"(",
"Context",
"$",
"context",
",",
"string",
"$",
"entity",
",",
"string",
"$",
"versionId",
")",
":",
"JsonResponse",
"{",
"if",
"(",
"!",
"Uuid",
"::",
"isValid",
"(",
"$",
"versionId",
")",
")",
"{",
"throw",
... | @Route("/api/v{version}/_action/version/merge/{entity}/{versionId}", name="api.mergeVersion", methods={"POST"},
requirements={"version"="\d+", "entity"="[a-zA-Z-]+", "versionId"="[0-9a-f]{32}"
})
@throws InvalidUuidException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"version",
"/",
"merge",
"/",
"{",
"entity",
"}",
"/",
"{",
"versionId",
"}",
"name",
"=",
"api",
".",
"mergeVersion",
"methods",
"=",
"{",
"POST",
"}",
"requirements",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/ApiController.php#L169-L180 |
shopware/platform | src/Core/Framework/Api/Controller/ApiController.php | ApiController.deleteVersion | public function deleteVersion(Context $context, string $entity, string $entityId, string $versionId): Response
{
if ($versionId !== null && !Uuid::isValid($versionId)) {
throw new InvalidUuidException($versionId);
}
if ($entityId !== null && !Uuid::isValid($entityId)) {
... | php | public function deleteVersion(Context $context, string $entity, string $entityId, string $versionId): Response
{
if ($versionId !== null && !Uuid::isValid($versionId)) {
throw new InvalidUuidException($versionId);
}
if ($entityId !== null && !Uuid::isValid($entityId)) {
... | [
"public",
"function",
"deleteVersion",
"(",
"Context",
"$",
"context",
",",
"string",
"$",
"entity",
",",
"string",
"$",
"entityId",
",",
"string",
"$",
"versionId",
")",
":",
"Response",
"{",
"if",
"(",
"$",
"versionId",
"!==",
"null",
"&&",
"!",
"Uuid"... | @Route("/api/v{version}/_action/version/{versionId}/{entity}/{entityId}", name="api.deleteVersion", methods={"POST"},
requirements={"version"="\d+", "entity"="[a-zA-Z-]+", "id"="[0-9a-f]{32}"
})
@throws InvalidUuidException
@throws InvalidVersionNameException | [
"@Route",
"(",
"/",
"api",
"/",
"v",
"{",
"version",
"}",
"/",
"_action",
"/",
"version",
"/",
"{",
"versionId",
"}",
"/",
"{",
"entity",
"}",
"/",
"{",
"entityId",
"}",
"name",
"=",
"api",
".",
"deleteVersion",
"methods",
"=",
"{",
"POST",
"}",
... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/ApiController.php#L190-L215 |
shopware/platform | src/Core/Framework/Api/Controller/ApiController.php | ApiController.getRequestBody | private function getRequestBody(Request $request): array
{
$contentType = $request->headers->get('CONTENT_TYPE', '');
$semicolonPosition = strpos($contentType, ';');
if ($semicolonPosition !== false) {
$contentType = substr($contentType, 0, $semicolonPosition);
}
... | php | private function getRequestBody(Request $request): array
{
$contentType = $request->headers->get('CONTENT_TYPE', '');
$semicolonPosition = strpos($contentType, ';');
if ($semicolonPosition !== false) {
$contentType = substr($contentType, 0, $semicolonPosition);
}
... | [
"private",
"function",
"getRequestBody",
"(",
"Request",
"$",
"request",
")",
":",
"array",
"{",
"$",
"contentType",
"=",
"$",
"request",
"->",
"headers",
"->",
"get",
"(",
"'CONTENT_TYPE'",
",",
"''",
")",
";",
"$",
"semicolonPosition",
"=",
"strpos",
"("... | Return a nested array structure of based on the content-type | [
"Return",
"a",
"nested",
"array",
"structure",
"of",
"based",
"on",
"the",
"content",
"-",
"type"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/ApiController.php#L818-L839 |
shopware/platform | src/Storefront/PageletController/CmsPageletController.php | CmsPageletController.page | public function page(string $id, Request $request, SalesChannelContext $context): Response
{
if (!$id) {
throw new MissingRequestParameterException('Parameter id missing');
}
$page = $this->load($id, $request, $context);
return $this->renderStorefront('@Storefront/page/... | php | public function page(string $id, Request $request, SalesChannelContext $context): Response
{
if (!$id) {
throw new MissingRequestParameterException('Parameter id missing');
}
$page = $this->load($id, $request, $context);
return $this->renderStorefront('@Storefront/page/... | [
"public",
"function",
"page",
"(",
"string",
"$",
"id",
",",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"throw",
"new",
"MissingRequestParameterException",
"(",
"'P... | Route for stand alone cms pages
@Route("/widgets/cms/{id}", name="widgets.cms.page", methods={"GET", "POST"}, defaults={"id"=null, "XmlHttpRequest"=true}) | [
"Route",
"for",
"stand",
"alone",
"cms",
"pages"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageletController/CmsPageletController.php#L43-L52 |
shopware/platform | src/Storefront/PageletController/CmsPageletController.php | CmsPageletController.category | public function category(string $navigationId, Request $request, SalesChannelContext $context): Response
{
if (!$navigationId) {
throw new MissingRequestParameterException('Parameter navigationId missing');
}
$categories = $this->categoryRepository->search(new Criteria([$navigat... | php | public function category(string $navigationId, Request $request, SalesChannelContext $context): Response
{
if (!$navigationId) {
throw new MissingRequestParameterException('Parameter navigationId missing');
}
$categories = $this->categoryRepository->search(new Criteria([$navigat... | [
"public",
"function",
"category",
"(",
"string",
"$",
"navigationId",
",",
"Request",
"$",
"request",
",",
"SalesChannelContext",
"$",
"context",
")",
":",
"Response",
"{",
"if",
"(",
"!",
"$",
"navigationId",
")",
"{",
"throw",
"new",
"MissingRequestParameter... | Route to load a cms page which assigned to the provided navigation id.
Navigation id is required to load the slot config for the navigation
@Route("/widgets/cms/navigation/{navigationId}", name="widgets.cms.navigation.page", methods={"GET", "POST"}, defaults={"navigationId"=null, "XmlHttpRequest"=true}) | [
"Route",
"to",
"load",
"a",
"cms",
"page",
"which",
"assigned",
"to",
"the",
"provided",
"navigation",
"id",
".",
"Navigation",
"id",
"is",
"required",
"to",
"load",
"the",
"slot",
"config",
"for",
"the",
"navigation"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageletController/CmsPageletController.php#L60-L82 |
shopware/platform | src/Core/Framework/Plugin/PluginExtractor.php | PluginExtractor.extract | public function extract(\ZipArchive $archive): void
{
$destination = $this->pluginDir;
if (!is_writable($destination)) {
throw new PluginExtractionException(sprintf('Destination directory "%s" is not writable', $destination));
}
$pluginName = $this->getPluginName($archi... | php | public function extract(\ZipArchive $archive): void
{
$destination = $this->pluginDir;
if (!is_writable($destination)) {
throw new PluginExtractionException(sprintf('Destination directory "%s" is not writable', $destination));
}
$pluginName = $this->getPluginName($archi... | [
"public",
"function",
"extract",
"(",
"\\",
"ZipArchive",
"$",
"archive",
")",
":",
"void",
"{",
"$",
"destination",
"=",
"$",
"this",
"->",
"pluginDir",
";",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"destination",
")",
")",
"{",
"throw",
"new",
"Plugi... | Extracts the provided zip file to the plugin directory | [
"Extracts",
"the",
"provided",
"zip",
"file",
"to",
"the",
"plugin",
"directory"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/PluginExtractor.php#L29-L59 |
shopware/platform | src/Core/Framework/Plugin/PluginExtractor.php | PluginExtractor.validatePluginZip | private function validatePluginZip(string $prefix, \ZipArchive $archive): void
{
for ($i = 2; $i < $archive->numFiles; ++$i) {
$stat = $archive->statIndex($i);
$this->assertNoDirectoryTraversal($stat['name']);
$this->assertPrefix($stat['name'], $prefix);
}
} | php | private function validatePluginZip(string $prefix, \ZipArchive $archive): void
{
for ($i = 2; $i < $archive->numFiles; ++$i) {
$stat = $archive->statIndex($i);
$this->assertNoDirectoryTraversal($stat['name']);
$this->assertPrefix($stat['name'], $prefix);
}
} | [
"private",
"function",
"validatePluginZip",
"(",
"string",
"$",
"prefix",
",",
"\\",
"ZipArchive",
"$",
"archive",
")",
":",
"void",
"{",
"for",
"(",
"$",
"i",
"=",
"2",
";",
"$",
"i",
"<",
"$",
"archive",
"->",
"numFiles",
";",
"++",
"$",
"i",
")"... | Iterates all files of the provided zip archive
path and validates the plugin namespace, directory traversal
and multiple plugin directories. | [
"Iterates",
"all",
"files",
"of",
"the",
"provided",
"zip",
"archive",
"path",
"and",
"validates",
"the",
"plugin",
"namespace",
"directory",
"traversal",
"and",
"multiple",
"plugin",
"directories",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/PluginExtractor.php#L66-L74 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Write/Command/WriteCommandQueue.php | WriteCommandQueue.getCommandsInOrder | public function getCommandsInOrder(): array
{
$commands = array_filter($this->commands);
$order = [];
$counter = 0;
while (!empty($commands)) {
++$counter;
if ($counter === 50) {
throw new ImpossibleWriteOrderException(array_keys($commands)... | php | public function getCommandsInOrder(): array
{
$commands = array_filter($this->commands);
$order = [];
$counter = 0;
while (!empty($commands)) {
++$counter;
if ($counter === 50) {
throw new ImpossibleWriteOrderException(array_keys($commands)... | [
"public",
"function",
"getCommandsInOrder",
"(",
")",
":",
"array",
"{",
"$",
"commands",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"commands",
")",
";",
"$",
"order",
"=",
"[",
"]",
";",
"$",
"counter",
"=",
"0",
";",
"while",
"(",
"!",
"empty",
... | @throws ImpossibleWriteOrderException
@return WriteCommandInterface[] | [
"@throws",
"ImpossibleWriteOrderException"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Write/Command/WriteCommandQueue.php#L62-L93 |
shopware/platform | src/Core/System/User/Command/UserCreateCommand.php | UserCreateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$username = $input->getArgument('username');
$password = $input->getOption('password');
if (empty($password)) {
$passwordQuestion = new Question('Passwo... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$username = $input->getArgument('username');
$password = $input->getOption('password');
if (empty($password)) {
$passwordQuestion = new Question('Passwo... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"username",
"=",
"$",
"input",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/System/User/Command/UserCreateCommand.php#L44-L73 |
shopware/platform | src/Core/Framework/Doctrine/FetchModeHelper.php | FetchModeHelper.keyPair | public static function keyPair(array $result): array
{
$firstRow = current($result);
if (empty($firstRow)) {
return $result;
}
list($keyName, $valueName) = array_keys($firstRow);
return array_combine(
array_column($result, $keyName),
arra... | php | public static function keyPair(array $result): array
{
$firstRow = current($result);
if (empty($firstRow)) {
return $result;
}
list($keyName, $valueName) = array_keys($firstRow);
return array_combine(
array_column($result, $keyName),
arra... | [
"public",
"static",
"function",
"keyPair",
"(",
"array",
"$",
"result",
")",
":",
"array",
"{",
"$",
"firstRow",
"=",
"current",
"(",
"$",
"result",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"firstRow",
")",
")",
"{",
"return",
"$",
"result",
";",
"}... | User-land implementation of PDO::FETCH_KEY_PAIR | [
"User",
"-",
"land",
"implementation",
"of",
"PDO",
"::",
"FETCH_KEY_PAIR"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Doctrine/FetchModeHelper.php#L10-L23 |
shopware/platform | src/Core/Framework/Doctrine/FetchModeHelper.php | FetchModeHelper.group | public static function group(array $result): array
{
$firstRow = current($result);
if (empty($firstRow)) {
return $result;
}
$dataKeys = array_keys($firstRow);
$groupKey = array_shift($dataKeys);
$rows = [];
foreach ($result as $row) {
... | php | public static function group(array $result): array
{
$firstRow = current($result);
if (empty($firstRow)) {
return $result;
}
$dataKeys = array_keys($firstRow);
$groupKey = array_shift($dataKeys);
$rows = [];
foreach ($result as $row) {
... | [
"public",
"static",
"function",
"group",
"(",
"array",
"$",
"result",
")",
":",
"array",
"{",
"$",
"firstRow",
"=",
"current",
"(",
"$",
"result",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"firstRow",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",... | User-land implementation of PDO::FETCH_GROUP | [
"User",
"-",
"land",
"implementation",
"of",
"PDO",
"::",
"FETCH_GROUP"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Doctrine/FetchModeHelper.php#L28-L47 |
shopware/platform | src/Core/Checkout/Promotion/Cart/Builder/PromotionItemBuilder.php | PromotionItemBuilder.buildPlaceholderItem | public function buildPlaceholderItem(string $code, int $currencyPrecision): LineItem
{
// void duplicate codes with other items
// that might not be from the promotion scope
$uniqueKey = self::PLACEHOLDER_PREFIX . $code;
$item = new LineItem($uniqueKey, $this->lineItemType, 1);
... | php | public function buildPlaceholderItem(string $code, int $currencyPrecision): LineItem
{
// void duplicate codes with other items
// that might not be from the promotion scope
$uniqueKey = self::PLACEHOLDER_PREFIX . $code;
$item = new LineItem($uniqueKey, $this->lineItemType, 1);
... | [
"public",
"function",
"buildPlaceholderItem",
"(",
"string",
"$",
"code",
",",
"int",
"$",
"currencyPrecision",
")",
":",
"LineItem",
"{",
"// void duplicate codes with other items",
"// that might not be from the promotion scope",
"$",
"uniqueKey",
"=",
"self",
"::",
"PL... | Builds a new placeholder promotion line item that does not have
any side effects for the calculation. It will contain the code
within the payload which can then be used to create a real promotion item.
@throws InvalidPayloadException
@throws InvalidQuantityException | [
"Builds",
"a",
"new",
"placeholder",
"promotion",
"line",
"item",
"that",
"does",
"not",
"have",
"any",
"side",
"effects",
"for",
"the",
"calculation",
".",
"It",
"will",
"contain",
"the",
"code",
"within",
"the",
"payload",
"which",
"can",
"then",
"be",
"... | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Builder/PromotionItemBuilder.php#L43-L61 |
shopware/platform | src/Core/Checkout/Promotion/Cart/Builder/PromotionItemBuilder.php | PromotionItemBuilder.buildDiscountLineItem | public function buildDiscountLineItem(PromotionEntity $promotion, PromotionDiscountEntity $discount, int $currencyPrecision): LineItem
{
//get the rules collection of discount
/** @var RuleCollection|null $discountRuleCollection */
$discountRuleCollection = $discount->getDiscountRules();
... | php | public function buildDiscountLineItem(PromotionEntity $promotion, PromotionDiscountEntity $discount, int $currencyPrecision): LineItem
{
//get the rules collection of discount
/** @var RuleCollection|null $discountRuleCollection */
$discountRuleCollection = $discount->getDiscountRules();
... | [
"public",
"function",
"buildDiscountLineItem",
"(",
"PromotionEntity",
"$",
"promotion",
",",
"PromotionDiscountEntity",
"$",
"discount",
",",
"int",
"$",
"currencyPrecision",
")",
":",
"LineItem",
"{",
"//get the rules collection of discount",
"/** @var RuleCollection|null $... | Builds a new Line Item for the provided discount and its promotion.
It will automatically reference all provided "product" item Ids within the payload.
@throws \Shopware\Core\Checkout\Cart\Exception\InvalidPayloadException
@throws \Shopware\Core\Checkout\Cart\Exception\InvalidQuantityException | [
"Builds",
"a",
"new",
"Line",
"Item",
"for",
"the",
"provided",
"discount",
"and",
"its",
"promotion",
".",
"It",
"will",
"automatically",
"reference",
"all",
"provided",
"product",
"item",
"Ids",
"within",
"the",
"payload",
"."
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Builder/PromotionItemBuilder.php#L70-L138 |
shopware/platform | src/Core/Framework/Api/Serializer/JsonApiDecoder.php | JsonApiDecoder.decode | public function decode($data, $format, array $context = [])
{
$decoder = new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
$data = $decoder->decode($data, 'json');
if (!\is_array($data) || !array_key_exists('data', $data) || !\is_array($data)) {
throw new UnexpectedValueExcepti... | php | public function decode($data, $format, array $context = [])
{
$decoder = new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
$data = $decoder->decode($data, 'json');
if (!\is_array($data) || !array_key_exists('data', $data) || !\is_array($data)) {
throw new UnexpectedValueExcepti... | [
"public",
"function",
"decode",
"(",
"$",
"data",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"decoder",
"=",
"new",
"JsonDecode",
"(",
"[",
"JsonDecode",
"::",
"ASSOCIATIVE",
"=>",
"true",
"]",
")",
";",
"$",
"d... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Serializer/JsonApiDecoder.php#L17-L36 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityWriteGateway.php | EntityWriteGateway.getExistence | public function getExistence(EntityDefinition $definition, array $primaryKey, array $data, WriteCommandQueue $commandQueue): EntityExistence
{
$state = $this->getCurrentState($definition, $primaryKey, $commandQueue);
$exists = !empty($state);
$isChild = $this->isChild($definition, $data, $... | php | public function getExistence(EntityDefinition $definition, array $primaryKey, array $data, WriteCommandQueue $commandQueue): EntityExistence
{
$state = $this->getCurrentState($definition, $primaryKey, $commandQueue);
$exists = !empty($state);
$isChild = $this->isChild($definition, $data, $... | [
"public",
"function",
"getExistence",
"(",
"EntityDefinition",
"$",
"definition",
",",
"array",
"$",
"primaryKey",
",",
"array",
"$",
"data",
",",
"WriteCommandQueue",
"$",
"commandQueue",
")",
":",
"EntityExistence",
"{",
"$",
"state",
"=",
"$",
"this",
"->",... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityWriteGateway.php#L45-L56 |
shopware/platform | src/Core/Framework/DataAbstractionLayer/Dbal/EntityWriteGateway.php | EntityWriteGateway.execute | public function execute(array $commands, WriteContext $context): void
{
$this->connection->transactional(function () use ($commands, $context) {
// throws exception on violation and then aborts/rollbacks this transaction
$this->commandQueueValidator->preValidate($commands, $context);... | php | public function execute(array $commands, WriteContext $context): void
{
$this->connection->transactional(function () use ($commands, $context) {
// throws exception on violation and then aborts/rollbacks this transaction
$this->commandQueueValidator->preValidate($commands, $context);... | [
"public",
"function",
"execute",
"(",
"array",
"$",
"commands",
",",
"WriteContext",
"$",
"context",
")",
":",
"void",
"{",
"$",
"this",
"->",
"connection",
"->",
"transactional",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"commands",
",",
"$",
"context... | {@inheritdoc} | [
"{"
] | train | https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Dbal/EntityWriteGateway.php#L61-L107 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.