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 |
|---|---|---|---|---|---|---|---|---|---|---|
sc0Vu/web3.php | src/Contracts/Types/Bytes.php | Bytes.inputFormat | public function inputFormat($value, $name)
{
if (!Utils::isHex($value)) {
throw new InvalidArgumentException('The value to inputFormat must be hex bytes.');
}
$value = Utils::stripZero($value);
if (mb_strlen($value) % 2 !== 0) {
$value = "0" . $value;
... | php | public function inputFormat($value, $name)
{
if (!Utils::isHex($value)) {
throw new InvalidArgumentException('The value to inputFormat must be hex bytes.');
}
$value = Utils::stripZero($value);
if (mb_strlen($value) % 2 !== 0) {
$value = "0" . $value;
... | [
"public",
"function",
"inputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"Utils",
"::",
"isHex",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The value to inputFormat must be hex bytes.'",
")",... | inputFormat
@param mixed $value
@param string $name
@return string | [
"inputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Bytes.php#L59-L78 |
sc0Vu/web3.php | src/Contracts/Types/Bytes.php | Bytes.outputFormat | public function outputFormat($value, $name)
{
$checkZero = str_replace('0', '', $value);
if (empty($checkZero)) {
return '0';
}
if (preg_match('/^bytes([0-9]*)/', $name, $match) === 1) {
$size = intval($match[1]);
$length = 2 * $size;
... | php | public function outputFormat($value, $name)
{
$checkZero = str_replace('0', '', $value);
if (empty($checkZero)) {
return '0';
}
if (preg_match('/^bytes([0-9]*)/', $name, $match) === 1) {
$size = intval($match[1]);
$length = 2 * $size;
... | [
"public",
"function",
"outputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"checkZero",
"=",
"str_replace",
"(",
"'0'",
",",
"''",
",",
"$",
"value",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"checkZero",
")",
")",
"{",
"return",
"'0'"... | outputFormat
@param mixed $value
@param string $name
@return string | [
"outputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Bytes.php#L87-L100 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeFunctionSignature | public function encodeFunctionSignature($functionName)
{
if (!is_string($functionName)) {
$functionName = Utils::jsonMethodToString($functionName);
}
return mb_substr(Utils::sha3($functionName), 0, 10);
} | php | public function encodeFunctionSignature($functionName)
{
if (!is_string($functionName)) {
$functionName = Utils::jsonMethodToString($functionName);
}
return mb_substr(Utils::sha3($functionName), 0, 10);
} | [
"public",
"function",
"encodeFunctionSignature",
"(",
"$",
"functionName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"functionName",
")",
")",
"{",
"$",
"functionName",
"=",
"Utils",
"::",
"jsonMethodToString",
"(",
"$",
"functionName",
")",
";",
"}",... | encodeFunctionSignature
@param string|stdClass|array $functionName
@return string | [
"encodeFunctionSignature"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L93-L99 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeEventSignature | public function encodeEventSignature($functionName)
{
if (!is_string($functionName)) {
$functionName = Utils::jsonMethodToString($functionName);
}
return Utils::sha3($functionName);
} | php | public function encodeEventSignature($functionName)
{
if (!is_string($functionName)) {
$functionName = Utils::jsonMethodToString($functionName);
}
return Utils::sha3($functionName);
} | [
"public",
"function",
"encodeEventSignature",
"(",
"$",
"functionName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"functionName",
")",
")",
"{",
"$",
"functionName",
"=",
"Utils",
"::",
"jsonMethodToString",
"(",
"$",
"functionName",
")",
";",
"}",
... | encodeEventSignature
TODO: Fix same event name with different params
@param string|stdClass|array $functionName
@return string | [
"encodeEventSignature",
"TODO",
":",
"Fix",
"same",
"event",
"name",
"with",
"different",
"params"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L108-L114 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeParameter | public function encodeParameter($type, $param)
{
if (!is_string($type)) {
throw new InvalidArgumentException('The type to encodeParameter must be string.');
}
return $this->encodeParameters([$type], [$param]);
} | php | public function encodeParameter($type, $param)
{
if (!is_string($type)) {
throw new InvalidArgumentException('The type to encodeParameter must be string.');
}
return $this->encodeParameters([$type], [$param]);
} | [
"public",
"function",
"encodeParameter",
"(",
"$",
"type",
",",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The type to encodeParameter must be string.'",
")",
";",
"}... | encodeParameter
@param string $type
@param mixed $param
@return string | [
"encodeParameter"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L123-L129 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeParameters | public function encodeParameters($types, $params)
{
// change json to array
if ($types instanceof stdClass && isset($types->inputs)) {
$types = Utils::jsonToArray($types, 2);
}
if (is_array($types) && isset($types['inputs'])) {
$inputTypes = $types;
... | php | public function encodeParameters($types, $params)
{
// change json to array
if ($types instanceof stdClass && isset($types->inputs)) {
$types = Utils::jsonToArray($types, 2);
}
if (is_array($types) && isset($types['inputs'])) {
$inputTypes = $types;
... | [
"public",
"function",
"encodeParameters",
"(",
"$",
"types",
",",
"$",
"params",
")",
"{",
"// change json to array",
"if",
"(",
"$",
"types",
"instanceof",
"stdClass",
"&&",
"isset",
"(",
"$",
"types",
"->",
"inputs",
")",
")",
"{",
"$",
"types",
"=",
"... | encodeParameters
@param stdClass|array $types
@param array $params
@return string | [
"encodeParameters"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L138-L177 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.decodeParameter | public function decodeParameter($type, $param)
{
if (!is_string($type)) {
throw new InvalidArgumentException('The type to decodeParameter must be string.');
}
return $this->decodeParameters([$type], $param)[0];
} | php | public function decodeParameter($type, $param)
{
if (!is_string($type)) {
throw new InvalidArgumentException('The type to decodeParameter must be string.');
}
return $this->decodeParameters([$type], $param)[0];
} | [
"public",
"function",
"decodeParameter",
"(",
"$",
"type",
",",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The type to decodeParameter must be string.'",
")",
";",
"}... | decodeParameter
@param string $type
@param mixed $param
@return string | [
"decodeParameter"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L186-L192 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.decodeParameters | public function decodeParameters($types, $param)
{
if (!is_string($param)) {
throw new InvalidArgumentException('The type or param to decodeParameters must be string.');
}
// change json to array
if ($types instanceof stdClass && isset($types->outputs)) {
$ty... | php | public function decodeParameters($types, $param)
{
if (!is_string($param)) {
throw new InvalidArgumentException('The type or param to decodeParameters must be string.');
}
// change json to array
if ($types instanceof stdClass && isset($types->outputs)) {
$ty... | [
"public",
"function",
"decodeParameters",
"(",
"$",
"types",
",",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"param",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The type or param to decodeParameters must be string.'",
")"... | decodeParameters
@param stdClass|array $type
@param string $param
@return string | [
"decodeParameters"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L201-L246 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.getSolidityTypes | protected function getSolidityTypes($types)
{
if (!is_array($types)) {
throw new InvalidArgumentException('Types must be array');
}
$solidityTypes = array_fill(0, count($types), 0);
foreach ($types as $key => $type) {
$match = [];
if (preg_match(... | php | protected function getSolidityTypes($types)
{
if (!is_array($types)) {
throw new InvalidArgumentException('Types must be array');
}
$solidityTypes = array_fill(0, count($types), 0);
foreach ($types as $key => $type) {
$match = [];
if (preg_match(... | [
"protected",
"function",
"getSolidityTypes",
"(",
"$",
"types",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"types",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Types must be array'",
")",
";",
"}",
"$",
"solidityTypes",
"=",
"array... | getSolidityTypes
@param array $types
@return array | [
"getSolidityTypes"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L254-L281 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeWithOffset | protected function encodeWithOffset($type, $solidityType, $encoded, $offset)
{
if ($solidityType->isDynamicArray($type)) {
$nestedName = $solidityType->nestedName($type);
$nestedStaticPartLength = $solidityType->staticPartLength($type);
$result = $encoded[0];
... | php | protected function encodeWithOffset($type, $solidityType, $encoded, $offset)
{
if ($solidityType->isDynamicArray($type)) {
$nestedName = $solidityType->nestedName($type);
$nestedStaticPartLength = $solidityType->staticPartLength($type);
$result = $encoded[0];
... | [
"protected",
"function",
"encodeWithOffset",
"(",
"$",
"type",
",",
"$",
"solidityType",
",",
"$",
"encoded",
",",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"solidityType",
"->",
"isDynamicArray",
"(",
"$",
"type",
")",
")",
"{",
"$",
"nestedName",
"=",
... | encodeWithOffset
@param string $type
@param \Web3\Contracts\SolidityType $solidityType
@param mixed $encode
@param int $offset
@return string | [
"encodeWithOffset"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L292-L352 |
sc0Vu/web3.php | src/Contracts/Ethabi.php | Ethabi.encodeMultiWithOffset | protected function encodeMultiWithOffset($types, $solidityTypes, $encodes, $dynamicOffset)
{
$result = '';
foreach ($solidityTypes as $key => $type) {
if ($type->isDynamicType($types[$key]) || $type->isDynamicArray($types[$key])) {
$result .= IntegerFormatter::format($dy... | php | protected function encodeMultiWithOffset($types, $solidityTypes, $encodes, $dynamicOffset)
{
$result = '';
foreach ($solidityTypes as $key => $type) {
if ($type->isDynamicType($types[$key]) || $type->isDynamicArray($types[$key])) {
$result .= IntegerFormatter::format($dy... | [
"protected",
"function",
"encodeMultiWithOffset",
"(",
"$",
"types",
",",
"$",
"solidityTypes",
",",
"$",
"encodes",
",",
"$",
"dynamicOffset",
")",
"{",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",
"$",
"solidityTypes",
"as",
"$",
"key",
"=>",
"$",
"t... | encodeMultiWithOffset
@param array $types
@param array $solidityTypes
@param array $encodes
@param int $dynamicOffset
@return string | [
"encodeMultiWithOffset"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Ethabi.php#L363-L384 |
sc0Vu/web3.php | src/Contracts/Types/Integer.php | Integer.outputFormat | public function outputFormat($value, $name)
{
$match = [];
if (preg_match('/^[0]+([a-f0-9]+)$/', $value, $match) === 1) {
// due to value without 0x prefix, we will parse as decimal
$value = '0x' . $match[1];
}
return BigNumberFormatter::format($value);
} | php | public function outputFormat($value, $name)
{
$match = [];
if (preg_match('/^[0]+([a-f0-9]+)$/', $value, $match) === 1) {
// due to value without 0x prefix, we will parse as decimal
$value = '0x' . $match[1];
}
return BigNumberFormatter::format($value);
} | [
"public",
"function",
"outputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"match",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"'/^[0]+([a-f0-9]+)$/'",
",",
"$",
"value",
",",
"$",
"match",
")",
"===",
"1",
")",
"{",
"// due to ... | outputFormat
@param mixed $value
@param string $name
@return string | [
"outputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Integer.php#L72-L81 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.nestedTypes | public function nestedTypes($name)
{
if (!is_string($name)) {
throw new InvalidArgumentException('nestedTypes name must string.');
}
$matches = [];
if (preg_match_all('/(\[[0-9]*\])/', $name, $matches, PREG_PATTERN_ORDER) >= 1) {
return $matches[0];
}... | php | public function nestedTypes($name)
{
if (!is_string($name)) {
throw new InvalidArgumentException('nestedTypes name must string.');
}
$matches = [];
if (preg_match_all('/(\[[0-9]*\])/', $name, $matches, PREG_PATTERN_ORDER) >= 1) {
return $matches[0];
}... | [
"public",
"function",
"nestedTypes",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'nestedTypes name must string.'",
")",
";",
"}",
"$",
"matches",
"=",
"[",
"]",... | nestedTypes
@param string $name
@return mixed | [
"nestedTypes"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L74-L85 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.nestedName | public function nestedName($name)
{
if (!is_string($name)) {
throw new InvalidArgumentException('nestedName name must string.');
}
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
return $name;
}
return mb_substr($name, ... | php | public function nestedName($name)
{
if (!is_string($name)) {
throw new InvalidArgumentException('nestedName name must string.');
}
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
return $name;
}
return mb_substr($name, ... | [
"public",
"function",
"nestedName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'nestedName name must string.'",
")",
";",
"}",
"$",
"nestedTypes",
"=",
"$",
"t... | nestedName
@param string $name
@return string | [
"nestedName"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L93-L104 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.isDynamicArray | public function isDynamicArray($name)
{
$nestedTypes = $this->nestedTypes($name);
return $nestedTypes && preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1]) !== 1;
} | php | public function isDynamicArray($name)
{
$nestedTypes = $this->nestedTypes($name);
return $nestedTypes && preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1]) !== 1;
} | [
"public",
"function",
"isDynamicArray",
"(",
"$",
"name",
")",
"{",
"$",
"nestedTypes",
"=",
"$",
"this",
"->",
"nestedTypes",
"(",
"$",
"name",
")",
";",
"return",
"$",
"nestedTypes",
"&&",
"preg_match",
"(",
"'/[0-9]{1,}/'",
",",
"$",
"nestedTypes",
"[",... | isDynamicArray
@param string $name
@return bool | [
"isDynamicArray"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L112-L117 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.isStaticArray | public function isStaticArray($name)
{
$nestedTypes = $this->nestedTypes($name);
return $nestedTypes && preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1]) === 1;
} | php | public function isStaticArray($name)
{
$nestedTypes = $this->nestedTypes($name);
return $nestedTypes && preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1]) === 1;
} | [
"public",
"function",
"isStaticArray",
"(",
"$",
"name",
")",
"{",
"$",
"nestedTypes",
"=",
"$",
"this",
"->",
"nestedTypes",
"(",
"$",
"name",
")",
";",
"return",
"$",
"nestedTypes",
"&&",
"preg_match",
"(",
"'/[0-9]{1,}/'",
",",
"$",
"nestedTypes",
"[",
... | isStaticArray
@param string $name
@return bool | [
"isStaticArray"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L125-L130 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.staticArrayLength | public function staticArrayLength($name)
{
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
return 1;
}
$match = [];
if (preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1], $match) === 1) {
return (int) $match[0];
... | php | public function staticArrayLength($name)
{
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
return 1;
}
$match = [];
if (preg_match('/[0-9]{1,}/', $nestedTypes[count($nestedTypes) - 1], $match) === 1) {
return (int) $match[0];
... | [
"public",
"function",
"staticArrayLength",
"(",
"$",
"name",
")",
"{",
"$",
"nestedTypes",
"=",
"$",
"this",
"->",
"nestedTypes",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"nestedTypes",
"===",
"false",
")",
"{",
"return",
"1",
";",
"}",
"$",
"matc... | staticArrayLength
@param string $name
@return int | [
"staticArrayLength"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L138-L151 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.staticPartLength | public function staticPartLength($name)
{
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
$nestedTypes = ['[1]'];
}
$count = 32;
foreach ($nestedTypes as $type) {
$num = mb_substr($type, 1, 1);
if (!is_numeric($nu... | php | public function staticPartLength($name)
{
$nestedTypes = $this->nestedTypes($name);
if ($nestedTypes === false) {
$nestedTypes = ['[1]'];
}
$count = 32;
foreach ($nestedTypes as $type) {
$num = mb_substr($type, 1, 1);
if (!is_numeric($nu... | [
"public",
"function",
"staticPartLength",
"(",
"$",
"name",
")",
"{",
"$",
"nestedTypes",
"=",
"$",
"this",
"->",
"nestedTypes",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"nestedTypes",
"===",
"false",
")",
"{",
"$",
"nestedTypes",
"=",
"[",
"'[1]'",... | staticPartLength
@param string $name
@return int | [
"staticPartLength"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L159-L180 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.encode | public function encode($value, $name)
{
if ($this->isDynamicArray($name)) {
$length = count($value);
$nestedName = $this->nestedName($name);
$result = [];
$result[] = IntegerFormatter::format($length);
foreach ($value as $val) {
$r... | php | public function encode($value, $name)
{
if ($this->isDynamicArray($name)) {
$length = count($value);
$nestedName = $this->nestedName($name);
$result = [];
$result[] = IntegerFormatter::format($length);
foreach ($value as $val) {
$r... | [
"public",
"function",
"encode",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDynamicArray",
"(",
"$",
"name",
")",
")",
"{",
"$",
"length",
"=",
"count",
"(",
"$",
"value",
")",
";",
"$",
"nestedName",
"=",
"$",... | encode
@param mixed $value
@param string $name
@return string | [
"encode"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L199-L222 |
sc0Vu/web3.php | src/Contracts/SolidityType.php | SolidityType.decode | public function decode($value, $offset, $name)
{
if ($this->isDynamicArray($name)) {
$arrayOffset = (int) Utils::toBn('0x' . mb_substr($value, $offset * 2, 64))->toString();
$length = (int) Utils::toBn('0x' . mb_substr($value, $arrayOffset * 2, 64))->toString();
$arraySta... | php | public function decode($value, $offset, $name)
{
if ($this->isDynamicArray($name)) {
$arrayOffset = (int) Utils::toBn('0x' . mb_substr($value, $offset * 2, 64))->toString();
$length = (int) Utils::toBn('0x' . mb_substr($value, $arrayOffset * 2, 64))->toString();
$arraySta... | [
"public",
"function",
"decode",
"(",
"$",
"value",
",",
"$",
"offset",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDynamicArray",
"(",
"$",
"name",
")",
")",
"{",
"$",
"arrayOffset",
"=",
"(",
"int",
")",
"Utils",
"::",
"toBn",
"... | decode
@param mixed $value
@param string $offset
@param string $name
@return array | [
"decode"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/SolidityType.php#L232-L272 |
sc0Vu/web3.php | src/RequestManagers/HttpRequestManager.php | HttpRequestManager.sendPayload | public function sendPayload($payload, $callback)
{
if (!is_string($payload)) {
throw new \InvalidArgumentException('Payload must be string.');
}
try {
$res = $this->client->post($this->host, [
'headers' => [
'content-type' => 'appl... | php | public function sendPayload($payload, $callback)
{
if (!is_string($payload)) {
throw new \InvalidArgumentException('Payload must be string.');
}
try {
$res = $this->client->post($this->host, [
'headers' => [
'content-type' => 'appl... | [
"public",
"function",
"sendPayload",
"(",
"$",
"payload",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"payload",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Payload must be string.'",
")",
";",
"}",
"t... | sendPayload
@param string $payload
@param callable $callback
@return void | [
"sendPayload"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/RequestManagers/HttpRequestManager.php#L52-L113 |
rap2hpoutre/laravel-log-viewer | src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewerServiceProvider.php | LaravelLogViewerServiceProvider.boot | public function boot()
{
if (method_exists($this, 'package')) {
$this->package('rap2hpoutre/laravel-log-viewer', 'laravel-log-viewer', __DIR__ . '/../../');
}
if (method_exists($this, 'loadViewsFrom')) {
$this->loadViewsFrom(__DIR__.'/../../views', 'laravel-log-viewe... | php | public function boot()
{
if (method_exists($this, 'package')) {
$this->package('rap2hpoutre/laravel-log-viewer', 'laravel-log-viewer', __DIR__ . '/../../');
}
if (method_exists($this, 'loadViewsFrom')) {
$this->loadViewsFrom(__DIR__.'/../../views', 'laravel-log-viewe... | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'package'",
")",
")",
"{",
"$",
"this",
"->",
"package",
"(",
"'rap2hpoutre/laravel-log-viewer'",
",",
"'laravel-log-viewer'",
",",
"__DIR__",
".",
"'/../../'",
... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/rap2hpoutre/laravel-log-viewer/blob/f6acf9779669568e8afce1182e1a5579d5a0ffe5/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewerServiceProvider.php#L19-L38 |
rap2hpoutre/laravel-log-viewer | src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewerServiceProvider.php | LaravelLogViewerServiceProvider.config_path | private function config_path($path = '')
{
return function_exists('config_path') ? config_path($path) : app()->basePath() . DIRECTORY_SEPARATOR . 'config' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
} | php | private function config_path($path = '')
{
return function_exists('config_path') ? config_path($path) : app()->basePath() . DIRECTORY_SEPARATOR . 'config' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
} | [
"private",
"function",
"config_path",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"return",
"function_exists",
"(",
"'config_path'",
")",
"?",
"config_path",
"(",
"$",
"path",
")",
":",
"app",
"(",
")",
"->",
"basePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
... | Get the configuration path.
@param string $path
@return string | [
"Get",
"the",
"configuration",
"path",
"."
] | train | https://github.com/rap2hpoutre/laravel-log-viewer/blob/f6acf9779669568e8afce1182e1a5579d5a0ffe5/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewerServiceProvider.php#L66-L69 |
dektrium/yii2-user | clients/Google.php | Google.buildAuthUrl | public function buildAuthUrl(array $params = [])
{
if ($this->hostedDomain) {
$params['hd'] = $this->hostedDomain;
}
return parent::buildAuthUrl($params);
} | php | public function buildAuthUrl(array $params = [])
{
if ($this->hostedDomain) {
$params['hd'] = $this->hostedDomain;
}
return parent::buildAuthUrl($params);
} | [
"public",
"function",
"buildAuthUrl",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hostedDomain",
")",
"{",
"$",
"params",
"[",
"'hd'",
"]",
"=",
"$",
"this",
"->",
"hostedDomain",
";",
"}",
"return",
"parent",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/clients/Google.php#L29-L36 |
dektrium/yii2-user | helpers/Timezone.php | Timezone.getAll | public static function getAll()
{
$timeZones = [];
$timeZoneIdentifiers = \DateTimeZone::listIdentifiers();
foreach ($timeZoneIdentifiers as $timeZone) {
$date = new \DateTime('now', new \DateTimeZone($timeZone));
$offset = $date->getOffset();
$tz = ($off... | php | public static function getAll()
{
$timeZones = [];
$timeZoneIdentifiers = \DateTimeZone::listIdentifiers();
foreach ($timeZoneIdentifiers as $timeZone) {
$date = new \DateTime('now', new \DateTimeZone($timeZone));
$offset = $date->getOffset();
$tz = ($off... | [
"public",
"static",
"function",
"getAll",
"(",
")",
"{",
"$",
"timeZones",
"=",
"[",
"]",
";",
"$",
"timeZoneIdentifiers",
"=",
"\\",
"DateTimeZone",
"::",
"listIdentifiers",
"(",
")",
";",
"foreach",
"(",
"$",
"timeZoneIdentifiers",
"as",
"$",
"timeZone",
... | Get all of the time zones with the offsets sorted by their offset
@return array | [
"Get",
"all",
"of",
"the",
"time",
"zones",
"with",
"the",
"offsets",
"sorted",
"by",
"their",
"offset"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/helpers/Timezone.php#L27-L46 |
dektrium/yii2-user | controllers/ProfileController.php | ProfileController.actionShow | public function actionShow($id)
{
$profile = $this->finder->findProfileById($id);
if ($profile === null) {
throw new NotFoundHttpException();
}
return $this->render('show', [
'profile' => $profile,
]);
} | php | public function actionShow($id)
{
$profile = $this->finder->findProfileById($id);
if ($profile === null) {
throw new NotFoundHttpException();
}
return $this->render('show', [
'profile' => $profile,
]);
} | [
"public",
"function",
"actionShow",
"(",
"$",
"id",
")",
"{",
"$",
"profile",
"=",
"$",
"this",
"->",
"finder",
"->",
"findProfileById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"profile",
"===",
"null",
")",
"{",
"throw",
"new",
"NotFoundHttpExceptio... | Shows user's profile.
@param int $id
@return \yii\web\Response
@throws \yii\web\NotFoundHttpException | [
"Shows",
"user",
"s",
"profile",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/ProfileController.php#L75-L86 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionIndex | public function actionIndex()
{
Url::remember('', 'actions-redirect');
$searchModel = \Yii::createObject(UserSearch::className());
$dataProvider = $searchModel->search(\Yii::$app->request->get());
return $this->render('index', [
'dataProvider' => $dataProvider,
... | php | public function actionIndex()
{
Url::remember('', 'actions-redirect');
$searchModel = \Yii::createObject(UserSearch::className());
$dataProvider = $searchModel->search(\Yii::$app->request->get());
return $this->render('index', [
'dataProvider' => $dataProvider,
... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"Url",
"::",
"remember",
"(",
"''",
",",
"'actions-redirect'",
")",
";",
"$",
"searchModel",
"=",
"\\",
"Yii",
"::",
"createObject",
"(",
"UserSearch",
"::",
"className",
"(",
")",
")",
";",
"$",
"dataP... | Lists all User models.
@return mixed | [
"Lists",
"all",
"User",
"models",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L203-L213 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionCreate | public function actionCreate()
{
/** @var User $user */
$user = \Yii::createObject([
'class' => User::className(),
'scenario' => 'create',
]);
$event = $this->getUserEvent($user);
$this->performAjaxValidation($user);
$this->trigger(self::E... | php | public function actionCreate()
{
/** @var User $user */
$user = \Yii::createObject([
'class' => User::className(),
'scenario' => 'create',
]);
$event = $this->getUserEvent($user);
$this->performAjaxValidation($user);
$this->trigger(self::E... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"/** @var User $user */",
"$",
"user",
"=",
"\\",
"Yii",
"::",
"createObject",
"(",
"[",
"'class'",
"=>",
"User",
"::",
"className",
"(",
")",
",",
"'scenario'",
"=>",
"'create'",
",",
"]",
")",
";",
"... | Creates a new User model.
If creation is successful, the browser will be redirected to the 'index' page.
@return mixed | [
"Creates",
"a",
"new",
"User",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L221-L242 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionInfo | public function actionInfo($id)
{
Url::remember('', 'actions-redirect');
$user = $this->findModel($id);
return $this->render('_info', [
'user' => $user,
]);
} | php | public function actionInfo($id)
{
Url::remember('', 'actions-redirect');
$user = $this->findModel($id);
return $this->render('_info', [
'user' => $user,
]);
} | [
"public",
"function",
"actionInfo",
"(",
"$",
"id",
")",
"{",
"Url",
"::",
"remember",
"(",
"''",
",",
"'actions-redirect'",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"render",
... | Shows information about user.
@param int $id
@return string | [
"Shows",
"information",
"about",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L314-L322 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionSwitch | public function actionSwitch($id = null)
{
if (!$this->module->enableImpersonateUser) {
throw new ForbiddenHttpException(Yii::t('user', 'Impersonate user is disabled in the application configuration'));
}
if(!$id && Yii::$app->session->has(self::ORIGINAL_USER_SESSION_KEY)) {
... | php | public function actionSwitch($id = null)
{
if (!$this->module->enableImpersonateUser) {
throw new ForbiddenHttpException(Yii::t('user', 'Impersonate user is disabled in the application configuration'));
}
if(!$id && Yii::$app->session->has(self::ORIGINAL_USER_SESSION_KEY)) {
... | [
"public",
"function",
"actionSwitch",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"module",
"->",
"enableImpersonateUser",
")",
"{",
"throw",
"new",
"ForbiddenHttpException",
"(",
"Yii",
"::",
"t",
"(",
"'user'",
",",
"'Impe... | Switches to the given user for the rest of the Session.
When no id is given, we switch back to the original admin user
that started the impersonation.
@param int $id
@return string | [
"Switches",
"to",
"the",
"given",
"user",
"for",
"the",
"rest",
"of",
"the",
"Session",
".",
"When",
"no",
"id",
"is",
"given",
"we",
"switch",
"back",
"to",
"the",
"original",
"admin",
"user",
"that",
"started",
"the",
"impersonation",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L333-L361 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionAssignments | public function actionAssignments($id)
{
if (!isset(\Yii::$app->extensions['dektrium/yii2-rbac'])) {
throw new NotFoundHttpException();
}
Url::remember('', 'actions-redirect');
$user = $this->findModel($id);
return $this->render('_assignments', [
'use... | php | public function actionAssignments($id)
{
if (!isset(\Yii::$app->extensions['dektrium/yii2-rbac'])) {
throw new NotFoundHttpException();
}
Url::remember('', 'actions-redirect');
$user = $this->findModel($id);
return $this->render('_assignments', [
'use... | [
"public",
"function",
"actionAssignments",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"extensions",
"[",
"'dektrium/yii2-rbac'",
"]",
")",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",... | If "dektrium/yii2-rbac" extension is installed, this page displays form
where user can assign multiple auth items to user.
@param int $id
@return string
@throws NotFoundHttpException | [
"If",
"dektrium",
"/",
"yii2",
"-",
"rbac",
"extension",
"is",
"installed",
"this",
"page",
"displays",
"form",
"where",
"user",
"can",
"assign",
"multiple",
"auth",
"items",
"to",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L372-L383 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionDelete | public function actionDelete($id)
{
if ($id == \Yii::$app->user->getId()) {
\Yii::$app->getSession()->setFlash('danger', \Yii::t('user', 'You can not remove your own account'));
} else {
$model = $this->findModel($id);
$event = $this->getUserEvent($model);
... | php | public function actionDelete($id)
{
if ($id == \Yii::$app->user->getId()) {
\Yii::$app->getSession()->setFlash('danger', \Yii::t('user', 'You can not remove your own account'));
} else {
$model = $this->findModel($id);
$event = $this->getUserEvent($model);
... | [
"public",
"function",
"actionDelete",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"==",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"getId",
"(",
")",
")",
"{",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getSession",
"(",
")",
"->",
"setF... | Deletes an existing User model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param int $id
@return mixed | [
"Deletes",
"an",
"existing",
"User",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L414-L428 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionBlock | public function actionBlock($id)
{
if ($id == \Yii::$app->user->getId()) {
\Yii::$app->getSession()->setFlash('danger', \Yii::t('user', 'You can not block your own account'));
} else {
$user = $this->findModel($id);
$event = $this->getUserEvent($user);
... | php | public function actionBlock($id)
{
if ($id == \Yii::$app->user->getId()) {
\Yii::$app->getSession()->setFlash('danger', \Yii::t('user', 'You can not block your own account'));
} else {
$user = $this->findModel($id);
$event = $this->getUserEvent($user);
... | [
"public",
"function",
"actionBlock",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"==",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"getId",
"(",
")",
")",
"{",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getSession",
"(",
")",
"->",
"setFl... | Blocks the user.
@param int $id
@return Response | [
"Blocks",
"the",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L437-L458 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.actionResendPassword | public function actionResendPassword($id)
{
$user = $this->findModel($id);
if ($user->isAdmin) {
throw new ForbiddenHttpException(Yii::t('user', 'Password generation is not possible for admin users'));
}
if ($user->resendPassword()) {
Yii::$app->session->setF... | php | public function actionResendPassword($id)
{
$user = $this->findModel($id);
if ($user->isAdmin) {
throw new ForbiddenHttpException(Yii::t('user', 'Password generation is not possible for admin users'));
}
if ($user->resendPassword()) {
Yii::$app->session->setF... | [
"public",
"function",
"actionResendPassword",
"(",
"$",
"id",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"user",
"->",
"isAdmin",
")",
"{",
"throw",
"new",
"ForbiddenHttpException",
"(",
"Yii",... | Generates a new password and sends it to the user.
@return Response | [
"Generates",
"a",
"new",
"password",
"and",
"sends",
"it",
"to",
"the",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L465-L479 |
dektrium/yii2-user | controllers/AdminController.php | AdminController.findModel | protected function findModel($id)
{
$user = $this->finder->findUserById($id);
if ($user === null) {
throw new NotFoundHttpException('The requested page does not exist');
}
return $user;
} | php | protected function findModel($id)
{
$user = $this->finder->findUserById($id);
if ($user === null) {
throw new NotFoundHttpException('The requested page does not exist');
}
return $user;
} | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"finder",
"->",
"findUserById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"user",
"===",
"null",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"... | Finds the User model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param int $id
@return User the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"User",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/AdminController.php#L490-L498 |
dektrium/yii2-user | Mailer.php | Mailer.sendWelcomeMessage | public function sendWelcomeMessage(User $user, Token $token = null, $showPassword = false)
{
return $this->sendMessage(
$user->email,
$this->getWelcomeSubject(),
'welcome',
['user' => $user, 'token' => $token, 'module' => $this->module, 'showPassword' => $show... | php | public function sendWelcomeMessage(User $user, Token $token = null, $showPassword = false)
{
return $this->sendMessage(
$user->email,
$this->getWelcomeSubject(),
'welcome',
['user' => $user, 'token' => $token, 'module' => $this->module, 'showPassword' => $show... | [
"public",
"function",
"sendWelcomeMessage",
"(",
"User",
"$",
"user",
",",
"Token",
"$",
"token",
"=",
"null",
",",
"$",
"showPassword",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"sendMessage",
"(",
"$",
"user",
"->",
"email",
",",
"$",
"thi... | Sends an email to a user after registration.
@param User $user
@param Token $token
@param bool $showPassword
@return bool | [
"Sends",
"an",
"email",
"to",
"a",
"user",
"after",
"registration",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Mailer.php#L169-L177 |
dektrium/yii2-user | Mailer.php | Mailer.sendGeneratedPassword | public function sendGeneratedPassword(User $user, $password)
{
return $this->sendMessage(
$user->email,
$this->getNewPasswordSubject(),
'new_password',
['user' => $user, 'password' => $password, 'module' => $this->module]
);
} | php | public function sendGeneratedPassword(User $user, $password)
{
return $this->sendMessage(
$user->email,
$this->getNewPasswordSubject(),
'new_password',
['user' => $user, 'password' => $password, 'module' => $this->module]
);
} | [
"public",
"function",
"sendGeneratedPassword",
"(",
"User",
"$",
"user",
",",
"$",
"password",
")",
"{",
"return",
"$",
"this",
"->",
"sendMessage",
"(",
"$",
"user",
"->",
"email",
",",
"$",
"this",
"->",
"getNewPasswordSubject",
"(",
")",
",",
"'new_pass... | Sends a new generated password to a user.
@param User $user
@param Password $password
@return bool | [
"Sends",
"a",
"new",
"generated",
"password",
"to",
"a",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Mailer.php#L187-L195 |
dektrium/yii2-user | Mailer.php | Mailer.sendMessage | protected function sendMessage($to, $subject, $view, $params = [])
{
$mailer = $this->mailerComponent === null ? Yii::$app->mailer : Yii::$app->get($this->mailerComponent);
$mailer->viewPath = $this->viewPath;
$mailer->getView()->theme = Yii::$app->view->theme;
if ($this->sender ===... | php | protected function sendMessage($to, $subject, $view, $params = [])
{
$mailer = $this->mailerComponent === null ? Yii::$app->mailer : Yii::$app->get($this->mailerComponent);
$mailer->viewPath = $this->viewPath;
$mailer->getView()->theme = Yii::$app->view->theme;
if ($this->sender ===... | [
"protected",
"function",
"sendMessage",
"(",
"$",
"to",
",",
"$",
"subject",
",",
"$",
"view",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"mailer",
"=",
"$",
"this",
"->",
"mailerComponent",
"===",
"null",
"?",
"Yii",
"::",
"$",
"app",
"->",... | @param string $to
@param string $subject
@param string $view
@param array $params
@return bool | [
"@param",
"string",
"$to",
"@param",
"string",
"$subject",
"@param",
"string",
"$view",
"@param",
"array",
"$params"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Mailer.php#L265-L282 |
dektrium/yii2-user | models/User.php | User.getAccountByProvider | public function getAccountByProvider($provider)
{
$accounts = $this->getAccounts();
return isset($accounts[$provider])
? $accounts[$provider]
: null;
} | php | public function getAccountByProvider($provider)
{
$accounts = $this->getAccounts();
return isset($accounts[$provider])
? $accounts[$provider]
: null;
} | [
"public",
"function",
"getAccountByProvider",
"(",
"$",
"provider",
")",
"{",
"$",
"accounts",
"=",
"$",
"this",
"->",
"getAccounts",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"accounts",
"[",
"$",
"provider",
"]",
")",
"?",
"$",
"accounts",
"[",
"$"... | Returns connected account by provider.
@param string $provider
@return Account|null | [
"Returns",
"connected",
"account",
"by",
"provider",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L166-L172 |
dektrium/yii2-user | models/User.php | User.create | public function create()
{
if ($this->getIsNewRecord() == false) {
throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
}
$transaction = $this->getDb()->beginTransaction();
try {
$this->password = ($this->password ... | php | public function create()
{
if ($this->getIsNewRecord() == false) {
throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
}
$transaction = $this->getDb()->beginTransaction();
try {
$this->password = ($this->password ... | [
"public",
"function",
"create",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsNewRecord",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Calling \"'",
".",
"__CLASS__",
".",
"'::'",
".",
"__METHOD__",
".",
"'\" o... | Creates new user account. If Module::enableGeneratingPassword is set true, this method
will generate password.
@return bool | [
"Creates",
"new",
"user",
"account",
".",
"If",
"Module",
"::",
"enableGeneratingPassword",
"is",
"set",
"true",
"this",
"method",
"will",
"generate",
"password",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L266-L297 |
dektrium/yii2-user | models/User.php | User.register | public function register()
{
if ($this->getIsNewRecord() == false) {
throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
}
$transaction = $this->getDb()->beginTransaction();
try {
$this->confirmed_at = $this->modu... | php | public function register()
{
if ($this->getIsNewRecord() == false) {
throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
}
$transaction = $this->getDb()->beginTransaction();
try {
$this->confirmed_at = $this->modu... | [
"public",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsNewRecord",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Calling \"'",
".",
"__CLASS__",
".",
"'::'",
".",
"__METHOD__",
".",
"'\"... | This method is used to register new user account. If Module::enableConfirmation is set true, this method
will generate new confirmation token and use mailer to send it to the user.
@return bool | [
"This",
"method",
"is",
"used",
"to",
"register",
"new",
"user",
"account",
".",
"If",
"Module",
"::",
"enableConfirmation",
"is",
"set",
"true",
"this",
"method",
"will",
"generate",
"new",
"confirmation",
"token",
"and",
"use",
"mailer",
"to",
"send",
"it"... | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L305-L341 |
dektrium/yii2-user | models/User.php | User.resendPassword | public function resendPassword()
{
$this->password = Password::generate(8);
$this->save(false, ['password_hash']);
return $this->mailer->sendGeneratedPassword($this, $this->password);
} | php | public function resendPassword()
{
$this->password = Password::generate(8);
$this->save(false, ['password_hash']);
return $this->mailer->sendGeneratedPassword($this, $this->password);
} | [
"public",
"function",
"resendPassword",
"(",
")",
"{",
"$",
"this",
"->",
"password",
"=",
"Password",
"::",
"generate",
"(",
"8",
")",
";",
"$",
"this",
"->",
"save",
"(",
"false",
",",
"[",
"'password_hash'",
"]",
")",
";",
"return",
"$",
"this",
"... | Generates a new password and sends it to the user.
@param string $code Confirmation code.
@return boolean | [
"Generates",
"a",
"new",
"password",
"and",
"sends",
"it",
"to",
"the",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L379-L385 |
dektrium/yii2-user | models/User.php | User.attemptEmailChange | public function attemptEmailChange($code)
{
// TODO refactor method
/** @var Token $token */
$token = $this->finder->findToken([
'user_id' => $this->id,
'code' => $code,
])->andWhere(['in', 'type', [Token::TYPE_CONFIRM_NEW_EMAIL, Token::TYPE_CONFIRM_OLD_EM... | php | public function attemptEmailChange($code)
{
// TODO refactor method
/** @var Token $token */
$token = $this->finder->findToken([
'user_id' => $this->id,
'code' => $code,
])->andWhere(['in', 'type', [Token::TYPE_CONFIRM_NEW_EMAIL, Token::TYPE_CONFIRM_OLD_EM... | [
"public",
"function",
"attemptEmailChange",
"(",
"$",
"code",
")",
"{",
"// TODO refactor method",
"/** @var Token $token */",
"$",
"token",
"=",
"$",
"this",
"->",
"finder",
"->",
"findToken",
"(",
"[",
"'user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'code'... | This method attempts changing user email. If user's "unconfirmed_email" field is empty is returns false, else if
somebody already has email that equals user's "unconfirmed_email" it returns false, otherwise returns true and
updates user's password.
@param string $code
@return bool
@throws \Exception | [
"This",
"method",
"attempts",
"changing",
"user",
"email",
".",
"If",
"user",
"s",
"unconfirmed_email",
"field",
"is",
"empty",
"is",
"returns",
"false",
"else",
"if",
"somebody",
"already",
"has",
"email",
"that",
"equals",
"user",
"s",
"unconfirmed_email",
"... | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L397-L448 |
dektrium/yii2-user | models/User.php | User.confirm | public function confirm()
{
$this->trigger(self::BEFORE_CONFIRM);
$result = (bool) $this->updateAttributes(['confirmed_at' => time()]);
$this->trigger(self::AFTER_CONFIRM);
return $result;
} | php | public function confirm()
{
$this->trigger(self::BEFORE_CONFIRM);
$result = (bool) $this->updateAttributes(['confirmed_at' => time()]);
$this->trigger(self::AFTER_CONFIRM);
return $result;
} | [
"public",
"function",
"confirm",
"(",
")",
"{",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"BEFORE_CONFIRM",
")",
";",
"$",
"result",
"=",
"(",
"bool",
")",
"$",
"this",
"->",
"updateAttributes",
"(",
"[",
"'confirmed_at'",
"=>",
"time",
"(",
")"... | Confirms the user by setting 'confirmed_at' field to current time. | [
"Confirms",
"the",
"user",
"by",
"setting",
"confirmed_at",
"field",
"to",
"current",
"time",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L453-L459 |
dektrium/yii2-user | models/User.php | User.generateUsername | public function generateUsername()
{
// try to use name part of email
$username = explode('@', $this->email)[0];
$this->username = $username;
if ($this->validate(['username'])) {
return $this->username;
}
// valid email addresses are less restricitve than... | php | public function generateUsername()
{
// try to use name part of email
$username = explode('@', $this->email)[0];
$this->username = $username;
if ($this->validate(['username'])) {
return $this->username;
}
// valid email addresses are less restricitve than... | [
"public",
"function",
"generateUsername",
"(",
")",
"{",
"// try to use name part of email",
"$",
"username",
"=",
"explode",
"(",
"'@'",
",",
"$",
"this",
"->",
"email",
")",
"[",
"0",
"]",
";",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
... | Generates new username based on email address, or creates new username
like "emailuser1". | [
"Generates",
"new",
"username",
"based",
"on",
"email",
"address",
"or",
"creates",
"new",
"username",
"like",
"emailuser1",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/User.php#L496-L520 |
dektrium/yii2-user | widgets/Connect.php | Connect.isConnected | public function isConnected(ClientInterface $provider)
{
return $this->accounts != null && isset($this->accounts[$provider->getId()]);
} | php | public function isConnected(ClientInterface $provider)
{
return $this->accounts != null && isset($this->accounts[$provider->getId()]);
} | [
"public",
"function",
"isConnected",
"(",
"ClientInterface",
"$",
"provider",
")",
"{",
"return",
"$",
"this",
"->",
"accounts",
"!=",
"null",
"&&",
"isset",
"(",
"$",
"this",
"->",
"accounts",
"[",
"$",
"provider",
"->",
"getId",
"(",
")",
"]",
")",
"... | Checks if provider already connected to user.
@param ClientInterface $provider
@return bool | [
"Checks",
"if",
"provider",
"already",
"connected",
"to",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/widgets/Connect.php#L68-L71 |
dektrium/yii2-user | models/UserSearch.php | UserSearch.search | public function search($params)
{
$query = $this->finder->getUserQuery();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
]);
if (!($this->load($params) && $this->validate())) {
... | php | public function search($params)
{
$query = $this->finder->getUserQuery();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
]);
if (!($this->load($params) && $this->validate())) {
... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"finder",
"->",
"getUserQuery",
"(",
")",
";",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"query",
",",
"'so... | @param $params
@return ActiveDataProvider | [
"@param",
"$params"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/UserSearch.php#L83-L110 |
dektrium/yii2-user | models/LoginForm.php | LoginForm.loginList | public static function loginList()
{
/** @var \dektrium\user\Module $module */
$module = \Yii::$app->getModule('user');
$userModel = $module->modelMap['User'];
return ArrayHelper::map($userModel::find()->where(['blocked_at' => null])->all(), 'username', function ($user) {
... | php | public static function loginList()
{
/** @var \dektrium\user\Module $module */
$module = \Yii::$app->getModule('user');
$userModel = $module->modelMap['User'];
return ArrayHelper::map($userModel::find()->where(['blocked_at' => null])->all(), 'username', function ($user) {
... | [
"public",
"static",
"function",
"loginList",
"(",
")",
"{",
"/** @var \\dektrium\\user\\Module $module */",
"$",
"module",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getModule",
"(",
"'user'",
")",
";",
"$",
"userModel",
"=",
"$",
"module",
"->",
"modelMap",
... | Gets all users to generate the dropdown list when in debug mode.
@return array | [
"Gets",
"all",
"users",
"to",
"generate",
"the",
"dropdown",
"list",
"when",
"in",
"debug",
"mode",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/LoginForm.php#L62-L72 |
dektrium/yii2-user | models/LoginForm.php | LoginForm.validatePassword | public function validatePassword($attribute, $params)
{
if ($this->user === null || !Password::validate($this->password, $this->user->password_hash))
$this->addError($attribute, Yii::t('user', 'Invalid login or password'));
} | php | public function validatePassword($attribute, $params)
{
if ($this->user === null || !Password::validate($this->password, $this->user->password_hash))
$this->addError($attribute, Yii::t('user', 'Invalid login or password'));
} | [
"public",
"function",
"validatePassword",
"(",
"$",
"attribute",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"user",
"===",
"null",
"||",
"!",
"Password",
"::",
"validate",
"(",
"$",
"this",
"->",
"password",
",",
"$",
"this",
"->",
"... | Validates if the hash of the given password is identical to the saved hash in the database.
It will always succeed if the module is in DEBUG mode.
@return void | [
"Validates",
"if",
"the",
"hash",
"of",
"the",
"given",
"password",
"is",
"identical",
"to",
"the",
"saved",
"hash",
"in",
"the",
"database",
".",
"It",
"will",
"always",
"succeed",
"if",
"the",
"module",
"is",
"in",
"DEBUG",
"mode",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/LoginForm.php#L131-L135 |
dektrium/yii2-user | models/LoginForm.php | LoginForm.login | public function login()
{
if ($this->validate() && $this->user) {
$isLogged = Yii::$app->getUser()->login($this->user, $this->rememberMe ? $this->module->rememberFor : 0);
if ($isLogged) {
$this->user->updateAttributes(['last_login_at' => time()]);
}
... | php | public function login()
{
if ($this->validate() && $this->user) {
$isLogged = Yii::$app->getUser()->login($this->user, $this->rememberMe ? $this->module->rememberFor : 0);
if ($isLogged) {
$this->user->updateAttributes(['last_login_at' => time()]);
}
... | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
"&&",
"$",
"this",
"->",
"user",
")",
"{",
"$",
"isLogged",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
")",
"->",
"login",
"(",
"$",
"thi... | Validates form and logs the user in.
@return bool whether the user is logged in successfully | [
"Validates",
"form",
"and",
"logs",
"the",
"user",
"in",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/LoginForm.php#L142-L155 |
dektrium/yii2-user | controllers/SettingsController.php | SettingsController.actionAccount | public function actionAccount()
{
/** @var SettingsForm $model */
$model = \Yii::createObject(SettingsForm::className());
$event = $this->getFormEvent($model);
$this->performAjaxValidation($model);
$this->trigger(self::EVENT_BEFORE_ACCOUNT_UPDATE, $event);
if ($mode... | php | public function actionAccount()
{
/** @var SettingsForm $model */
$model = \Yii::createObject(SettingsForm::className());
$event = $this->getFormEvent($model);
$this->performAjaxValidation($model);
$this->trigger(self::EVENT_BEFORE_ACCOUNT_UPDATE, $event);
if ($mode... | [
"public",
"function",
"actionAccount",
"(",
")",
"{",
"/** @var SettingsForm $model */",
"$",
"model",
"=",
"\\",
"Yii",
"::",
"createObject",
"(",
"SettingsForm",
"::",
"className",
"(",
")",
")",
";",
"$",
"event",
"=",
"$",
"this",
"->",
"getFormEvent",
"... | Displays page where user can update account settings (username, email or password).
@return string|\yii\web\Response | [
"Displays",
"page",
"where",
"user",
"can",
"update",
"account",
"settings",
"(",
"username",
"email",
"or",
"password",
")",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/SettingsController.php#L181-L199 |
dektrium/yii2-user | controllers/SettingsController.php | SettingsController.actionConfirm | public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
throw new NotFoundHttpException();
}
$event = $this->getUserEvent($user);
$this->trigg... | php | public function actionConfirm($id, $code)
{
$user = $this->finder->findUserById($id);
if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
throw new NotFoundHttpException();
}
$event = $this->getUserEvent($user);
$this->trigg... | [
"public",
"function",
"actionConfirm",
"(",
"$",
"id",
",",
"$",
"code",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"finder",
"->",
"findUserById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"user",
"===",
"null",
"||",
"$",
"this",
"->",
"mod... | Attempts changing user's email address.
@param int $id
@param string $code
@return string
@throws \yii\web\HttpException | [
"Attempts",
"changing",
"user",
"s",
"email",
"address",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/SettingsController.php#L210-L225 |
dektrium/yii2-user | controllers/SettingsController.php | SettingsController.actionDisconnect | public function actionDisconnect($id)
{
$account = $this->finder->findAccount()->byId($id)->one();
if ($account === null) {
throw new NotFoundHttpException();
}
if ($account->user_id != \Yii::$app->user->id) {
throw new ForbiddenHttpException();
}
... | php | public function actionDisconnect($id)
{
$account = $this->finder->findAccount()->byId($id)->one();
if ($account === null) {
throw new NotFoundHttpException();
}
if ($account->user_id != \Yii::$app->user->id) {
throw new ForbiddenHttpException();
}
... | [
"public",
"function",
"actionDisconnect",
"(",
"$",
"id",
")",
"{",
"$",
"account",
"=",
"$",
"this",
"->",
"finder",
"->",
"findAccount",
"(",
")",
"->",
"byId",
"(",
"$",
"id",
")",
"->",
"one",
"(",
")",
";",
"if",
"(",
"$",
"account",
"===",
... | Disconnects a network account from user.
@param int $id
@return \yii\web\Response
@throws \yii\web\NotFoundHttpException
@throws \yii\web\ForbiddenHttpException | [
"Disconnects",
"a",
"network",
"account",
"from",
"user",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/SettingsController.php#L248-L266 |
dektrium/yii2-user | controllers/SettingsController.php | SettingsController.actionDelete | public function actionDelete()
{
if (!$this->module->enableAccountDelete) {
throw new NotFoundHttpException(\Yii::t('user', 'Not found'));
}
/** @var User $user */
$user = \Yii::$app->user->identity;
$event = $this->getUserEvent($user);
\Yii::$app->user... | php | public function actionDelete()
{
if (!$this->module->enableAccountDelete) {
throw new NotFoundHttpException(\Yii::t('user', 'Not found'));
}
/** @var User $user */
$user = \Yii::$app->user->identity;
$event = $this->getUserEvent($user);
\Yii::$app->user... | [
"public",
"function",
"actionDelete",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"module",
"->",
"enableAccountDelete",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"\\",
"Yii",
"::",
"t",
"(",
"'user'",
",",
"'Not found'",
")",
")",
";... | Completely deletes user's account.
@return \yii\web\Response
@throws \Exception | [
"Completely",
"deletes",
"user",
"s",
"account",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/SettingsController.php#L274-L293 |
dektrium/yii2-user | Finder.php | Finder.findUserByUsernameOrEmail | public function findUserByUsernameOrEmail($usernameOrEmail)
{
if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
return $this->findUserByEmail($usernameOrEmail);
}
return $this->findUserByUsername($usernameOrEmail);
} | php | public function findUserByUsernameOrEmail($usernameOrEmail)
{
if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
return $this->findUserByEmail($usernameOrEmail);
}
return $this->findUserByUsername($usernameOrEmail);
} | [
"public",
"function",
"findUserByUsernameOrEmail",
"(",
"$",
"usernameOrEmail",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"usernameOrEmail",
",",
"FILTER_VALIDATE_EMAIL",
")",
")",
"{",
"return",
"$",
"this",
"->",
"findUserByEmail",
"(",
"$",
"usernameOrEmail"... | Finds a user by the given username or email.
@param string $usernameOrEmail Username or email to be used on search.
@return models\User | [
"Finds",
"a",
"user",
"by",
"the",
"given",
"username",
"or",
"email",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Finder.php#L138-L145 |
dektrium/yii2-user | Finder.php | Finder.findTokenByParams | public function findTokenByParams($userId, $code, $type)
{
return $this->findToken([
'user_id' => $userId,
'code' => $code,
'type' => $type,
])->one();
} | php | public function findTokenByParams($userId, $code, $type)
{
return $this->findToken([
'user_id' => $userId,
'code' => $code,
'type' => $type,
])->one();
} | [
"public",
"function",
"findTokenByParams",
"(",
"$",
"userId",
",",
"$",
"code",
",",
"$",
"type",
")",
"{",
"return",
"$",
"this",
"->",
"findToken",
"(",
"[",
"'user_id'",
"=>",
"$",
"userId",
",",
"'code'",
"=>",
"$",
"code",
",",
"'type'",
"=>",
... | Finds a token by params.
@param integer $userId
@param string $code
@param integer $type
@return Token | [
"Finds",
"a",
"token",
"by",
"params",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Finder.php#L200-L207 |
dektrium/yii2-user | controllers/RegistrationController.php | RegistrationController.actionResend | public function actionResend()
{
if ($this->module->enableConfirmation == false) {
throw new NotFoundHttpException();
}
/** @var ResendForm $model */
$model = \Yii::createObject(ResendForm::className());
$event = $this->getFormEvent($model);
$this->trigg... | php | public function actionResend()
{
if ($this->module->enableConfirmation == false) {
throw new NotFoundHttpException();
}
/** @var ResendForm $model */
$model = \Yii::createObject(ResendForm::className());
$event = $this->getFormEvent($model);
$this->trigg... | [
"public",
"function",
"actionResend",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"module",
"->",
"enableConfirmation",
"==",
"false",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",
"}",
"/** @var ResendForm $model */",
"$",
"model",
"=",
... | Displays page where user can request new confirmation token. If resending was successful, displays message.
@return string
@throws \yii\web\HttpException | [
"Displays",
"page",
"where",
"user",
"can",
"request",
"new",
"confirmation",
"token",
".",
"If",
"resending",
"was",
"successful",
"displays",
"message",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/controllers/RegistrationController.php#L230-L256 |
dektrium/yii2-user | models/Profile.php | Profile.toLocalTime | public function toLocalTime(\DateTime $dateTime = null)
{
if ($dateTime === null) {
$dateTime = new \DateTime();
}
return $dateTime->setTimezone($this->getTimeZone());
} | php | public function toLocalTime(\DateTime $dateTime = null)
{
if ($dateTime === null) {
$dateTime = new \DateTime();
}
return $dateTime->setTimezone($this->getTimeZone());
} | [
"public",
"function",
"toLocalTime",
"(",
"\\",
"DateTime",
"$",
"dateTime",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"dateTime",
"===",
"null",
")",
"{",
"$",
"dateTime",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"}",
"return",
"$",
"dateTime",
"->... | Converts DateTime to user's local time
@param \DateTime the datetime to convert
@return \DateTime | [
"Converts",
"DateTime",
"to",
"user",
"s",
"local",
"time"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/Profile.php#L140-L147 |
dektrium/yii2-user | Bootstrap.php | Bootstrap.ensureCorrectDebugSetting | public function ensureCorrectDebugSetting()
{
if (!defined('YII_DEBUG')) {
return false;
}
if (!defined('YII_ENV')) {
return false;
}
if (defined('YII_ENV') && YII_ENV !== 'dev') {
return false;
}
if (defined('YII_DEBUG') &&... | php | public function ensureCorrectDebugSetting()
{
if (!defined('YII_DEBUG')) {
return false;
}
if (!defined('YII_ENV')) {
return false;
}
if (defined('YII_ENV') && YII_ENV !== 'dev') {
return false;
}
if (defined('YII_DEBUG') &&... | [
"public",
"function",
"ensureCorrectDebugSetting",
"(",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"'YII_DEBUG'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"defined",
"(",
"'YII_ENV'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | Ensure the module is not in DEBUG mode on production environments | [
"Ensure",
"the",
"module",
"is",
"not",
"in",
"DEBUG",
"mode",
"on",
"production",
"environments"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/Bootstrap.php#L113-L129 |
dektrium/yii2-user | filters/BackendFilter.php | BackendFilter.beforeAction | public function beforeAction($action)
{
if (in_array($action->controller->id, $this->controllers)) {
throw new NotFoundHttpException('Not found');
}
return true;
} | php | public function beforeAction($action)
{
if (in_array($action->controller->id, $this->controllers)) {
throw new NotFoundHttpException('Not found');
}
return true;
} | [
"public",
"function",
"beforeAction",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"action",
"->",
"controller",
"->",
"id",
",",
"$",
"this",
"->",
"controllers",
")",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"'Not found'"... | @param \yii\base\Action $action
@return bool
@throws \yii\web\NotFoundHttpException | [
"@param",
"\\",
"yii",
"\\",
"base",
"\\",
"Action",
"$action"
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/filters/BackendFilter.php#L36-L43 |
dektrium/yii2-user | models/SettingsForm.php | SettingsForm.save | public function save()
{
if ($this->validate()) {
$this->user->scenario = 'settings';
$this->user->username = $this->username;
$this->user->password = $this->new_password;
if ($this->email == $this->user->email && $this->user->unconfirmed_email != null) {
... | php | public function save()
{
if ($this->validate()) {
$this->user->scenario = 'settings';
$this->user->username = $this->username;
$this->user->password = $this->new_password;
if ($this->email == $this->user->email && $this->user->unconfirmed_email != null) {
... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"scenario",
"=",
"'settings'",
";",
"$",
"this",
"->",
"user",
"->",
"username",
"=",
"$",
"this",
"->",
"... | Saves new account settings.
@return bool | [
"Saves",
"new",
"account",
"settings",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/SettingsForm.php#L117-L145 |
dektrium/yii2-user | models/SettingsForm.php | SettingsForm.defaultEmailChange | protected function defaultEmailChange()
{
$this->user->unconfirmed_email = $this->email;
/** @var Token $token */
$token = Yii::createObject([
'class' => Token::className(),
'user_id' => $this->user->id,
'type' => Token::TYPE_CONFIRM_NEW_EMAIL,
... | php | protected function defaultEmailChange()
{
$this->user->unconfirmed_email = $this->email;
/** @var Token $token */
$token = Yii::createObject([
'class' => Token::className(),
'user_id' => $this->user->id,
'type' => Token::TYPE_CONFIRM_NEW_EMAIL,
... | [
"protected",
"function",
"defaultEmailChange",
"(",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"unconfirmed_email",
"=",
"$",
"this",
"->",
"email",
";",
"/** @var Token $token */",
"$",
"token",
"=",
"Yii",
"::",
"createObject",
"(",
"[",
"'class'",
"=>",
"... | Sends a confirmation message to user's email address with link to confirm changing of email. | [
"Sends",
"a",
"confirmation",
"message",
"to",
"user",
"s",
"email",
"address",
"with",
"link",
"to",
"confirm",
"changing",
"of",
"email",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/SettingsForm.php#L159-L174 |
dektrium/yii2-user | models/Account.php | Account.getConnectUrl | public function getConnectUrl()
{
$code = \Yii::$app->security->generateRandomString();
$this->updateAttributes(['code' => md5($code)]);
return Url::to(['/user/registration/connect', 'code' => $code]);
} | php | public function getConnectUrl()
{
$code = \Yii::$app->security->generateRandomString();
$this->updateAttributes(['code' => md5($code)]);
return Url::to(['/user/registration/connect', 'code' => $code]);
} | [
"public",
"function",
"getConnectUrl",
"(",
")",
"{",
"$",
"code",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"security",
"->",
"generateRandomString",
"(",
")",
";",
"$",
"this",
"->",
"updateAttributes",
"(",
"[",
"'code'",
"=>",
"md5",
"(",
"$",
"cod... | Returns connect url.
@return string | [
"Returns",
"connect",
"url",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/Account.php#L87-L93 |
dektrium/yii2-user | models/Account.php | Account.fetchAccount | protected static function fetchAccount(BaseClientInterface $client)
{
$account = static::getFinder()->findAccount()->byClient($client)->one();
if (null === $account) {
$account = \Yii::createObject([
'class' => static::className(),
'provider' => $c... | php | protected static function fetchAccount(BaseClientInterface $client)
{
$account = static::getFinder()->findAccount()->byClient($client)->one();
if (null === $account) {
$account = \Yii::createObject([
'class' => static::className(),
'provider' => $c... | [
"protected",
"static",
"function",
"fetchAccount",
"(",
"BaseClientInterface",
"$",
"client",
")",
"{",
"$",
"account",
"=",
"static",
"::",
"getFinder",
"(",
")",
"->",
"findAccount",
"(",
")",
"->",
"byClient",
"(",
"$",
"client",
")",
"->",
"one",
"(",
... | Tries to find account, otherwise creates new account.
@param BaseClientInterface $client
@return Account
@throws \yii\base\InvalidConfigException | [
"Tries",
"to",
"find",
"account",
"otherwise",
"creates",
"new",
"account",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/Account.php#L173-L188 |
dektrium/yii2-user | models/Account.php | Account.fetchUser | protected static function fetchUser(Account $account)
{
$user = static::getFinder()->findUserByEmail($account->email);
if (null !== $user) {
return $user;
}
$user = \Yii::createObject([
'class' => User::className(),
'scenario' => 'connect',
... | php | protected static function fetchUser(Account $account)
{
$user = static::getFinder()->findUserByEmail($account->email);
if (null !== $user) {
return $user;
}
$user = \Yii::createObject([
'class' => User::className(),
'scenario' => 'connect',
... | [
"protected",
"static",
"function",
"fetchUser",
"(",
"Account",
"$",
"account",
")",
"{",
"$",
"user",
"=",
"static",
"::",
"getFinder",
"(",
")",
"->",
"findUserByEmail",
"(",
"$",
"account",
"->",
"email",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"us... | Tries to find user or create a new one.
@param Account $account
@return User|bool False when can't create user. | [
"Tries",
"to",
"find",
"user",
"or",
"create",
"a",
"new",
"one",
"."
] | train | https://github.com/dektrium/yii2-user/blob/b1681d788963726ab7e5f760af5b849047b0b257/models/Account.php#L197-L221 |
pascalbaljetmedia/laravel-ffmpeg | src/FFMpegServiceProvider.php | FFMpegServiceProvider.register | public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../config/laravel-ffmpeg.php', 'laravel-ffmpeg');
$this->app->singleton('laravel-ffmpeg', function ($app) {
return $app->make(FFMpeg::class);
});
} | php | public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../config/laravel-ffmpeg.php', 'laravel-ffmpeg');
$this->app->singleton('laravel-ffmpeg', function ($app) {
return $app->make(FFMpeg::class);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/laravel-ffmpeg.php'",
",",
"'laravel-ffmpeg'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'laravel-ffmpeg'",
",",
"function... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/pascalbaljetmedia/laravel-ffmpeg/blob/2a85065cdcaa243eceecd7d70064d0ba554c69a5/src/FFMpegServiceProvider.php#L23-L30 |
jpush/jpush-api-php-client | src/JPush/PushPayload.php | PushPayload.iosNotification | public function iosNotification($alert = '', array $notification = array()) {
$ios = array();
$ios['alert'] = (is_string($alert) || is_array($alert)) ? $alert : '';
if (!empty($notification)) {
if (isset($notification['sound'])) {
if (is_string($notification['sound'])... | php | public function iosNotification($alert = '', array $notification = array()) {
$ios = array();
$ios['alert'] = (is_string($alert) || is_array($alert)) ? $alert : '';
if (!empty($notification)) {
if (isset($notification['sound'])) {
if (is_string($notification['sound'])... | [
"public",
"function",
"iosNotification",
"(",
"$",
"alert",
"=",
"''",
",",
"array",
"$",
"notification",
"=",
"array",
"(",
")",
")",
"{",
"$",
"ios",
"=",
"array",
"(",
")",
";",
"$",
"ios",
"[",
"'alert'",
"]",
"=",
"(",
"is_string",
"(",
"$",
... | # new methods | [
"#",
"new",
"methods"
] | train | https://github.com/jpush/jpush-api-php-client/blob/64c4037c3ac9b9c5a97ce3f3d238cfe67e954128/src/JPush/PushPayload.php#L336-L378 |
jpush/jpush-api-php-client | src/JPush/PushPayload.php | PushPayload.addIosNotification | public function addIosNotification($alert=null, $sound=null, $badge=null, $content_available=null, $category=null, $extras=null) {
$ios = array();
if (!is_null($alert)) {
if (!is_string($alert) && !is_array($alert)) {
throw new InvalidArgumentException("Invalid ios alert val... | php | public function addIosNotification($alert=null, $sound=null, $badge=null, $content_available=null, $category=null, $extras=null) {
$ios = array();
if (!is_null($alert)) {
if (!is_string($alert) && !is_array($alert)) {
throw new InvalidArgumentException("Invalid ios alert val... | [
"public",
"function",
"addIosNotification",
"(",
"$",
"alert",
"=",
"null",
",",
"$",
"sound",
"=",
"null",
",",
"$",
"badge",
"=",
"null",
",",
"$",
"content_available",
"=",
"null",
",",
"$",
"category",
"=",
"null",
",",
"$",
"extras",
"=",
"null",
... | ############################################################################### | [
"###############################################################################"
] | train | https://github.com/jpush/jpush-api-php-client/blob/64c4037c3ac9b9c5a97ce3f3d238cfe67e954128/src/JPush/PushPayload.php#L493-L560 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.make | public function make($pathToFile, $type = 'zip')
{
$new = $this->createArchiveFile($pathToFile);
$objectOrName = $type;
if (is_string($type)) {
$objectOrName = 'Chumper\Zipper\Repositories\\' . ucwords($type) . 'Repository';
}
if (!is_subclass_of($objectOrName, ... | php | public function make($pathToFile, $type = 'zip')
{
$new = $this->createArchiveFile($pathToFile);
$objectOrName = $type;
if (is_string($type)) {
$objectOrName = 'Chumper\Zipper\Repositories\\' . ucwords($type) . 'Repository';
}
if (!is_subclass_of($objectOrName, ... | [
"public",
"function",
"make",
"(",
"$",
"pathToFile",
",",
"$",
"type",
"=",
"'zip'",
")",
"{",
"$",
"new",
"=",
"$",
"this",
"->",
"createArchiveFile",
"(",
"$",
"pathToFile",
")",
";",
"$",
"objectOrName",
"=",
"$",
"type",
";",
"if",
"(",
"is_stri... | Create a new zip Archive if the file does not exists
opens a zip archive if the file exists
@param $pathToFile string The file to open
@param RepositoryInterface|string $type The type of the archive, defaults to zip, possible are zip, phar
@throws \RuntimeException
@throws \Exception
@throws \InvalidArgumentException... | [
"Create",
"a",
"new",
"zip",
"Archive",
"if",
"the",
"file",
"does",
"not",
"exists",
"opens",
"a",
"zip",
"archive",
"if",
"the",
"file",
"exists"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L84-L110 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.extractTo | public function extractTo($path, array $files = [], $methodFlags = self::BLACKLIST)
{
if (!$this->file->exists($path) && !$this->file->makeDirectory($path, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
}
if ($methodFlags & self::EXACT_MATCH) {
... | php | public function extractTo($path, array $files = [], $methodFlags = self::BLACKLIST)
{
if (!$this->file->exists($path) && !$this->file->makeDirectory($path, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
}
if ($methodFlags & self::EXACT_MATCH) {
... | [
"public",
"function",
"extractTo",
"(",
"$",
"path",
",",
"array",
"$",
"files",
"=",
"[",
"]",
",",
"$",
"methodFlags",
"=",
"self",
"::",
"BLACKLIST",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"->",
"exists",
"(",
"$",
"path",
")",
"... | Extracts the opened zip archive to the specified location <br/>
you can provide an array of files and folders and define if they should be a white list
or a black list to extract. By default this method compares file names using "string starts with" logic
@param $path string The path to extract to
@param array $files ... | [
"Extracts",
"the",
"opened",
"zip",
"archive",
"to",
"the",
"specified",
"location",
"<br",
"/",
">",
"you",
"can",
"provide",
"an",
"array",
"of",
"files",
"and",
"folders",
"and",
"define",
"if",
"they",
"should",
"be",
"a",
"white",
"list",
"or",
"a",... | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L171-L195 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.extractMatchingRegex | public function extractMatchingRegex($extractToPath, $regex)
{
if (empty($regex)) {
throw new \InvalidArgumentException('Missing pass valid regex parameter');
}
$this->extractFilesInternal($extractToPath, function ($filename) use ($regex) {
$match = preg_match($regex... | php | public function extractMatchingRegex($extractToPath, $regex)
{
if (empty($regex)) {
throw new \InvalidArgumentException('Missing pass valid regex parameter');
}
$this->extractFilesInternal($extractToPath, function ($filename) use ($regex) {
$match = preg_match($regex... | [
"public",
"function",
"extractMatchingRegex",
"(",
"$",
"extractToPath",
",",
"$",
"regex",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"regex",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Missing pass valid regex parameter'",
")",
";",
... | Extracts matching files/folders from the opened zip archive to the specified location.
@param string $extractToPath The path to extract to
@param string $regex regular expression used to match files. See @link http://php.net/manual/en/reference.pcre.pattern.syntax.php
@throws \InvalidArgumentException
@throws... | [
"Extracts",
"matching",
"files",
"/",
"folders",
"from",
"the",
"opened",
"zip",
"archive",
"to",
"the",
"specified",
"location",
"."
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L206-L225 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.getFileContent | public function getFileContent($filePath)
{
if ($this->repository->fileExists($filePath) === false) {
throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
}
return $this->repository->getFileContent($filePath);
} | php | public function getFileContent($filePath)
{
if ($this->repository->fileExists($filePath) === false) {
throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
}
return $this->repository->getFileContent($filePath);
} | [
"public",
"function",
"getFileContent",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"repository",
"->",
"fileExists",
"(",
"$",
"filePath",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'The file \"%s\"... | Gets the content of a single file if available
@param $filePath string The full path (including all folders) of the file in the zip
@throws \Exception
@return mixed returns the content or throws an exception | [
"Gets",
"the",
"content",
"of",
"a",
"single",
"file",
"if",
"available"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L236-L242 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.add | public function add($pathToAdd, $fileName = null)
{
if (is_array($pathToAdd)) {
foreach ($pathToAdd as $key=>$dir) {
if (!is_int($key)) {
$this->add($dir, $key); }
else {
$this->add($dir);
}
}
... | php | public function add($pathToAdd, $fileName = null)
{
if (is_array($pathToAdd)) {
foreach ($pathToAdd as $key=>$dir) {
if (!is_int($key)) {
$this->add($dir, $key); }
else {
$this->add($dir);
}
}
... | [
"public",
"function",
"add",
"(",
"$",
"pathToAdd",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pathToAdd",
")",
")",
"{",
"foreach",
"(",
"$",
"pathToAdd",
"as",
"$",
"key",
"=>",
"$",
"dir",
")",
"{",
"if",
"(... | Add one or multiple files to the zip.
@param $pathToAdd array|string An array or string of files and folders to add
@param null|mixed $fileName
@return $this Zipper instance | [
"Add",
"one",
"or",
"multiple",
"files",
"to",
"the",
"zip",
"."
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L252-L273 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.remove | public function remove($fileToRemove)
{
if (is_array($fileToRemove)) {
$self = $this;
$this->repository->each(function ($file) use ($fileToRemove, $self) {
if (starts_with($file, $fileToRemove)) {
$self->getRepository()->removeFile($file);
... | php | public function remove($fileToRemove)
{
if (is_array($fileToRemove)) {
$self = $this;
$this->repository->each(function ($file) use ($fileToRemove, $self) {
if (starts_with($file, $fileToRemove)) {
$self->getRepository()->removeFile($file);
... | [
"public",
"function",
"remove",
"(",
"$",
"fileToRemove",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fileToRemove",
")",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"repository",
"->",
"each",
"(",
"function",
"(",
"$",
"file",
... | Remove a file or array of files and folders from the zip archive
@param $fileToRemove array|string The path/array to the files in the zip
@return $this Zipper instance | [
"Remove",
"a",
"file",
"or",
"array",
"of",
"files",
"and",
"folders",
"from",
"the",
"zip",
"archive"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L321-L335 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.delete | public function delete()
{
if (null !== $this->repository) {
$this->repository->close();
}
$this->file->delete($this->filePath);
$this->filePath = '';
} | php | public function delete()
{
if (null !== $this->repository) {
$this->repository->close();
}
$this->file->delete($this->filePath);
$this->filePath = '';
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"repository",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"close",
"(",
")",
";",
"}",
"$",
"this",
"->",
"file",
"->",
"delete",
"(",
"$",
"this",
"... | Deletes the archive file | [
"Deletes",
"the",
"archive",
"file"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L400-L408 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.listFiles | public function listFiles($regexFilter = null)
{
$filesList = [];
if ($regexFilter) {
$filter = function ($file) use (&$filesList, $regexFilter) {
// push/pop an error handler here to to make sure no error/exception thrown if $expected is not a regex
set_e... | php | public function listFiles($regexFilter = null)
{
$filesList = [];
if ($regexFilter) {
$filter = function ($file) use (&$filesList, $regexFilter) {
// push/pop an error handler here to to make sure no error/exception thrown if $expected is not a regex
set_e... | [
"public",
"function",
"listFiles",
"(",
"$",
"regexFilter",
"=",
"null",
")",
"{",
"$",
"filesList",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"regexFilter",
")",
"{",
"$",
"filter",
"=",
"function",
"(",
"$",
"file",
")",
"use",
"(",
"&",
"$",
"filesLis... | List all files that are within the archive
@param string|null $regexFilter regular expression to filter returned files/folders. See @link http://php.net/manual/en/reference.pcre.pattern.syntax.php
@throws \RuntimeException
@return array | [
"List",
"all",
"files",
"that",
"are",
"within",
"the",
"archive"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L477-L502 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.createArchiveFile | private function createArchiveFile($pathToZip)
{
if (!$this->file->exists($pathToZip)) {
$dirname = dirname($pathToZip);
if (!$this->file->exists($dirname) && !$this->file->makeDirectory($dirname, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
... | php | private function createArchiveFile($pathToZip)
{
if (!$this->file->exists($pathToZip)) {
$dirname = dirname($pathToZip);
if (!$this->file->exists($dirname) && !$this->file->makeDirectory($dirname, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
... | [
"private",
"function",
"createArchiveFile",
"(",
"$",
"pathToZip",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"->",
"exists",
"(",
"$",
"pathToZip",
")",
")",
"{",
"$",
"dirname",
"=",
"dirname",
"(",
"$",
"pathToZip",
")",
";",
"if",
"(",
... | @param $pathToZip
@throws \Exception
@return bool | [
"@param",
"$pathToZip"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L527-L541 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.addFile | private function addFile($pathToAdd, $fileName = null)
{
if (!$fileName) {
$info = pathinfo($pathToAdd);
$fileName = isset($info['extension']) ?
$info['filename'].'.'.$info['extension'] :
$info['filename'];
}
$this->repository->addFile... | php | private function addFile($pathToAdd, $fileName = null)
{
if (!$fileName) {
$info = pathinfo($pathToAdd);
$fileName = isset($info['extension']) ?
$info['filename'].'.'.$info['extension'] :
$info['filename'];
}
$this->repository->addFile... | [
"private",
"function",
"addFile",
"(",
"$",
"pathToAdd",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"fileName",
")",
"{",
"$",
"info",
"=",
"pathinfo",
"(",
"$",
"pathToAdd",
")",
";",
"$",
"fileName",
"=",
"isset",
"(",
"$",... | Add the file to the zip
@param string $pathToAdd
@param string $fileName | [
"Add",
"the",
"file",
"to",
"the",
"zip"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L568-L578 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.addFromString | private function addFromString($filename, $content)
{
$this->repository->addFromString($this->getInternalPath().$filename, $content);
} | php | private function addFromString($filename, $content)
{
$this->repository->addFromString($this->getInternalPath().$filename, $content);
} | [
"private",
"function",
"addFromString",
"(",
"$",
"filename",
",",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"addFromString",
"(",
"$",
"this",
"->",
"getInternalPath",
"(",
")",
".",
"$",
"filename",
",",
"$",
"content",
")",
";",... | Add the file to the zip from content
@param $filename
@param $content | [
"Add",
"the",
"file",
"to",
"the",
"zip",
"from",
"content"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L586-L589 |
Chumper/Zipper | src/Chumper/Zipper/Zipper.php | Zipper.extractOneFileInternal | private function extractOneFileInternal($fileName, $path)
{
$tmpPath = str_replace($this->getInternalPath(), '', $fileName);
// We need to create the directory first in case it doesn't exist
$dir = pathinfo($path.DIRECTORY_SEPARATOR.$tmpPath, PATHINFO_DIRNAME);
if (!$this->file->exi... | php | private function extractOneFileInternal($fileName, $path)
{
$tmpPath = str_replace($this->getInternalPath(), '', $fileName);
// We need to create the directory first in case it doesn't exist
$dir = pathinfo($path.DIRECTORY_SEPARATOR.$tmpPath, PATHINFO_DIRNAME);
if (!$this->file->exi... | [
"private",
"function",
"extractOneFileInternal",
"(",
"$",
"fileName",
",",
"$",
"path",
")",
"{",
"$",
"tmpPath",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getInternalPath",
"(",
")",
",",
"''",
",",
"$",
"fileName",
")",
";",
"// We need to create the d... | @param $fileName
@param $path
@throws \RuntimeException | [
"@param",
"$fileName",
"@param",
"$path"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Zipper.php#L613-L626 |
Chumper/Zipper | src/Chumper/Zipper/Repositories/ZipRepository.php | ZipRepository.each | public function each($callback)
{
for ($i = 0; $i < $this->archive->numFiles; ++$i) {
//skip if folder
$stats = $this->archive->statIndex($i);
if ($stats['size'] === 0 && $stats['crc'] === 0) {
continue;
}
call_user_func_array($call... | php | public function each($callback)
{
for ($i = 0; $i < $this->archive->numFiles; ++$i) {
//skip if folder
$stats = $this->archive->statIndex($i);
if ($stats['size'] === 0 && $stats['crc'] === 0) {
continue;
}
call_user_func_array($call... | [
"public",
"function",
"each",
"(",
"$",
"callback",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"archive",
"->",
"numFiles",
";",
"++",
"$",
"i",
")",
"{",
"//skip if folder",
"$",
"stats",
"=",
"$",
"this",
... | Will loop over every item in the archive and will execute the callback on them
Will provide the filename for every item
@param $callback | [
"Will",
"loop",
"over",
"every",
"item",
"in",
"the",
"archive",
"and",
"will",
"execute",
"the",
"callback",
"on",
"them",
"Will",
"provide",
"the",
"filename",
"for",
"every",
"item"
] | train | https://github.com/Chumper/Zipper/blob/2f5dd0a77d419f84fd377cb36af72edb47467868/src/Chumper/Zipper/Repositories/ZipRepository.php#L109-L122 |
doctrine/cache | lib/Doctrine/Common/Cache/ApcCache.php | ApcCache.doSaveMultiple | protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
{
$result = apc_store($keysAndValues, null, $lifetime);
return empty($result);
} | php | protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
{
$result = apc_store($keysAndValues, null, $lifetime);
return empty($result);
} | [
"protected",
"function",
"doSaveMultiple",
"(",
"array",
"$",
"keysAndValues",
",",
"$",
"lifetime",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"apc_store",
"(",
"$",
"keysAndValues",
",",
"null",
",",
"$",
"lifetime",
")",
";",
"return",
"empty",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ApcCache.php#L75-L80 |
doctrine/cache | lib/Doctrine/Common/Cache/ApcCache.php | ApcCache.doGetStats | protected function doGetStats()
{
$info = apc_cache_info('', true);
$sma = apc_sma_info();
// @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42
if (PHP_VERSION_ID >= 50500) {
$info['num_hits'] = $info['num_hits'] ?? $info['nhits'];
$info['... | php | protected function doGetStats()
{
$info = apc_cache_info('', true);
$sma = apc_sma_info();
// @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42
if (PHP_VERSION_ID >= 50500) {
$info['num_hits'] = $info['num_hits'] ?? $info['nhits'];
$info['... | [
"protected",
"function",
"doGetStats",
"(",
")",
"{",
"$",
"info",
"=",
"apc_cache_info",
"(",
"''",
",",
"true",
")",
";",
"$",
"sma",
"=",
"apc_sma_info",
"(",
")",
";",
"// @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42",
"if",
"(",
"PHP_VER... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ApcCache.php#L85-L104 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doFetch | protected function doFetch($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->get($id);
} catch (Exception $e) {
return false;
}
if ($document instanceof Document && $document->value !== false) {
return unserialize($d... | php | protected function doFetch($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->get($id);
} catch (Exception $e) {
return false;
}
if ($document instanceof Document && $document->value !== false) {
return unserialize($d... | [
"protected",
"function",
"doFetch",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"normalizeKey",
"(",
"$",
"id",
")",
";",
"try",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"bucket",
"->",
"get",
"(",
"$",
"id",
")",
";",
"}"... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L48-L63 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doContains | protected function doContains($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->get($id);
} catch (Exception $e) {
return false;
}
if ($document instanceof Document) {
return ! $document->error;
}
re... | php | protected function doContains($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->get($id);
} catch (Exception $e) {
return false;
}
if ($document instanceof Document) {
return ! $document->error;
}
re... | [
"protected",
"function",
"doContains",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"normalizeKey",
"(",
"$",
"id",
")",
";",
"try",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"bucket",
"->",
"get",
"(",
"$",
"id",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L68-L83 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doSave | protected function doSave($id, $data, $lifeTime = 0)
{
$id = $this->normalizeKey($id);
$lifeTime = $this->normalizeExpiry($lifeTime);
try {
$encoded = serialize($data);
$document = $this->bucket->upsert($id, $encoded, [
'expiry' => (int) $lifeTime,
... | php | protected function doSave($id, $data, $lifeTime = 0)
{
$id = $this->normalizeKey($id);
$lifeTime = $this->normalizeExpiry($lifeTime);
try {
$encoded = serialize($data);
$document = $this->bucket->upsert($id, $encoded, [
'expiry' => (int) $lifeTime,
... | [
"protected",
"function",
"doSave",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"lifeTime",
"=",
"0",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"normalizeKey",
"(",
"$",
"id",
")",
";",
"$",
"lifeTime",
"=",
"$",
"this",
"->",
"normalizeExpiry",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L88-L109 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doDelete | protected function doDelete($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->remove($id);
} catch (Exception $e) {
return $e->getCode() === self::KEY_NOT_FOUND;
}
if ($document instanceof Document) {
return ! $docum... | php | protected function doDelete($id)
{
$id = $this->normalizeKey($id);
try {
$document = $this->bucket->remove($id);
} catch (Exception $e) {
return $e->getCode() === self::KEY_NOT_FOUND;
}
if ($document instanceof Document) {
return ! $docum... | [
"protected",
"function",
"doDelete",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"normalizeKey",
"(",
"$",
"id",
")",
";",
"try",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"bucket",
"->",
"remove",
"(",
"$",
"id",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L114-L129 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doFlush | protected function doFlush()
{
$manager = $this->bucket->manager();
// Flush does not return with success or failure, and must be enabled per bucket on the server.
// Store a marker item so that we will know if it was successful.
$this->doSave(__METHOD__, true, 60);
$manage... | php | protected function doFlush()
{
$manager = $this->bucket->manager();
// Flush does not return with success or failure, and must be enabled per bucket on the server.
// Store a marker item so that we will know if it was successful.
$this->doSave(__METHOD__, true, 60);
$manage... | [
"protected",
"function",
"doFlush",
"(",
")",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"bucket",
"->",
"manager",
"(",
")",
";",
"// Flush does not return with success or failure, and must be enabled per bucket on the server.",
"// Store a marker item so that we will know i... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L134-L151 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.doGetStats | protected function doGetStats()
{
$manager = $this->bucket->manager();
$stats = $manager->info();
$nodes = $stats['nodes'];
$node = $nodes[0];
$interestingStats = $node['interestingStats'];
return [
Cache::STATS_... | php | protected function doGetStats()
{
$manager = $this->bucket->manager();
$stats = $manager->info();
$nodes = $stats['nodes'];
$node = $nodes[0];
$interestingStats = $node['interestingStats'];
return [
Cache::STATS_... | [
"protected",
"function",
"doGetStats",
"(",
")",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"bucket",
"->",
"manager",
"(",
")",
";",
"$",
"stats",
"=",
"$",
"manager",
"->",
"info",
"(",
")",
";",
"$",
"nodes",
"=",
"$",
"stats",
"[",
"'nodes'",... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L156-L171 |
doctrine/cache | lib/Doctrine/Common/Cache/CouchbaseBucketCache.php | CouchbaseBucketCache.normalizeExpiry | private function normalizeExpiry(int $expiry) : int
{
if ($expiry > self::THIRTY_DAYS_IN_SECONDS) {
return time() + $expiry;
}
return $expiry;
} | php | private function normalizeExpiry(int $expiry) : int
{
if ($expiry > self::THIRTY_DAYS_IN_SECONDS) {
return time() + $expiry;
}
return $expiry;
} | [
"private",
"function",
"normalizeExpiry",
"(",
"int",
"$",
"expiry",
")",
":",
"int",
"{",
"if",
"(",
"$",
"expiry",
">",
"self",
"::",
"THIRTY_DAYS_IN_SECONDS",
")",
"{",
"return",
"time",
"(",
")",
"+",
"$",
"expiry",
";",
"}",
"return",
"$",
"expiry... | Expiry treated as a unix timestamp instead of an offset if expiry is greater than 30 days.
@src https://developer.couchbase.com/documentation/server/4.1/developer-guide/expiry.html | [
"Expiry",
"treated",
"as",
"a",
"unix",
"timestamp",
"instead",
"of",
"an",
"offset",
"if",
"expiry",
"is",
"greater",
"than",
"30",
"days",
"."
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/CouchbaseBucketCache.php#L189-L196 |
doctrine/cache | lib/Doctrine/Common/Cache/XcacheCache.php | XcacheCache.doSave | protected function doSave($id, $data, $lifeTime = 0)
{
return xcache_set($id, serialize($data), (int) $lifeTime);
} | php | protected function doSave($id, $data, $lifeTime = 0)
{
return xcache_set($id, serialize($data), (int) $lifeTime);
} | [
"protected",
"function",
"doSave",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"lifeTime",
"=",
"0",
")",
"{",
"return",
"xcache_set",
"(",
"$",
"id",
",",
"serialize",
"(",
"$",
"data",
")",
",",
"(",
"int",
")",
"$",
"lifeTime",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/XcacheCache.php#L45-L48 |
doctrine/cache | lib/Doctrine/Common/Cache/XcacheCache.php | XcacheCache.doGetStats | protected function doGetStats()
{
$this->checkAuthorization();
$info = xcache_info(XC_TYPE_VAR, 0);
return [
Cache::STATS_HITS => $info['hits'],
Cache::STATS_MISSES => $info['misses'],
Cache::STATS_UPTIME => null,
Cache::STATS_MEMORY_USAGE ... | php | protected function doGetStats()
{
$this->checkAuthorization();
$info = xcache_info(XC_TYPE_VAR, 0);
return [
Cache::STATS_HITS => $info['hits'],
Cache::STATS_MISSES => $info['misses'],
Cache::STATS_UPTIME => null,
Cache::STATS_MEMORY_USAGE ... | [
"protected",
"function",
"doGetStats",
"(",
")",
"{",
"$",
"this",
"->",
"checkAuthorization",
"(",
")",
";",
"$",
"info",
"=",
"xcache_info",
"(",
"XC_TYPE_VAR",
",",
"0",
")",
";",
"return",
"[",
"Cache",
"::",
"STATS_HITS",
"=>",
"$",
"info",
"[",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/XcacheCache.php#L90-L103 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doFetch | protected function doFetch($id)
{
foreach ($this->cacheProviders as $key => $cacheProvider) {
if ($cacheProvider->doContains($id)) {
$value = $cacheProvider->doFetch($id);
// We populate all the previous cache layers (that are assumed to be faster)
... | php | protected function doFetch($id)
{
foreach ($this->cacheProviders as $key => $cacheProvider) {
if ($cacheProvider->doContains($id)) {
$value = $cacheProvider->doFetch($id);
// We populate all the previous cache layers (that are assumed to be faster)
... | [
"protected",
"function",
"doFetch",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"key",
"=>",
"$",
"cacheProvider",
")",
"{",
"if",
"(",
"$",
"cacheProvider",
"->",
"doContains",
"(",
"$",
"id",
")",
")",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L43-L59 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doFetchMultiple | protected function doFetchMultiple(array $keys)
{
/** @var CacheProvider[] $traversedProviders */
$traversedProviders = [];
$keysCount = count($keys);
$fetchedValues = [];
foreach ($this->cacheProviders as $key => $cacheProvider) {
$fetchedValues = ... | php | protected function doFetchMultiple(array $keys)
{
/** @var CacheProvider[] $traversedProviders */
$traversedProviders = [];
$keysCount = count($keys);
$fetchedValues = [];
foreach ($this->cacheProviders as $key => $cacheProvider) {
$fetchedValues = ... | [
"protected",
"function",
"doFetchMultiple",
"(",
"array",
"$",
"keys",
")",
"{",
"/** @var CacheProvider[] $traversedProviders */",
"$",
"traversedProviders",
"=",
"[",
"]",
";",
"$",
"keysCount",
"=",
"count",
"(",
"$",
"keys",
")",
";",
"$",
"fetchedValues",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L64-L87 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doContains | protected function doContains($id)
{
foreach ($this->cacheProviders as $cacheProvider) {
if ($cacheProvider->doContains($id)) {
return true;
}
}
return false;
} | php | protected function doContains($id)
{
foreach ($this->cacheProviders as $cacheProvider) {
if ($cacheProvider->doContains($id)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"doContains",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"if",
"(",
"$",
"cacheProvider",
"->",
"doContains",
"(",
"$",
"id",
")",
")",
"{",
"return",
"t... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L92-L101 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doSave | protected function doSave($id, $data, $lifeTime = 0)
{
$stored = true;
foreach ($this->cacheProviders as $cacheProvider) {
$stored = $cacheProvider->doSave($id, $data, $lifeTime) && $stored;
}
return $stored;
} | php | protected function doSave($id, $data, $lifeTime = 0)
{
$stored = true;
foreach ($this->cacheProviders as $cacheProvider) {
$stored = $cacheProvider->doSave($id, $data, $lifeTime) && $stored;
}
return $stored;
} | [
"protected",
"function",
"doSave",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"lifeTime",
"=",
"0",
")",
"{",
"$",
"stored",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"$",
"stored",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L106-L115 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doSaveMultiple | protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
{
$stored = true;
foreach ($this->cacheProviders as $cacheProvider) {
$stored = $cacheProvider->doSaveMultiple($keysAndValues, $lifetime) && $stored;
}
return $stored;
} | php | protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
{
$stored = true;
foreach ($this->cacheProviders as $cacheProvider) {
$stored = $cacheProvider->doSaveMultiple($keysAndValues, $lifetime) && $stored;
}
return $stored;
} | [
"protected",
"function",
"doSaveMultiple",
"(",
"array",
"$",
"keysAndValues",
",",
"$",
"lifetime",
"=",
"0",
")",
"{",
"$",
"stored",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"$",
"sto... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L120-L129 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doDelete | protected function doDelete($id)
{
$deleted = true;
foreach ($this->cacheProviders as $cacheProvider) {
$deleted = $cacheProvider->doDelete($id) && $deleted;
}
return $deleted;
} | php | protected function doDelete($id)
{
$deleted = true;
foreach ($this->cacheProviders as $cacheProvider) {
$deleted = $cacheProvider->doDelete($id) && $deleted;
}
return $deleted;
} | [
"protected",
"function",
"doDelete",
"(",
"$",
"id",
")",
"{",
"$",
"deleted",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"$",
"deleted",
"=",
"$",
"cacheProvider",
"->",
"doDelete",
"(",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L134-L143 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doDeleteMultiple | protected function doDeleteMultiple(array $keys)
{
$deleted = true;
foreach ($this->cacheProviders as $cacheProvider) {
$deleted = $cacheProvider->doDeleteMultiple($keys) && $deleted;
}
return $deleted;
} | php | protected function doDeleteMultiple(array $keys)
{
$deleted = true;
foreach ($this->cacheProviders as $cacheProvider) {
$deleted = $cacheProvider->doDeleteMultiple($keys) && $deleted;
}
return $deleted;
} | [
"protected",
"function",
"doDeleteMultiple",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"deleted",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"$",
"deleted",
"=",
"$",
"cacheProvider",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L148-L157 |
doctrine/cache | lib/Doctrine/Common/Cache/ChainCache.php | ChainCache.doFlush | protected function doFlush()
{
$flushed = true;
foreach ($this->cacheProviders as $cacheProvider) {
$flushed = $cacheProvider->doFlush() && $flushed;
}
return $flushed;
} | php | protected function doFlush()
{
$flushed = true;
foreach ($this->cacheProviders as $cacheProvider) {
$flushed = $cacheProvider->doFlush() && $flushed;
}
return $flushed;
} | [
"protected",
"function",
"doFlush",
"(",
")",
"{",
"$",
"flushed",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"cacheProviders",
"as",
"$",
"cacheProvider",
")",
"{",
"$",
"flushed",
"=",
"$",
"cacheProvider",
"->",
"doFlush",
"(",
")",
"&&",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/cache/blob/9c22e29b271426c3462f1e53777d1e9a1f16d84c/lib/Doctrine/Common/Cache/ChainCache.php#L162-L171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.