repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
evias/nem-php | src/Models/MosaicLevy.php | MosaicLevy.serialize | public function serialize($parameters = null)
{
// shortcuts
$serializer = $this->getSerializer();
$nisData = $this->toDTO();
if (empty($nisData)) {
$emptyLevy = $serializer->serializeInt(0);
return $emptyLevy;
}
// serialize
$type = ... | php | public function serialize($parameters = null)
{
// shortcuts
$serializer = $this->getSerializer();
$nisData = $this->toDTO();
if (empty($nisData)) {
$emptyLevy = $serializer->serializeInt(0);
return $emptyLevy;
}
// serialize
$type = ... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"// shortcuts",
"$",
"serializer",
"=",
"$",
"this",
"->",
"getSerializer",
"(",
")",
";",
"$",
"nisData",
"=",
"$",
"this",
"->",
"toDTO",
"(",
")",
";",
"if",
"(",
"e... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *Mosaic Levy* serialization.
@see \NEM\Contracts\Serializable
@param null|string $parameters non-null will return only the named sub-dtos.
@return array Returns a byte-array with values in UInt8 representation. | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"Mosaic",
"Levy",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicLevy.php#L98-L118 |
evias/nem-php | src/Core/Serializer.php | Serializer.serialize | public function serialize(/*mixed*/ $data)
{
if (null === $data) {
return $this->serializeInt(null);
}
elseif (is_array($data)) {
return $this->serializeUInt8($data);
}
elseif (is_integer($data)) {
return $this->serializeLong($data);
... | php | public function serialize(/*mixed*/ $data)
{
if (null === $data) {
return $this->serializeInt(null);
}
elseif (is_array($data)) {
return $this->serializeUInt8($data);
}
elseif (is_integer($data)) {
return $this->serializeLong($data);
... | [
"public",
"function",
"serialize",
"(",
"/*mixed*/",
"$",
"data",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"serializeInt",
"(",
"null",
")",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"data",
")",
... | Serialize any input for the NEM network.
@param array|string|integer|\NEM\Core\Serializer $data
@return array Returns a byte-array with values in UInt8 representation.
@throws RuntimeException On unrecognized `data` argument. | [
"Serialize",
"any",
"input",
"for",
"the",
"NEM",
"network",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L95-L114 |
evias/nem-php | src/Core/Serializer.php | Serializer.serializeInt | public function serializeInt(int $number = null)
{
if (null === $number) {
return $this->serializeInt(self::NULL_SENTINEL);
}
else {
$uint8 = [
$number & 0xff,
($number >> 8) & 0xff,
($number >> 16) & 0xff,
... | php | public function serializeInt(int $number = null)
{
if (null === $number) {
return $this->serializeInt(self::NULL_SENTINEL);
}
else {
$uint8 = [
$number & 0xff,
($number >> 8) & 0xff,
($number >> 16) & 0xff,
... | [
"public",
"function",
"serializeInt",
"(",
"int",
"$",
"number",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"number",
")",
"{",
"return",
"$",
"this",
"->",
"serializeInt",
"(",
"self",
"::",
"NULL_SENTINEL",
")",
";",
"}",
"else",
"{",
"$... | Internal method to serialize a decimal number into a
Integer on 4 Bytes.
This method is used in all other serializeX methods and
should not be used directly from outside the NEM SDK.
@internal This method should not be used directly
@param integer $number
@return array Returns a byte-array with values i... | [
"Internal",
"method",
"to",
"serialize",
"a",
"decimal",
"number",
"into",
"a",
"Integer",
"on",
"4",
"Bytes",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L128-L143 |
evias/nem-php | src/Core/Serializer.php | Serializer.serializeString | public function serializeString(string $str = null)
{
if (null === $str) {
$uint8 = $this->serializeInt(null);
}
else {
// prepend size on 4 bytes
$count = strlen($str);
$uint8 = $this->serializeInt($count);
// UTF-8 to binary
... | php | public function serializeString(string $str = null)
{
if (null === $str) {
$uint8 = $this->serializeInt(null);
}
else {
// prepend size on 4 bytes
$count = strlen($str);
$uint8 = $this->serializeInt($count);
// UTF-8 to binary
... | [
"public",
"function",
"serializeString",
"(",
"string",
"$",
"str",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"str",
")",
"{",
"$",
"uint8",
"=",
"$",
"this",
"->",
"serializeInt",
"(",
"null",
")",
";",
"}",
"else",
"{",
"// prepend size... | Serialize string data. The serialized string will be prefixed
with a 4-bytes long Size field followed by the UInt8 representation
of the given `str`.
Takes in a string and returns an array of Unsigned Integers
on 8-bits.
@internal This method is used internally
@param string $str
@return array Returns a byt... | [
"Serialize",
"string",
"data",
".",
"The",
"serialized",
"string",
"will",
"be",
"prefixed",
"with",
"a",
"4",
"-",
"bytes",
"long",
"Size",
"field",
"followed",
"by",
"the",
"UInt8",
"representation",
"of",
"the",
"given",
"str",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L157-L175 |
evias/nem-php | src/Core/Serializer.php | Serializer.serializeUInt8 | public function serializeUInt8(array $uint8Str = null)
{
if (null === $uint8Str) {
$uint8 = $this->serializeInt(null);
}
else {
// prepend size on 4 bytes
$count = count($uint8Str);
$uint8 = $this->serializeInt($count);
for ($i = 0... | php | public function serializeUInt8(array $uint8Str = null)
{
if (null === $uint8Str) {
$uint8 = $this->serializeInt(null);
}
else {
// prepend size on 4 bytes
$count = count($uint8Str);
$uint8 = $this->serializeInt($count);
for ($i = 0... | [
"public",
"function",
"serializeUInt8",
"(",
"array",
"$",
"uint8Str",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"uint8Str",
")",
"{",
"$",
"uint8",
"=",
"$",
"this",
"->",
"serializeInt",
"(",
"null",
")",
";",
"}",
"else",
"{",
"// prep... | Serialize unsigned char data. The serialized string will be prefixed
with a 4-bytes long Size field followed by the given `str`.
Takes in a 8bit-string and returns an array of Unsigned Integers
on 8-bits.
@internal This method is used internally
@param string $str
@return array Returns a byte-array with val... | [
"Serialize",
"unsigned",
"char",
"data",
".",
"The",
"serialized",
"string",
"will",
"be",
"prefixed",
"with",
"a",
"4",
"-",
"bytes",
"long",
"Size",
"field",
"followed",
"by",
"the",
"given",
"str",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L188-L204 |
evias/nem-php | src/Core/Serializer.php | Serializer.serializeLong | public function serializeLong(int $long = null)
{
if (null === $long) {
// long on 8 bytes always
$uint8 = array_merge($this->serializeInt(null), $this->serializeInt(0));
}
else {
// prepend size on 4 bytes
$uint64L = $this->serializeInt($long)... | php | public function serializeLong(int $long = null)
{
if (null === $long) {
// long on 8 bytes always
$uint8 = array_merge($this->serializeInt(null), $this->serializeInt(0));
}
else {
// prepend size on 4 bytes
$uint64L = $this->serializeInt($long)... | [
"public",
"function",
"serializeLong",
"(",
"int",
"$",
"long",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"long",
")",
"{",
"// long on 8 bytes always",
"$",
"uint8",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"serializeInt",
"(",
"null",
")... | Serialize UInt64 numbers. This corresponds to the `long` variable type
in C.
@param integer $long
@return array | [
"Serialize",
"UInt64",
"numbers",
".",
"This",
"corresponds",
"to",
"the",
"long",
"variable",
"type",
"in",
"C",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L213-L236 |
evias/nem-php | src/Core/Serializer.php | Serializer.aggregate | public function aggregate(/* [array $uint8_1, array $uint8_2, ...] */)
{
// read dynamic arguments
$count = func_num_args();
if (! $count) {
return [];
}
// interpret dynamic arguments and concatenate
// byte arrays into one aggregated byte array `concat`... | php | public function aggregate(/* [array $uint8_1, array $uint8_2, ...] */)
{
// read dynamic arguments
$count = func_num_args();
if (! $count) {
return [];
}
// interpret dynamic arguments and concatenate
// byte arrays into one aggregated byte array `concat`... | [
"public",
"function",
"aggregate",
"(",
"/* [array $uint8_1, array $uint8_2, ...] */",
")",
"{",
"// read dynamic arguments",
"$",
"count",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"!",
"$",
"count",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// interpret d... | This method lets you aggregate multiple serialized
byte arrays.
It will also prepend a size on 4 bytes representing
the *count of the merged/aggregated byte arrays*.
This method accepts *any* count of array arguments.
The passed array must contain UInt8 representation
of bytes (see serializeX methods).
@param arra... | [
"This",
"method",
"lets",
"you",
"aggregate",
"multiple",
"serialized",
"byte",
"arrays",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Serializer.php#L254-L283 |
evias/nem-php | src/Models/Account.php | Account.toDTO | public function toDTO($filterByKey = null)
{
$toDTO = [
"account" => [
"address" => $this->address()->toClean(),
"balance" => $this->balance()->toMicro(),
"vestedBalance" => $this->vestedBalance()->toMicro(),
"importance" => $this->... | php | public function toDTO($filterByKey = null)
{
$toDTO = [
"account" => [
"address" => $this->address()->toClean(),
"balance" => $this->balance()->toMicro(),
"vestedBalance" => $this->vestedBalance()->toMicro(),
"importance" => $this->... | [
"public",
"function",
"toDTO",
"(",
"$",
"filterByKey",
"=",
"null",
")",
"{",
"$",
"toDTO",
"=",
"[",
"\"account\"",
"=>",
"[",
"\"address\"",
"=>",
"$",
"this",
"->",
"address",
"(",
")",
"->",
"toClean",
"(",
")",
",",
"\"balance\"",
"=>",
"$",
"t... | Account DTO represents NIS API's [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair).
@see [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair)
@return array Associative array containing a NIS *compliable* account representation. | [
"Account",
"DTO",
"represents",
"NIS",
"API",
"s",
"[",
"AccountMetaDataPair",
"]",
"(",
"https",
":",
"//",
"bob",
".",
"nem",
".",
"ninja",
"/",
"docs",
"/",
"#accountMetaDataPair",
")",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Account.php#L76-L101 |
evias/nem-php | src/Models/Account.php | Account.cosignatoryOf | public function cosignatoryOf(array $data = null)
{
$multisigs = $data ?: $this->getAttribute("cosignatoryOf") ?: [];
return (new CollectionMutator())->mutate("account", $multisigs);
} | php | public function cosignatoryOf(array $data = null)
{
$multisigs = $data ?: $this->getAttribute("cosignatoryOf") ?: [];
return (new CollectionMutator())->mutate("account", $multisigs);
} | [
"public",
"function",
"cosignatoryOf",
"(",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"multisigs",
"=",
"$",
"data",
"?",
":",
"$",
"this",
"->",
"getAttribute",
"(",
"\"cosignatoryOf\"",
")",
"?",
":",
"[",
"]",
";",
"return",
"(",
"new",
"C... | Mutator for the cosignatoryOf object collection.
@return \NEM\Models\ModelCollection | [
"Mutator",
"for",
"the",
"cosignatoryOf",
"object",
"collection",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Account.php#L148-L152 |
evias/nem-php | src/Models/Account.php | Account.cosignatories | public function cosignatories(array $data = null)
{
$cosignatories = $data ?: $this->getAttribute("cosignatories") ?: [];
return (new CollectionMutator())->mutate("account", $cosignatories);
} | php | public function cosignatories(array $data = null)
{
$cosignatories = $data ?: $this->getAttribute("cosignatories") ?: [];
return (new CollectionMutator())->mutate("account", $cosignatories);
} | [
"public",
"function",
"cosignatories",
"(",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"cosignatories",
"=",
"$",
"data",
"?",
":",
"$",
"this",
"->",
"getAttribute",
"(",
"\"cosignatories\"",
")",
"?",
":",
"[",
"]",
";",
"return",
"(",
"new",
... | Mutator for the cosignatories object collection.
@return \NEM\Models\ModelCollection | [
"Mutator",
"for",
"the",
"cosignatories",
"object",
"collection",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Account.php#L159-L163 |
evias/nem-php | src/Core/KeccakHasher.php | KeccakHasher.hash | static public function hash($algorithm, $data, $raw_output = false)
{
$hashBits = self::getHashBitLength($algorithm);
return Keccak::hash($data, (int) $hashBits, (bool) $raw_output);
} | php | static public function hash($algorithm, $data, $raw_output = false)
{
$hashBits = self::getHashBitLength($algorithm);
return Keccak::hash($data, (int) $hashBits, (bool) $raw_output);
} | [
"static",
"public",
"function",
"hash",
"(",
"$",
"algorithm",
",",
"$",
"data",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"$",
"hashBits",
"=",
"self",
"::",
"getHashBitLength",
"(",
"$",
"algorithm",
")",
";",
"return",
"Keccak",
"::",
"hash",
... | Non-Incremental Keccak Hash implementation.
@param null|string|integer $algorithm The hashing algorithm or Hash Bit Length.
@param string|\NEM\Core\Buffer $data The data that needs to be hashed.
@param boolean $raw_output Whether to return raw data or a Hexadecimal hash.
@r... | [
"Non",
"-",
"Incremental",
"Keccak",
"Hash",
"implementation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeccakHasher.php#L72-L76 |
evias/nem-php | src/Core/KeccakHasher.php | KeccakHasher.getHashBitLength | static public function getHashBitLength($algorithm = null)
{
if (!$algorithm) {
return self::HASH_BIT_LENGTH;
}
if (is_integer($algorithm)) {
// direct hash-bit-length provided
return (int) $algorithm;
}
elseif (strpos(strtolower($algorith... | php | static public function getHashBitLength($algorithm = null)
{
if (!$algorithm) {
return self::HASH_BIT_LENGTH;
}
if (is_integer($algorithm)) {
// direct hash-bit-length provided
return (int) $algorithm;
}
elseif (strpos(strtolower($algorith... | [
"static",
"public",
"function",
"getHashBitLength",
"(",
"$",
"algorithm",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"algorithm",
")",
"{",
"return",
"self",
"::",
"HASH_BIT_LENGTH",
";",
"}",
"if",
"(",
"is_integer",
"(",
"$",
"algorithm",
")",
")",
... | Helper function used to determine each hash's Bits length
by a given `algorithm`.
The `algorithm` parameter can be a integer directly and should
then represent a Bits Length for generated Hashes.
@param null|string|integer $algorithm The hashing algorithm or Hashes' Bits Length.
@return integer | [
"Helper",
"function",
"used",
"to",
"determine",
"each",
"hash",
"s",
"Bits",
"length",
"by",
"a",
"given",
"algorithm",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeccakHasher.php#L88-L108 |
evias/nem-php | src/Mosaics/Template.php | Template.properties | public function properties(array $properties = null)
{
$data = [
new MosaicProperty(["name" => "divisibility", "value" => $this->divisibility]),
new MosaicProperty(["name" => "initialSupply", "value" => $this->initialSupply]),
new MosaicProperty(["name" => "supplyMutable"... | php | public function properties(array $properties = null)
{
$data = [
new MosaicProperty(["name" => "divisibility", "value" => $this->divisibility]),
new MosaicProperty(["name" => "initialSupply", "value" => $this->initialSupply]),
new MosaicProperty(["name" => "supplyMutable"... | [
"public",
"function",
"properties",
"(",
"array",
"$",
"properties",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"new",
"MosaicProperty",
"(",
"[",
"\"name\"",
"=>",
"\"divisibility\"",
",",
"\"value\"",
"=>",
"$",
"this",
"->",
"divisibility",
"]",
")",... | Mutator for `properties` relation.
This will return a NIS compliant collection of [MosaicProperties](https://bob.nem.ninja/docs/#mosaicProperties) object.
@param array $properties Array of MosaicProperty instances
@return \NEM\Models\MosaicProperties | [
"Mutator",
"for",
"properties",
"relation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Mosaics/Template.php#L96-L106 |
evias/nem-php | src/Traits/Connectable.php | Connectable.setProtocol | public function setProtocol($protocol)
{
$lowerProtocol = strtolower($protocol);
// handle special cases where protocol is not
// formatted as intended yet.
if ("websocket" == $lowerProtocol)
$lowerProtocol = "ws";
if (in_array($lowerProtocol, ["https", "wss"])... | php | public function setProtocol($protocol)
{
$lowerProtocol = strtolower($protocol);
// handle special cases where protocol is not
// formatted as intended yet.
if ("websocket" == $lowerProtocol)
$lowerProtocol = "ws";
if (in_array($lowerProtocol, ["https", "wss"])... | [
"public",
"function",
"setProtocol",
"(",
"$",
"protocol",
")",
"{",
"$",
"lowerProtocol",
"=",
"strtolower",
"(",
"$",
"protocol",
")",
";",
"// handle special cases where protocol is not",
"// formatted as intended yet.",
"if",
"(",
"\"websocket\"",
"==",
"$",
"lowe... | This method should implement a protocol
setter which will be used to determine
which Protocol is used in the Base URL.
@param string $protocol
@return \NEM\Contracts\HttpHandler | [
"This",
"method",
"should",
"implement",
"a",
"protocol",
"setter",
"which",
"will",
"be",
"used",
"to",
"determine",
"which",
"Protocol",
"is",
"used",
"in",
"the",
"Base",
"URL",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Traits/Connectable.php#L113-L131 |
evias/nem-php | src/Traits/Connectable.php | Connectable.getBasicAuth | public function getBasicAuth()
{
if (empty($this->basicAuth))
return "";
if (empty($this->basicAuth["username"]))
// Username cannot be empty in Basic Authentication
return "";
$username = $this->basicAuth["username"];
$password = isset($this->ba... | php | public function getBasicAuth()
{
if (empty($this->basicAuth))
return "";
if (empty($this->basicAuth["username"]))
// Username cannot be empty in Basic Authentication
return "";
$username = $this->basicAuth["username"];
$password = isset($this->ba... | [
"public",
"function",
"getBasicAuth",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"basicAuth",
")",
")",
"return",
"\"\"",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"basicAuth",
"[",
"\"username\"",
"]",
")",
")",
"// Username can... | This method returns the username:password@ format
string to perform Basic Authentication using the
URL.
@return [type] [description] | [
"This",
"method",
"returns",
"the",
"username",
":",
"password@",
"format",
"string",
"to",
"perform",
"Basic",
"Authentication",
"using",
"the",
"URL",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Traits/Connectable.php#L276-L288 |
evias/nem-php | src/Traits/Connectable.php | Connectable.getBaseUrl | public function getBaseUrl()
{
return $this->getScheme() . $this->getBasicAuth() . $this->getHost() . ":" . $this->getPort() . $this->getEndpoint();
} | php | public function getBaseUrl()
{
return $this->getScheme() . $this->getBasicAuth() . $this->getHost() . ":" . $this->getPort() . $this->getEndpoint();
} | [
"public",
"function",
"getBaseUrl",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getScheme",
"(",
")",
".",
"$",
"this",
"->",
"getBasicAuth",
"(",
")",
".",
"$",
"this",
"->",
"getHost",
"(",
")",
".",
"\":\"",
".",
"$",
"this",
"->",
"getPort",
"... | Getter for `base_url` property.
@return string | [
"Getter",
"for",
"base_url",
"property",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Traits/Connectable.php#L295-L298 |
evias/nem-php | src/Traits/Connectable.php | Connectable.fillFromBaseUrl | public function fillFromBaseUrl($baseUrl)
{
$reg = "/^(https?):\/\/((www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})(:([0-9]+))?/";
$matches = [];
$scheme = "http";
$host = "hugealice.nem.ninja";
$port = 7890;
if ((bool) preg_match_all($reg, $baseUrl, $matches)... | php | public function fillFromBaseUrl($baseUrl)
{
$reg = "/^(https?):\/\/((www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})(:([0-9]+))?/";
$matches = [];
$scheme = "http";
$host = "hugealice.nem.ninja";
$port = 7890;
if ((bool) preg_match_all($reg, $baseUrl, $matches)... | [
"public",
"function",
"fillFromBaseUrl",
"(",
"$",
"baseUrl",
")",
"{",
"$",
"reg",
"=",
"\"/^(https?):\\/\\/((www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6})(:([0-9]+))?/\"",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"scheme",
"=",
"\"http\"",
";",
"$",
"h... | Helper class method to create a Connectabl object from
a fully qualified base url.
@param string $baseUrl
@return \NEM\Traits\Connectable | [
"Helper",
"class",
"method",
"to",
"create",
"a",
"Connectabl",
"object",
"from",
"a",
"fully",
"qualified",
"base",
"url",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Traits/Connectable.php#L316-L335 |
evias/nem-php | src/Infrastructure/ConnectionPool.php | ConnectionPool.getEndpoint | public function getEndpoint($forceNew = false)
{
$index = $forceNew === true ? ++$this->poolIndex : $this->poolIndex;
if ($index == count($this->nodes)) {
$index = 0;
}
if (!isset($this->endpoints[$this->network][$index])) {
$api = new API([
"... | php | public function getEndpoint($forceNew = false)
{
$index = $forceNew === true ? ++$this->poolIndex : $this->poolIndex;
if ($index == count($this->nodes)) {
$index = 0;
}
if (!isset($this->endpoints[$this->network][$index])) {
$api = new API([
"... | [
"public",
"function",
"getEndpoint",
"(",
"$",
"forceNew",
"=",
"false",
")",
"{",
"$",
"index",
"=",
"$",
"forceNew",
"===",
"true",
"?",
"++",
"$",
"this",
"->",
"poolIndex",
":",
"$",
"this",
"->",
"poolIndex",
";",
"if",
"(",
"$",
"index",
"==",
... | Get a connected API using the NEM node configured
at the current `poolIndex`
@param boolean $forceNew
@return \NEM\API | [
"Get",
"a",
"connected",
"API",
"using",
"the",
"NEM",
"node",
"configured",
"at",
"the",
"current",
"poolIndex"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/ConnectionPool.php#L102-L123 |
evias/nem-php | src/Core/Encoder.php | Encoder.hex2bin | public function hex2bin($hex)
{
$binLen = ceil(mb_strlen($hex) / 2);
// size validation while creating
$buffer = Buffer::fromHex($hex, $binLen);
return $buffer->getBinary();
} | php | public function hex2bin($hex)
{
$binLen = ceil(mb_strlen($hex) / 2);
// size validation while creating
$buffer = Buffer::fromHex($hex, $binLen);
return $buffer->getBinary();
} | [
"public",
"function",
"hex2bin",
"(",
"$",
"hex",
")",
"{",
"$",
"binLen",
"=",
"ceil",
"(",
"mb_strlen",
"(",
"$",
"hex",
")",
"/",
"2",
")",
";",
"// size validation while creating",
"$",
"buffer",
"=",
"Buffer",
"::",
"fromHex",
"(",
"$",
"hex",
","... | Encode a Hexadecimal string to corresponding string characters
using the Buffer class as a backbone.
@param string $hex
@return string | [
"Encode",
"a",
"Hexadecimal",
"string",
"to",
"corresponding",
"string",
"characters",
"using",
"the",
"Buffer",
"class",
"as",
"a",
"backbone",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encoder.php#L44-L51 |
evias/nem-php | src/Core/Encoder.php | Encoder.ua2bin | public function ua2bin(array $uint8)
{
$bin = "";
foreach ($uint8 as $ix => $char) {
$buf = Buffer::fromInt($char, 1);
$bin .= $buf->getBinary();
}
$buffer = new Buffer($bin);
return $buffer->getBinary();
} | php | public function ua2bin(array $uint8)
{
$bin = "";
foreach ($uint8 as $ix => $char) {
$buf = Buffer::fromInt($char, 1);
$bin .= $buf->getBinary();
}
$buffer = new Buffer($bin);
return $buffer->getBinary();
} | [
"public",
"function",
"ua2bin",
"(",
"array",
"$",
"uint8",
")",
"{",
"$",
"bin",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"uint8",
"as",
"$",
"ix",
"=>",
"$",
"char",
")",
"{",
"$",
"buf",
"=",
"Buffer",
"::",
"fromInt",
"(",
"$",
"char",
",",
"... | Encode a UInt8 array to its bytes representation.
@param array $uint8 UInt8 array to convert to its bytes representation.
@return string Byte-level representation of the UInt8 array. | [
"Encode",
"a",
"UInt8",
"array",
"to",
"its",
"bytes",
"representation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encoder.php#L72-L82 |
evias/nem-php | src/Core/Encoder.php | Encoder.ua2words | public function ua2words(array $uint8)
{
$uint8 = $uint8;
$int32 = [];
// 4 bytes in a row ! => 4 times uint8 is an int32.
for ($i = 0, $bytes = count($uint8); $i < $bytes; $i += 4) {
$b1 = $uint8[$i];
$b2 = isset($uint8[$i+1]) ? $uint8[$i+1] : 0;
... | php | public function ua2words(array $uint8)
{
$uint8 = $uint8;
$int32 = [];
// 4 bytes in a row ! => 4 times uint8 is an int32.
for ($i = 0, $bytes = count($uint8); $i < $bytes; $i += 4) {
$b1 = $uint8[$i];
$b2 = isset($uint8[$i+1]) ? $uint8[$i+1] : 0;
... | [
"public",
"function",
"ua2words",
"(",
"array",
"$",
"uint8",
")",
"{",
"$",
"uint8",
"=",
"$",
"uint8",
";",
"$",
"int32",
"=",
"[",
"]",
";",
"// 4 bytes in a row ! => 4 times uint8 is an int32.",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"bytes",
"=",... | Convert a UInt8 array to a Int32 array (WordArray).
The returned array contains entries of type Int32.
@param array $uint8 UInt8 array to convert to Int32 array.
@return array Array of Int32 representations. | [
"Convert",
"a",
"UInt8",
"array",
"to",
"a",
"Int32",
"array",
"(",
"WordArray",
")",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encoder.php#L92-L115 |
evias/nem-php | src/Core/Encoder.php | Encoder.ua2hex | public function ua2hex(array $uint8)
{
$uint8 = $uint8 ?: $this->toUInt8();
$hex = "";
$enc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
for ($i = 0, $bytes = count($uint8); $i < $bytes; $i++) {
$code = $uint8[$i];
$hex ... | php | public function ua2hex(array $uint8)
{
$uint8 = $uint8 ?: $this->toUInt8();
$hex = "";
$enc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
for ($i = 0, $bytes = count($uint8); $i < $bytes; $i++) {
$code = $uint8[$i];
$hex ... | [
"public",
"function",
"ua2hex",
"(",
"array",
"$",
"uint8",
")",
"{",
"$",
"uint8",
"=",
"$",
"uint8",
"?",
":",
"$",
"this",
"->",
"toUInt8",
"(",
")",
";",
"$",
"hex",
"=",
"\"\"",
";",
"$",
"enc",
"=",
"[",
"'0'",
",",
"'1'",
",",
"'2'",
"... | Encode a UInt8 array (WordArray) to its hexadecimal representation.
@param array $uint8 UInt8 array to convert to Int32 array.
@return string Hexadecimal representation of the UInt8 array. | [
"Encode",
"a",
"UInt8",
"array",
"(",
"WordArray",
")",
"to",
"its",
"hexadecimal",
"representation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encoder.php#L123-L136 |
evias/nem-php | src/Models/Transaction/MultisigAggregateModification.php | MultisigAggregateModification.serialize | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->toDTO("transaction");
$network = $parameters ?: -104; // default testnet
// shortcuts
$serializer = $this->getSerializer();
$output = [];
$mapped... | php | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->toDTO("transaction");
$network = $parameters ?: -104; // default testnet
// shortcuts
$serializer = $this->getSerializer();
$output = [];
$mapped... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"baseTx",
"=",
"parent",
"::",
"serialize",
"(",
"$",
"parameters",
")",
";",
"$",
"nisData",
"=",
"$",
"this",
"->",
"toDTO",
"(",
"\"transaction\"",
")",
";",
"$",... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *MultisigAggregateModification* serialization.
This will sort multisig modifications contained in the transaction.
When the transaction is serialized, the multisig modifications
are sorted by type and lexicographically by address... | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"MultisigAggregateModification",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MultisigAggregateModification.php#L97-L182 |
evias/nem-php | src/Models/Transaction/MultisigAggregateModification.php | MultisigAggregateModification.minCosignatories | public function minCosignatories($minCosignatories = null)
{
$minCosignatories = $minCosignatories ?: $this->getAttribute("minCosignatories") ?: $this->relativeChange;
// "minCosignatories" can be used as direct attribute setter
if (is_integer($minCosignatories)) {
$relativeChan... | php | public function minCosignatories($minCosignatories = null)
{
$minCosignatories = $minCosignatories ?: $this->getAttribute("minCosignatories") ?: $this->relativeChange;
// "minCosignatories" can be used as direct attribute setter
if (is_integer($minCosignatories)) {
$relativeChan... | [
"public",
"function",
"minCosignatories",
"(",
"$",
"minCosignatories",
"=",
"null",
")",
"{",
"$",
"minCosignatories",
"=",
"$",
"minCosignatories",
"?",
":",
"$",
"this",
"->",
"getAttribute",
"(",
"\"minCosignatories\"",
")",
"?",
":",
"$",
"this",
"->",
... | Mutator for the modifications collection.
@return \NEM\Models\ModelCollection | [
"Mutator",
"for",
"the",
"modifications",
"collection",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MultisigAggregateModification.php#L227-L245 |
evias/nem-php | src/Models/Transaction/MosaicTransfer.php | MosaicTransfer.serialize | public function serialize($parameters = null)
{
// @see NEM\Models\Transaction\Transfer::serialize()
$baseTx = parent::serialize($parameters);
$nisData = $this->extend();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
// serialize spec... | php | public function serialize($parameters = null)
{
// @see NEM\Models\Transaction\Transfer::serialize()
$baseTx = parent::serialize($parameters);
$nisData = $this->extend();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
// serialize spec... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"// @see NEM\\Models\\Transaction\\Transfer::serialize()",
"$",
"baseTx",
"=",
"parent",
"::",
"serialize",
"(",
"$",
"parameters",
")",
";",
"$",
"nisData",
"=",
"$",
"this",
"->"... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *Transfer* serialization.
@see \NEM\Contracts\Serializable
@see \NEM\Models\Transaction\Transfer::serialize()
@param null|string $parameters non-null will return only the named sub-dtos.
@return array Returns a byte-array ... | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"Transfer",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MosaicTransfer.php#L63-L76 |
evias/nem-php | src/Models/Transaction/MosaicTransfer.php | MosaicTransfer.extend | public function extend()
{
$version = $this->getAttribute("version");
$twoByOld = [
Transaction::VERSION_1 => Transaction::VERSION_2,
Transaction::VERSION_1_TEST => Transaction::VERSION_2_TEST,
Transaction::VERSION_1_MIJIN => Transaction::VERSION_2_MIJIN,
... | php | public function extend()
{
$version = $this->getAttribute("version");
$twoByOld = [
Transaction::VERSION_1 => Transaction::VERSION_2,
Transaction::VERSION_1_TEST => Transaction::VERSION_2_TEST,
Transaction::VERSION_1_MIJIN => Transaction::VERSION_2_MIJIN,
... | [
"public",
"function",
"extend",
"(",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"\"version\"",
")",
";",
"$",
"twoByOld",
"=",
"[",
"Transaction",
"::",
"VERSION_1",
"=>",
"Transaction",
"::",
"VERSION_2",
",",
"Transaction",
":... | The MosaicTransfer transaction type adds the `mosaics` offset
to the Transaction DTO and also adds all fields defined in the
Transfer::extend() overload.
@return array | [
"The",
"MosaicTransfer",
"transaction",
"type",
"adds",
"the",
"mosaics",
"offset",
"to",
"the",
"Transaction",
"DTO",
"and",
"also",
"adds",
"all",
"fields",
"defined",
"in",
"the",
"Transfer",
"::",
"extend",
"()",
"overload",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MosaicTransfer.php#L85-L116 |
evias/nem-php | src/Models/Transaction/MosaicTransfer.php | MosaicTransfer.extendFee | public function extendFee()
{
// identify network
$address = $this->recipient()->address();
$networkId = 104;
if (!empty($address->toClean()))
$networkId = Network::fromAddress($address);
// load definitions for attached mosaics.
$definitions = MosaicDef... | php | public function extendFee()
{
// identify network
$address = $this->recipient()->address();
$networkId = 104;
if (!empty($address->toClean()))
$networkId = Network::fromAddress($address);
// load definitions for attached mosaics.
$definitions = MosaicDef... | [
"public",
"function",
"extendFee",
"(",
")",
"{",
"// identify network",
"$",
"address",
"=",
"$",
"this",
"->",
"recipient",
"(",
")",
"->",
"address",
"(",
")",
";",
"$",
"networkId",
"=",
"104",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"address",
"... | The extendFee() method must be overloaded by any Transaction Type
which needs to extend the base FEE to a custom FEE.
@return array | [
"The",
"extendFee",
"()",
"method",
"must",
"be",
"overloaded",
"by",
"any",
"Transaction",
"Type",
"which",
"needs",
"to",
"extend",
"the",
"base",
"FEE",
"to",
"a",
"custom",
"FEE",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MosaicTransfer.php#L124-L143 |
evias/nem-php | src/Models/Transaction/MosaicTransfer.php | MosaicTransfer.attachMosaic | public function attachMosaic($mosaic, $quantity = null)
{
$attachment = $this->prepareAttachment($mosaic);
$actualAmt = $attachment->quantity ?: $quantity ?: 0;
$attachment->setAttribute("quantity", $actualAmt);
// push to internal storage
$attachments = $this->getAttribute... | php | public function attachMosaic($mosaic, $quantity = null)
{
$attachment = $this->prepareAttachment($mosaic);
$actualAmt = $attachment->quantity ?: $quantity ?: 0;
$attachment->setAttribute("quantity", $actualAmt);
// push to internal storage
$attachments = $this->getAttribute... | [
"public",
"function",
"attachMosaic",
"(",
"$",
"mosaic",
",",
"$",
"quantity",
"=",
"null",
")",
"{",
"$",
"attachment",
"=",
"$",
"this",
"->",
"prepareAttachment",
"(",
"$",
"mosaic",
")",
";",
"$",
"actualAmt",
"=",
"$",
"attachment",
"->",
"quantity... | Helper to easily attach mosaics to the attachments.
@param string|\NEM\Models\Mosaic|\NEM\Models\MosaicAttachment $mosaic
@param null|integer $quantity
@return \NEM\Models\Transaction\MosaicTransfer | [
"Helper",
"to",
"easily",
"attach",
"mosaics",
"to",
"the",
"attachments",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MosaicTransfer.php#L166-L178 |
evias/nem-php | src/Models/Transaction/MosaicTransfer.php | MosaicTransfer.prepareAttachment | protected function prepareAttachment($mosaic)
{
if ($mosaic instanceof MosaicAttachment) {
return $mosaic;
}
elseif ($mosaic instanceof MosaicAttachments) {
return $mosaic->shift();
}
elseif ($mosaic instanceof Mosaic) {
return new MosaicAt... | php | protected function prepareAttachment($mosaic)
{
if ($mosaic instanceof MosaicAttachment) {
return $mosaic;
}
elseif ($mosaic instanceof MosaicAttachments) {
return $mosaic->shift();
}
elseif ($mosaic instanceof Mosaic) {
return new MosaicAt... | [
"protected",
"function",
"prepareAttachment",
"(",
"$",
"mosaic",
")",
"{",
"if",
"(",
"$",
"mosaic",
"instanceof",
"MosaicAttachment",
")",
"{",
"return",
"$",
"mosaic",
";",
"}",
"elseif",
"(",
"$",
"mosaic",
"instanceof",
"MosaicAttachments",
")",
"{",
"r... | Helper to prepare a MosaicAttachment object out of any one of string, | [
"Helper",
"to",
"prepare",
"a",
"MosaicAttachment",
"object",
"out",
"of",
"any",
"one",
"of",
"string"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/MosaicTransfer.php#L183-L202 |
evias/nem-php | src/Core/Signature.php | Signature.create | static public function create(KeyPair $kp, $data, $algorithm = 'keccak-512')
{
$sig = new static($privateKey, $publicKey, $algorithm);
return $sig;
} | php | static public function create(KeyPair $kp, $data, $algorithm = 'keccak-512')
{
$sig = new static($privateKey, $publicKey, $algorithm);
return $sig;
} | [
"static",
"public",
"function",
"create",
"(",
"KeyPair",
"$",
"kp",
",",
"$",
"data",
",",
"$",
"algorithm",
"=",
"'keccak-512'",
")",
"{",
"$",
"sig",
"=",
"new",
"static",
"(",
"$",
"privateKey",
",",
"$",
"publicKey",
",",
"$",
"algorithm",
")",
... | This method creates a Signature of said `data` with the
given `keyPair` KeyPair object.
@param \NEM\Core\KeyPair $keyPair The KeyPair object with which you want to sign `data`.
@param string|\NEM\Core\Buffer $data The data that needs to be signed.
@param null|string $algor... | [
"This",
"method",
"creates",
"a",
"Signature",
"of",
"said",
"data",
"with",
"the",
"given",
"keyPair",
"KeyPair",
"object",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Signature.php#L74-L78 |
evias/nem-php | src/Core/Signature.php | Signature.prepareData | protected function prepareData($data)
{
if ($data instanceof Buffer) {
$this->data = $data;
}
elseif (is_string($data)) {
$this->data = new Buffer($data); // auto-sized
}
elseif (is_array($data)) {
// Uint8 provided (serialized data)
... | php | protected function prepareData($data)
{
if ($data instanceof Buffer) {
$this->data = $data;
}
elseif (is_string($data)) {
$this->data = new Buffer($data); // auto-sized
}
elseif (is_array($data)) {
// Uint8 provided (serialized data)
... | [
"protected",
"function",
"prepareData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"Buffer",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
... | This method will prepare the given data and populate the
`data` property with a prepared and correctly sized Buffer.
@param string|\NEM\Core\Buffer $data The data that needs to be signed.
@return \NEM\Core\Signature
@throws \NEM\Errors\NISInvalidSignatureContent On invalid `data` argument. Should b... | [
"This",
"method",
"will",
"prepare",
"the",
"given",
"data",
"and",
"populate",
"the",
"data",
"property",
"with",
"a",
"prepared",
"and",
"correctly",
"sized",
"Buffer",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Signature.php#L127-L144 |
evias/nem-php | src/Infrastructure/Account.php | Account.generateAccount | public function generateAccount()
{
$params = [];
$apiUrl = $this->getPath('generate', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object); //XXX brr => error... | php | public function generateAccount()
{
$params = [];
$apiUrl = $this->getPath('generate', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object); //XXX brr => error... | [
"public",
"function",
"generateAccount",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'generate'",
",",
"$",
"params",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"get... | Let NIS generate an account KeyPair.
WARNING: This method can only be used on a locally running
NIS. It is preferred to use the \NEM\Core\KeyPair
class to create accounts on your machine rather than
let NIS create an account for you.
@internal This method only works with a locally running NIS.
@return object Ob... | [
"Let",
"NIS",
"generate",
"an",
"account",
"KeyPair",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L53-L62 |
evias/nem-php | src/Infrastructure/Account.php | Account.getFromAddress | public function getFromAddress($address)
{
$apiUrl = $this->getPath('get', ["address" => $address]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object);
} | php | public function getFromAddress($address)
{
$apiUrl = $this->getPath('get', ["address" => $address]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object);
} | [
"public",
"function",
"getFromAddress",
"(",
"$",
"address",
")",
"{",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'get'",
",",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",... | Gets an [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair) for an account
by its Base32 address representation (T-, N-, M- prefixed addresses).
@param string $address Base32 representation of the account address (T-, N-, M- prefixed addresses).
@return object Instance with keys ... | [
"Gets",
"an",
"[",
"AccountMetaDataPair",
"]",
"(",
"https",
":",
"//",
"bob",
".",
"nem",
".",
"ninja",
"/",
"docs",
"/",
"#accountMetaDataPair",
")",
"for",
"an",
"account",
"by",
"its",
"Base32",
"address",
"representation",
"(",
"T",
"-",
"N",
"-",
... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L71-L79 |
evias/nem-php | src/Infrastructure/Account.php | Account.getFromPublicKey | public function getFromPublicKey($publicKey)
{
$apiUrl = $this->getPath('get/from-public-key', ["publicKey" => $publicKey]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object)... | php | public function getFromPublicKey($publicKey)
{
$apiUrl = $this->getPath('get/from-public-key', ["publicKey" => $publicKey]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createAccountModel($object)... | [
"public",
"function",
"getFromPublicKey",
"(",
"$",
"publicKey",
")",
"{",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'get/from-public-key'",
",",
"[",
"\"publicKey\"",
"=>",
"$",
"publicKey",
"]",
")",
";",
"$",
"response",
"=",
"$",
"this",
... | Gets an [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair) for an account
by its public key hexadecimal representation.
@param string $publicKey Hexadecimal representation of the Public Key
@return object Instance with keys from [AccountMetaDataPair](https://bob.nem.ninja/docs/#ac... | [
"Gets",
"an",
"[",
"AccountMetaDataPair",
"]",
"(",
"https",
":",
"//",
"bob",
".",
"nem",
".",
"ninja",
"/",
"docs",
"/",
"#accountMetaDataPair",
")",
"for",
"an",
"account",
"by",
"its",
"public",
"key",
"hexadecimal",
"representation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L88-L96 |
evias/nem-php | src/Infrastructure/Account.php | Account.status | public function status($address)
{
$apiUrl = $this->getPath('status', ["address" => $address]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createBaseModel($object);
} | php | public function status($address)
{
$apiUrl = $this->getPath('status', ["address" => $address]);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createBaseModel($object);
} | [
"public",
"function",
"status",
"(",
"$",
"address",
")",
"{",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'status'",
",",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"g... | Gets the [AccountMetaData](https://bob.nem.ninja/docs/#accountMetaData) from an account.
@param string $address Base32 representation of the account address (T-, N-, M- prefixed addresses).
@return object Instance with keys from [AccountMetaData](https://bob.nem.ninja/docs/#accountMetaData) objects... | [
"Gets",
"the",
"[",
"AccountMetaData",
"]",
"(",
"https",
":",
"//",
"bob",
".",
"nem",
".",
"ninja",
"/",
"docs",
"/",
"#accountMetaData",
")",
"from",
"an",
"account",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L138-L146 |
evias/nem-php | src/Infrastructure/Account.php | Account.incomingTransactions | public function incomingTransactions($address, $hash = null, $id = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
if ($id !== null)
$params["id"] = $id;
$apiUrl = $this->getPath('transfers/incoming', $params);
... | php | public function incomingTransactions($address, $hash = null, $id = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
if ($id !== null)
$params["id"] = $id;
$apiUrl = $this->getPath('transfers/incoming', $params);
... | [
"public",
"function",
"incomingTransactions",
"(",
"$",
"address",
",",
"$",
"hash",
"=",
"null",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"if",
"(",
"$",
"hash",
"!==",
"null",
... | A transaction is said to be incoming with respect to an account if the account is the recipient of the
transaction. In the same way outgoing transaction are the transactions where the account is the sender of the
transaction. Unconfirmed transactions are those transactions that have not yet been included in a block.
Un... | [
"A",
"transaction",
"is",
"said",
"to",
"be",
"incoming",
"with",
"respect",
"to",
"an",
"account",
"if",
"the",
"account",
"is",
"the",
"recipient",
"of",
"the",
"transaction",
".",
"In",
"the",
"same",
"way",
"outgoing",
"transaction",
"are",
"the",
"tra... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L159-L175 |
evias/nem-php | src/Infrastructure/Account.php | Account.unconfirmedTransactions | public function unconfirmedTransactions($address, $hash = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
$apiUrl = $this->getPath('unconfirmedTransactions', $params);
$response = $this->api->getJSON($apiUrl);
//XXX inclu... | php | public function unconfirmedTransactions($address, $hash = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
$apiUrl = $this->getPath('unconfirmedTransactions', $params);
$response = $this->api->getJSON($apiUrl);
//XXX inclu... | [
"public",
"function",
"unconfirmedTransactions",
"(",
"$",
"address",
",",
"$",
"hash",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"if",
"(",
"$",
"hash",
"!==",
"null",
")",
"$",
"params",
"[",
"\"... | Gets the array of transactions for which an account is the sender or receiver and which have not yet been
included in a block
@param string $address Base32 representation of the account address (T-, N-, M- prefixed addresses).
@param string $hash (Optional) The 256 bit sha3 hash of the transaction up to... | [
"Gets",
"the",
"array",
"of",
"transactions",
"for",
"which",
"an",
"account",
"is",
"the",
"sender",
"or",
"receiver",
"and",
"which",
"have",
"not",
"yet",
"been",
"included",
"in",
"a",
"block"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L241-L254 |
evias/nem-php | src/Infrastructure/Account.php | Account.getHarvestInfo | public function getHarvestInfo($address, $hash = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
$apiUrl = $this->getPath('harvests', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
... | php | public function getHarvestInfo($address, $hash = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
$apiUrl = $this->getPath('harvests', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
... | [
"public",
"function",
"getHarvestInfo",
"(",
"$",
"address",
",",
"$",
"hash",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"if",
"(",
"$",
"hash",
"!==",
"null",
")",
"$",
"params",
"[",
"\"hash\"",
... | Gets an array of harvest info objects for an account.
@param string $address The address of the account.
@param string %hash The 256 bit sha3 hash of the block up to which harvested blocks are returned.
@return object Instance with keys from [HarvestInfo](https://bob.nem.ninja/docs/#harves... | [
"Gets",
"an",
"array",
"of",
"harvest",
"info",
"objects",
"for",
"an",
"account",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L263-L276 |
evias/nem-php | src/Infrastructure/Account.php | Account.getAccountImportances | public function getAccountImportances($address)
{
$params = ["address" => $address];
$apiUrl = $this->getPath('importances', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createBa... | php | public function getAccountImportances($address)
{
$params = ["address" => $address];
$apiUrl = $this->getPath('importances', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createBa... | [
"public",
"function",
"getAccountImportances",
"(",
"$",
"address",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'importances'",
",",
"$",
"params",
")",
";",
... | Gets an array of account importance view model objects.
@param string $address The address of the account.
@return array Array of object with keys from [AccountImportanceViewModl](https://bob.nem.ninja/docs/#accountImportanceViewModel) objects. | [
"Gets",
"an",
"array",
"of",
"account",
"importance",
"view",
"model",
"objects",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L284-L293 |
evias/nem-php | src/Infrastructure/Account.php | Account.getOwnedNamespaces | public function getOwnedNamespaces($address, $parent = null, $id = null, $pageSize = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
if ($id !== null)
$params["id"] = $id;
if ($pageSize !== null)
$params["... | php | public function getOwnedNamespaces($address, $parent = null, $id = null, $pageSize = null)
{
$params = ["address" => $address];
if ($hash !== null)
$params["hash"] = $hash;
if ($id !== null)
$params["id"] = $id;
if ($pageSize !== null)
$params["... | [
"public",
"function",
"getOwnedNamespaces",
"(",
"$",
"address",
",",
"$",
"parent",
"=",
"null",
",",
"$",
"id",
"=",
"null",
",",
"$",
"pageSize",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"if",
... | Gets an array of namespace objects for a given account address.
The parent parameter is optional. If supplied, only sub-namespaces of the parent namespace are returned.
@param string $address The address of the account.
@param null|string $parent The (optional) parent namespace id.
@param nul... | [
"Gets",
"an",
"array",
"of",
"namespace",
"objects",
"for",
"a",
"given",
"account",
"address",
".",
"The",
"parent",
"parameter",
"is",
"optional",
".",
"If",
"supplied",
"only",
"sub",
"-",
"namespaces",
"of",
"the",
"parent",
"namespace",
"are",
"returned... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L305-L324 |
evias/nem-php | src/Infrastructure/Account.php | Account.getCreatedMosaics | public function getCreatedMosaics($address, $parent = null, $id = null)
{
$params = ["address" => $address];
if ($parent !== null)
$params["parent"] = $parent;
if ($id !== null)
$params["id"] = $id;
$apiUrl = $this->getPath('mosaic/definition/page', $param... | php | public function getCreatedMosaics($address, $parent = null, $id = null)
{
$params = ["address" => $address];
if ($parent !== null)
$params["parent"] = $parent;
if ($id !== null)
$params["id"] = $id;
$apiUrl = $this->getPath('mosaic/definition/page', $param... | [
"public",
"function",
"getCreatedMosaics",
"(",
"$",
"address",
",",
"$",
"parent",
"=",
"null",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"if",
"(",
"$",
"parent",
"!==",
"null",
... | Gets an array of mosaic definition objects for a given account address. The parent parameter is optional.
If supplied, only mosaic definitions for the given parent namespace are returned.
The id parameter is optional and allows retrieving mosaic definitions in batches of 25 mosaic definitions.
@param string ... | [
"Gets",
"an",
"array",
"of",
"mosaic",
"definition",
"objects",
"for",
"a",
"given",
"account",
"address",
".",
"The",
"parent",
"parameter",
"is",
"optional",
".",
"If",
"supplied",
"only",
"mosaic",
"definitions",
"for",
"the",
"given",
"parent",
"namespace"... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L336-L352 |
evias/nem-php | src/Infrastructure/Account.php | Account.getOwnedMosaics | public function getOwnedMosaics($address)
{
$params = ["address" => $address];
$apiUrl = $this->getPath('mosaic/owned', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createMosaic... | php | public function getOwnedMosaics($address)
{
$params = ["address" => $address];
$apiUrl = $this->getPath('mosaic/owned', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createMosaic... | [
"public",
"function",
"getOwnedMosaics",
"(",
"$",
"address",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'mosaic/owned'",
",",
"$",
"params",
")",
";",
"$",
... | Gets an array of mosaic objects for a given account address.
@param string $address The address of the account.
@return array Array of object with keys from [MosaicDefinitionMetaDataPair](https://bob.nem.ninja/docs/#mosaicDefinitionMetaDataPair) objects. | [
"Gets",
"an",
"array",
"of",
"mosaic",
"objects",
"for",
"a",
"given",
"account",
"address",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L360-L370 |
evias/nem-php | src/Infrastructure/Account.php | Account.getHistoricalAccountData | public function getHistoricalAccountData($address, $startHeight = null, $endHeight = null, $increment = null)
{
$params = ["address" => $address];
if ($startHeight !== null)
$params["startHeight"] = $startHeight;
if ($endHeight !== null)
$params["endHeight"] = $endH... | php | public function getHistoricalAccountData($address, $startHeight = null, $endHeight = null, $increment = null)
{
$params = ["address" => $address];
if ($startHeight !== null)
$params["startHeight"] = $startHeight;
if ($endHeight !== null)
$params["endHeight"] = $endH... | [
"public",
"function",
"getHistoricalAccountData",
"(",
"$",
"address",
",",
"$",
"startHeight",
"=",
"null",
",",
"$",
"endHeight",
"=",
"null",
",",
"$",
"increment",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"address\"",
"=>",
"$",
"address",
"... | Gets historical information for an account.
@param string $address The address of the account.
@param integer $startHeight The block height from which on the data should be supplied.
@param integer $endHeight The block height up to which the data should be supplied. The en... | [
"Gets",
"historical",
"information",
"for",
"an",
"account",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L383-L402 |
evias/nem-php | src/Infrastructure/Account.php | Account.getUnlockInfo | public function getUnlockInfo()
{
$params = [];
$apiUrl = $this->getPath('unlocked/info', []);
$response = $this->api->post($apiUrl, $params);
//XXX include Error checks
$object = json_decode($response);
return $this->createBaseModel($object); //XXX brr => error/con... | php | public function getUnlockInfo()
{
$params = [];
$apiUrl = $this->getPath('unlocked/info', []);
$response = $this->api->post($apiUrl, $params);
//XXX include Error checks
$object = json_decode($response);
return $this->createBaseModel($object); //XXX brr => error/con... | [
"public",
"function",
"getUnlockInfo",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'unlocked/info'",
",",
"[",
"]",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"post"... | Each node can allow users to harvest with their delegated key on that node.
The NIS configuration has entries for configuring the maximum number of allowed harvesters and optionally allow
harvesting only for certain account addresses. The unlock info gives information about the maximum number of
allowed harvesters and ... | [
"Each",
"node",
"can",
"allow",
"users",
"to",
"harvest",
"with",
"their",
"delegated",
"key",
"on",
"that",
"node",
".",
"The",
"NIS",
"configuration",
"has",
"entries",
"for",
"configuring",
"the",
"maximum",
"number",
"of",
"allowed",
"harvesters",
"and",
... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L412-L421 |
evias/nem-php | src/Infrastructure/Account.php | Account.startHarvesting | public function startHarvesting($privateKey)
{
$params = ["value" => $privateKey];
$apiUrl = $this->getPath('unlock', $params);
$response = $this->api->post($apiUrl, []);
//XXX include Error checks
$object = json_decode($response);
return $this->createBaseModel($ob... | php | public function startHarvesting($privateKey)
{
$params = ["value" => $privateKey];
$apiUrl = $this->getPath('unlock', $params);
$response = $this->api->post($apiUrl, []);
//XXX include Error checks
$object = json_decode($response);
return $this->createBaseModel($ob... | [
"public",
"function",
"startHarvesting",
"(",
"$",
"privateKey",
")",
"{",
"$",
"params",
"=",
"[",
"\"value\"",
"=>",
"$",
"privateKey",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'unlock'",
",",
"$",
"params",
")",
";",
"$",
... | Unlocks an account (starts harvesting).
@param host - string
@param privateKey - string
@return Array<boolean> | [
"Unlocks",
"an",
"account",
"(",
"starts",
"harvesting",
")",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Account.php#L431-L441 |
evias/nem-php | src/ServiceProvider.php | ServiceProvider.setupConfig | protected function setupConfig()
{
$source = realpath(__DIR__.'/../config') . "/nem.php";
if (! $this->isLumen())
// console laravel, use config_path helper
$this->publishes([$source => config_path('nem.php')]);
else
// lumen configure app
$thi... | php | protected function setupConfig()
{
$source = realpath(__DIR__.'/../config') . "/nem.php";
if (! $this->isLumen())
// console laravel, use config_path helper
$this->publishes([$source => config_path('nem.php')]);
else
// lumen configure app
$thi... | [
"protected",
"function",
"setupConfig",
"(",
")",
"{",
"$",
"source",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../config'",
")",
".",
"\"/nem.php\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isLumen",
"(",
")",
")",
"// console laravel, use config_path helper"... | Setup the NEM blockchain config.
@return void | [
"Setup",
"the",
"NEM",
"blockchain",
"config",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/ServiceProvider.php#L76-L87 |
evias/nem-php | src/ServiceProvider.php | ServiceProvider.registerPreConfiguredApiClients | protected function registerPreConfiguredApiClients()
{
$this->app->bindIf("nem", function()
{
$environment = env("APP_ENV", "testing");
$envConfig = $environment == "production" ? "primary" : "testing";
$config = $this->app["nem.config"];
$nisConf ... | php | protected function registerPreConfiguredApiClients()
{
$this->app->bindIf("nem", function()
{
$environment = env("APP_ENV", "testing");
$envConfig = $environment == "production" ? "primary" : "testing";
$config = $this->app["nem.config"];
$nisConf ... | [
"protected",
"function",
"registerPreConfiguredApiClients",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bindIf",
"(",
"\"nem\"",
",",
"function",
"(",
")",
"{",
"$",
"environment",
"=",
"env",
"(",
"\"APP_ENV\"",
",",
"\"testing\"",
")",
";",
"$",
"env... | Register all pre-configured NEM API clients.
This will register following IoC bindings:
- nem : using the primary NIS server configuration
- nem.testing : using the testing NIS server configuration
- nem.ncc : using the primary NCC client configuration
- nem.ncc.testing : using the testing NCC client configuration
- n... | [
"Register",
"all",
"pre",
"-",
"configured",
"NEM",
"API",
"clients",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/ServiceProvider.php#L137-L173 |
evias/nem-php | src/Infrastructure/Transaction.php | Transaction.signTransaction | public function signTransaction(TxModel $transaction, KeyPair $kp = null)
{
// always set optional `signer` in case we provide a KeyPair
if (null !== $kp) {
$transaction->setAttribute("signer", $kp->getPublicKey("hex"));
}
// now we can serialize and sign
$serial... | php | public function signTransaction(TxModel $transaction, KeyPair $kp = null)
{
// always set optional `signer` in case we provide a KeyPair
if (null !== $kp) {
$transaction->setAttribute("signer", $kp->getPublicKey("hex"));
}
// now we can serialize and sign
$serial... | [
"public",
"function",
"signTransaction",
"(",
"TxModel",
"$",
"transaction",
",",
"KeyPair",
"$",
"kp",
"=",
"null",
")",
"{",
"// always set optional `signer` in case we provide a KeyPair",
"if",
"(",
"null",
"!==",
"$",
"kp",
")",
"{",
"$",
"transaction",
"->",
... | Helper method to sign a transaction with a given keypair `kp`.
If no keypair is provided, this method will return `null`.
@internal This method is used internally to determined whether
instanciated keypairs are detected and to make sure that
Client Signatures are always created when possible.
@param \NEM\Models\Tr... | [
"Helper",
"method",
"to",
"sign",
"a",
"transaction",
"with",
"a",
"given",
"keypair",
"kp",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Transaction.php#L82-L94 |
evias/nem-php | src/Infrastructure/Transaction.php | Transaction.announce | public function announce(TxModel $transaction, KeyPair $kp = null)
{
// always set optional `signer` in case we provide a KeyPair
if (null !== $kp) {
$transaction->setAttribute("signer", $kp->getPublicKey("hex"));
}
// now we can serialize and sign
$serialized = ... | php | public function announce(TxModel $transaction, KeyPair $kp = null)
{
// always set optional `signer` in case we provide a KeyPair
if (null !== $kp) {
$transaction->setAttribute("signer", $kp->getPublicKey("hex"));
}
// now we can serialize and sign
$serialized = ... | [
"public",
"function",
"announce",
"(",
"TxModel",
"$",
"transaction",
",",
"KeyPair",
"$",
"kp",
"=",
"null",
")",
"{",
"// always set optional `signer` in case we provide a KeyPair",
"if",
"(",
"null",
"!==",
"$",
"kp",
")",
"{",
"$",
"transaction",
"->",
"setA... | Announce a transaction. The transaction will be serialized before
it is sent to the server.
Additionally, a KeyPair object can be passed to this method *if you wish
to have the transaction **signed locally** by the SDK instead of letting
the remote NIS sign for you*. The local signing method **is recommended**.
WARNI... | [
"Announce",
"a",
"transaction",
".",
"The",
"transaction",
"will",
"be",
"serialized",
"before",
"it",
"is",
"sent",
"to",
"the",
"server",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Transaction.php#L112-L147 |
evias/nem-php | src/Infrastructure/Transaction.php | Transaction.byHash | public function byHash($hash)
{
$params = ["hash" => $hash];
$apiUrl = $this->getPath('get', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createTransactionModel($object['data']); ... | php | public function byHash($hash)
{
$params = ["hash" => $hash];
$apiUrl = $this->getPath('get', $params);
$response = $this->api->getJSON($apiUrl);
//XXX include Error checks
$object = json_decode($response, true);
return $this->createTransactionModel($object['data']); ... | [
"public",
"function",
"byHash",
"(",
"$",
"hash",
")",
"{",
"$",
"params",
"=",
"[",
"\"hash\"",
"=>",
"$",
"hash",
"]",
";",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"getPath",
"(",
"'get'",
",",
"$",
"params",
")",
";",
"$",
"response",
"=",
"$",... | Gets a transaction meta data pair where the transaction hash corresponds
to the said `hash` parameter. | [
"Gets",
"a",
"transaction",
"meta",
"data",
"pair",
"where",
"the",
"transaction",
"hash",
"corresponds",
"to",
"the",
"said",
"hash",
"parameter",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Transaction.php#L153-L162 |
evias/nem-php | src/API.php | API.setOptions | public function setOptions(array $options)
{
foreach ($options as $option => $config) {
if (! (bool) preg_match("/^[0-9A-Za-z_]+$/", $option))
// invalid option format
throw new InvalidArgumentException("Invalid option name provided to evias\\NEMBlockchain\\API@se... | php | public function setOptions(array $options)
{
foreach ($options as $option => $config) {
if (! (bool) preg_match("/^[0-9A-Za-z_]+$/", $option))
// invalid option format
throw new InvalidArgumentException("Invalid option name provided to evias\\NEMBlockchain\\API@se... | [
"public",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
"=>",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"bool",
")",
"preg_match",
"(",
"\"/^[0-9A-Za-z_]+$/\"",
",",
"$",
"opt... | This method allows to set the API configuration
through an array rather than using the Laravel
and Lumen Config contracts.
@param array $options
@return \NEM\API
@throws InvalidArgumentException on invalid option names. | [
"This",
"method",
"allows",
"to",
"set",
"the",
"API",
"configuration",
"through",
"an",
"array",
"rather",
"than",
"using",
"the",
"Laravel",
"and",
"Lumen",
"Config",
"contracts",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/API.php#L84-L101 |
evias/nem-php | src/API.php | API.getRequestHandler | public function getRequestHandler()
{
if (isset($this->requestHandler))
return $this->requestHandler;
// now instantiating handler from config
$handlerClass = "\\" . ltrim($this->handlerClass, "\\");
if (!class_exists($handlerClass))
throw new RuntimeExceptio... | php | public function getRequestHandler()
{
if (isset($this->requestHandler))
return $this->requestHandler;
// now instantiating handler from config
$handlerClass = "\\" . ltrim($this->handlerClass, "\\");
if (!class_exists($handlerClass))
throw new RuntimeExceptio... | [
"public",
"function",
"getRequestHandler",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"requestHandler",
")",
")",
"return",
"$",
"this",
"->",
"requestHandler",
";",
"// now instantiating handler from config",
"$",
"handlerClass",
"=",
"\"\\\\\"",
... | The getRequestHandler method creates an instance of the
`handlerClass` and returns it.
@return \NEM\Contracts\RequestHandler | [
"The",
"getRequestHandler",
"method",
"creates",
"an",
"instance",
"of",
"the",
"handlerClass",
"and",
"returns",
"it",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/API.php#L211-L223 |
evias/nem-php | src/Core/KeyPair.php | KeyPair.getAddress | public function getAddress($networkId = 104, $prettyFormat = false)
{
$address = \NEM\Models\Address::fromPublicKey($this->getPublicKey(), $networkId);
if ($prettyFormat) {
return $address->toPretty();
}
return $address->toClean();
} | php | public function getAddress($networkId = 104, $prettyFormat = false)
{
$address = \NEM\Models\Address::fromPublicKey($this->getPublicKey(), $networkId);
if ($prettyFormat) {
return $address->toPretty();
}
return $address->toClean();
} | [
"public",
"function",
"getAddress",
"(",
"$",
"networkId",
"=",
"104",
",",
"$",
"prettyFormat",
"=",
"false",
")",
"{",
"$",
"address",
"=",
"\\",
"NEM",
"\\",
"Models",
"\\",
"Address",
"::",
"fromPublicKey",
"(",
"$",
"this",
"->",
"getPublicKey",
"("... | This method should return the *base32 encoded representation* of the
NEM Address.
@param string|integer $networkId A network ID OR a network name. (default mainnet)
@param boolean $prettyFormat Boolean whether address should be prettified or not.
@return string | [
"This",
"method",
"should",
"return",
"the",
"*",
"base32",
"encoded",
"representation",
"*",
"of",
"the",
"NEM",
"Address",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeyPair.php#L174-L182 |
evias/nem-php | src/Core/KeyPair.php | KeyPair.sign | public function sign($data, $algorithm = "keccak-512", $enc = null)
{
if ($data instanceof Buffer) {
$data = $data->getBinary();
}
elseif (is_string($data) && ctype_xdigit($data)) {
$data = Buffer::fromHex($data)->getBinary();
}
elseif (is_array($data)... | php | public function sign($data, $algorithm = "keccak-512", $enc = null)
{
if ($data instanceof Buffer) {
$data = $data->getBinary();
}
elseif (is_string($data) && ctype_xdigit($data)) {
$data = Buffer::fromHex($data)->getBinary();
}
elseif (is_array($data)... | [
"public",
"function",
"sign",
"(",
"$",
"data",
",",
"$",
"algorithm",
"=",
"\"keccak-512\"",
",",
"$",
"enc",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"Buffer",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"->",
"getBinary",
"(",
"... | This method returns a 64 bytes signature of the *data signed with the
current `secretKey`*.
You can also specify the `enc` parameter to be "hex", "uint8" or "int32".
@param null|array|string|\NEM\Core\Buffer $data The data that needs to be signed.
@param string $algorithm ... | [
"This",
"method",
"returns",
"a",
"64",
"bytes",
"signature",
"of",
"the",
"*",
"data",
"signed",
"with",
"the",
"current",
"secretKey",
"*",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeyPair.php#L195-L214 |
evias/nem-php | src/Core/KeyPair.php | KeyPair.preparePrivateKey | protected function preparePrivateKey($privateKey = null)
{
if (is_string($privateKey)) {
// provided a string, must check if it contains 64 or 66 characters.
// and whether it is valid hexadecimal data.
$keySize = strlen($privateKey);
if ($keySize !== 64 && $... | php | protected function preparePrivateKey($privateKey = null)
{
if (is_string($privateKey)) {
// provided a string, must check if it contains 64 or 66 characters.
// and whether it is valid hexadecimal data.
$keySize = strlen($privateKey);
if ($keySize !== 64 && $... | [
"protected",
"function",
"preparePrivateKey",
"(",
"$",
"privateKey",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"privateKey",
")",
")",
"{",
"// provided a string, must check if it contains 64 or 66 characters.",
"// and whether it is valid hexadecimal data.",
... | This method will parse a given `privateKey` such that we
store the binary representation of the private key *always*.
This method is used internally to create the KeyPair secret key
which is the key that is actually hashed and derived to get the
public key.
@internal
@param null|string|\NEM\Core\Buffer|\NEM\Core\Ke... | [
"This",
"method",
"will",
"parse",
"a",
"given",
"privateKey",
"such",
"that",
"we",
"store",
"the",
"binary",
"representation",
"of",
"the",
"private",
"key",
"*",
"always",
"*",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeyPair.php#L230-L269 |
evias/nem-php | src/Core/KeyPair.php | KeyPair.preparePublicKey | protected function preparePublicKey($publicKey = null)
{
if (is_string($publicKey)) {
// provided a string, must check if it contains 64 characters.
// and whether it is valid hexadecimal data.
$keySize = strlen($publicKey);
if ($keySize !== 64) {
... | php | protected function preparePublicKey($publicKey = null)
{
if (is_string($publicKey)) {
// provided a string, must check if it contains 64 characters.
// and whether it is valid hexadecimal data.
$keySize = strlen($publicKey);
if ($keySize !== 64) {
... | [
"protected",
"function",
"preparePublicKey",
"(",
"$",
"publicKey",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"publicKey",
")",
")",
"{",
"// provided a string, must check if it contains 64 characters.",
"// and whether it is valid hexadecimal data.",
"$",
... | This method will parse a given `publicKey` such that we
store the binary representation of the public key *always*.
This method is used internally whenever a public key *is not*
derived of the passed private key but rather passed directly in
hexadecimal or binary representation.
@internal
@param null|string|\NEM\Co... | [
"This",
"method",
"will",
"parse",
"a",
"given",
"publicKey",
"such",
"that",
"we",
"store",
"the",
"binary",
"representation",
"of",
"the",
"public",
"key",
"*",
"always",
"*",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeyPair.php#L285-L311 |
evias/nem-php | src/Core/KeyPair.php | KeyPair.encodeKey | protected function encodeKey(Buffer $key, $enc = null)
{
if ("hex" === $enc || (int) $enc == 16) {
return $key->getHex();
}
elseif ("uint8" === $enc || (int) $enc == 8) {
return $key->toUInt8();
}
elseif ("int32" === $enc || (int) $enc == 32) {
... | php | protected function encodeKey(Buffer $key, $enc = null)
{
if ("hex" === $enc || (int) $enc == 16) {
return $key->getHex();
}
elseif ("uint8" === $enc || (int) $enc == 8) {
return $key->toUInt8();
}
elseif ("int32" === $enc || (int) $enc == 32) {
... | [
"protected",
"function",
"encodeKey",
"(",
"Buffer",
"$",
"key",
",",
"$",
"enc",
"=",
"null",
")",
"{",
"if",
"(",
"\"hex\"",
"===",
"$",
"enc",
"||",
"(",
"int",
")",
"$",
"enc",
"==",
"16",
")",
"{",
"return",
"$",
"key",
"->",
"getHex",
"(",
... | This method encodes a given `key` to the given `enc` codec or
returns the Buffer itself if no encoding was specified.
@param \NEM\Core\Buffer $key The Key object (Buffer) that needs to be encoded.
@param string|integer $enc Which encoding to use (One of: "hex", "uint8", "int32")
@return \NEM... | [
"This",
"method",
"encodes",
"a",
"given",
"key",
"to",
"the",
"given",
"enc",
"codec",
"or",
"returns",
"the",
"Buffer",
"itself",
"if",
"no",
"encoding",
"was",
"specified",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/KeyPair.php#L321-L335 |
evias/nem-php | src/Models/Transaction/ImportanceTransfer.php | ImportanceTransfer.serialize | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->extend();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
// serialize specialized fields
$uint8_mode = $serializer->serializeIn... | php | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->extend();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
// serialize specialized fields
$uint8_mode = $serializer->serializeIn... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"baseTx",
"=",
"parent",
"::",
"serialize",
"(",
"$",
"parameters",
")",
";",
"$",
"nisData",
"=",
"$",
"this",
"->",
"extend",
"(",
")",
";",
"// shortcuts",
"$",
... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *ImportanceTransfer* serialization.
@see \NEM\Contracts\Serializable
@param null|string $parameters non-null will return only the named sub-dtos.
@return array Returns a byte-array with values in UInt8 representation. | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"ImportanceTransfer",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/ImportanceTransfer.php#L65-L85 |
evias/nem-php | src/Models/Transaction/ImportanceTransfer.php | ImportanceTransfer.extend | public function extend()
{
// set default mode in case its invalid
$mode = $this->getAttribute("mode");
if (! $mode || ! in_array($mode, [self::MODE_ACTIVATE, self::MODE_DEACTIVATE])) {
$mode = self::MODE_ACTIVATE;
$this->setAttribute("mode", $mode);
}
... | php | public function extend()
{
// set default mode in case its invalid
$mode = $this->getAttribute("mode");
if (! $mode || ! in_array($mode, [self::MODE_ACTIVATE, self::MODE_DEACTIVATE])) {
$mode = self::MODE_ACTIVATE;
$this->setAttribute("mode", $mode);
}
... | [
"public",
"function",
"extend",
"(",
")",
"{",
"// set default mode in case its invalid",
"$",
"mode",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"\"mode\"",
")",
";",
"if",
"(",
"!",
"$",
"mode",
"||",
"!",
"in_array",
"(",
"$",
"mode",
",",
"[",
"sel... | The Signature transaction type does not need to add an offset to
the transaction base DTO.
@return array | [
"The",
"Signature",
"transaction",
"type",
"does",
"not",
"need",
"to",
"add",
"an",
"offset",
"to",
"the",
"transaction",
"base",
"DTO",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/ImportanceTransfer.php#L93-L108 |
evias/nem-php | src/Mosaics/Dim/Coin.php | Coin.levy | public function levy(array $levy = null)
{
$data = $levy ?: [
"type" => MosaicLevy::TYPE_PERCENTILE,
"fee" => 10,
"recipient" => "NCGGLVO2G3CUACVI5GNX2KRBJSQCN4RDL2ZWJ4DP",
"mosaicId" => $this->id()->toDTO(),
];
return new MosaicLevy($data);
... | php | public function levy(array $levy = null)
{
$data = $levy ?: [
"type" => MosaicLevy::TYPE_PERCENTILE,
"fee" => 10,
"recipient" => "NCGGLVO2G3CUACVI5GNX2KRBJSQCN4RDL2ZWJ4DP",
"mosaicId" => $this->id()->toDTO(),
];
return new MosaicLevy($data);
... | [
"public",
"function",
"levy",
"(",
"array",
"$",
"levy",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"levy",
"?",
":",
"[",
"\"type\"",
"=>",
"MosaicLevy",
"::",
"TYPE_PERCENTILE",
",",
"\"fee\"",
"=>",
"10",
",",
"\"recipient\"",
"=>",
"\"NCGGLVO2G3CU... | Mutator for `levy` relation.
This will return a NIS compliant [MosaicLevy](https://bob.nem.ninja/docs/#mosaicLevy) object.
@param array $mosaidId Array should contain offsets `type`, `recipient`, `mosaicId` and `fee`.
@return \NEM\Models\MosaicLevy | [
"Mutator",
"for",
"levy",
"relation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Mosaics/Dim/Coin.php#L87-L97 |
evias/nem-php | src/Core/Buffer.php | Buffer.bufferize | static public function bufferize($data, $byteSize = null, $paddingDirection = self::PAD_LEFT)
{
if (is_integer($data)) {
// Buffer from Decimal
return Buffer::fromInt($data, $byteSize, null, $paddingDirection);
}
$charLen = strlen($data);
if (ctype_xdigit($da... | php | static public function bufferize($data, $byteSize = null, $paddingDirection = self::PAD_LEFT)
{
if (is_integer($data)) {
// Buffer from Decimal
return Buffer::fromInt($data, $byteSize, null, $paddingDirection);
}
$charLen = strlen($data);
if (ctype_xdigit($da... | [
"static",
"public",
"function",
"bufferize",
"(",
"$",
"data",
",",
"$",
"byteSize",
"=",
"null",
",",
"$",
"paddingDirection",
"=",
"self",
"::",
"PAD_LEFT",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"data",
")",
")",
"{",
"// Buffer from Decimal",
"... | Build a Buffer from `data`.
Dynamic Buffer creation. Decimals, Hexadecimals
and String are handled differently in binary form.
Only use the bufferize method for Hexadecimal input
in case you are sure about the data length. It must
be a multiple of 32-bytes. (32, 64, 96, etc.)
When you are working with Hexadecimal da... | [
"Build",
"a",
"Buffer",
"from",
"data",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L147-L162 |
evias/nem-php | src/Core/Buffer.php | Buffer.fromString | static public function fromString($string, $paddingDirection = self::PAD_LEFT)
{
if (!class_exists("Normalizer")) {
// Data representation Normalization not supported
return new Buffer($string, null, $paddingDirection);
}
// Normalizer is used to avoid problems with ... | php | static public function fromString($string, $paddingDirection = self::PAD_LEFT)
{
if (!class_exists("Normalizer")) {
// Data representation Normalization not supported
return new Buffer($string, null, $paddingDirection);
}
// Normalizer is used to avoid problems with ... | [
"static",
"public",
"function",
"fromString",
"(",
"$",
"string",
",",
"$",
"paddingDirection",
"=",
"self",
"::",
"PAD_LEFT",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"\"Normalizer\"",
")",
")",
"{",
"// Data representation Normalization not supported",
"re... | Build Buffer from string
In case \Normalizer is available, the utf-8 string will
be normalized with Normalization Form KD.
@param string $string
@return \NEM\Core\Buffer | [
"Build",
"Buffer",
"from",
"string"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L173-L183 |
evias/nem-php | src/Core/Buffer.php | Buffer.fromHex | static public function fromHex($hexString = '', $byteSize = null, $paddingDirection = self::PAD_LEFT)
{
if (strlen($hexString) > 0 && !ctype_xdigit($hexString)) {
throw new InvalidArgumentException('NEM\\Core\\Buffer::hex: non-hexadecimal character passed');
}
// format to binar... | php | static public function fromHex($hexString = '', $byteSize = null, $paddingDirection = self::PAD_LEFT)
{
if (strlen($hexString) > 0 && !ctype_xdigit($hexString)) {
throw new InvalidArgumentException('NEM\\Core\\Buffer::hex: non-hexadecimal character passed');
}
// format to binar... | [
"static",
"public",
"function",
"fromHex",
"(",
"$",
"hexString",
"=",
"''",
",",
"$",
"byteSize",
"=",
"null",
",",
"$",
"paddingDirection",
"=",
"self",
"::",
"PAD_LEFT",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"hexString",
")",
">",
"0",
"&&",
"!... | Buffer::fromHex()
Create a new buffer from a hexadecimal string.
@param string $hexString
@param integer $byteSize
@return \NEM\Core\Buffer
@throws \InvalidArgumentException On non-hexadecimal content in `hexString` | [
"Buffer",
"::",
"fromHex",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L195-L204 |
evias/nem-php | src/Core/Buffer.php | Buffer.fromInt | static public function fromInt($integer, $byteSize = null, GmpMathInterface $math = null, $paddingDirection = self::PAD_LEFT)
{
if ($integer < 0) {
throw new InvalidArgumentException('Buffer::int supports only unsigned integers.');
}
$math = $math ?: EccFactory::getAdapter();
... | php | static public function fromInt($integer, $byteSize = null, GmpMathInterface $math = null, $paddingDirection = self::PAD_LEFT)
{
if ($integer < 0) {
throw new InvalidArgumentException('Buffer::int supports only unsigned integers.');
}
$math = $math ?: EccFactory::getAdapter();
... | [
"static",
"public",
"function",
"fromInt",
"(",
"$",
"integer",
",",
"$",
"byteSize",
"=",
"null",
",",
"GmpMathInterface",
"$",
"math",
"=",
"null",
",",
"$",
"paddingDirection",
"=",
"self",
"::",
"PAD_LEFT",
")",
"{",
"if",
"(",
"$",
"integer",
"<",
... | Buffer::fromInt()
Create a new buffer from an integer.
The decimal format will be converted to hexadecimal first then
packed as a hexadecimal string.
@param int|string $integer
@param null|int $byteSize
@param \Mdanter\Ecc\Math\GmpMathInterface $math A... | [
"Buffer",
"::",
"fromInt",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L238-L251 |
evias/nem-php | src/Core/Buffer.php | Buffer.getBinary | public function getBinary()
{
// if a size is specified we'll make sure the value returned is *strictly* of that size
if ($this->size !== null) {
if (strlen($this->buffer) < $this->size) {
// internal size of buffer is *too small*
// will now pad the strin... | php | public function getBinary()
{
// if a size is specified we'll make sure the value returned is *strictly* of that size
if ($this->size !== null) {
if (strlen($this->buffer) < $this->size) {
// internal size of buffer is *too small*
// will now pad the strin... | [
"public",
"function",
"getBinary",
"(",
")",
"{",
"// if a size is specified we'll make sure the value returned is *strictly* of that size",
"if",
"(",
"$",
"this",
"->",
"size",
"!==",
"null",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
... | Buffer::getBinary()
Get the binary data of the buffer.
The binary data will be truncated or padded in case
the buffer content size and buffer size do not
match.
This ensures that *whenever a size is set*, we will
get a strictly well-sized binary data format.
@return string | [
"Buffer",
"::",
"getBinary",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L291-L308 |
evias/nem-php | src/Core/Buffer.php | Buffer.getGmp | public function getGmp($base = null)
{
$gmp = gmp_init($this->getHex(), 16);
if (null !== $base)
return gmp_strval($gmp, (int) $base);
return $gmp;
} | php | public function getGmp($base = null)
{
$gmp = gmp_init($this->getHex(), 16);
if (null !== $base)
return gmp_strval($gmp, (int) $base);
return $gmp;
} | [
"public",
"function",
"getGmp",
"(",
"$",
"base",
"=",
"null",
")",
"{",
"$",
"gmp",
"=",
"gmp_init",
"(",
"$",
"this",
"->",
"getHex",
"(",
")",
",",
"16",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"base",
")",
"return",
"gmp_strval",
"(",
"$",
... | Buffer::getGmp()
Get Base16 representation (hexadecimal).
This uses the GNU Multiple Precision PHP wrapper to
create a GMP number with the given base. (here 16 - hexadecimal)
@return \GMP | [
"Buffer",
"::",
"getGmp",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L332-L340 |
evias/nem-php | src/Core/Buffer.php | Buffer.slice | public function slice($start, $end = null)
{
if ($start > $this->getSize()) {
throw new InvalidArgumentException('Start exceeds buffer length');
}
if ($end === null) {
return new self(substr($this->getBinary(), $start));
}
if ($end > $this->getSize()... | php | public function slice($start, $end = null)
{
if ($start > $this->getSize()) {
throw new InvalidArgumentException('Start exceeds buffer length');
}
if ($end === null) {
return new self(substr($this->getBinary(), $start));
}
if ($end > $this->getSize()... | [
"public",
"function",
"slice",
"(",
"$",
"start",
",",
"$",
"end",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"start",
">",
"$",
"this",
"->",
"getSize",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Start exceeds buffer length'",
")... | Buffer::slice()
Get part of a buffer content.
@param integer $start Where in the buffer content should we start?
@param integer|null $end (Optional) end of slice
@return \NEM\Core\Buffer
@throws \InvalidArgumentException On invalid start or end parameter
@throws \RuntimeExceptio... | [
"Buffer",
"::",
"slice",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L404-L425 |
evias/nem-php | src/Core/Buffer.php | Buffer.equals | public function equals(Buffer $other)
{
return ($other->getSize() === $this->getSize()
&& $other->getBinary() === $this->getBinary());
} | php | public function equals(Buffer $other)
{
return ($other->getSize() === $this->getSize()
&& $other->getBinary() === $this->getBinary());
} | [
"public",
"function",
"equals",
"(",
"Buffer",
"$",
"other",
")",
"{",
"return",
"(",
"$",
"other",
"->",
"getSize",
"(",
")",
"===",
"$",
"this",
"->",
"getSize",
"(",
")",
"&&",
"$",
"other",
"->",
"getBinary",
"(",
")",
"===",
"$",
"this",
"->",... | Buffer::equals()
Buffer comparison operator.
@param Buffer $other
@return bool | [
"Buffer",
"::",
"equals",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L435-L439 |
evias/nem-php | src/Core/Buffer.php | Buffer.decimalToBinary | public function decimalToBinary($decimal, $size = null, $padding = false, $direction = self::PAD_LEFT)
{
if ($decimal < 0xfd) {
// Uint8 (unsigned char)
$bin = chr($decimal);
}
elseif ($decimal <= 0xffff) {
// Uint16 (unsigned short)
$bin = pac... | php | public function decimalToBinary($decimal, $size = null, $padding = false, $direction = self::PAD_LEFT)
{
if ($decimal < 0xfd) {
// Uint8 (unsigned char)
$bin = chr($decimal);
}
elseif ($decimal <= 0xffff) {
// Uint16 (unsigned short)
$bin = pac... | [
"public",
"function",
"decimalToBinary",
"(",
"$",
"decimal",
",",
"$",
"size",
"=",
"null",
",",
"$",
"padding",
"=",
"false",
",",
"$",
"direction",
"=",
"self",
"::",
"PAD_LEFT",
")",
"{",
"if",
"(",
"$",
"decimal",
"<",
"0xfd",
")",
"{",
"// Uint... | Buffer::decimalToBinary()
Return variable-sized Binary Integer value from decimal
value `decimal`.
This will return either a `unsigned char`, a 16-bit
number, a 32-bit number or a 64-bit
number.
@param int $decimal
@return string Binary Data | [
"Buffer",
"::",
"decimalToBinary",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L454-L487 |
evias/nem-php | src/Core/Buffer.php | Buffer.flipBytes | public function flipBytes($bytes = null)
{
if (null === $bytes && $this instanceof Buffer) {
$bytes = $this;
}
$isBuffer = $bytes instanceof Buffer;
if ($isBuffer) {
$bytes = $bytes->getBinary();
}
$flipped = implode('', array_reverse(str_spl... | php | public function flipBytes($bytes = null)
{
if (null === $bytes && $this instanceof Buffer) {
$bytes = $this;
}
$isBuffer = $bytes instanceof Buffer;
if ($isBuffer) {
$bytes = $bytes->getBinary();
}
$flipped = implode('', array_reverse(str_spl... | [
"public",
"function",
"flipBytes",
"(",
"$",
"bytes",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"bytes",
"&&",
"$",
"this",
"instanceof",
"Buffer",
")",
"{",
"$",
"bytes",
"=",
"$",
"this",
";",
"}",
"$",
"isBuffer",
"=",
"$",
"bytes",
... | Buffer::flipBytes()
Flip byte order (reverse order) of this binary string. Accepts a string or Buffer,
and will return whatever type it was given.
@param null|string|\NEM\Core\Buffer $bytes Bytes that must be reversed.
@return string|\NEM\Core\Buffer | [
"Buffer",
"::",
"flipBytes",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L511-L528 |
evias/nem-php | src/Core/Buffer.php | Buffer.toUInt8 | public function toUInt8()
{
$binary = $this->getBinary();
$split = str_split($binary, 1);
// argument *by-reference*
array_walk($split, function(&$item, $ix) {
$buf = new Buffer($item, 1);
$item = (int) $buf->getInt();
});
return $split;
... | php | public function toUInt8()
{
$binary = $this->getBinary();
$split = str_split($binary, 1);
// argument *by-reference*
array_walk($split, function(&$item, $ix) {
$buf = new Buffer($item, 1);
$item = (int) $buf->getInt();
});
return $split;
... | [
"public",
"function",
"toUInt8",
"(",
")",
"{",
"$",
"binary",
"=",
"$",
"this",
"->",
"getBinary",
"(",
")",
";",
"$",
"split",
"=",
"str_split",
"(",
"$",
"binary",
",",
"1",
")",
";",
"// argument *by-reference*",
"array_walk",
"(",
"$",
"split",
",... | Transfer binary data into a unsigned char array. Unsigned Char
is the same as UInt8 in Javascript or other languages, it represents
unsigned integers on 8 bits (1 byte).
@return array | [
"Transfer",
"binary",
"data",
"into",
"a",
"unsigned",
"char",
"array",
".",
"Unsigned",
"Char",
"is",
"the",
"same",
"as",
"UInt8",
"in",
"Javascript",
"or",
"other",
"languages",
"it",
"represents",
"unsigned",
"integers",
"on",
"8",
"bits",
"(",
"1",
"b... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L537-L549 |
evias/nem-php | src/Core/Buffer.php | Buffer.concat | public function concat(Buffer $buffer)
{
// size-protected through Buffer class
$this->buffer = $this->buffer . $buffer->getBinary();
$this->size += $buffer->getSize();
return $this;
} | php | public function concat(Buffer $buffer)
{
// size-protected through Buffer class
$this->buffer = $this->buffer . $buffer->getBinary();
$this->size += $buffer->getSize();
return $this;
} | [
"public",
"function",
"concat",
"(",
"Buffer",
"$",
"buffer",
")",
"{",
"// size-protected through Buffer class",
"$",
"this",
"->",
"buffer",
"=",
"$",
"this",
"->",
"buffer",
".",
"$",
"buffer",
"->",
"getBinary",
"(",
")",
";",
"$",
"this",
"->",
"size"... | Buffer::concat()
Concatenate buffers
@param \NEM\Core\Buffer $buffer1
@return \NEM\Core\Buffer | [
"Buffer",
"::",
"concat",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L559-L565 |
evias/nem-php | src/Core/Buffer.php | Buffer.sort | public function sort(array $items, callable $convertToBuffer = null)
{
if (null == $convertToBuffer) {
$convertToBuffer = function ($value) {
if ($value instanceof Buffer) {
return $value;
}
if ($value instanceof Serializable) ... | php | public function sort(array $items, callable $convertToBuffer = null)
{
if (null == $convertToBuffer) {
$convertToBuffer = function ($value) {
if ($value instanceof Buffer) {
return $value;
}
if ($value instanceof Serializable) ... | [
"public",
"function",
"sort",
"(",
"array",
"$",
"items",
",",
"callable",
"$",
"convertToBuffer",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"convertToBuffer",
")",
"{",
"$",
"convertToBuffer",
"=",
"function",
"(",
"$",
"value",
")",
"{",
"... | Buffer::sort()
Sorting multiple buffers.
The default behaviour should be, take a list of Buffers/SerializableInterfaces, and
sort their binary representation.
If an anonymous function is provided, we completely defer the conversion of values to
Buffer to the $convertToBuffer callable.
This is to allow anonymous fun... | [
"Buffer",
"::",
"sort",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L586-L609 |
evias/nem-php | src/Core/Buffer.php | Buffer.hash | public function hash($algorithm = "sha512")
{
if (! in_array($algorithm, hash_algos())) {
throw new InvalidArgumentException("Hash algorithm '" . $algorithm . "' not supported.");
}
$byteSize = false !== strpos($algorithm, "512") ? 64 : 32;
if ($algorithm === "sha1") $by... | php | public function hash($algorithm = "sha512")
{
if (! in_array($algorithm, hash_algos())) {
throw new InvalidArgumentException("Hash algorithm '" . $algorithm . "' not supported.");
}
$byteSize = false !== strpos($algorithm, "512") ? 64 : 32;
if ($algorithm === "sha1") $by... | [
"public",
"function",
"hash",
"(",
"$",
"algorithm",
"=",
"\"sha512\"",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"algorithm",
",",
"hash_algos",
"(",
")",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Hash algorithm '\"",
".",
"... | Buffer::hash()
Create HMAC out of buffer using said `algorithm`.
Currently supported algorithm include, but are not limited to:
- sha256 (32 bytes)
- sha512 (64 bytes)
- sha1 (20 bytes)
@param string $algorithm Hash algorithm (Example: sha512)
@return \NEM\Core\Buffer | [
"Buffer",
"::",
"hash",
"()"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L625-L637 |
evias/nem-php | src/Core/Buffer.php | Buffer.clampBits | static public function clampBits($unsafeSecret, $bytes = 64)
{
if ($unsafeSecret instanceof Buffer) {
// copy-construct to avoid malformed and wrong size
$toBuffer = new Buffer($unsafeSecret->getBinary(), $bytes);
}
elseif (! ctype_xdigit($unsafeSecret)) {
... | php | static public function clampBits($unsafeSecret, $bytes = 64)
{
if ($unsafeSecret instanceof Buffer) {
// copy-construct to avoid malformed and wrong size
$toBuffer = new Buffer($unsafeSecret->getBinary(), $bytes);
}
elseif (! ctype_xdigit($unsafeSecret)) {
... | [
"static",
"public",
"function",
"clampBits",
"(",
"$",
"unsafeSecret",
",",
"$",
"bytes",
"=",
"64",
")",
"{",
"if",
"(",
"$",
"unsafeSecret",
"instanceof",
"Buffer",
")",
"{",
"// copy-construct to avoid malformed and wrong size",
"$",
"toBuffer",
"=",
"new",
"... | Convert 64 Bytes Keccak SHA3-512 Hashes into a Secret Key.
@param string $unsafeSecret A 64 bytes (512 bits) Keccak hash produced from a KeyPair's Secret Key.
@return string Byte-level representation of the Secret Key. | [
"Convert",
"64",
"Bytes",
"Keccak",
"SHA3",
"-",
"512",
"Hashes",
"into",
"a",
"Secret",
"Key",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Buffer.php#L645-L669 |
evias/nem-php | src/Infrastructure/Mosaic.php | Mosaic.getMosaicDefinitionsPage | public function getMosaicDefinitionsPage($namespace, $id = null, $pageSize = null)
{
$params = ["namespace" => $namespace]
+ ($id !== null ? ["id" => $id] : [])
+ ($pageSize !== null ? ["pageSize" => $pageSize] : []);
$apiUrl = $this->getPath('definition/page', $para... | php | public function getMosaicDefinitionsPage($namespace, $id = null, $pageSize = null)
{
$params = ["namespace" => $namespace]
+ ($id !== null ? ["id" => $id] : [])
+ ($pageSize !== null ? ["pageSize" => $pageSize] : []);
$apiUrl = $this->getPath('definition/page', $para... | [
"public",
"function",
"getMosaicDefinitionsPage",
"(",
"$",
"namespace",
",",
"$",
"id",
"=",
"null",
",",
"$",
"pageSize",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"\"namespace\"",
"=>",
"$",
"namespace",
"]",
"+",
"(",
"$",
"id",
"!==",
"null"... | XXX
@param namespace
@param id - The topmost mosaic definition database id up to which root mosaic definitions are returned.
The parameter is optional. If not supplied the most recent mosaic definitiona are returned.
@param pageSize - The number of mosaic definition objects to be returned for each request. T... | [
"XXX"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Mosaic.php#L38-L50 |
evias/nem-php | src/Infrastructure/Network.php | Network.fromAddress | static public function fromAddress($address)
{
if ($address instanceof Address) {
$addr = $address->toClean();
$prefix = substr($addr, 0, 1);
}
elseif (is_string($address)) {
$prefix = substr($address, 0, 1);
}
else {
throw new ... | php | static public function fromAddress($address)
{
if ($address instanceof Address) {
$addr = $address->toClean();
$prefix = substr($addr, 0, 1);
}
elseif (is_string($address)) {
$prefix = substr($address, 0, 1);
}
else {
throw new ... | [
"static",
"public",
"function",
"fromAddress",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"$",
"address",
"instanceof",
"Address",
")",
"{",
"$",
"addr",
"=",
"$",
"address",
"->",
"toClean",
"(",
")",
";",
"$",
"prefix",
"=",
"substr",
"(",
"$",
"add... | Load a NetworkInfo object from an `address`.
@param string|\NEM\Models\Address $address
@return \NEM\Models\Model
@throws \InvalidArgumentException On invalid address format or unrecognized address first character. | [
"Load",
"a",
"NetworkInfo",
"object",
"from",
"an",
"address",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Network.php#L69-L90 |
evias/nem-php | src/Infrastructure/Network.php | Network.getPrefixFromId | static public function getPrefixFromId($networkId)
{
foreach (self::$networkInfos as $name => $spec) {
if ($networkId === $spec['id'])
return $spec['hex'];
}
throw new NISInvalidNetworkId("Network Id '" . $networkId . "' is invalid.");
} | php | static public function getPrefixFromId($networkId)
{
foreach (self::$networkInfos as $name => $spec) {
if ($networkId === $spec['id'])
return $spec['hex'];
}
throw new NISInvalidNetworkId("Network Id '" . $networkId . "' is invalid.");
} | [
"static",
"public",
"function",
"getPrefixFromId",
"(",
"$",
"networkId",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"networkInfos",
"as",
"$",
"name",
"=>",
"$",
"spec",
")",
"{",
"if",
"(",
"$",
"networkId",
"===",
"$",
"spec",
"[",
"'id'",
"]",
... | Helper to get a network address prefix hexadecimal representation
from a network id.
@param integer $networkId
@return string | [
"Helper",
"to",
"get",
"a",
"network",
"address",
"prefix",
"hexadecimal",
"representation",
"from",
"a",
"network",
"id",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Network.php#L99-L107 |
evias/nem-php | src/Infrastructure/Network.php | Network.getFromId | static public function getFromId($networkId, $field = "name")
{
foreach (self::$networkInfos as $name => $spec) {
if ($spec["id"] !== (int) $networkId) continue;
if ($field === "name")
return $name;
elseif (in_array($field, array_keys($spec)))
... | php | static public function getFromId($networkId, $field = "name")
{
foreach (self::$networkInfos as $name => $spec) {
if ($spec["id"] !== (int) $networkId) continue;
if ($field === "name")
return $name;
elseif (in_array($field, array_keys($spec)))
... | [
"static",
"public",
"function",
"getFromId",
"(",
"$",
"networkId",
",",
"$",
"field",
"=",
"\"name\"",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"networkInfos",
"as",
"$",
"name",
"=>",
"$",
"spec",
")",
"{",
"if",
"(",
"$",
"spec",
"[",
"\"id\""... | Helper to load a network field from a given `networkId`.
@param integer $networkId
@param string $field Defaults to "name".
@return null|string|integer | [
"Helper",
"to",
"load",
"a",
"network",
"field",
"from",
"a",
"given",
"networkId",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Infrastructure/Network.php#L116-L132 |
evias/nem-php | src/Models/MosaicDefinitions.php | MosaicDefinitions.create | static public function create(MosaicAttachments $mosaics = null, $networkId = 104)
{
if (! self::$definitions) {
self::$definitions = new static([
Registry::getDefinition("nem:xem")
]);
}
if ($mosaics === null) {
return self::$definitions;... | php | static public function create(MosaicAttachments $mosaics = null, $networkId = 104)
{
if (! self::$definitions) {
self::$definitions = new static([
Registry::getDefinition("nem:xem")
]);
}
if ($mosaics === null) {
return self::$definitions;... | [
"static",
"public",
"function",
"create",
"(",
"MosaicAttachments",
"$",
"mosaics",
"=",
"null",
",",
"$",
"networkId",
"=",
"104",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"definitions",
")",
"{",
"self",
"::",
"$",
"definitions",
"=",
"new",
"sta... | Class method to create a MosaicDefinitions *array*.
This array will *always* contain MosaicDefinition objects
for the mosaics that are pre-configured.
@return \NEM\Models\MosaicDefinitions | [
"Class",
"method",
"to",
"create",
"a",
"MosaicDefinitions",
"*",
"array",
"*",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicDefinitions.php#L50-L95 |
evias/nem-php | src/Models/MosaicDefinitions.php | MosaicDefinitions.getDefinition | public function getDefinition($mosaic)
{
if (! $this->count()) {
return false;
}
$mosaic = $this->prepareMosaic($mosaic);
foreach ($this->all() as $definition) {
if ($mosaic->getFQN() != $definition->id()->getFQN()) {
continue;
}
... | php | public function getDefinition($mosaic)
{
if (! $this->count()) {
return false;
}
$mosaic = $this->prepareMosaic($mosaic);
foreach ($this->all() as $definition) {
if ($mosaic->getFQN() != $definition->id()->getFQN()) {
continue;
}
... | [
"public",
"function",
"getDefinition",
"(",
"$",
"mosaic",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"count",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"mosaic",
"=",
"$",
"this",
"->",
"prepareMosaic",
"(",
"$",
"mosaic",
")",
";",
... | This method will find a said `MosaicDefinition` for the
given `mosaic` in the current definitions collection.
@param string|\NEM\Models\Mosaic $mosaic
@return false|\NEM\Models\MosaicDefinition | [
"This",
"method",
"will",
"find",
"a",
"said",
"MosaicDefinition",
"for",
"the",
"given",
"mosaic",
"in",
"the",
"current",
"definitions",
"collection",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicDefinitions.php#L152-L168 |
evias/nem-php | src/Models/MosaicDefinitions.php | MosaicDefinitions.prepareMosaic | protected function prepareMosaic($mosaic)
{
if ($mosaic instanceof Mosaic) {
return $mosaic;
}
elseif (is_string($mosaic)) {
return Mosaic::create($mosaic);
}
elseif (is_array($mosaic)) {
$fqmn = $mosaic["namespaceId"] . ":" . $mosaic["name... | php | protected function prepareMosaic($mosaic)
{
if ($mosaic instanceof Mosaic) {
return $mosaic;
}
elseif (is_string($mosaic)) {
return Mosaic::create($mosaic);
}
elseif (is_array($mosaic)) {
$fqmn = $mosaic["namespaceId"] . ":" . $mosaic["name... | [
"protected",
"function",
"prepareMosaic",
"(",
"$",
"mosaic",
")",
"{",
"if",
"(",
"$",
"mosaic",
"instanceof",
"Mosaic",
")",
"{",
"return",
"$",
"mosaic",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"mosaic",
")",
")",
"{",
"return",
"Mosaic",
":... | Internal helper to wrap a mosaic FQN into a
\NEM\Models\Mosaic instance.
@param string|\NEM\Models\Mosaic $mosaic
@return \NEM\Models\Mosaic | [
"Internal",
"helper",
"to",
"wrap",
"a",
"mosaic",
"FQN",
"into",
"a",
"\\",
"NEM",
"\\",
"Models",
"\\",
"Mosaic",
"instance",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicDefinitions.php#L177-L191 |
evias/nem-php | src/Models/MosaicProperty.php | MosaicProperty.toDTO | public function toDTO($filterByKey = null)
{
$value = (string) $this->value;
if (in_array($this->name, ["supplyMutable", "transferable"])) {
$value = ($value !== "false" && (bool) $value) ? "true" : "false";
}
elseif (empty($value) || 0 > (int) $value) {
$valu... | php | public function toDTO($filterByKey = null)
{
$value = (string) $this->value;
if (in_array($this->name, ["supplyMutable", "transferable"])) {
$value = ($value !== "false" && (bool) $value) ? "true" : "false";
}
elseif (empty($value) || 0 > (int) $value) {
$valu... | [
"public",
"function",
"toDTO",
"(",
"$",
"filterByKey",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"value",
";",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"name",
",",
"[",
"\"supplyMutable\"",
",",
"\"trans... | Address DTO automatically cleans address representation.
@return array Associative array with key `address` containing a NIS *compliable* address representation. | [
"Address",
"DTO",
"automatically",
"cleans",
"address",
"representation",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicProperty.php#L49-L63 |
evias/nem-php | src/Models/MosaicProperty.php | MosaicProperty.serialize | public function serialize($parameters = null)
{
$nisData = $this->toDTO();
// shortcuts
$serializer = $this->getSerializer();
$serializedName = $serializer->serializeString($nisData["name"]);
$serializedValue = $serializer->serializeString($nisData["value"]);
ret... | php | public function serialize($parameters = null)
{
$nisData = $this->toDTO();
// shortcuts
$serializer = $this->getSerializer();
$serializedName = $serializer->serializeString($nisData["name"]);
$serializedValue = $serializer->serializeString($nisData["value"]);
ret... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"nisData",
"=",
"$",
"this",
"->",
"toDTO",
"(",
")",
";",
"// shortcuts",
"$",
"serializer",
"=",
"$",
"this",
"->",
"getSerializer",
"(",
")",
";",
"$",
"serialize... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *Mosaic Definition Properties* serialization.
@see \NEM\Contracts\Serializable
@param null|string $parameters non-null will return only the named sub-dtos.
@return array Returns a byte-array with values in UInt8 representa... | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"Mosaic",
"Definition",
"Properties",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/MosaicProperty.php#L73-L83 |
evias/nem-php | src/Models/Transaction/Signature.php | Signature.toDTO | public function toDTO($filterByKey = null)
{
$baseMeta = $this->meta();
$baseEntity = [
"timeStamp" => $this->timeStamp()->toDTO(),
"fee" => $this->fee()->toMicro(),
"otherHash" => [
"data" => $this->getAttribute("otherHash"),
],... | php | public function toDTO($filterByKey = null)
{
$baseMeta = $this->meta();
$baseEntity = [
"timeStamp" => $this->timeStamp()->toDTO(),
"fee" => $this->fee()->toMicro(),
"otherHash" => [
"data" => $this->getAttribute("otherHash"),
],... | [
"public",
"function",
"toDTO",
"(",
"$",
"filterByKey",
"=",
"null",
")",
"{",
"$",
"baseMeta",
"=",
"$",
"this",
"->",
"meta",
"(",
")",
";",
"$",
"baseEntity",
"=",
"[",
"\"timeStamp\"",
"=>",
"$",
"this",
"->",
"timeStamp",
"(",
")",
"->",
"toDTO"... | Overload of the toDTO() logic to skip "meta" and "transaction"
sub-dto pairing.
@return array Associative array containing a NIS *compliable* account representation. | [
"Overload",
"of",
"the",
"toDTO",
"()",
"logic",
"to",
"skip",
"meta",
"and",
"transaction",
"sub",
"-",
"dto",
"pairing",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/Signature.php#L55-L95 |
evias/nem-php | src/Models/Transaction/Signature.php | Signature.serialize | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->toDTO();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
$binHash = hex2bin($nisData["otherHash"]["data"]);
// serialize spec... | php | public function serialize($parameters = null)
{
$baseTx = parent::serialize($parameters);
$nisData = $this->toDTO();
// shortcuts
$serializer = $this->getSerializer();
$output = [];
$binHash = hex2bin($nisData["otherHash"]["data"]);
// serialize spec... | [
"public",
"function",
"serialize",
"(",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"baseTx",
"=",
"parent",
"::",
"serialize",
"(",
"$",
"parameters",
")",
";",
"$",
"nisData",
"=",
"$",
"this",
"->",
"toDTO",
"(",
")",
";",
"// shortcuts",
"$",
... | Overload of the \NEM\Core\Model::serialize() method to provide
with a specialization for *Signature transaction* serialization.
@see \NEM\Contracts\Serializable
@param null|string $parameters non-null will return only the named sub-dtos.
@return array Returns a byte-array with values in UInt8 representation. | [
"Overload",
"of",
"the",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Model",
"::",
"serialize",
"()",
"method",
"to",
"provide",
"with",
"a",
"specialization",
"for",
"*",
"Signature",
"transaction",
"*",
"serialization",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Transaction/Signature.php#L105-L128 |
evias/nem-php | src/Models/Message.php | Message.toDTO | public function toDTO($filterByKey = null)
{
// CryptoHelper will store a KeyPair when necessary
// to allow encryption (needs private + public keys)
$helper = new CryptoHelper();
$plain = $this->getPlain();
if (empty($plain) || !isset($this->type))
$this->type... | php | public function toDTO($filterByKey = null)
{
// CryptoHelper will store a KeyPair when necessary
// to allow encryption (needs private + public keys)
$helper = new CryptoHelper();
$plain = $this->getPlain();
if (empty($plain) || !isset($this->type))
$this->type... | [
"public",
"function",
"toDTO",
"(",
"$",
"filterByKey",
"=",
"null",
")",
"{",
"// CryptoHelper will store a KeyPair when necessary",
"// to allow encryption (needs private + public keys)",
"$",
"helper",
"=",
"new",
"CryptoHelper",
"(",
")",
";",
"$",
"plain",
"=",
"$"... | Account DTO represents NIS API's [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair).
@see [AccountMetaDataPair](https://bob.nem.ninja/docs/#accountMetaDataPair)
@return array Associative array containing a NIS *compliable* account representation. | [
"Account",
"DTO",
"represents",
"NIS",
"API",
"s",
"[",
"AccountMetaDataPair",
"]",
"(",
"https",
":",
"//",
"bob",
".",
"nem",
".",
"ninja",
"/",
"docs",
"/",
"#accountMetaDataPair",
")",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Message.php#L72-L112 |
evias/nem-php | src/Models/Message.php | Message.toHex | public function toHex($prefixHexContent = false)
{
$chars = $this->getPlain();
if ($prefixHexContent && ctype_xdigit($chars)) {
return "fe" . $chars;
}
$payload = "";
for ($c = 0, $cnt = strlen($chars); $c < $cnt; $c++ ) {
$decimal = ord($chars[$c]);
... | php | public function toHex($prefixHexContent = false)
{
$chars = $this->getPlain();
if ($prefixHexContent && ctype_xdigit($chars)) {
return "fe" . $chars;
}
$payload = "";
for ($c = 0, $cnt = strlen($chars); $c < $cnt; $c++ ) {
$decimal = ord($chars[$c]);
... | [
"public",
"function",
"toHex",
"(",
"$",
"prefixHexContent",
"=",
"false",
")",
"{",
"$",
"chars",
"=",
"$",
"this",
"->",
"getPlain",
"(",
")",
";",
"if",
"(",
"$",
"prefixHexContent",
"&&",
"ctype_xdigit",
"(",
"$",
"chars",
")",
")",
"{",
"return",
... | Helper to retrieve the hexadecimal representation of a message.
@return string | [
"Helper",
"to",
"retrieve",
"the",
"hexadecimal",
"representation",
"of",
"a",
"message",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Message.php#L119-L137 |
evias/nem-php | src/Models/Message.php | Message.toPlain | public function toPlain($hex = null)
{
if (empty($this->payload) && empty($hex))
return "";
$plain = "";
$payload = $hex ?: $this->payload;
for ($c = 0, $cnt = strlen($payload); $c < $cnt; $c += 2) {
$hex = substr($payload, $c, 2);
$decimal = hexd... | php | public function toPlain($hex = null)
{
if (empty($this->payload) && empty($hex))
return "";
$plain = "";
$payload = $hex ?: $this->payload;
for ($c = 0, $cnt = strlen($payload); $c < $cnt; $c += 2) {
$hex = substr($payload, $c, 2);
$decimal = hexd... | [
"public",
"function",
"toPlain",
"(",
"$",
"hex",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"payload",
")",
"&&",
"empty",
"(",
"$",
"hex",
")",
")",
"return",
"\"\"",
";",
"$",
"plain",
"=",
"\"\"",
";",
"$",
"payload",
... | Helper to retrieve the UTF8 representation of a message
payload (hexadecimal representation).
@return string | [
"Helper",
"to",
"retrieve",
"the",
"UTF8",
"representation",
"of",
"a",
"message",
"payload",
"(",
"hexadecimal",
"representation",
")",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Models/Message.php#L145-L159 |
evias/nem-php | src/Core/Encryption.php | Encryption.prepareInputBuffer | protected static function prepareInputBuffer($data)
{
if ($data instanceof Buffer) {
return $data;
}
elseif (is_string($data) && ctype_xdigit($data)) {
return Buffer::fromHex($data);
}
elseif (is_string($data)) {
return new Buffer($data);
... | php | protected static function prepareInputBuffer($data)
{
if ($data instanceof Buffer) {
return $data;
}
elseif (is_string($data) && ctype_xdigit($data)) {
return Buffer::fromHex($data);
}
elseif (is_string($data)) {
return new Buffer($data);
... | [
"protected",
"static",
"function",
"prepareInputBuffer",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"Buffer",
")",
"{",
"return",
"$",
"data",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"data",
")",
"&&",
"ctype_xdigit",
"(",
... | Helper to prepare a `data` attribute into a \NEM\Core\Buffer
object for easier internal data representations.
@param null|string|\NEM\Core\Buffer $data The data that needs to be added to the returned Buffer.
@return \NEM\Core\Buffer | [
"Helper",
"to",
"prepare",
"a",
"data",
"attribute",
"into",
"a",
"\\",
"NEM",
"\\",
"Core",
"\\",
"Buffer",
"object",
"for",
"easier",
"internal",
"data",
"representations",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L62-L79 |
evias/nem-php | src/Core/Encryption.php | Encryption.derive | public static function derive($algorithm, $password, $salt, $count = 6000, $keyLength = 64) // 6000=NanoWallet, 64=512bits
{
// shortcuts + use Buffer always
$password = self::prepareInputBuffer($password);
$salt = self::prepareInputBuffer($salt);
if ($keyLength < 0) {
t... | php | public static function derive($algorithm, $password, $salt, $count = 6000, $keyLength = 64) // 6000=NanoWallet, 64=512bits
{
// shortcuts + use Buffer always
$password = self::prepareInputBuffer($password);
$salt = self::prepareInputBuffer($salt);
if ($keyLength < 0) {
t... | [
"public",
"static",
"function",
"derive",
"(",
"$",
"algorithm",
",",
"$",
"password",
",",
"$",
"salt",
",",
"$",
"count",
"=",
"6000",
",",
"$",
"keyLength",
"=",
"64",
")",
"// 6000=NanoWallet, 64=512bits",
"{",
"// shortcuts + use Buffer always",
"$",
"pas... | PBKDF2 : Password Based Key Derivation Function
For the name of selected hashing algorithms (i.e. md5,
sha256, haval160,4, etc..), see hash_algos() for a list
of supported algorithms.
This method can be used when PBKDF2 must be used, typically with
NEM this is used to derive a Private key off a Password.
@param st... | [
"PBKDF2",
":",
"Password",
"Based",
"Key",
"Derivation",
"Function"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L102-L124 |
evias/nem-php | src/Core/Encryption.php | Encryption.hash | public static function hash($algo, $data, $returnRaw = false)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
if (in_array($algo, hash_algos())) {
// use PHP hash()
$hash = hash($algo, $data->getBinary(), true);
}
elseif (s... | php | public static function hash($algo, $data, $returnRaw = false)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
if (in_array($algo, hash_algos())) {
// use PHP hash()
$hash = hash($algo, $data->getBinary(), true);
}
elseif (s... | [
"public",
"static",
"function",
"hash",
"(",
"$",
"algo",
",",
"$",
"data",
",",
"$",
"returnRaw",
"=",
"false",
")",
"{",
"// shortcuts + use Buffer always",
"$",
"data",
"=",
"self",
"::",
"prepareInputBuffer",
"(",
"$",
"data",
")",
";",
"if",
"(",
"i... | Helper to hash the provided buffer `data`'s content
with algorithm `algo`.
The hash algorithm can contain `keccak-256` for example.
@param string $algo
@param string|\NEM\Core\Buffer $data
@param boolean $returnRaw
@return \NEM\Core\Buffer | [
"Helper",
"to",
"hash",
"the",
"provided",
"buffer",
"data",
"s",
"content",
"with",
"algorithm",
"algo",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L137-L159 |
evias/nem-php | src/Core/Encryption.php | Encryption.hash_init | public static function hash_init($algorithm)
{
if (in_array($algorithm, hash_algos())) {
// use PHP hash()
$res = hash_init($algorithm);
}
else {
throw new RuntimeException("Unsupported hash algorithm '" . $algo . "'.");
}
//XXX should ret... | php | public static function hash_init($algorithm)
{
if (in_array($algorithm, hash_algos())) {
// use PHP hash()
$res = hash_init($algorithm);
}
else {
throw new RuntimeException("Unsupported hash algorithm '" . $algo . "'.");
}
//XXX should ret... | [
"public",
"static",
"function",
"hash_init",
"(",
"$",
"algorithm",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"algorithm",
",",
"hash_algos",
"(",
")",
")",
")",
"{",
"// use PHP hash()",
"$",
"res",
"=",
"hash_init",
"(",
"$",
"algorithm",
")",
";",
... | Helper to initialize *a incremental Hasher* for the hashing
algorithm `algorithm`.
This method will return a Resource that can be passed to the
hash_update() method.
@param string $algorithm
@return resource|\NEM\Core\KeccakSponge | [
"Helper",
"to",
"initialize",
"*",
"a",
"incremental",
"Hasher",
"*",
"for",
"the",
"hashing",
"algorithm",
"algorithm",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L171-L183 |
evias/nem-php | src/Core/Encryption.php | Encryption.hash_update | public static function hash_update($hasher, $data)
{
// use Buffer always
$data = self::prepareInputBuffer($data);
//XXX should use Hasher class to keep track of key size
return hash_update($hasher, $data->getBinary());
} | php | public static function hash_update($hasher, $data)
{
// use Buffer always
$data = self::prepareInputBuffer($data);
//XXX should use Hasher class to keep track of key size
return hash_update($hasher, $data->getBinary());
} | [
"public",
"static",
"function",
"hash_update",
"(",
"$",
"hasher",
",",
"$",
"data",
")",
"{",
"// use Buffer always",
"$",
"data",
"=",
"self",
"::",
"prepareInputBuffer",
"(",
"$",
"data",
")",
";",
"//XXX should use Hasher class to keep track of key size",
"retur... | Helper to update *a incremental Hasher* with some data.
This method will edit the Resource directly.
@param resource|KeccakSponge $hasher
@param string|\NEM\Core\Buffer $data
@return resource|\NEM\Core\KeccakSponge | [
"Helper",
"to",
"update",
"*",
"a",
"incremental",
"Hasher",
"*",
"with",
"some",
"data",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L194-L201 |
evias/nem-php | src/Core/Encryption.php | Encryption.hash_final | public static function hash_final($hasher, $returnRaw = false)
{
$hash = hash_final($hasher, true);
if ((bool) $returnRaw) {
return $hash;
}
//XXX should use Hasher class to keep track of key size
return new Buffer($hash);
} | php | public static function hash_final($hasher, $returnRaw = false)
{
$hash = hash_final($hasher, true);
if ((bool) $returnRaw) {
return $hash;
}
//XXX should use Hasher class to keep track of key size
return new Buffer($hash);
} | [
"public",
"static",
"function",
"hash_final",
"(",
"$",
"hasher",
",",
"$",
"returnRaw",
"=",
"false",
")",
"{",
"$",
"hash",
"=",
"hash_final",
"(",
"$",
"hasher",
",",
"true",
")",
";",
"if",
"(",
"(",
"bool",
")",
"$",
"returnRaw",
")",
"{",
"re... | Helper to finalize *a incremental Hasher*.
This will close the Input Phase of the incremental
hashing mechanism.
@param resource|KeccakSponge $hasher
@param bool $returnRaw
@return \NEM\Core\Buffer|string | [
"Helper",
"to",
"finalize",
"*",
"a",
"incremental",
"Hasher",
"*",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L213-L223 |
evias/nem-php | src/Core/Encryption.php | Encryption.hmac | public static function hmac($algo, $data, $salt)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
$salt = self::prepareInputBuffer($salt);
return new Buffer(hash_hmac($algo, $data->getBinary(), $salt->getBinary(), true));
} | php | public static function hmac($algo, $data, $salt)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
$salt = self::prepareInputBuffer($salt);
return new Buffer(hash_hmac($algo, $data->getBinary(), $salt->getBinary(), true));
} | [
"public",
"static",
"function",
"hmac",
"(",
"$",
"algo",
",",
"$",
"data",
",",
"$",
"salt",
")",
"{",
"// shortcuts + use Buffer always",
"$",
"data",
"=",
"self",
"::",
"prepareInputBuffer",
"(",
"$",
"data",
")",
";",
"$",
"salt",
"=",
"self",
"::",
... | HMAC : Hash based Message Authentication Code
A MAC authenticates a message. It is a signature based on a secret key (salt).
@param string $algorithm Which hash algorithm to use.
@param string|NEM\Core\Buffer $data
@param string|NEM\Core\Buffer $salt
@return NEM\Core\Buffer | [
"HMAC",
":",
"Hash",
"based",
"Message",
"Authentication",
"Code"
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L235-L242 |
evias/nem-php | src/Core/Encryption.php | Encryption.checksum | public static function checksum($algo, $data, $checksumLen = 4)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
$hash = self::hash($algo, $data, false)->getBinary();
$out = new Buffer(substr($hash, 0, $checksumLen), $checksumLen);
return $out;
... | php | public static function checksum($algo, $data, $checksumLen = 4)
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
$hash = self::hash($algo, $data, false)->getBinary();
$out = new Buffer(substr($hash, 0, $checksumLen), $checksumLen);
return $out;
... | [
"public",
"static",
"function",
"checksum",
"(",
"$",
"algo",
",",
"$",
"data",
",",
"$",
"checksumLen",
"=",
"4",
")",
"{",
"// shortcuts + use Buffer always",
"$",
"data",
"=",
"self",
"::",
"prepareInputBuffer",
"(",
"$",
"data",
")",
";",
"$",
"hash",
... | Generate a checksum of data buffer `data` and of length
`checksumLen`. Default length is 4 bytes.
@param string $algo
@param string|\NEM\Core\Buffer $data
@param integer $checksumLen
@return \NEM\Core\Buffer | [
"Generate",
"a",
"checksum",
"of",
"data",
"buffer",
"data",
"and",
"of",
"length",
"checksumLen",
".",
"Default",
"length",
"is",
"4",
"bytes",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L253-L260 |
evias/nem-php | src/Core/Encryption.php | Encryption.sign | public static function sign(KeyPair $keyPair, $data, $algorithm = "keccak-512")
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
// shortcuts
$secretKey = $keyPair->getSecretKey()->getBinary();
$publicKey = $keyPair->getPublicKey()->getBinary();
... | php | public static function sign(KeyPair $keyPair, $data, $algorithm = "keccak-512")
{
// shortcuts + use Buffer always
$data = self::prepareInputBuffer($data);
// shortcuts
$secretKey = $keyPair->getSecretKey()->getBinary();
$publicKey = $keyPair->getPublicKey()->getBinary();
... | [
"public",
"static",
"function",
"sign",
"(",
"KeyPair",
"$",
"keyPair",
",",
"$",
"data",
",",
"$",
"algorithm",
"=",
"\"keccak-512\"",
")",
"{",
"// shortcuts + use Buffer always",
"$",
"data",
"=",
"self",
"::",
"prepareInputBuffer",
"(",
"$",
"data",
")",
... | This method lets you sign `data` with a given `keyPair`.
The signature scheme of NEM can be divided in following steps:
- step 1: hash the keypair secret key (byte-level reversed private key) with keccak-512
- step 2: generate `r` with `r = H(priv[32..64], data)`
- step 3: generate encodedR with ED25519 scalar multip... | [
"This",
"method",
"lets",
"you",
"sign",
"data",
"with",
"a",
"given",
"keyPair",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Core/Encryption.php#L280-L350 |
evias/nem-php | src/Handlers/GuzzleRequestHandler.php | GuzzleRequestHandler.promiseResponse | protected function promiseResponse(Client $client, Request $request, array $options = [])
{
// Guzzle Promises do not allow Asynchronous Requests Handling,
// I have implemented this feature only because it will
// allow a better Response Time for Paralell Request Handling.
// This w... | php | protected function promiseResponse(Client $client, Request $request, array $options = [])
{
// Guzzle Promises do not allow Asynchronous Requests Handling,
// I have implemented this feature only because it will
// allow a better Response Time for Paralell Request Handling.
// This w... | [
"protected",
"function",
"promiseResponse",
"(",
"Client",
"$",
"client",
",",
"Request",
"$",
"request",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"// Guzzle Promises do not allow Asynchronous Requests Handling,",
"// I have implemented this feature only becau... | Use GuzzleHTTP Promises v6 Implementation to send
the request asynchronously. As mentioned in the source
code, this method will only leverage the advantages
of Asynchronous execution in later versions.
The current version uses the Promises but will synchronously
execute the Request and wait for it to response.
Config... | [
"Use",
"GuzzleHTTP",
"Promises",
"v6",
"Implementation",
"to",
"send",
"the",
"request",
"asynchronously",
".",
"As",
"mentioned",
"in",
"the",
"source",
"code",
"this",
"method",
"will",
"only",
"leverage",
"the",
"advantages",
"of",
"Asynchronous",
"execution",
... | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Handlers/GuzzleRequestHandler.php#L60-L105 |
evias/nem-php | src/Handlers/GuzzleRequestHandler.php | GuzzleRequestHandler.status | public function status(array $options = [], $usePromises = false)
{
$headers = [];
if (!empty($options["headers"]))
$headers = $options["headers"];
// get generic headers
$headers = $this->normalizeHeaders($headers);
// prepare guzzle request options
$op... | php | public function status(array $options = [], $usePromises = false)
{
$headers = [];
if (!empty($options["headers"]))
$headers = $options["headers"];
// get generic headers
$headers = $this->normalizeHeaders($headers);
// prepare guzzle request options
$op... | [
"public",
"function",
"status",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"usePromises",
"=",
"false",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"\"headers\"",
"]",
")",
")",
"$"... | This method triggers a GET request to the given
Base URL with the URI `/heartbeat` using the GuzzleHttp
client.
Default behaviour disables Promises Features.
Promises Features
- success callback can be configured with $options["onSuccess"],
a ResponseInterface object will be passed to this callable when
the Request C... | [
"This",
"method",
"triggers",
"a",
"GET",
"request",
"to",
"the",
"given",
"Base",
"URL",
"with",
"the",
"URI",
"/",
"heartbeat",
"using",
"the",
"GuzzleHttp",
"client",
"."
] | train | https://github.com/evias/nem-php/blob/88cf1674077ed1146b85521db25c09e60c3634bb/src/Handlers/GuzzleRequestHandler.php#L130-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.