repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.uri | public function uri(): HttpUri
{
$host = (string) $this->headers->value('HTTP_HOST')->value();
return HttpUri::fromParts(
$this->headers->contain('HTTPS') ? Http::SCHEME_SSL : Http::SCHEME,
$host,
strstr($host, ':') === false ? $this->headers->value('S... | php | public function uri(): HttpUri
{
$host = (string) $this->headers->value('HTTP_HOST')->value();
return HttpUri::fromParts(
$this->headers->contain('HTTPS') ? Http::SCHEME_SSL : Http::SCHEME,
$host,
strstr($host, ':') === false ? $this->headers->value('S... | [
"public",
"function",
"uri",
"(",
")",
":",
"HttpUri",
"{",
"$",
"host",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"headers",
"->",
"value",
"(",
"'HTTP_HOST'",
")",
"->",
"value",
"(",
")",
";",
"return",
"HttpUri",
"::",
"fromParts",
"(",
"$",
... | returns the uri of the request
In case the composed uri for this request does not denote a valid HTTP
uri a stubbles\peer\MalformedUriException is thrown. If you came this far
but the request is for an invalid HTTP uri something is completely wrong,
most likely the request tries to find out if you have a security issu... | [
"returns",
"the",
"uri",
"of",
"the",
"request"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L245-L254 |
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.hasRedirectHeader | public function hasRedirectHeader(string $headerName): bool
{
return $this->hasHeader('REDIRECT_' . $headerName) || $this->hasHeader($headerName);
} | php | public function hasRedirectHeader(string $headerName): bool
{
return $this->hasHeader('REDIRECT_' . $headerName) || $this->hasHeader($headerName);
} | [
"public",
"function",
"hasRedirectHeader",
"(",
"string",
"$",
"headerName",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"hasHeader",
"(",
"'REDIRECT_'",
".",
"$",
"headerName",
")",
"||",
"$",
"this",
"->",
"hasHeader",
"(",
"$",
"headerName",
")"... | checks whether a request header or it's redirect equivalent is set
A redirect header is one that starts with REDIRECT_ and has most likely
a different value after a redirection happened than the original header.
The method will try to use the header REDIRECT_$headerName first, but
falls back to $headerName when REDIRE... | [
"checks",
"whether",
"a",
"request",
"header",
"or",
"it",
"s",
"redirect",
"equivalent",
"is",
"set"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L291-L294 |
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.validateRedirectHeader | public function validateRedirectHeader(string $headerName): ValueValidator
{
if ($this->headers->contain('REDIRECT_' . $headerName)) {
return $this->validateHeader('REDIRECT_' . $headerName);
}
return $this->validateHeader($headerName);
} | php | public function validateRedirectHeader(string $headerName): ValueValidator
{
if ($this->headers->contain('REDIRECT_' . $headerName)) {
return $this->validateHeader('REDIRECT_' . $headerName);
}
return $this->validateHeader($headerName);
} | [
"public",
"function",
"validateRedirectHeader",
"(",
"string",
"$",
"headerName",
")",
":",
"ValueValidator",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"contain",
"(",
"'REDIRECT_'",
".",
"$",
"headerName",
")",
")",
"{",
"return",
"$",
"this",
"... | checks whether a request value from redirect headers is valid or not
A redirect header is one that starts with REDIRECT_ and has most likely
a different value after a redirection happened than the original header.
The method will try to use the header REDIRECT_$headerName first, but
falls back to $headerName when REDI... | [
"checks",
"whether",
"a",
"request",
"value",
"from",
"redirect",
"headers",
"is",
"valid",
"or",
"not"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L331-L338 |
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.readHeader | public function readHeader(string $headerName): ValueReader
{
return new ValueReader(
$this->headers->errors(),
$headerName,
$this->headers->value($headerName)
);
} | php | public function readHeader(string $headerName): ValueReader
{
return new ValueReader(
$this->headers->errors(),
$headerName,
$this->headers->value($headerName)
);
} | [
"public",
"function",
"readHeader",
"(",
"string",
"$",
"headerName",
")",
":",
"ValueReader",
"{",
"return",
"new",
"ValueReader",
"(",
"$",
"this",
"->",
"headers",
"->",
"errors",
"(",
")",
",",
"$",
"headerName",
",",
"$",
"this",
"->",
"headers",
"-... | returns request value from headers for filtering or validation
@param string $headerName name of header
@return \stubbles\input\ValueReader
@since 1.3.0 | [
"returns",
"request",
"value",
"from",
"headers",
"for",
"filtering",
"or",
"validation"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L347-L354 |
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.readRedirectHeader | public function readRedirectHeader(string $headerName): ValueReader
{
if ($this->headers->contain('REDIRECT_' . $headerName)) {
return $this->readHeader('REDIRECT_' . $headerName);
}
return $this->readHeader($headerName);
} | php | public function readRedirectHeader(string $headerName): ValueReader
{
if ($this->headers->contain('REDIRECT_' . $headerName)) {
return $this->readHeader('REDIRECT_' . $headerName);
}
return $this->readHeader($headerName);
} | [
"public",
"function",
"readRedirectHeader",
"(",
"string",
"$",
"headerName",
")",
":",
"ValueReader",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"contain",
"(",
"'REDIRECT_'",
".",
"$",
"headerName",
")",
")",
"{",
"return",
"$",
"this",
"->",
... | returns request value from headers for filtering or validation
A redirect header is one that starts with REDIRECT_ and has most likely
a different value after a redirection happened than the original header.
The method will try to use the header REDIRECT_$headerName first, but
falls back to $headerName when REDIRECT_$... | [
"returns",
"request",
"value",
"from",
"headers",
"for",
"filtering",
"or",
"validation"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L368-L375 |
stubbles/stubbles-webapp-core | src/main/php/request/WebRequest.php | WebRequest.readCookie | public function readCookie(string $cookieName): ValueReader
{
return new ValueReader(
$this->cookies->errors(),
$cookieName,
$this->cookies->value($cookieName)
);
} | php | public function readCookie(string $cookieName): ValueReader
{
return new ValueReader(
$this->cookies->errors(),
$cookieName,
$this->cookies->value($cookieName)
);
} | [
"public",
"function",
"readCookie",
"(",
"string",
"$",
"cookieName",
")",
":",
"ValueReader",
"{",
"return",
"new",
"ValueReader",
"(",
"$",
"this",
"->",
"cookies",
"->",
"errors",
"(",
")",
",",
"$",
"cookieName",
",",
"$",
"this",
"->",
"cookies",
"-... | returns request value from cookies for filtering or validation
@param string $cookieName name of cookie
@return \stubbles\input\ValueReader
@since 1.3.0 | [
"returns",
"request",
"value",
"from",
"cookies",
"for",
"filtering",
"or",
"validation"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L430-L437 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/CheckinsGateway.php | CheckinsGateway.checkin | public function checkin($venueId, $shout, array $options = array())
{
$resource = '/checkins/add';
$response = $this->makeApiRequest($resource, compact('venueId','shout') + $options, 'POST');
return $response;
} | php | public function checkin($venueId, $shout, array $options = array())
{
$resource = '/checkins/add';
$response = $this->makeApiRequest($resource, compact('venueId','shout') + $options, 'POST');
return $response;
} | [
"public",
"function",
"checkin",
"(",
"$",
"venueId",
",",
"$",
"shout",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"resource",
"=",
"'/checkins/add'",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"makeApiRequest",
"(",
"$",
... | Check a user to a venue, and maybe to a event too.
@param string $venueId
@param string $shout
@param array $options
@return object https://developer.foursquare.com/docs/responses/checkin
@see https://developer.foursquare.com/docs/checkins/add | [
"Check",
"a",
"user",
"to",
"a",
"venue",
"and",
"maybe",
"to",
"a",
"event",
"too",
"."
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/CheckinsGateway.php#L15-L22 |
movoin/one-swoole | src/Console/Application.php | Application.getLongVersion | public function getLongVersion()
{
return sprintf(
'<info>%s</info> version <comment>%s</comment> %s',
ucfirst($this->getName()),
$this->getVersion(),
! empty($this->stripeVersion) ? $this->stripeVersion : 'dev'
);
} | php | public function getLongVersion()
{
return sprintf(
'<info>%s</info> version <comment>%s</comment> %s',
ucfirst($this->getName()),
$this->getVersion(),
! empty($this->stripeVersion) ? $this->stripeVersion : 'dev'
);
} | [
"public",
"function",
"getLongVersion",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'<info>%s</info> version <comment>%s</comment> %s'",
",",
"ucfirst",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
",",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"!",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/Application.php#L77-L85 |
movoin/one-swoole | src/Console/Application.php | Application.addCommandInPath | protected function addCommandInPath(string $root)
{
$iterator = new DirectoryIterator($root);
foreach ($iterator as $path) {
if ($path->isDot()) {
continue;
}
if ($path->isDir()) {
$this->addCommandInPath($path->getPathName());
... | php | protected function addCommandInPath(string $root)
{
$iterator = new DirectoryIterator($root);
foreach ($iterator as $path) {
if ($path->isDot()) {
continue;
}
if ($path->isDir()) {
$this->addCommandInPath($path->getPathName());
... | [
"protected",
"function",
"addCommandInPath",
"(",
"string",
"$",
"root",
")",
"{",
"$",
"iterator",
"=",
"new",
"DirectoryIterator",
"(",
"$",
"root",
")",
";",
"foreach",
"(",
"$",
"iterator",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"path",
"->",... | 从路径中添加命令
@param string $root | [
"从路径中添加命令"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/Application.php#L114-L135 |
movoin/one-swoole | src/Console/Application.php | Application.createCommand | protected function createCommand(DirectoryIterator $path)
{
if (! ($namespace = $this->lookupNamespace($path->getPathName()))) {
return false;
}
$command = new ReflectionClass($namespace . '\\' . $path->getBasename('.php'));
if ($command->isAbstract() || $command->isInt... | php | protected function createCommand(DirectoryIterator $path)
{
if (! ($namespace = $this->lookupNamespace($path->getPathName()))) {
return false;
}
$command = new ReflectionClass($namespace . '\\' . $path->getBasename('.php'));
if ($command->isAbstract() || $command->isInt... | [
"protected",
"function",
"createCommand",
"(",
"DirectoryIterator",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"namespace",
"=",
"$",
"this",
"->",
"lookupNamespace",
"(",
"$",
"path",
"->",
"getPathName",
"(",
")",
")",
")",
")",
"{",
"return",
... | 创建命令对象
@param \DirectoryIterator $path
@return false|\Symfony\Component\Console\Command\Command | [
"创建命令对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/Application.php#L144-L161 |
movoin/one-swoole | src/Console/Application.php | Application.lookupNamespace | private function lookupNamespace(string $path)
{
$content = file_get_contents($path);
preg_match(
'#' .
preg_quote('namespace') .
'(.+?)' .
preg_quote(';') .
'#s',
$content,
$matchs
);
unset($conten... | php | private function lookupNamespace(string $path)
{
$content = file_get_contents($path);
preg_match(
'#' .
preg_quote('namespace') .
'(.+?)' .
preg_quote(';') .
'#s',
$content,
$matchs
);
unset($conten... | [
"private",
"function",
"lookupNamespace",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
";",
"preg_match",
"(",
"'#'",
".",
"preg_quote",
"(",
"'namespace'",
")",
".",
"'(.+?)'",
".",
"preg_quote",
"... | 解析类命名空间
@param string $path
@return string|false | [
"解析类命名空间"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/Application.php#L170-L187 |
esperecyan/dictionary-php | src/serializer/AbstractSerializer.php | AbstractSerializer.convertToValidFilenameWithoutExtension | protected function convertToValidFilenameWithoutExtension(string $filenameWithoutExtension): string
{
/** @var string 制御文字、先頭末尾の空白を取り除いた文字列。 */
$trimed = preg_replace('/^\\p{Z}+|\\p{C}+|\\p{Z}+$/u', '', $filenameWithoutExtension);
return $trimed === ''
? (new FilenameVal... | php | protected function convertToValidFilenameWithoutExtension(string $filenameWithoutExtension): string
{
/** @var string 制御文字、先頭末尾の空白を取り除いた文字列。 */
$trimed = preg_replace('/^\\p{Z}+|\\p{C}+|\\p{Z}+$/u', '', $filenameWithoutExtension);
return $trimed === ''
? (new FilenameVal... | [
"protected",
"function",
"convertToValidFilenameWithoutExtension",
"(",
"string",
"$",
"filenameWithoutExtension",
")",
":",
"string",
"{",
"/** @var string 制御文字、先頭末尾の空白を取り除いた文字列。 */",
"$",
"trimed",
"=",
"preg_replace",
"(",
"'/^\\\\p{Z}+|\\\\p{C}+|\\\\p{Z}+$/u'",
",",
"''",
... | 入力を妥当な拡張子を除くファイル名に変換します。
@param string $filenameWithoutExtension NFC適用済みの拡張子を除くファイル名。
@return string 制御文字、および空白文字のみで構成されていた場合、ランダムな文字列生成します。 | [
"入力を妥当な拡張子を除くファイル名に変換します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/AbstractSerializer.php#L32-L56 |
esperecyan/dictionary-php | src/serializer/AbstractSerializer.php | AbstractSerializer.getFilename | protected function getFilename(Dictionary $dictionary, string $extension, string $suffix = '')
{
return $this->convertToValidFilenameWithoutExtension(
($dictionary->getMetadata()['@title'] ?? self::DEFAULT_FILENAME) . $suffix
) . ".$extension";
} | php | protected function getFilename(Dictionary $dictionary, string $extension, string $suffix = '')
{
return $this->convertToValidFilenameWithoutExtension(
($dictionary->getMetadata()['@title'] ?? self::DEFAULT_FILENAME) . $suffix
) . ".$extension";
} | [
"protected",
"function",
"getFilename",
"(",
"Dictionary",
"$",
"dictionary",
",",
"string",
"$",
"extension",
",",
"string",
"$",
"suffix",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"convertToValidFilenameWithoutExtension",
"(",
"(",
"$",
"dictionary",
... | ファイル名を取得します。
@param Dictionary $dictionary
@param string $extension ピリオドを除く拡張子。
@param string $suffix ファイル名の末尾に追加する文字列。 | [
"ファイル名を取得します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/AbstractSerializer.php#L64-L69 |
esperecyan/dictionary-php | src/serializer/AbstractSerializer.php | AbstractSerializer.serializeMetadata | protected function serializeMetadata(
Dictionary $dictionary,
string $lineCommentString = '//',
array $brackets = null
):string {
$metadata = $dictionary->getMetadata();
if (isset($metadata['@title'])) {
$shiftJisableTitle = $this->convertToShiftJISable($... | php | protected function serializeMetadata(
Dictionary $dictionary,
string $lineCommentString = '//',
array $brackets = null
):string {
$metadata = $dictionary->getMetadata();
if (isset($metadata['@title'])) {
$shiftJisableTitle = $this->convertToShiftJISable($... | [
"protected",
"function",
"serializeMetadata",
"(",
"Dictionary",
"$",
"dictionary",
",",
"string",
"$",
"lineCommentString",
"=",
"'//'",
",",
"array",
"$",
"brackets",
"=",
"null",
")",
":",
"string",
"{",
"$",
"metadata",
"=",
"$",
"dictionary",
"->",
"get... | 辞書自体のタイトルと説明文を直列化します。Shift_JISに存在しない符号位置が含まれているタイトル、または説明文は存在しないものとして扱います。
@param Dictionary $dictionary
@param string $lineCommentString 行コメント文字。
@param string[]|null $brackets 開き括弧と閉じ括弧の配列。指定されていればタイトルをこの括弧で囲み、タイトル先頭の行コメント文字を省略します。
@return string 改行はCRLFを使用します。辞書にタイトルか説明文のいずれかが存在すれば、末尾に改行を2つ付けます。どちらも無ければ空文字列を返します。 | [
"辞書自体のタイトルと説明文を直列化します。Shift_JISに存在しない符号位置が含まれているタイトル、または説明文は存在しないものとして扱います。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/AbstractSerializer.php#L78-L95 |
prooph/link-app-core | src/Service/ControllerTranslatorProvider.php | ControllerTranslatorProvider.initialize | public function initialize($instance, ServiceLocatorInterface $serviceLocator)
{
if ($instance instanceof TranslatorAwareController) {
$instance->setTranslator($serviceLocator->getServiceLocator()->get('translator'));
}
} | php | public function initialize($instance, ServiceLocatorInterface $serviceLocator)
{
if ($instance instanceof TranslatorAwareController) {
$instance->setTranslator($serviceLocator->getServiceLocator()->get('translator'));
}
} | [
"public",
"function",
"initialize",
"(",
"$",
"instance",
",",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"$",
"instance",
"instanceof",
"TranslatorAwareController",
")",
"{",
"$",
"instance",
"->",
"setTranslator",
"(",
"$",
"serviceLo... | Initialize
@param $instance
@param ServiceLocatorInterface $serviceLocator
@return mixed | [
"Initialize"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Service/ControllerTranslatorProvider.php#L31-L36 |
blast-project/CoreBundle | src/Admin/Traits/Base.php | Base.getExportFormats | public function getExportFormats()
{
$formats = [];
foreach (parent::getExportFormats() as $format) {
$formats[$format] = [];
}
return array_keys($this->addPresetExportFormats($formats));
} | php | public function getExportFormats()
{
$formats = [];
foreach (parent::getExportFormats() as $format) {
$formats[$format] = [];
}
return array_keys($this->addPresetExportFormats($formats));
} | [
"public",
"function",
"getExportFormats",
"(",
")",
"{",
"$",
"formats",
"=",
"[",
"]",
";",
"foreach",
"(",
"parent",
"::",
"getExportFormats",
"(",
")",
"as",
"$",
"format",
")",
"{",
"$",
"formats",
"[",
"$",
"format",
"]",
"=",
"[",
"]",
";",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/Base.php#L82-L90 |
blast-project/CoreBundle | src/Admin/Traits/Base.php | Base.getExportFields | public function getExportFields()
{
// prerequisites
$fields = parent::getExportFields();
$this->getExportFormats();
// nothing to add
if (!$this->exportFields) {
return parent::getExportFields();
}
// nothing specific to add
if (!($this-... | php | public function getExportFields()
{
// prerequisites
$fields = parent::getExportFields();
$this->getExportFormats();
// nothing to add
if (!$this->exportFields) {
return parent::getExportFields();
}
// nothing specific to add
if (!($this-... | [
"public",
"function",
"getExportFields",
"(",
")",
"{",
"// prerequisites",
"$",
"fields",
"=",
"parent",
"::",
"getExportFields",
"(",
")",
";",
"$",
"this",
"->",
"getExportFormats",
"(",
")",
";",
"// nothing to add",
"if",
"(",
"!",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/Base.php#L95-L114 |
blast-project/CoreBundle | src/Admin/Traits/Base.php | Base.getDataSourceIterator | public function getDataSourceIterator()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
return new Iterator($datagrid->getQuery()->getQuery(), $this->getExportFields());
} | php | public function getDataSourceIterator()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
return new Iterator($datagrid->getQuery()->getQuery(), $this->getExportFields());
} | [
"public",
"function",
"getDataSourceIterator",
"(",
")",
"{",
"$",
"datagrid",
"=",
"$",
"this",
"->",
"getDatagrid",
"(",
")",
";",
"$",
"datagrid",
"->",
"buildPager",
"(",
")",
";",
"return",
"new",
"Iterator",
"(",
"$",
"datagrid",
"->",
"getQuery",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/Base.php#L119-L125 |
tequila/mongodb-php-lib | src/OptionsResolver/Command/AggregateResolver.php | AggregateResolver.resolve | public function resolve(array $options = [])
{
$hasOutStage = $this->hasOutStage($options);
if (
$hasOutStage
&& $this->hasDefault('readConcern')
&& $this->getDefault('readConcern') instanceof ReadConcern
&& ReadConcern::MAJORITY === $this->getDefault... | php | public function resolve(array $options = [])
{
$hasOutStage = $this->hasOutStage($options);
if (
$hasOutStage
&& $this->hasDefault('readConcern')
&& $this->getDefault('readConcern') instanceof ReadConcern
&& ReadConcern::MAJORITY === $this->getDefault... | [
"public",
"function",
"resolve",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"hasOutStage",
"=",
"$",
"this",
"->",
"hasOutStage",
"(",
"$",
"options",
")",
";",
"if",
"(",
"$",
"hasOutStage",
"&&",
"$",
"this",
"->",
"hasDefault",
"(... | {@inheritdoc} | [
"{"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/OptionsResolver/Command/AggregateResolver.php#L21-L79 |
tequila/mongodb-php-lib | src/OptionsResolver/Command/AggregateResolver.php | AggregateResolver.hasOutStage | private function hasOutStage(array $options)
{
if (!array_key_exists('pipeline', $options)) {
// Let resolve() to throw exception, since this option is required
return false;
}
$pipeline = (array) $options['pipeline'];
$lastStage = end($pipeline);
re... | php | private function hasOutStage(array $options)
{
if (!array_key_exists('pipeline', $options)) {
// Let resolve() to throw exception, since this option is required
return false;
}
$pipeline = (array) $options['pipeline'];
$lastStage = end($pipeline);
re... | [
"private",
"function",
"hasOutStage",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'pipeline'",
",",
"$",
"options",
")",
")",
"{",
"// Let resolve() to throw exception, since this option is required",
"return",
"false",
";",
"}"... | @param array $options
@return bool | [
"@param",
"array",
"$options"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/OptionsResolver/Command/AggregateResolver.php#L113-L124 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.calculateItemTotalNetPrice | public function calculateItemTotalNetPrice($item, $currency = null, $useProductsPrice = true, $isGrossPrice = false)
{
$priceValue = $this->calculateItemNetPrice($item, $currency, $useProductsPrice, $isGrossPrice);
if ($priceValue === null) {
$priceValue = 0;
}
if ($ite... | php | public function calculateItemTotalNetPrice($item, $currency = null, $useProductsPrice = true, $isGrossPrice = false)
{
$priceValue = $this->calculateItemNetPrice($item, $currency, $useProductsPrice, $isGrossPrice);
if ($priceValue === null) {
$priceValue = 0;
}
if ($ite... | [
"public",
"function",
"calculateItemTotalNetPrice",
"(",
"$",
"item",
",",
"$",
"currency",
"=",
"null",
",",
"$",
"useProductsPrice",
"=",
"true",
",",
"$",
"isGrossPrice",
"=",
"false",
")",
"{",
"$",
"priceValue",
"=",
"$",
"this",
"->",
"calculateItemNet... | Calculates the overall total price of an item.
@param CalculableBulkPriceItemInterface $item
@param string|null $currency
@param bool|null $useProductsPrice
@param bool|null $isGrossPrice
@return float | [
"Calculates",
"the",
"overall",
"total",
"price",
"of",
"an",
"item",
"."
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L64-L85 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.calculateItemNetPrice | public function calculateItemNetPrice($item, $currency = null, $useProductsPrice = null, $isGrossPrice = false)
{
$currency = $this->getCurrency($currency);
if ($useProductsPrice === null) {
$useProductsPrice = $item->getUseProductsPrice();
}
// Validate item
$t... | php | public function calculateItemNetPrice($item, $currency = null, $useProductsPrice = null, $isGrossPrice = false)
{
$currency = $this->getCurrency($currency);
if ($useProductsPrice === null) {
$useProductsPrice = $item->getUseProductsPrice();
}
// Validate item
$t... | [
"public",
"function",
"calculateItemNetPrice",
"(",
"$",
"item",
",",
"$",
"currency",
"=",
"null",
",",
"$",
"useProductsPrice",
"=",
"null",
",",
"$",
"isGrossPrice",
"=",
"false",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"getCurrency",
"(",
... | Returns price of a single item based on it's quantity.
@param CalculableBulkPriceItemInterface $item
@param null|string $currency
@param null|bool $useProductsPrice
@param bool|null $isGrossPrice
@throws PriceCalculationException
@return float | [
"Returns",
"price",
"of",
"a",
"single",
"item",
"based",
"on",
"it",
"s",
"quantity",
"."
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L99-L123 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.formatPrice | public function formatPrice($price, $currency, $locale = null)
{
return $this->priceManager->getFormattedPrice($price, $currency, $locale);
} | php | public function formatPrice($price, $currency, $locale = null)
{
return $this->priceManager->getFormattedPrice($price, $currency, $locale);
} | [
"public",
"function",
"formatPrice",
"(",
"$",
"price",
",",
"$",
"currency",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"priceManager",
"->",
"getFormattedPrice",
"(",
"$",
"price",
",",
"$",
"currency",
",",
"$",
"locale",
... | Format price.
@param float $price
@param string $currency
@param string $locale
@return string | [
"Format",
"price",
"."
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L134-L137 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.getValidProductNetPriceForItem | private function getValidProductNetPriceForItem(CalculableBulkPriceItemInterface $item, $currency)
{
$product = $item->getCalcProduct();
$areGrossPrices = false;
// Get addon price.
$addon = $item->getAddon();
if ($addon) {
$addonPrice = $this->priceManager->getA... | php | private function getValidProductNetPriceForItem(CalculableBulkPriceItemInterface $item, $currency)
{
$product = $item->getCalcProduct();
$areGrossPrices = false;
// Get addon price.
$addon = $item->getAddon();
if ($addon) {
$addonPrice = $this->priceManager->getA... | [
"private",
"function",
"getValidProductNetPriceForItem",
"(",
"CalculableBulkPriceItemInterface",
"$",
"item",
",",
"$",
"currency",
")",
"{",
"$",
"product",
"=",
"$",
"item",
"->",
"getCalcProduct",
"(",
")",
";",
"$",
"areGrossPrices",
"=",
"false",
";",
"// ... | Returns the valid product net price for item.
@param CalculableBulkPriceItemInterface $item
@param string $currency
@return int | [
"Returns",
"the",
"valid",
"product",
"net",
"price",
"for",
"item",
"."
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L193-L231 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.getPriceOfProduct | private function getPriceOfProduct(ProductInterface $product, $quantity, $currency)
{
$specialPriceValue = null;
$bulkPriceValue = null;
// Get special price.
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($specialPrice) {
... | php | private function getPriceOfProduct(ProductInterface $product, $quantity, $currency)
{
$specialPriceValue = null;
$bulkPriceValue = null;
// Get special price.
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($specialPrice) {
... | [
"private",
"function",
"getPriceOfProduct",
"(",
"ProductInterface",
"$",
"product",
",",
"$",
"quantity",
",",
"$",
"currency",
")",
"{",
"$",
"specialPriceValue",
"=",
"null",
";",
"$",
"bulkPriceValue",
"=",
"null",
";",
"// Get special price.",
"$",
"special... | @param ProductInterface $product
@param float $quantity
@param string|null $currency
@return float|null | [
"@param",
"ProductInterface",
"$product",
"@param",
"float",
"$quantity",
"@param",
"string|null",
"$currency"
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L240-L278 |
sulu/SuluPricingBundle | Pricing/ItemPriceCalculator.php | ItemPriceCalculator.retrieveProductTypeIdByKey | private function retrieveProductTypeIdByKey($key)
{
if (!isset($this->productTypesMap[$key])) {
return null;
}
return intval($this->productTypesMap[$key]);
} | php | private function retrieveProductTypeIdByKey($key)
{
if (!isset($this->productTypesMap[$key])) {
return null;
}
return intval($this->productTypesMap[$key]);
} | [
"private",
"function",
"retrieveProductTypeIdByKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"productTypesMap",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"intval",
"(",
"$",
"this",
... | Returns product type id by key.
@param string $key
@return int | [
"Returns",
"product",
"type",
"id",
"by",
"key",
"."
] | train | https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Pricing/ItemPriceCalculator.php#L287-L294 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/PermissionTableMap.php | PermissionTableMap.addSelectColumns | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(PermissionTableMap::COL_ID);
$criteria->addSelectColumn(PermissionTableMap::COL_NAME);
$criteria->addSelectColumn(PermissionTableMap::COL_CREATE_... | php | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(PermissionTableMap::COL_ID);
$criteria->addSelectColumn(PermissionTableMap::COL_NAME);
$criteria->addSelectColumn(PermissionTableMap::COL_CREATE_... | [
"public",
"static",
"function",
"addSelectColumns",
"(",
"Criteria",
"$",
"criteria",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"PermissionTableMap",
"::",
"CO... | Add all the columns needed to create a new object.
Note: any columns that were marked with lazyLoad="true" in the
XML schema will not be added to the select list and only loaded
on demand.
@param Criteria $criteria object containing the columns to add.
@param string $alias optional table alias
@throws PropelExce... | [
"Add",
"all",
"the",
"columns",
"needed",
"to",
"create",
"a",
"new",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/PermissionTableMap.php#L329-L348 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/PermissionTableMap.php | PermissionTableMap.buildTableMap | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PermissionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(PermissionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new PermissionTableMap());
}
} | php | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PermissionTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(PermissionTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new PermissionTableMap());
}
} | [
"public",
"static",
"function",
"buildTableMap",
"(",
")",
"{",
"$",
"dbMap",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getDatabaseMap",
"(",
"PermissionTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"!",
"$",
"dbMap",
"->",
"hasTa... | Add a TableMap instance to the database for this tableMap class. | [
"Add",
"a",
"TableMap",
"instance",
"to",
"the",
"database",
"for",
"this",
"tableMap",
"class",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/PermissionTableMap.php#L365-L371 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.detach | public function detach()
{
$stream = $this->stream;
$this->stream = null;
$this->readable = null;
$this->writable = null;
$this->seekable = null;
$this->size = null;
return $stream;
} | php | public function detach()
{
$stream = $this->stream;
$this->stream = null;
$this->readable = null;
$this->writable = null;
$this->seekable = null;
$this->size = null;
return $stream;
} | [
"public",
"function",
"detach",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"stream",
";",
"$",
"this",
"->",
"stream",
"=",
"null",
";",
"$",
"this",
"->",
"readable",
"=",
"null",
";",
"$",
"this",
"->",
"writable",
"=",
"null",
";",
... | 分离资源
@return resource|null | [
"分离资源"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L92-L103 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.getSize | public function getSize()
{
if (! $this->size && $this->isAttached() === true) {
$stats = fstat($this->stream);
$this->size = isset($stats['size']) ? $stats['size'] : null;
}
return $this->size;
} | php | public function getSize()
{
if (! $this->size && $this->isAttached() === true) {
$stats = fstat($this->stream);
$this->size = isset($stats['size']) ? $stats['size'] : null;
}
return $this->size;
} | [
"public",
"function",
"getSize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"size",
"&&",
"$",
"this",
"->",
"isAttached",
"(",
")",
"===",
"true",
")",
"{",
"$",
"stats",
"=",
"fstat",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"$",
"t... | 获得流的大小
@return int|null | [
"获得流的大小"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L110-L118 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.tell | public function tell(): int
{
if ($this->isAttached() === false || ($position = ftell($this->stream)) === false) {
throw new RuntimeException('Could not get the position of the pointer in stream');
}
return $position;
} | php | public function tell(): int
{
if ($this->isAttached() === false || ($position = ftell($this->stream)) === false) {
throw new RuntimeException('Could not get the position of the pointer in stream');
}
return $position;
} | [
"public",
"function",
"tell",
"(",
")",
":",
"int",
"{",
"if",
"(",
"$",
"this",
"->",
"isAttached",
"(",
")",
"===",
"false",
"||",
"(",
"$",
"position",
"=",
"ftell",
"(",
"$",
"this",
"->",
"stream",
")",
")",
"===",
"false",
")",
"{",
"throw"... | 获得文件指针读/写的位置
@return int
@throws \RuntimeException | [
"获得文件指针读",
"/",
"写的位置"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L126-L133 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.isReadable | public function isReadable(): bool
{
if ($this->readable === null) {
$this->readable = false;
if ($this->isAttached() === true) {
$meta = $this->getMetadata();
foreach (self::$modes['readable'] as $mode) {
if (strpos($meta['mode'], ... | php | public function isReadable(): bool
{
if ($this->readable === null) {
$this->readable = false;
if ($this->isAttached() === true) {
$meta = $this->getMetadata();
foreach (self::$modes['readable'] as $mode) {
if (strpos($meta['mode'], ... | [
"public",
"function",
"isReadable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"readable",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"readable",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isAttached",
"(",
")",
"===",
"true"... | 判断文件流是否可读
@return bool | [
"判断文件流是否可读"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L150-L166 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.isSeekable | public function isSeekable(): bool
{
if ($this->seekable === null) {
$this->seekable = false;
if ($this->isAttached() === true) {
$meta = $this->getMetadata();
$this->seekable = $meta['seekable'];
}
}
return $this->seekable... | php | public function isSeekable(): bool
{
if ($this->seekable === null) {
$this->seekable = false;
if ($this->isAttached() === true) {
$meta = $this->getMetadata();
$this->seekable = $meta['seekable'];
}
}
return $this->seekable... | [
"public",
"function",
"isSeekable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"seekable",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"seekable",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isAttached",
"(",
")",
"===",
"true"... | 判断流是否可定位
@return bool | [
"判断流是否可定位"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L196-L207 |
movoin/one-swoole | src/Protocol/Message/Stream.php | Stream.attach | protected function attach($stream)
{
if (is_resource($stream) === false) {
throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource');
}
$this->stream = $stream;
} | php | protected function attach($stream)
{
if (is_resource($stream) === false) {
throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource');
}
$this->stream = $stream;
} | [
"protected",
"function",
"attach",
"(",
"$",
"stream",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"stream",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"__METHOD__",
".",
"' argument must be a valid PHP resource'",
")",
";"... | 附加资源
@param resource
@throws \InvalidArgumentException | [
"附加资源"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Stream.php#L341-L348 |
huasituo/hstcms | src/Database/Migrations/2016_11_28_130534_create_common_role_table.php | CreateCommonRoleTable.up | public function up()
{
Schema::create('common_role', function (Blueprint $table) {
$table->increments('id')->comment('ID');
$table->string('name')->nullable()->comment(hst_lang('hstcms::public.name'));
$table->text('auths')->comment(hst_lang('hstcms::public.auths'));
... | php | public function up()
{
Schema::create('common_role', function (Blueprint $table) {
$table->increments('id')->comment('ID');
$table->string('name')->nullable()->comment(hst_lang('hstcms::public.name'));
$table->text('auths')->comment(hst_lang('hstcms::public.auths'));
... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'common_role'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
"->",
"comment",
"(",
"'ID'",
")",
";",
"$",
"ta... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_11_28_130534_create_common_role_table.php#L18-L27 |
WellCommerce/CoreBundle | DependencyInjection/Compiler/AbstractCollectionPass.php | AbstractCollectionPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->collectionServiceId)) {
return;
}
$collection = $this->getCollection($container);
foreach ($container->findTaggedServiceIds($this->serviceTag) as $id => $attributes) {
... | php | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->collectionServiceId)) {
return;
}
$collection = $this->getCollection($container);
foreach ($container->findTaggedServiceIds($this->serviceTag) as $id => $attributes) {
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"$",
"this",
"->",
"collectionServiceId",
")",
")",
"{",
"return",
";",
"}",
"$",
"collection",
"=",
"$",
... | Processes the container
@param ContainerBuilder $container | [
"Processes",
"the",
"container"
] | train | https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/DependencyInjection/Compiler/AbstractCollectionPass.php#L42-L53 |
datasift/datasift-php | lib/DataSift/Account/Identity/Token.php | DataSift_Account_Identity_Token.getAll | public function getAll($identity, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
return $this->_user->get('account/identity/' . $identity . '/token', $params);
} | php | public function getAll($identity, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
return $this->_user->get('account/identity/' . $identity . '/token', $params);
} | [
"public",
"function",
"getAll",
"(",
"$",
"identity",
",",
"$",
"page",
"=",
"1",
",",
"$",
"perPage",
"=",
"25",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'page'",
"=>",
"$",
"page",
",",
"'per_page'",
"=>",
"$",
"perPage",
")",
";",
"return",
... | Get all the tokens for an identity
@param string $identity
@param integer $page
@param integer $perPage
@return mixed | [
"Get",
"all",
"the",
"tokens",
"for",
"an",
"identity"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Token.php#L50-L58 |
datasift/datasift-php | lib/DataSift/Account/Identity/Token.php | DataSift_Account_Identity_Token.create | public function create($identity, $service, $token)
{
$params = array(
'service' => $service,
'token' => $token,
);
return $this->_user->post('account/identity/' . $identity . '/token', $params);
} | php | public function create($identity, $service, $token)
{
$params = array(
'service' => $service,
'token' => $token,
);
return $this->_user->post('account/identity/' . $identity . '/token', $params);
} | [
"public",
"function",
"create",
"(",
"$",
"identity",
",",
"$",
"service",
",",
"$",
"token",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'service'",
"=>",
"$",
"service",
",",
"'token'",
"=>",
"$",
"token",
",",
")",
";",
"return",
"$",
"this",
"... | Creates a token for a service
@param string $identity
@param string $service
@param string $token
@param string $expiresAt
@return mixed | [
"Creates",
"a",
"token",
"for",
"a",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Token.php#L70-L79 |
datasift/datasift-php | lib/DataSift/Account/Identity/Token.php | DataSift_Account_Identity_Token.update | public function update($identity, $service, $token)
{
$params = array(
'token' => $token,
);
return $this->_user->put('account/identity/' . $identity . '/token/' . $service, $params);
} | php | public function update($identity, $service, $token)
{
$params = array(
'token' => $token,
);
return $this->_user->put('account/identity/' . $identity . '/token/' . $service, $params);
} | [
"public",
"function",
"update",
"(",
"$",
"identity",
",",
"$",
"service",
",",
"$",
"token",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'token'",
"=>",
"$",
"token",
",",
")",
";",
"return",
"$",
"this",
"->",
"_user",
"->",
"put",
"(",
"'accoun... | Updates the token for a service
@param string $identity
@param string $service
@param string $expiresAt
@return mixed | [
"Updates",
"the",
"token",
"for",
"a",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Token.php#L90-L98 |
datasift/datasift-php | lib/DataSift/Account/Identity/Token.php | DataSift_Account_Identity_Token.delete | public function delete($identity, $service)
{
$successCode = array(DataSift_ApiClient::HTTP_NO_CONTENT);
return $this->_user->delete('account/identity/' . $identity . '/token/' . $service);
} | php | public function delete($identity, $service)
{
$successCode = array(DataSift_ApiClient::HTTP_NO_CONTENT);
return $this->_user->delete('account/identity/' . $identity . '/token/' . $service);
} | [
"public",
"function",
"delete",
"(",
"$",
"identity",
",",
"$",
"service",
")",
"{",
"$",
"successCode",
"=",
"array",
"(",
"DataSift_ApiClient",
"::",
"HTTP_NO_CONTENT",
")",
";",
"return",
"$",
"this",
"->",
"_user",
"->",
"delete",
"(",
"'account/identity... | Deletes a token for a service
@param string $identity
@param string $service
@return mixed | [
"Deletes",
"a",
"token",
"for",
"a",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Token.php#L108-L113 |
sinso/Swisscom.Neos.CaseInsensitiveUrls | Classes/Migration/Transformations/ChangePropertyValueToLowercase.php | ChangePropertyValueToLowercase.execute | public function execute(NodeData $node)
{
$currentPropertyValue = $node->getProperty($this->propertyName);
$newPropertyValue = strtolower($currentPropertyValue);
$node->setProperty($this->propertyName, $newPropertyValue);
} | php | public function execute(NodeData $node)
{
$currentPropertyValue = $node->getProperty($this->propertyName);
$newPropertyValue = strtolower($currentPropertyValue);
$node->setProperty($this->propertyName, $newPropertyValue);
} | [
"public",
"function",
"execute",
"(",
"NodeData",
"$",
"node",
")",
"{",
"$",
"currentPropertyValue",
"=",
"$",
"node",
"->",
"getProperty",
"(",
"$",
"this",
"->",
"propertyName",
")",
";",
"$",
"newPropertyValue",
"=",
"strtolower",
"(",
"$",
"currentPrope... | Change the property on the given node.
@param NodeData $node
@return void
@throws \Neos\ContentRepository\Exception\NodeException | [
"Change",
"the",
"property",
"on",
"the",
"given",
"node",
"."
] | train | https://github.com/sinso/Swisscom.Neos.CaseInsensitiveUrls/blob/34b823fca74554a958d64d065b81762f0437090a/Classes/Migration/Transformations/ChangePropertyValueToLowercase.php#L57-L62 |
activecollab/databasestructure | src/Field/Scalar/EnumField.php | EnumField.& | public function &possibilities(...$possibilities)
{
if ($this->getDefaultValue() !== null && !in_array($this->getDefaultValue(), $possibilities)) {
throw new InvalidArgumentException('Default value ' . var_export($this->getDefaultValue(), true) . ' needs to be in the list of possibilities');
... | php | public function &possibilities(...$possibilities)
{
if ($this->getDefaultValue() !== null && !in_array($this->getDefaultValue(), $possibilities)) {
throw new InvalidArgumentException('Default value ' . var_export($this->getDefaultValue(), true) . ' needs to be in the list of possibilities');
... | [
"public",
"function",
"&",
"possibilities",
"(",
"...",
"$",
"possibilities",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getDefaultValue",
"(",
")",
"!==",
"null",
"&&",
"!",
"in_array",
"(",
"$",
"this",
"->",
"getDefaultValue",
"(",
")",
",",
"$",
"pos... | Set a list of possible values.
@param string[] $possibilities
@return $this | [
"Set",
"a",
"list",
"of",
"possible",
"values",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Scalar/EnumField.php#L37-L46 |
kderyabin/logger | src/Utils/Date.php | Date.getDateTime | public static function getDateTime()
{
$dt = \DateTime::createFromFormat('U.u', microtime(true));
$dt->setTimezone(new \DateTimeZone(date('e')));
return $dt;
} | php | public static function getDateTime()
{
$dt = \DateTime::createFromFormat('U.u', microtime(true));
$dt->setTimezone(new \DateTimeZone(date('e')));
return $dt;
} | [
"public",
"static",
"function",
"getDateTime",
"(",
")",
"{",
"$",
"dt",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"'U.u'",
",",
"microtime",
"(",
"true",
")",
")",
";",
"$",
"dt",
"->",
"setTimezone",
"(",
"new",
"\\",
"DateTimeZone",
"(",
... | Returns DateTime object.
@return \DateTime | [
"Returns",
"DateTime",
"object",
"."
] | train | https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Utils/Date.php#L22-L28 |
activecollab/databasestructure | src/Association/HasAndBelongsToManyAssociation.php | HasAndBelongsToManyAssociation.getConnectionTableName | public function getConnectionTableName()
{
$type_names = [$this->getSourceTypeName(), $this->getTargetTypeName()];
sort($type_names);
return implode('_', $type_names);
} | php | public function getConnectionTableName()
{
$type_names = [$this->getSourceTypeName(), $this->getTargetTypeName()];
sort($type_names);
return implode('_', $type_names);
} | [
"public",
"function",
"getConnectionTableName",
"(",
")",
"{",
"$",
"type_names",
"=",
"[",
"$",
"this",
"->",
"getSourceTypeName",
"(",
")",
",",
"$",
"this",
"->",
"getTargetTypeName",
"(",
")",
"]",
";",
"sort",
"(",
"$",
"type_names",
")",
";",
"retu... | Return connection table name.
@return string | [
"Return",
"connection",
"table",
"name",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasAndBelongsToManyAssociation.php#L68-L74 |
activecollab/databasestructure | src/Association/HasAndBelongsToManyAssociation.php | HasAndBelongsToManyAssociation.buildAddRelatedObjectMethod | public function buildAddRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$target_instance_class = $this->getInstanceClassFrom($namespace, $target_type);
$longest_docs_param_type_name = max(strlen($target_instanc... | php | public function buildAddRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$target_instance_class = $this->getInstanceClassFrom($namespace, $target_type);
$longest_docs_param_type_name = max(strlen($target_instanc... | [
"public",
"function",
"buildAddRelatedObjectMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"target_in... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasAndBelongsToManyAssociation.php#L107-L140 |
activecollab/databasestructure | src/Association/HasAndBelongsToManyAssociation.php | HasAndBelongsToManyAssociation.buildRemoveRelatedObjectMethod | public function buildRemoveRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$target_instance_class = $this->getInstanceClassFrom($namespace, $target_type);
$longest_docs_param_type_name = max(strlen($target_inst... | php | public function buildRemoveRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$target_instance_class = $this->getInstanceClassFrom($namespace, $target_type);
$longest_docs_param_type_name = max(strlen($target_inst... | [
"public",
"function",
"buildRemoveRelatedObjectMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"target... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasAndBelongsToManyAssociation.php#L145-L180 |
activecollab/databasestructure | src/Association/HasAndBelongsToManyAssociation.php | HasAndBelongsToManyAssociation.buildClearRelatedObjectsMethod | public function buildClearRelatedObjectsMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$result[] = '';
$result[] = ' /**';
$result[] = ' * Drop all connections between ' . str_replace('_', ' ', $target_type->... | php | public function buildClearRelatedObjectsMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$result[] = '';
$result[] = ' /**';
$result[] = ' * Drop all connections between ' . str_replace('_', ' ', $target_type->... | [
"public",
"function",
"buildClearRelatedObjectsMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"result... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasAndBelongsToManyAssociation.php#L185-L203 |
crossjoin/Css | src/Crossjoin/Css/Helper/Url.php | Url.extractUrl | public static function extractUrl($url)
{
if (is_string($url)) {
// Extract the URL from a given CSS URL value|string
//
// Examples:
// - "http://www.example.com"
// - 'http://www.example.com'
// - url("http://www.example.com")
... | php | public static function extractUrl($url)
{
if (is_string($url)) {
// Extract the URL from a given CSS URL value|string
//
// Examples:
// - "http://www.example.com"
// - 'http://www.example.com'
// - url("http://www.example.com")
... | [
"public",
"static",
"function",
"extractUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"// Extract the URL from a given CSS URL value|string",
"//",
"// Examples:",
"// - \"http://www.example.com\"",
"// - 'http://www.example.com'... | Extracts the URL from a CSS URL value.
@param string $url
@return string | [
"Extracts",
"the",
"URL",
"from",
"a",
"CSS",
"URL",
"value",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Url.php#L12-L40 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Arg.php | Arg.range | function range($min = null, $max = null)
{
$this->min($min);
$this->max($max);
return $this;
} | php | function range($min = null, $max = null)
{
$this->min($min);
$this->max($max);
return $this;
} | [
"function",
"range",
"(",
"$",
"min",
"=",
"null",
",",
"$",
"max",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"min",
"(",
"$",
"min",
")",
";",
"$",
"this",
"->",
"max",
"(",
"$",
"max",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the minimum and maximum
@param numeric minimum
@param numeric maximum
@return Arg | [
"Set",
"the",
"minimum",
"and",
"maximum"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Arg.php#L154-L159 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Arg.php | Arg.exclusiveRange | function exclusiveRange($min = null, $max = null)
{
$this->exclusiveMin($min);
$this->exclusiveMax($max);
return $this;
} | php | function exclusiveRange($min = null, $max = null)
{
$this->exclusiveMin($min);
$this->exclusiveMax($max);
return $this;
} | [
"function",
"exclusiveRange",
"(",
"$",
"min",
"=",
"null",
",",
"$",
"max",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"exclusiveMin",
"(",
"$",
"min",
")",
";",
"$",
"this",
"->",
"exclusiveMax",
"(",
"$",
"max",
")",
";",
"return",
"$",
"this",
... | Set the exclusive minimum and maximum
@param numeric minimum
@param numeric maximum
@return Arg | [
"Set",
"the",
"exclusive",
"minimum",
"and",
"maximum"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Arg.php#L167-L172 |
prooph/link-app-core | src/Service/Factory/ApplicationDbFactory.php | ApplicationDbFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
if (! array_key_exists('application_db', $config)) throw new \InvalidArgumentException('Missing config for application_db');
$config = $config['application_db'];
if (... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
if (! array_key_exists('application_db', $config)) throw new \InvalidArgumentException('Missing config for application_db');
$config = $config['application_db'];
if (... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'config'",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'application_db'",
",",
"$",
"c... | Create service
@param ServiceLocatorInterface $serviceLocator
@throws \InvalidArgumentException
@return \Doctrine\DBAL\Connection | [
"Create",
"service"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Service/Factory/ApplicationDbFactory.php#L35-L53 |
dreamcommerce/common-bundle | src/DreamCommerce/Component/Common/JMS/Serializer/Construction/SyliusConstructor.php | SyliusConstructor.construct | public function construct(VisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context)
{
$syliusMetadata = null;
try {
$syliusMetadata = $this->registry->getByClass($metadata->name);
} catch (InvalidArgumentException $exception) {
... | php | public function construct(VisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context)
{
$syliusMetadata = null;
try {
$syliusMetadata = $this->registry->getByClass($metadata->name);
} catch (InvalidArgumentException $exception) {
... | [
"public",
"function",
"construct",
"(",
"VisitorInterface",
"$",
"visitor",
",",
"ClassMetadata",
"$",
"metadata",
",",
"$",
"data",
",",
"array",
"$",
"type",
",",
"DeserializationContext",
"$",
"context",
")",
"{",
"$",
"syliusMetadata",
"=",
"null",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/JMS/Serializer/Construction/SyliusConstructor.php#L58-L92 |
tonicospinelli/class-generation | src/ClassGeneration/DocBlock/TagCollection.php | TagCollection.add | public function add($tag)
{
if (!$tag instanceof TagInterface) {
throw new \InvalidArgumentException('This tag is not allowed');
}
if ($this->isUniqueTag($tag->getName())) {
$this->removeByName($tag->getName());
}
return parent::add($tag);
} | php | public function add($tag)
{
if (!$tag instanceof TagInterface) {
throw new \InvalidArgumentException('This tag is not allowed');
}
if ($this->isUniqueTag($tag->getName())) {
$this->removeByName($tag->getName());
}
return parent::add($tag);
} | [
"public",
"function",
"add",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"$",
"tag",
"instanceof",
"TagInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This tag is not allowed'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"... | Adds a new Tag on Dockblock.
@param TagInterface $tag
@throws \InvalidArgumentException
@return bool | [
"Adds",
"a",
"new",
"Tag",
"on",
"Dockblock",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/DocBlock/TagCollection.php#L40-L50 |
tonicospinelli/class-generation | src/ClassGeneration/DocBlock/TagCollection.php | TagCollection.removeByName | public function removeByName($tagName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $tag) {
$name = $tag->getName();
if ((is_array($tagName) && in_array($name, $tagName)) ||
($name === $tagName)
) {... | php | public function removeByName($tagName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $tag) {
$name = $tag->getName();
if ((is_array($tagName) && in_array($name, $tagName)) ||
($name === $tagName)
) {... | [
"public",
"function",
"removeByName",
"(",
"$",
"tagName",
")",
"{",
"$",
"removedList",
"=",
"new",
"self",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"index",
"=>",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/DocBlock/TagCollection.php#L100-L115 |
tonicospinelli/class-generation | src/ClassGeneration/DocBlock/TagCollection.php | TagCollection.sortAsc | public function sortAsc()
{
$cmp = function (TagInterface $a, TagInterface $b) {
if ($a->getName() == $b->getName()) {
return 0;
}
return ($a->getName() < $b->getName()) ? -1 : 1;
};
usort($this->elements, $cmp);
} | php | public function sortAsc()
{
$cmp = function (TagInterface $a, TagInterface $b) {
if ($a->getName() == $b->getName()) {
return 0;
}
return ($a->getName() < $b->getName()) ? -1 : 1;
};
usort($this->elements, $cmp);
} | [
"public",
"function",
"sortAsc",
"(",
")",
"{",
"$",
"cmp",
"=",
"function",
"(",
"TagInterface",
"$",
"a",
",",
"TagInterface",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getName",
"(",
")",
"==",
"$",
"b",
"->",
"getName",
"(",
")",
")",
... | Sort the list by elements.
@return void | [
"Sort",
"the",
"list",
"by",
"elements",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/DocBlock/TagCollection.php#L121-L131 |
acasademont/wurfl | WURFL/Configuration/Config.php | WURFL_Configuration_Config.getFullPath | protected function getFullPath($fileName)
{
;
$fileName = trim($fileName);
if (realpath($fileName) && !(basename($fileName) === $fileName)) {
return realpath($fileName);
}
$fullName = join(DIRECTORY_SEPARATOR, array($this->configurationFileDir, $fileName));
... | php | protected function getFullPath($fileName)
{
;
$fileName = trim($fileName);
if (realpath($fileName) && !(basename($fileName) === $fileName)) {
return realpath($fileName);
}
$fullName = join(DIRECTORY_SEPARATOR, array($this->configurationFileDir, $fileName));
... | [
"protected",
"function",
"getFullPath",
"(",
"$",
"fileName",
")",
"{",
";",
"$",
"fileName",
"=",
"trim",
"(",
"$",
"fileName",
")",
";",
"if",
"(",
"realpath",
"(",
"$",
"fileName",
")",
"&&",
"!",
"(",
"basename",
"(",
"$",
"fileName",
")",
"===",... | Return the full path
@param string $fileName
@throws WURFL_WURFLException The configuration file does not exist
@return string File name including full path | [
"Return",
"the",
"full",
"path"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/Config.php#L175-L188 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig.initialize | protected function initialize()
{
$xmlConfig = simplexml_load_file($this->configFilePath);
$this->wurflFile = $this->wurflFile($xmlConfig->xpath('/wurfl-config/wurfl/main-file'));
$this->wurflPatches = $this->wurflPatches($xmlConfig->xpath('/wurfl-config/wurfl/patches/patch'));
$this... | php | protected function initialize()
{
$xmlConfig = simplexml_load_file($this->configFilePath);
$this->wurflFile = $this->wurflFile($xmlConfig->xpath('/wurfl-config/wurfl/main-file'));
$this->wurflPatches = $this->wurflPatches($xmlConfig->xpath('/wurfl-config/wurfl/patches/patch'));
$this... | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"$",
"xmlConfig",
"=",
"simplexml_load_file",
"(",
"$",
"this",
"->",
"configFilePath",
")",
";",
"$",
"this",
"->",
"wurflFile",
"=",
"$",
"this",
"->",
"wurflFile",
"(",
"$",
"xmlConfig",
"->",
"xpath... | Initialize XML Configuration | [
"Initialize",
"XML",
"Configuration"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L27-L38 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig.wurflPatches | private function wurflPatches($patchElements)
{
$patches = array();
if ($patchElements) {
foreach ($patchElements as $patchElement) {
$patches[] = parent::getFullPath((string)$patchElement);
}
}
return $patches;
} | php | private function wurflPatches($patchElements)
{
$patches = array();
if ($patchElements) {
foreach ($patchElements as $patchElement) {
$patches[] = parent::getFullPath((string)$patchElement);
}
}
return $patches;
} | [
"private",
"function",
"wurflPatches",
"(",
"$",
"patchElements",
")",
"{",
"$",
"patches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"patchElements",
")",
"{",
"foreach",
"(",
"$",
"patchElements",
"as",
"$",
"patchElement",
")",
"{",
"$",
"patches",... | Returns an array of full path WURFL patches
@param array $patchElements array of SimpleXMLElement objects
@return array WURFL Patches | [
"Returns",
"an",
"array",
"of",
"full",
"path",
"WURFL",
"patches"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L55-L64 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig.capabilityFilter | private function capabilityFilter($capabilityFilter)
{
$filter = array();
if ($capabilityFilter) {
foreach ($capabilityFilter as $filterElement) {
$filter[] = (string)$filterElement;
}
}
return $filter;
} | php | private function capabilityFilter($capabilityFilter)
{
$filter = array();
if ($capabilityFilter) {
foreach ($capabilityFilter as $filterElement) {
$filter[] = (string)$filterElement;
}
}
return $filter;
} | [
"private",
"function",
"capabilityFilter",
"(",
"$",
"capabilityFilter",
")",
"{",
"$",
"filter",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"capabilityFilter",
")",
"{",
"foreach",
"(",
"$",
"capabilityFilter",
"as",
"$",
"filterElement",
")",
"{",
"$",... | Returns an array of WURFL Capabilities
@param array $capabilityFilter array of SimpleXMLElement objects
@return array WURFL Capabilities | [
"Returns",
"an",
"array",
"of",
"WURFL",
"Capabilities"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L71-L80 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig.matchMode | private function matchMode($modeElement)
{
if (!empty($modeElement)) {
$mode = $modeElement[0];
if (!$mode) {
return $this->matchMode;
}
if (!self::validMatchMode($mode)) {
throw new WURFL_WURFLException('Invalid Match Mode: '.$... | php | private function matchMode($modeElement)
{
if (!empty($modeElement)) {
$mode = $modeElement[0];
if (!$mode) {
return $this->matchMode;
}
if (!self::validMatchMode($mode)) {
throw new WURFL_WURFLException('Invalid Match Mode: '.$... | [
"private",
"function",
"matchMode",
"(",
"$",
"modeElement",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"modeElement",
")",
")",
"{",
"$",
"mode",
"=",
"$",
"modeElement",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"$",
"mode",
")",
"{",
"return",
"$"... | Returns the mode of operation if set, otherwise null
@param array $modeElement array of SimpleXMLElement objects
@return boolean | [
"Returns",
"the",
"mode",
"of",
"operation",
"if",
"set",
"otherwise",
"null"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L100-L113 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig.persistence | private function persistence($persistenceElement)
{
$persistence = array();
if ($persistenceElement) {
$persistence['provider'] = (string)$persistenceElement[0]->provider;
$persistence['params'] = $this->_toArray((string)$persistenceElement[0]->params);
}
retu... | php | private function persistence($persistenceElement)
{
$persistence = array();
if ($persistenceElement) {
$persistence['provider'] = (string)$persistenceElement[0]->provider;
$persistence['params'] = $this->_toArray((string)$persistenceElement[0]->params);
}
retu... | [
"private",
"function",
"persistence",
"(",
"$",
"persistenceElement",
")",
"{",
"$",
"persistence",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"persistenceElement",
")",
"{",
"$",
"persistence",
"[",
"'provider'",
"]",
"=",
"(",
"string",
")",
"$",
"pe... | Returns persistence provider info from XML config
@param array $persistenceElement array of SimpleXMLElement objects
@return array Persistence info | [
"Returns",
"persistence",
"provider",
"info",
"from",
"XML",
"config"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L133-L141 |
acasademont/wurfl | WURFL/Configuration/XmlConfig.php | WURFL_Configuration_XmlConfig._toArray | private function _toArray($params)
{
$paramsArray = array();
foreach (explode(',', $params) as $param) {
$paramNameValue = explode('=', $param);
if (count($paramNameValue) > 1) {
if (strcmp(WURFL_Configuration_Config::DIR, $paramNameValue[0]) == 0) {
... | php | private function _toArray($params)
{
$paramsArray = array();
foreach (explode(',', $params) as $param) {
$paramNameValue = explode('=', $param);
if (count($paramNameValue) > 1) {
if (strcmp(WURFL_Configuration_Config::DIR, $paramNameValue[0]) == 0) {
... | [
"private",
"function",
"_toArray",
"(",
"$",
"params",
")",
"{",
"$",
"paramsArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"params",
")",
"as",
"$",
"param",
")",
"{",
"$",
"paramNameValue",
"=",
"explode",
"("... | Converts given CSV $params to array of parameters
@param string $params Comma-seperated list of parameters
@return array Parameters | [
"Converts",
"given",
"CSV",
"$params",
"to",
"array",
"of",
"parameters"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/XmlConfig.php#L148-L162 |
acasademont/wurfl | WURFL/VirtualCapabilityProvider.php | WURFL_VirtualCapabilityProvider.getRequiredCapabilities | public static function getRequiredCapabilities()
{
$caps = array();
foreach (self::$virtual_capabilities as $cap_name => $vc_name) {
if (strpos($vc_name, '.') !== false) {
// Group of capabilities
list($group, $property) = explode('.', $vc_name);
... | php | public static function getRequiredCapabilities()
{
$caps = array();
foreach (self::$virtual_capabilities as $cap_name => $vc_name) {
if (strpos($vc_name, '.') !== false) {
// Group of capabilities
list($group, $property) = explode('.', $vc_name);
... | [
"public",
"static",
"function",
"getRequiredCapabilities",
"(",
")",
"{",
"$",
"caps",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"virtual_capabilities",
"as",
"$",
"cap_name",
"=>",
"$",
"vc_name",
")",
"{",
"if",
"(",
"strpos",
"("... | Returns an array of all the required capabilities for all virtual capabilities
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"required",
"capabilities",
"for",
"all",
"virtual",
"capabilities"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapabilityProvider.php#L99-L119 |
acasademont/wurfl | WURFL/VirtualCapabilityProvider.php | WURFL_VirtualCapabilityProvider.getAll | public function getAll()
{
$all = array();
foreach (self::$virtual_capabilities as $name => $class) {
$all[$name] = $this->get($name);
}
return $all;
} | php | public function getAll()
{
$all = array();
foreach (self::$virtual_capabilities as $name => $class) {
$all[$name] = $this->get($name);
}
return $all;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"all",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"virtual_capabilities",
"as",
"$",
"name",
"=>",
"$",
"class",
")",
"{",
"$",
"all",
"[",
"$",
"name",
"]",
"=",
"$",
"this... | Gets an array of all the virtual capabilities
@return array Virtual capabilities in format "name => value" | [
"Gets",
"an",
"array",
"of",
"all",
"the",
"virtual",
"capabilities"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapabilityProvider.php#L125-L132 |
acasademont/wurfl | WURFL/VirtualCapabilityProvider.php | WURFL_VirtualCapabilityProvider.get | public function get($name)
{
$control_value = $this->getControlValue($name);
// The value is null if it is not in the loaded WURFL, it's default if it is loaded and not overridden
if ($control_value === null || $control_value == self::WURFL_CONTROL_DEFAULT) {
// The cont... | php | public function get($name)
{
$control_value = $this->getControlValue($name);
// The value is null if it is not in the loaded WURFL, it's default if it is loaded and not overridden
if ($control_value === null || $control_value == self::WURFL_CONTROL_DEFAULT) {
// The cont... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"control_value",
"=",
"$",
"this",
"->",
"getControlValue",
"(",
"$",
"name",
")",
";",
"// The value is null if it is not in the loaded WURFL, it's default if it is loaded and not overridden",
"if",
"(",
"$"... | Returns the value of the virtual capability
@param string $name
@return string|bool|int|float | [
"Returns",
"the",
"value",
"of",
"the",
"virtual",
"capability"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapabilityProvider.php#L139-L159 |
acasademont/wurfl | WURFL/VirtualCapabilityProvider.php | WURFL_VirtualCapabilityProvider.getObject | public function getObject($name)
{
if (!array_key_exists($name, $this->cache)) {
if (($pos = strpos(self::$virtual_capabilities[$name], '.')) !== false) {
// Group of capabilities
list($group, $property) = explode('.', self::$virtual_capabilities[$name]);
... | php | public function getObject($name)
{
if (!array_key_exists($name, $this->cache)) {
if (($pos = strpos(self::$virtual_capabilities[$name], '.')) !== false) {
// Group of capabilities
list($group, $property) = explode('.', self::$virtual_capabilities[$name]);
... | [
"public",
"function",
"getObject",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"cache",
")",
")",
"{",
"if",
"(",
"(",
"$",
"pos",
"=",
"strpos",
"(",
"self",
"::",
"$",
"virtual_capabil... | Returns the WURFL_VirtualCapability object for the given $name.
@param string $name
@return WURFL_VirtualCapability | [
"Returns",
"the",
"WURFL_VirtualCapability",
"object",
"for",
"the",
"given",
"$name",
"."
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapabilityProvider.php#L166-L189 |
alexpts/psr15-middlewares | src/JsonPayload.php | JsonPayload.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
{
$method = $request->getMethod();
if (!\in_array($method, $this->ignoreHttpMethods, true) && $this->isSupportContentType($request)) {
$parsedJson = $this->parse($request);
... | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
{
$method = $request->getMethod();
if (!\in_array($method, $this->ignoreHttpMethods, true) && $this->isSupportContentType($request)) {
$parsedJson = $this->parse($request);
... | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"next",
")",
":",
"ResponseInterface",
"{",
"$",
"method",
"=",
"$",
"request",
"->",
"getMethod",
"(",
")",
";",
"if",
"(",
"!",
"\\",
"in_a... | @param ServerRequestInterface $request
@param RequestHandlerInterface $next
@return ResponseInterface
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \DomainException | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"RequestHandlerInterface",
"$next"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/JsonPayload.php#L34-L43 |
alexpts/psr15-middlewares | src/JsonPayload.php | JsonPayload.parse | protected function parse(ServerRequestInterface $request): array
{
$body = $request->getBody()->getContents();
if ($body === '') {
return [];
}
$parsedJson = \json_decode($body, true, $this->decodeDepth, $this->decodeOptions);
if (json_last_error() !== JSON_ERRO... | php | protected function parse(ServerRequestInterface $request): array
{
$body = $request->getBody()->getContents();
if ($body === '') {
return [];
}
$parsedJson = \json_decode($body, true, $this->decodeDepth, $this->decodeOptions);
if (json_last_error() !== JSON_ERRO... | [
"protected",
"function",
"parse",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"array",
"{",
"$",
"body",
"=",
"$",
"request",
"->",
"getBody",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"if",
"(",
"$",
"body",
"===",
"''",
")",
"{",
"... | @param ServerRequestInterface $request
@return array
@throws \DomainException
@throws \RuntimeException | [
"@param",
"ServerRequestInterface",
"$request"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/JsonPayload.php#L53-L67 |
alexpts/psr15-middlewares | src/JsonPayload.php | JsonPayload.isSupportContentType | protected function isSupportContentType(ServerRequestInterface $request): bool
{
$contentType = $request->getHeaderLine('content-type');
foreach ($this->allowContentTypes as $allowContentType) {
if (stripos($contentType, $allowContentType) === 0) {
return true;
... | php | protected function isSupportContentType(ServerRequestInterface $request): bool
{
$contentType = $request->getHeaderLine('content-type');
foreach ($this->allowContentTypes as $allowContentType) {
if (stripos($contentType, $allowContentType) === 0) {
return true;
... | [
"protected",
"function",
"isSupportContentType",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"bool",
"{",
"$",
"contentType",
"=",
"$",
"request",
"->",
"getHeaderLine",
"(",
"'content-type'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"allowConte... | @param ServerRequestInterface $request
@return bool | [
"@param",
"ServerRequestInterface",
"$request"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/JsonPayload.php#L74-L85 |
toxor88/yii2-widget-switchery | Switchery.php | Switchery.run | public function run()
{
$this->registerAssets();
if ($this->hasModel()) {
echo Html::activeCheckbox($this->model, $this->attribute, $this->options);
} else {
$checked = ArrayHelper::remove($this->options, 'checked', false);
echo Html::checkbox($th... | php | public function run()
{
$this->registerAssets();
if ($this->hasModel()) {
echo Html::activeCheckbox($this->model, $this->attribute, $this->options);
} else {
$checked = ArrayHelper::remove($this->options, 'checked', false);
echo Html::checkbox($th... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"registerAssets",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasModel",
"(",
")",
")",
"{",
"echo",
"Html",
"::",
"activeCheckbox",
"(",
"$",
"this",
"->",
"model",
",",
"$",
"this",... | Runs the widget
@return string | [
"Runs",
"the",
"widget"
] | train | https://github.com/toxor88/yii2-widget-switchery/blob/ddee54d4d486a514d3b02a249f2cc3833b020d0c/Switchery.php#L83-L93 |
toxor88/yii2-widget-switchery | Switchery.php | Switchery.registerPlugin | protected function registerPlugin()
{
if (!isset($this->options['id'])) {
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
} else {
$this->setId($this->options['id']);
}
$clientOptions = [];... | php | protected function registerPlugin()
{
if (!isset($this->options['id'])) {
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
} else {
$this->setId($this->options['id']);
}
$clientOptions = [];... | [
"protected",
"function",
"registerPlugin",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
"hasModel",
"(",
")",
"... | Registers switchery plugin | [
"Registers",
"switchery",
"plugin"
] | train | https://github.com/toxor88/yii2-widget-switchery/blob/ddee54d4d486a514d3b02a249f2cc3833b020d0c/Switchery.php#L98-L114 |
toxor88/yii2-widget-switchery | Switchery.php | Switchery.registerAssets | public function registerAssets()
{
$id = Inflector::variablize($this->getId());
$view = $this->getView();
SwitcheryAsset::register($view);
$selector = $id . 'Element';
$options = [$selector];
if (!empty($this->clientOptions)) {
$... | php | public function registerAssets()
{
$id = Inflector::variablize($this->getId());
$view = $this->getView();
SwitcheryAsset::register($view);
$selector = $id . 'Element';
$options = [$selector];
if (!empty($this->clientOptions)) {
$... | [
"public",
"function",
"registerAssets",
"(",
")",
"{",
"$",
"id",
"=",
"Inflector",
"::",
"variablize",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
")",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"SwitcheryAsset",
"::",
"regis... | Registers the needed assets | [
"Registers",
"the",
"needed",
"assets"
] | train | https://github.com/toxor88/yii2-widget-switchery/blob/ddee54d4d486a514d3b02a249f2cc3833b020d0c/Switchery.php#L119-L144 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.getHeader | public final function getHeader($name): array
{
$key = $this->parseHeaderName($name);
return array_key_exists($key, $this->header) ? $this->header[$key] : [];
} | php | public final function getHeader($name): array
{
$key = $this->parseHeaderName($name);
return array_key_exists($key, $this->header) ? $this->header[$key] : [];
} | [
"public",
"final",
"function",
"getHeader",
"(",
"$",
"name",
")",
":",
"array",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"parseHeaderName",
"(",
"$",
"name",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"header",
... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::getHeader() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L160-L164 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.getHeaderLine | public final function getHeaderLine($name): string
{
$key = $this->parseHeaderName($name);
return array_key_exists($key, $this->header)
? implode(",", $this->header[$key])
: "";
} | php | public final function getHeaderLine($name): string
{
$key = $this->parseHeaderName($name);
return array_key_exists($key, $this->header)
? implode(",", $this->header[$key])
: "";
} | [
"public",
"final",
"function",
"getHeaderLine",
"(",
"$",
"name",
")",
":",
"string",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"parseHeaderName",
"(",
"$",
"name",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"header... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::getHeaderLine() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L170-L176 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.withHeader | public final function withHeader($name, $value): MessageInterface
{
$value = $this->parseHeaderValue($value);
if (!is_string($name) || [] === $value) {
throw new InvalidArgumentException(
"Can't get instance for header: invalid " . $name);
}
$header = $thi... | php | public final function withHeader($name, $value): MessageInterface
{
$value = $this->parseHeaderValue($value);
if (!is_string($name) || [] === $value) {
throw new InvalidArgumentException(
"Can't get instance for header: invalid " . $name);
}
$header = $thi... | [
"public",
"final",
"function",
"withHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
":",
"MessageInterface",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"parseHeaderValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::withHeader() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L182-L192 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.withAddedHeader | public final function withAddedHeader($name, $value): MessageInterface
{
$key = $this->parseHeaderName($name);
$header = $this->header;
if (!array_key_exists($key, $header)) {
$value = $this->parseHeaderValue($value);
if ("" === $key || [] === $value) {
... | php | public final function withAddedHeader($name, $value): MessageInterface
{
$key = $this->parseHeaderName($name);
$header = $this->header;
if (!array_key_exists($key, $header)) {
$value = $this->parseHeaderValue($value);
if ("" === $key || [] === $value) {
... | [
"public",
"final",
"function",
"withAddedHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
":",
"MessageInterface",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"parseHeaderName",
"(",
"$",
"name",
")",
";",
"$",
"header",
"=",
"$",
"this",
"->",
"header"... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::withAddedHeader() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L198-L211 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.withoutHeader | public final function withoutHeader($name): MessageInterface
{
$key = $this->parseHeaderName($name);
$header = $this->header;
if (array_key_exists($key, $header)) {
unset($header[$key]);
}
return $this->with("header", $header);
} | php | public final function withoutHeader($name): MessageInterface
{
$key = $this->parseHeaderName($name);
$header = $this->header;
if (array_key_exists($key, $header)) {
unset($header[$key]);
}
return $this->with("header", $header);
} | [
"public",
"final",
"function",
"withoutHeader",
"(",
"$",
"name",
")",
":",
"MessageInterface",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"parseHeaderName",
"(",
"$",
"name",
")",
";",
"$",
"header",
"=",
"$",
"this",
"->",
"header",
";",
"if",
"(",
"... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::withoutHeader() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L217-L225 |
seeren/http | src/Message/AbstractMessage.php | AbstractMessage.withBody | public final function withBody(StreamInterface $body): MessageInterface
{
if (!$body->getMetadata("uri")) {
throw new InvalidArgumentException(
"Can't get instance for body: invalid stream");
}
return $this->with("body", $body);
} | php | public final function withBody(StreamInterface $body): MessageInterface
{
if (!$body->getMetadata("uri")) {
throw new InvalidArgumentException(
"Can't get instance for body: invalid stream");
}
return $this->with("body", $body);
} | [
"public",
"final",
"function",
"withBody",
"(",
"StreamInterface",
"$",
"body",
")",
":",
"MessageInterface",
"{",
"if",
"(",
"!",
"$",
"body",
"->",
"getMetadata",
"(",
"\"uri\"",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Can't get in... | {@inheritDoc}
@see \Psr\Http\Message\MessageInterface::withBody() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Message/AbstractMessage.php#L240-L247 |
phramework/validate | src/AllOf.php | AllOf.validate | public function validate($value)
{
$this->requiredCountOfAnyOf = count($this->allOf);
return parent::validate($value);
} | php | public function validate($value)
{
$this->requiredCountOfAnyOf = count($this->allOf);
return parent::validate($value);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"requiredCountOfAnyOf",
"=",
"count",
"(",
"$",
"this",
"->",
"allOf",
")",
";",
"return",
"parent",
"::",
"validate",
"(",
"$",
"value",
")",
";",
"}"
] | Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param mixed $value Value to validate
@return ValidateResult
@uses $requiredCountOfAnyOf
@uses \Phramework\Validate\AnyOf::validate | [
"Validate",
"value"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/AllOf.php#L79-L84 |
lcobucci/chimera-bus-tactician | src/ReadModelConversionMiddleware.php | ReadModelConversionMiddleware.execute | public function execute($query, callable $next)
{
$result = $next($query);
return $this->converter->convert($query, $result);
} | php | public function execute($query, callable $next)
{
$result = $next($query);
return $this->converter->convert($query, $result);
} | [
"public",
"function",
"execute",
"(",
"$",
"query",
",",
"callable",
"$",
"next",
")",
"{",
"$",
"result",
"=",
"$",
"next",
"(",
"$",
"query",
")",
";",
"return",
"$",
"this",
"->",
"converter",
"->",
"convert",
"(",
"$",
"query",
",",
"$",
"resul... | @param object|mixed $query
@return mixed | [
"@param",
"object|mixed",
"$query"
] | train | https://github.com/lcobucci/chimera-bus-tactician/blob/58233d8a1892470d9f4bbe380f4fbd26c210203e/src/ReadModelConversionMiddleware.php#L26-L31 |
drunomics/service-utils | src/user/SharedTempStoreFactoryTrait.php | SharedTempStoreFactoryTrait.getSharedTempStoreFactory | public function getSharedTempStoreFactory() {
if (empty($this->sharedTempStoreFactory)) {
$this->sharedTempStoreFactory = \Drupal::service('user.shared_tempstore');
}
return $this->sharedTempStoreFactory;
} | php | public function getSharedTempStoreFactory() {
if (empty($this->sharedTempStoreFactory)) {
$this->sharedTempStoreFactory = \Drupal::service('user.shared_tempstore');
}
return $this->sharedTempStoreFactory;
} | [
"public",
"function",
"getSharedTempStoreFactory",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sharedTempStoreFactory",
")",
")",
"{",
"$",
"this",
"->",
"sharedTempStoreFactory",
"=",
"\\",
"Drupal",
"::",
"service",
"(",
"'user.shared_tempstore... | Gets shared tempstore factory.
@return \Drupal\user\SharedTempStoreFactory
Shared tempstore factory. | [
"Gets",
"shared",
"tempstore",
"factory",
"."
] | train | https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/user/SharedTempStoreFactoryTrait.php#L38-L43 |
graphp/plaintext | src/File.php | File.getLines | protected function getLines()
{
$ret = file($this->fileName);
if ($ret === false) {
throw new Exception('Unable to read file');
}
$lines = array();
foreach ($ret as $line) {
$lines[] = rtrim($line);
}
return $lines;
} | php | protected function getLines()
{
$ret = file($this->fileName);
if ($ret === false) {
throw new Exception('Unable to read file');
}
$lines = array();
foreach ($ret as $line) {
$lines[] = rtrim($line);
}
return $lines;
} | [
"protected",
"function",
"getLines",
"(",
")",
"{",
"$",
"ret",
"=",
"file",
"(",
"$",
"this",
"->",
"fileName",
")",
";",
"if",
"(",
"$",
"ret",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Unable to read file'",
")",
";",
"}",
"$",... | get an array of all lines in this file
@return string[]
@throws InvalidArgumentException if file can not be read | [
"get",
"an",
"array",
"of",
"all",
"lines",
"in",
"this",
"file"
] | train | https://github.com/graphp/plaintext/blob/77cfdc71558f7d04860afc73b4b5e70eded21f00/src/File.php#L24-L36 |
graphp/plaintext | src/File.php | File.readLine | protected function readLine($line, $parts, Graph $graph = NULL)
{
$ret = array();
$explode = explode("\t", $line);
$i = 0;
foreach ($parts as $key => $part) {
if (!isset($explode[$i])) {
throw new InvalidArgumentException('Line does not split into enough p... | php | protected function readLine($line, $parts, Graph $graph = NULL)
{
$ret = array();
$explode = explode("\t", $line);
$i = 0;
foreach ($parts as $key => $part) {
if (!isset($explode[$i])) {
throw new InvalidArgumentException('Line does not split into enough p... | [
"protected",
"function",
"readLine",
"(",
"$",
"line",
",",
"$",
"parts",
",",
"Graph",
"$",
"graph",
"=",
"NULL",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"explode",
"=",
"explode",
"(",
"\"\\t\"",
",",
"$",
"line",
")",
";",
"$",... | read given line string into given array of parts (int, float, vertex)
@param string $line
@param array $parts
@param Graph $graph
@return mixed[]
@throws InvalidArgumentException | [
"read",
"given",
"line",
"string",
"into",
"given",
"array",
"of",
"parts",
"(",
"int",
"float",
"vertex",
")"
] | train | https://github.com/graphp/plaintext/blob/77cfdc71558f7d04860afc73b4b5e70eded21f00/src/File.php#L79-L102 |
phramework/jsonapi | src/Model.php | Model.collection | public static function collection($records = [], Fields $fields = null, $flags = Resource::PARSE_DEFAULT)
{
return Resource::parseFromRecords(
$records,
static::class,
$fields,
$flags
);
} | php | public static function collection($records = [], Fields $fields = null, $flags = Resource::PARSE_DEFAULT)
{
return Resource::parseFromRecords(
$records,
static::class,
$fields,
$flags
);
} | [
"public",
"static",
"function",
"collection",
"(",
"$",
"records",
"=",
"[",
"]",
",",
"Fields",
"$",
"fields",
"=",
"null",
",",
"$",
"flags",
"=",
"Resource",
"::",
"PARSE_DEFAULT",
")",
"{",
"return",
"Resource",
"::",
"parseFromRecords",
"(",
"$",
"r... | Prepare a collection of resources
@param array[]|object[] $records Multiple records fetched from database
[Optional] Write resource and relationship links, defaults is false
@param Fields|null $fields
@param int $flags
@return Resource[]
@uses Resource::parseFromRecords
@example
```php
Model::collection([
[
'id' => '1... | [
"Prepare",
"a",
"collection",
"of",
"resources"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model.php#L96-L104 |
phramework/jsonapi | src/Model.php | Model.resource | public static function resource($record, Fields $fields = null, $flags = Resource::PARSE_DEFAULT)
{
return Resource::parseFromRecord(
$record,
static::class,
$fields,
$flags
);
} | php | public static function resource($record, Fields $fields = null, $flags = Resource::PARSE_DEFAULT)
{
return Resource::parseFromRecord(
$record,
static::class,
$fields,
$flags
);
} | [
"public",
"static",
"function",
"resource",
"(",
"$",
"record",
",",
"Fields",
"$",
"fields",
"=",
"null",
",",
"$",
"flags",
"=",
"Resource",
"::",
"PARSE_DEFAULT",
")",
"{",
"return",
"Resource",
"::",
"parseFromRecord",
"(",
"$",
"record",
",",
"static"... | Prepare an individual resource
@param array|object $record A single record fetched from database
@param Fields|null $fields
@param int $flags
@return Resource|null
@throws \Exception
@uses Resource::parseFromRecord
@example
```php
Model::resource(
[
'id' => '10',
'title' => 'Hello world'
],
null,
Resource::PARSE_DEFAUL... | [
"Prepare",
"an",
"individual",
"resource"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model.php#L126-L134 |
phramework/jsonapi | src/Model.php | Model.post | public static function post(
$attributes,
$return = \Phramework\Database\Operations\Create::RETURN_ID
) {
return \Phramework\Database\Operations\Create::create(
$attributes,
static::getTable(),
static::getSchema(),
$return
);
} | php | public static function post(
$attributes,
$return = \Phramework\Database\Operations\Create::RETURN_ID
) {
return \Phramework\Database\Operations\Create::create(
$attributes,
static::getTable(),
static::getSchema(),
$return
);
} | [
"public",
"static",
"function",
"post",
"(",
"$",
"attributes",
",",
"$",
"return",
"=",
"\\",
"Phramework",
"\\",
"Database",
"\\",
"Operations",
"\\",
"Create",
"::",
"RETURN_ID",
")",
"{",
"return",
"\\",
"Phramework",
"\\",
"Database",
"\\",
"Operations"... | Create a record in database
@param array $attributes
@param \Phramework\Database\Operations\Create::RETURN_ID $return Return type,
default is RETURN_ID
@return mixed
@todo disable post ? | [
"Create",
"a",
"record",
"in",
"database"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model.php#L144-L154 |
phramework/jsonapi | src/Model.php | Model.patch | public static function patch($id, $attributes)
{
static::invalidateCache($id);
return \Phramework\Database\Operations\Update::update(
$id,
(array) $attributes,
(
static::getSchema() === null
? static::getTable()
: [... | php | public static function patch($id, $attributes)
{
static::invalidateCache($id);
return \Phramework\Database\Operations\Update::update(
$id,
(array) $attributes,
(
static::getSchema() === null
? static::getTable()
: [... | [
"public",
"static",
"function",
"patch",
"(",
"$",
"id",
",",
"$",
"attributes",
")",
"{",
"static",
"::",
"invalidateCache",
"(",
"$",
"id",
")",
";",
"return",
"\\",
"Phramework",
"\\",
"Database",
"\\",
"Operations",
"\\",
"Update",
"::",
"update",
"(... | Update selected attributes of a database record
@param mixed $id id attribute's value
@param object $attributes Key-value array with fields to update
@return int Number of updated rows
@todo add query limit | [
"Update",
"selected",
"attributes",
"of",
"a",
"database",
"record"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model.php#L163-L180 |
phramework/jsonapi | src/Model.php | Model.delete | public static function delete($id, $additionalAttributes = null)
{
static::invalidateCache($id);
return \Phramework\Database\Operations\Delete::delete(
$id,
(
$additionalAttributes !== null
? (array) $additionalAttributes
: []
... | php | public static function delete($id, $additionalAttributes = null)
{
static::invalidateCache($id);
return \Phramework\Database\Operations\Delete::delete(
$id,
(
$additionalAttributes !== null
? (array) $additionalAttributes
: []
... | [
"public",
"static",
"function",
"delete",
"(",
"$",
"id",
",",
"$",
"additionalAttributes",
"=",
"null",
")",
"{",
"static",
"::",
"invalidateCache",
"(",
"$",
"id",
")",
";",
"return",
"\\",
"Phramework",
"\\",
"Database",
"\\",
"Operations",
"\\",
"Delet... | Delete a database record
@param mixed $id id attribute's value
@param object $additionalAttributes Object with additional fields
to use in WHERE clause
@return boolean Returns true on success, false on failure | [
"Delete",
"a",
"database",
"record"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model.php#L189-L210 |
huasituo/hstcms | src/Database/Migrations/2016_11_25_093145_create_hook_table.php | CreateHookTable.up | public function up()
{
//
Schema::create('hook', function (Blueprint $table)
{
$table->string('name', 30)->default('')->comment(trans('hstcms::hook.name'));
$table->string('module', 30)->default('manage')->comment(trans('hstcms::hook.module'));
$table->tex... | php | public function up()
{
//
Schema::create('hook', function (Blueprint $table)
{
$table->string('name', 30)->default('')->comment(trans('hstcms::hook.name'));
$table->string('module', 30)->default('manage')->comment(trans('hstcms::hook.module'));
$table->tex... | [
"public",
"function",
"up",
"(",
")",
"{",
"//",
"Schema",
"::",
"create",
"(",
"'hook'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"string",
"(",
"'name'",
",",
"30",
")",
"->",
"default",
"(",
"''",
")",
"->",... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_11_25_093145_create_hook_table.php#L18-L31 |
seeren/http | src/Request/ClientRequest.php | ClientRequest.getResponse | public final function getResponse(): ResponseInterface
{
if (!$this->response) {
try {
$this->send();
} catch (RuntimeException $e) {
throw new RuntimeException(
"Can't get response: " . $e->getMessage());
}
}
... | php | public final function getResponse(): ResponseInterface
{
if (!$this->response) {
try {
$this->send();
} catch (RuntimeException $e) {
throw new RuntimeException(
"Can't get response: " . $e->getMessage());
}
}
... | [
"public",
"final",
"function",
"getResponse",
"(",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"response",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"$",
"e",
")"... | {@inheritDoc}
@see \Seeren\Http\Request\ClientRequestInterface::getResponse() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ClientRequest.php#L84-L95 |
seeren/http | src/Request/ClientRequest.php | ClientRequest.send | public function send(): ClientRequestInterface
{
try {
$this->response = new ClientResponse(
new ClientResponseStream($this));
} catch (InvalidArgumentException $e) {
throw new RuntimeException(
"Can't send client request: " . $e->getMessage())... | php | public function send(): ClientRequestInterface
{
try {
$this->response = new ClientResponse(
new ClientResponseStream($this));
} catch (InvalidArgumentException $e) {
throw new RuntimeException(
"Can't send client request: " . $e->getMessage())... | [
"public",
"function",
"send",
"(",
")",
":",
"ClientRequestInterface",
"{",
"try",
"{",
"$",
"this",
"->",
"response",
"=",
"new",
"ClientResponse",
"(",
"new",
"ClientResponseStream",
"(",
"$",
"this",
")",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentExcep... | {@inheritDoc}
@see \Seeren\Http\Request\ClientRequestInterface::send() | [
"{"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ClientRequest.php#L101-L111 |
movoin/one-swoole | src/Routing/Router.php | Router.addRoute | public function addRoute($methods, string $pattern, string $handler)
{
if (is_string($methods)) {
$methods = (array) $methods;
}
$methods = array_map('strtoupper', $methods);
$this->routes[] = [
$methods,
$pattern,
$handler
];... | php | public function addRoute($methods, string $pattern, string $handler)
{
if (is_string($methods)) {
$methods = (array) $methods;
}
$methods = array_map('strtoupper', $methods);
$this->routes[] = [
$methods,
$pattern,
$handler
];... | [
"public",
"function",
"addRoute",
"(",
"$",
"methods",
",",
"string",
"$",
"pattern",
",",
"string",
"$",
"handler",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"methods",
")",
")",
"{",
"$",
"methods",
"=",
"(",
"array",
")",
"$",
"methods",
";",
... | 添加路由规则
@param string|array $methods
@param string $pattern
@param string $handler | [
"添加路由规则"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Routing/Router.php#L51-L64 |
movoin/one-swoole | src/Routing/Router.php | Router.match | public function match(Request $request): array
{
$uri = $request->getUri()->getPath();
// HTTP & WebSocket 请求
if ($request->getProtocol() === Protocol::HTTP || $request->getProtocol() === Protocol::WEBSOCKET) {
return $this->getDispatcher()->dispatch(
$request->g... | php | public function match(Request $request): array
{
$uri = $request->getUri()->getPath();
// HTTP & WebSocket 请求
if ($request->getProtocol() === Protocol::HTTP || $request->getProtocol() === Protocol::WEBSOCKET) {
return $this->getDispatcher()->dispatch(
$request->g... | [
"public",
"function",
"match",
"(",
"Request",
"$",
"request",
")",
":",
"array",
"{",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"(",
")",
"->",
"getPath",
"(",
")",
";",
"// HTTP & WebSocket 请求",
"if",
"(",
"$",
"request",
"->",
"getProtocol",
... | 匹配请求
@param \One\Protocol\Contracts\Request $request
@return array | [
"匹配请求"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Routing/Router.php#L73-L96 |
movoin/one-swoole | src/Routing/Router.php | Router.getDispatcher | protected function getDispatcher()
{
if ($this->dispatcher === null) {
$collector = new RouteCollector(
new Parser,
new Generator
);
foreach ($this->routes as $route) {
$collector->addRoute($route[0], $route[1], $route[2]);... | php | protected function getDispatcher()
{
if ($this->dispatcher === null) {
$collector = new RouteCollector(
new Parser,
new Generator
);
foreach ($this->routes as $route) {
$collector->addRoute($route[0], $route[1], $route[2]);... | [
"protected",
"function",
"getDispatcher",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dispatcher",
"===",
"null",
")",
"{",
"$",
"collector",
"=",
"new",
"RouteCollector",
"(",
"new",
"Parser",
",",
"new",
"Generator",
")",
";",
"foreach",
"(",
"$",
... | 获得调度器
@return \FastRoute\Dispatcher | [
"获得调度器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Routing/Router.php#L103-L122 |
puli/twig-extension | src/NodeVisitor/AbstractPathResolver.php | AbstractPathResolver.doEnterNode | protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
{
// Remember the directory of the current file
if ($node instanceof Twig_Node_Module && $node->hasAttribute('puli-dir')) {
// Currently, it doesn't seem like Twig does recursive traversals
// (i.e. starti... | php | protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
{
// Remember the directory of the current file
if ($node instanceof Twig_Node_Module && $node->hasAttribute('puli-dir')) {
// Currently, it doesn't seem like Twig does recursive traversals
// (i.e. starti... | [
"protected",
"function",
"doEnterNode",
"(",
"Twig_Node",
"$",
"node",
",",
"Twig_Environment",
"$",
"env",
")",
"{",
"// Remember the directory of the current file",
"if",
"(",
"$",
"node",
"instanceof",
"Twig_Node_Module",
"&&",
"$",
"node",
"->",
"hasAttribute",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/NodeVisitor/AbstractPathResolver.php#L46-L58 |
puli/twig-extension | src/NodeVisitor/AbstractPathResolver.php | AbstractPathResolver.doLeaveNode | protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
{
// Only process if the current directory was set
if (null !== $this->currentDir) {
if ($result = $this->processNode($node)) {
$node = $result;
}
}
return $node;
} | php | protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
{
// Only process if the current directory was set
if (null !== $this->currentDir) {
if ($result = $this->processNode($node)) {
$node = $result;
}
}
return $node;
} | [
"protected",
"function",
"doLeaveNode",
"(",
"Twig_Node",
"$",
"node",
",",
"Twig_Environment",
"$",
"env",
")",
"{",
"// Only process if the current directory was set",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"currentDir",
")",
"{",
"if",
"(",
"$",
"result... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/NodeVisitor/AbstractPathResolver.php#L63-L73 |
puli/twig-extension | src/NodeVisitor/AbstractPathResolver.php | AbstractPathResolver.resolvePath | protected function resolvePath($path, $checkPath = false)
{
// Empty path? WTF I don't want to deal with this.
if ('' === $path) {
return $path;
}
// Absolute paths are fine
if ('/' === $path[0]) {
return $path;
}
// Resolve relative ... | php | protected function resolvePath($path, $checkPath = false)
{
// Empty path? WTF I don't want to deal with this.
if ('' === $path) {
return $path;
}
// Absolute paths are fine
if ('/' === $path[0]) {
return $path;
}
// Resolve relative ... | [
"protected",
"function",
"resolvePath",
"(",
"$",
"path",
",",
"$",
"checkPath",
"=",
"false",
")",
"{",
"// Empty path? WTF I don't want to deal with this.",
"if",
"(",
"''",
"===",
"$",
"path",
")",
"{",
"return",
"$",
"path",
";",
"}",
"// Absolute paths are ... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/twig-extension/blob/b19fce610aa9fda5d86c73045ed5b9d378c47b93/src/NodeVisitor/AbstractPathResolver.php#L78-L104 |
lara-cms/lara | src/Middleware/laraCmsLara.php | LaraCmsLara.handle | public function handle($request, Closure $next)
{
return true;
$auth = Config('lara-cms.lara.master.auth',[]);
if ($this->auth->guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
return redirect()->guest('a... | php | public function handle($request, Closure $next)
{
return true;
$auth = Config('lara-cms.lara.master.auth',[]);
if ($this->auth->guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
return redirect()->guest('a... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"return",
"true",
";",
"$",
"auth",
"=",
"Config",
"(",
"'lara-cms.lara.master.auth'",
",",
"[",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"auth",
"->",
"g... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/lara-cms/lara/blob/cc430c9325f9f702257ab403453af887a3b33e0d/src/Middleware/laraCmsLara.php#L33-L58 |
WebDevTmas/date-repetition | src/DateRepetition/DateRepetitionInterpeter.php | DateRepetitionInterpeter.newDateRepetitionFromString | public static function newDateRepetitionFromString($string)
{
$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$regex = "/^(hourly|daily|weekly|monthly|yearly)( on (" . implode('|', $days) . "))?( at (.*))?$/";
$result = preg_match($regex,... | php | public static function newDateRepetitionFromString($string)
{
$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$regex = "/^(hourly|daily|weekly|monthly|yearly)( on (" . implode('|', $days) . "))?( at (.*))?$/";
$result = preg_match($regex,... | [
"public",
"static",
"function",
"newDateRepetitionFromString",
"(",
"$",
"string",
")",
"{",
"$",
"days",
"=",
"array",
"(",
"'monday'",
",",
"'tuesday'",
",",
"'wednesday'",
",",
"'thursday'",
",",
"'friday'",
",",
"'saturday'",
",",
"'sunday'",
")",
";",
"... | "hourly at minute 15" returns new HourlyDateRepetition(15)
"daily at 9:30" returns new DailyDateRepition(9, 30)
"weekly on monday at 8:15" returns new WeeklyDateRepetition('monday', 8, 15)
@param string
@return DateRepetition | [
"hourly",
"at",
"minute",
"15",
"returns",
"new",
"HourlyDateRepetition",
"(",
"15",
")",
"daily",
"at",
"9",
":",
"30",
"returns",
"new",
"DailyDateRepition",
"(",
"9",
"30",
")",
"weekly",
"on",
"monday",
"at",
"8",
":",
"15",
"returns",
"new",
"Weekly... | train | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DateRepetitionInterpeter.php#L19-L47 |
WebDevTmas/date-repetition | src/DateRepetition/DateRepetitionInterpeter.php | DateRepetitionInterpeter.convertDateRepetitionToString | public static function convertDateRepetitionToString(DateRepetition $dateRepetition)
{
$dateString = '';
if($dateRepetition instanceof HourlyDateRepetition) {
$prefix = 'hourly';
$timeString = ' at minute ' . $dateRepetition->getMinute();
}
if($dateRepetition... | php | public static function convertDateRepetitionToString(DateRepetition $dateRepetition)
{
$dateString = '';
if($dateRepetition instanceof HourlyDateRepetition) {
$prefix = 'hourly';
$timeString = ' at minute ' . $dateRepetition->getMinute();
}
if($dateRepetition... | [
"public",
"static",
"function",
"convertDateRepetitionToString",
"(",
"DateRepetition",
"$",
"dateRepetition",
")",
"{",
"$",
"dateString",
"=",
"''",
";",
"if",
"(",
"$",
"dateRepetition",
"instanceof",
"HourlyDateRepetition",
")",
"{",
"$",
"prefix",
"=",
"'hour... | converts DateRepetition to a string accepted by 'newDateRepetitionFromString'
@param DateRepetition
@return string | [
"converts",
"DateRepetition",
"to",
"a",
"string",
"accepted",
"by",
"newDateRepetitionFromString"
] | train | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DateRepetitionInterpeter.php#L55-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.