repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.floatPow | public function floatPow(FloatType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = RationalTypeFactory::fromFloat($a());
return $this->rationalPow($b, $exp)->asFloatType();
}
if ($exp instanceof ComplexType) {
return $this->floatComplexPow($a(), $... | php | public function floatPow(FloatType $a, NI $exp)
{
if ($exp instanceof RationalType) {
$b = RationalTypeFactory::fromFloat($a());
return $this->rationalPow($b, $exp)->asFloatType();
}
if ($exp instanceof ComplexType) {
return $this->floatComplexPow($a(), $... | [
"public",
"function",
"floatPow",
"(",
"FloatType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"RationalType",
")",
"{",
"$",
"b",
"=",
"RationalTypeFactory",
"::",
"fromFloat",
"(",
"$",
"a",
"(",
")",
")",
";",
... | Float Pow - raise number to the exponent
Will return a float type
@param FloatType $a operand
@param NI $exp Exponent
@return FloatType | [
"Float",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"float",
"type"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L230-L245 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeAdd | public function wholeAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() + $b());
} | php | public function wholeAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() + $b());
} | [
"public",
"function",
"wholeAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number addition
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"addition"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L267-L271 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeSub | public function wholeSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() - $b());
} | php | public function wholeSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() - $b());
} | [
"public",
"function",
"wholeSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number subtraction
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"subtraction"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L281-L285 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.wholeMul | public function wholeMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() * $b());
} | php | public function wholeMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new WholeIntType($a() * $b());
} | [
"public",
"function",
"wholeMul",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"WholeIntType",
... | Whole number multiplication
@param NI $a first operand
@param NI $b second operand
@return WholeIntType | [
"Whole",
"number",
"multiplication"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L295-L299 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalAdd | public function naturalAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() + $b());
} | php | public function naturalAdd(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() + $b());
} | [
"public",
"function",
"naturalAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number addition
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"addition"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L309-L313 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalSub | public function naturalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() - $b());
} | php | public function naturalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() - $b());
} | [
"public",
"function",
"naturalSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number subtraction
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"subtraction"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L323-L327 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.naturalMul | public function naturalMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() * $b());
} | php | public function naturalMul(NI $a, NI $b)
{
list($a, $b) = $this->checkIntTypes($a, $b);
return new NaturalIntType($a() * $b());
} | [
"public",
"function",
"naturalMul",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkIntTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"return",
"new",
"NaturalIntType... | Natural number multiplication
@param NI $a first operand
@param NI $b second operand
@return NaturalIntType | [
"Natural",
"number",
"multiplication"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L337-L341 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalAdd | public function rationalAdd(NI $a, NI $b)
{
if (!$a instanceof RationalType) {
$a = $a->asRational();
}
if (!$b instanceof RationalType) {
$b = $b->asRational();
}
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()... | php | public function rationalAdd(NI $a, NI $b)
{
if (!$a instanceof RationalType) {
$a = $a->asRational();
}
if (!$b instanceof RationalType) {
$b = $b->asRational();
}
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()... | [
"public",
"function",
"rationalAdd",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"if",
"(",
"!",
"$",
"a",
"instanceof",
"RationalType",
")",
"{",
"$",
"a",
"=",
"$",
"a",
"->",
"asRational",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"... | Rational number addition
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"addition"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L351-L366 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalSub | public function rationalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()->get()));
$nn = $this->rationalDiv($this->rationalMul($a->numerator(), $d), $a->denominator())->get();
... | php | public function rationalSub(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$d = RationalTypeFactory::create($this->lcm($a->denominator()->get(), $b->denominator()->get()));
$nn = $this->rationalDiv($this->rationalMul($a->numerator(), $d), $a->denominator())->get();
... | [
"public",
"function",
"rationalSub",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkRationalTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"$",
"d",
"=",
"Rational... | Rational number subtraction
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"subtraction"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L376-L385 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalDiv | public function rationalDiv(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$n = $this->intMul($a->numerator(), $b->denominator());
$d = $this->intMul($a->denominator(), $b->numerator());
return RationalTypeFactory::create($n, $d);
} | php | public function rationalDiv(NI $a, NI $b)
{
list($a, $b) = $this->checkRationalTypes($a, $b);
$n = $this->intMul($a->numerator(), $b->denominator());
$d = $this->intMul($a->denominator(), $b->numerator());
return RationalTypeFactory::create($n, $d);
} | [
"public",
"function",
"rationalDiv",
"(",
"NI",
"$",
"a",
",",
"NI",
"$",
"b",
")",
"{",
"list",
"(",
"$",
"a",
",",
"$",
"b",
")",
"=",
"$",
"this",
"->",
"checkRationalTypes",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"$",
"n",
"=",
"$",
"t... | Rational number division
@param NI $a first operand
@param NI $b second operand
@return RationalType | [
"Rational",
"number",
"division"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L412-L419 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalPow | public function rationalPow(RationalType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$r = $this->floatComplexPow($a(), $exp);
if ($r instanceof FloatType) {
return RationalTypeFactory::fromFloat($r());
}
return $r;
}
$exp... | php | public function rationalPow(RationalType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$r = $this->floatComplexPow($a(), $exp);
if ($r instanceof FloatType) {
return RationalTypeFactory::fromFloat($r());
}
return $r;
}
$exp... | [
"public",
"function",
"rationalPow",
"(",
"RationalType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"ComplexType",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"floatComplexPow",
"(",
"$",
"a",
"(",
")",
",",
"$... | Rational Pow - raise number to the exponent
Will return a RationalType
@param RationalType $a operand
@param NI $exp exponent
@return NI | [
"Rational",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"RationalType"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L442-L459 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.rationalSqrt | public function rationalSqrt(RationalType $a)
{
$num = sqrt($a->numerator()->get());
$den = sqrt($a->denominator()->get());
return $this->rationalDiv(
RationalTypeFactory::fromFloat($num),
RationalTypeFactory::fromFloat($den)
);
} | php | public function rationalSqrt(RationalType $a)
{
$num = sqrt($a->numerator()->get());
$den = sqrt($a->denominator()->get());
return $this->rationalDiv(
RationalTypeFactory::fromFloat($num),
RationalTypeFactory::fromFloat($den)
);
} | [
"public",
"function",
"rationalSqrt",
"(",
"RationalType",
"$",
"a",
")",
"{",
"$",
"num",
"=",
"sqrt",
"(",
"$",
"a",
"->",
"numerator",
"(",
")",
"->",
"get",
"(",
")",
")",
";",
"$",
"den",
"=",
"sqrt",
"(",
"$",
"a",
"->",
"denominator",
"(",... | Rational sqrt
@param RationalType $a operand
@return RationalType result | [
"Rational",
"sqrt"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L468-L476 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexAdd | public function complexAdd(ComplexType $a, ComplexType $b)
{
$r = $this->rationalAdd($a->r(), $b->r());
$i = $this->rationalAdd($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | php | public function complexAdd(ComplexType $a, ComplexType $b)
{
$r = $this->rationalAdd($a->r(), $b->r());
$i = $this->rationalAdd($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | [
"public",
"function",
"complexAdd",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalAdd",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"->",
"r",
"(",
")",
")",
";",
"$",
... | Complex number addition
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"addition"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L487-L492 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexSub | public function complexSub(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub($a->r(), $b->r());
$i = $this->rationalSub($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | php | public function complexSub(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub($a->r(), $b->r());
$i = $this->rationalSub($a->i(), $b->i());
return ComplexTypeFactory::create($r, $i);
} | [
"public",
"function",
"complexSub",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalSub",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"->",
"r",
"(",
")",
")",
";",
"$",
... | Complex number subtraction
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"subtraction"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L502-L507 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexMul | public function complexMul(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub(
$this->rationalMul($a->r(), $b->r()),
$this->rationalMul($a->i(), $b->i())
);
$i = $this->rationalAdd(
$this->rationalMul($a->i(), $b->r()),
$this->rationalMu... | php | public function complexMul(ComplexType $a, ComplexType $b)
{
$r = $this->rationalSub(
$this->rationalMul($a->r(), $b->r()),
$this->rationalMul($a->i(), $b->i())
);
$i = $this->rationalAdd(
$this->rationalMul($a->i(), $b->r()),
$this->rationalMu... | [
"public",
"function",
"complexMul",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"rationalSub",
"(",
"$",
"this",
"->",
"rationalMul",
"(",
"$",
"a",
"->",
"r",
"(",
")",
",",
"$",
"b",
"... | Complex number multiplication
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType | [
"Complex",
"number",
"multiplication"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L517-L528 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexDiv | public function complexDiv(ComplexType $a, ComplexType $b)
{
if ($b->isZero()) {
throw new \BadMethodCallException('Cannot divide complex number by zero complex number');
}
//div = br^2 + bi^2
$div = $this->rationalAdd(
$this->rationalMul($b->r(), $b->r()),
... | php | public function complexDiv(ComplexType $a, ComplexType $b)
{
if ($b->isZero()) {
throw new \BadMethodCallException('Cannot divide complex number by zero complex number');
}
//div = br^2 + bi^2
$div = $this->rationalAdd(
$this->rationalMul($b->r(), $b->r()),
... | [
"public",
"function",
"complexDiv",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"b",
"->",
"isZero",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'Cannot divide complex number by zero compl... | Complex number division
@param ComplexType $a first operand
@param ComplexType $b second operand
@return ComplexType
@throws \BadMethodCallException | [
"Complex",
"number",
"division"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L540-L568 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexReciprocal | public function complexReciprocal(ComplexType $a)
{
if ($a->isZero()) {
throw new \BadMethodCallException('Cannot compute reciprocal of zero complex number');
}
//div = ar^2 + ai^2
$div = $this->rationalAdd($this->rationalMul($a->r(), $a->r()), $this->rationalMul($a->i()... | php | public function complexReciprocal(ComplexType $a)
{
if ($a->isZero()) {
throw new \BadMethodCallException('Cannot compute reciprocal of zero complex number');
}
//div = ar^2 + ai^2
$div = $this->rationalAdd($this->rationalMul($a->r(), $a->r()), $this->rationalMul($a->i()... | [
"public",
"function",
"complexReciprocal",
"(",
"ComplexType",
"$",
"a",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"isZero",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'Cannot compute reciprocal of zero complex number'",
")",
";",
"}",
... | Complex number reciprocal: 1/a+bi
@param ComplexType $a operand
@return ComplexType
@throws \BadMethodCallException | [
"Complex",
"number",
"reciprocal",
":",
"1",
"/",
"a",
"+",
"bi"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L579-L591 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexPow | public function complexPow(ComplexType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$comp = new Comparator();
$zero = new IntType(0);
$real = 0;
$imaginary = 0;
if (!($comp->eq($a->r(), $zero) && $comp->eq($a->i(), $zero))) {
l... | php | public function complexPow(ComplexType $a, NI $exp)
{
if ($exp instanceof ComplexType) {
$comp = new Comparator();
$zero = new IntType(0);
$real = 0;
$imaginary = 0;
if (!($comp->eq($a->r(), $zero) && $comp->eq($a->i(), $zero))) {
l... | [
"public",
"function",
"complexPow",
"(",
"ComplexType",
"$",
"a",
",",
"NI",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"instanceof",
"ComplexType",
")",
"{",
"$",
"comp",
"=",
"new",
"Comparator",
"(",
")",
";",
"$",
"zero",
"=",
"new",
"IntType",... | Complex Pow - raise number to the exponent
Will return a ComplexType
Exponent must be non complex
@param ComplexType $a operand
@param NI $exp Exponent
@return ComplexType
@throws \InvalidArgumentException If exponent is complex | [
"Complex",
"Pow",
"-",
"raise",
"number",
"to",
"the",
"exponent",
"Will",
"return",
"a",
"ComplexType",
"Exponent",
"must",
"be",
"non",
"complex"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L606-L636 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.getPowExponentPartsFromPolar | protected function getPowExponentPartsFromPolar(ComplexType $a, ComplexType $exp)
{
$eReal = $exp->r()->get();
$eImaginary = $exp->i()->get();
$logr = log($a->modulus()->get());
$theta = $a->theta()->get();
$rho = exp($logr * $eReal - $eImaginary * $theta);
$beta = $t... | php | protected function getPowExponentPartsFromPolar(ComplexType $a, ComplexType $exp)
{
$eReal = $exp->r()->get();
$eImaginary = $exp->i()->get();
$logr = log($a->modulus()->get());
$theta = $a->theta()->get();
$rho = exp($logr * $eReal - $eImaginary * $theta);
$beta = $t... | [
"protected",
"function",
"getPowExponentPartsFromPolar",
"(",
"ComplexType",
"$",
"a",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"$",
"eReal",
"=",
"$",
"exp",
"->",
"r",
"(",
")",
"->",
"get",
"(",
")",
";",
"$",
"eImaginary",
"=",
"$",
"exp",
"->",
... | @param ComplexType $a first operand
@param ComplexType $exp second operand
@return array [real, imaginary] | [
"@param",
"ComplexType",
"$a",
"first",
"operand",
"@param",
"ComplexType",
"$exp",
"second",
"operand"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L644-L654 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.intComplexPow | private function intComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new IntType(1);
}
return $this->complexExponent($a, $exp);
} | php | private function intComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new IntType(1);
}
return $this->complexExponent($a, $exp);
} | [
"private",
"function",
"intComplexPow",
"(",
"$",
"a",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isZero",
"(",
")",
")",
"{",
"return",
"new",
"IntType",
"(",
"1",
")",
";",
"}",
"return",
"$",
"this",
"->",
"complexEx... | Create Complex power from an integer
@param int $a operand
@param ComplexType $exp exponent
@return NI|ComplexType|IntType | [
"Create",
"Complex",
"power",
"from",
"an",
"integer"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L676-L682 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.floatComplexPow | private function floatComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new FloatType(1);
}
return $this->complexExponent($a, $exp);
} | php | private function floatComplexPow($a, ComplexType $exp)
{
if ($exp->isZero()) {
return new FloatType(1);
}
return $this->complexExponent($a, $exp);
} | [
"private",
"function",
"floatComplexPow",
"(",
"$",
"a",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isZero",
"(",
")",
")",
"{",
"return",
"new",
"FloatType",
"(",
"1",
")",
";",
"}",
"return",
"$",
"this",
"->",
"compl... | Create complex power from a float
@param float $a operand
@param ComplexType $exp exponent
@return NI|ComplexType|FloatType | [
"Create",
"complex",
"power",
"from",
"a",
"float"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L692-L698 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Calculator/Native.php | Native.complexExponent | private function complexExponent($base, ComplexType $exp)
{
if ($exp->isReal()) {
return $this->rationalPow(
RationalTypeFactory::fromFloat($base),
$exp->r()
);
}
//do the imaginary part
//n^bi = cos(b.lg(n)) + i.sin(b.lg(n))
... | php | private function complexExponent($base, ComplexType $exp)
{
if ($exp->isReal()) {
return $this->rationalPow(
RationalTypeFactory::fromFloat($base),
$exp->r()
);
}
//do the imaginary part
//n^bi = cos(b.lg(n)) + i.sin(b.lg(n))
... | [
"private",
"function",
"complexExponent",
"(",
"$",
"base",
",",
"ComplexType",
"$",
"exp",
")",
"{",
"if",
"(",
"$",
"exp",
"->",
"isReal",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"rationalPow",
"(",
"RationalTypeFactory",
"::",
"fromFloat",
"(... | Create complex power from natural base and complex exponent
@param int|float $base base
@param ComplexType $exp exponent
@return NI|ComplexType | [
"Create",
"complex",
"power",
"from",
"natural",
"base",
"and",
"complex",
"exponent"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L708-L740 |
alexpts/psr15-middlewares | src/Etag.php | Etag.addEtag | public function addEtag(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
{
if ($this->canEtag($request, $response)) {
$streamData = $response->getBody()->getContents();
$etag = 'W/"' . md5($streamData) . '"';
$response = $response->withHead... | php | public function addEtag(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
{
if ($this->canEtag($request, $response)) {
$streamData = $response->getBody()->getContents();
$etag = 'W/"' . md5($streamData) . '"';
$response = $response->withHead... | [
"public",
"function",
"addEtag",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"canEtag",
"(",
"$",
"request",
",",
"$",
"response",
")",
")",
"{",
... | @param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface
@throws \RuntimeException
@throws \InvalidArgumentException | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"ResponseInterface",
"$response"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/Etag.php#L39-L49 |
alexpts/psr15-middlewares | src/Etag.php | Etag.setNotModifyHeader | protected function setNotModifyHeader(
ServerRequestInterface $request,
ResponseInterface $response,
string $etag
): ResponseInterface {
$clientEtag = $request->getHeaderLine('If-None-Match');
if ($clientEtag === $etag) {
$response = $response->withStatus(304);
... | php | protected function setNotModifyHeader(
ServerRequestInterface $request,
ResponseInterface $response,
string $etag
): ResponseInterface {
$clientEtag = $request->getHeaderLine('If-None-Match');
if ($clientEtag === $etag) {
$response = $response->withStatus(304);
... | [
"protected",
"function",
"setNotModifyHeader",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
",",
"string",
"$",
"etag",
")",
":",
"ResponseInterface",
"{",
"$",
"clientEtag",
"=",
"$",
"request",
"->",
"getHeaderLine",
... | @param ServerRequestInterface $request
@param ResponseInterface $response
@param string $etag
@return ResponseInterface | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"ResponseInterface",
"$response",
"@param",
"string",
"$etag"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/Etag.php#L58-L73 |
activecollab/databasestructure | src/Builder/TypesBuilder.php | TypesBuilder.postBuild | public function postBuild()
{
$types_build_path = $this->getBuildPath() ? "{$this->getBuildPath()}/types.php" : null;
if ($types_build_path) {
$result = [];
$result[] = '<?php';
$result[] = '';
if ($this->getStructure()->getConfig('header_comment'))... | php | public function postBuild()
{
$types_build_path = $this->getBuildPath() ? "{$this->getBuildPath()}/types.php" : null;
if ($types_build_path) {
$result = [];
$result[] = '<?php';
$result[] = '';
if ($this->getStructure()->getConfig('header_comment'))... | [
"public",
"function",
"postBuild",
"(",
")",
"{",
"$",
"types_build_path",
"=",
"$",
"this",
"->",
"getBuildPath",
"(",
")",
"?",
"\"{$this->getBuildPath()}/types.php\"",
":",
"null",
";",
"if",
"(",
"$",
"types_build_path",
")",
"{",
"$",
"result",
"=",
"["... | Execute after types are built. | [
"Execute",
"after",
"types",
"are",
"built",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/TypesBuilder.php#L21-L66 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/Style/StyleSelector.php | StyleSelector.analyzeSelector | protected function analyzeSelector()
{
if ($this->analyzed === false) {
// Calculate specificity
$selector = $this->getValue();
// Set flags
$isEscaped = false;
$inSelectorPart = false;
$wasEscaped = false;
$inAttribute = f... | php | protected function analyzeSelector()
{
if ($this->analyzed === false) {
// Calculate specificity
$selector = $this->getValue();
// Set flags
$isEscaped = false;
$inSelectorPart = false;
$wasEscaped = false;
$inAttribute = f... | [
"protected",
"function",
"analyzeSelector",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"analyzed",
"===",
"false",
")",
"{",
"// Calculate specificity",
"$",
"selector",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"// Set flags",
"$",
"isEscaped",
... | Analyzes the selector to extract pseudo classes/elements and calculate the specificity. | [
"Analyzes",
"the",
"selector",
"to",
"extract",
"pseudo",
"classes",
"/",
"elements",
"and",
"calculate",
"the",
"specificity",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/Style/StyleSelector.php#L148-L348 |
jasny/router | src/Router/Runner/Delegate.php | Delegate.getRunner | public function getRunner(Route $route)
{
if (isset($route->controller)) {
$class = Runner\Controller::class;
} elseif (isset($route->fn)) {
$class = Runner\Callback::class;
} elseif (isset($route->file)) {
$class = Runner\PhpScript::class;
} else ... | php | public function getRunner(Route $route)
{
if (isset($route->controller)) {
$class = Runner\Controller::class;
} elseif (isset($route->fn)) {
$class = Runner\Callback::class;
} elseif (isset($route->file)) {
$class = Runner\PhpScript::class;
} else ... | [
"public",
"function",
"getRunner",
"(",
"Route",
"$",
"route",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"route",
"->",
"controller",
")",
")",
"{",
"$",
"class",
"=",
"Runner",
"\\",
"Controller",
"::",
"class",
";",
"}",
"elseif",
"(",
"isset",
"(",
... | Create Runner instance
@param Route $route
@return Runner | [
"Create",
"Runner",
"instance"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Runner/Delegate.php#L24-L38 |
blast-project/CoreBundle | src/Generator/ArrayToYamlGenerator.php | ArrayToYamlGenerator.generate | public function generate($array, $skeleton)
{
$parts = explode('.', $this->file->getPathName());
array_pop($parts);
$file = implode('.', $parts) . '.yml';
if (file_exists($file)) {
return;
}
$this->renderFile($skeleton, $file, array(
'array'... | php | public function generate($array, $skeleton)
{
$parts = explode('.', $this->file->getPathName());
array_pop($parts);
$file = implode('.', $parts) . '.yml';
if (file_exists($file)) {
return;
}
$this->renderFile($skeleton, $file, array(
'array'... | [
"public",
"function",
"generate",
"(",
"$",
"array",
",",
"$",
"skeleton",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"file",
"->",
"getPathName",
"(",
")",
")",
";",
"array_pop",
"(",
"$",
"parts",
")",
";",
"$",
... | @param string $array
@throws \RuntimeException | [
"@param",
"string",
"$array"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Generator/ArrayToYamlGenerator.php#L38-L52 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php | GroupedItemsPriceCalculator.calculate | public function calculate(
$items,
&$groupPrices = array(),
&$groupedItems = array(),
$currency = 'EUR'
)
{
$overallPrice = 0;
/** @var PriceCalcilationInterface $item */
foreach ($items as $item) {
$itemPrice = $this->itemPriceCalculator->ca... | php | public function calculate(
$items,
&$groupPrices = array(),
&$groupedItems = array(),
$currency = 'EUR'
)
{
$overallPrice = 0;
/** @var PriceCalcilationInterface $item */
foreach ($items as $item) {
$itemPrice = $this->itemPriceCalculator->ca... | [
"public",
"function",
"calculate",
"(",
"$",
"items",
",",
"&",
"$",
"groupPrices",
"=",
"array",
"(",
")",
",",
"&",
"$",
"groupedItems",
"=",
"array",
"(",
")",
",",
"$",
"currency",
"=",
"'EUR'",
")",
"{",
"$",
"overallPrice",
"=",
"0",
";",
"/*... | {@inheritdoc} | [
"{"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php#L31-L53 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php | GroupedItemsPriceCalculator.setPricesOfChanged | public function setPricesOfChanged($items)
{
$hasChanged = false;
foreach ($items as $item) {
$priceChange = $item->getPriceChange();
if ($priceChange) {
$item->setPrice($priceChange['to']);
$hasChanged = true;
}
}
... | php | public function setPricesOfChanged($items)
{
$hasChanged = false;
foreach ($items as $item) {
$priceChange = $item->getPriceChange();
if ($priceChange) {
$item->setPrice($priceChange['to']);
$hasChanged = true;
}
}
... | [
"public",
"function",
"setPricesOfChanged",
"(",
"$",
"items",
")",
"{",
"$",
"hasChanged",
"=",
"false",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"priceChange",
"=",
"$",
"item",
"->",
"getPriceChange",
"(",
")",
";",
"if",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php#L58-L70 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php | GroupedItemsPriceCalculator.addPriceToPriceGroup | protected function addPriceToPriceGroup($price, $item, &$groupPrices, &$groupedItems)
{
$itemPriceGroup = $item->getCalcPriceGroup();
if ($itemPriceGroup === null) {
$itemPriceGroup = 'undefined';
}
if (!isset($groupPrices[$itemPriceGroup])) {
$groupPrices[$... | php | protected function addPriceToPriceGroup($price, $item, &$groupPrices, &$groupedItems)
{
$itemPriceGroup = $item->getCalcPriceGroup();
if ($itemPriceGroup === null) {
$itemPriceGroup = 'undefined';
}
if (!isset($groupPrices[$itemPriceGroup])) {
$groupPrices[$... | [
"protected",
"function",
"addPriceToPriceGroup",
"(",
"$",
"price",
",",
"$",
"item",
",",
"&",
"$",
"groupPrices",
",",
"&",
"$",
"groupedItems",
")",
"{",
"$",
"itemPriceGroup",
"=",
"$",
"item",
"->",
"getCalcPriceGroup",
"(",
")",
";",
"if",
"(",
"$"... | adds price to a price-group
@param $price
@param $item
@param $groupPrices
@param $groupedItems
@internal param $itemPriceGroup | [
"adds",
"price",
"to",
"a",
"price",
"-",
"group"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/GroupedItemsPriceCalculator.php#L82-L112 |
o2system/filesystem | src/Files/XmlFile.php | XmlFile.readFile | public function readFile($filePath = null, array $options = [])
{
$filePath = empty($filePath)
? $this->filePath
: $filePath;
$result = new ArrayIterator();
if (false !== ($xml = simplexml_load_file($filePath))) {
$contents = json_decode(json_en... | php | public function readFile($filePath = null, array $options = [])
{
$filePath = empty($filePath)
? $this->filePath
: $filePath;
$result = new ArrayIterator();
if (false !== ($xml = simplexml_load_file($filePath))) {
$contents = json_decode(json_en... | [
"public",
"function",
"readFile",
"(",
"$",
"filePath",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"filePath",
"=",
"empty",
"(",
"$",
"filePath",
")",
"?",
"$",
"this",
"->",
"filePath",
":",
"$",
"filePath",
";",
"$"... | XmlFile::readFile
@param string $filePath Path to the file.
@param array $options Read file options.
@return mixed | [
"XmlFile",
"::",
"readFile"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/XmlFile.php#L40-L63 |
o2system/filesystem | src/Files/XmlFile.php | XmlFile.writeFile | public function writeFile($filePath = null, array $options = [])
{
$filePath = empty($filePath)
? $this->filePath
: $filePath;
if ($this->count()) {
$root = '<' . pathinfo($filePath, PATHINFO_FILENAME) . '/>';
$contents = $this->getArrayCopy... | php | public function writeFile($filePath = null, array $options = [])
{
$filePath = empty($filePath)
? $this->filePath
: $filePath;
if ($this->count()) {
$root = '<' . pathinfo($filePath, PATHINFO_FILENAME) . '/>';
$contents = $this->getArrayCopy... | [
"public",
"function",
"writeFile",
"(",
"$",
"filePath",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"filePath",
"=",
"empty",
"(",
"$",
"filePath",
")",
"?",
"$",
"this",
"->",
"filePath",
":",
"$",
"filePath",
";",
"i... | XmlFile::writeFile
@param string $filePath Path to the file.
@param array $options Write file options.
@return bool Returns TRUE on success or FALSE on failure. | [
"XmlFile",
"::",
"writeFile"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/XmlFile.php#L75-L90 |
dragosprotung/stc-core | src/Date/DateTimeZone.php | DateTimeZone.UTCTimeZoneOffset | public function UTCTimeZoneOffset() : int
{
$originDateTime = new \DateTime('now', $this);
$utcTimeZone = new \DateTimeZone('UTC');
$utcDateTime = new \DateTime('now', $utcTimeZone);
return $utcTimeZone->getOffset($utcDateTime) - $this->getOffset($originDateTime);
} | php | public function UTCTimeZoneOffset() : int
{
$originDateTime = new \DateTime('now', $this);
$utcTimeZone = new \DateTimeZone('UTC');
$utcDateTime = new \DateTime('now', $utcTimeZone);
return $utcTimeZone->getOffset($utcDateTime) - $this->getOffset($originDateTime);
} | [
"public",
"function",
"UTCTimeZoneOffset",
"(",
")",
":",
"int",
"{",
"$",
"originDateTime",
"=",
"new",
"\\",
"DateTime",
"(",
"'now'",
",",
"$",
"this",
")",
";",
"$",
"utcTimeZone",
"=",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
";",
"$",
"utc... | Get offset between a time zone and UTC time zone in seconds.
@return integer | [
"Get",
"offset",
"between",
"a",
"time",
"zone",
"and",
"UTC",
"time",
"zone",
"in",
"seconds",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Date/DateTimeZone.php#L17-L25 |
Wonail/wocenter | libs/Constants.php | Constants.getUserStatusList | public static function getUserStatusList()
{
return [
IdentityInterface::STATUS_FORBIDDEN => Yii::t('wocenter/app', 'User disabled status'),
IdentityInterface::STATUS_ACTIVE => Yii::t('wocenter/app', 'User active status'),
IdentityInterface::STATUS_LOCKED => Yii::t('wocen... | php | public static function getUserStatusList()
{
return [
IdentityInterface::STATUS_FORBIDDEN => Yii::t('wocenter/app', 'User disabled status'),
IdentityInterface::STATUS_ACTIVE => Yii::t('wocenter/app', 'User active status'),
IdentityInterface::STATUS_LOCKED => Yii::t('wocen... | [
"public",
"static",
"function",
"getUserStatusList",
"(",
")",
"{",
"return",
"[",
"IdentityInterface",
"::",
"STATUS_FORBIDDEN",
"=>",
"Yii",
"::",
"t",
"(",
"'wocenter/app'",
",",
"'User disabled status'",
")",
",",
"IdentityInterface",
"::",
"STATUS_ACTIVE",
"=>"... | 获取用户状态列表
@return array | [
"获取用户状态列表"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/libs/Constants.php#L163-L171 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.add | public function add($name, $type, $options = array())
{
$field = array(
'name' => $name,
'type' => $type,
'options' => $options
);
if(!isset($field['options']['attr']['id'])) {
if(!isset($field['options']['attr'])) { $field['options']['attr'] ... | php | public function add($name, $type, $options = array())
{
$field = array(
'name' => $name,
'type' => $type,
'options' => $options
);
if(!isset($field['options']['attr']['id'])) {
if(!isset($field['options']['attr'])) { $field['options']['attr'] ... | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"field",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'type'",
"=>",
"$",
"type",
",",
"'options'",
"=>",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L56-L107 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.addBefore | public function addBefore($offset, $name, $type, $options = array())
{
$newField = array(
$name => array(
'name' => $name,
'type' => $type,
'options' => $options
)
);
$this->fields = $this->insertAfterKey($this->fields,... | php | public function addBefore($offset, $name, $type, $options = array())
{
$newField = array(
$name => array(
'name' => $name,
'type' => $type,
'options' => $options
)
);
$this->fields = $this->insertAfterKey($this->fields,... | [
"public",
"function",
"addBefore",
"(",
"$",
"offset",
",",
"$",
"name",
",",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"newField",
"=",
"array",
"(",
"$",
"name",
"=>",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L112-L125 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.addAfter | public function addAfter($offset, $name, $type, $options = array())
{
$newField = array(
$name => array(
'name' => $name,
'type' => $type,
'options' => $options
)
);
$this->fields = $this->insertAfterKey($this->fields, ... | php | public function addAfter($offset, $name, $type, $options = array())
{
$newField = array(
$name => array(
'name' => $name,
'type' => $type,
'options' => $options
)
);
$this->fields = $this->insertAfterKey($this->fields, ... | [
"public",
"function",
"addAfter",
"(",
"$",
"offset",
",",
"$",
"name",
",",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"newField",
"=",
"array",
"(",
"$",
"name",
"=>",
"array",
"(",
"'name'",
"=>",
"$",
"name",
","... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L130-L143 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.replace | public function replace($name, $type, $options = array(), $addIfNotExist = false)
{
if (!isset($this->fields[$name]) && $addIfNotExist === false) {
throw new \Exception("Can't replace field, field '$name' doesn't exist");
}
$this->fields[$name] = array(
'name' => $na... | php | public function replace($name, $type, $options = array(), $addIfNotExist = false)
{
if (!isset($this->fields[$name]) && $addIfNotExist === false) {
throw new \Exception("Can't replace field, field '$name' doesn't exist");
}
$this->fields[$name] = array(
'name' => $na... | [
"public",
"function",
"replace",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"addIfNotExist",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L148-L161 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.remove | public function remove($name)
{
if (strpos($name, '[') !== false) {
$names = $this->explodeFieldNameArray($name);
$first = array_shift($names);
if (!isset($this->fields[$first])) {
return $this;
}
$parent =& $this->recursiveFindP... | php | public function remove($name)
{
if (strpos($name, '[') !== false) {
$names = $this->explodeFieldNameArray($name);
$first = array_shift($names);
if (!isset($this->fields[$first])) {
return $this;
}
$parent =& $this->recursiveFindP... | [
"public",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'['",
")",
"!==",
"false",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"explodeFieldNameArray",
"(",
"$",
"name",
")",
";",
"$",
"first",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L166-L187 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.setFieldOption | public function setFieldOption($field, $option, $value)
{
if (!isset($this->fields[$field])) {
throw new \Exception("Cannot set field option: Field {$field} not found");
}
$this->fields[$field]['options'][$option] = $value;
} | php | public function setFieldOption($field, $option, $value)
{
if (!isset($this->fields[$field])) {
throw new \Exception("Cannot set field option: Field {$field} not found");
}
$this->fields[$field]['options'][$option] = $value;
} | [
"public",
"function",
"setFieldOption",
"(",
"$",
"field",
",",
"$",
"option",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"field",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
... | Override a field option
@param $field
@param $option
@param $value
@return void
@throws \Exception | [
"Override",
"a",
"field",
"option"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L230-L237 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.getDefaultData | public function getDefaultData($fields = null)
{
if (!$fields) {
$fields = $this->fields;
}
$defaultData = array();
foreach ($fields as $field) {
if (isset($field['options']['default'])) {
if ($field['name'] === null) {
$de... | php | public function getDefaultData($fields = null)
{
if (!$fields) {
$fields = $this->fields;
}
$defaultData = array();
foreach ($fields as $field) {
if (isset($field['options']['default'])) {
if ($field['name'] === null) {
$de... | [
"public",
"function",
"getDefaultData",
"(",
"$",
"fields",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"fields",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"fields",
";",
"}",
"$",
"defaultData",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L294-L316 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.insertAfterKey | public function insertAfterKey(array $array, $key, $data = array(), $insertBefore = false)
{
if (($offset = array_search($key, array_keys($array))) === false) { // if the key doesn't exist
$offset = count($array);
}
if ($insertBefore === false) {
$offset = $offset + ... | php | public function insertAfterKey(array $array, $key, $data = array(), $insertBefore = false)
{
if (($offset = array_search($key, array_keys($array))) === false) { // if the key doesn't exist
$offset = count($array);
}
if ($insertBefore === false) {
$offset = $offset + ... | [
"public",
"function",
"insertAfterKey",
"(",
"array",
"$",
"array",
",",
"$",
"key",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"insertBefore",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"$",
"offset",
"=",
"array_search",
"(",
"$",
"key",
",... | {@inheritdoc} | [
"{"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L365-L376 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.explodeFieldNameArray | protected function explodeFieldNameArray($fieldName)
{
$name = str_replace('][', '.', $fieldName);
$name = str_replace(array('[', ']'), '.', $name);
$name = rtrim($name, '.');
return explode('.', $name);
} | php | protected function explodeFieldNameArray($fieldName)
{
$name = str_replace('][', '.', $fieldName);
$name = str_replace(array('[', ']'), '.', $name);
$name = rtrim($name, '.');
return explode('.', $name);
} | [
"protected",
"function",
"explodeFieldNameArray",
"(",
"$",
"fieldName",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"']['",
",",
"'.'",
",",
"$",
"fieldName",
")",
";",
"$",
"name",
"=",
"str_replace",
"(",
"array",
"(",
"'['",
",",
"']'",
")",
",... | @param $fieldName
@return array
Example: $field_name = "example[one][two]"
return array('example', 'one', 'two') | [
"@param",
"$fieldName",
"@return",
"array"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L451-L459 |
andyvenus/form | src/FormBlueprint.php | FormBlueprint.recursiveAddToFields | protected function recursiveAddToFields($exploded, $field, $fieldsArray = null) {
if ($fieldsArray === null) {
$fieldsArray = $this->fields;
}
$fieldName = array_shift($exploded);
if (!empty($exploded)) {
if (!isset($fieldsArray[$fieldName])) {
$... | php | protected function recursiveAddToFields($exploded, $field, $fieldsArray = null) {
if ($fieldsArray === null) {
$fieldsArray = $this->fields;
}
$fieldName = array_shift($exploded);
if (!empty($exploded)) {
if (!isset($fieldsArray[$fieldName])) {
$... | [
"protected",
"function",
"recursiveAddToFields",
"(",
"$",
"exploded",
",",
"$",
"field",
",",
"$",
"fieldsArray",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fieldsArray",
"===",
"null",
")",
"{",
"$",
"fieldsArray",
"=",
"$",
"this",
"->",
"fields",
";",
... | @param array $exploded The exploded (explodeFieldNameArray) field name
@param array $field The new field's data
@param null $fieldsArray
@return array
Recursively adds a field to the fields array.
For example, will add a field "parent[sub_name]" as
$this->fields['parent']['fields']['sub_name'] | [
"@param",
"array",
"$exploded",
"The",
"exploded",
"(",
"explodeFieldNameArray",
")",
"field",
"name",
"@param",
"array",
"$field",
"The",
"new",
"field",
"s",
"data",
"@param",
"null",
"$fieldsArray",
"@return",
"array"
] | train | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormBlueprint.php#L472-L503 |
hamjoint/mustard-auctions | src/lib/Http/Controllers/InventoryController.php | InventoryController.getBidding | public function getBidding()
{
$items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
return $query->where('user_id', Auth::user()->userId);
});
$items = Item::typeAuction()->active()->leftJoin('bids')->where(
'bids.user_id',
Auth::u... | php | public function getBidding()
{
$items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
return $query->where('user_id', Auth::user()->userId);
});
$items = Item::typeAuction()->active()->leftJoin('bids')->where(
'bids.user_id',
Auth::u... | [
"public",
"function",
"getBidding",
"(",
")",
"{",
"$",
"items",
"=",
"Item",
"::",
"typeAuction",
"(",
")",
"->",
"active",
"(",
")",
"->",
"whereHas",
"(",
"'bids'",
",",
"function",
"(",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",
"where... | Return the inventory bidding items view.
@return \Illuminate\View\View | [
"Return",
"the",
"inventory",
"bidding",
"items",
"view",
"."
] | train | https://github.com/hamjoint/mustard-auctions/blob/66c8723d8681466e280263ad100f3fdc5895480d/src/lib/Http/Controllers/InventoryController.php#L37-L58 |
codeburnerframework/router | src/Resource.php | Resource.filterByMethod | private function filterByMethod(array $methods, $alt)
{
$methods = array_flip(array_map('strtolower', $methods));
foreach ($this->routes as $route) {
if (isset($methods[$route->getAction()[1]]) === $alt) {
$route->forget();
}
}
} | php | private function filterByMethod(array $methods, $alt)
{
$methods = array_flip(array_map('strtolower', $methods));
foreach ($this->routes as $route) {
if (isset($methods[$route->getAction()[1]]) === $alt) {
$route->forget();
}
}
} | [
"private",
"function",
"filterByMethod",
"(",
"array",
"$",
"methods",
",",
"$",
"alt",
")",
"{",
"$",
"methods",
"=",
"array_flip",
"(",
"array_map",
"(",
"'strtolower'",
",",
"$",
"methods",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
... | Forget the grouped routes filtering by http methods.
@param string[] $methods
@param bool $alt Should remove? | [
"Forget",
"the",
"grouped",
"routes",
"filtering",
"by",
"http",
"methods",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L66-L75 |
codeburnerframework/router | src/Resource.php | Resource.translate | public function translate(array $translations)
{
foreach ($this->routes as $route) {
$action = $route->getAction()[1];
if ($action === "make" && isset($translations["make"])) {
$route->setPatternWithoutReset(str_replace("make", $translations["make"], $route->getPatte... | php | public function translate(array $translations)
{
foreach ($this->routes as $route) {
$action = $route->getAction()[1];
if ($action === "make" && isset($translations["make"])) {
$route->setPatternWithoutReset(str_replace("make", $translations["make"], $route->getPatte... | [
"public",
"function",
"translate",
"(",
"array",
"$",
"translations",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"action",
"=",
"$",
"route",
"->",
"getAction",
"(",
")",
"[",
"1",
"]",
";",
"if",
"(",... | Translate the "make" or "edit" from resources path.
@param string[] $translations
@return self | [
"Translate",
"the",
"make",
"or",
"edit",
"from",
"resources",
"path",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L84-L97 |
codeburnerframework/router | src/Resource.php | Resource.member | public function member($route)
{
$resource = new self;
$resource->set($route);
$this->nest($resource);
} | php | public function member($route)
{
$resource = new self;
$resource->set($route);
$this->nest($resource);
} | [
"public",
"function",
"member",
"(",
"$",
"route",
")",
"{",
"$",
"resource",
"=",
"new",
"self",
";",
"$",
"resource",
"->",
"set",
"(",
"$",
"route",
")",
";",
"$",
"this",
"->",
"nest",
"(",
"$",
"resource",
")",
";",
"}"
] | Add a route or a group of routes to the resource, it means that
every added route will now receive the parameters of the resource, like id.
@param Route|Group $route
@return self | [
"Add",
"a",
"route",
"or",
"a",
"group",
"of",
"routes",
"to",
"the",
"resource",
"it",
"means",
"that",
"every",
"added",
"route",
"will",
"now",
"receive",
"the",
"parameters",
"of",
"the",
"resource",
"like",
"id",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L107-L112 |
codeburnerframework/router | src/Resource.php | Resource.nest | public function nest(self $resource)
{
foreach ($this->routes as $route) {
if ($route->getAction()[1] === "show") {
$this->set($resource->forget()->setPrefix($this->getNestedPrefix($route->getPattern()))); break;
}
}
return $this;
} | php | public function nest(self $resource)
{
foreach ($this->routes as $route) {
if ($route->getAction()[1] === "show") {
$this->set($resource->forget()->setPrefix($this->getNestedPrefix($route->getPattern()))); break;
}
}
return $this;
} | [
"public",
"function",
"nest",
"(",
"self",
"$",
"resource",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"->",
"getAction",
"(",
")",
"[",
"1",
"]",
"===",
"\"show\"",
")",
"{",
"$"... | Nested routes capture the relation between a resource and another resource.
@param self $resource
@return self | [
"Nested",
"routes",
"capture",
"the",
"relation",
"between",
"a",
"resource",
"and",
"another",
"resource",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L121-L130 |
codeburnerframework/router | src/Resource.php | Resource.shallow | public function shallow(self $resource)
{
$newResource = new self;
$resource->forget();
$routes = $resource->all();
foreach ($routes as $route) {
if (strpos("index make create", $route->getAction()[1]) !== false) {
$newResource->set($route);
}... | php | public function shallow(self $resource)
{
$newResource = new self;
$resource->forget();
$routes = $resource->all();
foreach ($routes as $route) {
if (strpos("index make create", $route->getAction()[1]) !== false) {
$newResource->set($route);
}... | [
"public",
"function",
"shallow",
"(",
"self",
"$",
"resource",
")",
"{",
"$",
"newResource",
"=",
"new",
"self",
";",
"$",
"resource",
"->",
"forget",
"(",
")",
";",
"$",
"routes",
"=",
"$",
"resource",
"->",
"all",
"(",
")",
";",
"foreach",
"(",
"... | Nest resources but with only build routes with the minimal amount of information
to uniquely identify the resource.
@param self $resource
@return self | [
"Nest",
"resources",
"but",
"with",
"only",
"build",
"routes",
"with",
"the",
"minimal",
"amount",
"of",
"information",
"to",
"uniquely",
"identify",
"the",
"resource",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L140-L153 |
codeburnerframework/router | src/Resource.php | Resource.getNestedPrefix | protected function getNestedPrefix($pattern)
{
$segments = explode("/", $pattern);
$pattern = "";
foreach ($segments as $index => $segment) {
if (strpos($segment, "{") === 0) {
$pattern .= "/{" . $segments[$index - 1] . "_" . ltrim($segment, "{");
... | php | protected function getNestedPrefix($pattern)
{
$segments = explode("/", $pattern);
$pattern = "";
foreach ($segments as $index => $segment) {
if (strpos($segment, "{") === 0) {
$pattern .= "/{" . $segments[$index - 1] . "_" . ltrim($segment, "{");
... | [
"protected",
"function",
"getNestedPrefix",
"(",
"$",
"pattern",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"\"/\"",
",",
"$",
"pattern",
")",
";",
"$",
"pattern",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"index",
"=>",
"$",
... | Resolve the nesting pattern, setting the prefixes based on
parent resources patterns.
@param string $pattern
@return string | [
"Resolve",
"the",
"nesting",
"pattern",
"setting",
"the",
"prefixes",
"based",
"on",
"parent",
"resources",
"patterns",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Resource.php#L163-L175 |
stubbles/stubbles-webapp-core | src/main/php/request/UserAgent.php | UserAgent.isBot | public function isBot(): bool
{
if (null === $this->isBot) {
$this->isBot = false;
foreach ($this->botSignatures as $botSignature) {
if (preg_match($botSignature, $this->name) === 1) {
$this->isBot = true;
break;
... | php | public function isBot(): bool
{
if (null === $this->isBot) {
$this->isBot = false;
foreach ($this->botSignatures as $botSignature) {
if (preg_match($botSignature, $this->name) === 1) {
$this->isBot = true;
break;
... | [
"public",
"function",
"isBot",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"isBot",
")",
"{",
"$",
"this",
"->",
"isBot",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"botSignatures",
"as",
"$",
"botSignature",
... | returns whether user agent is a bot or not
@XmlAttribute(attributeName='isBot')
@api
@return bool | [
"returns",
"whether",
"user",
"agent",
"is",
"a",
"bot",
"or",
"not"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/UserAgent.php#L86-L100 |
nicoSWD/put.io-api-v2 | src/PutIO/Helpers/PutIO/PutIOHelper.php | PutIOHelper.get | protected function get(
$path,
array $params = [],
$returnBool = \false,
$arrayKey = ''
) {
return $this->request('GET', $path, $params, '', $returnBool, $arrayKey);
} | php | protected function get(
$path,
array $params = [],
$returnBool = \false,
$arrayKey = ''
) {
return $this->request('GET', $path, $params, '', $returnBool, $arrayKey);
} | [
"protected",
"function",
"get",
"(",
"$",
"path",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"returnBool",
"=",
"\\",
"false",
",",
"$",
"arrayKey",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"'GET'",
",",
"$",
"... | Sends a GET HTTP request.
@param string $path Path of the API class.
@param array $params GET variables to be sent.
@param bool $returnBool Will return boolean if true.
@param string $arrayKey Will return all data on a specific array key
of the response.
@return mixed | [
"Sends",
"a",
"GET",
"HTTP",
"request",
"."
] | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/PutIO/PutIOHelper.php#L55-L62 |
nicoSWD/put.io-api-v2 | src/PutIO/Helpers/PutIO/PutIOHelper.php | PutIOHelper.post | protected function post(
$path,
array $params = [],
$returnBool = \false,
$arrayKey = ''
) {
return $this->request('POST', $path, $params, '', $returnBool, $arrayKey);
} | php | protected function post(
$path,
array $params = [],
$returnBool = \false,
$arrayKey = ''
) {
return $this->request('POST', $path, $params, '', $returnBool, $arrayKey);
} | [
"protected",
"function",
"post",
"(",
"$",
"path",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"returnBool",
"=",
"\\",
"false",
",",
"$",
"arrayKey",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"'POST'",
",",
"$",
... | Sends a POST HTTP request.
@param string $path Path of the API class.
@param array $params POST variables to be sent.
@param bool $returnBool Will return boolean if true.
@param string $arrayKey Will return all data on a specific array key
of the response.
@return mixed | [
"Sends",
"a",
"POST",
"HTTP",
"request",
"."
] | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/PutIO/PutIOHelper.php#L74-L81 |
nicoSWD/put.io-api-v2 | src/PutIO/Helpers/PutIO/PutIOHelper.php | PutIOHelper.request | protected function request(
$method,
$path,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = ''
) {
if ($token = $this->putio->getOAuthToken()) {
$params['oauth_token'] = $token;
}
$engine = $this->putio->getHTT... | php | protected function request(
$method,
$path,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = ''
) {
if ($token = $this->putio->getOAuthToken()) {
$params['oauth_token'] = $token;
}
$engine = $this->putio->getHTT... | [
"protected",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"path",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"outFile",
"=",
"''",
",",
"$",
"returnBool",
"=",
"\\",
"false",
",",
"$",
"arrayKey",
"=",
"''",
")",
"{",
"if",
"("... | Makes an HTTP request to put.io's API and returns the response.
@param string $method HTTP request method. Only POST and GET.
@param string $path Remote path to API module.
@param array $params Variables to be sent.
@param string $outFile If $outFile is set, the response will be written
to this file inst... | [
"Makes",
"an",
"HTTP",
"request",
"to",
"put",
".",
"io",
"s",
"API",
"and",
"returns",
"the",
"response",
"."
] | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Helpers/PutIO/PutIOHelper.php#L129-L153 |
pageon/SlackWebhookMonolog | src/Monolog/Config.php | Config.setLevel | private function setLevel($level)
{
$availableLevels = array_flip(Logger::getLevels());
if (!isset($availableLevels[$level])) {
throw new InvalidLoggerLevelException(
sprintf(
'The level: "%d" does not exist. The available levels are: "%s"',
... | php | private function setLevel($level)
{
$availableLevels = array_flip(Logger::getLevels());
if (!isset($availableLevels[$level])) {
throw new InvalidLoggerLevelException(
sprintf(
'The level: "%d" does not exist. The available levels are: "%s"',
... | [
"private",
"function",
"setLevel",
"(",
"$",
"level",
")",
"{",
"$",
"availableLevels",
"=",
"array_flip",
"(",
"Logger",
"::",
"getLevels",
"(",
")",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"availableLevels",
"[",
"$",
"level",
"]",
")",
")",
"... | @param int $level
@return self | [
"@param",
"int",
"$level"
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Monolog/Config.php#L43-L60 |
readdle/fqdb | src/Readdle/Database/FQDBWriteAPI.php | FQDBWriteAPI.doDeleteOrUpdate | private function doDeleteOrUpdate($query, $params, $sqlPrefix, $handler)
{
$this->_testQueryStarts($query, $sqlPrefix);
if ($handler !== null)
call_user_func_array($handler, [$query, $params]);
$statement = $this->_executeQuery($query, $params);
return $statement->rowCo... | php | private function doDeleteOrUpdate($query, $params, $sqlPrefix, $handler)
{
$this->_testQueryStarts($query, $sqlPrefix);
if ($handler !== null)
call_user_func_array($handler, [$query, $params]);
$statement = $this->_executeQuery($query, $params);
return $statement->rowCo... | [
"private",
"function",
"doDeleteOrUpdate",
"(",
"$",
"query",
",",
"$",
"params",
",",
"$",
"sqlPrefix",
",",
"$",
"handler",
")",
"{",
"$",
"this",
"->",
"_testQueryStarts",
"(",
"$",
"query",
",",
"$",
"sqlPrefix",
")",
";",
"if",
"(",
"$",
"handler"... | code for delete / update
@param string $query
@param array $params
@param string $sqlPrefix
@param callable|null $handler
@return int affected rows count | [
"code",
"for",
"delete",
"/",
"update"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBWriteAPI.php#L20-L29 |
readdle/fqdb | src/Readdle/Database/FQDBWriteAPI.php | FQDBWriteAPI.insert | public function insert($query, $params = array())
{
$this->_testQueryStarts($query, 'insert');
return $this->_executeQuery($query, $params, true);
} | php | public function insert($query, $params = array())
{
$this->_testQueryStarts($query, 'insert');
return $this->_executeQuery($query, $params, true);
} | [
"public",
"function",
"insert",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_testQueryStarts",
"(",
"$",
"query",
",",
"'insert'",
")",
";",
"return",
"$",
"this",
"->",
"_executeQuery",
"(",
"$",
"que... | executes INSERT query with placeholders in 2nd param
@param string $query
@param array $params
@return string last inserted id | [
"executes",
"INSERT",
"query",
"with",
"placeholders",
"in",
"2nd",
"param"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBWriteAPI.php#L60-L64 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendTextMsg | public function sendTextMsg($content, array $atMobiles = [], $isAtAll = false)
{
$query = [
'msgtype' => 'text',
'text' => [
'content' => $content,
],
'at' => [
'isAtAll' => $isAtAll
],
];
if (is_arra... | php | public function sendTextMsg($content, array $atMobiles = [], $isAtAll = false)
{
$query = [
'msgtype' => 'text',
'text' => [
'content' => $content,
],
'at' => [
'isAtAll' => $isAtAll
],
];
if (is_arra... | [
"public",
"function",
"sendTextMsg",
"(",
"$",
"content",
",",
"array",
"$",
"atMobiles",
"=",
"[",
"]",
",",
"$",
"isAtAll",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"[",
"'msgtype'",
"=>",
"'text'",
",",
"'text'",
"=>",
"[",
"'content'",
"=>",
"$... | 发送文本消息
@param string $content
@param array $atMobiles
@param bool $isAtAll
@return mixed | [
"发送文本消息"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L73-L88 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendLinkMsg | public function sendLinkMsg($title, $text, $picUrl = '', $messageUrl)
{
$query = [
'msgtype' => 'link',
'link' => [
'title' => $title,
'text' => $text,
'picUrl' => $picUrl,
'messageUrl' => $messageUrl
],
... | php | public function sendLinkMsg($title, $text, $picUrl = '', $messageUrl)
{
$query = [
'msgtype' => 'link',
'link' => [
'title' => $title,
'text' => $text,
'picUrl' => $picUrl,
'messageUrl' => $messageUrl
],
... | [
"public",
"function",
"sendLinkMsg",
"(",
"$",
"title",
",",
"$",
"text",
",",
"$",
"picUrl",
"=",
"''",
",",
"$",
"messageUrl",
")",
"{",
"$",
"query",
"=",
"[",
"'msgtype'",
"=>",
"'link'",
",",
"'link'",
"=>",
"[",
"'title'",
"=>",
"$",
"title",
... | 发送链接
@param string $title
@param string $text
@param string $picUrl
@param string $messageUrl
@return mixed | [
"发送链接"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L98-L110 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendMarkdownMsg | public function sendMarkdownMsg($title, $content, array $atMobiles = [], $isAtAll = false)
{
$query = [
'msgtype' => 'markdown',
'markdown' => [
'title' => $title,
'text' => $content,
],
'at' => [
'isAtAll' => $i... | php | public function sendMarkdownMsg($title, $content, array $atMobiles = [], $isAtAll = false)
{
$query = [
'msgtype' => 'markdown',
'markdown' => [
'title' => $title,
'text' => $content,
],
'at' => [
'isAtAll' => $i... | [
"public",
"function",
"sendMarkdownMsg",
"(",
"$",
"title",
",",
"$",
"content",
",",
"array",
"$",
"atMobiles",
"=",
"[",
"]",
",",
"$",
"isAtAll",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"[",
"'msgtype'",
"=>",
"'markdown'",
",",
"'markdown'",
"=>... | 发送MarkDown 消息
@param string $title
@param string $content
@param array $atMobiles
@param bool $isAtAll
@return mixed | [
"发送MarkDown",
"消息"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L120-L136 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendActionCardMsg | public function sendActionCardMsg($title, $content, $singleURL, $hideAvatar = 0, $btnOrientation = 0, $singleTitle = '阅读原文')
{
$query = [
'msgtype' => 'actionCard',
'actionCard' => [
'title' => $title,
'text' => $content,
'hideAvatar' =... | php | public function sendActionCardMsg($title, $content, $singleURL, $hideAvatar = 0, $btnOrientation = 0, $singleTitle = '阅读原文')
{
$query = [
'msgtype' => 'actionCard',
'actionCard' => [
'title' => $title,
'text' => $content,
'hideAvatar' =... | [
"public",
"function",
"sendActionCardMsg",
"(",
"$",
"title",
",",
"$",
"content",
",",
"$",
"singleURL",
",",
"$",
"hideAvatar",
"=",
"0",
",",
"$",
"btnOrientation",
"=",
"0",
",",
"$",
"singleTitle",
"=",
"'阅读原文')",
"",
"{",
"$",
"query",
"=",
"[",
... | 整体跳转ActionCard类型
@param $title
@param $content
@param $singleURL
@param int $hideAvatar
@param int $btnOrientation
@param string $singleTitle
@return mixed | [
"整体跳转ActionCard类型"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L148-L162 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendSingleActionCardMsg | public function sendSingleActionCardMsg($title, $content, $hideAvatar = 0, $btnOrientation = 0, array $btns=[])
{
$query = [
'msgtype' => 'actionCard',
'actionCard' => [
'title' => $title,
'text' => $content,
'hideAvatar' => $hideAvatar... | php | public function sendSingleActionCardMsg($title, $content, $hideAvatar = 0, $btnOrientation = 0, array $btns=[])
{
$query = [
'msgtype' => 'actionCard',
'actionCard' => [
'title' => $title,
'text' => $content,
'hideAvatar' => $hideAvatar... | [
"public",
"function",
"sendSingleActionCardMsg",
"(",
"$",
"title",
",",
"$",
"content",
",",
"$",
"hideAvatar",
"=",
"0",
",",
"$",
"btnOrientation",
"=",
"0",
",",
"array",
"$",
"btns",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"[",
"'msgtype'",
... | 独立跳转ActionCard类型
@param $title
@param $content
@param int $hideAvatar
@param int $btnOrientation
@param array $btns
@return mixed | [
"独立跳转ActionCard类型"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L173-L186 |
saviorlv/yii2-dingtalk | src/Robot.php | Robot.sendFeedCardMsg | public function sendFeedCardMsg(array $links=[])
{
if(!\is_array($links)){
throw new InvalidValueException('this data must be array');
}
if(count($links) == count($links, 1)){
throw new InvalidValueException('this data must be dyadic array');
}
$query ... | php | public function sendFeedCardMsg(array $links=[])
{
if(!\is_array($links)){
throw new InvalidValueException('this data must be array');
}
if(count($links) == count($links, 1)){
throw new InvalidValueException('this data must be dyadic array');
}
$query ... | [
"public",
"function",
"sendFeedCardMsg",
"(",
"array",
"$",
"links",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"links",
")",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"'this data must be array'",
")",
";",
"}",
"i... | FeedCard类型
@param array $links
@return mixed | [
"FeedCard类型"
] | train | https://github.com/saviorlv/yii2-dingtalk/blob/5e4cfec7244d623c045f9c84aa89db3f4262babd/src/Robot.php#L193-L208 |
movoin/one-swoole | src/FileSystem/Provider.php | Provider.register | public function register()
{
if (($config = $this->config('filesystem')) === null) {
throw new RuntimeException('The FileSystem is undefined');
}
$this->bind('fs', function ($server) use ($config) {
$fss = [];
foreach ($config as $prefix => $setting) {
... | php | public function register()
{
if (($config = $this->config('filesystem')) === null) {
throw new RuntimeException('The FileSystem is undefined');
}
$this->bind('fs', function ($server) use ($config) {
$fss = [];
foreach ($config as $prefix => $setting) {
... | [
"public",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
"'filesystem'",
")",
")",
"===",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'The FileSystem is undefined'",
")",
";",
... | 注册服务 | [
"注册服务"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Provider.php#L25-L42 |
movoin/one-swoole | src/FileSystem/Provider.php | Provider.createFileSystem | protected function createFileSystem(array $config): FileSystem
{
if (! isset($config['adapter'])) {
throw new RuntimeException('Filesystem adapter is undefined');
}
$adapters = [
'local' => 'Local',
'aliyun' => 'Aliyun',
];
if (! isset($a... | php | protected function createFileSystem(array $config): FileSystem
{
if (! isset($config['adapter'])) {
throw new RuntimeException('Filesystem adapter is undefined');
}
$adapters = [
'local' => 'Local',
'aliyun' => 'Aliyun',
];
if (! isset($a... | [
"protected",
"function",
"createFileSystem",
"(",
"array",
"$",
"config",
")",
":",
"FileSystem",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'adapter'",
"]",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Filesystem adapter is undefined... | 创建文件系统
@param array $config
@return \One\FileSystem\FileSystem
@throws \RuntimeException | [
"创建文件系统"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Provider.php#L52-L76 |
movoin/one-swoole | src/FileSystem/Provider.php | Provider.createAdapter | protected function createAdapter(string $adapter, array $config): Adapter
{
if ($adapter === 'Local') {
if (! isset($config['config']['path'])) {
throw new RuntimeException('Filesystem local adapter must set `path`');
}
$config = [$config['config']['path'... | php | protected function createAdapter(string $adapter, array $config): Adapter
{
if ($adapter === 'Local') {
if (! isset($config['config']['path'])) {
throw new RuntimeException('Filesystem local adapter must set `path`');
}
$config = [$config['config']['path'... | [
"protected",
"function",
"createAdapter",
"(",
"string",
"$",
"adapter",
",",
"array",
"$",
"config",
")",
":",
"Adapter",
"{",
"if",
"(",
"$",
"adapter",
"===",
"'Local'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'config'",
"]",
... | 创建适配器
@param string $adapter
@param array $config
@return \One\FileSystem\Contracts\Adapter
@throws \RuntimeException | [
"创建适配器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Provider.php#L87-L101 |
faustbrian/Laravel-Countries | src/CountriesServiceProvider.php | CountriesServiceProvider.boot | public function boot()
{
$this->publishes([
__DIR__.'/../database/migrations' => database_path('migrations'),
], 'migrations');
$this->publishes([
__DIR__.'/../config/laravel-countries.php' => config_path('laravel-countries.php'),
], 'config');
$this... | php | public function boot()
{
$this->publishes([
__DIR__.'/../database/migrations' => database_path('migrations'),
], 'migrations');
$this->publishes([
__DIR__.'/../config/laravel-countries.php' => config_path('laravel-countries.php'),
], 'config');
$this... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/../database/migrations'",
"=>",
"database_path",
"(",
"'migrations'",
")",
",",
"]",
",",
"'migrations'",
")",
";",
"$",
"this",
"->",
"publishes",
"(... | Bootstrap the application services. | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/CountriesServiceProvider.php#L23-L34 |
faustbrian/Laravel-Countries | src/CountriesServiceProvider.php | CountriesServiceProvider.registerCommands | private function registerCommands()
{
$this->commands([
Console\Commands\SeedCountries::class,
Console\Commands\SeedCurrencies::class,
Console\Commands\SeedTimezones::class,
Console\Commands\SeedTaxRates::class,
]);
} | php | private function registerCommands()
{
$this->commands([
Console\Commands\SeedCountries::class,
Console\Commands\SeedCurrencies::class,
Console\Commands\SeedTimezones::class,
Console\Commands\SeedTaxRates::class,
]);
} | [
"private",
"function",
"registerCommands",
"(",
")",
"{",
"$",
"this",
"->",
"commands",
"(",
"[",
"Console",
"\\",
"Commands",
"\\",
"SeedCountries",
"::",
"class",
",",
"Console",
"\\",
"Commands",
"\\",
"SeedCurrencies",
"::",
"class",
",",
"Console",
"\\... | Register the console commands. | [
"Register",
"the",
"console",
"commands",
"."
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/CountriesServiceProvider.php#L57-L65 |
aboutcoders/enum-serializer-bundle | DependencyInjection/Compiler/RegisterTypesPass.php | RegisterTypesPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->registry) && !$container->hasAlias($this->registry)) {
return;
}
// $registry = $container->findDefinition($this->registry);
foreach ($container->findTaggedServiceIds($this->tag... | php | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->registry) && !$container->hasAlias($this->registry)) {
return;
}
// $registry = $container->findDefinition($this->registry);
foreach ($container->findTaggedServiceIds($this->tag... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"$",
"this",
"->",
"registry",
")",
"&&",
"!",
"$",
"container",
"->",
"hasAlias",
"(",
"$",
"this",
"->",... | {@inheritdoc} | [
"{"
] | train | https://github.com/aboutcoders/enum-serializer-bundle/blob/e8a48e8d6d52b2f8fc896e9789fbb9fbbc38164f/DependencyInjection/Compiler/RegisterTypesPass.php#L48-L64 |
rozdol/bi | src/Bi/Db.php | Db.SetObjData | private function SetObjData($_table, $_fields, $_data)
{
$this->table = $_table;
$this->fields = $_fields;
$this->data[] = array();
if (isset($_data[0]) and is_array($_data[0])) {
for ($i=0; $i<count($_data); $i++) {
foreach ($this->fields as $field) {
... | php | private function SetObjData($_table, $_fields, $_data)
{
$this->table = $_table;
$this->fields = $_fields;
$this->data[] = array();
if (isset($_data[0]) and is_array($_data[0])) {
for ($i=0; $i<count($_data); $i++) {
foreach ($this->fields as $field) {
... | [
"private",
"function",
"SetObjData",
"(",
"$",
"_table",
",",
"$",
"_fields",
",",
"$",
"_data",
")",
"{",
"$",
"this",
"->",
"table",
"=",
"$",
"_table",
";",
"$",
"this",
"->",
"fields",
"=",
"$",
"_fields",
";",
"$",
"this",
"->",
"data",
"[",
... | sets data to be inserted or updated - cleans unwanted chars
@param array $_table
@param array $_fields
@param array $_data | [
"sets",
"data",
"to",
"be",
"inserted",
"or",
"updated",
"-",
"cleans",
"unwanted",
"chars"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L96-L117 |
rozdol/bi | src/Bi/Db.php | Db.IsFieldLocked | private function IsFieldLocked($field)
{
if (!is_array($this->locked_fields)) {
return false;
}
$locked_tables = array_keys($this->locked_fields);
$locked_fields = array_values($this->locked_fields);
$_locked_fields = array();
foreach ($locked_fields as $... | php | private function IsFieldLocked($field)
{
if (!is_array($this->locked_fields)) {
return false;
}
$locked_tables = array_keys($this->locked_fields);
$locked_fields = array_values($this->locked_fields);
$_locked_fields = array();
foreach ($locked_fields as $... | [
"private",
"function",
"IsFieldLocked",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"locked_fields",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"locked_tables",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"lock... | finds locked fields
@param string $field
@return bool | [
"finds",
"locked",
"fields"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L125-L149 |
rozdol/bi | src/Bi/Db.php | Db.FetchFields | private function FetchFields($res)
{
if (!$this->debug_on) {
return ;
}
$i=0;
$this->col_info = array();
while ($i < @pg_num_fields($res)) {
$this->col_info[$i]->name = @pg_field_name($res, $i);
$this->col_info[$i]->size = @pg_field_size($r... | php | private function FetchFields($res)
{
if (!$this->debug_on) {
return ;
}
$i=0;
$this->col_info = array();
while ($i < @pg_num_fields($res)) {
$this->col_info[$i]->name = @pg_field_name($res, $i);
$this->col_info[$i]->size = @pg_field_size($r... | [
"private",
"function",
"FetchFields",
"(",
"$",
"res",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"debug_on",
")",
"{",
"return",
";",
"}",
"$",
"i",
"=",
"0",
";",
"$",
"this",
"->",
"col_info",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$"... | fetches table fields
@param object $res | [
"fetches",
"table",
"fields"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L167-L180 |
rozdol/bi | src/Bi/Db.php | Db.Fetch | private function Fetch($res, $row_no = null, $offset = null)
{
if (is_numeric($row_no)) {
$limit = 1;
} else {
$limit = $this->GetNumRows();
}
if (is_numeric($offset)) {
$c_output = PGSQL_NUM;
} else {
$c_output = PGSQL_ASSOC;
... | php | private function Fetch($res, $row_no = null, $offset = null)
{
if (is_numeric($row_no)) {
$limit = 1;
} else {
$limit = $this->GetNumRows();
}
if (is_numeric($offset)) {
$c_output = PGSQL_NUM;
} else {
$c_output = PGSQL_ASSOC;
... | [
"private",
"function",
"Fetch",
"(",
"$",
"res",
",",
"$",
"row_no",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"row_no",
")",
")",
"{",
"$",
"limit",
"=",
"1",
";",
"}",
"else",
"{",
"$",
"limit"... | fetches result into array. also gets info about fields
@param object $res
@return array | [
"fetches",
"result",
"into",
"array",
".",
"also",
"gets",
"info",
"about",
"fields"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L188-L212 |
rozdol/bi | src/Bi/Db.php | Db.SetErrCode | private function SetErrCode()
{
$connection_status = @pg_connection_status($this->conn);
$last_error = @pg_last_error($this->conn);
$result_error = @pg_result_error($this->conn);
$last_notice = @pg_last_notice($this->conn);
$_errors = array();
if ($connection_status... | php | private function SetErrCode()
{
$connection_status = @pg_connection_status($this->conn);
$last_error = @pg_last_error($this->conn);
$result_error = @pg_result_error($this->conn);
$last_notice = @pg_last_notice($this->conn);
$_errors = array();
if ($connection_status... | [
"private",
"function",
"SetErrCode",
"(",
")",
"{",
"$",
"connection_status",
"=",
"@",
"pg_connection_status",
"(",
"$",
"this",
"->",
"conn",
")",
";",
"$",
"last_error",
"=",
"@",
"pg_last_error",
"(",
"$",
"this",
"->",
"conn",
")",
";",
"$",
"result... | sets error code returned by pgsql | [
"sets",
"error",
"code",
"returned",
"by",
"pgsql"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L227-L264 |
rozdol/bi | src/Bi/Db.php | Db.SetDebugDump | private function SetDebugDump($offset = null)
{
if (!$this->query_result or !$this->debug_on) {
return;
}
$report = '<b>DATA:</b><br />
<table border="0" cellpadding="5" cellspacing="1" style="background-color:#555555">
<tr style="background-color:#eeeeee"><td no... | php | private function SetDebugDump($offset = null)
{
if (!$this->query_result or !$this->debug_on) {
return;
}
$report = '<b>DATA:</b><br />
<table border="0" cellpadding="5" cellspacing="1" style="background-color:#555555">
<tr style="background-color:#eeeeee"><td no... | [
"private",
"function",
"SetDebugDump",
"(",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"query_result",
"or",
"!",
"$",
"this",
"->",
"debug_on",
")",
"{",
"return",
";",
"}",
"$",
"report",
"=",
"'<b>DATA:</b><br />\n ... | Data dump from select query | [
"Data",
"dump",
"from",
"select",
"query"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L270-L315 |
rozdol/bi | src/Bi/Db.php | Db.SetQuerySummary | private function SetQuerySummary()
{
if (!$this->query_result or !$this->debug_on) {
return;
}
$this->printOutStr .= "<div class=\"alert alert-info\"><b>Query:</b> " .nl2br($this->last_query) . "<br />
<b>Rows affected:</b> " .$this->GetAffRows() . "<br />
<b>Num... | php | private function SetQuerySummary()
{
if (!$this->query_result or !$this->debug_on) {
return;
}
$this->printOutStr .= "<div class=\"alert alert-info\"><b>Query:</b> " .nl2br($this->last_query) . "<br />
<b>Rows affected:</b> " .$this->GetAffRows() . "<br />
<b>Num... | [
"private",
"function",
"SetQuerySummary",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"query_result",
"or",
"!",
"$",
"this",
"->",
"debug_on",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"printOutStr",
".=",
"\"<div class=\\\"alert alert-info\\\"... | gathers some info about executed query | [
"gathers",
"some",
"info",
"about",
"executed",
"query"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L321-L331 |
rozdol/bi | src/Bi/Db.php | Db.Query | final function Query($qry)
{
$GLOBALS['qry_count']++;
$GLOBALS['qry'].=$GLOBALS['qry_count'].':'.$qry."\n";
$this->last_query = $qry;
$this->query_result = $this->ExecQuery($qry);
if ($this->query_result) {
$this->SetQuerySummary();
return $this->qu... | php | final function Query($qry)
{
$GLOBALS['qry_count']++;
$GLOBALS['qry'].=$GLOBALS['qry_count'].':'.$qry."\n";
$this->last_query = $qry;
$this->query_result = $this->ExecQuery($qry);
if ($this->query_result) {
$this->SetQuerySummary();
return $this->qu... | [
"final",
"function",
"Query",
"(",
"$",
"qry",
")",
"{",
"$",
"GLOBALS",
"[",
"'qry_count'",
"]",
"++",
";",
"$",
"GLOBALS",
"[",
"'qry'",
"]",
".=",
"$",
"GLOBALS",
"[",
"'qry_count'",
"]",
".",
"':'",
".",
"$",
"qry",
".",
"\"\\n\"",
";",
"$",
... | runs query - wrapper for ExecQuery
@param string $qry
@return int | [
"runs",
"query",
"-",
"wrapper",
"for",
"ExecQuery"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L396-L416 |
rozdol/bi | src/Bi/Db.php | Db.GetLastID | final function GetLastID($offset = 0, $seq_suffix = 'seq')
{
$regs = array();
preg_match("/insert\\s*into\\s*\"?(\\w*)\"?/i", $this->last_query, $regs);
if (count($regs) > 1) {
$table_name = $regs[1];
$res = @pg_query($this->conn, "SELECT * FROM $table_name WHERE 1 !... | php | final function GetLastID($offset = 0, $seq_suffix = 'seq')
{
$regs = array();
preg_match("/insert\\s*into\\s*\"?(\\w*)\"?/i", $this->last_query, $regs);
if (count($regs) > 1) {
$table_name = $regs[1];
$res = @pg_query($this->conn, "SELECT * FROM $table_name WHERE 1 !... | [
"final",
"function",
"GetLastID",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"seq_suffix",
"=",
"'seq'",
")",
"{",
"$",
"regs",
"=",
"array",
"(",
")",
";",
"preg_match",
"(",
"\"/insert\\\\s*into\\\\s*\\\"?(\\\\w*)\\\"?/i\"",
",",
"$",
"this",
"->",
"last_quer... | gets last inserted id
@return int | [
"gets",
"last",
"inserted",
"id"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L442-L457 |
rozdol/bi | src/Bi/Db.php | Db.GetResults | final function GetResults($qry)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result);
$this->SetDebugDump();
return $this->result;
}
return array();
} | php | final function GetResults($qry)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result);
$this->SetDebugDump();
return $this->result;
}
return array();
} | [
"final",
"function",
"GetResults",
"(",
"$",
"qry",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lock_sel_data",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"Query",
"(",
"$",
"qry",
")",
")",
"{",
"$",
"this",
"-... | gets results from select query
@param string $qry
@return array | [
"gets",
"results",
"from",
"select",
"query"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L465-L477 |
rozdol/bi | src/Bi/Db.php | Db.GetCol | final function GetCol($qry, $offset = 0)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result, null, $offset);
$this->SetDebugDump($offset);
return $this->result[0];
... | php | final function GetCol($qry, $offset = 0)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result, null, $offset);
$this->SetDebugDump($offset);
return $this->result[0];
... | [
"final",
"function",
"GetCol",
"(",
"$",
"qry",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lock_sel_data",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"Query",
"(",
"$",
"qry",
")",... | gets one col from a table
@param string $qry
@param int $offset
@return array | [
"gets",
"one",
"col",
"from",
"a",
"table"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L508-L520 |
rozdol/bi | src/Bi/Db.php | Db.GetVar | final function GetVar($qry, $row_no = 0, $offset = 0)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result, $row_no, $offset);
$this->SetDebugDump($offset);
return $this->re... | php | final function GetVar($qry, $row_no = 0, $offset = 0)
{
if ($this->lock_sel_data) {
return array();
}
if ($this->Query($qry)) {
$this->result = $this->Fetch($this->query_result, $row_no, $offset);
$this->SetDebugDump($offset);
return $this->re... | [
"final",
"function",
"GetVar",
"(",
"$",
"qry",
",",
"$",
"row_no",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lock_sel_data",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
... | gets one var from a table
@param string $qry
@param int $row_no
@param int $offset
@return string - the var | [
"gets",
"one",
"var",
"from",
"a",
"table"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L530-L542 |
rozdol/bi | src/Bi/Db.php | Db.InsertObject | function InsertObject($table, $fields, $data)
{
if ($this->lock_mod_data) {
return 0;
}
$this->SetObjData($table, $fields, $data);
$query = '';
for ($i=0; $i<count($this->data); $i++) {
if (!is_array($this->data[$i])) {
continue;
... | php | function InsertObject($table, $fields, $data)
{
if ($this->lock_mod_data) {
return 0;
}
$this->SetObjData($table, $fields, $data);
$query = '';
for ($i=0; $i<count($this->data); $i++) {
if (!is_array($this->data[$i])) {
continue;
... | [
"function",
"InsertObject",
"(",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lock_mod_data",
")",
"{",
"return",
"0",
";",
"}",
"$",
"this",
"->",
"SetObjData",
"(",
"$",
"table",
",",
"$",
"fields",... | inserts rows
@return int | [
"inserts",
"rows"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L566-L596 |
rozdol/bi | src/Bi/Db.php | Db.UpdateObject | function UpdateObject($where_part, $table, $fields, $data)
{
if (!$where_part or $this->lock_mod_data) {
return 0;
}
$this->SetObjData($table, $fields, $data);
$query = '';
$set_part = array();
$update_objects = $this->data[0];
foreach ($update_... | php | function UpdateObject($where_part, $table, $fields, $data)
{
if (!$where_part or $this->lock_mod_data) {
return 0;
}
$this->SetObjData($table, $fields, $data);
$query = '';
$set_part = array();
$update_objects = $this->data[0];
foreach ($update_... | [
"function",
"UpdateObject",
"(",
"$",
"where_part",
",",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"where_part",
"or",
"$",
"this",
"->",
"lock_mod_data",
")",
"{",
"return",
"0",
";",
"}",
"$",
"this",
"->"... | updates row
@param string $where_part
@return int | [
"updates",
"row"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L604-L633 |
rozdol/bi | src/Bi/Db.php | Db.DeleteObject | function DeleteObject($where_part, $table)
{
if (!$where_part or !$table or $this->lock_mod_data) {
return 0;
}
$query = "DELETE FROM $table WHERE ".$where_part;
return $this->Query($query);
} | php | function DeleteObject($where_part, $table)
{
if (!$where_part or !$table or $this->lock_mod_data) {
return 0;
}
$query = "DELETE FROM $table WHERE ".$where_part;
return $this->Query($query);
} | [
"function",
"DeleteObject",
"(",
"$",
"where_part",
",",
"$",
"table",
")",
"{",
"if",
"(",
"!",
"$",
"where_part",
"or",
"!",
"$",
"table",
"or",
"$",
"this",
"->",
"lock_mod_data",
")",
"{",
"return",
"0",
";",
"}",
"$",
"query",
"=",
"\"DELETE FRO... | deletes rows
@param string $where_part
@return int | [
"deletes",
"rows"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L641-L650 |
rozdol/bi | src/Bi/Db.php | Db.JoinNotEmpty | function JoinNotEmpty($separator, $array)
{
if (!is_array($array)) {
return '';
}
$rv = trim(array_shift($array));
foreach ($array as $item) {
$item = $this->Escape(trim($item));
if ($rv != '' and $item != '') {
$rv .= $separator;... | php | function JoinNotEmpty($separator, $array)
{
if (!is_array($array)) {
return '';
}
$rv = trim(array_shift($array));
foreach ($array as $item) {
$item = $this->Escape(trim($item));
if ($rv != '' and $item != '') {
$rv .= $separator;... | [
"function",
"JoinNotEmpty",
"(",
"$",
"separator",
",",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"rv",
"=",
"trim",
"(",
"array_shift",
"(",
"$",
"array",
")",
")",
";",
... | same as join, but wont allow empty vals and escapes values for safe use in query
@param string $separator
@param array $array
@return string | [
"same",
"as",
"join",
"but",
"wont",
"allow",
"empty",
"vals",
"and",
"escapes",
"values",
"for",
"safe",
"use",
"in",
"query"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L689-L705 |
rozdol/bi | src/Bi/Db.php | Db.IN | function IN($items)
{
$comma_separated_items = $this->JoinNotEmpty("','", is_array($items) ? $items : explode(',', $items));
$count_items = substr_count($comma_separated_items, ',') + 1;
if (trim($comma_separated_items) == '') {
$count_items = 0;
}
if ($count_it... | php | function IN($items)
{
$comma_separated_items = $this->JoinNotEmpty("','", is_array($items) ? $items : explode(',', $items));
$count_items = substr_count($comma_separated_items, ',') + 1;
if (trim($comma_separated_items) == '') {
$count_items = 0;
}
if ($count_it... | [
"function",
"IN",
"(",
"$",
"items",
")",
"{",
"$",
"comma_separated_items",
"=",
"$",
"this",
"->",
"JoinNotEmpty",
"(",
"\"','\"",
",",
"is_array",
"(",
"$",
"items",
")",
"?",
"$",
"items",
":",
"explode",
"(",
"','",
",",
"$",
"items",
")",
")",
... | sets SQL statement for IN items
@param various $items
@return string | [
"sets",
"SQL",
"statement",
"for",
"IN",
"items"
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Bi/Db.php#L713-L729 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.setClientCredentials | public function setClientCredentials($id, $secret)
{
$this->clientId = $id;
$this->clientSecret = $secret;
return $this;
} | php | public function setClientCredentials($id, $secret)
{
$this->clientId = $id;
$this->clientSecret = $secret;
return $this;
} | [
"public",
"function",
"setClientCredentials",
"(",
"$",
"id",
",",
"$",
"secret",
")",
"{",
"$",
"this",
"->",
"clientId",
"=",
"$",
"id",
";",
"$",
"this",
"->",
"clientSecret",
"=",
"$",
"secret",
";",
"return",
"$",
"this",
";",
"}"
] | set the client credentials
@param string $id
@param string $secret
@return \TheTwelve\Foursquare\ApiGatewayFactory | [
"set",
"the",
"client",
"credentials"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L64-L71 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getAuthenticationGateway | public function getAuthenticationGateway(
$authorizeUri, $accessTokenUri, $redirectUri
) {
if (!$this->redirector instanceof Redirector) {
throw new \RuntimeException("A Redirector is required for authentication");
}
$gateway = new AuthenticationGateway($this->httpClien... | php | public function getAuthenticationGateway(
$authorizeUri, $accessTokenUri, $redirectUri
) {
if (!$this->redirector instanceof Redirector) {
throw new \RuntimeException("A Redirector is required for authentication");
}
$gateway = new AuthenticationGateway($this->httpClien... | [
"public",
"function",
"getAuthenticationGateway",
"(",
"$",
"authorizeUri",
",",
"$",
"accessTokenUri",
",",
"$",
"redirectUri",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"redirector",
"instanceof",
"Redirector",
")",
"{",
"throw",
"new",
"\\",
"RuntimeExce... | factory method for authentication gateway
@param string $authorizeUri
@param string $accessTokenUri
@param string $redirectUri
@throws \RuntimeException
@return \TheTwelve\Foursquare\AuthenticationGateway | [
"factory",
"method",
"for",
"authentication",
"gateway"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L107-L123 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getCheckinsGateway | public function getCheckinsGateway($userId = null)
{
$gateway = new CheckinsGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | php | public function getCheckinsGateway($userId = null)
{
$gateway = new CheckinsGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | [
"public",
"function",
"getCheckinsGateway",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"gateway",
"=",
"new",
"CheckinsGateway",
"(",
"$",
"this",
"->",
"httpClient",
")",
";",
"$",
"this",
"->",
"injectGatewayDependencies",
"(",
"$",
"gateway",
",",
... | factory method for checkins gateway
@param string|null $userId
@return \TheTwelve\Foursquare\UsersGateway | [
"factory",
"method",
"for",
"checkins",
"gateway"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L130-L137 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getPhotosGateway | public function getPhotosGateway($userId = null)
{
$gateway = new PhotosGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | php | public function getPhotosGateway($userId = null)
{
$gateway = new PhotosGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | [
"public",
"function",
"getPhotosGateway",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"gateway",
"=",
"new",
"PhotosGateway",
"(",
"$",
"this",
"->",
"httpClient",
")",
";",
"$",
"this",
"->",
"injectGatewayDependencies",
"(",
"$",
"gateway",
",",
"$",... | factory method for photos gateway
@param string|null $userId
@return \TheTwelve\Foursquare\UsersGateway | [
"factory",
"method",
"for",
"photos",
"gateway"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L144-L151 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getUsersGateway | public function getUsersGateway($userId = null)
{
$gateway = new UsersGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | php | public function getUsersGateway($userId = null)
{
$gateway = new UsersGateway($this->httpClient);
$this->injectGatewayDependencies($gateway, $userId);
return $gateway;
} | [
"public",
"function",
"getUsersGateway",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"gateway",
"=",
"new",
"UsersGateway",
"(",
"$",
"this",
"->",
"httpClient",
")",
";",
"$",
"this",
"->",
"injectGatewayDependencies",
"(",
"$",
"gateway",
",",
"$",
... | factory method for users gateway
@param string|null $userId
@return \TheTwelve\Foursquare\UsersGateway | [
"factory",
"method",
"for",
"users",
"gateway"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L158-L165 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getListGateway | public function getListGateway($listId = null)
{
$gateway = new ListsGateway($this->httpClient);
$this->injectListGatewayDependencies($gateway, $listId);
return $gateway;
} | php | public function getListGateway($listId = null)
{
$gateway = new ListsGateway($this->httpClient);
$this->injectListGatewayDependencies($gateway, $listId);
return $gateway;
} | [
"public",
"function",
"getListGateway",
"(",
"$",
"listId",
"=",
"null",
")",
"{",
"$",
"gateway",
"=",
"new",
"ListsGateway",
"(",
"$",
"this",
"->",
"httpClient",
")",
";",
"$",
"this",
"->",
"injectListGatewayDependencies",
"(",
"$",
"gateway",
",",
"$"... | factory method for users gateway
@param string|null $listId
@return \TheTwelve\Foursquare\ListsGateway | [
"factory",
"method",
"for",
"users",
"gateway"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L172-L177 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.getRequestUri | protected function getRequestUri()
{
if (!$this->requestUri) {
$this->requestUri = rtrim($this->endpointUri, '/') . '/' . $this->version;
}
return $this->requestUri;
} | php | protected function getRequestUri()
{
if (!$this->requestUri) {
$this->requestUri = rtrim($this->endpointUri, '/') . '/' . $this->version;
}
return $this->requestUri;
} | [
"protected",
"function",
"getRequestUri",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"requestUri",
")",
"{",
"$",
"this",
"->",
"requestUri",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"endpointUri",
",",
"'/'",
")",
".",
"'/'",
".",
"$",
"this",
... | get the uri to make requests to
@return string | [
"get",
"the",
"uri",
"to",
"make",
"requests",
"to"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L223-L232 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.injectGatewayDependencies | protected function injectGatewayDependencies(EndpointGateway $gateway, $userId = null)
{
if (!is_null($userId)) {
$gateway->setUserId($userId);
}
$gateway->setRequestUri($this->getRequestUri())
->setToken($this->token)
->setClientCredentials($thi... | php | protected function injectGatewayDependencies(EndpointGateway $gateway, $userId = null)
{
if (!is_null($userId)) {
$gateway->setUserId($userId);
}
$gateway->setRequestUri($this->getRequestUri())
->setToken($this->token)
->setClientCredentials($thi... | [
"protected",
"function",
"injectGatewayDependencies",
"(",
"EndpointGateway",
"$",
"gateway",
",",
"$",
"userId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"userId",
")",
")",
"{",
"$",
"gateway",
"->",
"setUserId",
"(",
"$",
"userId",
... | inject the minimum required dependencies
@param \TheTwelve\Foursquare\EndpointGateway $gateway
@param null $userId | [
"inject",
"the",
"minimum",
"required",
"dependencies"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L239-L250 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/ApiGatewayFactory.php | ApiGatewayFactory.injectListGatewayDependencies | protected function injectListGatewayDependencies(EndpointGateway $gateway, $listId = null)
{
if ($listId) {
$gateway->setListId($listId);
}
$gateway->setRequestUri($this->getRequestUri())
->setToken($this->token)
->setClientCredentials($this->clien... | php | protected function injectListGatewayDependencies(EndpointGateway $gateway, $listId = null)
{
if ($listId) {
$gateway->setListId($listId);
}
$gateway->setRequestUri($this->getRequestUri())
->setToken($this->token)
->setClientCredentials($this->clien... | [
"protected",
"function",
"injectListGatewayDependencies",
"(",
"EndpointGateway",
"$",
"gateway",
",",
"$",
"listId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"listId",
")",
"{",
"$",
"gateway",
"->",
"setListId",
"(",
"$",
"listId",
")",
";",
"}",
"$",
"g... | inject the minimum required dependencies
@param \TheTwelve\Foursquare\EndpointGateway $gateway
@param null $listId | [
"inject",
"the",
"minimum",
"required",
"dependencies"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/ApiGatewayFactory.php#L257-L265 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php | UserRoleQuery.filterByPrimaryKey | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(UserRoleTableMap::COL_USER_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(UserRoleTableMap::COL_ROLE_ID, $key[1], Criteria::EQUAL);
return $this;
} | php | public function filterByPrimaryKey($key)
{
$this->addUsingAlias(UserRoleTableMap::COL_USER_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(UserRoleTableMap::COL_ROLE_ID, $key[1], Criteria::EQUAL);
return $this;
} | [
"public",
"function",
"filterByPrimaryKey",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"UserRoleTableMap",
"::",
"COL_USER_ID",
",",
"$",
"key",
"[",
"0",
"]",
",",
"Criteria",
"::",
"EQUAL",
")",
";",
"$",
"this",
"->",
"addUsin... | Filter the query by primary key
@param mixed $key Primary key to use for the query
@return $this|ChildUserRoleQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"primary",
"key"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L213-L219 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php | UserRoleQuery.filterByPrimaryKeys | public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(UserRoleTableMap::COL_USER_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNew... | php | public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(UserRoleTableMap::COL_USER_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNew... | [
"public",
"function",
"filterByPrimaryKeys",
"(",
"$",
"keys",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"keys",
")",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"null",
",",
"'1<>1'",
",",
"Criteria",
"::",
"CUSTOM",
")",
";",
"}",
"foreach",
... | Filter the query by a list of primary keys
@param array $keys The list of primary key to use for the query
@return $this|ChildUserRoleQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"list",
"of",
"primary",
"keys"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L228-L241 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php | UserRoleQuery.filterByUserId | public function filterByUserId($userId = null, $comparison = null)
{
if (is_array($userId)) {
$useMinMax = false;
if (isset($userId['min'])) {
$this->addUsingAlias(UserRoleTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
$useMinMax = tr... | php | public function filterByUserId($userId = null, $comparison = null)
{
if (is_array($userId)) {
$useMinMax = false;
if (isset($userId['min'])) {
$this->addUsingAlias(UserRoleTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
$useMinMax = tr... | [
"public",
"function",
"filterByUserId",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"userId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"us... | Filter the query on the user_id column
Example usage:
<code>
$query->filterByUserId(1234); // WHERE user_id = 1234
$query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
$query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
</code>
@see filterByUser()
@param mixed $userId The value... | [
"Filter",
"the",
"query",
"on",
"the",
"user_id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRoleQuery.php#L263-L284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.