id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,900 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogReader.php | LogReader.parseLog | protected function parseLog($content, $allowedEnvironment = null, $allowedLevel = [])
{
$log = [];
$parsed = $this->parser->parseLogContent($content);
extract($parsed, EXTR_PREFIX_ALL, 'parsed');
if (empty($parsed_headerSet)) {
return $log;
}
$needReFo... | php | protected function parseLog($content, $allowedEnvironment = null, $allowedLevel = [])
{
$log = [];
$parsed = $this->parser->parseLogContent($content);
extract($parsed, EXTR_PREFIX_ALL, 'parsed');
if (empty($parsed_headerSet)) {
return $log;
}
$needReFo... | [
"protected",
"function",
"parseLog",
"(",
"$",
"content",
",",
"$",
"allowedEnvironment",
"=",
"null",
",",
"$",
"allowedLevel",
"=",
"[",
"]",
")",
"{",
"$",
"log",
"=",
"[",
"]",
";",
"$",
"parsed",
"=",
"$",
"this",
"->",
"parser",
"->",
"parseLog... | Parses the content of the file separating the errors into a single array.
@param string $content
@param string $allowedEnvironment
@param array $allowedLevel
@return array | [
"Parses",
"the",
"content",
"of",
"the",
"file",
"separating",
"the",
"errors",
"into",
"a",
"single",
"array",
"."
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogReader.php#L697-L739 |
32,901 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogReader.php | LogReader.getLogFileList | protected function getLogFileList($forceName = null)
{
$path = $this->getLogPath();
if (is_dir($path)) {
/*
* Matches files in the log directory with the special name'
*/
$logPath = sprintf('%s%s%s', $path, DIRECTORY_SEPARATOR, $this->getLogFilenam... | php | protected function getLogFileList($forceName = null)
{
$path = $this->getLogPath();
if (is_dir($path)) {
/*
* Matches files in the log directory with the special name'
*/
$logPath = sprintf('%s%s%s', $path, DIRECTORY_SEPARATOR, $this->getLogFilenam... | [
"protected",
"function",
"getLogFileList",
"(",
"$",
"forceName",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getLogPath",
"(",
")",
";",
"if",
"(",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"/*\n * Matches files in the log dire... | Returns an array of log file paths.
@param null|string $forceName
@return bool|array | [
"Returns",
"an",
"array",
"of",
"log",
"file",
"paths",
"."
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogReader.php#L774-L796 |
32,902 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogParser.php | LogParser.parseLogContent | public function parseLogContent($content)
{
$headerSet = $dateSet = $envSet = $levelSet = $bodySet = [];
$pattern = "/^" .self::LOG_DATE_PATTERN. "\s" .self::LOG_ENVIRONMENT_PATTERN. "\." .self::LOG_LEVEL_PATTERN. "\:|Next/m";
preg_match_all($pattern, $content, $matchs);
if (is_ar... | php | public function parseLogContent($content)
{
$headerSet = $dateSet = $envSet = $levelSet = $bodySet = [];
$pattern = "/^" .self::LOG_DATE_PATTERN. "\s" .self::LOG_ENVIRONMENT_PATTERN. "\." .self::LOG_LEVEL_PATTERN. "\:|Next/m";
preg_match_all($pattern, $content, $matchs);
if (is_ar... | [
"public",
"function",
"parseLogContent",
"(",
"$",
"content",
")",
"{",
"$",
"headerSet",
"=",
"$",
"dateSet",
"=",
"$",
"envSet",
"=",
"$",
"levelSet",
"=",
"$",
"bodySet",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"\"/^\"",
".",
"self",
"::",
"LOG_D... | Parses content of the log file into an array containing the necessary information
@param string $content
@return array Structure is ['headerSet' => [], 'dateSet' => [], 'envSet' => [], 'levelSet' => [], 'bodySet' => []] | [
"Parses",
"content",
"of",
"the",
"log",
"file",
"into",
"an",
"array",
"containing",
"the",
"necessary",
"information"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogParser.php#L33-L56 |
32,903 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogParser.php | LogParser.parseLogBody | public function parseLogBody($content)
{
$pattern = "/^".self::STACK_TRACE_DIVIDER_PATTERN."/m";
$parts = array_map('ltrim', preg_split($pattern, $content));
$context = $parts[0];
$stack_traces = (isset($parts[1])) ? $parts[1] : null;
return compact('context... | php | public function parseLogBody($content)
{
$pattern = "/^".self::STACK_TRACE_DIVIDER_PATTERN."/m";
$parts = array_map('ltrim', preg_split($pattern, $content));
$context = $parts[0];
$stack_traces = (isset($parts[1])) ? $parts[1] : null;
return compact('context... | [
"public",
"function",
"parseLogBody",
"(",
"$",
"content",
")",
"{",
"$",
"pattern",
"=",
"\"/^\"",
".",
"self",
"::",
"STACK_TRACE_DIVIDER_PATTERN",
".",
"\"/m\"",
";",
"$",
"parts",
"=",
"array_map",
"(",
"'ltrim'",
",",
"preg_split",
"(",
"$",
"pattern",
... | Parses the body part of the log entry into an array containing the necessary information
@param string $content
@return array Structure is ['context' => '', 'stack_traces' => ''] | [
"Parses",
"the",
"body",
"part",
"of",
"the",
"log",
"entry",
"into",
"an",
"array",
"containing",
"the",
"necessary",
"information"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogParser.php#L65-L73 |
32,904 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogParser.php | LogParser.parseLogContext | public function parseLogContext($content)
{
$content = trim($content);
$pattern = "/^".self::CONTEXT_EXCEPTION_PATTERN.self::CONTEXT_MESSAGE_PATTERN.self::CONTEXT_IN_PATTERN."$/ms";
preg_match($pattern, $content, $matchs);
$exception = isset($matchs[1]) ? $matchs[1] : null;
... | php | public function parseLogContext($content)
{
$content = trim($content);
$pattern = "/^".self::CONTEXT_EXCEPTION_PATTERN.self::CONTEXT_MESSAGE_PATTERN.self::CONTEXT_IN_PATTERN."$/ms";
preg_match($pattern, $content, $matchs);
$exception = isset($matchs[1]) ? $matchs[1] : null;
... | [
"public",
"function",
"parseLogContext",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"trim",
"(",
"$",
"content",
")",
";",
"$",
"pattern",
"=",
"\"/^\"",
".",
"self",
"::",
"CONTEXT_EXCEPTION_PATTERN",
".",
"self",
"::",
"CONTEXT_MESSAGE_PATTERN",
"... | Parses the context part of the log entry into an array containing the necessary information
@param string $content
@return array Structure is ['message' => '', 'exception' => '', 'in' => '', 'line' => ''] | [
"Parses",
"the",
"context",
"part",
"of",
"the",
"log",
"entry",
"into",
"an",
"array",
"containing",
"the",
"necessary",
"information"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogParser.php#L82-L95 |
32,905 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogParser.php | LogParser.parseStackTrace | public function parseStackTrace($content)
{
$content = trim($content);
$pattern = "/^".self::STACK_TRACE_INDEX_PATTERN."/m";
if (empty($content)) {
return [];
}
$traces = preg_split($pattern, $content);
if (empty($trace[0])) {
array_shift($t... | php | public function parseStackTrace($content)
{
$content = trim($content);
$pattern = "/^".self::STACK_TRACE_INDEX_PATTERN."/m";
if (empty($content)) {
return [];
}
$traces = preg_split($pattern, $content);
if (empty($trace[0])) {
array_shift($t... | [
"public",
"function",
"parseStackTrace",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"trim",
"(",
"$",
"content",
")",
";",
"$",
"pattern",
"=",
"\"/^\"",
".",
"self",
"::",
"STACK_TRACE_INDEX_PATTERN",
".",
"\"/m\"",
";",
"if",
"(",
"empty",
"("... | Parses the stack trace part of the log entry into an array containing the necessary information
@param string $content
@return array | [
"Parses",
"the",
"stack",
"trace",
"part",
"of",
"the",
"log",
"entry",
"into",
"an",
"array",
"containing",
"the",
"necessary",
"information"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogParser.php#L104-L120 |
32,906 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/LogParser.php | LogParser.parseTraceEntry | public function parseTraceEntry($content)
{
$content = trim($content);
$caught_at = $content;
$in = $line = null;
if (!empty($content) && preg_match("/.*".self::TRACE_IN_DIVIDER_PATTERN.".*/", $content)) {
$split = array_map('trim', preg_split("/".self::TRACE_IN_DIVIDER... | php | public function parseTraceEntry($content)
{
$content = trim($content);
$caught_at = $content;
$in = $line = null;
if (!empty($content) && preg_match("/.*".self::TRACE_IN_DIVIDER_PATTERN.".*/", $content)) {
$split = array_map('trim', preg_split("/".self::TRACE_IN_DIVIDER... | [
"public",
"function",
"parseTraceEntry",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"trim",
"(",
"$",
"content",
")",
";",
"$",
"caught_at",
"=",
"$",
"content",
";",
"$",
"in",
"=",
"$",
"line",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
... | Parses the content of the trace entry into an array containing the necessary information
@param string $content
@return array Structure is ['caught_at' => '', 'in' => '', 'line' => ''] | [
"Parses",
"the",
"content",
"of",
"the",
"trace",
"entry",
"into",
"an",
"array",
"containing",
"the",
"necessary",
"information"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/LogParser.php#L129-L149 |
32,907 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/Console/Traits/SetLogReaderParamTrait.php | SetLogReaderParamTrait.setLogReaderParam | protected function setLogReaderParam()
{
if (array_key_exists('log-path', $this->option()) && ! empty($this->option('log-path'))) {
$this->reader->setLogPath($this->option('log-path'));
}
if (array_key_exists('order-by', $this->option()) && ! empty($this->option('order-by'))) {
... | php | protected function setLogReaderParam()
{
if (array_key_exists('log-path', $this->option()) && ! empty($this->option('log-path'))) {
$this->reader->setLogPath($this->option('log-path'));
}
if (array_key_exists('order-by', $this->option()) && ! empty($this->option('order-by'))) {
... | [
"protected",
"function",
"setLogReaderParam",
"(",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'log-path'",
",",
"$",
"this",
"->",
"option",
"(",
")",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"option",
"(",
"'log-path'",
")",
")",
")",
"{",... | Set parameters for LogReader
@return void | [
"Set",
"parameters",
"for",
"LogReader"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/Console/Traits/SetLogReaderParamTrait.php#L10-L39 |
32,908 | JackieDo/Laravel-Log-Reader | src/Jackiedo/LogReader/Console/Commands/LogReaderGetCommand.php | LogReaderGetCommand.getLogEntries | protected function getLogEntries()
{
if ($this->option('paginate')) {
$logs = $this->reader->paginate($this->option('per-page'), $this->option('page'));
$total = $logs->total();
$this->line("You have total ".$total." log ".(($total > 1) ? 'entries' : 'entry').".");
... | php | protected function getLogEntries()
{
if ($this->option('paginate')) {
$logs = $this->reader->paginate($this->option('per-page'), $this->option('page'));
$total = $logs->total();
$this->line("You have total ".$total." log ".(($total > 1) ? 'entries' : 'entry').".");
... | [
"protected",
"function",
"getLogEntries",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"option",
"(",
"'paginate'",
")",
")",
"{",
"$",
"logs",
"=",
"$",
"this",
"->",
"reader",
"->",
"paginate",
"(",
"$",
"this",
"->",
"option",
"(",
"'per-page'",
"... | Reading log files and get log entries
@return mixed | [
"Reading",
"log",
"files",
"and",
"get",
"log",
"entries"
] | 10c6b52b52cde4250e40bae83d7a17f0532adfc2 | https://github.com/JackieDo/Laravel-Log-Reader/blob/10c6b52b52cde4250e40bae83d7a17f0532adfc2/src/Jackiedo/LogReader/Console/Commands/LogReaderGetCommand.php#L60-L76 |
32,909 | silinternational/email-service-php-client | src/EmailServiceClient.php | EmailServiceClient.email | public function email(array $config = [])
{
$result = $this->emailInternal($config);
$statusCode = (int)$result['statusCode'];
if ($statusCode >= 200 && $statusCode < 300) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->repor... | php | public function email(array $config = [])
{
$result = $this->emailInternal($config);
$statusCode = (int)$result['statusCode'];
if ($statusCode >= 200 && $statusCode < 300) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->repor... | [
"public",
"function",
"email",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"emailInternal",
"(",
"$",
"config",
")",
";",
"$",
"statusCode",
"=",
"(",
"int",
")",
"$",
"result",
"[",
"'statusCode'",
... | Create an email with the given information.
@param array $config An array key/value pairs of attributes for the new
email.
@return array An array of information about the email.
@throws EmailServiceClientException | [
"Create",
"an",
"email",
"with",
"the",
"given",
"information",
"."
] | 02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e | https://github.com/silinternational/email-service-php-client/blob/02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e/src/EmailServiceClient.php#L148-L158 |
32,910 | silinternational/email-service-php-client | src/EmailServiceClient.php | EmailServiceClient.assertTrustedIp | private function assertTrustedIp()
{
$baseHost = parse_url($this->serviceUri, PHP_URL_HOST);
$serviceIp = gethostbyname(
$baseHost
);
if ( ! $this->isTrustedIpAddress($serviceIp)) {
throw new EmailServiceClientException(
'The service has an IP... | php | private function assertTrustedIp()
{
$baseHost = parse_url($this->serviceUri, PHP_URL_HOST);
$serviceIp = gethostbyname(
$baseHost
);
if ( ! $this->isTrustedIpAddress($serviceIp)) {
throw new EmailServiceClientException(
'The service has an IP... | [
"private",
"function",
"assertTrustedIp",
"(",
")",
"{",
"$",
"baseHost",
"=",
"parse_url",
"(",
"$",
"this",
"->",
"serviceUri",
",",
"PHP_URL_HOST",
")",
";",
"$",
"serviceIp",
"=",
"gethostbyname",
"(",
"$",
"baseHost",
")",
";",
"if",
"(",
"!",
"$",
... | Determine whether any of the service's IPs are not in the
trusted ranges
@throws Exception | [
"Determine",
"whether",
"any",
"of",
"the",
"service",
"s",
"IPs",
"are",
"not",
"in",
"the",
"trusted",
"ranges"
] | 02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e | https://github.com/silinternational/email-service-php-client/blob/02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e/src/EmailServiceClient.php#L207-L220 |
32,911 | silinternational/email-service-php-client | src/EmailServiceClient.php | EmailServiceClient.isTrustedIpAddress | private function isTrustedIpAddress($ipAddress)
{
foreach ($this->trustedIpRanges as $trustedIpBlock) {
if ($trustedIpBlock->containsIP($ipAddress)) {
return true;
}
}
return false;
} | php | private function isTrustedIpAddress($ipAddress)
{
foreach ($this->trustedIpRanges as $trustedIpBlock) {
if ($trustedIpBlock->containsIP($ipAddress)) {
return true;
}
}
return false;
} | [
"private",
"function",
"isTrustedIpAddress",
"(",
"$",
"ipAddress",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"trustedIpRanges",
"as",
"$",
"trustedIpBlock",
")",
"{",
"if",
"(",
"$",
"trustedIpBlock",
"->",
"containsIP",
"(",
"$",
"ipAddress",
")",
")",
... | Determine whether the service's IP address is in a trusted range.
@param string $ipAddress The IP address in question.
@return bool | [
"Determine",
"whether",
"the",
"service",
"s",
"IP",
"address",
"is",
"in",
"a",
"trusted",
"range",
"."
] | 02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e | https://github.com/silinternational/email-service-php-client/blob/02f438d133a2ccbf057a6d4d24b8fcdab8c2d63e/src/EmailServiceClient.php#L228-L237 |
32,912 | QoboLtd/qobo-robo | src/Command/Mysql/DbFindReplace.php | DbFindReplace.mysqlDbFindReplace | public function mysqlDbFindReplace(
$search,
$replace,
$db,
$user = 'root',
$pass = '',
$host = 'localhost',
$port = null,
$opts = ['format' => 'table', 'fields' => '']
) {
$result = $this->taskMysqlDbFindReplace()
->search($search)... | php | public function mysqlDbFindReplace(
$search,
$replace,
$db,
$user = 'root',
$pass = '',
$host = 'localhost',
$port = null,
$opts = ['format' => 'table', 'fields' => '']
) {
$result = $this->taskMysqlDbFindReplace()
->search($search)... | [
"public",
"function",
"mysqlDbFindReplace",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"db",
",",
"$",
"user",
"=",
"'root'",
",",
"$",
"pass",
"=",
"''",
",",
"$",
"host",
"=",
"'localhost'",
",",
"$",
"port",
"=",
"null",
",",
"$",
"opts"... | Run find-replace on MySQL database
@param string $search Search string
@param string $replace Replacement string
@param string $db Database name
@param string $user MySQL user to bind with
@param string $pass (Optional) MySQL user password
@param string $host (Optional) MySQL server host
@param string $port (Optional)... | [
"Run",
"find",
"-",
"replace",
"on",
"MySQL",
"database"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Command/Mysql/DbFindReplace.php#L34-L60 |
32,913 | doganoo/PHPUtil | src/Util/DateTimeUtil.php | DateTimeUtil.valid | public static function valid(string $date, string $format): bool {
return date($format, strtotime($date)) === $date;
} | php | public static function valid(string $date, string $format): bool {
return date($format, strtotime($date)) === $date;
} | [
"public",
"static",
"function",
"valid",
"(",
"string",
"$",
"date",
",",
"string",
"$",
"format",
")",
":",
"bool",
"{",
"return",
"date",
"(",
"$",
"format",
",",
"strtotime",
"(",
"$",
"date",
")",
")",
"===",
"$",
"date",
";",
"}"
] | Whether string is a valid date or not
@param string $date
@param string $format
@return bool | [
"Whether",
"string",
"is",
"a",
"valid",
"date",
"or",
"not"
] | 4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5 | https://github.com/doganoo/PHPUtil/blob/4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5/src/Util/DateTimeUtil.php#L85-L88 |
32,914 | orchestral/support | src/Support/Transformer.php | Transformer.handle | public function handle($instance)
{
if ($instance instanceof Paginator) {
return $instance->setCollection(
$instance->getCollection()->transform($this)
);
} elseif ($instance instanceof Transformable || $instance instanceof BaseCollection) {
$trans... | php | public function handle($instance)
{
if ($instance instanceof Paginator) {
return $instance->setCollection(
$instance->getCollection()->transform($this)
);
} elseif ($instance instanceof Transformable || $instance instanceof BaseCollection) {
$trans... | [
"public",
"function",
"handle",
"(",
"$",
"instance",
")",
"{",
"if",
"(",
"$",
"instance",
"instanceof",
"Paginator",
")",
"{",
"return",
"$",
"instance",
"->",
"setCollection",
"(",
"$",
"instance",
"->",
"getCollection",
"(",
")",
"->",
"transform",
"("... | Handle transformation.
@param mixed $instance
@return mixed | [
"Handle",
"transformation",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Transformer.php#L20-L35 |
32,915 | doganoo/PHPUtil | src/Util/StringUtil.php | StringUtil.stringToArray | public static function stringToArray(?string $string): array {
$result = [];
$strLen = \strlen($string);
if (null === $string) return $result;
if (1 === $strLen) {
$result[] = $string;
return $result;
}
for ($i = 0; $i < $strLen; $i++) {
... | php | public static function stringToArray(?string $string): array {
$result = [];
$strLen = \strlen($string);
if (null === $string) return $result;
if (1 === $strLen) {
$result[] = $string;
return $result;
}
for ($i = 0; $i < $strLen; $i++) {
... | [
"public",
"static",
"function",
"stringToArray",
"(",
"?",
"string",
"$",
"string",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"strLen",
"=",
"\\",
"strlen",
"(",
"$",
"string",
")",
";",
"if",
"(",
"null",
"===",
"$",
"string"... | returns an array of elements of the string
@param null|string $string
@return array | [
"returns",
"an",
"array",
"of",
"elements",
"of",
"the",
"string"
] | 4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5 | https://github.com/doganoo/PHPUtil/blob/4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5/src/Util/StringUtil.php#L45-L57 |
32,916 | QoboLtd/qobo-robo | src/Runner.php | Runner.handleError | public function handleError()
{
// get error info
list ($errno, $message, $file, $line) = func_get_args();
// construct error message
$msg = "ERROR ($errno): $message";
if ($line !== null) {
$file = "$file:$line";
}
if ($file !== null) {
... | php | public function handleError()
{
// get error info
list ($errno, $message, $file, $line) = func_get_args();
// construct error message
$msg = "ERROR ($errno): $message";
if ($line !== null) {
$file = "$file:$line";
}
if ($file !== null) {
... | [
"public",
"function",
"handleError",
"(",
")",
"{",
"// get error info",
"list",
"(",
"$",
"errno",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
")",
"=",
"func_get_args",
"(",
")",
";",
"// construct error message",
"$",
"msg",
"=",
"\"ERROR (... | Custom error handler that will throw an exception on any errors | [
"Custom",
"error",
"handler",
"that",
"will",
"throw",
"an",
"exception",
"on",
"any",
"errors"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Runner.php#L48-L67 |
32,917 | emgiezet/errbitPHP | src/Errbit/Exception/Notice.php | Notice.buildRequestUrl | private function buildRequestUrl()
{
if (!empty($_SERVER['REQUEST_URI'])) {
return sprintf(
'%s://%s%s%s',
$this->guessProtocol(),
$this->guessHost(),
$this->guessPort(),
$_SERVER['REQUEST_URI']
);
... | php | private function buildRequestUrl()
{
if (!empty($_SERVER['REQUEST_URI'])) {
return sprintf(
'%s://%s%s%s',
$this->guessProtocol(),
$this->guessHost(),
$this->guessPort(),
$_SERVER['REQUEST_URI']
);
... | [
"private",
"function",
"buildRequestUrl",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"return",
"sprintf",
"(",
"'%s://%s%s%s'",
",",
"$",
"this",
"->",
"guessProtocol",
"(",
")",
",",
"$",
"th... | Building request url
@return string url | [
"Building",
"request",
"url"
] | cc634f8d6b0d2cd4a29648662119310afc73fa7b | https://github.com/emgiezet/errbitPHP/blob/cc634f8d6b0d2cd4a29648662119310afc73fa7b/src/Errbit/Exception/Notice.php#L397-L408 |
32,918 | doganoo/PHPUtil | src/FileSystem/DirHandler.php | DirHandler._list | private function _list(string $path): array {
$result = [];
$scan = glob($path . '/*');
foreach ($scan as $item) {
if (is_dir($item)) {
$result[basename($item)] = $this->_list($item);
} else {
$result[] = basename($item);
}
... | php | private function _list(string $path): array {
$result = [];
$scan = glob($path . '/*');
foreach ($scan as $item) {
if (is_dir($item)) {
$result[basename($item)] = $this->_list($item);
} else {
$result[] = basename($item);
}
... | [
"private",
"function",
"_list",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"scan",
"=",
"glob",
"(",
"$",
"path",
".",
"'/*'",
")",
";",
"foreach",
"(",
"$",
"scan",
"as",
"$",
"item",
")",
"{",
... | lists every item in a given dir
see here: https://stackoverflow.com/a/49066335/1966490
@param string $path
@return array | [
"lists",
"every",
"item",
"in",
"a",
"given",
"dir"
] | 4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5 | https://github.com/doganoo/PHPUtil/blob/4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5/src/FileSystem/DirHandler.php#L112-L123 |
32,919 | doganoo/PHPUtil | src/FileSystem/DirHandler.php | DirHandler._findFile | private function _findFile(string $dirName, string $fileName): ?FileHandler {
$dirs = glob($dirName . '*');
$file = null;
foreach ($dirs as $d) {
if (is_file($d)) {
$pathInfo = \pathinfo($d);
$pathInfo2 = \pathinfo($fileName);
if (isse... | php | private function _findFile(string $dirName, string $fileName): ?FileHandler {
$dirs = glob($dirName . '*');
$file = null;
foreach ($dirs as $d) {
if (is_file($d)) {
$pathInfo = \pathinfo($d);
$pathInfo2 = \pathinfo($fileName);
if (isse... | [
"private",
"function",
"_findFile",
"(",
"string",
"$",
"dirName",
",",
"string",
"$",
"fileName",
")",
":",
"?",
"FileHandler",
"{",
"$",
"dirs",
"=",
"glob",
"(",
"$",
"dirName",
".",
"'*'",
")",
";",
"$",
"file",
"=",
"null",
";",
"foreach",
"(",
... | finds a file in the given dir
@param $dirName
@param $fileName
@return string | [
"finds",
"a",
"file",
"in",
"the",
"given",
"dir"
] | 4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5 | https://github.com/doganoo/PHPUtil/blob/4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5/src/FileSystem/DirHandler.php#L193-L218 |
32,920 | doganoo/PHPUtil | src/Util/ArrayUtil.php | ArrayUtil.hasSum | public static function hasSum(array $numbers, int $target): bool {
$collection = ArrayUtil::sumCollection($numbers, $target);
if (null === $collection) return false;
if (0 === \count($collection)) return false;
return true;
} | php | public static function hasSum(array $numbers, int $target): bool {
$collection = ArrayUtil::sumCollection($numbers, $target);
if (null === $collection) return false;
if (0 === \count($collection)) return false;
return true;
} | [
"public",
"static",
"function",
"hasSum",
"(",
"array",
"$",
"numbers",
",",
"int",
"$",
"target",
")",
":",
"bool",
"{",
"$",
"collection",
"=",
"ArrayUtil",
"::",
"sumCollection",
"(",
"$",
"numbers",
",",
"$",
"target",
")",
";",
"if",
"(",
"null",
... | returns a boolean that indicates whether a sequence sums up to a value or not
@param array $numbers
@param int $target
@return bool | [
"returns",
"a",
"boolean",
"that",
"indicates",
"whether",
"a",
"sequence",
"sums",
"up",
"to",
"a",
"value",
"or",
"not"
] | 4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5 | https://github.com/doganoo/PHPUtil/blob/4415a014b4448b1ddf6d2e3f0f0d39cd1a83b8f5/src/Util/ArrayUtil.php#L67-L72 |
32,921 | nails/module-invoice | src/Factory/ChargeRequest.php | ChargeRequest.setCardNumber | public function setCardNumber($sCardNumber)
{
// Validate
if (preg_match('/[^\d ]/', $sCardNumber)) {
throw new ChargeRequestException('Invalid card number; can only contain digits and spaces.', 1);
}
$this->oCard->number = $sCardNumber;
return $this;
} | php | public function setCardNumber($sCardNumber)
{
// Validate
if (preg_match('/[^\d ]/', $sCardNumber)) {
throw new ChargeRequestException('Invalid card number; can only contain digits and spaces.', 1);
}
$this->oCard->number = $sCardNumber;
return $this;
} | [
"public",
"function",
"setCardNumber",
"(",
"$",
"sCardNumber",
")",
"{",
"// Validate",
"if",
"(",
"preg_match",
"(",
"'/[^\\d ]/'",
",",
"$",
"sCardNumber",
")",
")",
"{",
"throw",
"new",
"ChargeRequestException",
"(",
"'Invalid card number; can only contain digits... | Set the card's number
@param string $sCardNumber The card's number
@throws ChargeRequestException
@return $this | [
"Set",
"the",
"card",
"s",
"number"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ChargeRequest.php#L91-L100 |
32,922 | nails/module-invoice | src/Factory/ChargeRequest.php | ChargeRequest.setCardExpMonth | public function setCardExpMonth($sCardExpMonth)
{
// Validate
if (is_numeric($sCardExpMonth)) {
$iMonth = (int) $sCardExpMonth;
if ($iMonth < 1 || $iMonth > 12) {
throw new ChargeRequestException(
'"' . $sCardExpMonth . '" is an invalid ... | php | public function setCardExpMonth($sCardExpMonth)
{
// Validate
if (is_numeric($sCardExpMonth)) {
$iMonth = (int) $sCardExpMonth;
if ($iMonth < 1 || $iMonth > 12) {
throw new ChargeRequestException(
'"' . $sCardExpMonth . '" is an invalid ... | [
"public",
"function",
"setCardExpMonth",
"(",
"$",
"sCardExpMonth",
")",
"{",
"// Validate",
"if",
"(",
"is_numeric",
"(",
"$",
"sCardExpMonth",
")",
")",
"{",
"$",
"iMonth",
"=",
"(",
"int",
")",
"$",
"sCardExpMonth",
";",
"if",
"(",
"$",
"iMonth",
"<"... | Set the card's expiry month
@param string $sCardExpMonth The card's expiry month
@throws ChargeRequestException
@return $this | [
"Set",
"the",
"card",
"s",
"expiry",
"month"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ChargeRequest.php#L123-L147 |
32,923 | nails/module-invoice | src/Factory/ChargeRequest.php | ChargeRequest.setCardExpYear | public function setCardExpYear($sCardExpYear)
{
// Validate
if (is_numeric($sCardExpYear)) {
// Accept two digits or 4 digits only
if (strlen($sCardExpYear) == 2 || strlen($sCardExpYear) == 4) {
// Two digit values should be turned into a 4 digit value
... | php | public function setCardExpYear($sCardExpYear)
{
// Validate
if (is_numeric($sCardExpYear)) {
// Accept two digits or 4 digits only
if (strlen($sCardExpYear) == 2 || strlen($sCardExpYear) == 4) {
// Two digit values should be turned into a 4 digit value
... | [
"public",
"function",
"setCardExpYear",
"(",
"$",
"sCardExpYear",
")",
"{",
"// Validate",
"if",
"(",
"is_numeric",
"(",
"$",
"sCardExpYear",
")",
")",
"{",
"// Accept two digits or 4 digits only",
"if",
"(",
"strlen",
"(",
"$",
"sCardExpYear",
")",
"==",
"2",... | Set the card's expiry year
@param string $sCardExpYear The card's expiry year
@throws ChargeRequestException
@return $this | [
"Set",
"the",
"card",
"s",
"expiry",
"year"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ChargeRequest.php#L170-L211 |
32,924 | nails/module-invoice | src/Factory/ChargeRequest.php | ChargeRequest.getCustomField | public function getCustomField($sProperty)
{
return property_exists($this->oCustomField, $sProperty) ? $this->oCustomField->{$sProperty} : null;
} | php | public function getCustomField($sProperty)
{
return property_exists($this->oCustomField, $sProperty) ? $this->oCustomField->{$sProperty} : null;
} | [
"public",
"function",
"getCustomField",
"(",
"$",
"sProperty",
")",
"{",
"return",
"property_exists",
"(",
"$",
"this",
"->",
"oCustomField",
",",
"$",
"sProperty",
")",
"?",
"$",
"this",
"->",
"oCustomField",
"->",
"{",
"$",
"sProperty",
"}",
":",
"null",... | Retrieve a custom field
@param string $sProperty The property to retrieve
@return mixed | [
"Retrieve",
"a",
"custom",
"field"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ChargeRequest.php#L276-L279 |
32,925 | nails/module-invoice | src/Factory/ChargeRequest.php | ChargeRequest.getCustomData | public function getCustomData($sProperty)
{
return property_exists($this->oCustomData, $sProperty) ? $this->oCustomData->{$sProperty} : null;
} | php | public function getCustomData($sProperty)
{
return property_exists($this->oCustomData, $sProperty) ? $this->oCustomData->{$sProperty} : null;
} | [
"public",
"function",
"getCustomData",
"(",
"$",
"sProperty",
")",
"{",
"return",
"property_exists",
"(",
"$",
"this",
"->",
"oCustomData",
",",
"$",
"sProperty",
")",
"?",
"$",
"this",
"->",
"oCustomData",
"->",
"{",
"$",
"sProperty",
"}",
":",
"null",
... | Retrieve a custom value
@param string $sProperty The property to retrieve
@return mixed | [
"Retrieve",
"a",
"custom",
"value"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ChargeRequest.php#L306-L309 |
32,926 | QoboLtd/qobo-robo | src/App.php | App.getCommands | protected function getCommands()
{
// construct command classes path depending on grp_cmd flag
$cmdPath = rtrim(__DIR__ . "/" . $this->data['cmd_path'], '/') . '/';
$cmdPath .= ($this->data['grp_cmd']) ? "*/*.php" : "*.php";
// construct commad path regex depending on grp_cmd flag
... | php | protected function getCommands()
{
// construct command classes path depending on grp_cmd flag
$cmdPath = rtrim(__DIR__ . "/" . $this->data['cmd_path'], '/') . '/';
$cmdPath .= ($this->data['grp_cmd']) ? "*/*.php" : "*.php";
// construct commad path regex depending on grp_cmd flag
... | [
"protected",
"function",
"getCommands",
"(",
")",
"{",
"// construct command classes path depending on grp_cmd flag",
"$",
"cmdPath",
"=",
"rtrim",
"(",
"__DIR__",
".",
"\"/\"",
".",
"$",
"this",
"->",
"data",
"[",
"'cmd_path'",
"]",
",",
"'/'",
")",
".",
"'/'",... | Get list of available command classes
@return array List of command classes | [
"Get",
"list",
"of",
"available",
"command",
"classes"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/App.php#L112-L150 |
32,927 | QoboLtd/qobo-robo | src/Command/Project/Branch.php | Branch.projectBranch | public function projectBranch($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskProjectBranch()
->run();
if (!$result->wasSuccessful()) {
$this->exitError("Failed to run command");
}
$data = $result->getData();
return new Property... | php | public function projectBranch($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskProjectBranch()
->run();
if (!$result->wasSuccessful()) {
$this->exitError("Failed to run command");
}
$data = $result->getData();
return new Property... | [
"public",
"function",
"projectBranch",
"(",
"$",
"opts",
"=",
"[",
"'format'",
"=>",
"'table'",
",",
"'fields'",
"=>",
"''",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskProjectBranch",
"(",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",
... | Get current project branch
@return \Qobo\Robo\Formatter\PropertyList | [
"Get",
"current",
"project",
"branch"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Command/Project/Branch.php#L24-L35 |
32,928 | hiqdev/hipanel-module-domain | src/models/Domain.php | Domain.isZone | public function isZone($zones)
{
$zone = $this->getZone();
return is_array($zones) ? in_array($this->getZone(), $zones, true) : $zone === $zones;
} | php | public function isZone($zones)
{
$zone = $this->getZone();
return is_array($zones) ? in_array($this->getZone(), $zones, true) : $zone === $zones;
} | [
"public",
"function",
"isZone",
"(",
"$",
"zones",
")",
"{",
"$",
"zone",
"=",
"$",
"this",
"->",
"getZone",
"(",
")",
";",
"return",
"is_array",
"(",
"$",
"zones",
")",
"?",
"in_array",
"(",
"$",
"this",
"->",
"getZone",
"(",
")",
",",
"$",
"zon... | a
Returns true if the zone is among given list of zones.
@param array|string $zones zone or list of zones
@return bool | [
"a",
"Returns",
"true",
"if",
"the",
"zone",
"is",
"among",
"given",
"list",
"of",
"zones",
"."
] | b1b02782fcb69970cacafe6c6ead238b14b54209 | https://github.com/hiqdev/hipanel-module-domain/blob/b1b02782fcb69970cacafe6c6ead238b14b54209/src/models/Domain.php#L707-L712 |
32,929 | SimpleBus/Serialization | src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php | StandardMessageInEnvelopeSerializer.wrapAndSerialize | public function wrapAndSerialize($message)
{
$envelope = $this->envelopeFactory->wrapMessageInEnvelope($message);
$serializedMessage = $this->objectSerializer->serialize($message);
return $this->objectSerializer->serialize($envelope->withSerializedMessage($serializedMessage));
} | php | public function wrapAndSerialize($message)
{
$envelope = $this->envelopeFactory->wrapMessageInEnvelope($message);
$serializedMessage = $this->objectSerializer->serialize($message);
return $this->objectSerializer->serialize($envelope->withSerializedMessage($serializedMessage));
} | [
"public",
"function",
"wrapAndSerialize",
"(",
"$",
"message",
")",
"{",
"$",
"envelope",
"=",
"$",
"this",
"->",
"envelopeFactory",
"->",
"wrapMessageInEnvelope",
"(",
"$",
"message",
")",
";",
"$",
"serializedMessage",
"=",
"$",
"this",
"->",
"objectSerializ... | Serialize a Message by wrapping it in an Envelope and serializing the envelope
@{inheritdoc} | [
"Serialize",
"a",
"Message",
"by",
"wrapping",
"it",
"in",
"an",
"Envelope",
"and",
"serializing",
"the",
"envelope"
] | b69f896cfdbd798b8e83d79c6c87a051f0469183 | https://github.com/SimpleBus/Serialization/blob/b69f896cfdbd798b8e83d79c6c87a051f0469183/src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php#L34-L41 |
32,930 | SimpleBus/Serialization | src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php | StandardMessageInEnvelopeSerializer.unwrapAndDeserialize | public function unwrapAndDeserialize($serializedEnvelope)
{
$envelope = $this->deserializeEnvelope($serializedEnvelope);
$message = $this->deserializeMessage($envelope->serializedMessage(), $envelope->messageType());
return $envelope->withMessage($message);
} | php | public function unwrapAndDeserialize($serializedEnvelope)
{
$envelope = $this->deserializeEnvelope($serializedEnvelope);
$message = $this->deserializeMessage($envelope->serializedMessage(), $envelope->messageType());
return $envelope->withMessage($message);
} | [
"public",
"function",
"unwrapAndDeserialize",
"(",
"$",
"serializedEnvelope",
")",
"{",
"$",
"envelope",
"=",
"$",
"this",
"->",
"deserializeEnvelope",
"(",
"$",
"serializedEnvelope",
")",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"deserializeMessage",
"(",
... | Deserialize a Message that was wrapped in an Envelope
@{inheritdoc} | [
"Deserialize",
"a",
"Message",
"that",
"was",
"wrapped",
"in",
"an",
"Envelope"
] | b69f896cfdbd798b8e83d79c6c87a051f0469183 | https://github.com/SimpleBus/Serialization/blob/b69f896cfdbd798b8e83d79c6c87a051f0469183/src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php#L48-L55 |
32,931 | SimpleBus/Serialization | src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php | StandardMessageInEnvelopeSerializer.deserializeEnvelope | private function deserializeEnvelope($serializedEnvelope)
{
$envelopeClass = $this->envelopeFactory->envelopeClass();
$envelope = $this->objectSerializer->deserialize(
$serializedEnvelope,
$envelopeClass
);
if (!($envelope instanceof $envelopeClass)) {
... | php | private function deserializeEnvelope($serializedEnvelope)
{
$envelopeClass = $this->envelopeFactory->envelopeClass();
$envelope = $this->objectSerializer->deserialize(
$serializedEnvelope,
$envelopeClass
);
if (!($envelope instanceof $envelopeClass)) {
... | [
"private",
"function",
"deserializeEnvelope",
"(",
"$",
"serializedEnvelope",
")",
"{",
"$",
"envelopeClass",
"=",
"$",
"this",
"->",
"envelopeFactory",
"->",
"envelopeClass",
"(",
")",
";",
"$",
"envelope",
"=",
"$",
"this",
"->",
"objectSerializer",
"->",
"d... | Deserialize the message Envelope
@param string $serializedEnvelope
@return Envelope | [
"Deserialize",
"the",
"message",
"Envelope"
] | b69f896cfdbd798b8e83d79c6c87a051f0469183 | https://github.com/SimpleBus/Serialization/blob/b69f896cfdbd798b8e83d79c6c87a051f0469183/src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php#L63-L81 |
32,932 | SimpleBus/Serialization | src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php | StandardMessageInEnvelopeSerializer.deserializeMessage | private function deserializeMessage($serializedMessage, $messageClass)
{
$message = $this->objectSerializer->deserialize($serializedMessage, $messageClass);
if (!($message instanceof $messageClass)) {
throw new \LogicException(
sprintf(
'Expected dese... | php | private function deserializeMessage($serializedMessage, $messageClass)
{
$message = $this->objectSerializer->deserialize($serializedMessage, $messageClass);
if (!($message instanceof $messageClass)) {
throw new \LogicException(
sprintf(
'Expected dese... | [
"private",
"function",
"deserializeMessage",
"(",
"$",
"serializedMessage",
",",
"$",
"messageClass",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"objectSerializer",
"->",
"deserialize",
"(",
"$",
"serializedMessage",
",",
"$",
"messageClass",
")",
";",
... | Deserialize the Message
@param string $serializedMessage
@param string $messageClass
@return object Of type $messageClass | [
"Deserialize",
"the",
"Message"
] | b69f896cfdbd798b8e83d79c6c87a051f0469183 | https://github.com/SimpleBus/Serialization/blob/b69f896cfdbd798b8e83d79c6c87a051f0469183/src/Envelope/Serializer/StandardMessageInEnvelopeSerializer.php#L90-L104 |
32,933 | canihavesomecoffee/theTVDbAPI | src/MultiLanguageWrapper/Route/SearchRouteLanguageFallback.php | SearchRouteLanguageFallback.getClosureForSearch | public function getClosureForSearch(array $options): Closure
{
return function ($language) use ($options) {
$json = $this->parent->performAPICallWithJsonResponse(
'get',
'/search/series',
array_merge($options, ['headers' => ['Accept-Language' => $l... | php | public function getClosureForSearch(array $options): Closure
{
return function ($language) use ($options) {
$json = $this->parent->performAPICallWithJsonResponse(
'get',
'/search/series',
array_merge($options, ['headers' => ['Accept-Language' => $l... | [
"public",
"function",
"getClosureForSearch",
"(",
"array",
"$",
"options",
")",
":",
"Closure",
"{",
"return",
"function",
"(",
"$",
"language",
")",
"use",
"(",
"$",
"options",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"parent",
"->",
"performAPICa... | Returns the closure used to execute a search for a single language.
@param array $options The options for the search.
@return Closure | [
"Returns",
"the",
"closure",
"used",
"to",
"execute",
"a",
"search",
"for",
"a",
"single",
"language",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/MultiLanguageWrapper/Route/SearchRouteLanguageFallback.php#L81-L91 |
32,934 | orchestral/support | src/Support/Collection.php | Collection.streamCsv | public function streamCsv()
{
$delimiter = ',';
$enclosure = '"';
$header = $this->resolveCsvHeader();
$stream = \fopen('php://output', 'r+');
\fputcsv($stream, $header, $delimiter, $enclosure);
foreach ($this->items as $key => $item) {
\fputcsv($stream... | php | public function streamCsv()
{
$delimiter = ',';
$enclosure = '"';
$header = $this->resolveCsvHeader();
$stream = \fopen('php://output', 'r+');
\fputcsv($stream, $header, $delimiter, $enclosure);
foreach ($this->items as $key => $item) {
\fputcsv($stream... | [
"public",
"function",
"streamCsv",
"(",
")",
"{",
"$",
"delimiter",
"=",
"','",
";",
"$",
"enclosure",
"=",
"'\"'",
";",
"$",
"header",
"=",
"$",
"this",
"->",
"resolveCsvHeader",
"(",
")",
";",
"$",
"stream",
"=",
"\\",
"fopen",
"(",
"'php://output'",... | Stream CSV output.
@return object | [
"Stream",
"CSV",
"output",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Collection.php#L29-L44 |
32,935 | QoboLtd/qobo-robo | src/Utility/File.php | File.readLines | public static function readLines($path, $skipEmpty = false)
{
if (!is_file($path) || !is_readable($path)) {
throw new RuntimeException("File '$path' doesn't exist or is not a readable file");
}
$lines = ($skipEmpty)
? file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EM... | php | public static function readLines($path, $skipEmpty = false)
{
if (!is_file($path) || !is_readable($path)) {
throw new RuntimeException("File '$path' doesn't exist or is not a readable file");
}
$lines = ($skipEmpty)
? file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EM... | [
"public",
"static",
"function",
"readLines",
"(",
"$",
"path",
",",
"$",
"skipEmpty",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
"||",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"RuntimeExcepti... | Read file content into array of lines without trailing newlines
@param string $path Path to file
@param bool $skipEmpty Flag to skip empty lines
@return array Lines of file content | [
"Read",
"file",
"content",
"into",
"array",
"of",
"lines",
"without",
"trailing",
"newlines"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Utility/File.php#L29-L45 |
32,936 | QoboLtd/qobo-robo | src/Utility/File.php | File.writeLines | public static function writeLines($path, $lines)
{
if (is_file($path) && !is_writable($path)) {
throw new RuntimeException("File '$path' is not a writable file");
}
// make sure every line has only one newline at the end
$lines = array_map(function ($line) {
... | php | public static function writeLines($path, $lines)
{
if (is_file($path) && !is_writable($path)) {
throw new RuntimeException("File '$path' is not a writable file");
}
// make sure every line has only one newline at the end
$lines = array_map(function ($line) {
... | [
"public",
"static",
"function",
"writeLines",
"(",
"$",
"path",
",",
"$",
"lines",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"path",
")",
"&&",
"!",
"is_writable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"File '$path... | Write array of lines into file
@param string $path Path to file
@param array $lines Content array
@return bool true on success | [
"Write",
"array",
"of",
"lines",
"into",
"file"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Utility/File.php#L67-L84 |
32,937 | anomalylabs/variables-module | src/Variable/Form/VariableFormBuilder.php | VariableFormBuilder.onReady | public function onReady(Container $container)
{
/* @var EntryModel $model */
$model = $container->make($this->getModel());
if ($model->isVersionable()) {
$this->setButtons(
[
'versions' => [
'href' => 'admin/variables/... | php | public function onReady(Container $container)
{
/* @var EntryModel $model */
$model = $container->make($this->getModel());
if ($model->isVersionable()) {
$this->setButtons(
[
'versions' => [
'href' => 'admin/variables/... | [
"public",
"function",
"onReady",
"(",
"Container",
"$",
"container",
")",
"{",
"/* @var EntryModel $model */",
"$",
"model",
"=",
"$",
"container",
"->",
"make",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
";",
"if",
"(",
"$",
"model",
"->",
"isVe... | Fired just before building.
@param Container $container | [
"Fired",
"just",
"before",
"building",
"."
] | bcd903670471a175f07aba3123693cb3a3c07d0b | https://github.com/anomalylabs/variables-module/blob/bcd903670471a175f07aba3123693cb3a3c07d0b/src/Variable/Form/VariableFormBuilder.php#L22-L38 |
32,938 | pxgamer/arionum-php | src/Arionum.php | Arionum.sendTransaction | public function sendTransaction(Transaction $transaction): string
{
$data = array_merge((array)$transaction, [
'q' => 'send',
]);
return $this->getJson($data);
} | php | public function sendTransaction(Transaction $transaction): string
{
$data = array_merge((array)$transaction, [
'q' => 'send',
]);
return $this->getJson($data);
} | [
"public",
"function",
"sendTransaction",
"(",
"Transaction",
"$",
"transaction",
")",
":",
"string",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"(",
"array",
")",
"$",
"transaction",
",",
"[",
"'q'",
"=>",
"'send'",
",",
"]",
")",
";",
"return",
"$",
"... | Send a transaction.
@param Transaction $transaction
@return string
@throws ApiException
@api | [
"Send",
"a",
"transaction",
"."
] | 1d3e73f7b661878b864b3a910faad540e6af47bb | https://github.com/pxgamer/arionum-php/blob/1d3e73f7b661878b864b3a910faad540e6af47bb/src/Arionum.php#L281-L288 |
32,939 | pxgamer/arionum-php | src/Arionum.php | Arionum.getRandomNumber | public function getRandomNumber(int $height, int $minimum, int $maximum, string $seed = null): int
{
return $this->getJson([
'q' => 'randomNumber',
'height' => $height,
'min' => $minimum,
'max' => $maximum,
'seed' => $seed,
]);
} | php | public function getRandomNumber(int $height, int $minimum, int $maximum, string $seed = null): int
{
return $this->getJson([
'q' => 'randomNumber',
'height' => $height,
'min' => $minimum,
'max' => $maximum,
'seed' => $seed,
]);
} | [
"public",
"function",
"getRandomNumber",
"(",
"int",
"$",
"height",
",",
"int",
"$",
"minimum",
",",
"int",
"$",
"maximum",
",",
"string",
"$",
"seed",
"=",
"null",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"getJson",
"(",
"[",
"'q'",
"=>",
... | Retrieve a random number based on a specified block.
@param int $height
@param int $minimum
@param int $maximum
@param string|null $seed
@return int
@throws ApiException
@api | [
"Retrieve",
"a",
"random",
"number",
"based",
"on",
"a",
"specified",
"block",
"."
] | 1d3e73f7b661878b864b3a910faad540e6af47bb | https://github.com/pxgamer/arionum-php/blob/1d3e73f7b661878b864b3a910faad540e6af47bb/src/Arionum.php#L315-L324 |
32,940 | pxgamer/arionum-php | src/Arionum.php | Arionum.checkSignature | public function checkSignature(string $signature, string $data, string $publicKey): bool
{
return $this->getJson([
'q' => 'checkSignature',
'signature' => $signature,
'data' => $data,
'public_key' => $publicKey,
]);
} | php | public function checkSignature(string $signature, string $data, string $publicKey): bool
{
return $this->getJson([
'q' => 'checkSignature',
'signature' => $signature,
'data' => $data,
'public_key' => $publicKey,
]);
} | [
"public",
"function",
"checkSignature",
"(",
"string",
"$",
"signature",
",",
"string",
"$",
"data",
",",
"string",
"$",
"publicKey",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"getJson",
"(",
"[",
"'q'",
"=>",
"'checkSignature'",
",",
"'signature... | Check that a signature is valid against a public key.
@param string $signature
@param string $data
@param string $publicKey
@return bool
@throws ApiException
@api | [
"Check",
"that",
"a",
"signature",
"is",
"valid",
"against",
"a",
"public",
"key",
"."
] | 1d3e73f7b661878b864b3a910faad540e6af47bb | https://github.com/pxgamer/arionum-php/blob/1d3e73f7b661878b864b3a910faad540e6af47bb/src/Arionum.php#L336-L344 |
32,941 | pxgamer/arionum-php | src/Arionum.php | Arionum.checkAddress | public function checkAddress(string $address, ?string $publicKey = null): bool
{
return $this->getJson([
'q' => 'checkAddress',
'account' => $address,
'public_key' => $publicKey,
]);
} | php | public function checkAddress(string $address, ?string $publicKey = null): bool
{
return $this->getJson([
'q' => 'checkAddress',
'account' => $address,
'public_key' => $publicKey,
]);
} | [
"public",
"function",
"checkAddress",
"(",
"string",
"$",
"address",
",",
"?",
"string",
"$",
"publicKey",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"getJson",
"(",
"[",
"'q'",
"=>",
"'checkAddress'",
",",
"'account'",
"=>",
"$",
... | Check that an address is valid.
Optionally validate it against the corresponding public key.
@param string $address
@param string|null $publicKey An optional corresponding public key.
@return bool
@throws ApiException
@api | [
"Check",
"that",
"an",
"address",
"is",
"valid",
".",
"Optionally",
"validate",
"it",
"against",
"the",
"corresponding",
"public",
"key",
"."
] | 1d3e73f7b661878b864b3a910faad540e6af47bb | https://github.com/pxgamer/arionum-php/blob/1d3e73f7b661878b864b3a910faad540e6af47bb/src/Arionum.php#L414-L421 |
32,942 | nails/module-invoice | src/Model/Refund.php | Refund.setPending | public function setPending($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_PENDING;
return $this->update($iRefundId, $aData);
} | php | public function setPending($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_PENDING;
return $this->update($iRefundId, $aData);
} | [
"public",
"function",
"setPending",
"(",
"$",
"iRefundId",
",",
"$",
"aData",
"=",
"[",
"]",
")",
"{",
"$",
"aData",
"[",
"'status'",
"]",
"=",
"self",
"::",
"STATUS_PENDING",
";",
"return",
"$",
"this",
"->",
"update",
"(",
"$",
"iRefundId",
",",
"$... | Set a refund as PENDING
@param integer $iRefundId The refund to update
@param array $aData Any additional data to save to the transaction
@return boolean | [
"Set",
"a",
"refund",
"as",
"PENDING"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Refund.php#L222-L226 |
32,943 | nails/module-invoice | src/Model/Refund.php | Refund.setProcessing | public function setProcessing($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_PROCESSING;
return $this->update($iRefundId, $aData);
} | php | public function setProcessing($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_PROCESSING;
return $this->update($iRefundId, $aData);
} | [
"public",
"function",
"setProcessing",
"(",
"$",
"iRefundId",
",",
"$",
"aData",
"=",
"[",
"]",
")",
"{",
"$",
"aData",
"[",
"'status'",
"]",
"=",
"self",
"::",
"STATUS_PROCESSING",
";",
"return",
"$",
"this",
"->",
"update",
"(",
"$",
"iRefundId",
","... | Set a refund as PROCESSING
@param integer $iRefundId The refund to update
@param array $aData Any additional data to save to the transaction
@return boolean | [
"Set",
"a",
"refund",
"as",
"PROCESSING"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Refund.php#L238-L242 |
32,944 | nails/module-invoice | src/Model/Refund.php | Refund.setFailed | public function setFailed($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_FAILED;
return $this->update($iRefundId, $aData);
} | php | public function setFailed($iRefundId, $aData = [])
{
$aData['status'] = self::STATUS_FAILED;
return $this->update($iRefundId, $aData);
} | [
"public",
"function",
"setFailed",
"(",
"$",
"iRefundId",
",",
"$",
"aData",
"=",
"[",
"]",
")",
"{",
"$",
"aData",
"[",
"'status'",
"]",
"=",
"self",
"::",
"STATUS_FAILED",
";",
"return",
"$",
"this",
"->",
"update",
"(",
"$",
"iRefundId",
",",
"$",... | Set a refund as FAILED
@param integer $iRefundId The refund to update
@param array $aData Any additional data to save to the transaction
@return boolean | [
"Set",
"a",
"refund",
"as",
"FAILED"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Refund.php#L270-L274 |
32,945 | nails/module-invoice | src/Model/Refund.php | Refund.sendReceipt | public function sendReceipt($iRefundId, $sEmailOverride = null)
{
try {
$oRefund = $this->getById(
$iRefundId,
[
'expand' => [
['invoice', ['expand' => ['customer']]],
'payment',
... | php | public function sendReceipt($iRefundId, $sEmailOverride = null)
{
try {
$oRefund = $this->getById(
$iRefundId,
[
'expand' => [
['invoice', ['expand' => ['customer']]],
'payment',
... | [
"public",
"function",
"sendReceipt",
"(",
"$",
"iRefundId",
",",
"$",
"sEmailOverride",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"oRefund",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"iRefundId",
",",
"[",
"'expand'",
"=>",
"[",
"[",
"'invoice'",
",",... | Sends refund receipt email
@param integer $iRefundId The ID of the refund
@param string $sEmailOverride The email address to send the email to
@return bool | [
"Sends",
"refund",
"receipt",
"email"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Refund.php#L286-L362 |
32,946 | nails/module-invoice | src/Model/Refund.php | Refund.getRefundForEvent | protected function getRefundForEvent(int $iRefundId): Resource
{
$oRefund = $this->getById($iRefundId);
if (empty($oRefund)) {
throw new ModelException('Invalid refund ID');
}
return $oRefund;
} | php | protected function getRefundForEvent(int $iRefundId): Resource
{
$oRefund = $this->getById($iRefundId);
if (empty($oRefund)) {
throw new ModelException('Invalid refund ID');
}
return $oRefund;
} | [
"protected",
"function",
"getRefundForEvent",
"(",
"int",
"$",
"iRefundId",
")",
":",
"Resource",
"{",
"$",
"oRefund",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"iRefundId",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"oRefund",
")",
")",
"{",
"throw",
... | Get a refund in a suitable format for the event triggers
@param int $iRefundId The refund ID
@return Resource
@throws ModelException | [
"Get",
"a",
"refund",
"in",
"a",
"suitable",
"format",
"for",
"the",
"event",
"triggers"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Refund.php#L374-L381 |
32,947 | Saritasa/php-laravel-entity-services | src/LaravelEntityServicesServiceProvider.php | LaravelEntityServicesServiceProvider.boot | public function boot(): void
{
$this->publishes(
[
__DIR__ . '/../config/laravel_entity_services.php' =>
$this->app->make('path.config') . DIRECTORY_SEPARATOR . 'laravel_entity_services.php',
],
'laravel_repositories'
);
... | php | public function boot(): void
{
$this->publishes(
[
__DIR__ . '/../config/laravel_entity_services.php' =>
$this->app->make('path.config') . DIRECTORY_SEPARATOR . 'laravel_entity_services.php',
],
'laravel_repositories'
);
... | [
"public",
"function",
"boot",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/../config/laravel_entity_services.php'",
"=>",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'path.config'",
")",
".",
"DIRECTORY_SEPARATOR",... | Make package settings needed to correct work.
@return void
@throws BindingResolutionException | [
"Make",
"package",
"settings",
"needed",
"to",
"correct",
"work",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/LaravelEntityServicesServiceProvider.php#L33-L45 |
32,948 | Saritasa/php-laravel-entity-services | src/LaravelEntityServicesServiceProvider.php | LaravelEntityServicesServiceProvider.registerCustomBindings | protected function registerCustomBindings(): void
{
$entityServiceFactory = $this->app->make(IEntityServiceFactory::class);
foreach (config('laravel_entity_services.bindings') as $className => $entityService) {
$entityServiceFactory->register($className, $entityService);
}
} | php | protected function registerCustomBindings(): void
{
$entityServiceFactory = $this->app->make(IEntityServiceFactory::class);
foreach (config('laravel_entity_services.bindings') as $className => $entityService) {
$entityServiceFactory->register($className, $entityService);
}
} | [
"protected",
"function",
"registerCustomBindings",
"(",
")",
":",
"void",
"{",
"$",
"entityServiceFactory",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"IEntityServiceFactory",
"::",
"class",
")",
";",
"foreach",
"(",
"config",
"(",
"'laravel_entity_servic... | Register custom entity services implementations.
@return void
@throws BindingResolutionException | [
"Register",
"custom",
"entity",
"services",
"implementations",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/LaravelEntityServicesServiceProvider.php#L54-L61 |
32,949 | Saritasa/php-laravel-entity-services | src/Services/EntityService.php | EntityService.getValidationRulesForAttributes | protected function getValidationRulesForAttributes(array $modelParams, array $rules = []): array
{
$modelRules = empty($rules) ? $this->getValidationRules() : $rules;
return array_intersect_key($modelRules, $modelParams);
} | php | protected function getValidationRulesForAttributes(array $modelParams, array $rules = []): array
{
$modelRules = empty($rules) ? $this->getValidationRules() : $rules;
return array_intersect_key($modelRules, $modelParams);
} | [
"protected",
"function",
"getValidationRulesForAttributes",
"(",
"array",
"$",
"modelParams",
",",
"array",
"$",
"rules",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"modelRules",
"=",
"empty",
"(",
"$",
"rules",
")",
"?",
"$",
"this",
"->",
"getValidation... | Return rules for given attributes.
@param array $modelParams Updating fields
@param array $rules Custom validation rules
@return array | [
"Return",
"rules",
"for",
"given",
"attributes",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/Services/EntityService.php#L120-L124 |
32,950 | Saritasa/php-laravel-entity-services | src/Services/EntityService.php | EntityService.validate | protected function validate(array $data, array $rules = null): void
{
$validator = $this->validatorFactory->make($data, $rules ?? $this->getValidationRules());
if ($validator->fails()) {
throw new ValidationException($validator);
}
} | php | protected function validate(array $data, array $rules = null): void
{
$validator = $this->validatorFactory->make($data, $rules ?? $this->getValidationRules());
if ($validator->fails()) {
throw new ValidationException($validator);
}
} | [
"protected",
"function",
"validate",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"rules",
"=",
"null",
")",
":",
"void",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"validatorFactory",
"->",
"make",
"(",
"$",
"data",
",",
"$",
"rules",
"??",
"$"... | Validates data.
@param array $data Data to validate
@param array|null $rules Validation rules
@throws ValidationException
@return void | [
"Validates",
"data",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/Services/EntityService.php#L163-L169 |
32,951 | Saritasa/php-laravel-entity-services | src/Services/EntityService.php | EntityService.getValidationRules | protected function getValidationRules(): array
{
$validationRulesFromRepository = $this->repository->getModelValidationRules();
return !empty($validationRulesFromRepository) ? $validationRulesFromRepository : $this->validationRules;
} | php | protected function getValidationRules(): array
{
$validationRulesFromRepository = $this->repository->getModelValidationRules();
return !empty($validationRulesFromRepository) ? $validationRulesFromRepository : $this->validationRules;
} | [
"protected",
"function",
"getValidationRules",
"(",
")",
":",
"array",
"{",
"$",
"validationRulesFromRepository",
"=",
"$",
"this",
"->",
"repository",
"->",
"getModelValidationRules",
"(",
")",
";",
"return",
"!",
"empty",
"(",
"$",
"validationRulesFromRepository",... | Returns validation rules.
@return array | [
"Returns",
"validation",
"rules",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/Services/EntityService.php#L176-L181 |
32,952 | canihavesomecoffee/theTVDbAPI | src/MultiLanguageWrapper/Route/EpisodesRouteLanguageFallback.php | EpisodesRouteLanguageFallback.getClosureById | public function getClosureById(int $episodeId): Closure
{
return function ($language) use ($episodeId) {
$json = $this->parent->performAPICallWithJsonResponse(
'get',
'/episodes/'.$episodeId,
[
'headers' => ['Accept-Language' =>... | php | public function getClosureById(int $episodeId): Closure
{
return function ($language) use ($episodeId) {
$json = $this->parent->performAPICallWithJsonResponse(
'get',
'/episodes/'.$episodeId,
[
'headers' => ['Accept-Language' =>... | [
"public",
"function",
"getClosureById",
"(",
"int",
"$",
"episodeId",
")",
":",
"Closure",
"{",
"return",
"function",
"(",
"$",
"language",
")",
"use",
"(",
"$",
"episodeId",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"parent",
"->",
"performAPICallW... | Returns the closure used to fetch an episode by id
for a single language.
@param int $episodeId The episode to fetch.
@return Closure | [
"Returns",
"the",
"closure",
"used",
"to",
"fetch",
"an",
"episode",
"by",
"id",
"for",
"a",
"single",
"language",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/MultiLanguageWrapper/Route/EpisodesRouteLanguageFallback.php#L79-L91 |
32,953 | QoboLtd/qobo-robo | src/AbstractTask.php | AbstractTask.printInfo | protected function printInfo($msg, $data = null)
{
// pass-through when no 'name' found in data
if ($data == null || !isset($data['name'])) {
return $this->printTaskInfo($msg, $data);
}
// doubt someone will use this ever in data
$key = 'print_task_info_name_repl... | php | protected function printInfo($msg, $data = null)
{
// pass-through when no 'name' found in data
if ($data == null || !isset($data['name'])) {
return $this->printTaskInfo($msg, $data);
}
// doubt someone will use this ever in data
$key = 'print_task_info_name_repl... | [
"protected",
"function",
"printInfo",
"(",
"$",
"msg",
",",
"$",
"data",
"=",
"null",
")",
"{",
"// pass-through when no 'name' found in data",
"if",
"(",
"$",
"data",
"==",
"null",
"||",
"!",
"isset",
"(",
"$",
"data",
"[",
"'name'",
"]",
")",
")",
"{",... | A quick fix on printInfo, as it is not very friendly
when you use 'name' placeholders or even just have 'name'
set in the data | [
"A",
"quick",
"fix",
"on",
"printInfo",
"as",
"it",
"is",
"not",
"very",
"friendly",
"when",
"you",
"use",
"name",
"placeholders",
"or",
"even",
"just",
"have",
"name",
"set",
"in",
"the",
"data"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/AbstractTask.php#L156-L176 |
32,954 | byjg/restserver | src/HttpResponse.php | HttpResponse.addCookie | public function addCookie($name, $value, $expire = null, $path = null, $domain = null)
{
if (!is_null($expire)) {
$expire = time() + $expire;
}
setcookie($name, $value, $expire, $path, $domain);
} | php | public function addCookie($name, $value, $expire = null, $path = null, $domain = null)
{
if (!is_null($expire)) {
$expire = time() + $expire;
}
setcookie($name, $value, $expire, $path, $domain);
} | [
"public",
"function",
"addCookie",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"expire",
"=",
"null",
",",
"$",
"path",
"=",
"null",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"expire",
")",
")",
"{",
"$"... | Add a cookie value
@param string $name
@param string $value
@param int $expire (seconds from now)
@param int $path (directory into domain in which the cookie will be available on )
@param string $domain | [
"Add",
"a",
"cookie",
"value"
] | 1fdbd58f414f5d9958de0873d67eea961dc52fda | https://github.com/byjg/restserver/blob/1fdbd58f414f5d9958de0873d67eea961dc52fda/src/HttpResponse.php#L63-L69 |
32,955 | byjg/restserver | src/HttpResponse.php | HttpResponse.writeDebug | public function writeDebug($key, $string)
{
if (is_null($this->responseDebug)) {
$this->responseDebug = new ResponseBag();
$this->response->add($this->responseDebug);
}
$this->responseDebug->add(['debug' => [$key => $string]]);
ErrorHandler::getInstance()->add... | php | public function writeDebug($key, $string)
{
if (is_null($this->responseDebug)) {
$this->responseDebug = new ResponseBag();
$this->response->add($this->responseDebug);
}
$this->responseDebug->add(['debug' => [$key => $string]]);
ErrorHandler::getInstance()->add... | [
"public",
"function",
"writeDebug",
"(",
"$",
"key",
",",
"$",
"string",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"responseDebug",
")",
")",
"{",
"$",
"this",
"->",
"responseDebug",
"=",
"new",
"ResponseBag",
"(",
")",
";",
"$",
"this"... | Added informations for debug purposes only.
In case the error it will showed and the result a node called "debug" will be added.
@param string $key
@param mixed $string | [
"Added",
"informations",
"for",
"debug",
"purposes",
"only",
".",
"In",
"case",
"the",
"error",
"it",
"will",
"showed",
"and",
"the",
"result",
"a",
"node",
"called",
"debug",
"will",
"be",
"added",
"."
] | 1fdbd58f414f5d9958de0873d67eea961dc52fda | https://github.com/byjg/restserver/blob/1fdbd58f414f5d9958de0873d67eea961dc52fda/src/HttpResponse.php#L110-L118 |
32,956 | wikimedia/mediawiki-oauthclient-php | src/Client.php | Client.makeOAuthCall | public function makeOAuthCall(
/*Token*/ $token, $url, $isPost = false, array $postFields = null
) {
// Figure out if there is a file in postFields
$hasFile = false;
if ( is_array( $postFields ) ) {
foreach ( $postFields as $field ) {
if ( is_a( $field, 'CurlFile' ) ) {
$hasFile = true;
break;... | php | public function makeOAuthCall(
/*Token*/ $token, $url, $isPost = false, array $postFields = null
) {
// Figure out if there is a file in postFields
$hasFile = false;
if ( is_array( $postFields ) ) {
foreach ( $postFields as $field ) {
if ( is_a( $field, 'CurlFile' ) ) {
$hasFile = true;
break;... | [
"public",
"function",
"makeOAuthCall",
"(",
"/*Token*/",
"$",
"token",
",",
"$",
"url",
",",
"$",
"isPost",
"=",
"false",
",",
"array",
"$",
"postFields",
"=",
"null",
")",
"{",
"// Figure out if there is a file in postFields",
"$",
"hasFile",
"=",
"false",
";... | Make a signed request to MediaWiki
@param Token $token additional token to use in signature, besides
the consumer token. In most cases, this will be the access token you
got from complete(), but we set it to the request token when
finishing the handshake.
@param string $url URL to call
@param bool $isPost true if this... | [
"Make",
"a",
"signed",
"request",
"to",
"MediaWiki"
] | 1c8b33ff91273ba50e987d380724add7051d31ea | https://github.com/wikimedia/mediawiki-oauthclient-php/blob/1c8b33ff91273ba50e987d380724add7051d31ea/src/Client.php#L224-L269 |
32,957 | wikimedia/mediawiki-oauthclient-php | src/Client.php | Client.compareHash | private function compareHash( $hash1, $hash2 ) {
$result = strlen( $hash1 ) ^ strlen( $hash2 );
$len = min( strlen( $hash1 ), strlen( $hash2 ) ) - 1;
for ( $i = 0; $i < $len; $i++ ) {
$result |= ord( $hash1{$i} ) ^ ord( $hash2{$i} );
}
return $result == 0;
} | php | private function compareHash( $hash1, $hash2 ) {
$result = strlen( $hash1 ) ^ strlen( $hash2 );
$len = min( strlen( $hash1 ), strlen( $hash2 ) ) - 1;
for ( $i = 0; $i < $len; $i++ ) {
$result |= ord( $hash1{$i} ) ^ ord( $hash2{$i} );
}
return $result == 0;
} | [
"private",
"function",
"compareHash",
"(",
"$",
"hash1",
",",
"$",
"hash2",
")",
"{",
"$",
"result",
"=",
"strlen",
"(",
"$",
"hash1",
")",
"^",
"strlen",
"(",
"$",
"hash2",
")",
";",
"$",
"len",
"=",
"min",
"(",
"strlen",
"(",
"$",
"hash1",
")",... | Constant time comparison
@param string $hash1
@param string $hash2
@return bool | [
"Constant",
"time",
"comparison"
] | 1c8b33ff91273ba50e987d380724add7051d31ea | https://github.com/wikimedia/mediawiki-oauthclient-php/blob/1c8b33ff91273ba50e987d380724add7051d31ea/src/Client.php#L410-L417 |
32,958 | wikimedia/mediawiki-oauthclient-php | src/Client.php | Client.decodeJson | private function decodeJson( $json ) {
$error = $errorMsg = null;
$return = json_decode( $json );
if ( $return === null && trim( $json ) !== 'null' ) {
$error = json_last_error();
$errorMsg = json_last_error_msg();
} elseif ( !$return || !is_object( $return ) ) {
$error = 128;
$errorMsg = 'Response ... | php | private function decodeJson( $json ) {
$error = $errorMsg = null;
$return = json_decode( $json );
if ( $return === null && trim( $json ) !== 'null' ) {
$error = json_last_error();
$errorMsg = json_last_error_msg();
} elseif ( !$return || !is_object( $return ) ) {
$error = 128;
$errorMsg = 'Response ... | [
"private",
"function",
"decodeJson",
"(",
"$",
"json",
")",
"{",
"$",
"error",
"=",
"$",
"errorMsg",
"=",
"null",
";",
"$",
"return",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"if",
"(",
"$",
"return",
"===",
"null",
"&&",
"trim",
"(",
"$",
... | Like json_decode but with sane error handling.
Assumes that null is not a valid value for the JSON string.
@param string $json
@return mixed
@throws Exception On invalid JSON | [
"Like",
"json_decode",
"but",
"with",
"sane",
"error",
"handling",
".",
"Assumes",
"that",
"null",
"is",
"not",
"a",
"valid",
"value",
"for",
"the",
"JSON",
"string",
"."
] | 1c8b33ff91273ba50e987d380724add7051d31ea | https://github.com/wikimedia/mediawiki-oauthclient-php/blob/1c8b33ff91273ba50e987d380724add7051d31ea/src/Client.php#L426-L450 |
32,959 | QoboLtd/qobo-robo | src/Command/Project/Version.php | Version.projectVersion | public function projectVersion($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskDotenvReload()->run();
$envVersion = getenv('GIT_BRANCH');
if (!empty($envVersion)) {
return new PropertyList(['version' => $envVersion]);
}
$result = $this->tas... | php | public function projectVersion($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskDotenvReload()->run();
$envVersion = getenv('GIT_BRANCH');
if (!empty($envVersion)) {
return new PropertyList(['version' => $envVersion]);
}
$result = $this->tas... | [
"public",
"function",
"projectVersion",
"(",
"$",
"opts",
"=",
"[",
"'format'",
"=>",
"'table'",
",",
"'fields'",
"=>",
"''",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskDotenvReload",
"(",
")",
"->",
"run",
"(",
")",
";",
"$",
"envVer... | Get project version
@option string $format Output format (table, list, csv, json, xml)
@option string $fields Limit output to given fields, comma-separated
@return PropertyList result | [
"Get",
"project",
"version"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Command/Project/Version.php#L27-L42 |
32,960 | nails/module-invoice | src/Model/Invoice.php | Invoice.getStates | public function getStates(): array
{
return [
self::STATE_DRAFT => 'Draft',
self::STATE_OPEN => 'Open',
self::STATE_PAID_PARTIAL => 'Partially Paid',
self::STATE_PAID_PROCESSING => 'Paid (payments processing)',
self::STATE_P... | php | public function getStates(): array
{
return [
self::STATE_DRAFT => 'Draft',
self::STATE_OPEN => 'Open',
self::STATE_PAID_PARTIAL => 'Partially Paid',
self::STATE_PAID_PROCESSING => 'Paid (payments processing)',
self::STATE_P... | [
"public",
"function",
"getStates",
"(",
")",
":",
"array",
"{",
"return",
"[",
"self",
"::",
"STATE_DRAFT",
"=>",
"'Draft'",
",",
"self",
"::",
"STATE_OPEN",
"=>",
"'Open'",
",",
"self",
"::",
"STATE_PAID_PARTIAL",
"=>",
"'Partially Paid'",
",",
"self",
"::"... | Returns the invoice states with human friendly names
@return array | [
"Returns",
"the",
"invoice",
"states",
"with",
"human",
"friendly",
"names"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L120-L131 |
32,961 | nails/module-invoice | src/Model/Invoice.php | Invoice.update | public function update($mIds, array $aData = []): bool
{
// @todo (Pablo - 2019-03-06) - Support passing in multiple IDs so as to be compatible with parent
$oDb = Factory::service('Database');
try {
$sKeyExistsCustomerId = array_key_exists('customer_id', $aData);
... | php | public function update($mIds, array $aData = []): bool
{
// @todo (Pablo - 2019-03-06) - Support passing in multiple IDs so as to be compatible with parent
$oDb = Factory::service('Database');
try {
$sKeyExistsCustomerId = array_key_exists('customer_id', $aData);
... | [
"public",
"function",
"update",
"(",
"$",
"mIds",
",",
"array",
"$",
"aData",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"// @todo (Pablo - 2019-03-06) - Support passing in multiple IDs so as to be compatible with parent",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",... | Update an invoice
@param int|array $mIds The ID (or array of IDs) of the object(s) to update
@param array $aData The data to update the object(s) with
@return bool
@throws FactoryException | [
"Update",
"an",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L341-L405 |
32,962 | nails/module-invoice | src/Model/Invoice.php | Invoice.updateLineItems | protected function updateLineItems(int $iInvoiceId, array $aItems): void
{
$oItemModel = Factory::model('InvoiceItem', 'nails/module-invoice');
$aTouchedIds = [];
// Update/insert all known items
foreach ($aItems as $aItem) {
$aData = [
'label' ... | php | protected function updateLineItems(int $iInvoiceId, array $aItems): void
{
$oItemModel = Factory::model('InvoiceItem', 'nails/module-invoice');
$aTouchedIds = [];
// Update/insert all known items
foreach ($aItems as $aItem) {
$aData = [
'label' ... | [
"protected",
"function",
"updateLineItems",
"(",
"int",
"$",
"iInvoiceId",
",",
"array",
"$",
"aItems",
")",
":",
"void",
"{",
"$",
"oItemModel",
"=",
"Factory",
"::",
"model",
"(",
"'InvoiceItem'",
",",
"'nails/module-invoice'",
")",
";",
"$",
"aTouchedIds",
... | Update the line items of an invoice
@param int $iInvoiceId The invoice ID
@param array $aItems The items to update
@throws FactoryException
@throws InvoiceException | [
"Update",
"the",
"line",
"items",
"of",
"an",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L638-L699 |
32,963 | nails/module-invoice | src/Model/Invoice.php | Invoice.generateValidRef | public function generateValidRef(): string
{
Factory::helper('string');
$oDb = Factory::service('Database');
$oNow = Factory::factory('DateTime');
do {
$sRef = $oNow->format('Ym') . '-' . strtoupper(random_string('alnum'));
$oDb->where('ref', $sRef);
... | php | public function generateValidRef(): string
{
Factory::helper('string');
$oDb = Factory::service('Database');
$oNow = Factory::factory('DateTime');
do {
$sRef = $oNow->format('Ym') . '-' . strtoupper(random_string('alnum'));
$oDb->where('ref', $sRef);
... | [
"public",
"function",
"generateValidRef",
"(",
")",
":",
"string",
"{",
"Factory",
"::",
"helper",
"(",
"'string'",
")",
";",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"$",
"oNow",
"=",
"Factory",
"::",
"factory",
"(",
"... | Generates a valid invoice ref
@return string
@throws FactoryException | [
"Generates",
"a",
"valid",
"invoice",
"ref"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L725-L741 |
32,964 | nails/module-invoice | src/Model/Invoice.php | Invoice.isPaid | public function isPaid(int $iInvoiceId, bool $bIncludeProcessing = false): bool
{
$oInvoice = $this->getById($iInvoiceId);
if (!empty($oInvoice)) {
$iPaid = $oInvoice->totals->raw->paid;
if ($bIncludeProcessing) {
$iPaid += $oInvoice->totals->raw->processing... | php | public function isPaid(int $iInvoiceId, bool $bIncludeProcessing = false): bool
{
$oInvoice = $this->getById($iInvoiceId);
if (!empty($oInvoice)) {
$iPaid = $oInvoice->totals->raw->paid;
if ($bIncludeProcessing) {
$iPaid += $oInvoice->totals->raw->processing... | [
"public",
"function",
"isPaid",
"(",
"int",
"$",
"iInvoiceId",
",",
"bool",
"$",
"bIncludeProcessing",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"oInvoice",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"iInvoiceId",
")",
";",
"if",
"(",
"!",
"empty",
... | Whether an invoice has been fully paid or not
@param int $iInvoiceId The Invoice to query
@param bool $bIncludeProcessing Whether to include payments which are still processing
@return bool
@throws ModelException | [
"Whether",
"an",
"invoice",
"has",
"been",
"fully",
"paid",
"or",
"not"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L838-L853 |
32,965 | nails/module-invoice | src/Model/Invoice.php | Invoice.setPaid | public function setPaid($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_PAID,
'paid' => $oNow->format('Y-m-d H:i:s'),
]
);
if ($bResult)... | php | public function setPaid($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_PAID,
'paid' => $oNow->format('Y-m-d H:i:s'),
]
);
if ($bResult)... | [
"public",
"function",
"setPaid",
"(",
"$",
"iInvoiceId",
")",
":",
"bool",
"{",
"$",
"oNow",
"=",
"Factory",
"::",
"factory",
"(",
"'DateTime'",
")",
";",
"$",
"bResult",
"=",
"$",
"this",
"->",
"update",
"(",
"$",
"iInvoiceId",
",",
"[",
"'state'",
... | Set an invoice as paid
@param int $iInvoiceId The Invoice to query
@return bool
@throws ModelException
@throws FactoryException | [
"Set",
"an",
"invoice",
"as",
"paid"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L866-L885 |
32,966 | nails/module-invoice | src/Model/Invoice.php | Invoice.setPaidProcessing | public function setPaidProcessing($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_PAID_PROCESSING,
'paid' => $oNow->format('Y-m-d H:i:s'),
]
);
... | php | public function setPaidProcessing($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_PAID_PROCESSING,
'paid' => $oNow->format('Y-m-d H:i:s'),
]
);
... | [
"public",
"function",
"setPaidProcessing",
"(",
"$",
"iInvoiceId",
")",
":",
"bool",
"{",
"$",
"oNow",
"=",
"Factory",
"::",
"factory",
"(",
"'DateTime'",
")",
";",
"$",
"bResult",
"=",
"$",
"this",
"->",
"update",
"(",
"$",
"iInvoiceId",
",",
"[",
"'s... | Set an invoice as paid but with processing payments
@param int $iInvoiceId The Invoice to query
@return bool
@throws ModelException
@throws FactoryException | [
"Set",
"an",
"invoice",
"as",
"paid",
"but",
"with",
"processing",
"payments"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L898-L917 |
32,967 | nails/module-invoice | src/Model/Invoice.php | Invoice.setWrittenOff | public function setWrittenOff($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_WRITTEN_OFF,
'written_off' => $oNow->format('Y-m-d H:i:s'),
]
... | php | public function setWrittenOff($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_WRITTEN_OFF,
'written_off' => $oNow->format('Y-m-d H:i:s'),
]
... | [
"public",
"function",
"setWrittenOff",
"(",
"$",
"iInvoiceId",
")",
":",
"bool",
"{",
"$",
"oNow",
"=",
"Factory",
"::",
"factory",
"(",
"'DateTime'",
")",
";",
"$",
"bResult",
"=",
"$",
"this",
"->",
"update",
"(",
"$",
"iInvoiceId",
",",
"[",
"'state... | Set an invoice as written off
@param int $iInvoiceId The Invoice to query
@return bool
@throws ModelException
@throws FactoryException | [
"Set",
"an",
"invoice",
"as",
"written",
"off"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L930-L949 |
32,968 | nails/module-invoice | src/Model/Invoice.php | Invoice.setCancelled | public function setCancelled($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_CANCELLED,
'written_off' => $oNow->format('Y-m-d H:i:s'),
]
);
... | php | public function setCancelled($iInvoiceId): bool
{
$oNow = Factory::factory('DateTime');
$bResult = $this->update(
$iInvoiceId,
[
'state' => self::STATE_CANCELLED,
'written_off' => $oNow->format('Y-m-d H:i:s'),
]
);
... | [
"public",
"function",
"setCancelled",
"(",
"$",
"iInvoiceId",
")",
":",
"bool",
"{",
"$",
"oNow",
"=",
"Factory",
"::",
"factory",
"(",
"'DateTime'",
")",
";",
"$",
"bResult",
"=",
"$",
"this",
"->",
"update",
"(",
"$",
"iInvoiceId",
",",
"[",
"'state'... | Set an invoice as cancelled
@param int $iInvoiceId The Invoice to query
@return bool
@throws ModelException
@throws FactoryException | [
"Set",
"an",
"invoice",
"as",
"cancelled"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L962-L981 |
32,969 | nails/module-invoice | src/Model/Invoice.php | Invoice.getInvoiceForEvent | protected function getInvoiceForEvent(int $iInvoiceId): Resource
{
$oInvoice = $this->getById($iInvoiceId, ['expand' => ['customer', 'items']]);
if (empty($oInvoice)) {
throw new ModelException('Invalid invoice ID');
}
return $oInvoice;
} | php | protected function getInvoiceForEvent(int $iInvoiceId): Resource
{
$oInvoice = $this->getById($iInvoiceId, ['expand' => ['customer', 'items']]);
if (empty($oInvoice)) {
throw new ModelException('Invalid invoice ID');
}
return $oInvoice;
} | [
"protected",
"function",
"getInvoiceForEvent",
"(",
"int",
"$",
"iInvoiceId",
")",
":",
"Resource",
"{",
"$",
"oInvoice",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"iInvoiceId",
",",
"[",
"'expand'",
"=>",
"[",
"'customer'",
",",
"'items'",
"]",
"]",
... | Get an invoice in a suitable format for the event triggers
@param int $iInvoiceId The invoice ID
@return Resource
@throws ModelException | [
"Get",
"an",
"invoice",
"in",
"a",
"suitable",
"format",
"for",
"the",
"event",
"triggers"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Model/Invoice.php#L993-L1000 |
32,970 | canihavesomecoffee/theTVDbAPI | src/DataParser.php | DataParser.parseDataArray | public static function parseDataArray($json, string $returnClass): array
{
$result = [];
if (is_array($json)) {
foreach ($json as $entry) {
$result[] = static::parseData($entry, $returnClass);
}
}
return $result;
} | php | public static function parseDataArray($json, string $returnClass): array
{
$result = [];
if (is_array($json)) {
foreach ($json as $entry) {
$result[] = static::parseData($entry, $returnClass);
}
}
return $result;
} | [
"public",
"static",
"function",
"parseDataArray",
"(",
"$",
"json",
",",
"string",
"$",
"returnClass",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"json",
")",
")",
"{",
"foreach",
"(",
"$",
"json",
"... | Parses the given JSON data into an array of return_class instances.
@param object $json The JSON data. Must be valid
@param string $returnClass The expected return class
@return array | [
"Parses",
"the",
"given",
"JSON",
"data",
"into",
"an",
"array",
"of",
"return_class",
"instances",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/DataParser.php#L75-L84 |
32,971 | canihavesomecoffee/theTVDbAPI | src/DataParser.php | DataParser.getSerializer | private static function getSerializer(): Serializer
{
if (static::$serializer === null) {
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
static::$serializer = new Serializer(
[new ObjectNormalizer(null, null, n... | php | private static function getSerializer(): Serializer
{
if (static::$serializer === null) {
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
static::$serializer = new Serializer(
[new ObjectNormalizer(null, null, n... | [
"private",
"static",
"function",
"getSerializer",
"(",
")",
":",
"Serializer",
"{",
"if",
"(",
"static",
"::",
"$",
"serializer",
"===",
"null",
")",
"{",
"$",
"extractor",
"=",
"new",
"PropertyInfoExtractor",
"(",
"[",
"]",
",",
"[",
"new",
"PhpDocExtract... | Gets the serializer instance.
@return Serializer An instance of the Serializer. | [
"Gets",
"the",
"serializer",
"instance",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/DataParser.php#L91-L101 |
32,972 | nails/module-invoice | src/Factory/ResponseBase.php | ResponseBase.setStatus | public function setStatus($sStatus)
{
if (!$this->bIsLocked) {
$aStatuses = $this->getStatuses();
if (!in_array($sStatus, $aStatuses)) {
throw new ResponseException('"' . $sStatus . '" is an invalid response status.', 1);
}
$this->sStatus = $... | php | public function setStatus($sStatus)
{
if (!$this->bIsLocked) {
$aStatuses = $this->getStatuses();
if (!in_array($sStatus, $aStatuses)) {
throw new ResponseException('"' . $sStatus . '" is an invalid response status.', 1);
}
$this->sStatus = $... | [
"public",
"function",
"setStatus",
"(",
"$",
"sStatus",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bIsLocked",
")",
"{",
"$",
"aStatuses",
"=",
"$",
"this",
"->",
"getStatuses",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"sStatus",
","... | Returns the current status of the response
@param string $sStatus The status to set
@throws ResponseException
@return string | [
"Returns",
"the",
"current",
"status",
"of",
"the",
"response"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ResponseBase.php#L94-L107 |
32,973 | nails/module-invoice | src/Factory/ResponseBase.php | ResponseBase.setStatusFailed | public function setStatusFailed($sReasonMsg, $sReasonCode, $sUserFeedback = '')
{
$this->sErrorMsg = trim($sReasonMsg);
$this->sErrorCode = trim($sReasonCode);
$this->sErrorUser = trim($sUserFeedback);
return $this->setStatus(self::STATUS_FAILED);
} | php | public function setStatusFailed($sReasonMsg, $sReasonCode, $sUserFeedback = '')
{
$this->sErrorMsg = trim($sReasonMsg);
$this->sErrorCode = trim($sReasonCode);
$this->sErrorUser = trim($sUserFeedback);
return $this->setStatus(self::STATUS_FAILED);
} | [
"public",
"function",
"setStatusFailed",
"(",
"$",
"sReasonMsg",
",",
"$",
"sReasonCode",
",",
"$",
"sUserFeedback",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"sErrorMsg",
"=",
"trim",
"(",
"$",
"sReasonMsg",
")",
";",
"$",
"this",
"->",
"sErrorCode",
"=",... | Set the status as FAILED
@param string $sReasonMsg The exception message, logged against the payment and not shown to the customer
@param string $sReasonCode The exception code, logged against the payment and not shown to the customer
@param string $sUserFeedback The message to show to the user explaining the err... | [
"Set",
"the",
"status",
"as",
"FAILED"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/ResponseBase.php#L153-L160 |
32,974 | anomalylabs/variables-module | src/Http/Controller/Admin/VersionsController.php | VersionsController.index | public function index(VersionTableBuilder $table)
{
/**
* Mimic the parent controllers method.
*/
$table
->setType($this->getModel())
->setId($this->request->route('id'));
$versionable = $table->getVersionableInstance();
if ($current = $ve... | php | public function index(VersionTableBuilder $table)
{
/**
* Mimic the parent controllers method.
*/
$table
->setType($this->getModel())
->setId($this->request->route('id'));
$versionable = $table->getVersionableInstance();
if ($current = $ve... | [
"public",
"function",
"index",
"(",
"VersionTableBuilder",
"$",
"table",
")",
"{",
"/**\n * Mimic the parent controllers method.\n */",
"$",
"table",
"->",
"setType",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
"->",
"setId",
"(",
"$",
"this... | Return a list of versions for the variable group.
@param VersionTableBuilder $table
@param $id
@return \Symfony\Component\HttpFoundation\Response | [
"Return",
"a",
"list",
"of",
"versions",
"for",
"the",
"variable",
"group",
"."
] | bcd903670471a175f07aba3123693cb3a3c07d0b | https://github.com/anomalylabs/variables-module/blob/bcd903670471a175f07aba3123693cb3a3c07d0b/src/Http/Controller/Admin/VersionsController.php#L45-L90 |
32,975 | canihavesomecoffee/theTVDbAPI | src/MultiLanguageWrapper/ClassValidator.php | ClassValidator.isValid | public function isValid(string $returnTypeClass, $instance): bool
{
if (array_key_exists($returnTypeClass, $this->getRequiredFields()) === false) {
return false;
}
foreach ($this->getRequiredFields()[$returnTypeClass] as $property) {
if (is_array($instance)) {
... | php | public function isValid(string $returnTypeClass, $instance): bool
{
if (array_key_exists($returnTypeClass, $this->getRequiredFields()) === false) {
return false;
}
foreach ($this->getRequiredFields()[$returnTypeClass] as $property) {
if (is_array($instance)) {
... | [
"public",
"function",
"isValid",
"(",
"string",
"$",
"returnTypeClass",
",",
"$",
"instance",
")",
":",
"bool",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"returnTypeClass",
",",
"$",
"this",
"->",
"getRequiredFields",
"(",
")",
")",
"===",
"false",
")"... | Checks if for a given instance the required fields are not null.
@param string $returnTypeClass The class type of the instance.
@param object|array $instance The instance to check.
@return bool | [
"Checks",
"if",
"for",
"a",
"given",
"instance",
"the",
"required",
"fields",
"are",
"not",
"null",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/MultiLanguageWrapper/ClassValidator.php#L52-L69 |
32,976 | canihavesomecoffee/theTVDbAPI | src/MultiLanguageWrapper/ClassValidator.php | ClassValidator.merge | public function merge(string $returnTypeClass, $existingInstance, $newInstance)
{
if ($existingInstance === null) {
return $newInstance;
}
if (array_key_exists($returnTypeClass, $this->getRequiredFields()) && $newInstance !== null) {
foreach ($this->getRequiredFields(... | php | public function merge(string $returnTypeClass, $existingInstance, $newInstance)
{
if ($existingInstance === null) {
return $newInstance;
}
if (array_key_exists($returnTypeClass, $this->getRequiredFields()) && $newInstance !== null) {
foreach ($this->getRequiredFields(... | [
"public",
"function",
"merge",
"(",
"string",
"$",
"returnTypeClass",
",",
"$",
"existingInstance",
",",
"$",
"newInstance",
")",
"{",
"if",
"(",
"$",
"existingInstance",
"===",
"null",
")",
"{",
"return",
"$",
"newInstance",
";",
"}",
"if",
"(",
"array_ke... | Merges two instances together by replacing missing values that are required.
@param string $returnTypeClass The class type of the instances.
@param object|array $existingInstance The instance that already exists.
@param object|array $newInstance The instance to be merged.
@return mixed | [
"Merges",
"two",
"instances",
"together",
"by",
"replacing",
"missing",
"values",
"that",
"are",
"required",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/MultiLanguageWrapper/ClassValidator.php#L80-L100 |
32,977 | nails/module-invoice | admin/controllers/Customer.php | Customer.edit | public function edit()
{
if (!userHasPermission('admin:invoice:customer:edit')) {
unauthorised();
}
$oCustomerModel = Factory::model('Customer', 'nails/module-invoice');
$oUri = Factory::service('Uri');
$itemId = (int) $oUri->segment(5);
... | php | public function edit()
{
if (!userHasPermission('admin:invoice:customer:edit')) {
unauthorised();
}
$oCustomerModel = Factory::model('Customer', 'nails/module-invoice');
$oUri = Factory::service('Uri');
$itemId = (int) $oUri->segment(5);
... | [
"public",
"function",
"edit",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:invoice:customer:edit'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"$",
"oCustomerModel",
"=",
"Factory",
"::",
"model",
"(",
"'Customer'",
",",
"'nails/m... | Edit an existing customer
@return void | [
"Edit",
"an",
"existing",
"customer"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/admin/controllers/Customer.php#L189-L234 |
32,978 | nails/module-invoice | admin/controllers/Customer.php | Customer.formValidation | protected function formValidation()
{
$aRules = [
'first_name' => 'max_length[255]',
'last_name' => 'max_length[255]',
'organisation' => 'max_length[255]',
'email' => 'max_length[255]|valid_email|requ... | php | protected function formValidation()
{
$aRules = [
'first_name' => 'max_length[255]',
'last_name' => 'max_length[255]',
'organisation' => 'max_length[255]',
'email' => 'max_length[255]|valid_email|requ... | [
"protected",
"function",
"formValidation",
"(",
")",
"{",
"$",
"aRules",
"=",
"[",
"'first_name'",
"=>",
"'max_length[255]'",
",",
"'last_name'",
"=>",
"'max_length[255]'",
",",
"'organisation'",
"=>",
"'max_length[255]'",
",",
"'email'",
"=>",
"'max_length[255]|valid... | Runs form validation
@return void | [
"Runs",
"form",
"validation"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/admin/controllers/Customer.php#L242-L281 |
32,979 | canihavesomecoffee/theTVDbAPI | src/Route/UsersRoute.php | UsersRoute.removeFavorite | public function removeFavorite(int $seriesId): bool
{
$response = $this->parent->performAPICall('delete', '/user/favorites/'.$seriesId);
return $response->getStatusCode() === 200;
} | php | public function removeFavorite(int $seriesId): bool
{
$response = $this->parent->performAPICall('delete', '/user/favorites/'.$seriesId);
return $response->getStatusCode() === 200;
} | [
"public",
"function",
"removeFavorite",
"(",
"int",
"$",
"seriesId",
")",
":",
"bool",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"parent",
"->",
"performAPICall",
"(",
"'delete'",
",",
"'/user/favorites/'",
".",
"$",
"seriesId",
")",
";",
"return",
"$"... | Remove series from favorites.
@param int $seriesId The id of the series to remove.
@return bool True if the series was removed from the user's favourites. | [
"Remove",
"series",
"from",
"favorites",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/Route/UsersRoute.php#L76-L80 |
32,980 | canihavesomecoffee/theTVDbAPI | src/Route/UsersRoute.php | UsersRoute.addRating | public function addRating(Rating $rating): bool
{
$response = $this->parent->performAPICall(
'put',
'user/ratings/'.$rating->getRatingType().'/'.$rating->ratingItemId.'/'.$rating->rating
);
return $response->getStatusCode() === 200;
} | php | public function addRating(Rating $rating): bool
{
$response = $this->parent->performAPICall(
'put',
'user/ratings/'.$rating->getRatingType().'/'.$rating->ratingItemId.'/'.$rating->rating
);
return $response->getStatusCode() === 200;
} | [
"public",
"function",
"addRating",
"(",
"Rating",
"$",
"rating",
")",
":",
"bool",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"parent",
"->",
"performAPICall",
"(",
"'put'",
",",
"'user/ratings/'",
".",
"$",
"rating",
"->",
"getRatingType",
"(",
")",
... | Adds a user rating.
@param Rating $rating The rating to add.
@return bool True on success, false on failure. | [
"Adds",
"a",
"user",
"rating",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/Route/UsersRoute.php#L127-L134 |
32,981 | canihavesomecoffee/theTVDbAPI | src/Model/PaginatedResults.php | PaginatedResults.getLinkElement | private function getLinkElement(string $key): int
{
$link = -1;
if (array_key_exists($key, $this->links)) {
$link = intval($this->links[$key], 10);
}
return $link;
} | php | private function getLinkElement(string $key): int
{
$link = -1;
if (array_key_exists($key, $this->links)) {
$link = intval($this->links[$key], 10);
}
return $link;
} | [
"private",
"function",
"getLinkElement",
"(",
"string",
"$",
"key",
")",
":",
"int",
"{",
"$",
"link",
"=",
"-",
"1",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"links",
")",
")",
"{",
"$",
"link",
"=",
"intval",
... | Fetches a link element from the array.
@param string $key The element to retrieve.
@return int The element if found, or -1 if not. | [
"Fetches",
"a",
"link",
"element",
"from",
"the",
"array",
"."
] | f23f544029269fe2a244818209b060d08654eca6 | https://github.com/canihavesomecoffee/theTVDbAPI/blob/f23f544029269fe2a244818209b060d08654eca6/src/Model/PaginatedResults.php#L123-L130 |
32,982 | Saritasa/php-laravel-entity-services | src/Services/EntityServiceFactory.php | EntityServiceFactory.buildEntityService | protected function buildEntityService(string $modelClass): IEntityService
{
try {
if (isset($this->registeredServices[$modelClass])) {
return $this->container->make($this->registeredServices[$modelClass]);
}
return $this->container->make(EntityService::cl... | php | protected function buildEntityService(string $modelClass): IEntityService
{
try {
if (isset($this->registeredServices[$modelClass])) {
return $this->container->make($this->registeredServices[$modelClass]);
}
return $this->container->make(EntityService::cl... | [
"protected",
"function",
"buildEntityService",
"(",
"string",
"$",
"modelClass",
")",
":",
"IEntityService",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"registeredServices",
"[",
"$",
"modelClass",
"]",
")",
")",
"{",
"return",
"$",
"this... | Build entity service by model class from registered instances or creates default.
@param string $modelClass Model class to build entity service
@return IEntityService
@throws EntityServiceException
@throws BindingResolutionException | [
"Build",
"entity",
"service",
"by",
"model",
"class",
"from",
"registered",
"instances",
"or",
"creates",
"default",
"."
] | 7cac8e05d8a067ac269ce141e94b18b8b89e5493 | https://github.com/Saritasa/php-laravel-entity-services/blob/7cac8e05d8a067ac269ce141e94b18b8b89e5493/src/Services/EntityServiceFactory.php#L83-L97 |
32,983 | wikimedia/mediawiki-oauthclient-php | src/Request.php | Request.fromRequest | public static function fromRequest(
$method = null,
$url = null,
array $params = null
) {
$scheme = ( !isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) ?
'http' : 'https';
$url = ( $url ?: $scheme ) .
'://' . $_SERVER['SERVER_NAME'] .
':' .
$_SERVER['SERVER_PORT'] .
$_SERVER['REQUEST_... | php | public static function fromRequest(
$method = null,
$url = null,
array $params = null
) {
$scheme = ( !isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) ?
'http' : 'https';
$url = ( $url ?: $scheme ) .
'://' . $_SERVER['SERVER_NAME'] .
':' .
$_SERVER['SERVER_PORT'] .
$_SERVER['REQUEST_... | [
"public",
"static",
"function",
"fromRequest",
"(",
"$",
"method",
"=",
"null",
",",
"$",
"url",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"scheme",
"=",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
... | Attempt to build up a request from what was passed to the server
@param string|null $method
@param string|null $url
@param array|null $params
@return Request | [
"Attempt",
"to",
"build",
"up",
"a",
"request",
"from",
"what",
"was",
"passed",
"to",
"the",
"server"
] | 1c8b33ff91273ba50e987d380724add7051d31ea | https://github.com/wikimedia/mediawiki-oauthclient-php/blob/1c8b33ff91273ba50e987d380724add7051d31ea/src/Request.php#L84-L133 |
32,984 | wikimedia/mediawiki-oauthclient-php | src/Request.php | Request.toUrl | public function toUrl() {
$post_data = $this->toPostData();
$out = $this->getNormalizedUrl();
if ( $post_data ) {
$out .= '?' . $post_data;
}
return $out;
} | php | public function toUrl() {
$post_data = $this->toPostData();
$out = $this->getNormalizedUrl();
if ( $post_data ) {
$out .= '?' . $post_data;
}
return $out;
} | [
"public",
"function",
"toUrl",
"(",
")",
"{",
"$",
"post_data",
"=",
"$",
"this",
"->",
"toPostData",
"(",
")",
";",
"$",
"out",
"=",
"$",
"this",
"->",
"getNormalizedUrl",
"(",
")",
";",
"if",
"(",
"$",
"post_data",
")",
"{",
"$",
"out",
".=",
"... | Builds a url usable for a GET request
@return string | [
"Builds",
"a",
"url",
"usable",
"for",
"a",
"GET",
"request"
] | 1c8b33ff91273ba50e987d380724add7051d31ea | https://github.com/wikimedia/mediawiki-oauthclient-php/blob/1c8b33ff91273ba50e987d380724add7051d31ea/src/Request.php#L278-L285 |
32,985 | anomalylabs/variables-module | src/Http/Controller/Admin/VariablesController.php | VariablesController.edit | public function edit(StreamRepositoryInterface $streams, VariableFormBuilder $form, $id)
{
/* @var StreamInterface $group */
$group = $streams->find($id);
$entry = $group->getEntryModel()->firstOrNew([]);
return $form->setModel($group->getEntryModelName())->render($entry);
} | php | public function edit(StreamRepositoryInterface $streams, VariableFormBuilder $form, $id)
{
/* @var StreamInterface $group */
$group = $streams->find($id);
$entry = $group->getEntryModel()->firstOrNew([]);
return $form->setModel($group->getEntryModelName())->render($entry);
} | [
"public",
"function",
"edit",
"(",
"StreamRepositoryInterface",
"$",
"streams",
",",
"VariableFormBuilder",
"$",
"form",
",",
"$",
"id",
")",
"{",
"/* @var StreamInterface $group */",
"$",
"group",
"=",
"$",
"streams",
"->",
"find",
"(",
"$",
"id",
")",
";",
... | Return a form to edit the variables.
@param StreamRepositoryInterface $streams
@param VariableFormBuilder $form
@param $id
@return \Symfony\Component\HttpFoundation\Response | [
"Return",
"a",
"form",
"to",
"edit",
"the",
"variables",
"."
] | bcd903670471a175f07aba3123693cb3a3c07d0b | https://github.com/anomalylabs/variables-module/blob/bcd903670471a175f07aba3123693cb3a3c07d0b/src/Http/Controller/Admin/VariablesController.php#L40-L48 |
32,986 | orchestral/support | src/Providers/Concerns/AliasesProvider.php | AliasesProvider.registerFacadesAliases | protected function registerFacadesAliases(): void
{
$loader = AliasLoader::getInstance();
foreach ((array) $this->facades as $facade => $aliases) {
foreach ((array) $aliases as $alias) {
$loader->alias($alias, $facade);
}
}
} | php | protected function registerFacadesAliases(): void
{
$loader = AliasLoader::getInstance();
foreach ((array) $this->facades as $facade => $aliases) {
foreach ((array) $aliases as $alias) {
$loader->alias($alias, $facade);
}
}
} | [
"protected",
"function",
"registerFacadesAliases",
"(",
")",
":",
"void",
"{",
"$",
"loader",
"=",
"AliasLoader",
"::",
"getInstance",
"(",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"facades",
"as",
"$",
"facade",
"=>",
"$",
"aliase... | Register facades aliases.
@return void | [
"Register",
"facades",
"aliases",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Providers/Concerns/AliasesProvider.php#L14-L23 |
32,987 | nails/module-invoice | src/Factory/Invoice.php | Invoice.addItem | public function addItem(Item $oItem)
{
if (empty(!$this->iId)) {
throw new InvoiceException('Invoice has been saved and cannot be modified.');
}
$this->aItems[] = $oItem;
return $this;
} | php | public function addItem(Item $oItem)
{
if (empty(!$this->iId)) {
throw new InvoiceException('Invoice has been saved and cannot be modified.');
}
$this->aItems[] = $oItem;
return $this;
} | [
"public",
"function",
"addItem",
"(",
"Item",
"$",
"oItem",
")",
"{",
"if",
"(",
"empty",
"(",
"!",
"$",
"this",
"->",
"iId",
")",
")",
"{",
"throw",
"new",
"InvoiceException",
"(",
"'Invoice has been saved and cannot be modified.'",
")",
";",
"}",
"$",
"t... | Add an item to the invoice
@param Item $oItem the item to add
@return $this
@throws InvoiceException | [
"Add",
"an",
"item",
"to",
"the",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/Invoice.php#L153-L160 |
32,988 | nails/module-invoice | src/Factory/Invoice.php | Invoice.save | public function save()
{
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (empty($this->iId)) {
$oInvoice = $oInvoiceModel->create($this->toArray(), true);
if (empty($oInvoice)) {
throw new InvoiceException($oInvoiceModel->lastError());
... | php | public function save()
{
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (empty($this->iId)) {
$oInvoice = $oInvoiceModel->create($this->toArray(), true);
if (empty($oInvoice)) {
throw new InvoiceException($oInvoiceModel->lastError());
... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"oInvoiceModel",
"=",
"Factory",
"::",
"model",
"(",
"'Invoice'",
",",
"'nails/module-invoice'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"iId",
")",
")",
"{",
"$",
"oInvoice",
"=",
"$",
... | Saves a new invoice
@return \stdClass
@throws InvoiceException | [
"Saves",
"a",
"new",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/Invoice.php#L186-L200 |
32,989 | nails/module-invoice | src/Factory/Invoice.php | Invoice.delete | public function delete()
{
if (!empty($this->iId)) {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (!$oInvoiceModel->delete($this->iId)) {
throw new InvoiceException('Failed to delete invoice.');
}
}
return $this;
... | php | public function delete()
{
if (!empty($this->iId)) {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (!$oInvoiceModel->delete($this->iId)) {
throw new InvoiceException('Failed to delete invoice.');
}
}
return $this;
... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"iId",
")",
")",
"{",
"$",
"oInvoiceModel",
"=",
"Factory",
"::",
"model",
"(",
"'Invoice'",
",",
"'nails/module-invoice'",
")",
";",
"if",
"(",
"!",
"$",... | Deletes an invoice
@return $this
@throws InvoiceException | [
"Deletes",
"an",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/Invoice.php#L209-L219 |
32,990 | nails/module-invoice | src/Factory/Invoice.php | Invoice.writeOff | public function writeOff()
{
if (!empty($this->iId)) {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (!$oInvoiceModel->setWrittenOff($this->iId)) {
throw new InvoiceException('Failed to write off invoice.');
}
}
re... | php | public function writeOff()
{
if (!empty($this->iId)) {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
if (!$oInvoiceModel->setWrittenOff($this->iId)) {
throw new InvoiceException('Failed to write off invoice.');
}
}
re... | [
"public",
"function",
"writeOff",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"iId",
")",
")",
"{",
"$",
"oInvoiceModel",
"=",
"Factory",
"::",
"model",
"(",
"'Invoice'",
",",
"'nails/module-invoice'",
")",
";",
"if",
"(",
"!",
"$... | Writes an invoice off
@return $this
@throws InvoiceException | [
"Writes",
"an",
"invoice",
"off"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/Invoice.php#L228-L238 |
32,991 | nails/module-invoice | src/Factory/Invoice.php | Invoice.charge | public function charge(ChargeRequest $oChargeRequest)
{
if (empty($this->iId)) {
$oInvoice = $this->save();
} else {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
$oInvoice = $oInvoiceModel->getById($this->iId);
}
$oChar... | php | public function charge(ChargeRequest $oChargeRequest)
{
if (empty($this->iId)) {
$oInvoice = $this->save();
} else {
$oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
$oInvoice = $oInvoiceModel->getById($this->iId);
}
$oChar... | [
"public",
"function",
"charge",
"(",
"ChargeRequest",
"$",
"oChargeRequest",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"iId",
")",
")",
"{",
"$",
"oInvoice",
"=",
"$",
"this",
"->",
"save",
"(",
")",
";",
"}",
"else",
"{",
"$",
"oInvoic... | Charges an invoice
@param ChargeRequest $oChargeRequest
@return ChargeResponse
@throws InvoiceException | [
"Charges",
"an",
"invoice"
] | 3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716 | https://github.com/nails/module-invoice/blob/3e62067f9de1b0ddb6b0ce0eddeb3eea4ee85716/src/Factory/Invoice.php#L250-L265 |
32,992 | QoboLtd/qobo-robo | src/Utility/Template.php | Template.getTokens | public static function getTokens($template, $pre = '%%', $post = '%%')
{
$tokens = [];
$regex = "/$pre(.*?)$post/";
if (preg_match_all($regex, $template, $matches)) {
$tokens = array_unique($matches[1]);
}
natsort($tokens);
return $tokens;
} | php | public static function getTokens($template, $pre = '%%', $post = '%%')
{
$tokens = [];
$regex = "/$pre(.*?)$post/";
if (preg_match_all($regex, $template, $matches)) {
$tokens = array_unique($matches[1]);
}
natsort($tokens);
return $tokens;
} | [
"public",
"static",
"function",
"getTokens",
"(",
"$",
"template",
",",
"$",
"pre",
"=",
"'%%'",
",",
"$",
"post",
"=",
"'%%'",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"$",
"regex",
"=",
"\"/$pre(.*?)$post/\"",
";",
"if",
"(",
"preg_match_all",
... | Returns a list of unique tokens found in a given template
@param string $template Template content
@param string $pre Token prefix
@param string $post Token postfix
@return array List of tokens | [
"Returns",
"a",
"list",
"of",
"unique",
"tokens",
"found",
"in",
"a",
"given",
"template"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Utility/Template.php#L40-L51 |
32,993 | QoboLtd/qobo-robo | src/Utility/Template.php | Template.parse | public static function parse(
$template,
array $tokens,
$pre = '%%',
$post = '%%',
$flags = self::FLAG_RECURSIVE | self::FLAG_STRICT
) {
// nothing to do with empty templates or when no tokens given
if (empty($template) || empty($tokens)) {
return ... | php | public static function parse(
$template,
array $tokens,
$pre = '%%',
$post = '%%',
$flags = self::FLAG_RECURSIVE | self::FLAG_STRICT
) {
// nothing to do with empty templates or when no tokens given
if (empty($template) || empty($tokens)) {
return ... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"template",
",",
"array",
"$",
"tokens",
",",
"$",
"pre",
"=",
"'%%'",
",",
"$",
"post",
"=",
"'%%'",
",",
"$",
"flags",
"=",
"self",
"::",
"FLAG_RECURSIVE",
"|",
"self",
"::",
"FLAG_STRICT",
")",
"{... | Parse template with given tokens
@param string $template Template content
@param array $tokens List of key value tokens array
@param string $pre Token prefix
@param string $post Token postfix
@param int $flags Additianal flags for parsing
@return string Parsed template | [
"Parse",
"template",
"with",
"given",
"tokens"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Utility/Template.php#L64-L120 |
32,994 | QoboLtd/qobo-robo | src/Command/Project/DotenvCreate.php | DotenvCreate.projectDotenvCreate | public function projectDotenvCreate(
$envPath = '.env',
$templatePath = '.env.example',
$env = '',
$opts = ['format' => 'table', 'fields' => '']
) {
$task = $this->taskProjectDotenvCreate()
->env($envPath)
->template($templatePath);
$vars = ex... | php | public function projectDotenvCreate(
$envPath = '.env',
$templatePath = '.env.example',
$env = '',
$opts = ['format' => 'table', 'fields' => '']
) {
$task = $this->taskProjectDotenvCreate()
->env($envPath)
->template($templatePath);
$vars = ex... | [
"public",
"function",
"projectDotenvCreate",
"(",
"$",
"envPath",
"=",
"'.env'",
",",
"$",
"templatePath",
"=",
"'.env.example'",
",",
"$",
"env",
"=",
"''",
",",
"$",
"opts",
"=",
"[",
"'format'",
"=>",
"'table'",
",",
"'fields'",
"=>",
"''",
"]",
")",
... | Create dotenv file
@param string $envPath Path to dotenv file
@param string $templatePath Path to dotenv template
@param string $env Custom dotenv in KEY1=VALUE1,KEY2=VALUE2 format
@option string $format Output format (table, list, csv, json, xml)
@option string $fields Limit output to given fields, comma-separated
... | [
"Create",
"dotenv",
"file"
] | ea10f778bb046ad41324d22b27fce5a2fb8915ce | https://github.com/QoboLtd/qobo-robo/blob/ea10f778bb046ad41324d22b27fce5a2fb8915ce/src/Command/Project/DotenvCreate.php#L32-L71 |
32,995 | orchestral/support | src/Support/Concerns/DataContainer.php | DataContainer.get | public function get(string $key, $default = null)
{
$value = Arr::get($this->items, $key);
if (\is_null($value)) {
return \value($default);
}
return $value;
} | php | public function get(string $key, $default = null)
{
$value = Arr::get($this->items, $key);
if (\is_null($value)) {
return \value($default);
}
return $value;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"key",
")",
";",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"value"... | Get a item value.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"item",
"value",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Concerns/DataContainer.php#L41-L50 |
32,996 | orchestral/support | src/Support/Concerns/DataContainer.php | DataContainer.secureGet | public function secureGet(string $key, $default = null)
{
$value = $this->get($key, $default);
if ($this->encrypter instanceof Encrypter) {
try {
return $this->encrypter->decrypt($value);
} catch (DecryptException $e) {
//
}
... | php | public function secureGet(string $key, $default = null)
{
$value = $this->get($key, $default);
if ($this->encrypter instanceof Encrypter) {
try {
return $this->encrypter->decrypt($value);
} catch (DecryptException $e) {
//
}
... | [
"public",
"function",
"secureGet",
"(",
"string",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
",",
"$",
"default",
")",
";",
"if",
"(",
"$",
"this",
"->",
"encrypter",
"ins... | Get an encrypted item value.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"an",
"encrypted",
"item",
"value",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Concerns/DataContainer.php#L60-L73 |
32,997 | orchestral/support | src/Support/Concerns/DataContainer.php | DataContainer.set | public function set(string $key, $value = null)
{
return Arr::set($this->items, $key, \value($value));
} | php | public function set(string $key, $value = null)
{
return Arr::set($this->items, $key, \value($value));
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"Arr",
"::",
"set",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"key",
",",
"\\",
"value",
"(",
"$",
"value",
")",
")",
";",
"}"
] | Set a item value.
@param string $key
@param mixed $value
@return mixed | [
"Set",
"a",
"item",
"value",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Concerns/DataContainer.php#L83-L86 |
32,998 | orchestral/support | src/Support/Concerns/DataContainer.php | DataContainer.secureSet | public function secureSet(string $key, $value = null)
{
try {
if ($this->encrypter instanceof Encrypter) {
$value = $this->encrypter->encrypt($value);
}
} catch (EncryptException $e) {
//
}
return $this->set($key, $value);
} | php | public function secureSet(string $key, $value = null)
{
try {
if ($this->encrypter instanceof Encrypter) {
$value = $this->encrypter->encrypt($value);
}
} catch (EncryptException $e) {
//
}
return $this->set($key, $value);
} | [
"public",
"function",
"secureSet",
"(",
"string",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"encrypter",
"instanceof",
"Encrypter",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"encrypter",
"->... | Set an ecrypted item value.
@param string $key
@param mixed $value
@return mixed | [
"Set",
"an",
"ecrypted",
"item",
"value",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Concerns/DataContainer.php#L96-L107 |
32,999 | orchestral/support | src/Support/Concerns/DataContainer.php | DataContainer.forget | public function forget(string $key): bool
{
$items = $this->items;
\array_push($this->removedItems, $key);
Arr::forget($items, $key);
$this->items = $items;
return true;
} | php | public function forget(string $key): bool
{
$items = $this->items;
\array_push($this->removedItems, $key);
Arr::forget($items, $key);
$this->items = $items;
return true;
} | [
"public",
"function",
"forget",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"items",
";",
"\\",
"array_push",
"(",
"$",
"this",
"->",
"removedItems",
",",
"$",
"key",
")",
";",
"Arr",
"::",
"forget",
"(",... | Remove a item key.
@param string $key
@return bool | [
"Remove",
"a",
"item",
"key",
"."
] | b56f0469f967737e39fc9a33d40ae7439f4f6884 | https://github.com/orchestral/support/blob/b56f0469f967737e39fc9a33d40ae7439f4f6884/src/Support/Concerns/DataContainer.php#L128-L138 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.