id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
190,500 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle.withPEM | public function withPEM(PEM $pem): self
{
$certs = $this->_certs;
$certs[] = Certificate::fromPEM($pem);
return new self(...$certs);
} | php | public function withPEM(PEM $pem): self
{
$certs = $this->_certs;
$certs[] = Certificate::fromPEM($pem);
return new self(...$certs);
} | [
"public",
"function",
"withPEM",
"(",
"PEM",
"$",
"pem",
")",
":",
"self",
"{",
"$",
"certs",
"=",
"$",
"this",
"->",
"_certs",
";",
"$",
"certs",
"[",
"]",
"=",
"Certificate",
"::",
"fromPEM",
"(",
"$",
"pem",
")",
";",
"return",
"new",
"self",
... | Get self with single certificate from PEM added.
@param PEM $pem
@return self | [
"Get",
"self",
"with",
"single",
"certificate",
"from",
"PEM",
"added",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L107-L112 |
190,501 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle.contains | public function contains(Certificate $cert): bool
{
$id = self::_getCertKeyId($cert);
$map = $this->_getKeyIdMap();
if (!isset($map[$id])) {
return false;
}
foreach ($map[$id] as $c) {
/** @var Certificate $c */
if ($cert->equals($c)) {
... | php | public function contains(Certificate $cert): bool
{
$id = self::_getCertKeyId($cert);
$map = $this->_getKeyIdMap();
if (!isset($map[$id])) {
return false;
}
foreach ($map[$id] as $c) {
/** @var Certificate $c */
if ($cert->equals($c)) {
... | [
"public",
"function",
"contains",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"id",
"=",
"self",
"::",
"_getCertKeyId",
"(",
"$",
"cert",
")",
";",
"$",
"map",
"=",
"$",
"this",
"->",
"_getKeyIdMap",
"(",
")",
";",
"if",
"(",
"!",
... | Check whether bundle contains a given certificate.
@param Certificate $cert
@return bool | [
"Check",
"whether",
"bundle",
"contains",
"a",
"given",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L120-L134 |
190,502 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle.allBySubjectKeyIdentifier | public function allBySubjectKeyIdentifier(string $id): array
{
$map = $this->_getKeyIdMap();
if (!isset($map[$id])) {
return array();
}
return $map[$id];
} | php | public function allBySubjectKeyIdentifier(string $id): array
{
$map = $this->_getKeyIdMap();
if (!isset($map[$id])) {
return array();
}
return $map[$id];
} | [
"public",
"function",
"allBySubjectKeyIdentifier",
"(",
"string",
"$",
"id",
")",
":",
"array",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"_getKeyIdMap",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"map",
"[",
"$",
"id",
"]",
")",
")",
"{",
... | Get all certificates that have given subject key identifier.
@param string $id
@return Certificate[] | [
"Get",
"all",
"certificates",
"that",
"have",
"given",
"subject",
"key",
"identifier",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L142-L149 |
190,503 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle._getKeyIdMap | private function _getKeyIdMap(): array
{
// lazily build mapping
if (!isset($this->_keyIdMap)) {
$this->_keyIdMap = array();
foreach ($this->_certs as $cert) {
$id = self::_getCertKeyId($cert);
if (!isset($this->_keyIdMap[$id])) {
... | php | private function _getKeyIdMap(): array
{
// lazily build mapping
if (!isset($this->_keyIdMap)) {
$this->_keyIdMap = array();
foreach ($this->_certs as $cert) {
$id = self::_getCertKeyId($cert);
if (!isset($this->_keyIdMap[$id])) {
... | [
"private",
"function",
"_getKeyIdMap",
"(",
")",
":",
"array",
"{",
"// lazily build mapping",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_keyIdMap",
")",
")",
"{",
"$",
"this",
"->",
"_keyIdMap",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$"... | Get certificate mapping by public key id.
@return (Certificate[])[] | [
"Get",
"certificate",
"mapping",
"by",
"public",
"key",
"id",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L166-L180 |
190,504 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle._getCertKeyId | private static function _getCertKeyId(Certificate $cert): string
{
$exts = $cert->tbsCertificate()->extensions();
if ($exts->hasSubjectKeyIdentifier()) {
return $exts->subjectKeyIdentifier()->keyIdentifier();
}
return $cert->tbsCertificate()
->subjectPublicKey... | php | private static function _getCertKeyId(Certificate $cert): string
{
$exts = $cert->tbsCertificate()->extensions();
if ($exts->hasSubjectKeyIdentifier()) {
return $exts->subjectKeyIdentifier()->keyIdentifier();
}
return $cert->tbsCertificate()
->subjectPublicKey... | [
"private",
"static",
"function",
"_getCertKeyId",
"(",
"Certificate",
"$",
"cert",
")",
":",
"string",
"{",
"$",
"exts",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",
"if",
"(",
"$",
"exts",
"->",
"hasSubjectKeyId... | Get public key id for the certificate.
@param Certificate $cert
@return string | [
"Get",
"public",
"key",
"id",
"for",
"the",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L188-L197 |
190,505 | phpflo/phpflo | src/PhpFlo/Core/Network.php | Network.shutdown | public function shutdown(): NetworkInterface
{
foreach ($this->processes as $process) {
$process[self::COMPONENT]->shutdown();
}
// explicitly destroy the $connections
foreach ($this->connections as $connection) {
$connection = null;
}
$this-... | php | public function shutdown(): NetworkInterface
{
foreach ($this->processes as $process) {
$process[self::COMPONENT]->shutdown();
}
// explicitly destroy the $connections
foreach ($this->connections as $connection) {
$connection = null;
}
$this-... | [
"public",
"function",
"shutdown",
"(",
")",
":",
"NetworkInterface",
"{",
"foreach",
"(",
"$",
"this",
"->",
"processes",
"as",
"$",
"process",
")",
"{",
"$",
"process",
"[",
"self",
"::",
"COMPONENT",
"]",
"->",
"shutdown",
"(",
")",
";",
"}",
"// exp... | Cleanup network state after runs.
@return NetworkInterface | [
"Cleanup",
"network",
"state",
"after",
"runs",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Network.php#L250-L267 |
190,506 | phpflo/phpflo | src/PhpFlo/Core/Network.php | Network.loadGraph | private function loadGraph(Graph $graph)
{
foreach ($graph->nodes as $node) {
$this->addNode($node);
}
foreach ($graph->edges as $edge) {
$this->addEdge($edge);
}
foreach ($graph->initializers as $initializer) {
$this->addInitial(
... | php | private function loadGraph(Graph $graph)
{
foreach ($graph->nodes as $node) {
$this->addNode($node);
}
foreach ($graph->edges as $edge) {
$this->addEdge($edge);
}
foreach ($graph->initializers as $initializer) {
$this->addInitial(
... | [
"private",
"function",
"loadGraph",
"(",
"Graph",
"$",
"graph",
")",
"{",
"foreach",
"(",
"$",
"graph",
"->",
"nodes",
"as",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"addNode",
"(",
"$",
"node",
")",
";",
"}",
"foreach",
"(",
"$",
"graph",
"->",
... | Load Graph into Network
@param Graph $graph | [
"Load",
"Graph",
"into",
"Network"
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Network.php#L336-L353 |
190,507 | phpflo/phpflo | src/PhpFlo/Core/Network.php | Network.connectPorts | private function connectPorts(
array $from,
array $to,
string $edgeFrom,
string $edgeTo
): NetworkInterface {
if (!$from[self::COMPONENT]->outPorts()->has($edgeFrom)) {
throw new InvalidDefinitionException("No outport {$edgeFrom} defined for process {$from[self::N... | php | private function connectPorts(
array $from,
array $to,
string $edgeFrom,
string $edgeTo
): NetworkInterface {
if (!$from[self::COMPONENT]->outPorts()->has($edgeFrom)) {
throw new InvalidDefinitionException("No outport {$edgeFrom} defined for process {$from[self::N... | [
"private",
"function",
"connectPorts",
"(",
"array",
"$",
"from",
",",
"array",
"$",
"to",
",",
"string",
"$",
"edgeFrom",
",",
"string",
"$",
"edgeTo",
")",
":",
"NetworkInterface",
"{",
"if",
"(",
"!",
"$",
"from",
"[",
"self",
"::",
"COMPONENT",
"]"... | Connect out to inport and compare data types.
@param array $from
@param array $to
@param string $edgeFrom
@param string $edgeTo
@return NetworkInterface
@throws IncompatibleDatatypeException
@throws InvalidDefinitionException | [
"Connect",
"out",
"to",
"inport",
"and",
"compare",
"data",
"types",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Network.php#L392-L448 |
190,508 | phpflo/phpflo | src/PhpFlo/FlowTrace/TraceableNetwork.php | TraceableNetwork.trace | private function trace(string $type): \Closure
{
$trace = function() use ($type) {
switch ($type) {
case TraceableNetwork::TYPE_DATA:
$this->traceData(func_get_args(), $type);
break;
case TraceableNetwork::TYPE_CONNECT:
... | php | private function trace(string $type): \Closure
{
$trace = function() use ($type) {
switch ($type) {
case TraceableNetwork::TYPE_DATA:
$this->traceData(func_get_args(), $type);
break;
case TraceableNetwork::TYPE_CONNECT:
... | [
"private",
"function",
"trace",
"(",
"string",
"$",
"type",
")",
":",
"\\",
"Closure",
"{",
"$",
"trace",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"TraceableNetwork",
"::",
"TYPE_DATA... | Wrap the creation of the callback
@param string $type
@return \Closure | [
"Wrap",
"the",
"creation",
"of",
"the",
"callback"
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/FlowTrace/TraceableNetwork.php#L70-L85 |
190,509 | phpflo/phpflo | src/PhpFlo/Fbp/Loader/Loader.php | Loader.checkType | private static function checkType(string $file): string
{
$parts = explode('.', $file);
$type = array_pop($parts);
if (!in_array($type, array_keys(self::$types))) {
throw new LoaderException("Loader::checkType(): Could not find parser for {$file}!");
}
return $t... | php | private static function checkType(string $file): string
{
$parts = explode('.', $file);
$type = array_pop($parts);
if (!in_array($type, array_keys(self::$types))) {
throw new LoaderException("Loader::checkType(): Could not find parser for {$file}!");
}
return $t... | [
"private",
"static",
"function",
"checkType",
"(",
"string",
"$",
"file",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"file",
")",
";",
"$",
"type",
"=",
"array_pop",
"(",
"$",
"parts",
")",
";",
"if",
"(",
"!",
"... | Check file if extension matches a loader.
@param string $file
@return string
@throws LoaderException | [
"Check",
"file",
"if",
"extension",
"matches",
"a",
"loader",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/Loader/Loader.php#L82-L92 |
190,510 | phpflo/phpflo | src/PhpFlo/Core/Graph.php | Graph.save | public function save(string $file): bool
{
$stat = file_put_contents($file, $this->definition->toFbp());
if ($stat === false) {
return false;
}
return true;
} | php | public function save(string $file): bool
{
$stat = file_put_contents($file, $this->definition->toFbp());
if ($stat === false) {
return false;
}
return true;
} | [
"public",
"function",
"save",
"(",
"string",
"$",
"file",
")",
":",
"bool",
"{",
"$",
"stat",
"=",
"file_put_contents",
"(",
"$",
"file",
",",
"$",
"this",
"->",
"definition",
"->",
"toFbp",
"(",
")",
")",
";",
"if",
"(",
"$",
"stat",
"===",
"false... | Save the graph json into the file.
@param string $file
@return bool | [
"Save",
"the",
"graph",
"json",
"into",
"the",
"file",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Graph.php#L244-L253 |
190,511 | phpflo/phpflo | src/PhpFlo/Core/Graph.php | Graph.loadString | public static function loadString(string $string): Graph
{
$loader = new FbpParser($string);
$definition = $loader->run();
return self::loadDefinition($definition);
} | php | public static function loadString(string $string): Graph
{
$loader = new FbpParser($string);
$definition = $loader->run();
return self::loadDefinition($definition);
} | [
"public",
"static",
"function",
"loadString",
"(",
"string",
"$",
"string",
")",
":",
"Graph",
"{",
"$",
"loader",
"=",
"new",
"FbpParser",
"(",
"$",
"string",
")",
";",
"$",
"definition",
"=",
"$",
"loader",
"->",
"run",
"(",
")",
";",
"return",
"se... | Load PhpFlo graph definition from string.
@param string $string FBP defnition string
@throws InvalidDefinitionException
@return Graph | [
"Load",
"PhpFlo",
"graph",
"definition",
"from",
"string",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Graph.php#L262-L268 |
190,512 | phpflo/phpflo | src/PhpFlo/Core/Graph.php | Graph.loadDefinition | public static function loadDefinition(DefinitionInterface $definition): Graph
{
$graph = new Graph($definition);
foreach ($definition->processes() as $id => $def) {
$graph->addNode($id, $def[Net::COMPONENT]);
}
foreach ($definition->initializers() as $initializer) {
... | php | public static function loadDefinition(DefinitionInterface $definition): Graph
{
$graph = new Graph($definition);
foreach ($definition->processes() as $id => $def) {
$graph->addNode($id, $def[Net::COMPONENT]);
}
foreach ($definition->initializers() as $initializer) {
... | [
"public",
"static",
"function",
"loadDefinition",
"(",
"DefinitionInterface",
"$",
"definition",
")",
":",
"Graph",
"{",
"$",
"graph",
"=",
"new",
"Graph",
"(",
"$",
"definition",
")",
";",
"foreach",
"(",
"$",
"definition",
"->",
"processes",
"(",
")",
"a... | Load PhpFlo graph definition.
@param DefinitionInterface $definition
@return Graph | [
"Load",
"PhpFlo",
"graph",
"definition",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Graph.php#L290-L316 |
190,513 | phpflo/phpflo | src/PhpFlo/Fbp/FbpParser.php | FbpParser.hasValue | private function hasValue(array $check, string $value): bool
{
if (empty($check[$value])) {
return false;
}
return true;
} | php | private function hasValue(array $check, string $value): bool
{
if (empty($check[$value])) {
return false;
}
return true;
} | [
"private",
"function",
"hasValue",
"(",
"array",
"$",
"check",
",",
"string",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"check",
"[",
"$",
"value",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"... | Check if array has a specific key and is not empty.
@param array $check
@param string $value
@return bool | [
"Check",
"if",
"array",
"has",
"a",
"specific",
"key",
"and",
"is",
"not",
"empty",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/FbpParser.php#L223-L230 |
190,514 | phpflo/phpflo | src/PhpFlo/Fbp/FbpParser.php | FbpParser.examineProcess | private function examineProcess(array $process)
{
if (!isset($this->definition[self::PROCESSES_LABEL][$process[self::PROCESS_LABEL]])) {
$component = $process[self::COMPONENT_LABEL];
if (empty($component)) {
$component = $process[self::PROCESS_LABEL];
}
... | php | private function examineProcess(array $process)
{
if (!isset($this->definition[self::PROCESSES_LABEL][$process[self::PROCESS_LABEL]])) {
$component = $process[self::COMPONENT_LABEL];
if (empty($component)) {
$component = $process[self::PROCESS_LABEL];
}
... | [
"private",
"function",
"examineProcess",
"(",
"array",
"$",
"process",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"definition",
"[",
"self",
"::",
"PROCESSES_LABEL",
"]",
"[",
"$",
"process",
"[",
"self",
"::",
"PROCESS_LABEL",
"]",
"]",
... | Add entry to processes.
@param array $process | [
"Add",
"entry",
"to",
"processes",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/FbpParser.php#L279-L294 |
190,515 | phpflo/phpflo | src/PhpFlo/Fbp/FbpParser.php | FbpParser.addName | private function addName(string $line)
{
$this->definition[self::PROPERTIES_LABEL]['name'] = trim(str_replace('#', '', $line));
} | php | private function addName(string $line)
{
$this->definition[self::PROPERTIES_LABEL]['name'] = trim(str_replace('#', '', $line));
} | [
"private",
"function",
"addName",
"(",
"string",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"definition",
"[",
"self",
"::",
"PROPERTIES_LABEL",
"]",
"[",
"'name'",
"]",
"=",
"trim",
"(",
"str_replace",
"(",
"'#'",
",",
"''",
",",
"$",
"line",
")",
")... | Add name to definition
@param string $line | [
"Add",
"name",
"to",
"definition"
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/FbpParser.php#L301-L304 |
190,516 | phpflo/phpflo | src/PhpFlo/Fbp/FbpParser.php | FbpParser.doSkip | private function doSkip(string $line): bool
{
switch (true) {
case (empty(trim($line))):
// empty line
$skip = true;
break;
case (1 == preg_match('/(#[\s\w]+)/', $line)):
if (1 === $this->linecountOverall) {
... | php | private function doSkip(string $line): bool
{
switch (true) {
case (empty(trim($line))):
// empty line
$skip = true;
break;
case (1 == preg_match('/(#[\s\w]+)/', $line)):
if (1 === $this->linecountOverall) {
... | [
"private",
"function",
"doSkip",
"(",
"string",
"$",
"line",
")",
":",
"bool",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"empty",
"(",
"trim",
"(",
"$",
"line",
")",
")",
")",
":",
"// empty line",
"$",
"skip",
"=",
"true",
";",
"break",
... | Check if line is empty or has comment.
In case of comments, add name to definition.
@param string $line
@return bool | [
"Check",
"if",
"line",
"is",
"empty",
"or",
"has",
"comment",
".",
"In",
"case",
"of",
"comments",
"add",
"name",
"to",
"definition",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/FbpParser.php#L313-L331 |
190,517 | phpflo/phpflo | src/PhpFlo/Core/Interaction/AbstractPort.php | AbstractPort.isCompatible | public static function isCompatible(string $fromType, string $toType): bool
{
switch (true) {
case (($fromType == $toType) || ($toType == 'all' || $toType == 'bang')):
$isCompatible = true;
break;
case (($fromType == 'int' || $fromType == 'integer') &&... | php | public static function isCompatible(string $fromType, string $toType): bool
{
switch (true) {
case (($fromType == $toType) || ($toType == 'all' || $toType == 'bang')):
$isCompatible = true;
break;
case (($fromType == 'int' || $fromType == 'integer') &&... | [
"public",
"static",
"function",
"isCompatible",
"(",
"string",
"$",
"fromType",
",",
"string",
"$",
"toType",
")",
":",
"bool",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"(",
"$",
"fromType",
"==",
"$",
"toType",
")",
"||",
"(",
"$",
"toType... | Compare in and outport datatypes.
@param string $fromType
@param string $toType
@return bool | [
"Compare",
"in",
"and",
"outport",
"datatypes",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Interaction/AbstractPort.php#L90-L104 |
190,518 | phpflo/phpflo | src/PhpFlo/FlowTrace/Logger/SimpleFile.php | SimpleFile.prepareLogLevels | private function prepareLogLevels(string $level)
{
$levels = [
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::ERROR,
LogLevel::WARNING,
LogLevel::NOTICE,
LogLevel::INFO,
LogLevel::DEBUG,
... | php | private function prepareLogLevels(string $level)
{
$levels = [
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL,
LogLevel::ERROR,
LogLevel::WARNING,
LogLevel::NOTICE,
LogLevel::INFO,
LogLevel::DEBUG,
... | [
"private",
"function",
"prepareLogLevels",
"(",
"string",
"$",
"level",
")",
"{",
"$",
"levels",
"=",
"[",
"LogLevel",
"::",
"EMERGENCY",
",",
"LogLevel",
"::",
"ALERT",
",",
"LogLevel",
"::",
"CRITICAL",
",",
"LogLevel",
"::",
"ERROR",
",",
"LogLevel",
":... | Prepare log levels for logfile
@param string $level | [
"Prepare",
"log",
"levels",
"for",
"logfile"
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/FlowTrace/Logger/SimpleFile.php#L84-L102 |
190,519 | phpflo/phpflo | src/PhpFlo/Fbp/FbpDumper.php | FbpDumper.examineConnectionTouple | private static function examineConnectionTouple(array $connectionTouple): string
{
self::hasElement(self::SOURCE_LABEL, $connectionTouple);
self::hasElement(self::TARGET_LABEL, $connectionTouple);
return self::connectPorts(
self::examineProcess(self::SOURCE_LABEL, $connectionTou... | php | private static function examineConnectionTouple(array $connectionTouple): string
{
self::hasElement(self::SOURCE_LABEL, $connectionTouple);
self::hasElement(self::TARGET_LABEL, $connectionTouple);
return self::connectPorts(
self::examineProcess(self::SOURCE_LABEL, $connectionTou... | [
"private",
"static",
"function",
"examineConnectionTouple",
"(",
"array",
"$",
"connectionTouple",
")",
":",
"string",
"{",
"self",
"::",
"hasElement",
"(",
"self",
"::",
"SOURCE_LABEL",
",",
"$",
"connectionTouple",
")",
";",
"self",
"::",
"hasElement",
"(",
... | Look for all needed fields and build a port -> port connection.
@param array $connectionTouple
@return string | [
"Look",
"for",
"all",
"needed",
"fields",
"and",
"build",
"a",
"port",
"-",
">",
"port",
"connection",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Fbp/FbpDumper.php#L120-L129 |
190,520 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.grant | public function grant($addresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '', $startBlock = 0, $endBlock = null)
{
return $this->jsonRPCClient->execute("grant", array($addresses, $permissions, $nativeAmount, $comment, $commentTo, $startBlock, $endBlock));
} | php | public function grant($addresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '', $startBlock = 0, $endBlock = null)
{
return $this->jsonRPCClient->execute("grant", array($addresses, $permissions, $nativeAmount, $comment, $commentTo, $startBlock, $endBlock));
} | [
"public",
"function",
"grant",
"(",
"$",
"addresses",
",",
"$",
"permissions",
",",
"$",
"nativeAmount",
"=",
"0",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
",",
"$",
"startBlock",
"=",
"0",
",",
"$",
"endBlock",
"=",
"null",
... | Grants permissions to addresses, where addresses is a comma-separated list of addresses and permissions is one
of connect, send, receive, issue, mine, admin, or a comma-separated list thereof. If the chain uses a native
currency, you can send some to each recipient using the native-amount parameter. Returns the txid of... | [
"Grants",
"permissions",
"to",
"addresses",
"where",
"addresses",
"is",
"a",
"comma",
"-",
"separated",
"list",
"of",
"addresses",
"and",
"permissions",
"is",
"one",
"of",
"connect",
"send",
"receive",
"issue",
"mine",
"admin",
"or",
"a",
"comma",
"-",
"sepa... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L468-L471 |
190,521 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.grantFrom | public function grantFrom($fromAddress, $toAddresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '', $startBlock = 0, $endBlock = null)
{
return $this->jsonRPCClient->execute("grantfrom", array($fromAddress, $toAddresses, $permissions, $nativeAmount, $comment, $commentTo, $startBlock, $end... | php | public function grantFrom($fromAddress, $toAddresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '', $startBlock = 0, $endBlock = null)
{
return $this->jsonRPCClient->execute("grantfrom", array($fromAddress, $toAddresses, $permissions, $nativeAmount, $comment, $commentTo, $startBlock, $end... | [
"public",
"function",
"grantFrom",
"(",
"$",
"fromAddress",
",",
"$",
"toAddresses",
",",
"$",
"permissions",
",",
"$",
"nativeAmount",
"=",
"0",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
",",
"$",
"startBlock",
"=",
"0",
",",
... | This works like grant, but with control over the from-address used to grant the permissions. If there are
multiple addresses with administrator permissions on one node, this allows control over which address is used.
@param $fromAddress
@param $toAddresses
@param $permissions
@param int $nativeAmount
@param string $co... | [
"This",
"works",
"like",
"grant",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"used",
"to",
"grant",
"the",
"permissions",
".",
"If",
"there",
"are",
"multiple",
"addresses",
"with",
"administrator",
"permissions",
"on",
"one",
"node",
"... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L487-L490 |
190,522 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.issueFrom | public function issueFrom($fromAddress, $toAddress, $name, $qty, $units = 1, $nativeAmount = 0, $custom = null)
{
return $this->jsonRPCClient->execute("issuefrom", array($fromAddress, $toAddress, $name, $qty, $units, $nativeAmount, $custom));
} | php | public function issueFrom($fromAddress, $toAddress, $name, $qty, $units = 1, $nativeAmount = 0, $custom = null)
{
return $this->jsonRPCClient->execute("issuefrom", array($fromAddress, $toAddress, $name, $qty, $units, $nativeAmount, $custom));
} | [
"public",
"function",
"issueFrom",
"(",
"$",
"fromAddress",
",",
"$",
"toAddress",
",",
"$",
"name",
",",
"$",
"qty",
",",
"$",
"units",
"=",
"1",
",",
"$",
"nativeAmount",
"=",
"0",
",",
"$",
"custom",
"=",
"null",
")",
"{",
"return",
"$",
"this",... | This works like issue, but with control over the from-address used to issue the asset. If there are multiple
addresses with asset issuing permissions on one node, this allows control over which address is used.
@param $fromAddress
@param $toAddress
@param $name
@param $qty
@param int $units
@param int $nativeAmount
@p... | [
"This",
"works",
"like",
"issue",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"used",
"to",
"issue",
"the",
"asset",
".",
"If",
"there",
"are",
"multiple",
"addresses",
"with",
"asset",
"issuing",
"permissions",
"on",
"one",
"node",
"t... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L551-L554 |
190,523 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.prepareLockUnspentFrom | public function prepareLockUnspentFrom($fromAddress, $assetsToLock, $lock = true)
{
return $this->jsonRPCClient->execute("preparelockunspentfrom", array($fromAddress, $assetsToLock, $lock));
} | php | public function prepareLockUnspentFrom($fromAddress, $assetsToLock, $lock = true)
{
return $this->jsonRPCClient->execute("preparelockunspentfrom", array($fromAddress, $assetsToLock, $lock));
} | [
"public",
"function",
"prepareLockUnspentFrom",
"(",
"$",
"fromAddress",
",",
"$",
"assetsToLock",
",",
"$",
"lock",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"jsonRPCClient",
"->",
"execute",
"(",
"\"preparelockunspentfrom\"",
",",
"array",
"(",
"$"... | This works like preparelockunspent, but with control over the from-address whose funds are used to prepare the
unspent transaction output. Any change from the transaction is send back to from-address.
@param $fromAddress
@param $assetsToLock
@param bool $lock
@return mixed | [
"This",
"works",
"like",
"preparelockunspent",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"whose",
"funds",
"are",
"used",
"to",
"prepare",
"the",
"unspent",
"transaction",
"output",
".",
"Any",
"change",
"from",
"the",
"transaction",
"is... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L644-L647 |
190,524 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.revoke | public function revoke($addresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("revoke", array($addresses, $permissions, $nativeAmount, $comment, $commentTo));
} | php | public function revoke($addresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("revoke", array($addresses, $permissions, $nativeAmount, $comment, $commentTo));
} | [
"public",
"function",
"revoke",
"(",
"$",
"addresses",
",",
"$",
"permissions",
",",
"$",
"nativeAmount",
"=",
"0",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"jsonRPCClient",
"->",
"execute... | Revokes permissions from addresses, where addresses is a comma-separated list of addresses and permissions is
one of connect, send, receive, issue, mine, admin, or a comma-separated list thereof. Equivalent to calling
grant with start-block=0 and end-block=0. Returns the txid of transaction revoking the permissions. Fo... | [
"Revokes",
"permissions",
"from",
"addresses",
"where",
"addresses",
"is",
"a",
"comma",
"-",
"separated",
"list",
"of",
"addresses",
"and",
"permissions",
"is",
"one",
"of",
"connect",
"send",
"receive",
"issue",
"mine",
"admin",
"or",
"a",
"comma",
"-",
"s... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L662-L665 |
190,525 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.revokeFrom | public function revokeFrom($fromAddress, $toAddresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("revokefrom", array($fromAddress, $toAddresses, $permissions, $nativeAmount, $comment, $commentTo));
} | php | public function revokeFrom($fromAddress, $toAddresses, $permissions, $nativeAmount = 0, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("revokefrom", array($fromAddress, $toAddresses, $permissions, $nativeAmount, $comment, $commentTo));
} | [
"public",
"function",
"revokeFrom",
"(",
"$",
"fromAddress",
",",
"$",
"toAddresses",
",",
"$",
"permissions",
",",
"$",
"nativeAmount",
"=",
"0",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
... | This works like revoke, but with control over the from-address used to revoke the permissions. If there are
multiple addresses with administrator permissions on one node, this allows control over which address is used.
@param $fromAddress
@param $toAddresses
@param $permissions
@param int $nativeAmount
@param string $... | [
"This",
"works",
"like",
"revoke",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"used",
"to",
"revoke",
"the",
"permissions",
".",
"If",
"there",
"are",
"multiple",
"addresses",
"with",
"administrator",
"permissions",
"on",
"one",
"node",
... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L679-L682 |
190,526 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.sendAssetFrom | public function sendAssetFrom($fromAddress, $toAddress, $asset, $qty, $nativeAmount = null, $comment = '', $commentTo = '')
{
$nativeAmount = $this->findDefaultMinimumPerOutput($nativeAmount);
return $this->jsonRPCClient->execute("sendassetfrom", array($fromAddress, $toAddress, $asset, $qty, $native... | php | public function sendAssetFrom($fromAddress, $toAddress, $asset, $qty, $nativeAmount = null, $comment = '', $commentTo = '')
{
$nativeAmount = $this->findDefaultMinimumPerOutput($nativeAmount);
return $this->jsonRPCClient->execute("sendassetfrom", array($fromAddress, $toAddress, $asset, $qty, $native... | [
"public",
"function",
"sendAssetFrom",
"(",
"$",
"fromAddress",
",",
"$",
"toAddress",
",",
"$",
"asset",
",",
"$",
"qty",
",",
"$",
"nativeAmount",
"=",
"null",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
")",
"{",
"$",
"native... | This works like sendassettoaddress, but with control over the from-address whose funds are used. Any change from
the transaction is sent back to from-address. See also sendfromaddress for sending multiple assets in one
transaction.
@param $fromAddress
@param $toAddress
@param $asset
@param $qty
@param null $nativeAmou... | [
"This",
"works",
"like",
"sendassettoaddress",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"whose",
"funds",
"are",
"used",
".",
"Any",
"change",
"from",
"the",
"transaction",
"is",
"sent",
"back",
"to",
"from",
"-",
"address",
".",
"S... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L698-L702 |
190,527 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.sendFromAddress | public function sendFromAddress($fromAddress, $toAddress, $amount, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("sendfromaddress", array($fromAddress, $toAddress, $amount, $comment, $commentTo));
} | php | public function sendFromAddress($fromAddress, $toAddress, $amount, $comment = '', $commentTo = '')
{
return $this->jsonRPCClient->execute("sendfromaddress", array($fromAddress, $toAddress, $amount, $comment, $commentTo));
} | [
"public",
"function",
"sendFromAddress",
"(",
"$",
"fromAddress",
",",
"$",
"toAddress",
",",
"$",
"amount",
",",
"$",
"comment",
"=",
"''",
",",
"$",
"commentTo",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"jsonRPCClient",
"->",
"execute",
"(",
... | This works like sendtoaddress, but with control over the from-address whose funds are used. Any
change from the transaction is sent back to from-address.
@param $fromAddress
@param $toAddress
@param $amount
@param string $comment
@param string $commentTo
@return mixed | [
"This",
"works",
"like",
"sendtoaddress",
"but",
"with",
"control",
"over",
"the",
"from",
"-",
"address",
"whose",
"funds",
"are",
"used",
".",
"Any",
"change",
"from",
"the",
"transaction",
"is",
"sent",
"back",
"to",
"from",
"-",
"address",
"."
] | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L744-L747 |
190,528 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.getTxOut | public function getTxOut($txId, $vOut, $unconfirmed = false)
{
return $this->jsonRPCClient->execute("gettxout", array($txId, $vOut, $unconfirmed));
} | php | public function getTxOut($txId, $vOut, $unconfirmed = false)
{
return $this->jsonRPCClient->execute("gettxout", array($txId, $vOut, $unconfirmed));
} | [
"public",
"function",
"getTxOut",
"(",
"$",
"txId",
",",
"$",
"vOut",
",",
"$",
"unconfirmed",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"jsonRPCClient",
"->",
"execute",
"(",
"\"gettxout\"",
",",
"array",
"(",
"$",
"txId",
",",
"$",
"vOut",... | Returns details about an unspent transaction output vout of txid. For a MultiChain blockchain, includes assets
and permissions fields listing any assets or permission changes encoded within the output. Set confirmed to true
to include unconfirmed transaction outputs.
@param $txId
@param $vOut
@param bool $unconfirmed
... | [
"Returns",
"details",
"about",
"an",
"unspent",
"transaction",
"output",
"vout",
"of",
"txid",
".",
"For",
"a",
"MultiChain",
"blockchain",
"includes",
"assets",
"and",
"permissions",
"fields",
"listing",
"any",
"assets",
"or",
"permission",
"changes",
"encoded",
... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L846-L849 |
190,529 | Kunstmaan/libphp-multichain | src/be/kunstmaan/multichain/MultichainClient.php | MultichainClient.listUnspent | public function listUnspent($minConf = 1, $maxConf = 999999, $addresses = null)
{
return $this->jsonRPCClient->execute("listunspent", array($minConf, $maxConf, $addresses));
} | php | public function listUnspent($minConf = 1, $maxConf = 999999, $addresses = null)
{
return $this->jsonRPCClient->execute("listunspent", array($minConf, $maxConf, $addresses));
} | [
"public",
"function",
"listUnspent",
"(",
"$",
"minConf",
"=",
"1",
",",
"$",
"maxConf",
"=",
"999999",
",",
"$",
"addresses",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"jsonRPCClient",
"->",
"execute",
"(",
"\"listunspent\"",
",",
"array",
"("... | Returns a list of unspent transaction outputs in the wallet, with between minconf and maxconf confirmations. For
a MultiChain blockchain, each transaction output includes assets and permissions fields listing any assets or
permission changes encoded within that output. If addresses is provided, only outputs which pay a... | [
"Returns",
"a",
"list",
"of",
"unspent",
"transaction",
"outputs",
"in",
"the",
"wallet",
"with",
"between",
"minconf",
"and",
"maxconf",
"confirmations",
".",
"For",
"a",
"MultiChain",
"blockchain",
"each",
"transaction",
"output",
"includes",
"assets",
"and",
... | 67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3 | https://github.com/Kunstmaan/libphp-multichain/blob/67d01a027d1db4d4ccbcab55ee8d1f4d5578e2e3/src/be/kunstmaan/multichain/MultichainClient.php#L862-L865 |
190,530 | phpflo/phpflo | src/PhpFlo/Core/Interaction/PortRegistry.php | PortRegistry.get | public function get(string $name = '')
{
switch (true) {
case ('' == $name):
$result = $this->ports;
break;
case $this->has($name):
$result = $this->ports[$name];
break;
default:
throw new Por... | php | public function get(string $name = '')
{
switch (true) {
case ('' == $name):
$result = $this->ports;
break;
case $this->has($name):
$result = $this->ports[$name];
break;
default:
throw new Por... | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
"=",
"''",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"''",
"==",
"$",
"name",
")",
":",
"$",
"result",
"=",
"$",
"this",
"->",
"ports",
";",
"break",
";",
"case",
"$",
"this... | Return one or all ports.
@param string $name
@return PortInterface[]|PortInterface
@throws PortException | [
"Return",
"one",
"or",
"all",
"ports",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Interaction/PortRegistry.php#L91-L105 |
190,531 | phpflo/phpflo | src/PhpFlo/Core/Interaction/ArrayPort.php | ArrayPort.isAttached | public function isAttached(int $socketId = 0): bool
{
if (!isset($this->sockets[$socketId])) {
return false;
}
return true;
} | php | public function isAttached(int $socketId = 0): bool
{
if (!isset($this->sockets[$socketId])) {
return false;
}
return true;
} | [
"public",
"function",
"isAttached",
"(",
"int",
"$",
"socketId",
"=",
"0",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"sockets",
"[",
"$",
"socketId",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
... | Checks if socket is attached.
@param int $socketId
@return bool | [
"Checks",
"if",
"socket",
"is",
"attached",
"."
] | bc38b7dc444ff6535930a9b84b9ae86266b1dc44 | https://github.com/phpflo/phpflo/blob/bc38b7dc444ff6535930a9b84b9ae86266b1dc44/src/PhpFlo/Core/Interaction/ArrayPort.php#L163-L170 |
190,532 | jorgejavierleon/LaravelPnotify | src/Notifier.php | Notifier.override | public function override(array $configs)
{
foreach($configs as $key => $value){
$this->config[$key] = $value;
}
$this->flashConfig();
return $this;
} | php | public function override(array $configs)
{
foreach($configs as $key => $value){
$this->config[$key] = $value;
}
$this->flashConfig();
return $this;
} | [
"public",
"function",
"override",
"(",
"array",
"$",
"configs",
")",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"$",
"this",... | Override the default config value.
@param array $configs
@return $this | [
"Override",
"the",
"default",
"config",
"value",
"."
] | 880d9bb110aa49d472da2971e4e339770958e18f | https://github.com/jorgejavierleon/LaravelPnotify/blob/880d9bb110aa49d472da2971e4e339770958e18f/src/Notifier.php#L165-L174 |
190,533 | jorgejavierleon/LaravelPnotify | src/Notifier.php | Notifier.flashConfig | private function flashConfig()
{
foreach ($this->config as $key => $value) {
$this->session->flash("notifier.{$key}", $value);
}
$this->session->flash('notifier.notice', $this->buildConfig());
} | php | private function flashConfig()
{
foreach ($this->config as $key => $value) {
$this->session->flash("notifier.{$key}", $value);
}
$this->session->flash('notifier.notice', $this->buildConfig());
} | [
"private",
"function",
"flashConfig",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"flash",
"(",
"\"notifier.{$key}\"",
",",
"$",
"value",
")",
";",
"}... | Flash the configuration to the session | [
"Flash",
"the",
"configuration",
"to",
"the",
"session"
] | 880d9bb110aa49d472da2971e4e339770958e18f | https://github.com/jorgejavierleon/LaravelPnotify/blob/880d9bb110aa49d472da2971e4e339770958e18f/src/Notifier.php#L180-L188 |
190,534 | jorgejavierleon/LaravelPnotify | src/Notifier.php | Notifier.setDefaultConfig | private function setDefaultConfig()
{
$defaults = $this->configRepo->get('laravelPnotify');
foreach($defaults as $key => $value){
$this->config[$key] = $value;
}
} | php | private function setDefaultConfig()
{
$defaults = $this->configRepo->get('laravelPnotify');
foreach($defaults as $key => $value){
$this->config[$key] = $value;
}
} | [
"private",
"function",
"setDefaultConfig",
"(",
")",
"{",
"$",
"defaults",
"=",
"$",
"this",
"->",
"configRepo",
"->",
"get",
"(",
"'laravelPnotify'",
")",
";",
"foreach",
"(",
"$",
"defaults",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this... | Set the default config values | [
"Set",
"the",
"default",
"config",
"values"
] | 880d9bb110aa49d472da2971e4e339770958e18f | https://github.com/jorgejavierleon/LaravelPnotify/blob/880d9bb110aa49d472da2971e4e339770958e18f/src/Notifier.php#L207-L214 |
190,535 | phly/conduit | src/MiddlewarePipe.php | MiddlewarePipe.pipe | public function pipe($path, $middleware = null)
{
if (null === $middleware && is_callable($path)) {
$middleware = $path;
$path = '/';
}
// Ensure we have a valid handler
if (! is_callable($middleware)) {
throw new InvalidArgumentException('M... | php | public function pipe($path, $middleware = null)
{
if (null === $middleware && is_callable($path)) {
$middleware = $path;
$path = '/';
}
// Ensure we have a valid handler
if (! is_callable($middleware)) {
throw new InvalidArgumentException('M... | [
"public",
"function",
"pipe",
"(",
"$",
"path",
",",
"$",
"middleware",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"middleware",
"&&",
"is_callable",
"(",
"$",
"path",
")",
")",
"{",
"$",
"middleware",
"=",
"$",
"path",
";",
"$",
"path",... | Attach middleware to the pipeline.
Each middleware can be associated with a particular path; if that
path is matched when that middleware is invoked, it will be processed;
otherwise it is skipped.
No path means it should be executed every request cycle.
A handler CAN implement MiddlewareInterface, but MUST be callab... | [
"Attach",
"middleware",
"to",
"the",
"pipeline",
"."
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/MiddlewarePipe.php#L95-L114 |
190,536 | phly/conduit | src/MiddlewarePipe.php | MiddlewarePipe.normalizePipePath | private function normalizePipePath($path)
{
// Prepend slash if missing
if (empty($path) || $path[0] !== '/') {
$path = '/' . $path;
}
// Trim trailing slash if present
if (strlen($path) > 1 && '/' === substr($path, -1)) {
$path = rtrim($path, '/');
... | php | private function normalizePipePath($path)
{
// Prepend slash if missing
if (empty($path) || $path[0] !== '/') {
$path = '/' . $path;
}
// Trim trailing slash if present
if (strlen($path) > 1 && '/' === substr($path, -1)) {
$path = rtrim($path, '/');
... | [
"private",
"function",
"normalizePipePath",
"(",
"$",
"path",
")",
"{",
"// Prepend slash if missing",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
"||",
"$",
"path",
"[",
"0",
"]",
"!==",
"'/'",
")",
"{",
"$",
"path",
"=",
"'/'",
".",
"$",
"path",
";"... | Normalize a path used when defining a pipe
Strips trailing slashes, and prepends a slash.
@param string $path
@return string | [
"Normalize",
"a",
"path",
"used",
"when",
"defining",
"a",
"pipe"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/MiddlewarePipe.php#L124-L137 |
190,537 | phly/conduit | src/MiddlewarePipe.php | MiddlewarePipe.decorateRequest | private function decorateRequest(Request $request)
{
if ($request instanceof Http\Request) {
return $request;
}
return new Http\Request($request);
} | php | private function decorateRequest(Request $request)
{
if ($request instanceof Http\Request) {
return $request;
}
return new Http\Request($request);
} | [
"private",
"function",
"decorateRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"instanceof",
"Http",
"\\",
"Request",
")",
"{",
"return",
"$",
"request",
";",
"}",
"return",
"new",
"Http",
"\\",
"Request",
"(",
"$",
"reque... | Decorate the Request instance
@param Request $request
@return Http\Request | [
"Decorate",
"the",
"Request",
"instance"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/MiddlewarePipe.php#L145-L152 |
190,538 | phly/conduit | src/MiddlewarePipe.php | MiddlewarePipe.decorateResponse | private function decorateResponse(Response $response)
{
if ($response instanceof Http\Response) {
return $response;
}
return new Http\Response($response);
} | php | private function decorateResponse(Response $response)
{
if ($response instanceof Http\Response) {
return $response;
}
return new Http\Response($response);
} | [
"private",
"function",
"decorateResponse",
"(",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"instanceof",
"Http",
"\\",
"Response",
")",
"{",
"return",
"$",
"response",
";",
"}",
"return",
"new",
"Http",
"\\",
"Response",
"(",
"$",
... | Decorate the Response instance
@param Response $response
@return Http\Response | [
"Decorate",
"the",
"Response",
"instance"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/MiddlewarePipe.php#L160-L167 |
190,539 | taq/torm | src/Persistence.php | Persistence.save | public function save($force=false)
{
if (!self::$_loaded) {
self::_loadColumns();
}
// check for callbacks before validation below
$calling = get_called_class();
if (!self::_checkCallback($calling, "before_save", $this)) {
return false;
}
... | php | public function save($force=false)
{
if (!self::$_loaded) {
self::_loadColumns();
}
// check for callbacks before validation below
$calling = get_called_class();
if (!self::_checkCallback($calling, "before_save", $this)) {
return false;
}
... | [
"public",
"function",
"save",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"_loaded",
")",
"{",
"self",
"::",
"_loadColumns",
"(",
")",
";",
"}",
"// check for callbacks before validation below",
"$",
"calling",
"=",
"get_c... | Save or update currenct object
@param boolean $force to force saving
@return boolean saved/updated | [
"Save",
"or",
"update",
"currenct",
"object"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Persistence.php#L24-L91 |
190,540 | taq/torm | src/Persistence.php | Persistence.destroy | public function destroy()
{
if (!self::$_loaded) {
self::_loadColumns();
}
$calling = get_called_class();
if (!self::_checkCallback($calling, "before_destroy", $this)) {
return false;
}
$table_name = $calling::getTableName();
$pk ... | php | public function destroy()
{
if (!self::$_loaded) {
self::_loadColumns();
}
$calling = get_called_class();
if (!self::_checkCallback($calling, "before_destroy", $this)) {
return false;
}
$table_name = $calling::getTableName();
$pk ... | [
"public",
"function",
"destroy",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"_loaded",
")",
"{",
"self",
"::",
"_loadColumns",
"(",
")",
";",
"}",
"$",
"calling",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"self",
"::",
"_checkC... | Destroy the current object
@return boolean destroyed or not | [
"Destroy",
"the",
"current",
"object"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Persistence.php#L267-L290 |
190,541 | taq/torm | src/Persistence.php | Persistence.updateAttributes | public function updateAttributes($attrs)
{
if (array_key_exists(self::getPK(), $attrs)) {
unset($attrs[self::getPK()]);
}
foreach ($attrs as $attr => $value) {
$this->_data[$attr] = $value;
}
return $this->save();
} | php | public function updateAttributes($attrs)
{
if (array_key_exists(self::getPK(), $attrs)) {
unset($attrs[self::getPK()]);
}
foreach ($attrs as $attr => $value) {
$this->_data[$attr] = $value;
}
return $this->save();
} | [
"public",
"function",
"updateAttributes",
"(",
"$",
"attrs",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"getPK",
"(",
")",
",",
"$",
"attrs",
")",
")",
"{",
"unset",
"(",
"$",
"attrs",
"[",
"self",
"::",
"getPK",
"(",
")",
"]",
")"... | Update object attributes
@param mixed $attrs attributes
@return updated or not | [
"Update",
"object",
"attributes"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Persistence.php#L299-L308 |
190,542 | taq/torm | src/Connection.php | Connection.setConnection | public static function setConnection($con, $env = null)
{
$env = self::selectEnvironment($env);
self::$_connection[$env] = $con;
// just send an exception when not on production mode
if (in_array($env, array("development","test"))) {
self::setErrorHandling(\PDO::ERRMODE... | php | public static function setConnection($con, $env = null)
{
$env = self::selectEnvironment($env);
self::$_connection[$env] = $con;
// just send an exception when not on production mode
if (in_array($env, array("development","test"))) {
self::setErrorHandling(\PDO::ERRMODE... | [
"public",
"static",
"function",
"setConnection",
"(",
"$",
"con",
",",
"$",
"env",
"=",
"null",
")",
"{",
"$",
"env",
"=",
"self",
"::",
"selectEnvironment",
"(",
"$",
"env",
")",
";",
"self",
"::",
"$",
"_connection",
"[",
"$",
"env",
"]",
"=",
"$... | Set the connection handle
@param mixed $con connection handle
@param string $env environment
@return null | [
"Set",
"the",
"connection",
"handle"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Connection.php#L48-L57 |
190,543 | taq/torm | src/Connection.php | Connection.selectEnvironment | public static function selectEnvironment($env = null)
{
if (strlen($env) < 1) {
$getenv = self::_getEnvironment();
if (strlen($getenv) > 0) {
$env = $getenv;
} else {
$env = "development";
}
}
return $env;
} | php | public static function selectEnvironment($env = null)
{
if (strlen($env) < 1) {
$getenv = self::_getEnvironment();
if (strlen($getenv) > 0) {
$env = $getenv;
} else {
$env = "development";
}
}
return $env;
} | [
"public",
"static",
"function",
"selectEnvironment",
"(",
"$",
"env",
"=",
"null",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"env",
")",
"<",
"1",
")",
"{",
"$",
"getenv",
"=",
"self",
"::",
"_getEnvironment",
"(",
")",
";",
"if",
"(",
"strlen",
"("... | Return the current environment
@param string $env enviroment to be forced
@return string environment | [
"Return",
"the",
"current",
"environment"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Connection.php#L78-L89 |
190,544 | taq/torm | src/Connection.php | Connection.setDriver | public static function setDriver($driver, $env = null)
{
$file = realpath(dirname(__FILE__)."/../drivers/$driver.php");
if (!file_exists($file)) {
Log::log("ERROR: Driver file $file does not exists");
return null;
}
self::$_driver[self::selectEnvironment($env)... | php | public static function setDriver($driver, $env = null)
{
$file = realpath(dirname(__FILE__)."/../drivers/$driver.php");
if (!file_exists($file)) {
Log::log("ERROR: Driver file $file does not exists");
return null;
}
self::$_driver[self::selectEnvironment($env)... | [
"public",
"static",
"function",
"setDriver",
"(",
"$",
"driver",
",",
"$",
"env",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"realpath",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"\"/../drivers/$driver.php\"",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",... | Set the connection database driver
@param string $driver database driver
@param string $env environment
@return driver file | [
"Set",
"the",
"connection",
"database",
"driver"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Connection.php#L109-L118 |
190,545 | taq/torm | src/Connection.php | Connection.convertToEncoding | public static function convertToEncoding($mixed)
{
if (is_null(self::$_encoding)
|| is_numeric($mixed)
|| is_bool($mixed)
|| is_object($mixed)
|| is_array($mixed)
|| !is_string($mixed)
|| !function_exists('mb_convert_encoding')
... | php | public static function convertToEncoding($mixed)
{
if (is_null(self::$_encoding)
|| is_numeric($mixed)
|| is_bool($mixed)
|| is_object($mixed)
|| is_array($mixed)
|| !is_string($mixed)
|| !function_exists('mb_convert_encoding')
... | [
"public",
"static",
"function",
"convertToEncoding",
"(",
"$",
"mixed",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_encoding",
")",
"||",
"is_numeric",
"(",
"$",
"mixed",
")",
"||",
"is_bool",
"(",
"$",
"mixed",
")",
"||",
"is_object",
"(... | Convert a string to the specified encoding
Paranoid checking
@param string $mixed string to encode
@return string encoded | [
"Convert",
"a",
"string",
"to",
"the",
"specified",
"encoding",
"Paranoid",
"checking"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Connection.php#L174-L187 |
190,546 | phly/conduit | src/Utils.php | Utils.getArity | public static function getArity($callable)
{
if (is_object($callable)) {
foreach (['__invoke', 'handle'] as $method) {
if (! method_exists($callable, $method)) {
continue;
}
$r = new ReflectionMethod($callable, $method);
... | php | public static function getArity($callable)
{
if (is_object($callable)) {
foreach (['__invoke', 'handle'] as $method) {
if (! method_exists($callable, $method)) {
continue;
}
$r = new ReflectionMethod($callable, $method);
... | [
"public",
"static",
"function",
"getArity",
"(",
"$",
"callable",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"callable",
")",
")",
"{",
"foreach",
"(",
"[",
"'__invoke'",
",",
"'handle'",
"]",
"as",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"method_e... | Get the arity of a handler
@param string|callable|object $callable
@return int | [
"Get",
"the",
"arity",
"of",
"a",
"handler"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Utils.php#L18-L38 |
190,547 | taq/torm | src/Validations.php | Validations.isValid | public function isValid()
{
$this->_resetErrors();
$cls = get_called_class();
$rtn = true;
$pk = self::get(self::getPK());
if (!array_key_exists($cls, self::$_validations)
|| sizeof(self::$_validations[$cls]) < 1
) {
return true;
}
... | php | public function isValid()
{
$this->_resetErrors();
$cls = get_called_class();
$rtn = true;
$pk = self::get(self::getPK());
if (!array_key_exists($cls, self::$_validations)
|| sizeof(self::$_validations[$cls]) < 1
) {
return true;
}
... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"this",
"->",
"_resetErrors",
"(",
")",
";",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"$",
"rtn",
"=",
"true",
";",
"$",
"pk",
"=",
"self",
"::",
"get",
"(",
"self",
"::",
"getPK",
"... | Check if object is valid
@return boolean valid? | [
"Check",
"if",
"object",
"is",
"valid"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validations.php#L24-L56 |
190,548 | taq/torm | src/Validations.php | Validations.isUnique | public static function isUnique($id, $attr, $attr_value)
{
$obj = self::first(array($attr => $attr_value));
return $obj==null || $obj->get(self::getPK()) == $id;
} | php | public static function isUnique($id, $attr, $attr_value)
{
$obj = self::first(array($attr => $attr_value));
return $obj==null || $obj->get(self::getPK()) == $id;
} | [
"public",
"static",
"function",
"isUnique",
"(",
"$",
"id",
",",
"$",
"attr",
",",
"$",
"attr_value",
")",
"{",
"$",
"obj",
"=",
"self",
"::",
"first",
"(",
"array",
"(",
"$",
"attr",
"=>",
"$",
"attr_value",
")",
")",
";",
"return",
"$",
"obj",
... | Check if attribute is unique
@param mixed $id id
@param mixed $attr to check
@param mixed $attr_value to check
@return if attribute is unique | [
"Check",
"if",
"attribute",
"is",
"unique"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validations.php#L67-L71 |
190,549 | taq/torm | src/Validations.php | Validations.validates | public static function validates($attr, $validation)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_validations)) {
self::$_validations[$cls] = array();
}
if (!array_key_exists($attr, self::$_validations[$cls])) {
self::$_validations[$cls]... | php | public static function validates($attr, $validation)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_validations)) {
self::$_validations[$cls] = array();
}
if (!array_key_exists($attr, self::$_validations[$cls])) {
self::$_validations[$cls]... | [
"public",
"static",
"function",
"validates",
"(",
"$",
"attr",
",",
"$",
"validation",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_validations",
")",
")",
... | Validates an attribute with a validation rule
@param string $attr attribute
@param mixed $validation validation rule
@return valid or not | [
"Validates",
"an",
"attribute",
"with",
"a",
"validation",
"rule"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validations.php#L81-L94 |
190,550 | taq/torm | src/Collection.php | Collection.current | public function current()
{
if ($this->_curval == null) {
return $this->next();
}
return new $this->_cls($this->_curval);
} | php | public function current()
{
if ($this->_curval == null) {
return $this->next();
}
return new $this->_cls($this->_curval);
} | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_curval",
"==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"next",
"(",
")",
";",
"}",
"return",
"new",
"$",
"this",
"->",
"_cls",
"(",
"$",
"this",
"->",
"_curval... | Return current value
@return mixed value | [
"Return",
"current",
"value"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L85-L91 |
190,551 | taq/torm | src/Collection.php | Collection.count | public function count()
{
$cls = $this->_cls;
$pk = $cls::getPK();
$builder = $this->_makeBuilderForAggregations(" count($pk) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | php | public function count()
{
$cls = $this->_cls;
$pk = $cls::getPK();
$builder = $this->_makeBuilderForAggregations(" count($pk) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | [
"public",
"function",
"count",
"(",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"_cls",
";",
"$",
"pk",
"=",
"$",
"cls",
"::",
"getPK",
"(",
")",
";",
"$",
"builder",
"=",
"$",
"this",
"->",
"_makeBuilderForAggregations",
"(",
"\" count($pk) \"",
"... | Return collection row count
Example:
echo Person::all()->count();
@return int row count | [
"Return",
"collection",
"row",
"count"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L131-L137 |
190,552 | taq/torm | src/Collection.php | Collection.sum | public function sum($attr)
{
$builder = $this->_makeBuilderForAggregations(" sum($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | php | public function sum($attr)
{
$builder = $this->_makeBuilderForAggregations(" sum($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | [
"public",
"function",
"sum",
"(",
"$",
"attr",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"_makeBuilderForAggregations",
"(",
"\" sum($attr) \"",
")",
";",
"return",
"$",
"this",
"->",
"_executeAndReturnFirst",
"(",
"$",
"builder",
",",
"$",
"this",
... | Return collection attribute sum
Example:
echo Person::all()->sum("age");
@param string $attr attribute
@return mixed sum | [
"Return",
"collection",
"attribute",
"sum"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L149-L153 |
190,553 | taq/torm | src/Collection.php | Collection.avg | public function avg($attr)
{
$builder = $this->_makeBuilderForAggregations(" avg($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | php | public function avg($attr)
{
$builder = $this->_makeBuilderForAggregations(" avg($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | [
"public",
"function",
"avg",
"(",
"$",
"attr",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"_makeBuilderForAggregations",
"(",
"\" avg($attr) \"",
")",
";",
"return",
"$",
"this",
"->",
"_executeAndReturnFirst",
"(",
"$",
"builder",
",",
"$",
"this",
... | Return collection attribute average
Example:
echo Person::all()->avg("age");
@param string $attr attribute
@return mixed average | [
"Return",
"collection",
"attribute",
"average"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L165-L169 |
190,554 | taq/torm | src/Collection.php | Collection.min | public function min($attr)
{
$builder = $this->_makeBuilderForAggregations(" min($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | php | public function min($attr)
{
$builder = $this->_makeBuilderForAggregations(" min($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | [
"public",
"function",
"min",
"(",
"$",
"attr",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"_makeBuilderForAggregations",
"(",
"\" min($attr) \"",
")",
";",
"return",
"$",
"this",
"->",
"_executeAndReturnFirst",
"(",
"$",
"builder",
",",
"$",
"this",
... | Return collection attribute minimum value
Example:
echo Person::all()->min("age");
@param string $attr attribute
@return mixed minimum | [
"Return",
"collection",
"attribute",
"minimum",
"value"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L181-L185 |
190,555 | taq/torm | src/Collection.php | Collection.max | public function max($attr)
{
$builder = $this->_makeBuilderForAggregations(" max($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | php | public function max($attr)
{
$builder = $this->_makeBuilderForAggregations(" max($attr) ");
return $this->_executeAndReturnFirst($builder, $this->_vals);
} | [
"public",
"function",
"max",
"(",
"$",
"attr",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"_makeBuilderForAggregations",
"(",
"\" max($attr) \"",
")",
";",
"return",
"$",
"this",
"->",
"_executeAndReturnFirst",
"(",
"$",
"builder",
",",
"$",
"this",
... | Return collection attribute maximum value
Example:
echo Person::all()->max("age");
@param string $attr attribute
@return mixed maximum | [
"Return",
"collection",
"attribute",
"maximum",
"value"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L197-L201 |
190,556 | taq/torm | src/Collection.php | Collection.paginate | public function paginate($page, $per_page = 50)
{
$this->_builder->limit = $per_page;
$this->_builder->offset = ($page - 1) * $per_page;
$this->page = $page;
$this->per_page = $per_page;
if (Driver::$pagination_subquery) {
$this->_builder->l... | php | public function paginate($page, $per_page = 50)
{
$this->_builder->limit = $per_page;
$this->_builder->offset = ($page - 1) * $per_page;
$this->page = $page;
$this->per_page = $per_page;
if (Driver::$pagination_subquery) {
$this->_builder->l... | [
"public",
"function",
"paginate",
"(",
"$",
"page",
",",
"$",
"per_page",
"=",
"50",
")",
"{",
"$",
"this",
"->",
"_builder",
"->",
"limit",
"=",
"$",
"per_page",
";",
"$",
"this",
"->",
"_builder",
"->",
"offset",
"=",
"(",
"$",
"page",
"-",
"1",
... | Return collection pagination page
Example:
echo Person::all()->paginate(1, 25);
@param int $page current page
@param int $per_page rows per page
@return mixed this object | [
"Return",
"collection",
"pagination",
"page"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L214-L226 |
190,557 | taq/torm | src/Collection.php | Collection._makeBuilderForAggregations | private function _makeBuilderForAggregations($fields)
{
$table = $this->_builder->table;
$where = $this->_builder->where;
$limit = $this->_builder->limit;
$offset = $this->_builder->offset;
$builder = new Builder();
$builder->prefix = "select";
... | php | private function _makeBuilderForAggregations($fields)
{
$table = $this->_builder->table;
$where = $this->_builder->where;
$limit = $this->_builder->limit;
$offset = $this->_builder->offset;
$builder = new Builder();
$builder->prefix = "select";
... | [
"private",
"function",
"_makeBuilderForAggregations",
"(",
"$",
"fields",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"_builder",
"->",
"table",
";",
"$",
"where",
"=",
"$",
"this",
"->",
"_builder",
"->",
"where",
";",
"$",
"limit",
"=",
"$",
"thi... | Construct builder for aggregations
@param mixed $fields fields to use
@return mixed average | [
"Construct",
"builder",
"for",
"aggregations"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L235-L250 |
190,558 | taq/torm | src/Collection.php | Collection._executeAndReturnFirst | private function _executeAndReturnFirst($builder,$vals)
{
$cls = $this->_cls;
$stmt = $cls::executePrepared($builder, $this->_vals);
$data = $stmt->fetch();
return $data ? $data[0] : 0;
} | php | private function _executeAndReturnFirst($builder,$vals)
{
$cls = $this->_cls;
$stmt = $cls::executePrepared($builder, $this->_vals);
$data = $stmt->fetch();
return $data ? $data[0] : 0;
} | [
"private",
"function",
"_executeAndReturnFirst",
"(",
"$",
"builder",
",",
"$",
"vals",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"_cls",
";",
"$",
"stmt",
"=",
"$",
"cls",
"::",
"executePrepared",
"(",
"$",
"builder",
",",
"$",
"this",
"->",
"_v... | Return the first value
@param mixed $builder builder
@param mixed $vals values to use
@return mixed average | [
"Return",
"the",
"first",
"value"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L260-L266 |
190,559 | taq/torm | src/Collection.php | Collection.destroy | public function destroy()
{
$table = $this->_builder->table;
$where = $this->_builder->where;
$builder = new Builder();
$builder->prefix = "delete";
$builder->fields = "";
$builder->table = $table;
$builder->where = $where;
$cls = $this->_cls;
... | php | public function destroy()
{
$table = $this->_builder->table;
$where = $this->_builder->where;
$builder = new Builder();
$builder->prefix = "delete";
$builder->fields = "";
$builder->table = $table;
$builder->where = $where;
$cls = $this->_cls;
... | [
"public",
"function",
"destroy",
"(",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"_builder",
"->",
"table",
";",
"$",
"where",
"=",
"$",
"this",
"->",
"_builder",
"->",
"where",
";",
"$",
"builder",
"=",
"new",
"Builder",
"(",
")",
";",
"$",
... | Destroy collection records
Example:
Person::all()->destroy();
@return destroyed or not | [
"Destroy",
"collection",
"records"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L276-L289 |
190,560 | taq/torm | src/Collection.php | Collection.updateAttributes | public function updateAttributes($attrs)
{
$cls = $this->_cls;
$table = $this->_builder->table;
$where = $this->_builder->where;
$escape = Driver::$escape_char;
$sql = "update $escape$table$escape set ";
$sql .= $cls::extractUpdateColumns($attrs, ",");
... | php | public function updateAttributes($attrs)
{
$cls = $this->_cls;
$table = $this->_builder->table;
$where = $this->_builder->where;
$escape = Driver::$escape_char;
$sql = "update $escape$table$escape set ";
$sql .= $cls::extractUpdateColumns($attrs, ",");
... | [
"public",
"function",
"updateAttributes",
"(",
"$",
"attrs",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"_cls",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"_builder",
"->",
"table",
";",
"$",
"where",
"=",
"$",
"this",
"->",
"_builder",
"->",
"w... | Update collection attributes
Example:
echo Person::all()->updateAttributes("age", 25);
@param string $attrs attributes
@return updated or not | [
"Update",
"collection",
"attributes"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L301-L317 |
190,561 | taq/torm | src/Collection.php | Collection._getCurrentData | private function _getCurrentData()
{
$cls = $this->_cls;
if (!$this->_data) {
$this->_data = $cls::executePrepared($this->_builder, $this->_vals);
}
return $this->_data->fetch(\PDO::FETCH_ASSOC);
} | php | private function _getCurrentData()
{
$cls = $this->_cls;
if (!$this->_data) {
$this->_data = $cls::executePrepared($this->_builder, $this->_vals);
}
return $this->_data->fetch(\PDO::FETCH_ASSOC);
} | [
"private",
"function",
"_getCurrentData",
"(",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"_cls",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_data",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"$",
"cls",
"::",
"executePrepared",
"(",
"$",
"this",
... | Get the next result from collection
@return mixed result | [
"Get",
"the",
"next",
"result",
"from",
"collection"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L350-L357 |
190,562 | taq/torm | src/Collection.php | Collection.next | public function next()
{
$cls = $this->_cls;
$data = $this->_getCurrentData();
if (!$data) {
$this->_curval = null;
return $this->_curval;
} else {
++$this->_count;
$this->_curval = $data;
return new $this->_cls($this->_cu... | php | public function next()
{
$cls = $this->_cls;
$data = $this->_getCurrentData();
if (!$data) {
$this->_curval = null;
return $this->_curval;
} else {
++$this->_count;
$this->_curval = $data;
return new $this->_cls($this->_cu... | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"_cls",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"_getCurrentData",
"(",
")",
";",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_curval",
"=",
"null... | Return the next collection object
Example:
echo Person::all()->next();
@return mixed object | [
"Return",
"the",
"next",
"collection",
"object"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Collection.php#L367-L380 |
190,563 | taq/torm | src/Inflections.php | Inflections.push | public static function push($idx, $singular, $plural)
{
self::_initialize();
self::$_inflections[$idx][$singular] = $plural;
} | php | public static function push($idx, $singular, $plural)
{
self::_initialize();
self::$_inflections[$idx][$singular] = $plural;
} | [
"public",
"static",
"function",
"push",
"(",
"$",
"idx",
",",
"$",
"singular",
",",
"$",
"plural",
")",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"self",
"::",
"$",
"_inflections",
"[",
"$",
"idx",
"]",
"[",
"$",
"singular",
"]",
"=",
"$",
... | Push an inflection
@param mixed $idx index
@param string $singular form
@param string $plural form
@return null | [
"Push",
"an",
"inflection"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Inflections.php#L43-L47 |
190,564 | taq/torm | src/Inflections.php | Inflections._search | private static function _search($str,$idx)
{
self::_initialize();
$idx = $idx == self::PLURAL ? self::SINGULAR : self::PLURAL;
$vals = self::$_inflections[$idx];
// adding irregular
foreach (self::$_inflections[self::IRREGULAR] as $key => $val) {
$vals[$key] =... | php | private static function _search($str,$idx)
{
self::_initialize();
$idx = $idx == self::PLURAL ? self::SINGULAR : self::PLURAL;
$vals = self::$_inflections[$idx];
// adding irregular
foreach (self::$_inflections[self::IRREGULAR] as $key => $val) {
$vals[$key] =... | [
"private",
"static",
"function",
"_search",
"(",
"$",
"str",
",",
"$",
"idx",
")",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"$",
"idx",
"=",
"$",
"idx",
"==",
"self",
"::",
"PLURAL",
"?",
"self",
"::",
"SINGULAR",
":",
"self",
"::",
"PLURAL... | Search an inflection
@param string $str string
@param mixed $idx index
@return inflection | [
"Search",
"an",
"inflection"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Inflections.php#L95-L123 |
190,565 | phly/conduit | src/Http/Response.php | Response.write | public function write($data)
{
if ($this->complete) {
return $this;
}
$this->getBody()->write($data);
return $this;
} | php | public function write($data)
{
if ($this->complete) {
return $this;
}
$this->getBody()->write($data);
return $this;
} | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"complete",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"getBody",
"(",
")",
"->",
"write",
"(",
"$",
"data",
")",
";",
"return",
"$",
"t... | Write data to the response body
Proxies to the underlying stream and writes the provided data to it.
@param string $data | [
"Write",
"data",
"to",
"the",
"response",
"body"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Http/Response.php#L52-L60 |
190,566 | phly/conduit | src/Http/Response.php | Response.end | public function end($data = null)
{
if ($this->complete) {
return $this;
}
if ($data) {
$this->write($data);
}
$new = clone $this;
$new->complete = true;
return $new;
} | php | public function end($data = null)
{
if ($this->complete) {
return $this;
}
if ($data) {
$this->write($data);
}
$new = clone $this;
$new->complete = true;
return $new;
} | [
"public",
"function",
"end",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"complete",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"$",
"data",
")",
";... | Mark the response as complete
A completed response should no longer allow manipulation of either
headers or the content body.
If $data is passed, that data should be written to the response body
prior to marking the response as complete.
@param string $data | [
"Mark",
"the",
"response",
"as",
"complete"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Http/Response.php#L73-L86 |
190,567 | taq/torm | src/Sequences.php | Sequences.getSequenceName | public static function getSequenceName()
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_sequence)) {
return null;
}
return self::$_sequence[$cls];
} | php | public static function getSequenceName()
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_sequence)) {
return null;
}
return self::$_sequence[$cls];
} | [
"public",
"static",
"function",
"getSequenceName",
"(",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_sequence",
")",
")",
"{",
"return",
"null",
";",
"}",
... | Returns the sequence name, if any
@return name of the sequence | [
"Returns",
"the",
"sequence",
"name",
"if",
"any"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L38-L45 |
190,568 | taq/torm | src/Sequences.php | Sequences.resolveSequenceName | public static function resolveSequenceName()
{
if (Driver::$primary_key_behaviour != Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
$name = self::getSequenceName();
if ($name) {
return $name;
}
$table = strtolower(self::getTableName()... | php | public static function resolveSequenceName()
{
if (Driver::$primary_key_behaviour != Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
$name = self::getSequenceName();
if ($name) {
return $name;
}
$table = strtolower(self::getTableName()... | [
"public",
"static",
"function",
"resolveSequenceName",
"(",
")",
"{",
"if",
"(",
"Driver",
"::",
"$",
"primary_key_behaviour",
"!=",
"Driver",
"::",
"PRIMARY_KEY_SEQUENCE",
")",
"{",
"return",
"null",
";",
"}",
"$",
"name",
"=",
"self",
"::",
"getSequenceName"... | Resolve the sequence name, if any
@return name of the sequence | [
"Resolve",
"the",
"sequence",
"name",
"if",
"any"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L52-L76 |
190,569 | taq/torm | src/Sequences.php | Sequences._sequenceExists | private static function _sequenceExists()
{
if (Driver::$primary_key_behaviour != Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
// caching if the sequence exists
$cls = get_called_class();
$name = self::resolveSequenceName();
if (array_key_exists($cls,... | php | private static function _sequenceExists()
{
if (Driver::$primary_key_behaviour != Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
// caching if the sequence exists
$cls = get_called_class();
$name = self::resolveSequenceName();
if (array_key_exists($cls,... | [
"private",
"static",
"function",
"_sequenceExists",
"(",
")",
"{",
"if",
"(",
"Driver",
"::",
"$",
"primary_key_behaviour",
"!=",
"Driver",
"::",
"PRIMARY_KEY_SEQUENCE",
")",
"{",
"return",
"null",
";",
"}",
"// caching if the sequence exists",
"$",
"cls",
"=",
... | Check if a sequence exists
@return exists or not | [
"Check",
"if",
"a",
"sequence",
"exists"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L83-L118 |
190,570 | taq/torm | src/Sequences.php | Sequences._oracleSequenceExists | private function _oracleSequenceExists($name)
{
$escape = Driver::$escape_char;
$sql = "select count(sequence_name) as $escape"."CNT"."$escape from user_sequences where sequence_name='$name' or sequence_name='".strtolower($name)."' or sequence_name='".strtoupper($name)."'";
$stmt = self... | php | private function _oracleSequenceExists($name)
{
$escape = Driver::$escape_char;
$sql = "select count(sequence_name) as $escape"."CNT"."$escape from user_sequences where sequence_name='$name' or sequence_name='".strtolower($name)."' or sequence_name='".strtoupper($name)."'";
$stmt = self... | [
"private",
"function",
"_oracleSequenceExists",
"(",
"$",
"name",
")",
"{",
"$",
"escape",
"=",
"Driver",
"::",
"$",
"escape_char",
";",
"$",
"sql",
"=",
"\"select count(sequence_name) as $escape\"",
".",
"\"CNT\"",
".",
"\"$escape from user_sequences where sequence_nam... | Check if an Oracle sequence exists
@param string $name sequence name
@return exists or not | [
"Check",
"if",
"an",
"Oracle",
"sequence",
"exists"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L127-L136 |
190,571 | taq/torm | src/Sequences.php | Sequences._postgresqlSequenceExists | private function _postgresqlSequenceExists($name)
{
$escape = Driver::$escape_char;
$sql = "select count(*) as {$escape}CNT{$escape} from information_schema.sequences where sequence_name = '$name'";
$stmt = self::query($sql);
$rst = $stmt->fetch(\PDO::FETCH_ASSOC);
$r... | php | private function _postgresqlSequenceExists($name)
{
$escape = Driver::$escape_char;
$sql = "select count(*) as {$escape}CNT{$escape} from information_schema.sequences where sequence_name = '$name'";
$stmt = self::query($sql);
$rst = $stmt->fetch(\PDO::FETCH_ASSOC);
$r... | [
"private",
"function",
"_postgresqlSequenceExists",
"(",
"$",
"name",
")",
"{",
"$",
"escape",
"=",
"Driver",
"::",
"$",
"escape_char",
";",
"$",
"sql",
"=",
"\"select count(*) as {$escape}CNT{$escape} from information_schema.sequences where sequence_name = '$name'\"",
";",
... | Check if an PostgreSQL sequence exists
@param string $name sequence name
@return exists or not | [
"Check",
"if",
"an",
"PostgreSQL",
"sequence",
"exists"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L145-L154 |
190,572 | taq/torm | src/Sequences.php | Sequences._checkSequence | private static function _checkSequence()
{
if (Driver::$primary_key_behaviour!=Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
if (self::_sequenceExists()) {
return;
}
switch (Driver::$name) {
case "oracle":
self::_createOracleSequ... | php | private static function _checkSequence()
{
if (Driver::$primary_key_behaviour!=Driver::PRIMARY_KEY_SEQUENCE) {
return null;
}
if (self::_sequenceExists()) {
return;
}
switch (Driver::$name) {
case "oracle":
self::_createOracleSequ... | [
"private",
"static",
"function",
"_checkSequence",
"(",
")",
"{",
"if",
"(",
"Driver",
"::",
"$",
"primary_key_behaviour",
"!=",
"Driver",
"::",
"PRIMARY_KEY_SEQUENCE",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"self",
"::",
"_sequenceExists",
"(",
")... | Create a sequence if not exists
@return null | [
"Create",
"a",
"sequence",
"if",
"not",
"exists"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L161-L179 |
190,573 | taq/torm | src/Sequences.php | Sequences._createOracleSequence | private static function _createOracleSequence()
{
$name = self::resolveSequenceName();
$sql = "create sequence $name increment by 1 start with 1 nocycle nocache";
Log::log($sql);
$stmt = self::query($sql);
self::closeCursor($stmt);
} | php | private static function _createOracleSequence()
{
$name = self::resolveSequenceName();
$sql = "create sequence $name increment by 1 start with 1 nocycle nocache";
Log::log($sql);
$stmt = self::query($sql);
self::closeCursor($stmt);
} | [
"private",
"static",
"function",
"_createOracleSequence",
"(",
")",
"{",
"$",
"name",
"=",
"self",
"::",
"resolveSequenceName",
"(",
")",
";",
"$",
"sql",
"=",
"\"create sequence $name increment by 1 start with 1 nocycle nocache\"",
";",
"Log",
"::",
"log",
"(",
"$"... | Create an Oracle sequence
@return null | [
"Create",
"an",
"Oracle",
"sequence"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L186-L193 |
190,574 | taq/torm | src/Sequences.php | Sequences.sequenceNextVal | public static function sequenceNextVal($name)
{
$sql = null;
switch (Driver::$name) {
case "oracle":
$sql = "select $name.nextval from dual";
break;
case "postgresql":
$sql = "select nextval('$name') as nextval";
break;
}
... | php | public static function sequenceNextVal($name)
{
$sql = null;
switch (Driver::$name) {
case "oracle":
$sql = "select $name.nextval from dual";
break;
case "postgresql":
$sql = "select nextval('$name') as nextval";
break;
}
... | [
"public",
"static",
"function",
"sequenceNextVal",
"(",
"$",
"name",
")",
"{",
"$",
"sql",
"=",
"null",
";",
"switch",
"(",
"Driver",
"::",
"$",
"name",
")",
"{",
"case",
"\"oracle\"",
":",
"$",
"sql",
"=",
"\"select $name.nextval from dual\"",
";",
"break... | Get the next value from a sequence
@param string $name sequence name
@return mixed next value | [
"Get",
"the",
"next",
"value",
"from",
"a",
"sequence"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Sequences.php#L216-L249 |
190,575 | phly/conduit | src/Next.php | Next.resetPath | private function resetPath(Http\Request $request)
{
if (! $this->removed) {
return $request;
}
$uri = $request->getUri();
$path = $uri->getPath();
if (strlen($path) >= strlen($this->removed)
&& 0 === strpos($path, $this->removed)
) {
... | php | private function resetPath(Http\Request $request)
{
if (! $this->removed) {
return $request;
}
$uri = $request->getUri();
$path = $uri->getPath();
if (strlen($path) >= strlen($this->removed)
&& 0 === strpos($path, $this->removed)
) {
... | [
"private",
"function",
"resetPath",
"(",
"Http",
"\\",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"removed",
")",
"{",
"return",
"$",
"request",
";",
"}",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"(",
")",
";",
... | Reset the path, if a segment was previously stripped
@param Http\Request $request
@return Http\Request | [
"Reset",
"the",
"path",
"if",
"a",
"segment",
"was",
"previously",
"stripped"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Next.php#L114-L143 |
190,576 | phly/conduit | src/Next.php | Next.getBorder | private function getBorder($path, $route)
{
$border = (strlen($path) > strlen($route))
? $path[strlen($route)]
: '';
$border = ($route === '/') ? '/' : $border;
return $border;
} | php | private function getBorder($path, $route)
{
$border = (strlen($path) > strlen($route))
? $path[strlen($route)]
: '';
$border = ($route === '/') ? '/' : $border;
return $border;
} | [
"private",
"function",
"getBorder",
"(",
"$",
"path",
",",
"$",
"route",
")",
"{",
"$",
"border",
"=",
"(",
"strlen",
"(",
"$",
"path",
")",
">",
"strlen",
"(",
"$",
"route",
")",
")",
"?",
"$",
"path",
"[",
"strlen",
"(",
"$",
"route",
")",
"]... | Determine the border between the request path and current route
@param string $path
@param string $route
@return string | [
"Determine",
"the",
"border",
"between",
"the",
"request",
"path",
"and",
"current",
"route"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Next.php#L152-L159 |
190,577 | phly/conduit | src/Next.php | Next.stripRouteFromPath | private function stripRouteFromPath(Http\Request $request, $route)
{
$this->removed = $route;
$uri = $request->getUri();
$path = $this->getTruncatedPath($route, $uri->getPath());
$new = $uri->withPath($path);
// Root path of route is treated differently
if ($path ... | php | private function stripRouteFromPath(Http\Request $request, $route)
{
$this->removed = $route;
$uri = $request->getUri();
$path = $this->getTruncatedPath($route, $uri->getPath());
$new = $uri->withPath($path);
// Root path of route is treated differently
if ($path ... | [
"private",
"function",
"stripRouteFromPath",
"(",
"Http",
"\\",
"Request",
"$",
"request",
",",
"$",
"route",
")",
"{",
"$",
"this",
"->",
"removed",
"=",
"$",
"route",
";",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"(",
")",
";",
"$",
"path",... | Strip the route from the request path
@param Http\Request $request
@param string $route
@return Http\Request | [
"Strip",
"the",
"route",
"from",
"the",
"request",
"path"
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Next.php#L168-L182 |
190,578 | phly/conduit | src/Next.php | Next.getTruncatedPath | private function getTruncatedPath($segment, $path)
{
if ($path === $segment) {
// Segment and path are same; return empty string
return '';
}
$segmentLength = strlen($segment);
if (strlen($path) > $segmentLength) {
// Strip segment from start of p... | php | private function getTruncatedPath($segment, $path)
{
if ($path === $segment) {
// Segment and path are same; return empty string
return '';
}
$segmentLength = strlen($segment);
if (strlen($path) > $segmentLength) {
// Strip segment from start of p... | [
"private",
"function",
"getTruncatedPath",
"(",
"$",
"segment",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"path",
"===",
"$",
"segment",
")",
"{",
"// Segment and path are same; return empty string",
"return",
"''",
";",
"}",
"$",
"segmentLength",
"=",
"strl... | Strip the segment from the start of the given path.
@param string $segment
@param string $path
@return string Truncated path
@throws RuntimeException if the segment does not begin the path. | [
"Strip",
"the",
"segment",
"from",
"the",
"start",
"of",
"the",
"given",
"path",
"."
] | 29f6e8c87ce2b9a3e95bc5c2c7371f101081853d | https://github.com/phly/conduit/blob/29f6e8c87ce2b9a3e95bc5c2c7371f101081853d/src/Next.php#L192-L214 |
190,579 | taq/torm | src/Validation.php | Validation.presence | public static function presence($cls, $id, $attr, $attr_value, $validation_value, $options)
{
if (!$validation_value) {
return true;
}
return strlen(trim($attr_value)) > 0;
} | php | public static function presence($cls, $id, $attr, $attr_value, $validation_value, $options)
{
if (!$validation_value) {
return true;
}
return strlen(trim($attr_value)) > 0;
} | [
"public",
"static",
"function",
"presence",
"(",
"$",
"cls",
",",
"$",
"id",
",",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"validation_value",
",",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"validation_value",
")",
"{",
"return",
"true",
"... | Check if an attribute is present
@param string $cls class
@param mixed $id id
@param string $attr attribute
@param mixed $attr_value attribute value
@param mixed $validation_value validation value
@param mixed $options options
@return valid or not | [
"Check",
"if",
"an",
"attribute",
"is",
"present"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validation.php#L52-L58 |
190,580 | taq/torm | src/Validation.php | Validation.format | public static function format($cls, $id, $attr, $attr_value, $validation_value, $options)
{
// check if allow blank values
if (!is_null($options) && array_key_exists("allow_blank", $options) && strlen(trim($attr_value)) < 1) {
return true;
}
// check if allow null values... | php | public static function format($cls, $id, $attr, $attr_value, $validation_value, $options)
{
// check if allow blank values
if (!is_null($options) && array_key_exists("allow_blank", $options) && strlen(trim($attr_value)) < 1) {
return true;
}
// check if allow null values... | [
"public",
"static",
"function",
"format",
"(",
"$",
"cls",
",",
"$",
"id",
",",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"validation_value",
",",
"$",
"options",
")",
"{",
"// check if allow blank values",
"if",
"(",
"!",
"is_null",
"(",
"$",
"opti... | Check if an attribute format is ok
@param string $cls class
@param mixed $id id
@param string $attr attribute
@param mixed $attr_value attribute value
@param mixed $validation_value validation value
@param mixed $options options
@return valid or not | [
"Check",
"if",
"an",
"attribute",
"format",
"is",
"ok"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validation.php#L72-L86 |
190,581 | taq/torm | src/Validation.php | Validation.uniqueness | public static function uniqueness($cls, $id, $attr, $attr_value, $validation_value, $options)
{
// check if allow null values
if (!is_null($options) && array_key_exists("allow_null", $options) && is_null($attr_value)) {
return true;
}
// check if allow blank values
... | php | public static function uniqueness($cls, $id, $attr, $attr_value, $validation_value, $options)
{
// check if allow null values
if (!is_null($options) && array_key_exists("allow_null", $options) && is_null($attr_value)) {
return true;
}
// check if allow blank values
... | [
"public",
"static",
"function",
"uniqueness",
"(",
"$",
"cls",
",",
"$",
"id",
",",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"validation_value",
",",
"$",
"options",
")",
"{",
"// check if allow null values",
"if",
"(",
"!",
"is_null",
"(",
"$",
"o... | Check if an attribute is unique
@param string $cls class
@param mixed $id id
@param string $attr attribute
@param mixed $attr_value attribute value
@param mixed $validation_value validation value
@param mixed $options options
@return valid or not | [
"Check",
"if",
"an",
"attribute",
"is",
"unique"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validation.php#L100-L112 |
190,582 | taq/torm | src/Validation.php | Validation.numericality | public static function numericality($cls, $id, $attr, $attr_value, $validation_value, $options)
{
return preg_match("/^[-\.0-9]+$/", trim($attr_value));
} | php | public static function numericality($cls, $id, $attr, $attr_value, $validation_value, $options)
{
return preg_match("/^[-\.0-9]+$/", trim($attr_value));
} | [
"public",
"static",
"function",
"numericality",
"(",
"$",
"cls",
",",
"$",
"id",
",",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"validation_value",
",",
"$",
"options",
")",
"{",
"return",
"preg_match",
"(",
"\"/^[-\\.0-9]+$/\"",
",",
"trim",
"(",
"... | Check if an attribute is numeric
@param string $cls class
@param mixed $id id
@param string $attr attribute
@param mixed $attr_value attribute value
@param mixed $validation_value validation value
@param mixed $options options
@return valid or not | [
"Check",
"if",
"an",
"attribute",
"is",
"numeric"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Validation.php#L126-L129 |
190,583 | taq/torm | src/HasMany.php | HasMany.hasMany | public static function hasMany($attr, $options=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many)) {
self::$_has_many[$cls] = array();
}
self::$_has_many[$cls][$attr] = $options ? $options : false;
$klass = self::hasManyClass($attr... | php | public static function hasMany($attr, $options=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many)) {
self::$_has_many[$cls] = array();
}
self::$_has_many[$cls][$attr] = $options ? $options : false;
$klass = self::hasManyClass($attr... | [
"public",
"static",
"function",
"hasMany",
"(",
"$",
"attr",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_has_many",
")"... | Create a has many relationship
@param string $attr attribute
@param mixed $options to use
@return null | [
"Create",
"a",
"has",
"many",
"relationship"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L29-L42 |
190,584 | taq/torm | src/HasMany.php | HasMany.hasHasMany | public static function hasHasMany($attr)
{
$cls = get_called_class();
return array_key_exists($cls, self::$_has_many) &&
array_key_exists($attr, self::$_has_many[$cls]);
} | php | public static function hasHasMany($attr)
{
$cls = get_called_class();
return array_key_exists($cls, self::$_has_many) &&
array_key_exists($attr, self::$_has_many[$cls]);
} | [
"public",
"static",
"function",
"hasHasMany",
"(",
"$",
"attr",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_has_many",
")",
"&&",
"array_key_exists",
"(",
"$",
"at... | Check if there is a has many association
@param string $attr attribute to check
@return boolean | [
"Check",
"if",
"there",
"is",
"a",
"has",
"many",
"association"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L51-L56 |
190,585 | taq/torm | src/HasMany.php | HasMany._checkAndReturnMany | private static function _checkAndReturnMany($method, $value)
{
$cls = get_called_class();
if (array_key_exists($cls, self::$_has_many)
&& array_key_exists($method, self::$_has_many[$cls])
) {
return self::_resolveHasMany($method, $value);
}
} | php | private static function _checkAndReturnMany($method, $value)
{
$cls = get_called_class();
if (array_key_exists($cls, self::$_has_many)
&& array_key_exists($method, self::$_has_many[$cls])
) {
return self::_resolveHasMany($method, $value);
}
} | [
"private",
"static",
"function",
"_checkAndReturnMany",
"(",
"$",
"method",
",",
"$",
"value",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_has_many",
")",
"&&",
... | Check a has many association and returns it resolved, if exists.
@param string $method name
@param mixed $value of this object primary key
@return has many collection, if any | [
"Check",
"a",
"has",
"many",
"association",
"and",
"returns",
"it",
"resolved",
"if",
"exists",
"."
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L66-L74 |
190,586 | taq/torm | src/HasMany.php | HasMany.hasManyForeignKey | public static function hasManyForeignKey($attr)
{
if (!self::hasHasMany($attr)) {
return null;
}
$cls = get_called_class();
$configs = self::$_has_many[$cls][$attr];
$key = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreig... | php | public static function hasManyForeignKey($attr)
{
if (!self::hasHasMany($attr)) {
return null;
}
$cls = get_called_class();
$configs = self::$_has_many[$cls][$attr];
$key = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreig... | [
"public",
"static",
"function",
"hasManyForeignKey",
"(",
"$",
"attr",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"hasHasMany",
"(",
"$",
"attr",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"$",
"config... | Check if there is a has many foreign key
@param string $attr attribute
@return string foreign key | [
"Check",
"if",
"there",
"is",
"a",
"has",
"many",
"foreign",
"key"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L102-L112 |
190,587 | taq/torm | src/HasMany.php | HasMany._resolveHasMany | private static function _resolveHasMany($attr, $value)
{
$cls = get_called_class();
if (!self::hasHasMany($attr)) {
return null;
}
$configs = self::$_has_many[$cls][$attr];
$has_many_cls = self::hasManyClass($attr);
$this_key = self::hasManyFo... | php | private static function _resolveHasMany($attr, $value)
{
$cls = get_called_class();
if (!self::hasHasMany($attr)) {
return null;
}
$configs = self::$_has_many[$cls][$attr];
$has_many_cls = self::hasManyClass($attr);
$this_key = self::hasManyFo... | [
"private",
"static",
"function",
"_resolveHasMany",
"(",
"$",
"attr",
",",
"$",
"value",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"self",
"::",
"hasHasMany",
"(",
"$",
"attr",
")",
")",
"{",
"return",
"null",
";",... | Resolve the has many association and returns the collection with values
@param string $attr association name
@param mixed $value of this object
@return collection | [
"Resolve",
"the",
"has",
"many",
"association",
"and",
"returns",
"the",
"collection",
"with",
"values"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L122-L134 |
190,588 | taq/torm | src/HasMany.php | HasMany._resolveIds | private function _resolveIds($attr, $values=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many_maps)
|| !array_key_exists($attr, self::$_has_many_maps[$cls])
) {
return null;
}
$klass = self::hasManyClass(self::$_has_ma... | php | private function _resolveIds($attr, $values=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many_maps)
|| !array_key_exists($attr, self::$_has_many_maps[$cls])
) {
return null;
}
$klass = self::hasManyClass(self::$_has_ma... | [
"private",
"function",
"_resolveIds",
"(",
"$",
"attr",
",",
"$",
"values",
"=",
"null",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_has_many_maps",
")",
... | Resolve has many ids
@param string $attr attribute name
@param mixed $values to resolve
@return ids | [
"Resolve",
"has",
"many",
"ids"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L144-L172 |
190,589 | taq/torm | src/HasMany.php | HasMany._resolveCollection | private function _resolveCollection($attr, $values)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many_maps)) {
return null;
}
$maps = array_values(self::$_has_many_maps[$cls]);
if (!in_array($attr, $maps)) {
return null;
... | php | private function _resolveCollection($attr, $values)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_has_many_maps)) {
return null;
}
$maps = array_values(self::$_has_many_maps[$cls]);
if (!in_array($attr, $maps)) {
return null;
... | [
"private",
"function",
"_resolveCollection",
"(",
"$",
"attr",
",",
"$",
"values",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_has_many_maps",
")",
")",
"{... | Set values to a has many association, from an array
@param string $attr attribute
@param mixed $values values to use
@return collections | [
"Set",
"values",
"to",
"a",
"has",
"many",
"association",
"from",
"an",
"array"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L182-L210 |
190,590 | taq/torm | src/HasMany.php | HasMany._nullNotPresentIds | private function _nullNotPresentIds($klass, $foreign, $ids, $id)
{
$escape = Driver::$escape_char;
$klasspk = $klass::getPK();
$klass = strtolower($klass);
$table = Model::getTableName($klass);
$sql = "update $escape$table$escape set $escape$foreign$escape=null where... | php | private function _nullNotPresentIds($klass, $foreign, $ids, $id)
{
$escape = Driver::$escape_char;
$klasspk = $klass::getPK();
$klass = strtolower($klass);
$table = Model::getTableName($klass);
$sql = "update $escape$table$escape set $escape$foreign$escape=null where... | [
"private",
"function",
"_nullNotPresentIds",
"(",
"$",
"klass",
",",
"$",
"foreign",
",",
"$",
"ids",
",",
"$",
"id",
")",
"{",
"$",
"escape",
"=",
"Driver",
"::",
"$",
"escape_char",
";",
"$",
"klasspk",
"=",
"$",
"klass",
"::",
"getPK",
"(",
")",
... | Nullify foreign class keys not present in array
@param string $klass association class
@param string $foreign foreign key on association class
@param mixed $ids ids to check
@param string $id id of the foreign association
@return null | [
"Nullify",
"foreign",
"class",
"keys",
"not",
"present",
"in",
"array"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L222-L231 |
190,591 | taq/torm | src/HasMany.php | HasMany.push | public function push($obj)
{
if (!$obj) {
return;
}
$cls = get_called_class();
$escape = Driver::$escape_char;
$value = array_key_exists(self::getPK(), $this->_data) ? $this->_data[self::getPK()] : null;
$other_cls = get_class... | php | public function push($obj)
{
if (!$obj) {
return;
}
$cls = get_called_class();
$escape = Driver::$escape_char;
$value = array_key_exists(self::getPK(), $this->_data) ? $this->_data[self::getPK()] : null;
$other_cls = get_class... | [
"public",
"function",
"push",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"!",
"$",
"obj",
")",
"{",
"return",
";",
"}",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"$",
"escape",
"=",
"Driver",
"::",
"$",
"escape_char",
";",
"$",
"value",
"=",... | Push an objet to a has many association
@param mixed $obj object
@return pushed | [
"Push",
"an",
"objet",
"to",
"a",
"has",
"many",
"association"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/HasMany.php#L240-L280 |
190,592 | taq/torm | src/Cache.php | Cache.getInstance | public static function getInstance()
{
if (!isset(self::$_instance)) {
$c = __CLASS__;
self::$_instance = new $c;
}
return self::$_instance;
} | php | public static function getInstance()
{
if (!isset(self::$_instance)) {
$c = __CLASS__;
self::$_instance = new $c;
}
return self::$_instance;
} | [
"public",
"static",
"function",
"getInstance",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_instance",
")",
")",
"{",
"$",
"c",
"=",
"__CLASS__",
";",
"self",
"::",
"$",
"_instance",
"=",
"new",
"$",
"c",
";",
"}",
"return",
... | Get cache instance
@return mixed cache | [
"Get",
"cache",
"instance"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Cache.php#L48-L55 |
190,593 | taq/torm | src/Cache.php | Cache.put | public function put($sql, $cls = null)
{
$this->expireCache();
$hash = self::_sqlHash($sql);
if (array_key_exists($hash, $this->_prepared_cache)) {
Log::log("SQL: already prepared:\n$sql");
return $this->_prepared_cache[$hash]["statement"];
} else {
... | php | public function put($sql, $cls = null)
{
$this->expireCache();
$hash = self::_sqlHash($sql);
if (array_key_exists($hash, $this->_prepared_cache)) {
Log::log("SQL: already prepared:\n$sql");
return $this->_prepared_cache[$hash]["statement"];
} else {
... | [
"public",
"function",
"put",
"(",
"$",
"sql",
",",
"$",
"cls",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"expireCache",
"(",
")",
";",
"$",
"hash",
"=",
"self",
"::",
"_sqlHash",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",... | Put a prepared statement on cache, if not there.
@param string $sql query
@param string $cls class to resolve connection
@return object prepared statement | [
"Put",
"a",
"prepared",
"statement",
"on",
"cache",
"if",
"not",
"there",
"."
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Cache.php#L77-L93 |
190,594 | taq/torm | src/Cache.php | Cache.get | public function get($sql)
{
$this->expireCache();
$hash = self::_sqlHash($sql);
// if doesn't exists, return null
if (!array_key_exists($hash, $this->_prepared_cache)) {
return null;
}
return $this->_prepared_cache[$hash]["statement"];
} | php | public function get($sql)
{
$this->expireCache();
$hash = self::_sqlHash($sql);
// if doesn't exists, return null
if (!array_key_exists($hash, $this->_prepared_cache)) {
return null;
}
return $this->_prepared_cache[$hash]["statement"];
} | [
"public",
"function",
"get",
"(",
"$",
"sql",
")",
"{",
"$",
"this",
"->",
"expireCache",
"(",
")",
";",
"$",
"hash",
"=",
"self",
"::",
"_sqlHash",
"(",
"$",
"sql",
")",
";",
"// if doesn't exists, return null",
"if",
"(",
"!",
"array_key_exists",
"(",
... | Get a prepared statement from cache
@param string $sql query
@return object or null if not on cache | [
"Get",
"a",
"prepared",
"statement",
"from",
"cache"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Cache.php#L102-L112 |
190,595 | taq/torm | src/BelongsTo.php | BelongsTo.belongsTo | public static function belongsTo($model, $options=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_belongs_to)) {
self::$_belongs_to[$cls] = array();
}
self::$_belongs_to[$cls][$model] = $options ? $options : false;
} | php | public static function belongsTo($model, $options=null)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_belongs_to)) {
self::$_belongs_to[$cls] = array();
}
self::$_belongs_to[$cls][$model] = $options ? $options : false;
} | [
"public",
"static",
"function",
"belongsTo",
"(",
"$",
"model",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_belongs_to",
... | Create a belongs relationship
@param string $model model
@param mixed $options options for relation
@return null | [
"Create",
"a",
"belongs",
"relationship"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/BelongsTo.php#L28-L35 |
190,596 | taq/torm | src/BelongsTo.php | BelongsTo._checkAndReturnBelongs | private function _checkAndReturnBelongs($attr, $values)
{
$cls = get_called_class();
if (array_key_exists($cls, self::$_belongs_to)
&& array_key_exists($attr, self::$_belongs_to[$cls])
) {
return $this->_resolveBelongsTo($attr, $values);
}
} | php | private function _checkAndReturnBelongs($attr, $values)
{
$cls = get_called_class();
if (array_key_exists($cls, self::$_belongs_to)
&& array_key_exists($attr, self::$_belongs_to[$cls])
) {
return $this->_resolveBelongsTo($attr, $values);
}
} | [
"private",
"function",
"_checkAndReturnBelongs",
"(",
"$",
"attr",
",",
"$",
"values",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_belongs_to",
")",
"&&",
"array_... | Check if is there a belongs to association and return it
@param string $attr attribute
@param mixed $values values to use
@return mixed association | [
"Check",
"if",
"is",
"there",
"a",
"belongs",
"to",
"association",
"and",
"return",
"it"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/BelongsTo.php#L45-L53 |
190,597 | taq/torm | src/BelongsTo.php | BelongsTo._resolveBelongsTo | private function _resolveBelongsTo($attr, $values)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_belongs_to)
|| !array_key_exists($attr, self::$_belongs_to[$cls])
) {
return null;
}
$configs = self::$_belongs_to[$cls][$attr];
... | php | private function _resolveBelongsTo($attr, $values)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_belongs_to)
|| !array_key_exists($attr, self::$_belongs_to[$cls])
) {
return null;
}
$configs = self::$_belongs_to[$cls][$attr];
... | [
"private",
"function",
"_resolveBelongsTo",
"(",
"$",
"attr",
",",
"$",
"values",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_belongs_to",
")",
"||",
"!",
... | Resolve a belongs to association
@param string $attr attribute
@param mixed $values values to use
@return association | [
"Resolve",
"a",
"belongs",
"to",
"association"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/BelongsTo.php#L63-L88 |
190,598 | taq/torm | src/Scopes.php | Scopes.scope | public static function scope($name, $conditions)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_scopes)) {
self::$_scopes[$cls] = array();
}
if (!array_key_exists($name, self::$_scopes[$cls])) {
self::$_scopes[$cls][$name] = array();
... | php | public static function scope($name, $conditions)
{
$cls = get_called_class();
if (!array_key_exists($cls, self::$_scopes)) {
self::$_scopes[$cls] = array();
}
if (!array_key_exists($name, self::$_scopes[$cls])) {
self::$_scopes[$cls][$name] = array();
... | [
"public",
"static",
"function",
"scope",
"(",
"$",
"name",
",",
"$",
"conditions",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cls",
",",
"self",
"::",
"$",
"_scopes",
")",
")",
"{",
... | Create a scope
@param string $name of scope
@param mixed $conditions to avail
@return null | [
"Create",
"a",
"scope"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Scopes.php#L27-L40 |
190,599 | taq/torm | src/Scopes.php | Scopes.getScope | public static function getScope($name, $cls = null)
{
if (!$cls) {
$cls = get_called_class();
}
if (!array_key_exists($cls, self::$_scopes)
|| !array_key_exists($name, self::$_scopes[$cls])
) {
return null;
}
return self::$_scopes... | php | public static function getScope($name, $cls = null)
{
if (!$cls) {
$cls = get_called_class();
}
if (!array_key_exists($cls, self::$_scopes)
|| !array_key_exists($name, self::$_scopes[$cls])
) {
return null;
}
return self::$_scopes... | [
"public",
"static",
"function",
"getScope",
"(",
"$",
"name",
",",
"$",
"cls",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"cls",
")",
"{",
"$",
"cls",
"=",
"get_called_class",
"(",
")",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"cl... | Return a scope
@param string $name of scope
@param string $cls class of scope
@return mixed scope | [
"Return",
"a",
"scope"
] | 9db401ffd313af1b54e769cae90c00d6fce8dc81 | https://github.com/taq/torm/blob/9db401ffd313af1b54e769cae90c00d6fce8dc81/src/Scopes.php#L50-L63 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.