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 |
|---|---|---|---|---|---|---|---|---|---|---|
pencepay/pencepay-php | lib/Pencepay/User.php | Pencepay_User.enable2FA | public static function enable2FA($userUid, $authenticationKey, $verificationCode) {
$request = array(
'authenticationKey' => $authenticationKey,
'verificationCode' => $verificationCode
);
return Pencepay_Util_HttpClient::postArray("/user/$userUid/tfa_enable", $request);
... | php | public static function enable2FA($userUid, $authenticationKey, $verificationCode) {
$request = array(
'authenticationKey' => $authenticationKey,
'verificationCode' => $verificationCode
);
return Pencepay_Util_HttpClient::postArray("/user/$userUid/tfa_enable", $request);
... | [
"public",
"static",
"function",
"enable2FA",
"(",
"$",
"userUid",
",",
"$",
"authenticationKey",
",",
"$",
"verificationCode",
")",
"{",
"$",
"request",
"=",
"array",
"(",
"'authenticationKey'",
"=>",
"$",
"authenticationKey",
",",
"'verificationCode'",
"=>",
"$... | Enables the two-factor authentication for this user.
@param string $userUid
@param string $authenticationKey
@param string $verificationCode
@return array | [
"Enables",
"the",
"two",
"-",
"factor",
"authentication",
"for",
"this",
"user",
"."
] | train | https://github.com/pencepay/pencepay-php/blob/fad91d56f3a39640ff6cb7e9d137d03a65cdd1cd/lib/Pencepay/User.php#L96-L102 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/HttpClient/BuzzHttpClient.php | BuzzHttpClient.get | public function get($uri, array $params = array())
{
$uri .= '?' . http_build_query($params);
return $this->client->get($uri);
} | php | public function get($uri, array $params = array())
{
$uri .= '?' . http_build_query($params);
return $this->client->get($uri);
} | [
"public",
"function",
"get",
"(",
"$",
"uri",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"uri",
".=",
"'?'",
".",
"http_build_query",
"(",
"$",
"params",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
... | (non-PHPdoc)
@see \TheTwelve\Foursquare.HttpClient::get() | [
"(",
"non",
"-",
"PHPdoc",
")"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/HttpClient/BuzzHttpClient.php#L28-L34 |
huasituo/hstcms | src/Providers/LibrariesServiceProvider.php | LibrariesServiceProvider.register | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Libraries');
$libraries = $file->glob($path.'/*.php');
foreach ($libraries as $librarie) {
require_once($librarie);
}
$libraries2 = $file->glob($pa... | php | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Libraries');
$libraries = $file->glob($path.'/*.php');
foreach ($libraries as $librarie) {
require_once($librarie);
}
$libraries2 = $file->glob($pa... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"Filesystem",
"::",
"class",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../Libraries'",
")",
";",
"$",
"libraries",
"... | Register the libraries services.
@return void | [
"Register",
"the",
"libraries",
"services",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/LibrariesServiceProvider.php#L29-L58 |
siriusphp/html | src/Tag/MultiSelect.php | MultiSelect.getOptionsString | protected function getOptionsString()
{
$value = $this->getValue();
$options = '';
if ($this->get('_first_option')) {
$options .= sprintf('<option value="">%s</option>', $this->get('_first_option'));
}
$optionsList = $this->get('_options') ?: array();
fo... | php | protected function getOptionsString()
{
$value = $this->getValue();
$options = '';
if ($this->get('_first_option')) {
$options .= sprintf('<option value="">%s</option>', $this->get('_first_option'));
}
$optionsList = $this->get('_options') ?: array();
fo... | [
"protected",
"function",
"getOptionsString",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"$",
"options",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'_first_option'",
")",
")",
"{",
"$",
"options",
... | Generates the string with the list of the <OPTIONS> elements
@return string | [
"Generates",
"the",
"string",
"with",
"the",
"list",
"of",
"the",
"<OPTIONS",
">",
"elements"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag/MultiSelect.php#L11-L29 |
esperecyan/dictionary-php | src/internal/Transliterator.php | Transliterator.translateUsingLatinAlphabet | public static function translateUsingLatinAlphabet(string $kanjiAndKanaString): string
{
return static::deleteMarks(
(new JpnForPhpTransliterator())->setSystem(new Hepburn())
->transliterate(preg_match('/[^ -~]/u', $kanjiAndKanaString)
? static::translateUsingKata... | php | public static function translateUsingLatinAlphabet(string $kanjiAndKanaString): string
{
return static::deleteMarks(
(new JpnForPhpTransliterator())->setSystem(new Hepburn())
->transliterate(preg_match('/[^ -~]/u', $kanjiAndKanaString)
? static::translateUsingKata... | [
"public",
"static",
"function",
"translateUsingLatinAlphabet",
"(",
"string",
"$",
"kanjiAndKanaString",
")",
":",
"string",
"{",
"return",
"static",
"::",
"deleteMarks",
"(",
"(",
"new",
"JpnForPhpTransliterator",
"(",
")",
")",
"->",
"setSystem",
"(",
"new",
"... | 文字列中のひらがな・カタカナ・漢字を、可能な限りヘボン式ローマ文字に変換し、文節と思われる部分にハイフンマイナスを挟みます。
@param string $kanjiAndKanaString
@return string | [
"文字列中のひらがな・カタカナ・漢字を、可能な限りヘボン式ローマ文字に変換し、文節と思われる部分にハイフンマイナスを挟みます。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/internal/Transliterator.php#L19-L27 |
esperecyan/dictionary-php | src/internal/Transliterator.php | Transliterator.deleteMarks | protected static function deleteMarks(string $input): string
{
return preg_replace(
'/\\p{M}+/u',
'',
\Normalizer::normalize($input, \Normalizer::FORM_KD)
);
} | php | protected static function deleteMarks(string $input): string
{
return preg_replace(
'/\\p{M}+/u',
'',
\Normalizer::normalize($input, \Normalizer::FORM_KD)
);
} | [
"protected",
"static",
"function",
"deleteMarks",
"(",
"string",
"$",
"input",
")",
":",
"string",
"{",
"return",
"preg_replace",
"(",
"'/\\\\p{M}+/u'",
",",
"''",
",",
"\\",
"Normalizer",
"::",
"normalize",
"(",
"$",
"input",
",",
"\\",
"Normalizer",
"::",
... | 文字列のダイアクリティカルマークや囲みを外します。
@param string $input
@return string | [
"文字列のダイアクリティカルマークや囲みを外します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/internal/Transliterator.php#L34-L41 |
esperecyan/dictionary-php | src/internal/Transliterator.php | Transliterator.translateUsingKatakana | protected static function translateUsingKatakana(string $kanjiAndKanaString): string
{
if (!static::$igo) {
static::$igo = new \Igo\Tagger(['dict_dir' => __DIR__ . '/../../naist-jdic']);
}
return implode('-', array_map(function ($morpheme) {
$feature = explode(',', $... | php | protected static function translateUsingKatakana(string $kanjiAndKanaString): string
{
if (!static::$igo) {
static::$igo = new \Igo\Tagger(['dict_dir' => __DIR__ . '/../../naist-jdic']);
}
return implode('-', array_map(function ($morpheme) {
$feature = explode(',', $... | [
"protected",
"static",
"function",
"translateUsingKatakana",
"(",
"string",
"$",
"kanjiAndKanaString",
")",
":",
"string",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"igo",
")",
"{",
"static",
"::",
"$",
"igo",
"=",
"new",
"\\",
"Igo",
"\\",
"Tagger",
"("... | 文字列中のひらがな・漢字を、可能な限りカタカナに変換し、文節と思われる部分にハイフンマイナスを挟みます。
@param string $kanjiAndKanaString
@return string | [
"文字列中のひらがな・漢字を、可能な限りカタカナに変換し、文節と思われる部分にハイフンマイナスを挟みます。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/internal/Transliterator.php#L48-L60 |
e0ipso/drupal-unit-autoload | src/Discovery/PathFinderContrib.php | PathFinderContrib.find | public function find($seed) {
// To find contrib, we need to know where core is first. Pass the empty
// string to as the path so we get the path for core itself -and not a path
// relative to the core install-.
$core_path = $this->coreFinder->find($seed);
// Create the RecursiveDirectoryIterator o... | php | public function find($seed) {
// To find contrib, we need to know where core is first. Pass the empty
// string to as the path so we get the path for core itself -and not a path
// relative to the core install-.
$core_path = $this->coreFinder->find($seed);
// Create the RecursiveDirectoryIterator o... | [
"public",
"function",
"find",
"(",
"$",
"seed",
")",
"{",
"// To find contrib, we need to know where core is first. Pass the empty",
"// string to as the path so we get the path for core itself -and not a path",
"// relative to the core install-.",
"$",
"core_path",
"=",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/Discovery/PathFinderContrib.php#L47-L72 |
e0ipso/drupal-unit-autoload | src/Discovery/PathFinderContrib.php | PathFinderContrib.isWantedContrib | protected function isWantedContrib(\SplFileInfo $dir) {
$info_file = $this->cleanDirPath($dir->getPathName()) . DIRECTORY_SEPARATOR . $this->moduleName . '.info';
return file_exists($info_file);
} | php | protected function isWantedContrib(\SplFileInfo $dir) {
$info_file = $this->cleanDirPath($dir->getPathName()) . DIRECTORY_SEPARATOR . $this->moduleName . '.info';
return file_exists($info_file);
} | [
"protected",
"function",
"isWantedContrib",
"(",
"\\",
"SplFileInfo",
"$",
"dir",
")",
"{",
"$",
"info_file",
"=",
"$",
"this",
"->",
"cleanDirPath",
"(",
"$",
"dir",
"->",
"getPathName",
"(",
")",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
... | Checks if the passed directory is the contrib module we are looking for.
@param \SplFileInfo $dir
The info object about the directory.
@return bool
TRUE if the contrib is detected. FALSE otherwise. | [
"Checks",
"if",
"the",
"passed",
"directory",
"is",
"the",
"contrib",
"module",
"we",
"are",
"looking",
"for",
"."
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/Discovery/PathFinderContrib.php#L82-L85 |
dantleech/glob | lib/DTL/Glob/GlobHelper.php | GlobHelper.isGlobbed | public function isGlobbed($string)
{
$segments = $this->parser->parse($string);
foreach ($segments as $segment) {
// if bitmask contains pattern
if ($segment[1] & SelectorParser::T_PATTERN) {
return true;
}
}
return false;
} | php | public function isGlobbed($string)
{
$segments = $this->parser->parse($string);
foreach ($segments as $segment) {
// if bitmask contains pattern
if ($segment[1] & SelectorParser::T_PATTERN) {
return true;
}
}
return false;
} | [
"public",
"function",
"isGlobbed",
"(",
"$",
"string",
")",
"{",
"$",
"segments",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"string",
")",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"segment",
")",
"{",
"// if bitmask contains patt... | Return true if the given string is contains a glob pattern
@param string $string
@return boolean | [
"Return",
"true",
"if",
"the",
"given",
"string",
"is",
"contains",
"a",
"glob",
"pattern"
] | train | https://github.com/dantleech/glob/blob/1f618e6b77a5de4c6b0538d82572fe19cbb1c446/lib/DTL/Glob/GlobHelper.php#L31-L42 |
mayoturis/properties-ini | src/FileLoader.php | FileLoader.load | public function load($fileName) {
if (!file_exists($fileName)) {
throw new \InvalidArgumentException('File ' . $fileName . ' does not exist');
}
$lines = $this->readLinesFromFile($fileName);
return $this->getArrayFromLines($lines);
} | php | public function load($fileName) {
if (!file_exists($fileName)) {
throw new \InvalidArgumentException('File ' . $fileName . ' does not exist');
}
$lines = $this->readLinesFromFile($fileName);
return $this->getArrayFromLines($lines);
} | [
"public",
"function",
"load",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'File '",
".",
"$",
"fileName",
".",
"' does not exist'",
")",
";",
... | Returns array which consists of value array and map
@param string $fileName
@return array
@throws \Exception | [
"Returns",
"array",
"which",
"consists",
"of",
"value",
"array",
"and",
"map"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L24-L32 |
mayoturis/properties-ini | src/FileLoader.php | FileLoader.getArrayFromLines | public function getArrayFromLines(array $lines) {
$array = [];
$map = [];
$i = 1;
foreach ($lines as $line) {
if ($this->processor->isEmptyLine($line)) {
$map[$i] = ['type' => 'empty'];
} elseif ($this->processor->isCommentLine($line)) {
$map[$i] = ['type' => 'comment', 'value' => $line];
} el... | php | public function getArrayFromLines(array $lines) {
$array = [];
$map = [];
$i = 1;
foreach ($lines as $line) {
if ($this->processor->isEmptyLine($line)) {
$map[$i] = ['type' => 'empty'];
} elseif ($this->processor->isCommentLine($line)) {
$map[$i] = ['type' => 'comment', 'value' => $line];
} el... | [
"public",
"function",
"getArrayFromLines",
"(",
"array",
"$",
"lines",
")",
"{",
"$",
"array",
"=",
"[",
"]",
";",
"$",
"map",
"=",
"[",
"]",
";",
"$",
"i",
"=",
"1",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
... | Creates value and map array from string lines
@param array $lines
@return array
@throws InvalidLineException | [
"Creates",
"value",
"and",
"map",
"array",
"from",
"string",
"lines"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L41-L69 |
mayoturis/properties-ini | src/FileLoader.php | FileLoader.processValue | public function processValue($value) {
$value = ltrim(rtrim($value));
if ($this->processor->isBool($value)) {
return $this->processor->getBool($value);
}
if ($this->processor->isNumber($value)) {
return $this->processor->getNumber($value);
}
if ($this->processor->isNull($value)) {
return null;
... | php | public function processValue($value) {
$value = ltrim(rtrim($value));
if ($this->processor->isBool($value)) {
return $this->processor->getBool($value);
}
if ($this->processor->isNumber($value)) {
return $this->processor->getNumber($value);
}
if ($this->processor->isNull($value)) {
return null;
... | [
"public",
"function",
"processValue",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"ltrim",
"(",
"rtrim",
"(",
"$",
"value",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"processor",
"->",
"isBool",
"(",
"$",
"value",
")",
")",
"{",
"return",
... | Creates value from string
@param string $value
@return bool|number|null|string | [
"Creates",
"value",
"from",
"string"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L77-L93 |
mayoturis/properties-ini | src/FileLoader.php | FileLoader.mapInfoForValue | protected function mapInfoForValue($value) {
if ($this->processor->startsWith($value, '\'') && $this->processor->endsWith($value, '\'')) {
return ['around' => '\''];
}
if ($this->processor->startsWith($value, '"') && $this->processor->endsWith($value, '"')) {
return ['around' => '"'];
}
} | php | protected function mapInfoForValue($value) {
if ($this->processor->startsWith($value, '\'') && $this->processor->endsWith($value, '\'')) {
return ['around' => '\''];
}
if ($this->processor->startsWith($value, '"') && $this->processor->endsWith($value, '"')) {
return ['around' => '"'];
}
} | [
"protected",
"function",
"mapInfoForValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"processor",
"->",
"startsWith",
"(",
"$",
"value",
",",
"'\\''",
")",
"&&",
"$",
"this",
"->",
"processor",
"->",
"endsWith",
"(",
"$",
"value",
","... | Return info for $value
@param string $value
@return array | [
"Return",
"info",
"for",
"$value"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L119-L127 |
andyvenus/form | src/FormHandler.php | FormHandler.getDefaultOptions | protected function getDefaultOptions(array $fields)
{
$fieldsUpdated = array();
foreach ($fields as $fieldName => $field) {
$fieldsUpdated[$fieldName] = $this->typeHandler->getDefaultOptions($field);
}
return $fieldsUpdated;
} | php | protected function getDefaultOptions(array $fields)
{
$fieldsUpdated = array();
foreach ($fields as $fieldName => $field) {
$fieldsUpdated[$fieldName] = $this->typeHandler->getDefaultOptions($field);
}
return $fieldsUpdated;
} | [
"protected",
"function",
"getDefaultOptions",
"(",
"array",
"$",
"fields",
")",
"{",
"$",
"fieldsUpdated",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fieldsUpdated",
"[",
"$",
... | Get the default options for the fields for their type
@param $fields array An array of field data
@return array The fields, updated with default data | [
"Get",
"the",
"default",
"options",
"for",
"the",
"fields",
"for",
"their",
"type"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L197-L205 |
andyvenus/form | src/FormHandler.php | FormHandler.setDefaultValues | public function setDefaultValues(array $defaultValues)
{
foreach ($defaultValues as $name => $value) {
if (isset($this->fields[$name])) {
$this->data[$name] = $value;
}
}
} | php | public function setDefaultValues(array $defaultValues)
{
foreach ($defaultValues as $name => $value) {
if (isset($this->fields[$name])) {
$this->data[$name] = $value;
}
}
} | [
"public",
"function",
"setDefaultValues",
"(",
"array",
"$",
"defaultValues",
")",
"{",
"foreach",
"(",
"$",
"defaultValues",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
... | Set the default values of matching fields
@param array $defaultValues | [
"Set",
"the",
"default",
"values",
"of",
"matching",
"fields"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L222-L229 |
andyvenus/form | src/FormHandler.php | FormHandler.bindEntity | public function bindEntity($entity, $fields = null, $validatable = true)
{
if ($this->submitted) {
throw new BadMethodCallException("Entities cannot be assigned after FormHandler::handleRequest has been called");
}
$this->entities[] = array('entity' => $entity, 'fields' => $fiel... | php | public function bindEntity($entity, $fields = null, $validatable = true)
{
if ($this->submitted) {
throw new BadMethodCallException("Entities cannot be assigned after FormHandler::handleRequest has been called");
}
$this->entities[] = array('entity' => $entity, 'fields' => $fiel... | [
"public",
"function",
"bindEntity",
"(",
"$",
"entity",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"validatable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"\"Entities cannot ... | Add an entity to the form. The entities values will be used to fill the form and the forms data
will be assigned to the entity when saveToEntities is called
@param $entity
@param null $fields
@param bool $validatable
@throws \Exception | [
"Add",
"an",
"entity",
"to",
"the",
"form",
".",
"The",
"entities",
"values",
"will",
"be",
"used",
"to",
"fill",
"the",
"form",
"and",
"the",
"forms",
"data",
"will",
"be",
"assigned",
"to",
"the",
"entity",
"when",
"saveToEntities",
"is",
"called"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L240-L257 |
andyvenus/form | src/FormHandler.php | FormHandler.handleRequest | public function handleRequest($request = null)
{
$this->submitted = true;
$requestData = $this->requestHandler->handleRequest($this, $request);
$validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);
if ($this->submitted === true && !empty($validRequestData))... | php | public function handleRequest($request = null)
{
$this->submitted = true;
$requestData = $this->requestHandler->handleRequest($this, $request);
$validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);
if ($this->submitted === true && !empty($validRequestData))... | [
"public",
"function",
"handleRequest",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"submitted",
"=",
"true",
";",
"$",
"requestData",
"=",
"$",
"this",
"->",
"requestHandler",
"->",
"handleRequest",
"(",
"$",
"this",
",",
"$",
"request... | Use a request handler to get data from a request and store the values that match fields
in the form blueprint
@param null $request | [
"Use",
"a",
"request",
"handler",
"to",
"get",
"data",
"from",
"a",
"request",
"and",
"store",
"the",
"values",
"that",
"match",
"fields",
"in",
"the",
"form",
"blueprint"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L273-L307 |
andyvenus/form | src/FormHandler.php | FormHandler.saveToEntities | public function saveToEntities()
{
$data = $this->transformFromFormData($this->data);
foreach ($this->entities as $entity) {
if ($entity['entity'] instanceof EntityInterface) {
$entity['entity']->setFormData($data, $entity['fields']);
} else {
... | php | public function saveToEntities()
{
$data = $this->transformFromFormData($this->data);
foreach ($this->entities as $entity) {
if ($entity['entity'] instanceof EntityInterface) {
$entity['entity']->setFormData($data, $entity['fields']);
} else {
... | [
"public",
"function",
"saveToEntities",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"transformFromFormData",
"(",
"$",
"this",
"->",
"data",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"entities",
"as",
"$",
"entity",
")",
"{",
"if",
"(",
"$... | Save the current form data to the assigned entities | [
"Save",
"the",
"current",
"form",
"data",
"to",
"the",
"assigned",
"entities"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L356-L367 |
andyvenus/form | src/FormHandler.php | FormHandler.saveToAndGetClonedEntities | public function saveToAndGetClonedEntities()
{
$data = $this->transformFromFormData($this->data);
$cloned_entities = array();
foreach ($this->entities as $entity) {
$entity['entity'] = clone $entity['entity'];
$cloned_entities[] = $entity;
if ($entity['e... | php | public function saveToAndGetClonedEntities()
{
$data = $this->transformFromFormData($this->data);
$cloned_entities = array();
foreach ($this->entities as $entity) {
$entity['entity'] = clone $entity['entity'];
$cloned_entities[] = $entity;
if ($entity['e... | [
"public",
"function",
"saveToAndGetClonedEntities",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"transformFromFormData",
"(",
"$",
"this",
"->",
"data",
")",
";",
"$",
"cloned_entities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"... | Save the form data to cloned entities and retrieve them.
Useful for getting entities with the data assigned without affecting
the original entities
@return array | [
"Save",
"the",
"form",
"data",
"to",
"cloned",
"entities",
"and",
"retrieve",
"them",
"."
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L377-L394 |
andyvenus/form | src/FormHandler.php | FormHandler.getProcessedFields | public function getProcessedFields()
{
$fields = array();
foreach ($this->fields as $fieldName => $field) {
$fields[$fieldName] = $this->getProcessedField($fieldName);
}
return $fields;
} | php | public function getProcessedFields()
{
$fields = array();
foreach ($this->fields as $fieldName => $field) {
$fields[$fieldName] = $this->getProcessedField($fieldName);
}
return $fields;
} | [
"public",
"function",
"getProcessedFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fields",
"[",
"$",
"fieldName",
"]",
"=",
... | Process all fields and return them
@return array | [
"Process",
"all",
"fields",
"and",
"return",
"them"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L422-L430 |
andyvenus/form | src/FormHandler.php | FormHandler.getProcessedField | public function getProcessedField($fieldName)
{
if (!isset($this->fields[$fieldName])) {
return false;
}
$field = $this->fields[$fieldName];
$field['has_error'] = $this->fieldHasError($fieldName);
return $this->typeHandler->makeView($field, $this->data, $this);... | php | public function getProcessedField($fieldName)
{
if (!isset($this->fields[$fieldName])) {
return false;
}
$field = $this->fields[$fieldName];
$field['has_error'] = $this->fieldHasError($fieldName);
return $this->typeHandler->makeView($field, $this->data, $this);... | [
"public",
"function",
"getProcessedField",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"fieldName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"field",
"=",
"$",
"this",
"->",
"fi... | Process a field and return it
@param $fieldName
@return bool | [
"Process",
"a",
"field",
"and",
"return",
"it"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L438-L449 |
andyvenus/form | src/FormHandler.php | FormHandler.fieldHasError | public function fieldHasError($fieldName)
{
foreach ($this->errors as $error) {
if ($error->getParam() == $fieldName) {
return true;
}
}
if (!$this->isSubmitted()) {
return false;
}
if (isset($this->validator) && $this->va... | php | public function fieldHasError($fieldName)
{
foreach ($this->errors as $error) {
if ($error->getParam() == $fieldName) {
return true;
}
}
if (!$this->isSubmitted()) {
return false;
}
if (isset($this->validator) && $this->va... | [
"public",
"function",
"fieldHasError",
"(",
"$",
"fieldName",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"errors",
"as",
"$",
"error",
")",
"{",
"if",
"(",
"$",
"error",
"->",
"getParam",
"(",
")",
"==",
"$",
"fieldName",
")",
"{",
"return",
"true"... | Check if a field has an error
@param $fieldName
@return bool | [
"Check",
"if",
"a",
"field",
"has",
"an",
"error"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L457-L472 |
andyvenus/form | src/FormHandler.php | FormHandler.hasFieldOfType | public function hasFieldOfType($fieldType)
{
foreach ($this->fields as $field) {
if ($field['type'] == $fieldType) {
return true;
}
}
return false;
} | php | public function hasFieldOfType($fieldType)
{
foreach ($this->fields as $field) {
if ($field['type'] == $fieldType) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasFieldOfType",
"(",
"$",
"fieldType",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"[",
"'type'",
"]",
"==",
"$",
"fieldType",
")",
"{",
"return",
"true",
";",
... | Check if the form contains any fields of a certain type like "select" or "textarea"
@param $fieldType
@return bool | [
"Check",
"if",
"the",
"form",
"contains",
"any",
"fields",
"of",
"a",
"certain",
"type",
"like",
"select",
"or",
"textarea"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L480-L489 |
andyvenus/form | src/FormHandler.php | FormHandler.getData | public function getData($name = null, $transform = true)
{
$data = $this->data;
if ($transform === true) {
$data = $this->transformFromFormData($this->data);
}
if ($name === null) {
return $data;
}
else {
if (isset($data[$name])) {... | php | public function getData($name = null, $transform = true)
{
$data = $this->data;
if ($transform === true) {
$data = $this->transformFromFormData($this->data);
}
if ($name === null) {
return $data;
}
else {
if (isset($data[$name])) {... | [
"public",
"function",
"getData",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"transform",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"$",
"transform",
"===",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
... | Get the values of all the form fields or a single form field
@param null|string|int $name
@param bool $transform
@return mixed | [
"Get",
"the",
"values",
"of",
"all",
"the",
"form",
"fields",
"or",
"a",
"single",
"form",
"field"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L503-L521 |
andyvenus/form | src/FormHandler.php | FormHandler.createView | public function createView()
{
if (!$this->formView) {
$this->formView = new FormView();
}
$this->formView->setFormBlueprint($this->form);
$this->formView->setFields($this->getProcessedFields());
$this->formView->setSections($this->form->getSections());
$... | php | public function createView()
{
if (!$this->formView) {
$this->formView = new FormView();
}
$this->formView->setFormBlueprint($this->form);
$this->formView->setFields($this->getProcessedFields());
$this->formView->setSections($this->form->getSections());
$... | [
"public",
"function",
"createView",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"formView",
")",
"{",
"$",
"this",
"->",
"formView",
"=",
"new",
"FormView",
"(",
")",
";",
"}",
"$",
"this",
"->",
"formView",
"->",
"setFormBlueprint",
"(",
"$",
... | Assign the form data to the view
@return FormViewInterface | [
"Assign",
"the",
"form",
"data",
"to",
"the",
"view"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L652-L676 |
andyvenus/form | src/FormHandler.php | FormHandler.setValidator | public function setValidator(ValidatorExtensionInterface $validator)
{
$this->validator = $validator;
$this->validator->setFormHandler($this);
} | php | public function setValidator(ValidatorExtensionInterface $validator)
{
$this->validator = $validator;
$this->validator->setFormHandler($this);
} | [
"public",
"function",
"setValidator",
"(",
"ValidatorExtensionInterface",
"$",
"validator",
")",
"{",
"$",
"this",
"->",
"validator",
"=",
"$",
"validator",
";",
"$",
"this",
"->",
"validator",
"->",
"setFormHandler",
"(",
"$",
"this",
")",
";",
"}"
] | Set a validator wrapped in a ValidatorExtension class
@param ValidatorExtensionInterface $validator | [
"Set",
"a",
"validator",
"wrapped",
"in",
"a",
"ValidatorExtension",
"class"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L683-L687 |
andyvenus/form | src/FormHandler.php | FormHandler.isValid | public function isValid($scope = null, $options = null)
{
if (!$this->isSubmitted()) {
return false;
}
// Check for internal errors & validator errors
if ((isset($this->validator) && $this->validator->isValid($scope, $options) && empty($this->errors)) || (!isset($this->v... | php | public function isValid($scope = null, $options = null)
{
if (!$this->isSubmitted()) {
return false;
}
// Check for internal errors & validator errors
if ((isset($this->validator) && $this->validator->isValid($scope, $options) && empty($this->errors)) || (!isset($this->v... | [
"public",
"function",
"isValid",
"(",
"$",
"scope",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSubmitted",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Check for internal errors & validator errors... | Check if the form is valid using the validator if it is set and checking for any
custom errors. Will save data to entities.
@param null $scope
@param null $options
@return bool | [
"Check",
"if",
"the",
"form",
"is",
"valid",
"using",
"the",
"validator",
"if",
"it",
"is",
"set",
"and",
"checking",
"for",
"any",
"custom",
"errors",
".",
"Will",
"save",
"data",
"to",
"entities",
"."
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L713-L739 |
andyvenus/form | src/FormHandler.php | FormHandler.setRequiredFieldErrors | protected function setRequiredFieldErrors($fields = null, $data = null)
{
if ($fields === null) {
$fields =& $this->fields;
}
if ($data === null) {
$data =& $this->data;
}
foreach ($fields as $field) {
if (isset($field['options']['require... | php | protected function setRequiredFieldErrors($fields = null, $data = null)
{
if ($fields === null) {
$fields =& $this->fields;
}
if ($data === null) {
$data =& $this->data;
}
foreach ($fields as $field) {
if (isset($field['options']['require... | [
"protected",
"function",
"setRequiredFieldErrors",
"(",
"$",
"fields",
"=",
"null",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fields",
"===",
"null",
")",
"{",
"$",
"fields",
"=",
"&",
"$",
"this",
"->",
"fields",
";",
"}",
"if",
"(... | Check each field to see if they're required. If they have no data set, assign the error
@param null $fields
@param null $data | [
"Check",
"each",
"field",
"to",
"see",
"if",
"they",
"re",
"required",
".",
"If",
"they",
"have",
"no",
"data",
"set",
"assign",
"the",
"error"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L758-L785 |
andyvenus/form | src/FormHandler.php | FormHandler.setError | public function setError($param, $message, $translate = false, $translationParams = array())
{
$this->errors[] = new FormError($param, $message, $translate, $translationParams);
// Call isValid to update valid status in restore data handlers
$this->isValid();
} | php | public function setError($param, $message, $translate = false, $translationParams = array())
{
$this->errors[] = new FormError($param, $message, $translate, $translationParams);
// Call isValid to update valid status in restore data handlers
$this->isValid();
} | [
"public",
"function",
"setError",
"(",
"$",
"param",
",",
"$",
"message",
",",
"$",
"translate",
"=",
"false",
",",
"$",
"translationParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"errors",
"[",
"]",
"=",
"new",
"FormError",
"(",
"$",
... | Set a custom error on the form
@param $param
@param $message
@param bool|false $translate
@param array $translationParams | [
"Set",
"a",
"custom",
"error",
"on",
"the",
"form"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L795-L801 |
andyvenus/form | src/FormHandler.php | FormHandler.addCustomErrors | public function addCustomErrors($errors)
{
if ($errors) {
foreach ($errors as $error) {
if (!is_a($error, 'AV\Form\FormError')) {
throw new InvalidArgumentException('Custom errors must be AV\Form\FormError objects');
}
else {
... | php | public function addCustomErrors($errors)
{
if ($errors) {
foreach ($errors as $error) {
if (!is_a($error, 'AV\Form\FormError')) {
throw new InvalidArgumentException('Custom errors must be AV\Form\FormError objects');
}
else {
... | [
"public",
"function",
"addCustomErrors",
"(",
"$",
"errors",
")",
"{",
"if",
"(",
"$",
"errors",
")",
"{",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"error",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"error",
",",
"'AV\\Form\\FormError'",
")",
")",... | Add custom errors to the form. Must be an array of FormError objects
@param $errors FormError[]
@throws InvalidArgumentException | [
"Add",
"custom",
"errors",
"to",
"the",
"form",
".",
"Must",
"be",
"an",
"array",
"of",
"FormError",
"objects"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L809-L824 |
andyvenus/form | src/FormHandler.php | FormHandler.getValidationErrors | public function getValidationErrors()
{
$errors = $this->errors;
if (isset($this->validator)) {
$validator_errors = $this->validator->getErrors();
$errors = array_merge($errors, $validator_errors);
}
return $errors;
} | php | public function getValidationErrors()
{
$errors = $this->errors;
if (isset($this->validator)) {
$validator_errors = $this->validator->getErrors();
$errors = array_merge($errors, $validator_errors);
}
return $errors;
} | [
"public",
"function",
"getValidationErrors",
"(",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"errors",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"validator",
")",
")",
"{",
"$",
"validator_errors",
"=",
"$",
"this",
"->",
"validator",
"->"... | Get the errors from the validator
@return mixed | [
"Get",
"the",
"errors",
"from",
"the",
"validator"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L831-L841 |
andyvenus/form | src/FormHandler.php | FormHandler.transformData | protected function transformData($type, $data)
{
foreach ($data as $field => $value) {
if (isset($this->fields[$field]['options']['transform'])) {
$data[$field] = $this->transformerManager->{$type.'Form'}($value, $this->fields[$field]['options']['transform']);
}
... | php | protected function transformData($type, $data)
{
foreach ($data as $field => $value) {
if (isset($this->fields[$field]['options']['transform'])) {
$data[$field] = $this->transformerManager->{$type.'Form'}($value, $this->fields[$field]['options']['transform']);
}
... | [
"protected",
"function",
"transformData",
"(",
"$",
"type",
",",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"field",
"]",
"... | Transform all given data that has an ['options']['transform'] value set
@param $type
@param $data
@return mixed | [
"Transform",
"all",
"given",
"data",
"that",
"has",
"an",
"[",
"options",
"]",
"[",
"transform",
"]",
"value",
"set"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L901-L910 |
devhelp/piwik-api | src/Param/ParamResolver.php | ParamResolver.resolve | public function resolve(array $params)
{
$merged = $this->merge($params);
$resolved = $this->read($merged);
return $resolved;
} | php | public function resolve(array $params)
{
$merged = $this->merge($params);
$resolved = $this->read($merged);
return $resolved;
} | [
"public",
"function",
"resolve",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"merged",
"=",
"$",
"this",
"->",
"merge",
"(",
"$",
"params",
")",
";",
"$",
"resolved",
"=",
"$",
"this",
"->",
"read",
"(",
"$",
"merged",
")",
";",
"return",
"$",
"r... | resolves $params value by merging and getting end values from each array elements
@param array $params
@return array | [
"resolves",
"$params",
"value",
"by",
"merging",
"and",
"getting",
"end",
"values",
"from",
"each",
"array",
"elements"
] | train | https://github.com/devhelp/piwik-api/blob/b50569fac9736a87be48228d8a336a84418be8da/src/Param/ParamResolver.php#L39-L45 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.setType | public function setType($type)
{
if (is_string($type)) {
if (in_array($type, [
self::TYPE_ALL, self::TYPE_PRINT, self::TYPE_SCREEN, self::TYPE_SPEECH,
self::TYPE_AURAL, self::TYPE_BRAILLE, self::TYPE_EMBOSSED, self::TYPE_HANDHELD,
self::TYPE_PROJEC... | php | public function setType($type)
{
if (is_string($type)) {
if (in_array($type, [
self::TYPE_ALL, self::TYPE_PRINT, self::TYPE_SCREEN, self::TYPE_SPEECH,
self::TYPE_AURAL, self::TYPE_BRAILLE, self::TYPE_EMBOSSED, self::TYPE_HANDHELD,
self::TYPE_PROJEC... | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"type",
",",
"[",
"self",
"::",
"TYPE_ALL",
",",
"self",
"::",
"TYPE_PRINT",
",",
"self",
"::",
... | Sets the media type.
@param string $type
@return $this | [
"Sets",
"the",
"media",
"type",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L55-L78 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.addCondition | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof MediaCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'MediaCondition' expected."
... | php | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof MediaCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'MediaCondition' expected."
... | [
"public",
"function",
"addCondition",
"(",
"ConditionAbstract",
"$",
"condition",
")",
"{",
"if",
"(",
"$",
"condition",
"instanceof",
"MediaCondition",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"$",
"condition",
";",
"}",
"else",
"{",
"thr... | Adds a media rule condition.
@param MediaCondition $condition
@return $this | [
"Adds",
"a",
"media",
"rule",
"condition",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L96-L107 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.setIsOnly | public function setIsOnly($isOnly)
{
if (is_bool($isOnly)) {
$this->isOnly = $isOnly;
return $this;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($isOnly). "' for argument 'isOnly' given."
);
}
} | php | public function setIsOnly($isOnly)
{
if (is_bool($isOnly)) {
$this->isOnly = $isOnly;
return $this;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($isOnly). "' for argument 'isOnly' given."
);
}
} | [
"public",
"function",
"setIsOnly",
"(",
"$",
"isOnly",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"isOnly",
")",
")",
"{",
"$",
"this",
"->",
"isOnly",
"=",
"$",
"isOnly",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"I... | Sets the 'only' flag.
@param bool $isOnly
@return $this | [
"Sets",
"the",
"only",
"flag",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L115-L126 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.setIsNot | public function setIsNot($isNot)
{
if (is_bool($isNot)) {
$this->isNot = $isNot;
return $this;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($isNot). "' for argument 'isNot' given."
);
}
} | php | public function setIsNot($isNot)
{
if (is_bool($isNot)) {
$this->isNot = $isNot;
return $this;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($isNot). "' for argument 'isNot' given."
);
}
} | [
"public",
"function",
"setIsNot",
"(",
"$",
"isNot",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"isNot",
")",
")",
"{",
"$",
"this",
"->",
"isNot",
"=",
"$",
"isNot",
";",
"return",
"$",
"this",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Invali... | Sets the 'only' flag.
@param bool $isNot
@return $this | [
"Sets",
"the",
"only",
"flag",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L144-L155 |
alexpts/psr15-middlewares | src/NewRelic.php | NewRelic.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
{
$this->startTransaction();
$response = $handler->handle($request);
$this->endTransaction();
return $response;
} | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
{
$this->startTransaction();
$response = $handler->handle($request);
$this->endTransaction();
return $response;
} | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"startTransaction",
"(",
")",
";",
"$",
"response",
"=",
"$",
"handler",
"->",
... | @param ServerRequestInterface $request
@param RequestHandlerInterface $handler
@return ResponseInterface | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"RequestHandlerInterface",
"$handler"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/NewRelic.php#L47-L54 |
vcn/enum | src/Enum.php | Enum.byName | final public static function byName($name)
{
$instances = &static::getInstances();
if (!array_key_exists($name, $instances)) {
$instances[$name] = new static($name);
}
return $instances[$name];
} | php | final public static function byName($name)
{
$instances = &static::getInstances();
if (!array_key_exists($name, $instances)) {
$instances[$name] = new static($name);
}
return $instances[$name];
} | [
"final",
"public",
"static",
"function",
"byName",
"(",
"$",
"name",
")",
"{",
"$",
"instances",
"=",
"&",
"static",
"::",
"getInstances",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"instances",
")",
")",
"{",
"$",... | Attempts to instantiate an Enum from a label name.
For example:
```
Fruit::byName('APPLE'); // Fruit::APPLE()
Fruit::byName('BANANA'); // Fruit::BANANA()
Fruit::byName('UNKNOWN'); // exception
```
@param string $name
@return static
@throws Enum\Exception\InvalidInstance | [
"Attempts",
"to",
"instantiate",
"an",
"Enum",
"from",
"a",
"label",
"name",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L67-L76 |
vcn/enum | src/Enum.php | Enum.getAllInstances | public static function getAllInstances()
{
try {
$instances = array();
foreach (static::getAllNames() as $name) {
$instances[] = static::byName($name);
}
return $instances;
} catch (Enum\Exception\InvalidInstance $e) {
thr... | php | public static function getAllInstances()
{
try {
$instances = array();
foreach (static::getAllNames() as $name) {
$instances[] = static::byName($name);
}
return $instances;
} catch (Enum\Exception\InvalidInstance $e) {
thr... | [
"public",
"static",
"function",
"getAllInstances",
"(",
")",
"{",
"try",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"getAllNames",
"(",
")",
"as",
"$",
"name",
")",
"{",
"$",
"instances",
"[",
"]",
"=",
"stati... | Gets an array of all possible instances.
<br/>
For example:
<br/>
```
Fruit::getAllInstances(); // [Fruit::APPLE(), Fruit::BANANA()]
```
@return static[] | [
"Gets",
"an",
"array",
"of",
"all",
"possible",
"instances",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L114-L127 |
vcn/enum | src/Enum.php | Enum.getAllNames | public static function getAllNames()
{
$className = get_called_class();
if (!array_key_exists($className, self::$constantsArray)) {
try {
$class = new ReflectionClass($className);
} catch (ReflectionException $e) {
throw new RuntimeException($... | php | public static function getAllNames()
{
$className = get_called_class();
if (!array_key_exists($className, self::$constantsArray)) {
try {
$class = new ReflectionClass($className);
} catch (ReflectionException $e) {
throw new RuntimeException($... | [
"public",
"static",
"function",
"getAllNames",
"(",
")",
"{",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"className",
",",
"self",
"::",
"$",
"constantsArray",
")",
")",
"{",
"try",
"{",
"$",
... | Gets an array of all possible instances' label names.
<br/>
For example:
<br/>
```
Fruit::getAllNames(); // ['APPLE', 'BANANA']
```
@return string[] | [
"Gets",
"an",
"array",
"of",
"all",
"possible",
"instances",
"label",
"names",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L158-L173 |
vcn/enum | src/Enum.php | Enum.when | final public function when(Enum $a, $b)
{
/** @noinspection PhpInternalEntityUsedInspection */
$map = new Enum\Matcher($this);
return $map->when($a, $b);
} | php | final public function when(Enum $a, $b)
{
/** @noinspection PhpInternalEntityUsedInspection */
$map = new Enum\Matcher($this);
return $map->when($a, $b);
} | [
"final",
"public",
"function",
"when",
"(",
"Enum",
"$",
"a",
",",
"$",
"b",
")",
"{",
"/** @noinspection PhpInternalEntityUsedInspection */",
"$",
"map",
"=",
"new",
"Enum",
"\\",
"Matcher",
"(",
"$",
"this",
")",
";",
"return",
"$",
"map",
"->",
"when",
... | Maps an Enum instance to a value.
<br/>
If the subject of this map is equal to the given instance, `get()` will return this value.
<br/>
By chaining this method, a total case distinction can be expressed, for example:
<br/>
```
$fruit
->when(Fruit::BANANA(), 'banana')
->when(Fruit::APPLE(), 'apple')
->get();
```
... | [
"Maps",
"an",
"Enum",
"instance",
"to",
"a",
"value",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L234-L240 |
vcn/enum | src/Enum.php | Enum.whenDo | final public function whenDo(Enum $a, $b)
{
/** @noinspection PhpInternalEntityUsedInspection */
$map = new Enum\Matcher($this);
return $map->whenDo($a, $b);
} | php | final public function whenDo(Enum $a, $b)
{
/** @noinspection PhpInternalEntityUsedInspection */
$map = new Enum\Matcher($this);
return $map->whenDo($a, $b);
} | [
"final",
"public",
"function",
"whenDo",
"(",
"Enum",
"$",
"a",
",",
"$",
"b",
")",
"{",
"/** @noinspection PhpInternalEntityUsedInspection */",
"$",
"map",
"=",
"new",
"Enum",
"\\",
"Matcher",
"(",
"$",
"this",
")",
";",
"return",
"$",
"map",
"->",
"whenD... | Like `Enum::when()`, but let a callback provide the value.
<br/>
Use this to lazily provide mapped values, or produce side effects when matched:
```
$fruit
->whenDo(
Fruit::BANANA(),
function () {
return new LargeHadronCollider();
}
)
->whenDo(
Fruit::APPLE(),
function () use ($logger) {
$logger->critical("I don't l... | [
"Like",
"Enum",
"::",
"when",
"()",
"but",
"let",
"a",
"callback",
"provide",
"the",
"value",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L291-L297 |
vcn/enum | src/Enum.php | Enum.equals | final public function equals(Enum $b)
{
$aClass = get_class($this);
$bClass = get_class($b);
if ($aClass !== $bClass) {
throw new InvalidArgumentException("Unexpected type {$bClass} is not of type {$aClass}.");
}
return $b->getName() === $this->getName();
} | php | final public function equals(Enum $b)
{
$aClass = get_class($this);
$bClass = get_class($b);
if ($aClass !== $bClass) {
throw new InvalidArgumentException("Unexpected type {$bClass} is not of type {$aClass}.");
}
return $b->getName() === $this->getName();
} | [
"final",
"public",
"function",
"equals",
"(",
"Enum",
"$",
"b",
")",
"{",
"$",
"aClass",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"bClass",
"=",
"get_class",
"(",
"$",
"b",
")",
";",
"if",
"(",
"$",
"aClass",
"!==",
"$",
"bClass",
")",
... | Only two Enums of the same type can be compared.
They are equal if their label is the same.
<br/>
For example:
<br/>
```
Fruit::APPLE()->equals(Fruit::BANANA()); // false
Fruit::APPLE()->equals(Fruit::APPLE()); // true
Fruit::APPLE()->equals(VEGETABLE::SPINACH()); // exception
```
@param Enum $b
@return bool
@thr... | [
"Only",
"two",
"Enums",
"of",
"the",
"same",
"type",
"can",
"be",
"compared",
".",
"They",
"are",
"equal",
"if",
"their",
"label",
"is",
"the",
"same",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L320-L330 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.resourceWith | public function resourceWith($entity, $transformer, $key = null): TransformationFactory
{
// if collection, paginator, or array with first value being an array use collection resource.
if ((is_array($entity) && isset($entity[0]) && is_array($entity[0])) || $entity instanceof LaravelCollection || $entity instanceof... | php | public function resourceWith($entity, $transformer, $key = null): TransformationFactory
{
// if collection, paginator, or array with first value being an array use collection resource.
if ((is_array($entity) && isset($entity[0]) && is_array($entity[0])) || $entity instanceof LaravelCollection || $entity instanceof... | [
"public",
"function",
"resourceWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"// if collection, paginator, or array with first value being an array use collection resource.",
"if",
"(",
"(",
"is_a... | Adds data and transformer, and chooses whether to use the Item or Collection Resource
based on what's most suitable for the data passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\Transform... | [
"Adds",
"data",
"and",
"transformer",
"and",
"chooses",
"whether",
"to",
"use",
"the",
"Item",
"or",
"Collection",
"Resource",
"based",
"on",
"what",
"s",
"most",
"suitable",
"for",
"the",
"data",
"passed",
"in",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L101-L109 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.collectionWith | public function collectionWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Collection($entity, $transformer, $key);
return $this;
} | php | public function collectionWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Collection($entity, $transformer, $key);
return $this;
} | [
"public",
"function",
"collectionWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"$",
"this",
"->",
"entity",
"=",
"$",
"entity",
";",
"$",
"this",
"->",
"transformer",
"=",
"$",
... | Uses a Collection resource on the data and transformer passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Uses",
"a",
"Collection",
"resource",
"on",
"the",
"data",
"and",
"transformer",
"passed",
"in",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L120-L127 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.itemWith | public function itemWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Item($entity, $transformer, $key);
return $this;
} | php | public function itemWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Item($entity, $transformer, $key);
return $this;
} | [
"public",
"function",
"itemWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"$",
"this",
"->",
"entity",
"=",
"$",
"entity",
";",
"$",
"this",
"->",
"transformer",
"=",
"$",
"tran... | Uses an Item resource on the data and transformer passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Uses",
"an",
"Item",
"resource",
"on",
"the",
"data",
"and",
"transformer",
"passed",
"in",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L138-L145 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.serialize | public function serialize($serializer = ApiDataSerializer::class): array
{
if (! is_a($serializer, SerializerAbstract::class, true)) {
throw new \InvalidArgumentException(
sprintf('The serializer must either be an instance,
or string representation of %s. The passed value %s is neither.',
SerializerA... | php | public function serialize($serializer = ApiDataSerializer::class): array
{
if (! is_a($serializer, SerializerAbstract::class, true)) {
throw new \InvalidArgumentException(
sprintf('The serializer must either be an instance,
or string representation of %s. The passed value %s is neither.',
SerializerA... | [
"public",
"function",
"serialize",
"(",
"$",
"serializer",
"=",
"ApiDataSerializer",
"::",
"class",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"serializer",
",",
"SerializerAbstract",
"::",
"class",
",",
"true",
")",
")",
"{",
"throw",
"ne... | Completes the the transformation and serialization flow, returning the data.
This could be thought of as a `flush` method.
// @TODO it does too much currently. toArray is really the `flush` method and should be moved into it's own
method.
@param \League\Fractal\Serializer\SerializerAbstract|string $serializer
@retu... | [
"Completes",
"the",
"the",
"transformation",
"and",
"serialization",
"flow",
"returning",
"the",
"data",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L159-L176 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.usingPaginatorIfPaged | public function usingPaginatorIfPaged(): TransformationFactory
{
if ($this->resource instanceof Collection && $this->entity instanceof LengthAwarePaginator) {
return $this->usingPaginator();
}
return $this;
} | php | public function usingPaginatorIfPaged(): TransformationFactory
{
if ($this->resource instanceof Collection && $this->entity instanceof LengthAwarePaginator) {
return $this->usingPaginator();
}
return $this;
} | [
"public",
"function",
"usingPaginatorIfPaged",
"(",
")",
":",
"TransformationFactory",
"{",
"if",
"(",
"$",
"this",
"->",
"resource",
"instanceof",
"Collection",
"&&",
"$",
"this",
"->",
"entity",
"instanceof",
"LengthAwarePaginator",
")",
"{",
"return",
"$",
"t... | Determines if the set data is paged, if so it will apply the
`usingPaginator()` method, if not it will just continue.
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Determines",
"if",
"the",
"set",
"data",
"is",
"paged",
"if",
"so",
"it",
"will",
"apply",
"the",
"usingPaginator",
"()",
"method",
"if",
"not",
"it",
"will",
"just",
"continue",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L184-L191 |
fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.usingPaginator | public function usingPaginator($paginator = null): TransformationFactory
{
if (! ($this->resource instanceof Collection) || ! ($this->entity instanceof LengthAwarePaginator)) {
throw new \InvalidArgumentException('Bad Request Issued');
}
$this->resource->setPaginator(new IlluminatePaginatorAdapter($this->ent... | php | public function usingPaginator($paginator = null): TransformationFactory
{
if (! ($this->resource instanceof Collection) || ! ($this->entity instanceof LengthAwarePaginator)) {
throw new \InvalidArgumentException('Bad Request Issued');
}
$this->resource->setPaginator(new IlluminatePaginatorAdapter($this->ent... | [
"public",
"function",
"usingPaginator",
"(",
"$",
"paginator",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"resource",
"instanceof",
"Collection",
")",
"||",
"!",
"(",
"$",
"this",
"->",
"entity",
"instanceo... | Applies a LengthAwarePaginator for paged resources.
@param null $paginator
@throws \InvalidArgumentException
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Applies",
"a",
"LengthAwarePaginator",
"for",
"paged",
"resources",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L202-L211 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.updateRecordsByFilter | public function updateRecordsByFilter($table, $record, $filter = null, $params = [], $extras = [])
{
$record = static::validateAsArray($record, null, false, 'There are no fields in the record.');
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 'ss_filters')... | php | public function updateRecordsByFilter($table, $record, $filter = null, $params = [], $extras = [])
{
$record = static::validateAsArray($record, null, false, 'There are no fields in the record.');
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 'ss_filters')... | [
"public",
"function",
"updateRecordsByFilter",
"(",
"$",
"table",
",",
"$",
"record",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"extras",
"=",
"[",
"]",
")",
"{",
"$",
"record",
"=",
"static",
"::",
"validateAsArra... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L87-L109 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.deleteRecordsByFilter | public function deleteRecordsByFilter($table, $filter, $params = [], $extras = [])
{
if (empty($filter)) {
throw new BadRequestException("Filter for delete request can not be empty.");
}
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 's... | php | public function deleteRecordsByFilter($table, $filter, $params = [], $extras = [])
{
if (empty($filter)) {
throw new BadRequestException("Filter for delete request can not be empty.");
}
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 's... | [
"public",
"function",
"deleteRecordsByFilter",
"(",
"$",
"table",
",",
"$",
"filter",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"extras",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filter",
")",
")",
"{",
"throw",
"new",
"BadRequest... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L150-L174 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.retrieveRecordsByFilter | public function retrieveRecordsByFilter($table, $filter = null, $params = [], $extras = [])
{
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 'ss_filters');
$options = new QueryEntitiesOptions();
$options->setSelectFields([]);
if (!empty($fi... | php | public function retrieveRecordsByFilter($table, $filter = null, $params = [], $extras = [])
{
$fields = array_get($extras, ApiOptions::FIELDS);
$ssFilters = array_get($extras, 'ss_filters');
$options = new QueryEntitiesOptions();
$options->setSelectFields([]);
if (!empty($fi... | [
"public",
"function",
"retrieveRecordsByFilter",
"(",
"$",
"table",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"extras",
"=",
"[",
"]",
")",
"{",
"$",
"fields",
"=",
"array_get",
"(",
"$",
"extras",
",",
"ApiOptions... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L179-L200 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.getIdsInfo | protected function getIdsInfo($table, $fields_info = null, &$requested_fields = null, $requested_types = null)
{
$requested_fields = [static::PARTITION_KEY, static::ROW_KEY]; // can only be this
$ids = [
new ColumnSchema(['name' => static::PARTITION_KEY, 'type' => 'string', 'required' =>... | php | protected function getIdsInfo($table, $fields_info = null, &$requested_fields = null, $requested_types = null)
{
$requested_fields = [static::PARTITION_KEY, static::ROW_KEY]; // can only be this
$ids = [
new ColumnSchema(['name' => static::PARTITION_KEY, 'type' => 'string', 'required' =>... | [
"protected",
"function",
"getIdsInfo",
"(",
"$",
"table",
",",
"$",
"fields_info",
"=",
"null",
",",
"&",
"$",
"requested_fields",
"=",
"null",
",",
"$",
"requested_types",
"=",
"null",
")",
"{",
"$",
"requested_fields",
"=",
"[",
"static",
"::",
"PARTITIO... | @param $table
@param null $fields_info
@param null $requested_fields
@param null $requested_types
@return array | [
"@param",
"$table",
"@param",
"null",
"$fields_info",
"@param",
"null",
"$requested_fields",
"@param",
"null",
"$requested_types"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L210-L219 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.queryEntities | protected function queryEntities(
$table,
$parsed_filter = '',
$fields = null,
$extras = [],
$parse_results = false
) {
$options = new QueryEntitiesOptions();
$options->setSelectFields([]);
if (!empty($fields) && (ApiOptions::FIELDS_ALL != $fields)) {... | php | protected function queryEntities(
$table,
$parsed_filter = '',
$fields = null,
$extras = [],
$parse_results = false
) {
$options = new QueryEntitiesOptions();
$options->setSelectFields([]);
if (!empty($fields) && (ApiOptions::FIELDS_ALL != $fields)) {... | [
"protected",
"function",
"queryEntities",
"(",
"$",
"table",
",",
"$",
"parsed_filter",
"=",
"''",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"extras",
"=",
"[",
"]",
",",
"$",
"parse_results",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"new",
"Que... | @param $table
@param string $parsed_filter
@param string $fields
@param array $extras
@param bool $parse_results
@throws \Exception
@return array | [
"@param",
"$table",
"@param",
"string",
"$parsed_filter",
"@param",
"string",
"$fields",
"@param",
"array",
"$extras",
"@param",
"bool",
"$parse_results"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L231-L274 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.parseRecord | protected function parseRecord($record, $fields_info, $filter_info = null, $for_update = false, $old_record = null)
{
unset($record['Timestamp']); // not set-able
return parent::parseRecord($record, $fields_info, $filter_info, $for_update, $old_record);
} | php | protected function parseRecord($record, $fields_info, $filter_info = null, $for_update = false, $old_record = null)
{
unset($record['Timestamp']); // not set-able
return parent::parseRecord($record, $fields_info, $filter_info, $for_update, $old_record);
} | [
"protected",
"function",
"parseRecord",
"(",
"$",
"record",
",",
"$",
"fields_info",
",",
"$",
"filter_info",
"=",
"null",
",",
"$",
"for_update",
"=",
"false",
",",
"$",
"old_record",
"=",
"null",
")",
"{",
"unset",
"(",
"$",
"record",
"[",
"'Timestamp'... | @param array $record
@param array $fields_info
@param array $filter_info
@param bool $for_update
@param array $old_record
@return array
@throws \Exception | [
"@param",
"array",
"$record",
"@param",
"array",
"$fields_info",
"@param",
"array",
"$filter_info",
"@param",
"bool",
"$for_update",
"@param",
"array",
"$old_record"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L286-L291 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.parseRecordToEntity | protected static function parseRecordToEntity($record = [], $entity = null, $exclude = [])
{
if (empty($entity)) {
$entity = new Entity();
}
foreach ($record as $key => $value) {
if (false === array_search($key, $exclude)) {
// valid types
// const ... | php | protected static function parseRecordToEntity($record = [], $entity = null, $exclude = [])
{
if (empty($entity)) {
$entity = new Entity();
}
foreach ($record as $key => $value) {
if (false === array_search($key, $exclude)) {
// valid types
// const ... | [
"protected",
"static",
"function",
"parseRecordToEntity",
"(",
"$",
"record",
"=",
"[",
"]",
",",
"$",
"entity",
"=",
"null",
",",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"entity",
")",
")",
"{",
"$",
"entity",
"=",
... | @param array $record
@param null|Entity $entity
@param array $exclude List of keys to exclude from adding to Entity
@return Entity | [
"@param",
"array",
"$record",
"@param",
"null|Entity",
"$entity",
"@param",
"array",
"$exclude",
"List",
"of",
"keys",
"to",
"exclude",
"from",
"adding",
"to",
"Entity"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L300-L336 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.parseEntityToRecord | protected static function parseEntityToRecord($entity, $include = ApiOptions::FIELDS_ALL, $record = [])
{
if (!empty($entity)) {
if (empty($include)) {
$record[static::PARTITION_KEY] = $entity->getPartitionKey();
$record[static::ROW_KEY] = $entity->getRowKey();
... | php | protected static function parseEntityToRecord($entity, $include = ApiOptions::FIELDS_ALL, $record = [])
{
if (!empty($entity)) {
if (empty($include)) {
$record[static::PARTITION_KEY] = $entity->getPartitionKey();
$record[static::ROW_KEY] = $entity->getRowKey();
... | [
"protected",
"static",
"function",
"parseEntityToRecord",
"(",
"$",
"entity",
",",
"$",
"include",
"=",
"ApiOptions",
"::",
"FIELDS_ALL",
",",
"$",
"record",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"entity",
")",
")",
"{",
"if",
"... | @param null|Entity $entity
@param string|array $include List of keys to include in the output record
@param array $record
@return array | [
"@param",
"null|Entity",
"$entity",
"@param",
"string|array",
"$include",
"List",
"of",
"keys",
"to",
"include",
"in",
"the",
"output",
"record",
"@param",
"array",
"$record"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L345-L369 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.parseFilter | protected static function parseFilter($filter, $params = [])
{
if (empty($filter)) {
return '';
}
if (is_array($filter)) {
return ''; // todo need to build from array of parts
}
// handle logical operators first
// supported logical operators... | php | protected static function parseFilter($filter, $params = [])
{
if (empty($filter)) {
return '';
}
if (is_array($filter)) {
return ''; // todo need to build from array of parts
}
// handle logical operators first
// supported logical operators... | [
"protected",
"static",
"function",
"parseFilter",
"(",
"$",
"filter",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filter",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"filter",
")",
")... | @param string|array $filter Filter for querying records by
@param array $params replacement parameters
@return array | [
"@param",
"string|array",
"$filter",
"Filter",
"for",
"querying",
"records",
"by",
"@param",
"array",
"$params",
"replacement",
"parameters"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L464-L517 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.initTransaction | protected function initTransaction($table_name, &$id_fields = null, $id_types = null, $require_ids = true)
{
$this->batchOps = null;
$this->backupOps = null;
return parent::initTransaction($table_name, $id_fields, $id_types, $require_ids);
} | php | protected function initTransaction($table_name, &$id_fields = null, $id_types = null, $require_ids = true)
{
$this->batchOps = null;
$this->backupOps = null;
return parent::initTransaction($table_name, $id_fields, $id_types, $require_ids);
} | [
"protected",
"function",
"initTransaction",
"(",
"$",
"table_name",
",",
"&",
"$",
"id_fields",
"=",
"null",
",",
"$",
"id_types",
"=",
"null",
",",
"$",
"require_ids",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"batchOps",
"=",
"null",
";",
"$",
"this"... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L639-L645 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.addToTransaction | protected function addToTransaction(
$record = null,
$id = null,
$extras = null,
$rollback = false,
$continue = false,
$single = false
) {
$ssFilters = array_get($extras, 'ss_filters');
$fields = array_get($extras, ApiOptions::FIELDS);
$require... | php | protected function addToTransaction(
$record = null,
$id = null,
$extras = null,
$rollback = false,
$continue = false,
$single = false
) {
$ssFilters = array_get($extras, 'ss_filters');
$fields = array_get($extras, ApiOptions::FIELDS);
$require... | [
"protected",
"function",
"addToTransaction",
"(",
"$",
"record",
"=",
"null",
",",
"$",
"id",
"=",
"null",
",",
"$",
"extras",
"=",
"null",
",",
"$",
"rollback",
"=",
"false",
",",
"$",
"continue",
"=",
"false",
",",
"$",
"single",
"=",
"false",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L650-L836 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.commitTransaction | protected function commitTransaction($extras = null)
{
if (!isset($this->batchOps) && empty($this->batchIds) && empty($this->batchRecords)) {
return null;
}
$fields = array_get($extras, ApiOptions::FIELDS);
$partitionKey = array_get($extras, static::PARTITION_KEY);
... | php | protected function commitTransaction($extras = null)
{
if (!isset($this->batchOps) && empty($this->batchIds) && empty($this->batchRecords)) {
return null;
}
$fields = array_get($extras, ApiOptions::FIELDS);
$partitionKey = array_get($extras, static::PARTITION_KEY);
... | [
"protected",
"function",
"commitTransaction",
"(",
"$",
"extras",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"batchOps",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"batchIds",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L841-L909 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.addToRollback | protected function addToRollback($record)
{
if (!isset($this->backupOps)) {
$this->backupOps = new BatchOperations();
}
switch ($this->getAction()) {
case Verbs::POST:
$this->backupOps->addDeleteEntity(
$this->transactionTable,
... | php | protected function addToRollback($record)
{
if (!isset($this->backupOps)) {
$this->backupOps = new BatchOperations();
}
switch ($this->getAction()) {
case Verbs::POST:
$this->backupOps->addDeleteEntity(
$this->transactionTable,
... | [
"protected",
"function",
"addToRollback",
"(",
"$",
"record",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"backupOps",
")",
")",
"{",
"$",
"this",
"->",
"backupOps",
"=",
"new",
"BatchOperations",
"(",
")",
";",
"}",
"switch",
"(",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L914-L939 |
dreamfactorysoftware/df-azure | src/Resources/Table.php | Table.rollbackTransaction | protected function rollbackTransaction()
{
if (!isset($this->backupOps)) {
switch ($this->getAction()) {
case Verbs::POST:
case Verbs::PUT:
case Verbs::PATCH:
case Verbs::DELETE:
/** @var BatchResult $result */
... | php | protected function rollbackTransaction()
{
if (!isset($this->backupOps)) {
switch ($this->getAction()) {
case Verbs::POST:
case Verbs::PUT:
case Verbs::PATCH:
case Verbs::DELETE:
/** @var BatchResult $result */
... | [
"protected",
"function",
"rollbackTransaction",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"backupOps",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getAction",
"(",
")",
")",
"{",
"case",
"Verbs",
"::",
"POST",
":",
"case",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/Table.php#L944-L964 |
zhaoyang1214/phalcon-framwork-plugins | src/Dispatcher.php | Dispatcher.beforeException | public function beforeException(Event $event, MvcDispatcher $dispatcher, Exception $exception)
{
// 可直接访问config服务
// $notfoundConfig = $this->config->services->dispatcher->notfound;
$notfoundConfig = $this->servicesConfig['notfound'];
// 处理404异常
if ($exception instanceof Disp... | php | public function beforeException(Event $event, MvcDispatcher $dispatcher, Exception $exception)
{
// 可直接访问config服务
// $notfoundConfig = $this->config->services->dispatcher->notfound;
$notfoundConfig = $this->servicesConfig['notfound'];
// 处理404异常
if ($exception instanceof Disp... | [
"public",
"function",
"beforeException",
"(",
"Event",
"$",
"event",
",",
"MvcDispatcher",
"$",
"dispatcher",
",",
"Exception",
"$",
"exception",
")",
"{",
"// 可直接访问config服务",
"// $notfoundConfig = $this->config->services->dispatcher->notfound;",
"$",
"notfoundConfig",
"=",... | 处理 Not-Found 错误 | [
"处理",
"Not",
"-",
"Found",
"错误"
] | train | https://github.com/zhaoyang1214/phalcon-framwork-plugins/blob/fe2e25e6d01fb7315e37ee32fdeaed6c88c382c1/src/Dispatcher.php#L27-L53 |
zhaoyang1214/phalcon-framwork-plugins | src/Dispatcher.php | Dispatcher.beforeDispatchLoop | public function beforeDispatchLoop(Event $event, MvcDispatcher $dispatcher)
{
$params = $dispatcher->getParams();
$newParams = [];
foreach ($params as $k => $v) {
if ($k & 1) {
$newParams[$params[$k - 1]] = $v;
}
}
$dispatcher->setParam... | php | public function beforeDispatchLoop(Event $event, MvcDispatcher $dispatcher)
{
$params = $dispatcher->getParams();
$newParams = [];
foreach ($params as $k => $v) {
if ($k & 1) {
$newParams[$params[$k - 1]] = $v;
}
}
$dispatcher->setParam... | [
"public",
"function",
"beforeDispatchLoop",
"(",
"Event",
"$",
"event",
",",
"MvcDispatcher",
"$",
"dispatcher",
")",
"{",
"$",
"params",
"=",
"$",
"dispatcher",
"->",
"getParams",
"(",
")",
";",
"$",
"newParams",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",... | 组合pathinfo参数 | [
"组合pathinfo参数"
] | train | https://github.com/zhaoyang1214/phalcon-framwork-plugins/blob/fe2e25e6d01fb7315e37ee32fdeaed6c88c382c1/src/Dispatcher.php#L58-L68 |
verschoof/bunq-api | src/Middleware/ResponseSignatureMiddleware.php | ResponseSignatureMiddleware.createSignatureDataFromHeaders | private function createSignatureDataFromHeaders(ResponseInterface $response)
{
$signatureData = $response->getStatusCode();
$signatureData .= $this->convertHeadersToSignatureData($response);
$signatureData .= "\n\n";
$signatureData .= (string)$response->getBody();
return $si... | php | private function createSignatureDataFromHeaders(ResponseInterface $response)
{
$signatureData = $response->getStatusCode();
$signatureData .= $this->convertHeadersToSignatureData($response);
$signatureData .= "\n\n";
$signatureData .= (string)$response->getBody();
return $si... | [
"private",
"function",
"createSignatureDataFromHeaders",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"signatureData",
"=",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
";",
"$",
"signatureData",
".=",
"$",
"this",
"->",
"convertHeadersToSignatureD... | @param ResponseInterface $response
@return string | [
"@param",
"ResponseInterface",
"$response"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Middleware/ResponseSignatureMiddleware.php#L68-L76 |
verschoof/bunq-api | src/Middleware/ResponseSignatureMiddleware.php | ResponseSignatureMiddleware.convertHeadersToSignatureData | private function convertHeadersToSignatureData(ResponseInterface $response)
{
$headers = $response->getHeaders();
ksort($headers);
$signatureData = '';
foreach ($headers as $header => $values) {
// Skip the server signature itself
if ($header === 'X-Bunq-Serv... | php | private function convertHeadersToSignatureData(ResponseInterface $response)
{
$headers = $response->getHeaders();
ksort($headers);
$signatureData = '';
foreach ($headers as $header => $values) {
// Skip the server signature itself
if ($header === 'X-Bunq-Serv... | [
"private",
"function",
"convertHeadersToSignatureData",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"headers",
"=",
"$",
"response",
"->",
"getHeaders",
"(",
")",
";",
"ksort",
"(",
"$",
"headers",
")",
";",
"$",
"signatureData",
"=",
"''",
";"... | @param ResponseInterface $response
@return string | [
"@param",
"ResponseInterface",
"$response"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Middleware/ResponseSignatureMiddleware.php#L83-L107 |
ekyna/GlsUniBox | Api/Request.php | Request.buildOriginReference | private function buildOriginReference()
{
/* - Code produit (2 positions numériques) : voir annexe 12.2
* - Numéro de colis (10 positions numériques) : ce numéro doit être unique. Vous le composez à votre
* guise suivant la logique qui vous convient (chrono, numéro commande…) Il pourra é... | php | private function buildOriginReference()
{
/* - Code produit (2 positions numériques) : voir annexe 12.2
* - Numéro de colis (10 positions numériques) : ce numéro doit être unique. Vous le composez à votre
* guise suivant la logique qui vous convient (chrono, numéro commande…) Il pourra é... | [
"private",
"function",
"buildOriginReference",
"(",
")",
"{",
"/* - Code produit (2 positions numériques) : voir annexe 12.2\n * - Numéro de colis (10 positions numériques) : ce numéro doit être unique. Vous le composez à votre\n * guise suivant la logique qui vous convient (chrono, nu... | Builds the GLS origin reference (T8975)
@return string | [
"Builds",
"the",
"GLS",
"origin",
"reference",
"(",
"T8975",
")"
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L77-L92 |
ekyna/GlsUniBox | Api/Request.php | Request.setDate | public function setDate(\DateTime $dateTime)
{
$this->set(Config::T540, $dateTime->format('Ymd'));
return $this;
} | php | public function setDate(\DateTime $dateTime)
{
$this->set(Config::T540, $dateTime->format('Ymd'));
return $this;
} | [
"public",
"function",
"setDate",
"(",
"\\",
"DateTime",
"$",
"dateTime",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"Config",
"::",
"T540",
",",
"$",
"dateTime",
"->",
"format",
"(",
"'Ymd'",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the shipment date (T540).
@param \DateTime $dateTime
@return $this | [
"Sets",
"the",
"shipment",
"date",
"(",
"T540",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L101-L106 |
ekyna/GlsUniBox | Api/Request.php | Request.setWeight | public function setWeight($weight)
{
if ($weight < 0.1) {
throw new InvalidArgumentException("Expected weight greater than 100g.");
}
$this->set(Config::T530, (string)round($weight, 2));
return $this;
} | php | public function setWeight($weight)
{
if ($weight < 0.1) {
throw new InvalidArgumentException("Expected weight greater than 100g.");
}
$this->set(Config::T530, (string)round($weight, 2));
return $this;
} | [
"public",
"function",
"setWeight",
"(",
"$",
"weight",
")",
"{",
"if",
"(",
"$",
"weight",
"<",
"0.1",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Expected weight greater than 100g.\"",
")",
";",
"}",
"$",
"this",
"->",
"set",
"(",
"Config"... | Sets the weight (xx.xx kg) (T530).
@param float $weight
@return $this | [
"Sets",
"the",
"weight",
"(",
"xx",
".",
"xx",
"kg",
")",
"(",
"T530",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L115-L124 |
ekyna/GlsUniBox | Api/Request.php | Request.setService | public function setService($service)
{
Service::isValid($service);
$this->service = $service;
if ($service === Service::EP) {
$this->set(Config::T200, 'T13');
$this->set(Config::T206, $service);
} elseif ($service === Service::SHD || $service === Service::FD... | php | public function setService($service)
{
Service::isValid($service);
$this->service = $service;
if ($service === Service::EP) {
$this->set(Config::T200, 'T13');
$this->set(Config::T206, $service);
} elseif ($service === Service::SHD || $service === Service::FD... | [
"public",
"function",
"setService",
"(",
"$",
"service",
")",
"{",
"Service",
"::",
"isValid",
"(",
"$",
"service",
")",
";",
"$",
"this",
"->",
"service",
"=",
"$",
"service",
";",
"if",
"(",
"$",
"service",
"===",
"Service",
"::",
"EP",
")",
"{",
... | Sets the service (T200).
@param string $service
@return $this | [
"Sets",
"the",
"service",
"(",
"T200",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L133-L148 |
ekyna/GlsUniBox | Api/Request.php | Request.setParcelNumber | public function setParcelNumber($number)
{
$this->set(Config::T8904, (string)$number);
$this->set(Config::T8973, (string)$number);
return $this;
} | php | public function setParcelNumber($number)
{
$this->set(Config::T8904, (string)$number);
$this->set(Config::T8973, (string)$number);
return $this;
} | [
"public",
"function",
"setParcelNumber",
"(",
"$",
"number",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"Config",
"::",
"T8904",
",",
"(",
"string",
")",
"$",
"number",
")",
";",
"$",
"this",
"->",
"set",
"(",
"Config",
"::",
"T8973",
",",
"(",
"stri... | Sets the parcel number (T8904 & T8973).
@param string $number
@return $this | [
"Sets",
"the",
"parcel",
"number",
"(",
"T8904",
"&",
"T8973",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L465-L471 |
ekyna/GlsUniBox | Api/Request.php | Request.setParcelCount | public function setParcelCount($count)
{
$this->set(Config::T8905, (string)$count);
$this->set(Config::T8702, (string)$count);
return $this;
} | php | public function setParcelCount($count)
{
$this->set(Config::T8905, (string)$count);
$this->set(Config::T8702, (string)$count);
return $this;
} | [
"public",
"function",
"setParcelCount",
"(",
"$",
"count",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"Config",
"::",
"T8905",
",",
"(",
"string",
")",
"$",
"count",
")",
";",
"$",
"this",
"->",
"set",
"(",
"Config",
"::",
"T8702",
",",
"(",
"string"... | Sets the parcel count (T8905 & T8702).
@param string $count
@return $this | [
"Sets",
"the",
"parcel",
"count",
"(",
"T8905",
"&",
"T8702",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L480-L486 |
ekyna/GlsUniBox | Api/Request.php | Request.configure | public function configure(array $config)
{
return $this
->setGLSShipmentDeposit($config[Config::T8700])
->setCustomerCode($config[Config::T8915])
->setContactId($config[Config::T8914])
->clean();
} | php | public function configure(array $config)
{
return $this
->setGLSShipmentDeposit($config[Config::T8700])
->setCustomerCode($config[Config::T8915])
->setContactId($config[Config::T8914])
->clean();
} | [
"public",
"function",
"configure",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"$",
"this",
"->",
"setGLSShipmentDeposit",
"(",
"$",
"config",
"[",
"Config",
"::",
"T8700",
"]",
")",
"->",
"setCustomerCode",
"(",
"$",
"config",
"[",
"Config",
"::",
... | Configures the request (called by the client).
@param array $config
@return $this
@see Client::send() | [
"Configures",
"the",
"request",
"(",
"called",
"by",
"the",
"client",
")",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Request.php#L511-L518 |
prooph/link-app-core | src/Service/ApplicationDbProvider.php | ApplicationDbProvider.initialize | public function initialize($instance, ServiceLocatorInterface $serviceLocator)
{
if ($instance instanceof ApplicationDbAware) {
$instance->setApplicationDb($serviceLocator->get('prooph.link.app.db'));
}
} | php | public function initialize($instance, ServiceLocatorInterface $serviceLocator)
{
if ($instance instanceof ApplicationDbAware) {
$instance->setApplicationDb($serviceLocator->get('prooph.link.app.db'));
}
} | [
"public",
"function",
"initialize",
"(",
"$",
"instance",
",",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"$",
"instance",
"instanceof",
"ApplicationDbAware",
")",
"{",
"$",
"instance",
"->",
"setApplicationDb",
"(",
"$",
"serviceLocato... | Initialize
@param $instance
@param ServiceLocatorInterface $serviceLocator
@return mixed | [
"Initialize"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Service/ApplicationDbProvider.php#L31-L36 |
opis/utils | lib/Placeholder.php | Placeholder.replace | public function replace($text, array $placeholders, $escape = true)
{
$args = array();
foreach ($placeholders as $key => $value) {
$l = $key[0];
if ($l == $this->escape) {
$args[$key] = $escape ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : $value;... | php | public function replace($text, array $placeholders, $escape = true)
{
$args = array();
foreach ($placeholders as $key => $value) {
$l = $key[0];
if ($l == $this->escape) {
$args[$key] = $escape ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : $value;... | [
"public",
"function",
"replace",
"(",
"$",
"text",
",",
"array",
"$",
"placeholders",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"$",
"args",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"placeholders",
"as",
"$",
"key",
"=>",
"$",
"value",
")... | Replace placeholders
@param string $text
@param array $placeholders
@param boolean $escape (optional)
@return string | [
"Replace",
"placeholders"
] | train | https://github.com/opis/utils/blob/239cd3dc3760eb746838011e712592700fe5d58c/lib/Placeholder.php#L52-L66 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.listContainers | public function listContainers($include_properties = false)
{
$this->checkConnection();
if (!empty($this->container)) {
return $this->listResource($include_properties);
}
/** @var \MicrosoftAzure\Storage\Blob\Models\ListContainersResult $result */
$result = $thi... | php | public function listContainers($include_properties = false)
{
$this->checkConnection();
if (!empty($this->container)) {
return $this->listResource($include_properties);
}
/** @var \MicrosoftAzure\Storage\Blob\Models\ListContainersResult $result */
$result = $thi... | [
"public",
"function",
"listContainers",
"(",
"$",
"include_properties",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"container",
")",
")",
"{",
"return",
"$",
"this",
"->... | List all containers, just names if noted
@param bool $include_properties If true, additional properties are retrieved
@throws \Exception
@return array | [
"List",
"all",
"containers",
"just",
"names",
"if",
"noted"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L128-L153 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.containerExists | public function containerExists($container)
{
$this->checkConnection();
try {
$this->blobConn->getContainerProperties($container);
return true;
} catch (\Exception $ex) {
if (false === stripos($ex->getMessage(), 'does not exist')) {
throw ... | php | public function containerExists($container)
{
$this->checkConnection();
try {
$this->blobConn->getContainerProperties($container);
return true;
} catch (\Exception $ex) {
if (false === stripos($ex->getMessage(), 'does not exist')) {
throw ... | [
"public",
"function",
"containerExists",
"(",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"try",
"{",
"$",
"this",
"->",
"blobConn",
"->",
"getContainerProperties",
"(",
"$",
"container",
")",
";",
"return",
"true",
";"... | Check if a container exists
@param string $container Container name
@return boolean
@throws \Exception | [
"Check",
"if",
"a",
"container",
"exists"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L193-L207 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.createContainer | public function createContainer($properties, $metadata = [])
{
$this->checkConnection();
$name = array_get($properties, 'name', array_get($properties, 'path'));
if (empty($name)) {
throw new DfException('No name found for container in create request.');
}
$option... | php | public function createContainer($properties, $metadata = [])
{
$this->checkConnection();
$name = array_get($properties, 'name', array_get($properties, 'path'));
if (empty($name)) {
throw new DfException('No name found for container in create request.');
}
$option... | [
"public",
"function",
"createContainer",
"(",
"$",
"properties",
",",
"$",
"metadata",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"name",
"=",
"array_get",
"(",
"$",
"properties",
",",
"'name'",
",",
"array_get",
... | @param array $properties
@param array $metadata
@throws DfException
@return array | [
"@param",
"array",
"$properties",
"@param",
"array",
"$metadata"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L216-L231 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.updateContainerProperties | public function updateContainerProperties($container, $properties = [])
{
$this->checkConnection();
$options = new CreateContainerOptions();
$options->setMetadata($properties);
// $options->setPublicAccess('blob');
$this->blobConn->setContainerMetadata($container, $options);
} | php | public function updateContainerProperties($container, $properties = [])
{
$this->checkConnection();
$options = new CreateContainerOptions();
$options->setMetadata($properties);
// $options->setPublicAccess('blob');
$this->blobConn->setContainerMetadata($container, $options);
} | [
"public",
"function",
"updateContainerProperties",
"(",
"$",
"container",
",",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"options",
"=",
"new",
"CreateContainerOptions",
"(",
")",
";",
"$",
"optio... | Update a container with some properties
@param string $container
@param array $properties
@throws NotFoundException
@return void | [
"Update",
"a",
"container",
"with",
"some",
"properties"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L242-L251 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.deleteContainer | public function deleteContainer($container, $force = false)
{
try {
$this->checkConnection();
$this->blobConn->deleteContainer($container);
} catch (\Exception $ex) {
if (false === stripos($ex->getMessage(), 'does not exist')) {
throw $ex;
... | php | public function deleteContainer($container, $force = false)
{
try {
$this->checkConnection();
$this->blobConn->deleteContainer($container);
} catch (\Exception $ex) {
if (false === stripos($ex->getMessage(), 'does not exist')) {
throw $ex;
... | [
"public",
"function",
"deleteContainer",
"(",
"$",
"container",
",",
"$",
"force",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"this",
"->",
"blobConn",
"->",
"deleteContainer",
"(",
"$",
"container",
")"... | @param string $container
@param bool $force
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"bool",
"$force"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L260-L270 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.blobExists | public function blobExists($container, $name)
{
try {
$this->checkConnection();
$name = $this->fixBlobName($name);
if (empty($name)) {
return false;
}
$this->blobConn->getBlobProperties($container, $name);
return true;
... | php | public function blobExists($container, $name)
{
try {
$this->checkConnection();
$name = $this->fixBlobName($name);
if (empty($name)) {
return false;
}
$this->blobConn->getBlobProperties($container, $name);
return true;
... | [
"public",
"function",
"blobExists",
"(",
"$",
"container",
",",
"$",
"name",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"fixBlobName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"empt... | Check if a blob exists
@param string $container Container name
@param string $name Blob name
@return boolean
@throws \Exception | [
"Check",
"if",
"a",
"blob",
"exists"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L281-L299 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.putBlobData | public function putBlobData($container, $name, $blob = '', $type = '')
{
$this->checkConnection();
$options = new CreateBlobOptions();
if (!empty($type)) {
$options->setContentType($type);
}
$this->blobConn->createBlockBlob($container, $this->fixBlobName($name)... | php | public function putBlobData($container, $name, $blob = '', $type = '')
{
$this->checkConnection();
$options = new CreateBlobOptions();
if (!empty($type)) {
$options->setContentType($type);
}
$this->blobConn->createBlockBlob($container, $this->fixBlobName($name)... | [
"public",
"function",
"putBlobData",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"blob",
"=",
"''",
",",
"$",
"type",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"options",
"=",
"new",
"CreateBlobOptions",
"(... | @param string $container
@param string $name
@param string $blob
@param string $type
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$name",
"@param",
"string",
"$blob",
"@param",
"string",
"$type"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L309-L320 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.putBlobFromFile | public function putBlobFromFile($container, $name, $localFileName = '', $type = '')
{
$blob = file_get_contents($localFileName);
if (false === $blob) {
throw new InternalServerErrorException("Failed to get contents of uploaded file.");
}
$this->putBlobData($container, $n... | php | public function putBlobFromFile($container, $name, $localFileName = '', $type = '')
{
$blob = file_get_contents($localFileName);
if (false === $blob) {
throw new InternalServerErrorException("Failed to get contents of uploaded file.");
}
$this->putBlobData($container, $n... | [
"public",
"function",
"putBlobFromFile",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"localFileName",
"=",
"''",
",",
"$",
"type",
"=",
"''",
")",
"{",
"$",
"blob",
"=",
"file_get_contents",
"(",
"$",
"localFileName",
")",
";",
"if",
"(",
"false... | @param string $container
@param string $name
@param string $localFileName
@param string $type
@throws InternalServerErrorException
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$name",
"@param",
"string",
"$localFileName",
"@param",
"string",
"$type"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L331-L339 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.copyBlob | public function copyBlob($container, $name, $src_container, $src_name, $properties = [])
{
$this->checkConnection();
$this->blobConn->copyBlob($container, $this->fixBlobName($name), $src_container,
$this->fixBlobName($src_name));
} | php | public function copyBlob($container, $name, $src_container, $src_name, $properties = [])
{
$this->checkConnection();
$this->blobConn->copyBlob($container, $this->fixBlobName($name), $src_container,
$this->fixBlobName($src_name));
} | [
"public",
"function",
"copyBlob",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"src_container",
",",
"$",
"src_name",
",",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"this",
"->",
"blob... | @param string $container
@param string $name
@param string $src_container
@param string $src_name
@param array $properties
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$name",
"@param",
"string",
"$src_container",
"@param",
"string",
"$src_name"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L351-L356 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.getBlobAsFile | public function getBlobAsFile($container, $name, $localFileName = '')
{
$this->checkConnection();
/** @var GetBlobResult $results */
$results = $this->blobConn->getBlob($container, $this->fixBlobName($name));
file_put_contents($localFileName, stream_get_contents($results->getContentS... | php | public function getBlobAsFile($container, $name, $localFileName = '')
{
$this->checkConnection();
/** @var GetBlobResult $results */
$results = $this->blobConn->getBlob($container, $this->fixBlobName($name));
file_put_contents($localFileName, stream_get_contents($results->getContentS... | [
"public",
"function",
"getBlobAsFile",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"localFileName",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"/** @var GetBlobResult $results */",
"$",
"results",
"=",
"$",
"this",
"->",... | Get blob
@param string $container Container name
@param string $name Blob name
@param string $localFileName Local file name to store downloaded blob
@return void | [
"Get",
"blob"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L367-L373 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.getBlobData | public function getBlobData($container, $name)
{
$this->checkConnection();
/** @var GetBlobResult $results */
$results = $this->blobConn->getBlob($container, $this->fixBlobName($name));
return stream_get_contents($results->getContentStream());
} | php | public function getBlobData($container, $name)
{
$this->checkConnection();
/** @var GetBlobResult $results */
$results = $this->blobConn->getBlob($container, $this->fixBlobName($name));
return stream_get_contents($results->getContentStream());
} | [
"public",
"function",
"getBlobData",
"(",
"$",
"container",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"/** @var GetBlobResult $results */",
"$",
"results",
"=",
"$",
"this",
"->",
"blobConn",
"->",
"getBlob",
"(",
"$",
... | @param string $container
@param string $name
@return mixed|string
@return string | [
"@param",
"string",
"$container",
"@param",
"string",
"$name"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L382-L389 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.deleteBlob | public function deleteBlob($container, $name, $noCheck = false)
{
try {
$this->checkConnection();
$this->blobConn->deleteBlob($container, $this->fixBlobName($name));
} catch (\Exception $ex) {
if ($ex instanceof ServiceException) {
if ($ex->getCode... | php | public function deleteBlob($container, $name, $noCheck = false)
{
try {
$this->checkConnection();
$this->blobConn->deleteBlob($container, $this->fixBlobName($name));
} catch (\Exception $ex) {
if ($ex instanceof ServiceException) {
if ($ex->getCode... | [
"public",
"function",
"deleteBlob",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"noCheck",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"this",
"->",
"blobConn",
"->",
"deleteBlob",
"(",
"$",
"c... | @param string $container
@param string $name
@param bool $noCheck
@return void
@throws \Exception | [
"@param",
"string",
"$container",
"@param",
"string",
"$name",
"@param",
"bool",
"$noCheck"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L399-L415 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.listBlobs | public function listBlobs($container, $prefix = '', $delimiter = '')
{
$this->checkConnection();
$options = new ListBlobsOptions();
if (!empty($delimiter)) {
$options->setDelimiter($delimiter);
}
if (!empty($prefix)) {
$options->setPrefix($prefix);
... | php | public function listBlobs($container, $prefix = '', $delimiter = '')
{
$this->checkConnection();
$options = new ListBlobsOptions();
if (!empty($delimiter)) {
$options->setDelimiter($delimiter);
}
if (!empty($prefix)) {
$options->setPrefix($prefix);
... | [
"public",
"function",
"listBlobs",
"(",
"$",
"container",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"delimiter",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"options",
"=",
"new",
"ListBlobsOptions",
"(",
")",
";",
"... | List blobs
@param string $container Container name
@param string $prefix Optional. Filters the results to return only blobs whose name begins with the
specified prefix.
@param string $delimiter Optional. Delimiter, i.e. '/', for specifying folder hierarchy
@return array
@throws \Exception | [
"List",
"blobs"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L428-L474 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.getBlobProperties | public function getBlobProperties($container, $name)
{
$this->checkConnection();
$name = $this->fixBlobName($name);
/** @var GetBlobPropertiesResult $result */
$result = $this->blobConn->getBlobProperties($container, $name);
$props = $result->getProperties();
$file = ... | php | public function getBlobProperties($container, $name)
{
$this->checkConnection();
$name = $this->fixBlobName($name);
/** @var GetBlobPropertiesResult $result */
$result = $this->blobConn->getBlobProperties($container, $name);
$props = $result->getProperties();
$file = ... | [
"public",
"function",
"getBlobProperties",
"(",
"$",
"container",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"fixBlobName",
"(",
"$",
"name",
")",
";",
"/** @var GetBlobPropertiesRe... | List blob
@param string $container Container name
@param string $name Blob name
@return array instance
@throws \Exception | [
"List",
"blob"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L485-L500 |
dreamfactorysoftware/df-azure | src/Components/AzureBlobFileSystem.php | AzureBlobFileSystem.streamBlob | public function streamBlob($container, $blobName, $params = [])
{
try {
$this->checkConnection();
///** @var GetBlobResult $blob */
//$blob = $this->blobConn->getBlob($container, $blobName);
$props = $this->blobConn->getBlobProperties($container, $blobName)->g... | php | public function streamBlob($container, $blobName, $params = [])
{
try {
$this->checkConnection();
///** @var GetBlobResult $blob */
//$blob = $this->blobConn->getBlob($container, $blobName);
$props = $this->blobConn->getBlobProperties($container, $blobName)->g... | [
"public",
"function",
"streamBlob",
"(",
"$",
"container",
",",
"$",
"blobName",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"///** @var GetBlobResult $blob */",
"//$blob = $this->blobConn->getBlo... | @param string $container
@param string $blobName
@param array $params
@throws \Exception
@return void | [
"@param",
"string",
"$container",
"@param",
"string",
"$blobName",
"@param",
"array",
"$params"
] | train | https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Components/AzureBlobFileSystem.php#L510-L554 |
czim/laravel-pxlcms | src/Generator/Analyzer/Steps/LoadRawData.php | LoadRawData.parseFieldOptionsJson | protected function parseFieldOptionsJson()
{
foreach ($this->data->rawData['fields'] as $fieldId => &$fieldData) {
$optionsJson = trim( $fieldData['options'] );
if (empty($optionsJson)) continue;
$fieldData['options'] = json_decode($optionsJson, true);
}
... | php | protected function parseFieldOptionsJson()
{
foreach ($this->data->rawData['fields'] as $fieldId => &$fieldData) {
$optionsJson = trim( $fieldData['options'] );
if (empty($optionsJson)) continue;
$fieldData['options'] = json_decode($optionsJson, true);
}
... | [
"protected",
"function",
"parseFieldOptionsJson",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"->",
"rawData",
"[",
"'fields'",
"]",
"as",
"$",
"fieldId",
"=>",
"&",
"$",
"fieldData",
")",
"{",
"$",
"optionsJson",
"=",
"trim",
"(",
"$",
"... | Parses json to array for fields with 'options' set | [
"Parses",
"json",
"to",
"array",
"for",
"fields",
"with",
"options",
"set"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/LoadRawData.php#L272-L284 |
tequila/mongodb-php-lib | src/Database.php | Database.createCollection | public function createCollection($collectionName, array $options = [])
{
$cursor = $this->executeCommand(['create' => $collectionName], $options);
return $cursor->current();
} | php | public function createCollection($collectionName, array $options = [])
{
$cursor = $this->executeCommand(['create' => $collectionName], $options);
return $cursor->current();
} | [
"public",
"function",
"createCollection",
"(",
"$",
"collectionName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"cursor",
"=",
"$",
"this",
"->",
"executeCommand",
"(",
"[",
"'create'",
"=>",
"$",
"collectionName",
"]",
",",
"$",
"optio... | @param string $collectionName
@param array $options
@return array | [
"@param",
"string",
"$collectionName",
"@param",
"array",
"$options"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Database.php#L93-L98 |
tequila/mongodb-php-lib | src/Database.php | Database.runCommand | public function runCommand($command, array $options = [])
{
if (!is_array($command) && !is_object($command)) {
throw new InvalidArgumentException(
sprintf(
'$command must be an array or an object, %s given.',
\Tequila\MongoDB\getType($comma... | php | public function runCommand($command, array $options = [])
{
if (!is_array($command) && !is_object($command)) {
throw new InvalidArgumentException(
sprintf(
'$command must be an array or an object, %s given.',
\Tequila\MongoDB\getType($comma... | [
"public",
"function",
"runCommand",
"(",
"$",
"command",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"command",
")",
"&&",
"!",
"is_object",
"(",
"$",
"command",
")",
")",
"{",
"throw",
"new",
"Inval... | @param array|object $command
@param array $options
@return CommandCursor | [
"@param",
"array|object",
"$command",
"@param",
"array",
"$options"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Database.php#L157-L189 |
tequila/mongodb-php-lib | src/Database.php | Database.selectCollection | public function selectCollection($collectionName, array $options = [])
{
$options += [
'readConcern' => $this->readConcern,
'readPreference' => $this->readPreference,
'writeConcern' => $this->writeConcern,
];
return new Collection($this->manager, $this->d... | php | public function selectCollection($collectionName, array $options = [])
{
$options += [
'readConcern' => $this->readConcern,
'readPreference' => $this->readPreference,
'writeConcern' => $this->writeConcern,
];
return new Collection($this->manager, $this->d... | [
"public",
"function",
"selectCollection",
"(",
"$",
"collectionName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'readConcern'",
"=>",
"$",
"this",
"->",
"readConcern",
",",
"'readPreference'",
"=>",
"$",
"this",
"->... | @param string $collectionName
@param array $options
@return Collection | [
"@param",
"string",
"$collectionName",
"@param",
"array",
"$options"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Database.php#L197-L206 |
harp-orm/query | src/Compiler/Columns.php | Columns.renderItem | public static function renderItem(SQL\Columns $item)
{
return Compiler::braced(
Arr::join(', ', Arr::map(__NAMESPACE__.'\Compiler::name', $item->all()))
);
} | php | public static function renderItem(SQL\Columns $item)
{
return Compiler::braced(
Arr::join(', ', Arr::map(__NAMESPACE__.'\Compiler::name', $item->all()))
);
} | [
"public",
"static",
"function",
"renderItem",
"(",
"SQL",
"\\",
"Columns",
"$",
"item",
")",
"{",
"return",
"Compiler",
"::",
"braced",
"(",
"Arr",
"::",
"join",
"(",
"', '",
",",
"Arr",
"::",
"map",
"(",
"__NAMESPACE__",
".",
"'\\Compiler::name'",
",",
... | Render Columns object
@param SQL\Columns $item
@return string | [
"Render",
"Columns",
"object"
] | train | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Columns.php#L30-L35 |
harp-orm/query | src/Compiler/Select.php | Select.render | public static function render(Query\Select $query)
{
return Compiler::withDb($query->getDb(), function () use ($query) {
return Compiler::expression(array(
'SELECT',
$query->getType(),
Aliased::combine($query->getColumns()) ?: '*',
... | php | public static function render(Query\Select $query)
{
return Compiler::withDb($query->getDb(), function () use ($query) {
return Compiler::expression(array(
'SELECT',
$query->getType(),
Aliased::combine($query->getColumns()) ?: '*',
... | [
"public",
"static",
"function",
"render",
"(",
"Query",
"\\",
"Select",
"$",
"query",
")",
"{",
"return",
"Compiler",
"::",
"withDb",
"(",
"$",
"query",
"->",
"getDb",
"(",
")",
",",
"function",
"(",
")",
"use",
"(",
"$",
"query",
")",
"{",
"return",... | Render a Select object
@param Query\Select $query
@return string | [
"Render",
"a",
"Select",
"object"
] | train | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Select.php#L19-L36 |
siriusphp/html | src/Builder.php | Builder.with | public function with($options)
{
$clone = clone $this;
foreach ($options as $name => $value) {
$clone->setOption($name, $value);
}
return $clone;
} | php | public function with($options)
{
$clone = clone $this;
foreach ($options as $name => $value) {
$clone->setOption($name, $value);
}
return $clone;
} | [
"public",
"function",
"with",
"(",
"$",
"options",
")",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"clone",
"->",
"setOption",
"(",
"$",
"name",
",",
"$... | Clones the instance and applies new set of options
@param $options
@return Builder | [
"Clones",
"the",
"instance",
"and",
"applies",
"new",
"set",
"of",
"options"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Builder.php#L72-L80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.