repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
SwooleDistributed/SwooleDistributed | src/Server/Components/Blade/Blade.php | Blade.render | public function render($view, $data = [], $mergeData = [])
{
return $this->container['view']->make($view, $data, $mergeData)->render();
} | php | public function render($view, $data = [], $mergeData = [])
{
return $this->container['view']->make($view, $data, $mergeData)->render();
} | [
"public",
"function",
"render",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"mergeData",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"[",
"'view'",
"]",
"->",
"make",
"(",
"$",
"view",
",",
"$",
"data",
"... | Render shortcut.
@param string $view
@param array $data
@param array $mergeData
@return string | [
"Render",
"shortcut",
"."
] | bca3c1fde5a3160747b7e2234bb3851a19bc2e94 | https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/Blade/Blade.php#L89-L92 | train |
ramsey/uuid | src/Generator/PeclUuidTimeGenerator.php | PeclUuidTimeGenerator.generate | public function generate($node = null, $clockSeq = null)
{
$uuid = uuid_create(UUID_TYPE_TIME);
return uuid_parse($uuid);
} | php | public function generate($node = null, $clockSeq = null)
{
$uuid = uuid_create(UUID_TYPE_TIME);
return uuid_parse($uuid);
} | [
"public",
"function",
"generate",
"(",
"$",
"node",
"=",
"null",
",",
"$",
"clockSeq",
"=",
"null",
")",
"{",
"$",
"uuid",
"=",
"uuid_create",
"(",
"UUID_TYPE_TIME",
")",
";",
"return",
"uuid_parse",
"(",
"$",
"uuid",
")",
";",
"}"
] | Generate a version 1 UUID using the PECL UUID extension
@param int|string $node Not used in this context
@param int $clockSeq Not used in this context
@return string A binary string | [
"Generate",
"a",
"version",
"1",
"UUID",
"using",
"the",
"PECL",
"UUID",
"extension"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Generator/PeclUuidTimeGenerator.php#L32-L37 | train |
ramsey/uuid | src/Builder/DegradedUuidBuilder.php | DegradedUuidBuilder.build | public function build(CodecInterface $codec, array $fields)
{
return new DegradedUuid($fields, $this->numberConverter, $codec, $this->timeConverter);
} | php | public function build(CodecInterface $codec, array $fields)
{
return new DegradedUuid($fields, $this->numberConverter, $codec, $this->timeConverter);
} | [
"public",
"function",
"build",
"(",
"CodecInterface",
"$",
"codec",
",",
"array",
"$",
"fields",
")",
"{",
"return",
"new",
"DegradedUuid",
"(",
"$",
"fields",
",",
"$",
"this",
"->",
"numberConverter",
",",
"$",
"codec",
",",
"$",
"this",
"->",
"timeCon... | Builds a DegradedUuid
@param CodecInterface $codec The codec to use for building this DegradedUuid
@param array $fields An array of fields from which to construct the DegradedUuid;
see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
@return DegradedUuid | [
"Builds",
"a",
"DegradedUuid"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Builder/DegradedUuidBuilder.php#L59-L62 | train |
ramsey/uuid | src/BinaryUtils.php | BinaryUtils.applyVersion | public static function applyVersion($timeHi, $version)
{
$timeHi = hexdec($timeHi) & 0x0fff;
$timeHi &= ~(0xf000);
$timeHi |= $version << 12;
return $timeHi;
} | php | public static function applyVersion($timeHi, $version)
{
$timeHi = hexdec($timeHi) & 0x0fff;
$timeHi &= ~(0xf000);
$timeHi |= $version << 12;
return $timeHi;
} | [
"public",
"static",
"function",
"applyVersion",
"(",
"$",
"timeHi",
",",
"$",
"version",
")",
"{",
"$",
"timeHi",
"=",
"hexdec",
"(",
"$",
"timeHi",
")",
"&",
"0x0fff",
";",
"$",
"timeHi",
"&=",
"~",
"(",
"0xf000",
")",
";",
"$",
"timeHi",
"|=",
"$... | Applies the RFC 4122 version number to the `time_hi_and_version` field
@param string $timeHi
@param integer $version
@return int The high field of the timestamp multiplexed with the version number
@link http://tools.ietf.org/html/rfc4122#section-4.1.3 | [
"Applies",
"the",
"RFC",
"4122",
"version",
"number",
"to",
"the",
"time_hi_and_version",
"field"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/BinaryUtils.php#L35-L42 | train |
ramsey/uuid | src/Codec/TimestampFirstCombCodec.php | TimestampFirstCombCodec.encode | public function encode(UuidInterface $uuid)
{
$sixPieceComponents = array_values($uuid->getFieldsHex());
$this->swapTimestampAndRandomBits($sixPieceComponents);
return vsprintf(
'%08s-%04s-%04s-%02s%02s-%012s',
$sixPieceComponents
);
} | php | public function encode(UuidInterface $uuid)
{
$sixPieceComponents = array_values($uuid->getFieldsHex());
$this->swapTimestampAndRandomBits($sixPieceComponents);
return vsprintf(
'%08s-%04s-%04s-%02s%02s-%012s',
$sixPieceComponents
);
} | [
"public",
"function",
"encode",
"(",
"UuidInterface",
"$",
"uuid",
")",
"{",
"$",
"sixPieceComponents",
"=",
"array_values",
"(",
"$",
"uuid",
"->",
"getFieldsHex",
"(",
")",
")",
";",
"$",
"this",
"->",
"swapTimestampAndRandomBits",
"(",
"$",
"sixPieceCompone... | Encodes a UuidInterface as a string representation of a timestamp first COMB UUID
@param UuidInterface $uuid
@return string Hexadecimal string representation of a GUID | [
"Encodes",
"a",
"UuidInterface",
"as",
"a",
"string",
"representation",
"of",
"a",
"timestamp",
"first",
"COMB",
"UUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/TimestampFirstCombCodec.php#L31-L41 | train |
ramsey/uuid | src/Codec/TimestampFirstCombCodec.php | TimestampFirstCombCodec.encodeBinary | public function encodeBinary(UuidInterface $uuid)
{
$stringEncoding = $this->encode($uuid);
return hex2bin(str_replace('-', '', $stringEncoding));
} | php | public function encodeBinary(UuidInterface $uuid)
{
$stringEncoding = $this->encode($uuid);
return hex2bin(str_replace('-', '', $stringEncoding));
} | [
"public",
"function",
"encodeBinary",
"(",
"UuidInterface",
"$",
"uuid",
")",
"{",
"$",
"stringEncoding",
"=",
"$",
"this",
"->",
"encode",
"(",
"$",
"uuid",
")",
";",
"return",
"hex2bin",
"(",
"str_replace",
"(",
"'-'",
",",
"''",
",",
"$",
"stringEncod... | Encodes a UuidInterface as a binary representation of timestamp first COMB UUID
@param UuidInterface $uuid
@return string Binary string representation of timestamp first COMB UUID | [
"Encodes",
"a",
"UuidInterface",
"as",
"a",
"binary",
"representation",
"of",
"timestamp",
"first",
"COMB",
"UUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/TimestampFirstCombCodec.php#L50-L55 | train |
ramsey/uuid | src/Codec/TimestampFirstCombCodec.php | TimestampFirstCombCodec.decode | public function decode($encodedUuid)
{
$fivePieceComponents = $this->extractComponents($encodedUuid);
$this->swapTimestampAndRandomBits($fivePieceComponents);
return $this->getBuilder()->build($this, $this->getFields($fivePieceComponents));
} | php | public function decode($encodedUuid)
{
$fivePieceComponents = $this->extractComponents($encodedUuid);
$this->swapTimestampAndRandomBits($fivePieceComponents);
return $this->getBuilder()->build($this, $this->getFields($fivePieceComponents));
} | [
"public",
"function",
"decode",
"(",
"$",
"encodedUuid",
")",
"{",
"$",
"fivePieceComponents",
"=",
"$",
"this",
"->",
"extractComponents",
"(",
"$",
"encodedUuid",
")",
";",
"$",
"this",
"->",
"swapTimestampAndRandomBits",
"(",
"$",
"fivePieceComponents",
")",
... | Decodes a string representation of timestamp first COMB UUID into a UuidInterface object instance
@param string $encodedUuid
@return UuidInterface
@throws \Ramsey\Uuid\Exception\InvalidUuidStringException | [
"Decodes",
"a",
"string",
"representation",
"of",
"timestamp",
"first",
"COMB",
"UUID",
"into",
"a",
"UuidInterface",
"object",
"instance"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/TimestampFirstCombCodec.php#L65-L72 | train |
ramsey/uuid | src/Codec/TimestampFirstCombCodec.php | TimestampFirstCombCodec.swapTimestampAndRandomBits | protected function swapTimestampAndRandomBits(array &$components)
{
$last48Bits = $components[4];
if (count($components) == 6) {
$last48Bits = $components[5];
$components[5] = $components[0] . $components[1];
} else {
$components[4] = $components[0] . $com... | php | protected function swapTimestampAndRandomBits(array &$components)
{
$last48Bits = $components[4];
if (count($components) == 6) {
$last48Bits = $components[5];
$components[5] = $components[0] . $components[1];
} else {
$components[4] = $components[0] . $com... | [
"protected",
"function",
"swapTimestampAndRandomBits",
"(",
"array",
"&",
"$",
"components",
")",
"{",
"$",
"last48Bits",
"=",
"$",
"components",
"[",
"4",
"]",
";",
"if",
"(",
"count",
"(",
"$",
"components",
")",
"==",
"6",
")",
"{",
"$",
"last48Bits",... | Swaps the first 48 bits with the last 48 bits
@param array $components An array of UUID components (the UUID exploded on its dashes)
@return void | [
"Swaps",
"the",
"first",
"48",
"bits",
"with",
"the",
"last",
"48",
"bits"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/TimestampFirstCombCodec.php#L94-L106 | train |
ramsey/uuid | src/Generator/DefaultTimeGenerator.php | DefaultTimeGenerator.generate | public function generate($node = null, $clockSeq = null)
{
$node = $this->getValidNode($node);
if ($clockSeq === null) {
// Not using "stable storage"; see RFC 4122, Section 4.2.1.1
$clockSeq = random_int(0, 0x3fff);
}
// Create a 60-bit time value as a coun... | php | public function generate($node = null, $clockSeq = null)
{
$node = $this->getValidNode($node);
if ($clockSeq === null) {
// Not using "stable storage"; see RFC 4122, Section 4.2.1.1
$clockSeq = random_int(0, 0x3fff);
}
// Create a 60-bit time value as a coun... | [
"public",
"function",
"generate",
"(",
"$",
"node",
"=",
"null",
",",
"$",
"clockSeq",
"=",
"null",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"getValidNode",
"(",
"$",
"node",
")",
";",
"if",
"(",
"$",
"clockSeq",
"===",
"null",
")",
"{",
"/... | Generate a version 1 UUID from a host ID, sequence number, and the current time
If $node is not given, we will attempt to obtain the local hardware
address. If $clockSeq is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen.
@param int|string $node A 48-bit number representi... | [
"Generate",
"a",
"version",
"1",
"UUID",
"from",
"a",
"host",
"ID",
"sequence",
"number",
"and",
"the",
"current",
"time"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Generator/DefaultTimeGenerator.php#L80-L110 | train |
ramsey/uuid | src/UuidFactory.php | UuidFactory.uuidFromNsAndName | protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
{
if (!($ns instanceof UuidInterface)) {
$ns = $this->codec->decode($ns);
}
$hash = call_user_func($hashFunction, ($ns->getBytes() . $name));
return $this->uuidFromHashedName($hash, $version);
... | php | protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
{
if (!($ns instanceof UuidInterface)) {
$ns = $this->codec->decode($ns);
}
$hash = call_user_func($hashFunction, ($ns->getBytes() . $name));
return $this->uuidFromHashedName($hash, $version);
... | [
"protected",
"function",
"uuidFromNsAndName",
"(",
"$",
"ns",
",",
"$",
"name",
",",
"$",
"version",
",",
"$",
"hashFunction",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"ns",
"instanceof",
"UuidInterface",
")",
")",
"{",
"$",
"ns",
"=",
"$",
"this",
"->",
... | Returns a version 3 or 5 namespaced `Uuid`
@param string|UuidInterface $ns The UUID namespace to use
@param string $name The string to hash together with the namespace
@param int $version The version of UUID to create (3 or 5)
@param string $hashFunction The hash function to use when hashing together
the namespace and... | [
"Returns",
"a",
"version",
"3",
"or",
"5",
"namespaced",
"Uuid"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/UuidFactory.php#L302-L311 | train |
ramsey/uuid | src/Codec/StringCodec.php | StringCodec.decode | public function decode($encodedUuid)
{
$components = $this->extractComponents($encodedUuid);
$fields = $this->getFields($components);
return $this->builder->build($this, $fields);
} | php | public function decode($encodedUuid)
{
$components = $this->extractComponents($encodedUuid);
$fields = $this->getFields($components);
return $this->builder->build($this, $fields);
} | [
"public",
"function",
"decode",
"(",
"$",
"encodedUuid",
")",
"{",
"$",
"components",
"=",
"$",
"this",
"->",
"extractComponents",
"(",
"$",
"encodedUuid",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"components",
")",
";",
... | Decodes a string representation of a UUID into a UuidInterface object instance
@param string $encodedUuid
@return UuidInterface
@throws \Ramsey\Uuid\Exception\InvalidUuidStringException | [
"Decodes",
"a",
"string",
"representation",
"of",
"a",
"UUID",
"into",
"a",
"UuidInterface",
"object",
"instance"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/StringCodec.php#L79-L85 | train |
ramsey/uuid | src/Codec/StringCodec.php | StringCodec.decodeBytes | public function decodeBytes($bytes)
{
if (strlen($bytes) !== 16) {
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
}
$hexUuid = unpack('H*', $bytes);
return $this->decode($hexUuid[1]);
} | php | public function decodeBytes($bytes)
{
if (strlen($bytes) !== 16) {
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
}
$hexUuid = unpack('H*', $bytes);
return $this->decode($hexUuid[1]);
} | [
"public",
"function",
"decodeBytes",
"(",
"$",
"bytes",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"bytes",
")",
"!==",
"16",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$bytes string should contain 16 characters.'",
")",
";",
"}",
"$",
"hexUuid... | Decodes a binary representation of a UUID into a UuidInterface object instance
@param string $bytes
@return UuidInterface
@throws \InvalidArgumentException if string has not 16 characters | [
"Decodes",
"a",
"binary",
"representation",
"of",
"a",
"UUID",
"into",
"a",
"UuidInterface",
"object",
"instance"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/StringCodec.php#L94-L103 | train |
ramsey/uuid | src/Codec/StringCodec.php | StringCodec.getFields | protected function getFields(array $components)
{
return [
'time_low' => str_pad($components[0], 8, '0', STR_PAD_LEFT),
'time_mid' => str_pad($components[1], 4, '0', STR_PAD_LEFT),
'time_hi_and_version' => str_pad($components[2], 4, '0', STR_PAD_LEFT),
'clock_... | php | protected function getFields(array $components)
{
return [
'time_low' => str_pad($components[0], 8, '0', STR_PAD_LEFT),
'time_mid' => str_pad($components[1], 4, '0', STR_PAD_LEFT),
'time_hi_and_version' => str_pad($components[2], 4, '0', STR_PAD_LEFT),
'clock_... | [
"protected",
"function",
"getFields",
"(",
"array",
"$",
"components",
")",
"{",
"return",
"[",
"'time_low'",
"=>",
"str_pad",
"(",
"$",
"components",
"[",
"0",
"]",
",",
"8",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
",",
"'time_mid'",
"=>",
"str_pad",
"(",... | Returns the fields that make up this UUID
@see \Ramsey\Uuid\UuidInterface::getFieldsHex()
@param array $components
@return array | [
"Returns",
"the",
"fields",
"that",
"make",
"up",
"this",
"UUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/StringCodec.php#L159-L169 | train |
ramsey/uuid | src/Codec/GuidStringCodec.php | GuidStringCodec.encode | public function encode(UuidInterface $uuid)
{
$components = array_values($uuid->getFieldsHex());
// Swap byte-order on the first three fields
$this->swapFields($components);
return vsprintf(
'%08s-%04s-%04s-%02s%02s-%012s',
$components
);
} | php | public function encode(UuidInterface $uuid)
{
$components = array_values($uuid->getFieldsHex());
// Swap byte-order on the first three fields
$this->swapFields($components);
return vsprintf(
'%08s-%04s-%04s-%02s%02s-%012s',
$components
);
} | [
"public",
"function",
"encode",
"(",
"UuidInterface",
"$",
"uuid",
")",
"{",
"$",
"components",
"=",
"array_values",
"(",
"$",
"uuid",
"->",
"getFieldsHex",
"(",
")",
")",
";",
"// Swap byte-order on the first three fields",
"$",
"this",
"->",
"swapFields",
"(",... | Encodes a UuidInterface as a string representation of a GUID
@param UuidInterface $uuid
@return string Hexadecimal string representation of a GUID | [
"Encodes",
"a",
"UuidInterface",
"as",
"a",
"string",
"representation",
"of",
"a",
"GUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/GuidStringCodec.php#L32-L43 | train |
ramsey/uuid | src/Codec/GuidStringCodec.php | GuidStringCodec.encodeBinary | public function encodeBinary(UuidInterface $uuid)
{
$components = array_values($uuid->getFieldsHex());
return hex2bin(implode('', $components));
} | php | public function encodeBinary(UuidInterface $uuid)
{
$components = array_values($uuid->getFieldsHex());
return hex2bin(implode('', $components));
} | [
"public",
"function",
"encodeBinary",
"(",
"UuidInterface",
"$",
"uuid",
")",
"{",
"$",
"components",
"=",
"array_values",
"(",
"$",
"uuid",
"->",
"getFieldsHex",
"(",
")",
")",
";",
"return",
"hex2bin",
"(",
"implode",
"(",
"''",
",",
"$",
"components",
... | Encodes a UuidInterface as a binary representation of a GUID
@param UuidInterface $uuid
@return string Binary string representation of a GUID | [
"Encodes",
"a",
"UuidInterface",
"as",
"a",
"binary",
"representation",
"of",
"a",
"GUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/GuidStringCodec.php#L51-L56 | train |
ramsey/uuid | src/Codec/GuidStringCodec.php | GuidStringCodec.decode | public function decode($encodedUuid)
{
$components = $this->extractComponents($encodedUuid);
$this->swapFields($components);
return $this->getBuilder()->build($this, $this->getFields($components));
} | php | public function decode($encodedUuid)
{
$components = $this->extractComponents($encodedUuid);
$this->swapFields($components);
return $this->getBuilder()->build($this, $this->getFields($components));
} | [
"public",
"function",
"decode",
"(",
"$",
"encodedUuid",
")",
"{",
"$",
"components",
"=",
"$",
"this",
"->",
"extractComponents",
"(",
"$",
"encodedUuid",
")",
";",
"$",
"this",
"->",
"swapFields",
"(",
"$",
"components",
")",
";",
"return",
"$",
"this"... | Decodes a string representation of a GUID into a UuidInterface object instance
@param string $encodedUuid
@return UuidInterface
@throws \Ramsey\Uuid\Exception\InvalidUuidStringException | [
"Decodes",
"a",
"string",
"representation",
"of",
"a",
"GUID",
"into",
"a",
"UuidInterface",
"object",
"instance"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/GuidStringCodec.php#L65-L72 | train |
ramsey/uuid | src/Codec/GuidStringCodec.php | GuidStringCodec.swapFields | protected function swapFields(array &$components)
{
$hex = unpack('H*', pack('L', hexdec($components[0])));
$components[0] = $hex[1];
$hex = unpack('H*', pack('S', hexdec($components[1])));
$components[1] = $hex[1];
$hex = unpack('H*', pack('S', hexdec($components[2])));
... | php | protected function swapFields(array &$components)
{
$hex = unpack('H*', pack('L', hexdec($components[0])));
$components[0] = $hex[1];
$hex = unpack('H*', pack('S', hexdec($components[1])));
$components[1] = $hex[1];
$hex = unpack('H*', pack('S', hexdec($components[2])));
... | [
"protected",
"function",
"swapFields",
"(",
"array",
"&",
"$",
"components",
")",
"{",
"$",
"hex",
"=",
"unpack",
"(",
"'H*'",
",",
"pack",
"(",
"'L'",
",",
"hexdec",
"(",
"$",
"components",
"[",
"0",
"]",
")",
")",
")",
";",
"$",
"components",
"["... | Swaps fields to support GUID byte order
@param array $components An array of UUID components (the UUID exploded on its dashes)
@return void | [
"Swaps",
"fields",
"to",
"support",
"GUID",
"byte",
"order"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/GuidStringCodec.php#L93-L101 | train |
ramsey/uuid | src/Provider/Node/FallbackNodeProvider.php | FallbackNodeProvider.getNode | public function getNode()
{
foreach ($this->nodeProviders as $provider) {
if ($node = $provider->getNode()) {
return $node;
}
}
return null;
} | php | public function getNode()
{
foreach ($this->nodeProviders as $provider) {
if ($node = $provider->getNode()) {
return $node;
}
}
return null;
} | [
"public",
"function",
"getNode",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"nodeProviders",
"as",
"$",
"provider",
")",
"{",
"if",
"(",
"$",
"node",
"=",
"$",
"provider",
"->",
"getNode",
"(",
")",
")",
"{",
"return",
"$",
"node",
";",
"}",... | Returns the system node ID by iterating over an array of node providers
and returning the first non-empty value found
@return string|null System node ID as a hexadecimal string
@throws \Exception | [
"Returns",
"the",
"system",
"node",
"ID",
"by",
"iterating",
"over",
"an",
"array",
"of",
"node",
"providers",
"and",
"returning",
"the",
"first",
"non",
"-",
"empty",
"value",
"found"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Provider/Node/FallbackNodeProvider.php#L48-L57 | train |
ramsey/uuid | src/Codec/OrderedTimeCodec.php | OrderedTimeCodec.encodeBinary | public function encodeBinary(UuidInterface $uuid)
{
$fields = $uuid->getFieldsHex();
$optimized = [
$fields['time_hi_and_version'],
$fields['time_mid'],
$fields['time_low'],
$fields['clock_seq_hi_and_reserved'],
$fields['clock_seq_low'],
... | php | public function encodeBinary(UuidInterface $uuid)
{
$fields = $uuid->getFieldsHex();
$optimized = [
$fields['time_hi_and_version'],
$fields['time_mid'],
$fields['time_low'],
$fields['clock_seq_hi_and_reserved'],
$fields['clock_seq_low'],
... | [
"public",
"function",
"encodeBinary",
"(",
"UuidInterface",
"$",
"uuid",
")",
"{",
"$",
"fields",
"=",
"$",
"uuid",
"->",
"getFieldsHex",
"(",
")",
";",
"$",
"optimized",
"=",
"[",
"$",
"fields",
"[",
"'time_hi_and_version'",
"]",
",",
"$",
"fields",
"["... | Encodes a UuidInterface as an optimized binary representation of a UUID
@param UuidInterface $uuid
@return string Binary string representation of a UUID | [
"Encodes",
"a",
"UuidInterface",
"as",
"an",
"optimized",
"binary",
"representation",
"of",
"a",
"UUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/OrderedTimeCodec.php#L32-L46 | train |
ramsey/uuid | src/Codec/OrderedTimeCodec.php | OrderedTimeCodec.decodeBytes | public function decodeBytes($bytes)
{
if (strlen($bytes) !== 16) {
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
}
$hex = unpack('H*', $bytes)[1];
// Rearrange the fields to their original order
$hex = substr($hex, 8, 4) . su... | php | public function decodeBytes($bytes)
{
if (strlen($bytes) !== 16) {
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
}
$hex = unpack('H*', $bytes)[1];
// Rearrange the fields to their original order
$hex = substr($hex, 8, 4) . su... | [
"public",
"function",
"decodeBytes",
"(",
"$",
"bytes",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"bytes",
")",
"!==",
"16",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$bytes string should contain 16 characters.'",
")",
";",
"}",
"$",
"hex",
... | Decodes an optimized binary representation of a UUID into a UuidInterface object instance
@param string $bytes
@return UuidInterface
@throws \InvalidArgumentException if string has not 16 characters | [
"Decodes",
"an",
"optimized",
"binary",
"representation",
"of",
"a",
"UUID",
"into",
"a",
"UuidInterface",
"object",
"instance"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Codec/OrderedTimeCodec.php#L55-L67 | train |
ramsey/uuid | src/Builder/DefaultUuidBuilder.php | DefaultUuidBuilder.build | public function build(CodecInterface $codec, array $fields)
{
return new Uuid($fields, $this->numberConverter, $codec, $this->timeConverter);
} | php | public function build(CodecInterface $codec, array $fields)
{
return new Uuid($fields, $this->numberConverter, $codec, $this->timeConverter);
} | [
"public",
"function",
"build",
"(",
"CodecInterface",
"$",
"codec",
",",
"array",
"$",
"fields",
")",
"{",
"return",
"new",
"Uuid",
"(",
"$",
"fields",
",",
"$",
"this",
"->",
"numberConverter",
",",
"$",
"codec",
",",
"$",
"this",
"->",
"timeConverter",... | Builds a Uuid
@param CodecInterface $codec The codec to use for building this Uuid
@param array $fields An array of fields from which to construct the Uuid;
see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
@return Uuid | [
"Builds",
"a",
"Uuid"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Builder/DefaultUuidBuilder.php#L60-L63 | train |
ramsey/uuid | src/Generator/CombGenerator.php | CombGenerator.generate | public function generate($length)
{
if ($length < self::TIMESTAMP_BYTES || $length < 0) {
throw new \InvalidArgumentException('Length must be a positive integer.');
}
$hash = '';
if (self::TIMESTAMP_BYTES > 0 && $length > self::TIMESTAMP_BYTES) {
$hash = $th... | php | public function generate($length)
{
if ($length < self::TIMESTAMP_BYTES || $length < 0) {
throw new \InvalidArgumentException('Length must be a positive integer.');
}
$hash = '';
if (self::TIMESTAMP_BYTES > 0 && $length > self::TIMESTAMP_BYTES) {
$hash = $th... | [
"public",
"function",
"generate",
"(",
"$",
"length",
")",
"{",
"if",
"(",
"$",
"length",
"<",
"self",
"::",
"TIMESTAMP_BYTES",
"||",
"$",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Length must be a positive integer.... | Generates a string of binary data of the specified length
@param integer $length The number of bytes of random binary data to generate
@return string A binary string
@throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
@throws \InvalidArgumentException if length is... | [
"Generates",
"a",
"string",
"of",
"binary",
"data",
"of",
"the",
"specified",
"length"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Generator/CombGenerator.php#L60-L75 | train |
ramsey/uuid | src/Converter/Number/BigNumberConverter.php | BigNumberConverter.toHex | public function toHex($integer)
{
if (!$integer instanceof BigNumber) {
$integer = new BigNumber($integer);
}
return BigNumber::convertFromBase10($integer, 16);
} | php | public function toHex($integer)
{
if (!$integer instanceof BigNumber) {
$integer = new BigNumber($integer);
}
return BigNumber::convertFromBase10($integer, 16);
} | [
"public",
"function",
"toHex",
"(",
"$",
"integer",
")",
"{",
"if",
"(",
"!",
"$",
"integer",
"instanceof",
"BigNumber",
")",
"{",
"$",
"integer",
"=",
"new",
"BigNumber",
"(",
"$",
"integer",
")",
";",
"}",
"return",
"BigNumber",
"::",
"convertFromBase1... | Converts an integer or `Moontoast\Math\BigNumber` integer representation
into a hexadecimal string representation
@param int|string|BigNumber $integer An integer or `Moontoast\Math\BigNumber`
@return string Hexadecimal string | [
"Converts",
"an",
"integer",
"or",
"Moontoast",
"\\",
"Math",
"\\",
"BigNumber",
"integer",
"representation",
"into",
"a",
"hexadecimal",
"string",
"representation"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Converter/Number/BigNumberConverter.php#L46-L53 | train |
ramsey/uuid | src/Uuid.php | Uuid.unserialize | public function unserialize($serialized)
{
/** @var \Ramsey\Uuid\Uuid $uuid */
$uuid = self::fromString($serialized);
$this->codec = $uuid->codec;
$this->numberConverter = $uuid->getNumberConverter();
$this->fields = $uuid->fields;
} | php | public function unserialize($serialized)
{
/** @var \Ramsey\Uuid\Uuid $uuid */
$uuid = self::fromString($serialized);
$this->codec = $uuid->codec;
$this->numberConverter = $uuid->getNumberConverter();
$this->fields = $uuid->fields;
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"/** @var \\Ramsey\\Uuid\\Uuid $uuid */",
"$",
"uuid",
"=",
"self",
"::",
"fromString",
"(",
"$",
"serialized",
")",
";",
"$",
"this",
"->",
"codec",
"=",
"$",
"uuid",
"->",
"codec",
";",... | Re-constructs the object from its serialized form.
@param string $serialized
@link http://php.net/manual/en/class.serializable.php
@throws \Ramsey\Uuid\Exception\InvalidUuidStringException | [
"Re",
"-",
"constructs",
"the",
"object",
"from",
"its",
"serialized",
"form",
"."
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Uuid.php#L240-L247 | train |
ramsey/uuid | src/Provider/Node/SystemNodeProvider.php | SystemNodeProvider.getIfconfig | protected function getIfconfig()
{
if (strpos(strtolower(ini_get('disable_functions')), 'passthru') !== false) {
return '';
}
ob_start();
switch (strtoupper(substr(php_uname('a'), 0, 3))) {
case 'WIN':
passthru('ipconfig /all 2>&1');
... | php | protected function getIfconfig()
{
if (strpos(strtolower(ini_get('disable_functions')), 'passthru') !== false) {
return '';
}
ob_start();
switch (strtoupper(substr(php_uname('a'), 0, 3))) {
case 'WIN':
passthru('ipconfig /all 2>&1');
... | [
"protected",
"function",
"getIfconfig",
"(",
")",
"{",
"if",
"(",
"strpos",
"(",
"strtolower",
"(",
"ini_get",
"(",
"'disable_functions'",
")",
")",
",",
"'passthru'",
")",
"!==",
"false",
")",
"{",
"return",
"''",
";",
"}",
"ob_start",
"(",
")",
";",
... | Returns the network interface configuration for the system
@codeCoverageIgnore
@return string | [
"Returns",
"the",
"network",
"interface",
"configuration",
"for",
"the",
"system"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Provider/Node/SystemNodeProvider.php#L63-L87 | train |
ramsey/uuid | src/Provider/Node/SystemNodeProvider.php | SystemNodeProvider.getSysfs | protected function getSysfs()
{
$mac = false;
if (strtoupper(php_uname('s')) === 'LINUX') {
$addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT);
if (empty($addressPaths)) {
return false;
}
array_walk($addressPaths, function... | php | protected function getSysfs()
{
$mac = false;
if (strtoupper(php_uname('s')) === 'LINUX') {
$addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT);
if (empty($addressPaths)) {
return false;
}
array_walk($addressPaths, function... | [
"protected",
"function",
"getSysfs",
"(",
")",
"{",
"$",
"mac",
"=",
"false",
";",
"if",
"(",
"strtoupper",
"(",
"php_uname",
"(",
"'s'",
")",
")",
"===",
"'LINUX'",
")",
"{",
"$",
"addressPaths",
"=",
"glob",
"(",
"'/sys/class/net/*/address'",
",",
"GLO... | Returns mac address from the first system interface via the sysfs interface
@return string|bool | [
"Returns",
"mac",
"address",
"from",
"the",
"first",
"system",
"interface",
"via",
"the",
"sysfs",
"interface"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Provider/Node/SystemNodeProvider.php#L94-L124 | train |
ramsey/uuid | src/FeatureSet.php | FeatureSet.buildCodec | protected function buildCodec($useGuids = false)
{
if ($useGuids) {
return new GuidStringCodec($this->builder);
}
return new StringCodec($this->builder);
} | php | protected function buildCodec($useGuids = false)
{
if ($useGuids) {
return new GuidStringCodec($this->builder);
}
return new StringCodec($this->builder);
} | [
"protected",
"function",
"buildCodec",
"(",
"$",
"useGuids",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"useGuids",
")",
"{",
"return",
"new",
"GuidStringCodec",
"(",
"$",
"this",
"->",
"builder",
")",
";",
"}",
"return",
"new",
"StringCodec",
"(",
"$",
"... | Determines which UUID coder-decoder to use and returns the configured
codec for this environment
@param bool $useGuids Whether to build UUIDs using the `GuidStringCodec`
@return CodecInterface | [
"Determines",
"which",
"UUID",
"coder",
"-",
"decoder",
"to",
"use",
"and",
"returns",
"the",
"configured",
"codec",
"for",
"this",
"environment"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/FeatureSet.php#L254-L261 | train |
ramsey/uuid | src/FeatureSet.php | FeatureSet.buildTimeGenerator | protected function buildTimeGenerator(TimeProviderInterface $timeProvider)
{
if ($this->enablePecl) {
return new PeclUuidTimeGenerator();
}
return (new TimeGeneratorFactory(
$this->nodeProvider,
$this->timeConverter,
$timeProvider
))->... | php | protected function buildTimeGenerator(TimeProviderInterface $timeProvider)
{
if ($this->enablePecl) {
return new PeclUuidTimeGenerator();
}
return (new TimeGeneratorFactory(
$this->nodeProvider,
$this->timeConverter,
$timeProvider
))->... | [
"protected",
"function",
"buildTimeGenerator",
"(",
"TimeProviderInterface",
"$",
"timeProvider",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enablePecl",
")",
"{",
"return",
"new",
"PeclUuidTimeGenerator",
"(",
")",
";",
"}",
"return",
"(",
"new",
"TimeGeneratorFa... | Determines which time-based UUID generator to use and returns the configured
time-based UUID generator for this environment
@param TimeProviderInterface $timeProvider
@return TimeGeneratorInterface | [
"Determines",
"which",
"time",
"-",
"based",
"UUID",
"generator",
"to",
"use",
"and",
"returns",
"the",
"configured",
"time",
"-",
"based",
"UUID",
"generator",
"for",
"this",
"environment"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/FeatureSet.php#L316-L327 | train |
ramsey/uuid | src/FeatureSet.php | FeatureSet.buildTimeConverter | protected function buildTimeConverter()
{
if ($this->is64BitSystem()) {
return new PhpTimeConverter();
} elseif ($this->hasGmp()) {
return new GmpTimeConverter();
} elseif ($this->hasBigNumber()) {
return new BigNumberTimeConverter();
}
re... | php | protected function buildTimeConverter()
{
if ($this->is64BitSystem()) {
return new PhpTimeConverter();
} elseif ($this->hasGmp()) {
return new GmpTimeConverter();
} elseif ($this->hasBigNumber()) {
return new BigNumberTimeConverter();
}
re... | [
"protected",
"function",
"buildTimeConverter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is64BitSystem",
"(",
")",
")",
"{",
"return",
"new",
"PhpTimeConverter",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"hasGmp",
"(",
")",
")",
"{",
... | Determines which time converter to use and returns the configured
time converter for this environment
@return \Ramsey\Uuid\Converter\TimeConverterInterface | [
"Determines",
"which",
"time",
"converter",
"to",
"use",
"and",
"returns",
"the",
"configured",
"time",
"converter",
"for",
"this",
"environment"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/FeatureSet.php#L335-L346 | train |
ramsey/uuid | src/FeatureSet.php | FeatureSet.buildUuidBuilder | protected function buildUuidBuilder()
{
if ($this->is64BitSystem()) {
return new DefaultUuidBuilder($this->numberConverter, $this->timeConverter);
}
return new DegradedUuidBuilder($this->numberConverter, $this->timeConverter);
} | php | protected function buildUuidBuilder()
{
if ($this->is64BitSystem()) {
return new DefaultUuidBuilder($this->numberConverter, $this->timeConverter);
}
return new DegradedUuidBuilder($this->numberConverter, $this->timeConverter);
} | [
"protected",
"function",
"buildUuidBuilder",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is64BitSystem",
"(",
")",
")",
"{",
"return",
"new",
"DefaultUuidBuilder",
"(",
"$",
"this",
"->",
"numberConverter",
",",
"$",
"this",
"->",
"timeConverter",
")",
"... | Determines which UUID builder to use and returns the configured UUID
builder for this environment
@return UuidBuilderInterface | [
"Determines",
"which",
"UUID",
"builder",
"to",
"use",
"and",
"returns",
"the",
"configured",
"UUID",
"builder",
"for",
"this",
"environment"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/FeatureSet.php#L354-L361 | train |
ramsey/uuid | src/Validator/Validator.php | Validator.validate | public function validate($uuid)
{
$uuid = str_replace(['urn:', 'uuid:', '{', '}'], '', $uuid);
if ($uuid === Uuid::NIL || preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) {
return true;
}
return false;
} | php | public function validate($uuid)
{
$uuid = str_replace(['urn:', 'uuid:', '{', '}'], '', $uuid);
if ($uuid === Uuid::NIL || preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) {
return true;
}
return false;
} | [
"public",
"function",
"validate",
"(",
"$",
"uuid",
")",
"{",
"$",
"uuid",
"=",
"str_replace",
"(",
"[",
"'urn:'",
",",
"'uuid:'",
",",
"'{'",
",",
"'}'",
"]",
",",
"''",
",",
"$",
"uuid",
")",
";",
"if",
"(",
"$",
"uuid",
"===",
"Uuid",
"::",
... | Validate that a string represents a UUID
@param string $uuid
@return bool Returns TRUE if the string was validated as a valid UUID or FALSE on failure | [
"Validate",
"that",
"a",
"string",
"represents",
"a",
"UUID"
] | f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7 | https://github.com/ramsey/uuid/blob/f30bc1af81b1fdf5dec5ae085eb3ac2c59c32fe7/src/Validator/Validator.php#L36-L45 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.columnQuote | public function columnQuote($column)
{
if (empty($column)) {
return null;
}
preg_match('/^(?:(?<table>\w+)\.)?(?<column>\w+)$/iu', $column, $match);
if (isset($match['table'], $match['column'])) {
$table = $this->tableQuote($match['table']);
$match... | php | public function columnQuote($column)
{
if (empty($column)) {
return null;
}
preg_match('/^(?:(?<table>\w+)\.)?(?<column>\w+)$/iu', $column, $match);
if (isset($match['table'], $match['column'])) {
$table = $this->tableQuote($match['table']);
$match... | [
"public",
"function",
"columnQuote",
"(",
"$",
"column",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"column",
")",
")",
"{",
"return",
"null",
";",
"}",
"preg_match",
"(",
"'/^(?:(?<table>\\w+)\\.)?(?<column>\\w+)$/iu'",
",",
"$",
"column",
",",
"$",
"match",
... | Quotes a column name for use in a query.
@param string $column
The column name.
@return string | [
"Quotes",
"a",
"column",
"name",
"for",
"use",
"in",
"a",
"query",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L393-L406 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.set | public function set($column, $value = null, $quote = null)
{
if (is_array($column)) {
foreach ($column as $columnName => $columnValue) {
$this->set($columnName, $columnValue, $quote);
}
} else {
$this->set[] = array(
'column' => $th... | php | public function set($column, $value = null, $quote = null)
{
if (is_array($column)) {
foreach ($column as $columnName => $columnValue) {
$this->set($columnName, $columnValue, $quote);
}
} else {
$this->set[] = array(
'column' => $th... | [
"public",
"function",
"set",
"(",
"$",
"column",
",",
"$",
"value",
"=",
"null",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"column",
")",
")",
"{",
"foreach",
"(",
"$",
"column",
"as",
"$",
"columnName",
"=>",
"$"... | Add one or more column values to INSERT, UPDATE, or REPLACE.
@param string|array $column
column name or array of columns => values
@param mixed|null $value
optional value for single column
@param bool|null $quote
optional auto-escape value, default to global
@return Miner | [
"Add",
"one",
"or",
"more",
"column",
"values",
"to",
"INSERT",
"UPDATE",
"or",
"REPLACE",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L468-L483 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.criteria | private function criteria(array &$criteria, $column, $value, $operator = self::EQUALS, $connector = self::LOGICAL_AND, $quote = null)
{
$criteria[] = array(
'column' => $this->columnQuote($column),
'value' => $value,
'operator' => $operator,
'connector' => $co... | php | private function criteria(array &$criteria, $column, $value, $operator = self::EQUALS, $connector = self::LOGICAL_AND, $quote = null)
{
$criteria[] = array(
'column' => $this->columnQuote($column),
'value' => $value,
'operator' => $operator,
'connector' => $co... | [
"private",
"function",
"criteria",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"self",
"::",
"EQUALS",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
... | Add a condition to the specified WHERE or HAVING criteria.
@param array $criteria
WHERE or HAVING criteria
@param string $column
column name
@param mixed $value
value
@param string $operator
optional comparison operator, default =
@param string $connector
optional logical connector, default AND
@param bool|null $quote... | [
"Add",
"a",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L652-L663 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.orHaving | public function orHaving($column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->orCriteria($this->having, $column, $value, $operator, self::LOGICAL_OR, $quote);
} | php | public function orHaving($column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->orCriteria($this->having, $column, $value, $operator, self::LOGICAL_OR, $quote);
} | [
"public",
"function",
"orHaving",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"self",
"::",
"EQUALS",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"orCriteria",
"(",
"$",
"this",
"->",
"having",
",",
... | Add an OR HAVING condition.
@param string $column
colum name
@param mixed $value
value
@param string $operator
optional comparison operator, default =
@param bool|null $quote
optional auto-escape value, default to global
@return Miner | [
"Add",
"an",
"OR",
"HAVING",
"condition",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L900-L903 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.getJoinString | public function getJoinString()
{
$statement = "";
foreach ($this->join as $i => $join) {
$statement .= " " . $join['type'] . " " . $join['table'];
if ($join['alias']) {
$statement .= " AS " . $join['alias'];
}
... | php | public function getJoinString()
{
$statement = "";
foreach ($this->join as $i => $join) {
$statement .= " " . $join['type'] . " " . $join['table'];
if ($join['alias']) {
$statement .= " AS " . $join['alias'];
}
... | [
"public",
"function",
"getJoinString",
"(",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"join",
"as",
"$",
"i",
"=>",
"$",
"join",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"join",
"[",
"'type'",
"]",... | Get the JOIN portion of the statement as a string.
@return string JOIN portion of the statement | [
"Get",
"the",
"JOIN",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L1268-L1304 | train |
pinguo/php-msf | src/Pools/Miner.php | Miner.mergeInto | public function mergeInto(Miner $Miner, $overrideLimit = true)
{
if ($this->isSelect()) {
$this->mergeSelectInto($Miner);
$this->mergeFromInto($Miner);
$this->mergeJoinInto($Miner);
$this->mergeWhereInto($Miner);
$this->mergeGroupByInto($Miner);
... | php | public function mergeInto(Miner $Miner, $overrideLimit = true)
{
if ($this->isSelect()) {
$this->mergeSelectInto($Miner);
$this->mergeFromInto($Miner);
$this->mergeJoinInto($Miner);
$this->mergeWhereInto($Miner);
$this->mergeGroupByInto($Miner);
... | [
"public",
"function",
"mergeInto",
"(",
"Miner",
"$",
"Miner",
",",
"$",
"overrideLimit",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSelect",
"(",
")",
")",
"{",
"$",
"this",
"->",
"mergeSelectInto",
"(",
"$",
"Miner",
")",
";",
"$",
"... | Merge this Miner into the given Miner.
@param Miner $Miner
to merge into
@param bool $overrideLimit
optional override limit, default true
@return Miner | [
"Merge",
"this",
"Miner",
"into",
"the",
"given",
"Miner",
"."
] | 2a193c53da996c260e8aace9affa12fc2b9c08a6 | https://github.com/pinguo/php-msf/blob/2a193c53da996c260e8aace9affa12fc2b9c08a6/src/Pools/Miner.php#L2135-L2187 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.prepareDirectory | protected function prepareDirectory()
{
if (File::exists($this->docDir) && ! is_writable($this->docDir)) {
throw new L5SwaggerException('Documentation storage directory is not writable');
}
// delete all existing documentation
if (File::exists($this->docDir)) {
... | php | protected function prepareDirectory()
{
if (File::exists($this->docDir) && ! is_writable($this->docDir)) {
throw new L5SwaggerException('Documentation storage directory is not writable');
}
// delete all existing documentation
if (File::exists($this->docDir)) {
... | [
"protected",
"function",
"prepareDirectory",
"(",
")",
"{",
"if",
"(",
"File",
"::",
"exists",
"(",
"$",
"this",
"->",
"docDir",
")",
"&&",
"!",
"is_writable",
"(",
"$",
"this",
"->",
"docDir",
")",
")",
"{",
"throw",
"new",
"L5SwaggerException",
"(",
... | Check directory structure and permissions.
@return Generator | [
"Check",
"directory",
"structure",
"and",
"permissions",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L77-L91 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.defineConstants | protected function defineConstants()
{
if (! empty($this->constants)) {
foreach ($this->constants as $key => $value) {
defined($key) || define($key, $value);
}
}
return $this;
} | php | protected function defineConstants()
{
if (! empty($this->constants)) {
foreach ($this->constants as $key => $value) {
defined($key) || define($key, $value);
}
}
return $this;
} | [
"protected",
"function",
"defineConstants",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"constants",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"constants",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"defined",
"(",
... | Define constant which will be replaced.
@return Generator | [
"Define",
"constant",
"which",
"will",
"be",
"replaced",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L98-L107 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.scanFilesForDocumentation | protected function scanFilesForDocumentation()
{
if ($this->isOpenApi()) {
$this->swagger = \OpenApi\scan(
$this->appDir,
['exclude' => $this->excludedDirs]
);
}
if (! $this->isOpenApi()) {
$this->swagger = \Swagger\scan(
... | php | protected function scanFilesForDocumentation()
{
if ($this->isOpenApi()) {
$this->swagger = \OpenApi\scan(
$this->appDir,
['exclude' => $this->excludedDirs]
);
}
if (! $this->isOpenApi()) {
$this->swagger = \Swagger\scan(
... | [
"protected",
"function",
"scanFilesForDocumentation",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpenApi",
"(",
")",
")",
"{",
"$",
"this",
"->",
"swagger",
"=",
"\\",
"OpenApi",
"\\",
"scan",
"(",
"$",
"this",
"->",
"appDir",
",",
"[",
"'exclude'... | Scan directory and create Swagger.
@return Generator | [
"Scan",
"directory",
"and",
"create",
"Swagger",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L114-L131 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.populateServers | protected function populateServers()
{
if (config('l5-swagger.paths.base') !== null) {
if ($this->isOpenApi()) {
$this->swagger->servers = [
new \OpenApi\Annotations\Server(['url' => config('l5-swagger.paths.base')]),
];
}
... | php | protected function populateServers()
{
if (config('l5-swagger.paths.base') !== null) {
if ($this->isOpenApi()) {
$this->swagger->servers = [
new \OpenApi\Annotations\Server(['url' => config('l5-swagger.paths.base')]),
];
}
... | [
"protected",
"function",
"populateServers",
"(",
")",
"{",
"if",
"(",
"config",
"(",
"'l5-swagger.paths.base'",
")",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpenApi",
"(",
")",
")",
"{",
"$",
"this",
"->",
"swagger",
"->",
"servers",
... | Generate servers section or basePath depending on Swagger version.
@return Generator | [
"Generate",
"servers",
"section",
"or",
"basePath",
"depending",
"on",
"Swagger",
"version",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L138-L153 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.saveJson | protected function saveJson()
{
$this->swagger->saveAs($this->docsFile);
$security = new SecurityDefinitions();
$security->generate($this->docsFile);
return $this;
} | php | protected function saveJson()
{
$this->swagger->saveAs($this->docsFile);
$security = new SecurityDefinitions();
$security->generate($this->docsFile);
return $this;
} | [
"protected",
"function",
"saveJson",
"(",
")",
"{",
"$",
"this",
"->",
"swagger",
"->",
"saveAs",
"(",
"$",
"this",
"->",
"docsFile",
")",
";",
"$",
"security",
"=",
"new",
"SecurityDefinitions",
"(",
")",
";",
"$",
"security",
"->",
"generate",
"(",
"... | Save documentation as json file.
@return Generator | [
"Save",
"documentation",
"as",
"json",
"file",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L160-L168 | train |
DarkaOnLine/L5-Swagger | src/Generator.php | Generator.makeYamlCopy | protected function makeYamlCopy()
{
if ($this->yamlCopyRequired) {
file_put_contents(
$this->yamlDocsFile,
(new YamlDumper(2))->dump(json_decode(file_get_contents($this->docsFile), true), 20)
);
}
} | php | protected function makeYamlCopy()
{
if ($this->yamlCopyRequired) {
file_put_contents(
$this->yamlDocsFile,
(new YamlDumper(2))->dump(json_decode(file_get_contents($this->docsFile), true), 20)
);
}
} | [
"protected",
"function",
"makeYamlCopy",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"yamlCopyRequired",
")",
"{",
"file_put_contents",
"(",
"$",
"this",
"->",
"yamlDocsFile",
",",
"(",
"new",
"YamlDumper",
"(",
"2",
")",
")",
"->",
"dump",
"(",
"json_d... | Save documentation as yaml file.
@return Generator | [
"Save",
"documentation",
"as",
"yaml",
"file",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/Generator.php#L175-L183 | train |
DarkaOnLine/L5-Swagger | src/SecurityDefinitions.php | SecurityDefinitions.generateSwaggerApi | public function generateSwaggerApi(Collection $documentation, array $securityConfig)
{
$securityDefinitions = collect();
if ($documentation->has('securityDefinitions')) {
$securityDefinitions = collect($documentation->get('securityDefinitions'));
}
foreach ($securityConf... | php | public function generateSwaggerApi(Collection $documentation, array $securityConfig)
{
$securityDefinitions = collect();
if ($documentation->has('securityDefinitions')) {
$securityDefinitions = collect($documentation->get('securityDefinitions'));
}
foreach ($securityConf... | [
"public",
"function",
"generateSwaggerApi",
"(",
"Collection",
"$",
"documentation",
",",
"array",
"$",
"securityConfig",
")",
"{",
"$",
"securityDefinitions",
"=",
"collect",
"(",
")",
";",
"if",
"(",
"$",
"documentation",
"->",
"has",
"(",
"'securityDefinition... | Inject security settings for Swagger 1 & 2.
@param Collection $documentation The parse json
@param array $securityConfig The security settings from l5-swagger
@return Collection | [
"Inject",
"security",
"settings",
"for",
"Swagger",
"1",
"&",
"2",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/SecurityDefinitions.php#L41-L55 | train |
DarkaOnLine/L5-Swagger | src/SecurityDefinitions.php | SecurityDefinitions.generateOpenApi | public function generateOpenApi(Collection $documentation, array $securityConfig)
{
$components = collect();
if ($documentation->has('components')) {
$components = collect($documentation->get('components'));
}
$securitySchemes = collect();
if ($components->has('s... | php | public function generateOpenApi(Collection $documentation, array $securityConfig)
{
$components = collect();
if ($documentation->has('components')) {
$components = collect($documentation->get('components'));
}
$securitySchemes = collect();
if ($components->has('s... | [
"public",
"function",
"generateOpenApi",
"(",
"Collection",
"$",
"documentation",
",",
"array",
"$",
"securityConfig",
")",
"{",
"$",
"components",
"=",
"collect",
"(",
")",
";",
"if",
"(",
"$",
"documentation",
"->",
"has",
"(",
"'components'",
")",
")",
... | Inject security settings for OpenApi 3.
@param Collection $documentation The parse json
@param array $securityConfig The security settings from l5-swagger
@return Collection | [
"Inject",
"security",
"settings",
"for",
"OpenApi",
"3",
"."
] | fc1d262688a1f932ce298603ecb6305bbeecb293 | https://github.com/DarkaOnLine/L5-Swagger/blob/fc1d262688a1f932ce298603ecb6305bbeecb293/src/SecurityDefinitions.php#L65-L86 | train |
antonioribeiro/tracker | src/Tracker.php | Tracker.updateGeoIp | public function updateGeoIp()
{
$updater = new GeoIpUpdater();
$success = $updater->updateGeoIpFiles($this->config->get('geoip_database_path'));
$this->messageRepository->addMessage($updater->getMessages());
return $success;
} | php | public function updateGeoIp()
{
$updater = new GeoIpUpdater();
$success = $updater->updateGeoIpFiles($this->config->get('geoip_database_path'));
$this->messageRepository->addMessage($updater->getMessages());
return $success;
} | [
"public",
"function",
"updateGeoIp",
"(",
")",
"{",
"$",
"updater",
"=",
"new",
"GeoIpUpdater",
"(",
")",
";",
"$",
"success",
"=",
"$",
"updater",
"->",
"updateGeoIpFiles",
"(",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'geoip_database_path'",
")",
... | Update the GeoIp2 database.
@return bool | [
"Update",
"the",
"GeoIp2",
"database",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Tracker.php#L552-L561 | train |
antonioribeiro/tracker | src/Repositories/Message.php | Message.addMessage | public function addMessage($message)
{
collect((array) $message)->each(function ($item) {
collect($item)->flatten()->each(function ($flattened) {
$this->messageList->push($flattened);
});
});
} | php | public function addMessage($message)
{
collect((array) $message)->each(function ($item) {
collect($item)->flatten()->each(function ($flattened) {
$this->messageList->push($flattened);
});
});
} | [
"public",
"function",
"addMessage",
"(",
"$",
"message",
")",
"{",
"collect",
"(",
"(",
"array",
")",
"$",
"message",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"collect",
"(",
"$",
"item",
")",
"->",
"flatten",
"(",
")",
"->",... | Add a message to the messages list.
@param $message
@return void | [
"Add",
"a",
"message",
"to",
"the",
"messages",
"list",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Repositories/Message.php#L29-L36 | train |
antonioribeiro/tracker | src/Support/RefererParser.php | RefererParser.parse | public function parse($refererUrl, $pageUrl)
{
$this->setReferer($this->parser->parse($refererUrl, $pageUrl));
return $this;
} | php | public function parse($refererUrl, $pageUrl)
{
$this->setReferer($this->parser->parse($refererUrl, $pageUrl));
return $this;
} | [
"public",
"function",
"parse",
"(",
"$",
"refererUrl",
",",
"$",
"pageUrl",
")",
"{",
"$",
"this",
"->",
"setReferer",
"(",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"refererUrl",
",",
"$",
"pageUrl",
")",
")",
";",
"return",
"$",
"this",... | Parse a referer.
@return RefererParser | [
"Parse",
"a",
"referer",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Support/RefererParser.php#L38-L43 | train |
antonioribeiro/tracker | src/Vendor/Laravel/Artisan/UpdateGeoIp.php | UpdateGeoIp.fire | public function fire()
{
$tracker = app('tracker');
$type = $tracker->updateGeoIp()
? 'info'
: 'error';
$this->displayMessages($type, $tracker->getMessages());
} | php | public function fire()
{
$tracker = app('tracker');
$type = $tracker->updateGeoIp()
? 'info'
: 'error';
$this->displayMessages($type, $tracker->getMessages());
} | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"tracker",
"=",
"app",
"(",
"'tracker'",
")",
";",
"$",
"type",
"=",
"$",
"tracker",
"->",
"updateGeoIp",
"(",
")",
"?",
"'info'",
":",
"'error'",
";",
"$",
"this",
"->",
"displayMessages",
"(",
"$",
... | Update the geo ip database.
@return void | [
"Update",
"the",
"geo",
"ip",
"database",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Vendor/Laravel/Artisan/UpdateGeoIp.php#L26-L35 | train |
antonioribeiro/tracker | src/Vendor/Laravel/Artisan/Base.php | Base.display | public function display($result, $method = 'info')
{
if ($result) {
if (is_array($result)) {
$this->displayTable($result);
} elseif (is_bool($result)) {
$this->{$method}($result ? 'Statement executed sucessfully.' : 'And error ocurred while executing t... | php | public function display($result, $method = 'info')
{
if ($result) {
if (is_array($result)) {
$this->displayTable($result);
} elseif (is_bool($result)) {
$this->{$method}($result ? 'Statement executed sucessfully.' : 'And error ocurred while executing t... | [
"public",
"function",
"display",
"(",
"$",
"result",
",",
"$",
"method",
"=",
"'info'",
")",
"{",
"if",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"result",
")",
")",
"{",
"$",
"this",
"->",
"displayTable",
"(",
"$",
"result",
... | Display results.
@param $result
@param string $method | [
"Display",
"results",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Vendor/Laravel/Artisan/Base.php#L63-L74 | train |
antonioribeiro/tracker | src/Vendor/Laravel/Artisan/Base.php | Base.displayTable | public function displayTable($table)
{
$headers = $this->makeHeaders($table[0]);
$rows = [];
foreach ($table as $row) {
$rows[] = (array) $row;
}
$this->table = $this->getHelperSet()->get('table');
$this->table->setHeaders($headers)->setRows($rows);
... | php | public function displayTable($table)
{
$headers = $this->makeHeaders($table[0]);
$rows = [];
foreach ($table as $row) {
$rows[] = (array) $row;
}
$this->table = $this->getHelperSet()->get('table');
$this->table->setHeaders($headers)->setRows($rows);
... | [
"public",
"function",
"displayTable",
"(",
"$",
"table",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"makeHeaders",
"(",
"$",
"table",
"[",
"0",
"]",
")",
";",
"$",
"rows",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"table",
"as",
"$",
"row",... | Display results in table format.
@param $table | [
"Display",
"results",
"in",
"table",
"format",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Vendor/Laravel/Artisan/Base.php#L81-L96 | train |
antonioribeiro/tracker | src/Vendor/Laravel/ServiceProvider.php | ServiceProvider.registerTracker | protected function registerTracker()
{
$this->app->singleton('tracker', function ($app) {
$app['tracker.loaded'] = true;
return new Tracker(
$app['tracker.config'],
$app['tracker.repositories'],
... | php | protected function registerTracker()
{
$this->app->singleton('tracker', function ($app) {
$app['tracker.loaded'] = true;
return new Tracker(
$app['tracker.config'],
$app['tracker.repositories'],
... | [
"protected",
"function",
"registerTracker",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'tracker'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'tracker.loaded'",
"]",
"=",
"true",
";",
"return",
"new",
"Tracker",
... | Takes all the components of Tracker and glues them
together to create Tracker.
@return void | [
"Takes",
"all",
"the",
"components",
"of",
"Tracker",
"and",
"glues",
"them",
"together",
"to",
"create",
"Tracker",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Vendor/Laravel/ServiceProvider.php#L155-L170 | train |
antonioribeiro/tracker | src/Vendor/Laravel/ServiceProvider.php | ServiceProvider.registerGlobalViewComposers | protected function registerGlobalViewComposers()
{
$me = $this;
$this->app->make('view')->composer('pragmarx/tracker::*', function ($view) use ($me) {
$view->with('stats_layout', $me->getConfig('stats_layout'));
$template_path = url('/').$me->getConfig('stats_template_path'... | php | protected function registerGlobalViewComposers()
{
$me = $this;
$this->app->make('view')->composer('pragmarx/tracker::*', function ($view) use ($me) {
$view->with('stats_layout', $me->getConfig('stats_layout'));
$template_path = url('/').$me->getConfig('stats_template_path'... | [
"protected",
"function",
"registerGlobalViewComposers",
"(",
")",
"{",
"$",
"me",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'view'",
")",
"->",
"composer",
"(",
"'pragmarx/tracker::*'",
",",
"function",
"(",
"$",
"view",
")",
"... | Register global view composers. | [
"Register",
"global",
"view",
"composers",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Vendor/Laravel/ServiceProvider.php#L596-L607 | train |
antonioribeiro/tracker | src/Support/Minutes.php | Minutes.calculateStartEnd | private function calculateStartEnd()
{
if ($this->minutes == 0) {
$this->setToday();
} else {
$this->start = Carbon::now()->subMinutes($this->minutes);
$this->end = Carbon::now();
}
} | php | private function calculateStartEnd()
{
if ($this->minutes == 0) {
$this->setToday();
} else {
$this->start = Carbon::now()->subMinutes($this->minutes);
$this->end = Carbon::now();
}
} | [
"private",
"function",
"calculateStartEnd",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"minutes",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"setToday",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"start",
"=",
"Carbon",
"::",
"now",
"(",
... | Calculate start and end dates. | [
"Calculate",
"start",
"and",
"end",
"dates",
"."
] | e1ec4926402958bdad565a61b65457238536aa12 | https://github.com/antonioribeiro/tracker/blob/e1ec4926402958bdad565a61b65457238536aa12/src/Support/Minutes.php#L49-L58 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.slug | public function slug(Model $model, bool $force = false): bool
{
$this->setModel($model);
$attributes = [];
foreach ($this->model->sluggable() as $attribute => $config) {
if (is_numeric($attribute)) {
$attribute = $config;
$config = $this->getConf... | php | public function slug(Model $model, bool $force = false): bool
{
$this->setModel($model);
$attributes = [];
foreach ($this->model->sluggable() as $attribute => $config) {
if (is_numeric($attribute)) {
$attribute = $config;
$config = $this->getConf... | [
"public",
"function",
"slug",
"(",
"Model",
"$",
"model",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"setModel",
"(",
"$",
"model",
")",
";",
"$",
"attributes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"thi... | Slug the current model.
@param \Illuminate\Database\Eloquent\Model $model
@param bool $force
@return bool | [
"Slug",
"the",
"current",
"model",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L29-L52 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.buildSlug | public function buildSlug(string $attribute, array $config, bool $force = null)
{
$slug = $this->model->getAttribute($attribute);
if ($force || $this->needsSlugging($attribute, $config)) {
$source = $this->getSlugSource($config['source']);
if ($source || is_numeric($source)... | php | public function buildSlug(string $attribute, array $config, bool $force = null)
{
$slug = $this->model->getAttribute($attribute);
if ($force || $this->needsSlugging($attribute, $config)) {
$source = $this->getSlugSource($config['source']);
if ($source || is_numeric($source)... | [
"public",
"function",
"buildSlug",
"(",
"string",
"$",
"attribute",
",",
"array",
"$",
"config",
",",
"bool",
"$",
"force",
"=",
"null",
")",
"{",
"$",
"slug",
"=",
"$",
"this",
"->",
"model",
"->",
"getAttribute",
"(",
"$",
"attribute",
")",
";",
"i... | Build the slug for the given attribute of the current model.
@param string $attribute
@param array $config
@param bool $force
@return null|string | [
"Build",
"the",
"slug",
"for",
"the",
"given",
"attribute",
"of",
"the",
"current",
"model",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L78-L93 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.getSlugSource | protected function getSlugSource($from): string
{
if (is_null($from)) {
return $this->model->__toString();
}
$sourceStrings = array_map(function($key) {
$value = data_get($this->model, $key);
if (is_bool($value)) {
$value = (int) $value;
... | php | protected function getSlugSource($from): string
{
if (is_null($from)) {
return $this->model->__toString();
}
$sourceStrings = array_map(function($key) {
$value = data_get($this->model, $key);
if (is_bool($value)) {
$value = (int) $value;
... | [
"protected",
"function",
"getSlugSource",
"(",
"$",
"from",
")",
":",
"string",
"{",
"if",
"(",
"is_null",
"(",
"$",
"from",
")",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"__toString",
"(",
")",
";",
"}",
"$",
"sourceStrings",
"=",
"arra... | Get the source string for the slug.
@param mixed $from
@return string | [
"Get",
"the",
"source",
"string",
"for",
"the",
"slug",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L126-L142 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.generateSlug | protected function generateSlug(string $source, array $config, string $attribute): string
{
$separator = $config['separator'];
$method = $config['method'];
$maxLength = $config['maxLength'];
$maxLengthKeepWords = $config['maxLengthKeepWords'];
if ($method === null) {
... | php | protected function generateSlug(string $source, array $config, string $attribute): string
{
$separator = $config['separator'];
$method = $config['method'];
$maxLength = $config['maxLength'];
$maxLengthKeepWords = $config['maxLengthKeepWords'];
if ($method === null) {
... | [
"protected",
"function",
"generateSlug",
"(",
"string",
"$",
"source",
",",
"array",
"$",
"config",
",",
"string",
"$",
"attribute",
")",
":",
"string",
"{",
"$",
"separator",
"=",
"$",
"config",
"[",
"'separator'",
"]",
";",
"$",
"method",
"=",
"$",
"... | Generate a slug from the given source string.
@param string $source
@param array $config
@param string $attribute
@return string
@throws \UnexpectedValueException | [
"Generate",
"a",
"slug",
"from",
"the",
"given",
"source",
"string",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L154-L182 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.validateSlug | protected function validateSlug(string $slug, array $config, string $attribute): string
{
$separator = $config['separator'];
$reserved = $config['reserved'];
if ($reserved === null) {
return $slug;
}
// check for reserved names
if ($reserved instanceof \... | php | protected function validateSlug(string $slug, array $config, string $attribute): string
{
$separator = $config['separator'];
$reserved = $config['reserved'];
if ($reserved === null) {
return $slug;
}
// check for reserved names
if ($reserved instanceof \... | [
"protected",
"function",
"validateSlug",
"(",
"string",
"$",
"slug",
",",
"array",
"$",
"config",
",",
"string",
"$",
"attribute",
")",
":",
"string",
"{",
"$",
"separator",
"=",
"$",
"config",
"[",
"'separator'",
"]",
";",
"$",
"reserved",
"=",
"$",
"... | Checks that the given slug is not a reserved word.
@param string $slug
@param array $config
@param string $attribute
@return string
@throws \UnexpectedValueException | [
"Checks",
"that",
"the",
"given",
"slug",
"is",
"not",
"a",
"reserved",
"word",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L220-L252 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.makeSlugUnique | protected function makeSlugUnique(string $slug, array $config, string $attribute): string
{
if (!$config['unique']) {
return $slug;
}
$separator = $config['separator'];
// find all models where the slug is like the current one
$list = $this->getExistingSlugs($sl... | php | protected function makeSlugUnique(string $slug, array $config, string $attribute): string
{
if (!$config['unique']) {
return $slug;
}
$separator = $config['separator'];
// find all models where the slug is like the current one
$list = $this->getExistingSlugs($sl... | [
"protected",
"function",
"makeSlugUnique",
"(",
"string",
"$",
"slug",
",",
"array",
"$",
"config",
",",
"string",
"$",
"attribute",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"config",
"[",
"'unique'",
"]",
")",
"{",
"return",
"$",
"slug",
";",
"... | Checks if the slug should be unique, and makes it so if needed.
@param string $slug
@param array $config
@param string $attribute
@return string
@throws \UnexpectedValueException | [
"Checks",
"if",
"the",
"slug",
"should",
"be",
"unique",
"and",
"makes",
"it",
"so",
"if",
"needed",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L264-L311 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.generateSuffix | protected function generateSuffix(string $slug, string $separator, Collection $list): string
{
$len = strlen($slug . $separator);
// If the slug already exists, but belongs to
// our model, return the current suffix.
if ($list->search($slug) === $this->model->getKey()) {
... | php | protected function generateSuffix(string $slug, string $separator, Collection $list): string
{
$len = strlen($slug . $separator);
// If the slug already exists, but belongs to
// our model, return the current suffix.
if ($list->search($slug) === $this->model->getKey()) {
... | [
"protected",
"function",
"generateSuffix",
"(",
"string",
"$",
"slug",
",",
"string",
"$",
"separator",
",",
"Collection",
"$",
"list",
")",
":",
"string",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"slug",
".",
"$",
"separator",
")",
";",
"// If the slug... | Generate a unique suffix for the given slug (and list of existing, "similar" slugs.
@param string $slug
@param string $separator
@param \Illuminate\Support\Collection $list
@return string | [
"Generate",
"a",
"unique",
"suffix",
"for",
"the",
"given",
"slug",
"(",
"and",
"list",
"of",
"existing",
"similar",
"slugs",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L322-L340 | train |
cviebrock/eloquent-sluggable | src/Services/SlugService.php | SlugService.createSlug | public static function createSlug($model, string $attribute, string $fromString, array $config = null): string
{
if (is_string($model)) {
$model = new $model;
}
/** @var static $instance */
$instance = (new static())->setModel($model);
if ($config === null) {
... | php | public static function createSlug($model, string $attribute, string $fromString, array $config = null): string
{
if (is_string($model)) {
$model = new $model;
}
/** @var static $instance */
$instance = (new static())->setModel($model);
if ($config === null) {
... | [
"public",
"static",
"function",
"createSlug",
"(",
"$",
"model",
",",
"string",
"$",
"attribute",
",",
"string",
"$",
"fromString",
",",
"array",
"$",
"config",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"is_string",
"(",
"$",
"model",
")",
")",
... | Generate a unique slug for a given string.
@param \Illuminate\Database\Eloquent\Model|string $model
@param string $attribute
@param string $fromString
@param array|null $config
@return string
@throws \InvalidArgumentException
@throws \UnexpectedValueException | [
"Generate",
"a",
"unique",
"slug",
"for",
"a",
"given",
"string",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Services/SlugService.php#L399-L424 | train |
cviebrock/eloquent-sluggable | src/Sluggable.php | Sluggable.scopeFindSimilarSlugs | public function scopeFindSimilarSlugs(Builder $query, string $attribute, array $config, string $slug): Builder
{
$separator = $config['separator'];
return $query->where(function(Builder $q) use ($attribute, $slug, $separator) {
$q->where($attribute, '=', $slug)
->orWhere... | php | public function scopeFindSimilarSlugs(Builder $query, string $attribute, array $config, string $slug): Builder
{
$separator = $config['separator'];
return $query->where(function(Builder $q) use ($attribute, $slug, $separator) {
$q->where($attribute, '=', $slug)
->orWhere... | [
"public",
"function",
"scopeFindSimilarSlugs",
"(",
"Builder",
"$",
"query",
",",
"string",
"$",
"attribute",
",",
"array",
"$",
"config",
",",
"string",
"$",
"slug",
")",
":",
"Builder",
"{",
"$",
"separator",
"=",
"$",
"config",
"[",
"'separator'",
"]",
... | Query scope for finding "similar" slugs, used to determine uniqueness.
@param \Illuminate\Database\Eloquent\Builder $query
@param string $attribute
@param array $config
@param string $slug
@return \Illuminate\Database\Eloquent\Builder | [
"Query",
"scope",
"for",
"finding",
"similar",
"slugs",
"used",
"to",
"determine",
"uniqueness",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/Sluggable.php#L67-L75 | train |
cviebrock/eloquent-sluggable | src/SluggableScopeHelpers.php | SluggableScopeHelpers.getSlugKeyName | public function getSlugKeyName(): string
{
if (property_exists($this, 'slugKeyName')) {
return $this->slugKeyName;
}
$config = $this->sluggable();
$name = reset($config);
$key = key($config);
// check for short configuration
if ($key === 0) {
... | php | public function getSlugKeyName(): string
{
if (property_exists($this, 'slugKeyName')) {
return $this->slugKeyName;
}
$config = $this->sluggable();
$name = reset($config);
$key = key($config);
// check for short configuration
if ($key === 0) {
... | [
"public",
"function",
"getSlugKeyName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'slugKeyName'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"slugKeyName",
";",
"}",
"$",
"config",
"=",
"$",
"this",
"->",
"slu... | Primary slug column of this model.
@return string | [
"Primary",
"slug",
"column",
"of",
"this",
"model",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/SluggableScopeHelpers.php#L21-L37 | train |
cviebrock/eloquent-sluggable | src/SluggableScopeHelpers.php | SluggableScopeHelpers.scopeWhereSlug | public function scopeWhereSlug(Builder $scope, string $slug): Builder
{
return $scope->where($this->getSlugKeyName(), $slug);
} | php | public function scopeWhereSlug(Builder $scope, string $slug): Builder
{
return $scope->where($this->getSlugKeyName(), $slug);
} | [
"public",
"function",
"scopeWhereSlug",
"(",
"Builder",
"$",
"scope",
",",
"string",
"$",
"slug",
")",
":",
"Builder",
"{",
"return",
"$",
"scope",
"->",
"where",
"(",
"$",
"this",
"->",
"getSlugKeyName",
"(",
")",
",",
"$",
"slug",
")",
";",
"}"
] | Query scope for finding a model by its primary slug.
@param \Illuminate\Database\Eloquent\Builder $scope
@param string $slug
@return \Illuminate\Database\Eloquent\Builder | [
"Query",
"scope",
"for",
"finding",
"a",
"model",
"by",
"its",
"primary",
"slug",
"."
] | 805b75b8adaa9d387eeabd7dd6b6978893cc948a | https://github.com/cviebrock/eloquent-sluggable/blob/805b75b8adaa9d387eeabd7dd6b6978893cc948a/src/SluggableScopeHelpers.php#L56-L59 | train |
heroku/heroku-buildpack-php | support/installer/src/Downloader.php | Downloader.extract | protected function extract($file, $path)
{
// we must use cmdline tar, as PharData::extract() messes up symlinks
$command = 'tar -xzf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
if (0 === $this->process->execute($command, $ignoredOutput)) {
return;
}
throw new \RuntimeE... | php | protected function extract($file, $path)
{
// we must use cmdline tar, as PharData::extract() messes up symlinks
$command = 'tar -xzf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
if (0 === $this->process->execute($command, $ignoredOutput)) {
return;
}
throw new \RuntimeE... | [
"protected",
"function",
"extract",
"(",
"$",
"file",
",",
"$",
"path",
")",
"{",
"// we must use cmdline tar, as PharData::extract() messes up symlinks",
"$",
"command",
"=",
"'tar -xzf '",
".",
"ProcessExecutor",
"::",
"escape",
"(",
"$",
"file",
")",
".",
"' -C '... | extract using cmdline tar, which merges with existing files and folders | [
"extract",
"using",
"cmdline",
"tar",
"which",
"merges",
"with",
"existing",
"files",
"and",
"folders"
] | 2625279c4b3caf5e2937308d07d4357b411d04d0 | https://github.com/heroku/heroku-buildpack-php/blob/2625279c4b3caf5e2937308d07d4357b411d04d0/support/installer/src/Downloader.php#L25-L35 | train |
heroku/heroku-buildpack-php | support/installer/src/Downloader.php | Downloader.download | public function download(PackageInterface $package, $path, $output = true)
{
$temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
$this->filesystem->ensureDirectoryExists($temporaryDir);
// START: from FileDownloader::download()
if (!$package->getDistUrl()) {
... | php | public function download(PackageInterface $package, $path, $output = true)
{
$temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
$this->filesystem->ensureDirectoryExists($temporaryDir);
// START: from FileDownloader::download()
if (!$package->getDistUrl()) {
... | [
"public",
"function",
"download",
"(",
"PackageInterface",
"$",
"package",
",",
"$",
"path",
",",
"$",
"output",
"=",
"true",
")",
"{",
"$",
"temporaryDir",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'vendor-dir'",
")",
".",
"'/composer/'",
"."... | we can't do that, since we need our contents to be merged into the probably existing folder structure | [
"we",
"can",
"t",
"do",
"that",
"since",
"we",
"need",
"our",
"contents",
"to",
"be",
"merged",
"into",
"the",
"probably",
"existing",
"folder",
"structure"
] | 2625279c4b3caf5e2937308d07d4357b411d04d0 | https://github.com/heroku/heroku-buildpack-php/blob/2625279c4b3caf5e2937308d07d4357b411d04d0/support/installer/src/Downloader.php#L39-L97 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/DecoratorPlugin.php | Swift_Plugins_DecoratorPlugin.setReplacements | public function setReplacements($replacements)
{
if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {
$this->replacements = (array) $replacements;
} else {
$this->replacements = $replacements;
}
} | php | public function setReplacements($replacements)
{
if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {
$this->replacements = (array) $replacements;
} else {
$this->replacements = $replacements;
}
} | [
"public",
"function",
"setReplacements",
"(",
"$",
"replacements",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"replacements",
"instanceof",
"Swift_Plugins_Decorator_Replacements",
")",
")",
"{",
"$",
"this",
"->",
"replacements",
"=",
"(",
"array",
")",
"$",
"replace... | Sets replacements.
@param mixed $replacements Array or Swift_Plugins_Decorator_Replacements
@see __construct() | [
"Sets",
"replacements",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/DecoratorPlugin.php#L66-L73 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/DecoratorPlugin.php | Swift_Plugins_DecoratorPlugin.getReplacementsFor | public function getReplacementsFor($address)
{
if ($this->replacements instanceof Swift_Plugins_Decorator_Replacements) {
return $this->replacements->getReplacementsFor($address);
}
return $this->replacements[$address] ?? null;
} | php | public function getReplacementsFor($address)
{
if ($this->replacements instanceof Swift_Plugins_Decorator_Replacements) {
return $this->replacements->getReplacementsFor($address);
}
return $this->replacements[$address] ?? null;
} | [
"public",
"function",
"getReplacementsFor",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"replacements",
"instanceof",
"Swift_Plugins_Decorator_Replacements",
")",
"{",
"return",
"$",
"this",
"->",
"replacements",
"->",
"getReplacementsFor",
"(",
"... | Find a map of replacements for the address.
If this plugin was provided with a delegate instance of
{@link Swift_Plugins_Decorator_Replacements} then the call will be
delegated to it. Otherwise, it will attempt to find the replacements
from the array provided in the constructor.
If no replacements can be found, an e... | [
"Find",
"a",
"map",
"of",
"replacements",
"for",
"the",
"address",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/DecoratorPlugin.php#L154-L161 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/DecoratorPlugin.php | Swift_Plugins_DecoratorPlugin.restoreMessage | private function restoreMessage(Swift_Mime_SimpleMessage $message)
{
if ($this->lastMessage === $message) {
if (isset($this->originalBody)) {
$message->setBody($this->originalBody);
$this->originalBody = null;
}
if (!empty($this->originalHe... | php | private function restoreMessage(Swift_Mime_SimpleMessage $message)
{
if ($this->lastMessage === $message) {
if (isset($this->originalBody)) {
$message->setBody($this->originalBody);
$this->originalBody = null;
}
if (!empty($this->originalHe... | [
"private",
"function",
"restoreMessage",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lastMessage",
"===",
"$",
"message",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"originalBody",
")",
")",
"{",
"... | Restore a changed message back to its original state | [
"Restore",
"a",
"changed",
"message",
"back",
"to",
"its",
"original",
"state"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/DecoratorPlugin.php#L172-L199 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DKIMSigner.php | Swift_Signers_DKIMSigner.reset | public function reset()
{
$this->headerHash = null;
$this->signedHeaders = [];
$this->bodyHash = null;
$this->bodyHashHandler = null;
$this->bodyCanonIgnoreStart = 2;
$this->bodyCanonEmptyCounter = 0;
$this->bodyCanonLastChar = null;
$this->bodyCanonSp... | php | public function reset()
{
$this->headerHash = null;
$this->signedHeaders = [];
$this->bodyHash = null;
$this->bodyHashHandler = null;
$this->bodyCanonIgnoreStart = 2;
$this->bodyCanonEmptyCounter = 0;
$this->bodyCanonLastChar = null;
$this->bodyCanonSp... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"headerHash",
"=",
"null",
";",
"$",
"this",
"->",
"signedHeaders",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"bodyHash",
"=",
"null",
";",
"$",
"this",
"->",
"bodyHashHandler",
"=",
"null... | Reset the Signer.
@see Swift_Signer::reset() | [
"Reset",
"the",
"Signer",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DKIMSigner.php#L190-L200 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DKIMSigner.php | Swift_Signers_DKIMSigner.setHashAlgorithm | public function setHashAlgorithm($hash)
{
switch ($hash) {
case 'rsa-sha1':
$this->hashAlgorithm = 'rsa-sha1';
break;
case 'rsa-sha256':
$this->hashAlgorithm = 'rsa-sha256';
if (!defined('OPENSSL_ALGO_SHA256')) {
... | php | public function setHashAlgorithm($hash)
{
switch ($hash) {
case 'rsa-sha1':
$this->hashAlgorithm = 'rsa-sha1';
break;
case 'rsa-sha256':
$this->hashAlgorithm = 'rsa-sha256';
if (!defined('OPENSSL_ALGO_SHA256')) {
... | [
"public",
"function",
"setHashAlgorithm",
"(",
"$",
"hash",
")",
"{",
"switch",
"(",
"$",
"hash",
")",
"{",
"case",
"'rsa-sha1'",
":",
"$",
"this",
"->",
"hashAlgorithm",
"=",
"'rsa-sha1'",
";",
"break",
";",
"case",
"'rsa-sha256'",
":",
"$",
"this",
"->... | Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1.
@param string $hash 'rsa-sha1' or 'rsa-sha256'
@throws Swift_SwiftException
@return $this | [
"Set",
"hash_algorithm",
"must",
"be",
"one",
"of",
"rsa",
"-",
"sha256",
"|",
"rsa",
"-",
"sha1",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DKIMSigner.php#L290-L307 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DKIMSigner.php | Swift_Signers_DKIMSigner.setBodySignedLen | public function setBodySignedLen($len)
{
if (true === $len) {
$this->showLen = true;
$this->maxLen = PHP_INT_MAX;
} elseif (false === $len) {
$this->showLen = false;
$this->maxLen = PHP_INT_MAX;
} else {
$this->showLen = true;
... | php | public function setBodySignedLen($len)
{
if (true === $len) {
$this->showLen = true;
$this->maxLen = PHP_INT_MAX;
} elseif (false === $len) {
$this->showLen = false;
$this->maxLen = PHP_INT_MAX;
} else {
$this->showLen = true;
... | [
"public",
"function",
"setBodySignedLen",
"(",
"$",
"len",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"len",
")",
"{",
"$",
"this",
"->",
"showLen",
"=",
"true",
";",
"$",
"this",
"->",
"maxLen",
"=",
"PHP_INT_MAX",
";",
"}",
"elseif",
"(",
"false",
... | Set the length of the body to sign.
@param mixed $len (bool or int)
@return $this | [
"Set",
"the",
"length",
"of",
"the",
"body",
"to",
"sign",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DKIMSigner.php#L366-L380 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DKIMSigner.php | Swift_Signers_DKIMSigner.startBody | public function startBody()
{
// Init
switch ($this->hashAlgorithm) {
case 'rsa-sha256':
$this->bodyHashHandler = hash_init('sha256');
break;
case 'rsa-sha1':
$this->bodyHashHandler = hash_init('sha1');
break;
... | php | public function startBody()
{
// Init
switch ($this->hashAlgorithm) {
case 'rsa-sha256':
$this->bodyHashHandler = hash_init('sha256');
break;
case 'rsa-sha1':
$this->bodyHashHandler = hash_init('sha1');
break;
... | [
"public",
"function",
"startBody",
"(",
")",
"{",
"// Init",
"switch",
"(",
"$",
"this",
"->",
"hashAlgorithm",
")",
"{",
"case",
"'rsa-sha256'",
":",
"$",
"this",
"->",
"bodyHashHandler",
"=",
"hash_init",
"(",
"'sha256'",
")",
";",
"break",
";",
"case",
... | Start Body. | [
"Start",
"Body",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DKIMSigner.php#L427-L439 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DKIMSigner.php | Swift_Signers_DKIMSigner.setHeaders | public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
$this->headerCanonData = '';
// Loop through Headers
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
if (!isset($this->ignoredHeaders[... | php | public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
$this->headerCanonData = '';
// Loop through Headers
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
if (!isset($this->ignoredHeaders[... | [
"public",
"function",
"setHeaders",
"(",
"Swift_Mime_SimpleHeaderSet",
"$",
"headers",
")",
"{",
"$",
"this",
"->",
"headerCanonData",
"=",
"''",
";",
"// Loop through Headers",
"$",
"listHeaders",
"=",
"$",
"headers",
"->",
"listAll",
"(",
")",
";",
"foreach",
... | Set the headers to sign.
@return Swift_Signers_DKIMSigner | [
"Set",
"the",
"headers",
"to",
"sign",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DKIMSigner.php#L482-L503 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/AbstractHeader.php | Swift_Mime_Headers_AbstractHeader.setLanguage | public function setLanguage($lang)
{
$this->clearCachedValueIf($this->lang != $lang);
$this->lang = $lang;
} | php | public function setLanguage($lang)
{
$this->clearCachedValueIf($this->lang != $lang);
$this->lang = $lang;
} | [
"public",
"function",
"setLanguage",
"(",
"$",
"lang",
")",
"{",
"$",
"this",
"->",
"clearCachedValueIf",
"(",
"$",
"this",
"->",
"lang",
"!=",
"$",
"lang",
")",
";",
"$",
"this",
"->",
"lang",
"=",
"$",
"lang",
";",
"}"
] | Set the language used in this Header.
For example, for US English, 'en-us'.
This can be unspecified.
@param string $lang | [
"Set",
"the",
"language",
"used",
"in",
"this",
"Header",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/AbstractHeader.php#L94-L98 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/AbstractHeader.php | Swift_Mime_Headers_AbstractHeader.getEncodableWordTokens | protected function getEncodableWordTokens($string)
{
$tokens = [];
$encodedToken = '';
// Split at all whitespace boundaries
foreach (preg_split('~(?=[\t ])~', $string) as $token) {
if ($this->tokenNeedsEncoding($token)) {
$encodedToken .= $token;
... | php | protected function getEncodableWordTokens($string)
{
$tokens = [];
$encodedToken = '';
// Split at all whitespace boundaries
foreach (preg_split('~(?=[\t ])~', $string) as $token) {
if ($this->tokenNeedsEncoding($token)) {
$encodedToken .= $token;
... | [
"protected",
"function",
"getEncodableWordTokens",
"(",
"$",
"string",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"$",
"encodedToken",
"=",
"''",
";",
"// Split at all whitespace boundaries",
"foreach",
"(",
"preg_split",
"(",
"'~(?=[\\t ])~'",
",",
"$",
"stri... | Splits a string into tokens in blocks of words which can be encoded quickly.
@param string $string
@return string[] | [
"Splits",
"a",
"string",
"into",
"tokens",
"in",
"blocks",
"of",
"words",
"which",
"can",
"be",
"encoded",
"quickly",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/AbstractHeader.php#L306-L328 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/DomainKeySigner.php | Swift_Signers_DomainKeySigner.reset | public function reset()
{
$this->hashHandler = null;
$this->bodyCanonIgnoreStart = 2;
$this->bodyCanonEmptyCounter = 0;
$this->bodyCanonLastChar = null;
$this->bodyCanonSpace = false;
return $this;
} | php | public function reset()
{
$this->hashHandler = null;
$this->bodyCanonIgnoreStart = 2;
$this->bodyCanonEmptyCounter = 0;
$this->bodyCanonLastChar = null;
$this->bodyCanonSpace = false;
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"hashHandler",
"=",
"null",
";",
"$",
"this",
"->",
"bodyCanonIgnoreStart",
"=",
"2",
";",
"$",
"this",
"->",
"bodyCanonEmptyCounter",
"=",
"0",
";",
"$",
"this",
"->",
"bodyCanonLastChar",
... | Resets internal states.
@return $this | [
"Resets",
"internal",
"states",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/DomainKeySigner.php#L130-L139 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/MailboxHeader.php | Swift_Mime_Headers_MailboxHeader.setNameAddresses | public function setNameAddresses($mailboxes)
{
$this->mailboxes = $this->normalizeMailboxes((array) $mailboxes);
$this->setCachedValue(null); //Clear any cached value
} | php | public function setNameAddresses($mailboxes)
{
$this->mailboxes = $this->normalizeMailboxes((array) $mailboxes);
$this->setCachedValue(null); //Clear any cached value
} | [
"public",
"function",
"setNameAddresses",
"(",
"$",
"mailboxes",
")",
"{",
"$",
"this",
"->",
"mailboxes",
"=",
"$",
"this",
"->",
"normalizeMailboxes",
"(",
"(",
"array",
")",
"$",
"mailboxes",
")",
";",
"$",
"this",
"->",
"setCachedValue",
"(",
"null",
... | Set a list of mailboxes to be shown in this Header.
The mailboxes can be a simple array of addresses, or an array of
key=>value pairs where (email => personalName).
Example:
<code>
<?php
//Sets two mailboxes in the Header, one with a personal name
$header->setNameAddresses(array(
'chris@swiftmailer.org' => 'Chris Corb... | [
"Set",
"a",
"list",
"of",
"mailboxes",
"to",
"be",
"shown",
"in",
"this",
"Header",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/MailboxHeader.php#L115-L119 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/MailboxHeader.php | Swift_Mime_Headers_MailboxHeader.removeAddresses | public function removeAddresses($addresses)
{
$this->setCachedValue(null);
foreach ((array) $addresses as $address) {
unset($this->mailboxes[$address]);
}
} | php | public function removeAddresses($addresses)
{
$this->setCachedValue(null);
foreach ((array) $addresses as $address) {
unset($this->mailboxes[$address]);
}
} | [
"public",
"function",
"removeAddresses",
"(",
"$",
"addresses",
")",
"{",
"$",
"this",
"->",
"setCachedValue",
"(",
"null",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"addresses",
"as",
"$",
"address",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
... | Remove one or more addresses from this Header.
@param string|string[] $addresses | [
"Remove",
"one",
"or",
"more",
"addresses",
"from",
"this",
"Header",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/MailboxHeader.php#L222-L228 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/MailboxHeader.php | Swift_Mime_Headers_MailboxHeader.normalizeMailboxes | protected function normalizeMailboxes(array $mailboxes)
{
$actualMailboxes = [];
foreach ($mailboxes as $key => $value) {
if (is_string($key)) {
//key is email addr
$address = $key;
$name = $value;
} else {
$add... | php | protected function normalizeMailboxes(array $mailboxes)
{
$actualMailboxes = [];
foreach ($mailboxes as $key => $value) {
if (is_string($key)) {
//key is email addr
$address = $key;
$name = $value;
} else {
$add... | [
"protected",
"function",
"normalizeMailboxes",
"(",
"array",
"$",
"mailboxes",
")",
"{",
"$",
"actualMailboxes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"mailboxes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"ke... | Normalizes a user-input list of mailboxes into consistent key=>value pairs.
@param string[] $mailboxes
@return string[] | [
"Normalizes",
"a",
"user",
"-",
"input",
"list",
"of",
"mailboxes",
"into",
"consistent",
"key",
"=",
">",
"value",
"pairs",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/MailboxHeader.php#L259-L277 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/MailboxHeader.php | Swift_Mime_Headers_MailboxHeader.createDisplayNameString | protected function createDisplayNameString($displayName, $shorten = false)
{
return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
} | php | protected function createDisplayNameString($displayName, $shorten = false)
{
return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
} | [
"protected",
"function",
"createDisplayNameString",
"(",
"$",
"displayName",
",",
"$",
"shorten",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"createPhrase",
"(",
"$",
"this",
",",
"$",
"displayName",
",",
"$",
"this",
"->",
"getCharset",
"(",
")"... | Produces a compliant, formatted display-name based on the string given.
@param string $displayName as displayed
@param bool $shorten the first line to make remove for header name
@return string | [
"Produces",
"a",
"compliant",
"formatted",
"display",
"-",
"name",
"based",
"on",
"the",
"string",
"given",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/MailboxHeader.php#L287-L290 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/MailboxHeader.php | Swift_Mime_Headers_MailboxHeader.createNameAddressStrings | private function createNameAddressStrings(array $mailboxes)
{
$strings = [];
foreach ($mailboxes as $email => $name) {
$mailboxStr = $this->addressEncoder->encodeString($email);
if (null !== $name) {
$nameStr = $this->createDisplayNameString($name, empty($str... | php | private function createNameAddressStrings(array $mailboxes)
{
$strings = [];
foreach ($mailboxes as $email => $name) {
$mailboxStr = $this->addressEncoder->encodeString($email);
if (null !== $name) {
$nameStr = $this->createDisplayNameString($name, empty($str... | [
"private",
"function",
"createNameAddressStrings",
"(",
"array",
"$",
"mailboxes",
")",
"{",
"$",
"strings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"mailboxes",
"as",
"$",
"email",
"=>",
"$",
"name",
")",
"{",
"$",
"mailboxStr",
"=",
"$",
"this",
"->... | Return an array of strings conforming the the name-addr spec of RFC 2822.
@param string[] $mailboxes
@return string[] | [
"Return",
"an",
"array",
"of",
"strings",
"conforming",
"the",
"the",
"name",
"-",
"addr",
"spec",
"of",
"RFC",
"2822",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/MailboxHeader.php#L329-L343 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Events/SimpleEventDispatcher.php | Swift_Events_SimpleEventDispatcher.bindEventListener | public function bindEventListener(Swift_Events_EventListener $listener)
{
foreach ($this->listeners as $l) {
// Already loaded
if ($l === $listener) {
return;
}
}
$this->listeners[] = $listener;
} | php | public function bindEventListener(Swift_Events_EventListener $listener)
{
foreach ($this->listeners as $l) {
// Already loaded
if ($l === $listener) {
return;
}
}
$this->listeners[] = $listener;
} | [
"public",
"function",
"bindEventListener",
"(",
"Swift_Events_EventListener",
"$",
"listener",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"as",
"$",
"l",
")",
"{",
"// Already loaded",
"if",
"(",
"$",
"l",
"===",
"$",
"listener",
")",
"{",
"... | Bind an event listener to this dispatcher. | [
"Bind",
"an",
"event",
"listener",
"to",
"this",
"dispatcher",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Events/SimpleEventDispatcher.php#L100-L109 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Events/SimpleEventDispatcher.php | Swift_Events_SimpleEventDispatcher.dispatchEvent | public function dispatchEvent(Swift_Events_EventObject $evt, $target)
{
$this->prepareBubbleQueue($evt);
$this->bubble($evt, $target);
} | php | public function dispatchEvent(Swift_Events_EventObject $evt, $target)
{
$this->prepareBubbleQueue($evt);
$this->bubble($evt, $target);
} | [
"public",
"function",
"dispatchEvent",
"(",
"Swift_Events_EventObject",
"$",
"evt",
",",
"$",
"target",
")",
"{",
"$",
"this",
"->",
"prepareBubbleQueue",
"(",
"$",
"evt",
")",
";",
"$",
"this",
"->",
"bubble",
"(",
"$",
"evt",
",",
"$",
"target",
")",
... | Dispatch the given Event to all suitable listeners.
@param string $target method | [
"Dispatch",
"the",
"given",
"Event",
"to",
"all",
"suitable",
"listeners",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Events/SimpleEventDispatcher.php#L116-L120 | train |
swiftmailer/swiftmailer | lib/classes/Swift/KeyCache/DiskKeyCache.php | Swift_KeyCache_DiskKeyCache.getHandle | private function getHandle($nsKey, $itemKey, $position)
{
if (!isset($this->keys[$nsKey][$itemKey])) {
$openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
$fp = fopen($this->path.'/'.$nsKey.'/'.$itemKey, $openMode);
$this->keys[$nsKey][$itemKey] = $fp;
}
... | php | private function getHandle($nsKey, $itemKey, $position)
{
if (!isset($this->keys[$nsKey][$itemKey])) {
$openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
$fp = fopen($this->path.'/'.$nsKey.'/'.$itemKey, $openMode);
$this->keys[$nsKey][$itemKey] = $fp;
}
... | [
"private",
"function",
"getHandle",
"(",
"$",
"nsKey",
",",
"$",
"itemKey",
",",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"keys",
"[",
"$",
"nsKey",
"]",
"[",
"$",
"itemKey",
"]",
")",
")",
"{",
"$",
"openMode",... | Get a file handle on the cache item.
@param string $nsKey
@param string $itemKey
@param int $position
@return resource | [
"Get",
"a",
"file",
"handle",
"on",
"the",
"cache",
"item",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/KeyCache/DiskKeyCache.php#L263-L277 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/ParameterizedHeader.php | Swift_Mime_Headers_ParameterizedHeader.setParameters | public function setParameters(array $parameters)
{
$this->clearCachedValueIf($this->params != $parameters);
$this->params = $parameters;
} | php | public function setParameters(array $parameters)
{
$this->clearCachedValueIf($this->params != $parameters);
$this->params = $parameters;
} | [
"public",
"function",
"setParameters",
"(",
"array",
"$",
"parameters",
")",
"{",
"$",
"this",
"->",
"clearCachedValueIf",
"(",
"$",
"this",
"->",
"params",
"!=",
"$",
"parameters",
")",
";",
"$",
"this",
"->",
"params",
"=",
"$",
"parameters",
";",
"}"
... | Set an associative array of parameter names mapped to values.
@param string[] $parameters | [
"Set",
"an",
"associative",
"array",
"of",
"parameter",
"names",
"mapped",
"to",
"values",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php#L106-L110 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/ParameterizedHeader.php | Swift_Mime_Headers_ParameterizedHeader.getEndOfParameterValue | private function getEndOfParameterValue($value, $encoded = false, $firstLine = false)
{
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
$value = '"'.$value.'"';
}
$prepend = '=';
if ($encoded) {
$prepend = '*=';
if ($firstLine) {
... | php | private function getEndOfParameterValue($value, $encoded = false, $firstLine = false)
{
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
$value = '"'.$value.'"';
}
$prepend = '=';
if ($encoded) {
$prepend = '*=';
if ($firstLine) {
... | [
"private",
"function",
"getEndOfParameterValue",
"(",
"$",
"value",
",",
"$",
"encoded",
"=",
"false",
",",
"$",
"firstLine",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^'",
".",
"self",
"::",
"TOKEN_REGEX",
".",
"'$/D'",
",",
"$",
"... | Returns the parameter value from the "=" and beyond.
@param string $value to append
@param bool $encoded
@param bool $firstLine
@return string | [
"Returns",
"the",
"parameter",
"value",
"from",
"the",
"=",
"and",
"beyond",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php#L239-L254 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php | Swift_Transport_Esmtp_Auth_CramMd5Authenticator.getResponse | private function getResponse($secret, $challenge)
{
if (strlen($secret) > 64) {
$secret = pack('H32', md5($secret));
}
if (strlen($secret) < 64) {
$secret = str_pad($secret, 64, chr(0));
}
$k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);... | php | private function getResponse($secret, $challenge)
{
if (strlen($secret) > 64) {
$secret = pack('H32', md5($secret));
}
if (strlen($secret) < 64) {
$secret = str_pad($secret, 64, chr(0));
}
$k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);... | [
"private",
"function",
"getResponse",
"(",
"$",
"secret",
",",
"$",
"challenge",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"secret",
")",
">",
"64",
")",
"{",
"$",
"secret",
"=",
"pack",
"(",
"'H32'",
",",
"md5",
"(",
"$",
"secret",
")",
")",
";",... | Generate a CRAM-MD5 response from a server challenge.
@param string $secret
@param string $challenge
@return string | [
"Generate",
"a",
"CRAM",
"-",
"MD5",
"response",
"from",
"a",
"server",
"challenge",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php#L57-L74 | train |
swiftmailer/swiftmailer | lib/classes/Swift/CharacterStream/NgCharacterStream.php | Swift_CharacterStream_NgCharacterStream.setCharacterSet | public function setCharacterSet($charset)
{
$this->charset = $charset;
$this->charReader = null;
$this->mapType = 0;
} | php | public function setCharacterSet($charset)
{
$this->charset = $charset;
$this->charReader = null;
$this->mapType = 0;
} | [
"public",
"function",
"setCharacterSet",
"(",
"$",
"charset",
")",
"{",
"$",
"this",
"->",
"charset",
"=",
"$",
"charset",
";",
"$",
"this",
"->",
"charReader",
"=",
"null",
";",
"$",
"this",
"->",
"mapType",
"=",
"0",
";",
"}"
] | Set the character set used in this CharacterStream.
@param string $charset | [
"Set",
"the",
"character",
"set",
"used",
"in",
"this",
"CharacterStream",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/CharacterStream/NgCharacterStream.php#L99-L104 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/AuthHandler.php | Swift_Transport_Esmtp_AuthHandler.afterEhlo | public function afterEhlo(Swift_Transport_SmtpAgent $agent)
{
if ($this->username) {
$count = 0;
$errors = [];
foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower... | php | public function afterEhlo(Swift_Transport_SmtpAgent $agent)
{
if ($this->username) {
$count = 0;
$errors = [];
foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower... | [
"public",
"function",
"afterEhlo",
"(",
"Swift_Transport_SmtpAgent",
"$",
"agent",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"username",
")",
"{",
"$",
"count",
"=",
"0",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAu... | Runs immediately after a EHLO has been issued.
@param Swift_Transport_SmtpAgent $agent to read/write | [
"Runs",
"immediately",
"after",
"a",
"EHLO",
"has",
"been",
"issued",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/AuthHandler.php#L168-L193 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/AuthHandler.php | Swift_Transport_Esmtp_AuthHandler.getAuthenticatorsForAgent | protected function getAuthenticatorsForAgent()
{
if (!$mode = strtolower($this->auth_mode)) {
return $this->authenticators;
}
foreach ($this->authenticators as $authenticator) {
if (strtolower($authenticator->getAuthKeyword()) == $mode) {
return [$aut... | php | protected function getAuthenticatorsForAgent()
{
if (!$mode = strtolower($this->auth_mode)) {
return $this->authenticators;
}
foreach ($this->authenticators as $authenticator) {
if (strtolower($authenticator->getAuthKeyword()) == $mode) {
return [$aut... | [
"protected",
"function",
"getAuthenticatorsForAgent",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"mode",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"auth_mode",
")",
")",
"{",
"return",
"$",
"this",
"->",
"authenticators",
";",
"}",
"foreach",
"(",
"$",
"this",... | Returns the authenticator list for the given agent.
@return array | [
"Returns",
"the",
"authenticator",
"list",
"for",
"the",
"given",
"agent",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/AuthHandler.php#L254-L267 | train |
swiftmailer/swiftmailer | lib/classes/Swift/FileSpool.php | Swift_FileSpool.queueMessage | public function queueMessage(Swift_Mime_SimpleMessage $message)
{
$ser = serialize($message);
$fileName = $this->path.'/'.$this->getRandomString(10);
for ($i = 0; $i < $this->retryLimit; ++$i) {
/* We try an exclusive creation of the file. This is an atomic operation, it avoid lo... | php | public function queueMessage(Swift_Mime_SimpleMessage $message)
{
$ser = serialize($message);
$fileName = $this->path.'/'.$this->getRandomString(10);
for ($i = 0; $i < $this->retryLimit; ++$i) {
/* We try an exclusive creation of the file. This is an atomic operation, it avoid lo... | [
"public",
"function",
"queueMessage",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"$",
"ser",
"=",
"serialize",
"(",
"$",
"message",
")",
";",
"$",
"fileName",
"=",
"$",
"this",
"->",
"path",
".",
"'/'",
".",
"$",
"this",
"->",
"getRandomS... | Queues a message.
@param Swift_Mime_SimpleMessage $message The message to store
@throws Swift_IoException
@return bool | [
"Queues",
"a",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/FileSpool.php#L92-L112 | train |
swiftmailer/swiftmailer | lib/classes/Swift/FileSpool.php | Swift_FileSpool.recover | public function recover($timeout = 900)
{
foreach (new DirectoryIterator($this->path) as $file) {
$file = $file->getRealPath();
if ('.message.sending' == substr($file, -16)) {
$lockedtime = filectime($file);
if ((time() - $lockedtime) > $timeout) {
... | php | public function recover($timeout = 900)
{
foreach (new DirectoryIterator($this->path) as $file) {
$file = $file->getRealPath();
if ('.message.sending' == substr($file, -16)) {
$lockedtime = filectime($file);
if ((time() - $lockedtime) > $timeout) {
... | [
"public",
"function",
"recover",
"(",
"$",
"timeout",
"=",
"900",
")",
"{",
"foreach",
"(",
"new",
"DirectoryIterator",
"(",
"$",
"this",
"->",
"path",
")",
"as",
"$",
"file",
")",
"{",
"$",
"file",
"=",
"$",
"file",
"->",
"getRealPath",
"(",
")",
... | Execute a recovery if for any reason a process is sending for too long.
@param int $timeout in second Defaults is for very slow smtp responses | [
"Execute",
"a",
"recovery",
"if",
"for",
"any",
"reason",
"a",
"process",
"is",
"sending",
"for",
"too",
"long",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/FileSpool.php#L119-L131 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Attachment.php | Swift_Mime_Attachment.setDisposition | public function setDisposition($disposition)
{
if (!$this->setHeaderFieldModel('Content-Disposition', $disposition)) {
$this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
}
return $this;
} | php | public function setDisposition($disposition)
{
if (!$this->setHeaderFieldModel('Content-Disposition', $disposition)) {
$this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
}
return $this;
} | [
"public",
"function",
"setDisposition",
"(",
"$",
"disposition",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setHeaderFieldModel",
"(",
"'Content-Disposition'",
",",
"$",
"disposition",
")",
")",
"{",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"->",
"add... | Set the Content-Disposition of this attachment.
@param string $disposition
@return $this | [
"Set",
"the",
"Content",
"-",
"Disposition",
"of",
"this",
"attachment",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Attachment.php#L65-L72 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Attachment.php | Swift_Mime_Attachment.setFile | public function setFile(Swift_FileStream $file, $contentType = null)
{
$this->setFilename(basename($file->getPath()));
$this->setBody($file, $contentType);
if (!isset($contentType)) {
$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
... | php | public function setFile(Swift_FileStream $file, $contentType = null)
{
$this->setFilename(basename($file->getPath()));
$this->setBody($file, $contentType);
if (!isset($contentType)) {
$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
... | [
"public",
"function",
"setFile",
"(",
"Swift_FileStream",
"$",
"file",
",",
"$",
"contentType",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setFilename",
"(",
"basename",
"(",
"$",
"file",
"->",
"getPath",
"(",
")",
")",
")",
";",
"$",
"this",
"->",
"... | Set the file that this attachment is for.
@param string $contentType optional
@return $this | [
"Set",
"the",
"file",
"that",
"this",
"attachment",
"is",
"for",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Attachment.php#L130-L143 | train |
swiftmailer/swiftmailer | lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php | Swift_CharacterReaderFactory_SimpleCharacterReaderFactory.getReaderFor | public function getReaderFor($charset)
{
$charset = strtolower(trim($charset));
foreach (self::$map as $pattern => $spec) {
$re = '/^'.$pattern.'$/D';
if (preg_match($re, $charset)) {
if (!array_key_exists($pattern, self::$loaded)) {
$refle... | php | public function getReaderFor($charset)
{
$charset = strtolower(trim($charset));
foreach (self::$map as $pattern => $spec) {
$re = '/^'.$pattern.'$/D';
if (preg_match($re, $charset)) {
if (!array_key_exists($pattern, self::$loaded)) {
$refle... | [
"public",
"function",
"getReaderFor",
"(",
"$",
"charset",
")",
"{",
"$",
"charset",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"charset",
")",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"map",
"as",
"$",
"pattern",
"=>",
"$",
"spec",
")",
"{",
"$... | Returns a CharacterReader suitable for the charset applied.
@param string $charset
@return Swift_CharacterReader | [
"Returns",
"a",
"CharacterReader",
"suitable",
"for",
"the",
"charset",
"applied",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php#L104-L123 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/StreamBuffer.php | Swift_Transport_StreamBuffer.terminate | public function terminate()
{
if (isset($this->stream)) {
switch ($this->params['type']) {
case self::TYPE_PROCESS:
fclose($this->in);
fclose($this->out);
proc_close($this->stream);
break;
... | php | public function terminate()
{
if (isset($this->stream)) {
switch ($this->params['type']) {
case self::TYPE_PROCESS:
fclose($this->in);
fclose($this->out);
proc_close($this->stream);
break;
... | [
"public",
"function",
"terminate",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"stream",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"params",
"[",
"'type'",
"]",
")",
"{",
"case",
"self",
"::",
"TYPE_PROCESS",
":",
"fclose",
"(... | Perform any shutdown logic needed. | [
"Perform",
"any",
"shutdown",
"logic",
"needed",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/StreamBuffer.php#L100-L118 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/StreamBuffer.php | Swift_Transport_StreamBuffer.setWriteTranslations | public function setWriteTranslations(array $replacements)
{
foreach ($this->translations as $search => $replace) {
if (!isset($replacements[$search])) {
$this->removeFilter($search);
unset($this->translations[$search]);
}
}
foreach ($r... | php | public function setWriteTranslations(array $replacements)
{
foreach ($this->translations as $search => $replace) {
if (!isset($replacements[$search])) {
$this->removeFilter($search);
unset($this->translations[$search]);
}
}
foreach ($r... | [
"public",
"function",
"setWriteTranslations",
"(",
"array",
"$",
"replacements",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"translations",
"as",
"$",
"search",
"=>",
"$",
"replace",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"replacements",
"[",
"$"... | Set an array of string replacements which should be made on data written
to the buffer.
This could replace LF with CRLF for example.
@param string[] $replacements | [
"Set",
"an",
"array",
"of",
"string",
"replacements",
"which",
"should",
"be",
"made",
"on",
"data",
"written",
"to",
"the",
"buffer",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/StreamBuffer.php#L128-L145 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/StreamBuffer.php | Swift_Transport_StreamBuffer.doCommit | protected function doCommit($bytes)
{
if (isset($this->in)) {
$bytesToWrite = strlen($bytes);
$totalBytesWritten = 0;
while ($totalBytesWritten < $bytesToWrite) {
$bytesWritten = fwrite($this->in, substr($bytes, $totalBytesWritten));
if (f... | php | protected function doCommit($bytes)
{
if (isset($this->in)) {
$bytesToWrite = strlen($bytes);
$totalBytesWritten = 0;
while ($totalBytesWritten < $bytesToWrite) {
$bytesWritten = fwrite($this->in, substr($bytes, $totalBytesWritten));
if (f... | [
"protected",
"function",
"doCommit",
"(",
"$",
"bytes",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"in",
")",
")",
"{",
"$",
"bytesToWrite",
"=",
"strlen",
"(",
"$",
"bytes",
")",
";",
"$",
"totalBytesWritten",
"=",
"0",
";",
"while",
"(... | Write this bytes to the stream | [
"Write",
"this",
"bytes",
"to",
"the",
"stream"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/StreamBuffer.php#L224-L243 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.