repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
koolkode/view-express | src/Tree/TextNode.php | TextNode.compile | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
$compiler->write(var_export($this->text, true));
}
else
{
// Using ENT_COMPAT due to Knockout JS (and others) data binding, this is not risky
// in Express-parsed attribute values due to ... | php | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
$compiler->write(var_export($this->text, true));
}
else
{
// Using ENT_COMPAT due to Knockout JS (and others) data binding, this is not risky
// in Express-parsed attribute values due to ... | [
"public",
"function",
"compile",
"(",
"ExpressCompiler",
"$",
"compiler",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"flags",
"&",
"self",
"::",
"FLAG_RAW",
")",
"{",
"$",
"compiler",
"->",
"write",
"(",
"var_export",
"(",
"$"... | Compiles the text node into it's PHP code.
@param ExpressCompiler $compiler
@param integer $flags Raw mode is used when an element is morphed using a tag builder. | [
"Compiles",
"the",
"text",
"node",
"into",
"it",
"s",
"PHP",
"code",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/Tree/TextNode.php#L58-L82 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isBoolean | public static function isBoolean($value, $message = null)
{
if (!is_bool($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected boolean, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isBoolean($value, $message = null)
{
if (!is_bool($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected boolean, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isBoolean",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"?... | Assert that the value is boolean.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"boolean",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L32-L40 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isInteger | public static function isInteger($value, $message = null)
{
if (!is_int($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected integer, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isInteger($value, $message = null)
{
if (!is_int($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected integer, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isInteger",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"?"... | Assert that the value is integer.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"integer",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L52-L60 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNumeric | public static function isNumeric($value, $message = null)
{
if (!is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected numeric, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isNumeric($value, $message = null)
{
if (!is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected numeric, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isNumeric",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
... | Assert that the value is numeric.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"numeric",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L72-L80 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isFloat | public static function isFloat($value, $message = null)
{
if (!is_float($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected float, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isFloat($value, $message = null)
{
if (!is_float($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected float, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isFloat",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"?"... | Assert that the value is float.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"float",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L92-L100 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isString | public static function isString($value, $message = null)
{
if (!is_string($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected string, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isString($value, $message = null)
{
if (!is_string($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected string, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isString",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"... | Assert that the value is string.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"string",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L112-L120 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isScalar | public static function isScalar($value, $message = null)
{
if (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected scalar, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isScalar($value, $message = null)
{
if (!is_scalar($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected scalar, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isScalar",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"... | Assert that the value is scalar.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"scalar",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L132-L140 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isArray | public static function isArray($value, $message = null)
{
if (!is_array($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected array, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isArray($value, $message = null)
{
if (!is_array($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected array, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isArray",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",
"?"... | Assert that the value is array.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"array",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L152-L160 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isInstanceOf | public static function isInstanceOf($value, $class, $message = null)
{
if (!$value instanceof $class) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected instance of %2$s, but got %s',
Helper::typeToString($value),
$class
... | php | public static function isInstanceOf($value, $class, $message = null)
{
if (!$value instanceof $class) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected instance of %2$s, but got %s',
Helper::typeToString($value),
$class
... | [
"public",
"static",
"function",
"isInstanceOf",
"(",
"$",
"value",
",",
"$",
"class",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"$",
"class",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprint... | Assert that the value is instance of class.
@param mixed $value
@param string $class
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"instance",
"of",
"class",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L193-L202 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isResource | public static function isResource($value, $message = null)
{
if (!is_resource($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected resource, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isResource($value, $message = null)
{
if (!is_resource($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected resource, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isResource",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"$",
"message",... | Assert that the value is resource.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"resource",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L234-L242 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isDirectory | public static function isDirectory($value, $message = null)
{
if (!is_string($value) || !is_dir($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected directory, but got %s',
Helper::valueToString($value)
));
}
} | php | public static function isDirectory($value, $message = null)
{
if (!is_string($value) || !is_dir($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected directory, but got %s',
Helper::valueToString($value)
));
}
} | [
"public",
"static",
"function",
"isDirectory",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"!",
"is_dir",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgument... | Assert that the value is directory.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"directory",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L254-L262 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isFile | public static function isFile($value, $message = null)
{
if (!is_string($value) || !is_file($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected file, but got %s',
Helper::valueToString($value)
));
}
} | php | public static function isFile($value, $message = null)
{
if (!is_string($value) || !is_file($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected file, but got %s',
Helper::valueToString($value)
));
}
} | [
"public",
"static",
"function",
"isFile",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"!",
"is_file",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentExce... | Assert that the value is file.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"file",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L274-L282 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrBoolean | public static function isNullOrBoolean($value, $message = null)
{
if (!is_null($value) && !is_bool($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or boolean, but got %s',
Helper::typeToString($value)
));
}
... | php | public static function isNullOrBoolean($value, $message = null)
{
if (!is_null($value) && !is_bool($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or boolean, but got %s',
Helper::typeToString($value)
));
}
... | [
"public",
"static",
"function",
"isNullOrBoolean",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgum... | Assert that the value is null or boolean.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"boolean",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L294-L302 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrInteger | public static function isNullOrInteger($value, $message = null)
{
if (!is_null($value) && !is_int($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or integer, but got %s',
Helper::typeToString($value)
));
}
... | php | public static function isNullOrInteger($value, $message = null)
{
if (!is_null($value) && !is_int($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or integer, but got %s',
Helper::typeToString($value)
));
}
... | [
"public",
"static",
"function",
"isNullOrInteger",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgume... | Assert that the value is null or integer.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"integer",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L314-L322 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrNumeric | public static function isNullOrNumeric($value, $message = null)
{
if (!is_null($value) && !is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or numeric, but got %s',
Helper::typeToString($value)
));
}
... | php | public static function isNullOrNumeric($value, $message = null)
{
if (!is_null($value) && !is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or numeric, but got %s',
Helper::typeToString($value)
));
}
... | [
"public",
"static",
"function",
"isNullOrNumeric",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidAr... | Assert that the value is null or numeric.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"numeric",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L334-L342 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrFloat | public static function isNullOrFloat($value, $message = null)
{
if (!is_null($value) && !is_float($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or float, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isNullOrFloat($value, $message = null)
{
if (!is_null($value) && !is_float($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or float, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isNullOrFloat",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgume... | Assert that the value is null or float.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"float",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L354-L362 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrString | public static function isNullOrString($value, $message = null)
{
if (!is_null($value) && !is_string($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or string, but got %s',
Helper::typeToString($value)
));
}
... | php | public static function isNullOrString($value, $message = null)
{
if (!is_null($value) && !is_string($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or string, but got %s',
Helper::typeToString($value)
));
}
... | [
"public",
"static",
"function",
"isNullOrString",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgu... | Assert that the value is null or string.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"string",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L374-L382 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrScalar | public static function isNullOrScalar($value, $message = null)
{
if (!is_null($value) && !is_scalar($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or scalar, but got %s',
Helper::typeToString($value)
));
}
... | php | public static function isNullOrScalar($value, $message = null)
{
if (!is_null($value) && !is_scalar($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or scalar, but got %s',
Helper::typeToString($value)
));
}
... | [
"public",
"static",
"function",
"isNullOrScalar",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgu... | Assert that the value is null or scalar.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"scalar",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L394-L402 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrArray | public static function isNullOrArray($value, $message = null)
{
if (!is_null($value) && !is_array($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or array, but got %s',
Helper::typeToString($value)
));
}
} | php | public static function isNullOrArray($value, $message = null)
{
if (!is_null($value) && !is_array($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or array, but got %s',
Helper::typeToString($value)
));
}
} | [
"public",
"static",
"function",
"isNullOrArray",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgume... | Assert that the value is null or array.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"array",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L414-L422 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrCallable | public static function isNullOrCallable($value, $message = null)
{
if (!is_null($value) && !is_callable($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or callable, but got %s',
Helper::typeToString($value)
));
... | php | public static function isNullOrCallable($value, $message = null)
{
if (!is_null($value) && !is_callable($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or callable, but got %s',
Helper::typeToString($value)
));
... | [
"public",
"static",
"function",
"isNullOrCallable",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_callable",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"Invalid... | Assert that the value is null or callable.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"callable",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L434-L442 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrInstanceOf | public static function isNullOrInstanceOf($value, $class, $message = null)
{
if (!is_null($value) && !$value instanceof $class) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or instance of %2$s, but got %s',
Helper::typeToString($value),... | php | public static function isNullOrInstanceOf($value, $class, $message = null)
{
if (!is_null($value) && !$value instanceof $class) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or instance of %2$s, but got %s',
Helper::typeToString($value),... | [
"public",
"static",
"function",
"isNullOrInstanceOf",
"(",
"$",
"value",
",",
"$",
"class",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"$",
"value",
"instanceof",
"$",
"class",
")",
"{",
... | Assert that the value is null or instance of class.
@param mixed $value
@param string $class
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"instance",
"of",
"class",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L455-L464 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrTraversable | public static function isNullOrTraversable($value, $message = null)
{
if (!is_null($value) && !is_array($value) && !$value instanceof Traversable) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or traversable, but got %s',
Helper::typeToS... | php | public static function isNullOrTraversable($value, $message = null)
{
if (!is_null($value) && !is_array($value) && !$value instanceof Traversable) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or traversable, but got %s',
Helper::typeToS... | [
"public",
"static",
"function",
"isNullOrTraversable",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_array",
"(",
"$",
"value",
")",
"&&",
"!",
"$",
"value",
"instance... | Assert that the value is null or traversable.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"traversable",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L476-L484 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrResource | public static function isNullOrResource($value, $message = null)
{
if (!is_null($value) && !is_resource($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or resource, but got %s',
Helper::typeToString($value)
));
... | php | public static function isNullOrResource($value, $message = null)
{
if (!is_null($value) && !is_resource($value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or resource, but got %s',
Helper::typeToString($value)
));
... | [
"public",
"static",
"function",
"isNullOrResource",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_resource",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"Invalid... | Assert that the value is null or resource.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"resource",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L496-L504 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrDirectory | public static function isNullOrDirectory($value, $message = null)
{
if (!is_null($value) && !(is_string($value) && is_dir($value))) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or directory, but got %s',
Helper::valueToString($value)
... | php | public static function isNullOrDirectory($value, $message = null)
{
if (!is_null($value) && !(is_string($value) && is_dir($value))) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or directory, but got %s',
Helper::valueToString($value)
... | [
"public",
"static",
"function",
"isNullOrDirectory",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"is_dir",
"(",
"$",
"v... | Assert that the value is null or directory.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"directory",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L516-L524 | train |
JoeBengalen/Assert | src/Assert.php | Assert.isNullOrFile | public static function isNullOrFile($value, $message = null)
{
if (!is_null($value) && !(is_string($value) && is_file($value))) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or file, but got %s',
Helper::valueToString($value)
... | php | public static function isNullOrFile($value, $message = null)
{
if (!is_null($value) && !(is_string($value) && is_file($value))) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected null or file, but got %s',
Helper::valueToString($value)
... | [
"public",
"static",
"function",
"isNullOrFile",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"is_file",
"(",
"$",
"value... | Assert that the value is null or file.
@param mixed $value
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"the",
"value",
"is",
"null",
"or",
"file",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L536-L544 | train |
JoeBengalen/Assert | src/Assert.php | Assert.keyExists | public static function keyExists($value, $key, $message = null)
{
if (!array_key_exists($key, $value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected array key %2$s to exist',
Helper::typeToString($value),
Helper::valueToString... | php | public static function keyExists($value, $key, $message = null)
{
if (!array_key_exists($key, $value)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Expected array key %2$s to exist',
Helper::typeToString($value),
Helper::valueToString... | [
"public",
"static",
"function",
"keyExists",
"(",
"$",
"value",
",",
"$",
"key",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentExceptio... | Assert that key exists in value.
@param mixed $value
@param string $key
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"key",
"exists",
"in",
"value",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L557-L566 | train |
JoeBengalen/Assert | src/Assert.php | Assert.inArray | public static function inArray($value, array $array, $message = null)
{
if (!in_array($value, $array)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Value %s is not in array',
Helper::valueToString($value)
));
}
} | php | public static function inArray($value, array $array, $message = null)
{
if (!in_array($value, $array)) {
throw new InvalidArgumentException(sprintf(
$message ?: 'Value %s is not in array',
Helper::valueToString($value)
));
}
} | [
"public",
"static",
"function",
"inArray",
"(",
"$",
"value",
",",
"array",
"$",
"array",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"value",
",",
"$",
"array",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentExc... | Assert that value is in array.
@param mixed $value
@param array $array
@param string $message
@return void
@throws InvalidArgumentException | [
"Assert",
"that",
"value",
"is",
"in",
"array",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Assert.php#L579-L587 | train |
vespolina/action | lib/Vespolina/Action/Manager/ActionManager.php | ActionManager.doExecute | protected function doExecute(ActionInterface $action, $reprocess = false)
{
// The first question is, are we even allowed to reprocess this action?
$definition = $this->findActionDefinitionByName($action->getName());
if (null == $definition) {
throw new \RuntimeException... | php | protected function doExecute(ActionInterface $action, $reprocess = false)
{
// The first question is, are we even allowed to reprocess this action?
$definition = $this->findActionDefinitionByName($action->getName());
if (null == $definition) {
throw new \RuntimeException... | [
"protected",
"function",
"doExecute",
"(",
"ActionInterface",
"$",
"action",
",",
"$",
"reprocess",
"=",
"false",
")",
"{",
"// The first question is, are we even allowed to reprocess this action?",
"$",
"definition",
"=",
"$",
"this",
"->",
"findActionDefinitionByName",
... | Start the execution of an action or schedule the action for processing later on
@param ActionInterface $action
@param bool $reprocess | [
"Start",
"the",
"execution",
"of",
"an",
"action",
"or",
"schedule",
"the",
"action",
"for",
"processing",
"later",
"on"
] | 798baf0401c81cc507c51a54bf57fdd3505f5b92 | https://github.com/vespolina/action/blob/798baf0401c81cc507c51a54bf57fdd3505f5b92/lib/Vespolina/Action/Manager/ActionManager.php#L138-L163 | train |
dubhunter/talon | src/Http.php | Http.getStatusMessage | public static function getStatusMessage($code) {
if (!$code) {
return '';
}
return isset(self::$statusMessages[$code]) ? self::$statusMessages[$code] : '';
} | php | public static function getStatusMessage($code) {
if (!$code) {
return '';
}
return isset(self::$statusMessages[$code]) ? self::$statusMessages[$code] : '';
} | [
"public",
"static",
"function",
"getStatusMessage",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"$",
"code",
")",
"{",
"return",
"''",
";",
"}",
"return",
"isset",
"(",
"self",
"::",
"$",
"statusMessages",
"[",
"$",
"code",
"]",
")",
"?",
"self",
"... | Returns a messages for a given code
@param $code
@return string | [
"Returns",
"a",
"messages",
"for",
"a",
"given",
"code"
] | 308b7284556dfaff0d9ac4c7739dc6a46930ef36 | https://github.com/dubhunter/talon/blob/308b7284556dfaff0d9ac4c7739dc6a46930ef36/src/Http.php#L85-L91 | train |
Aprila/Quick | src/Quick/Presenter/ListPresenter.php | ListPresenter.addOrEditObject | protected function addOrEditObject($data = [], $redirect = TRUE)
{
try {
if ($this->detailObject) {
// Edit object
$this->canUser('edit');
$this->mainManager->edit($this->detailObject->id, $data);
$this->flashMessage('Object saved');
} else {
// Add object
$this->canUser('add');
$t... | php | protected function addOrEditObject($data = [], $redirect = TRUE)
{
try {
if ($this->detailObject) {
// Edit object
$this->canUser('edit');
$this->mainManager->edit($this->detailObject->id, $data);
$this->flashMessage('Object saved');
} else {
// Add object
$this->canUser('add');
$t... | [
"protected",
"function",
"addOrEditObject",
"(",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"redirect",
"=",
"TRUE",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"detailObject",
")",
"{",
"// Edit object",
"$",
"this",
"->",
"canUser",
"(",
"'edit'",... | Simple implementation add or edit object
@param array $data
@param bool $redirect | [
"Simple",
"implementation",
"add",
"or",
"edit",
"object"
] | 53c3830c7256d6f46f6bc352d7e0b022f0c81277 | https://github.com/Aprila/Quick/blob/53c3830c7256d6f46f6bc352d7e0b022f0c81277/src/Quick/Presenter/ListPresenter.php#L168-L192 | train |
gplcart/backup | controllers/Backup.php | Backup.listBackup | public function listBackup()
{
$this->downloadListBackup();
$this->actionListBackup();
$this->setTitleListBackup();
$this->setBreadcrumbListBackup();
$this->setFilterListBackup();
$this->setPagerListBackup();
$this->setData('backups', $this->getListBackup());... | php | public function listBackup()
{
$this->downloadListBackup();
$this->actionListBackup();
$this->setTitleListBackup();
$this->setBreadcrumbListBackup();
$this->setFilterListBackup();
$this->setPagerListBackup();
$this->setData('backups', $this->getListBackup());... | [
"public",
"function",
"listBackup",
"(",
")",
"{",
"$",
"this",
"->",
"downloadListBackup",
"(",
")",
";",
"$",
"this",
"->",
"actionListBackup",
"(",
")",
";",
"$",
"this",
"->",
"setTitleListBackup",
"(",
")",
";",
"$",
"this",
"->",
"setBreadcrumbListBa... | Displays the backup overview page | [
"Displays",
"the",
"backup",
"overview",
"page"
] | 5838e2f47f0bb8c2e18b6697e20bec5682b71393 | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/controllers/Backup.php#L46-L59 | train |
gplcart/backup | controllers/Backup.php | Backup.downloadListBackup | protected function downloadListBackup()
{
$backup_id = $this->getQuery('download');
if (empty($backup_id)) {
return null;
}
$this->controlAccess('backup_download');
$backup = $this->backup->get($backup_id);
if (!empty($backup['path'])) {
$t... | php | protected function downloadListBackup()
{
$backup_id = $this->getQuery('download');
if (empty($backup_id)) {
return null;
}
$this->controlAccess('backup_download');
$backup = $this->backup->get($backup_id);
if (!empty($backup['path'])) {
$t... | [
"protected",
"function",
"downloadListBackup",
"(",
")",
"{",
"$",
"backup_id",
"=",
"$",
"this",
"->",
"getQuery",
"(",
"'download'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"backup_id",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"this",
"->",
... | Downloads a backup | [
"Downloads",
"a",
"backup"
] | 5838e2f47f0bb8c2e18b6697e20bec5682b71393 | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/controllers/Backup.php#L73-L88 | train |
gplcart/backup | controllers/Backup.php | Backup.actionListBackup | protected function actionListBackup()
{
list($selected, $action) = $this->getPostedAction();
$deleted = 0;
foreach ($selected as $id) {
if ($action === 'delete' && $this->access('backup_delete')) {
$deleted += (int) $this->backup->delete($id);
}
... | php | protected function actionListBackup()
{
list($selected, $action) = $this->getPostedAction();
$deleted = 0;
foreach ($selected as $id) {
if ($action === 'delete' && $this->access('backup_delete')) {
$deleted += (int) $this->backup->delete($id);
}
... | [
"protected",
"function",
"actionListBackup",
"(",
")",
"{",
"list",
"(",
"$",
"selected",
",",
"$",
"action",
")",
"=",
"$",
"this",
"->",
"getPostedAction",
"(",
")",
";",
"$",
"deleted",
"=",
"0",
";",
"foreach",
"(",
"$",
"selected",
"as",
"$",
"i... | Applies an action to the selected backups | [
"Applies",
"an",
"action",
"to",
"the",
"selected",
"backups"
] | 5838e2f47f0bb8c2e18b6697e20bec5682b71393 | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/controllers/Backup.php#L93-L109 | train |
gplcart/backup | controllers/Backup.php | Backup.getListBackup | protected function getListBackup()
{
$options = $this->query_filter;
$options['limit'] = $this->data_limit;
return $this->backup->getList($options);
} | php | protected function getListBackup()
{
$options = $this->query_filter;
$options['limit'] = $this->data_limit;
return $this->backup->getList($options);
} | [
"protected",
"function",
"getListBackup",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"query_filter",
";",
"$",
"options",
"[",
"'limit'",
"]",
"=",
"$",
"this",
"->",
"data_limit",
";",
"return",
"$",
"this",
"->",
"backup",
"->",
"getList",
... | Returns an array of backups
@return array | [
"Returns",
"an",
"array",
"of",
"backups"
] | 5838e2f47f0bb8c2e18b6697e20bec5682b71393 | https://github.com/gplcart/backup/blob/5838e2f47f0bb8c2e18b6697e20bec5682b71393/controllers/Backup.php#L144-L149 | train |
Kris-Kuiper/sFire-Framework | src/System/Captcha.php | Captcha.setImage | public function setImage($image) {
if(false === is_string($image)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($image)), E_USER_ERROR);
}
$file = new File($image);
if(false === $file -> exists()) {
return trigger_error(... | php | public function setImage($image) {
if(false === is_string($image)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($image)), E_USER_ERROR);
}
$file = new File($image);
if(false === $file -> exists()) {
return trigger_error(... | [
"public",
"function",
"setImage",
"(",
"$",
"image",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"image",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"_... | Set image by giving a file path as image
@param string $image
@return sFire\Captcha\Captcha | [
"Set",
"image",
"by",
"giving",
"a",
"file",
"path",
"as",
"image"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/System/Captcha.php#L72-L91 | train |
Kris-Kuiper/sFire-Framework | src/System/Captcha.php | Captcha.setFont | public function setFont($font) {
if(false === is_string($font)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($font)), E_USER_ERROR);
}
$file = new File($font);
if(false === $file -> exists()) {
return trigger_error(sprin... | php | public function setFont($font) {
if(false === is_string($font)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($font)), E_USER_ERROR);
}
$file = new File($font);
if(false === $file -> exists()) {
return trigger_error(sprin... | [
"public",
"function",
"setFont",
"(",
"$",
"font",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"font",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__ME... | Set the font by giving a file path as font
@param string $font
@return sFire\Captcha\Captcha | [
"Set",
"the",
"font",
"by",
"giving",
"a",
"file",
"path",
"as",
"font"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/System/Captcha.php#L99-L114 | train |
Kris-Kuiper/sFire-Framework | src/System/Captcha.php | Captcha.setFontSize | public function setFontSize($min, $max = null) {
if(false === ('-' . intval($min) == '-' . $min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(null !== $max && false === ('-' . intval($max) == '-' . $... | php | public function setFontSize($min, $max = null) {
if(false === ('-' . intval($min) == '-' . $min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(null !== $max && false === ('-' . intval($max) == '-' . $... | [
"public",
"function",
"setFontSize",
"(",
"$",
"min",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"min",
")",
"==",
"'-'",
".",
"$",
"min",
")",
")",
"{",
"return",
"trigger_error",
"(",... | Set the fontsize min. and max. If no max. is set, max. will be the same as min.
@param int $min
@param int $max
@return sFire\Captcha\Captcha | [
"Set",
"the",
"fontsize",
"min",
".",
"and",
"max",
".",
"If",
"no",
"max",
".",
"is",
"set",
"max",
".",
"will",
"be",
"the",
"same",
"as",
"min",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/System/Captcha.php#L152-L165 | train |
Kris-Kuiper/sFire-Framework | src/System/Captcha.php | Captcha.setAngle | public function setAngle($min, $max = null) {
if(false === ('-' . intval($min) == '-' . $min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(null !== $max && false === ('-' . intval($max) == '-' . $max... | php | public function setAngle($min, $max = null) {
if(false === ('-' . intval($min) == '-' . $min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(null !== $max && false === ('-' . intval($max) == '-' . $max... | [
"public",
"function",
"setAngle",
"(",
"$",
"min",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"min",
")",
"==",
"'-'",
".",
"$",
"min",
")",
")",
"{",
"return",
"trigger_error",
"(",
... | Set the angle min. and max. If no max. is set, max. will be the same as min.
@param int $min
@param int $max
@return sFire\Captcha\Captcha | [
"Set",
"the",
"angle",
"min",
".",
"and",
"max",
".",
"If",
"no",
"max",
".",
"is",
"set",
"max",
".",
"will",
"be",
"the",
"same",
"as",
"min",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/System/Captcha.php#L174-L187 | train |
essence/dom | src/Tag.php | Tag.matches | public function matches($name, $pattern, &$matches = []) {
return preg_match($pattern, $this->get($name), $matches);
} | php | public function matches($name, $pattern, &$matches = []) {
return preg_match($pattern, $this->get($name), $matches);
} | [
"public",
"function",
"matches",
"(",
"$",
"name",
",",
"$",
"pattern",
",",
"&",
"$",
"matches",
"=",
"[",
"]",
")",
"{",
"return",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
",",
"$",
"matches",
")"... | Tests if the value of an attribute matches the given pattern.
@param string $name Attribute name.
@param string $pattern Pattern.
@param array $matches Search results.
@return boolean If the attribute value matches the pattern. | [
"Tests",
"if",
"the",
"value",
"of",
"an",
"attribute",
"matches",
"the",
"given",
"pattern",
"."
] | e5776d2286f4ccbd048d160c28ac77ccc6d68f3a | https://github.com/essence/dom/blob/e5776d2286f4ccbd048d160c28ac77ccc6d68f3a/src/Tag.php#L36-L38 | train |
dms-org/common.structure | src/Colour/TransparentColour.php | TransparentColour.fromRgba | public static function fromRgba(int $red, int $green, int $blue, float $alpha) : TransparentColour
{
return new self(new Colour($red, $green, $blue), $alpha);
} | php | public static function fromRgba(int $red, int $green, int $blue, float $alpha) : TransparentColour
{
return new self(new Colour($red, $green, $blue), $alpha);
} | [
"public",
"static",
"function",
"fromRgba",
"(",
"int",
"$",
"red",
",",
"int",
"$",
"green",
",",
"int",
"$",
"blue",
",",
"float",
"$",
"alpha",
")",
":",
"TransparentColour",
"{",
"return",
"new",
"self",
"(",
"new",
"Colour",
"(",
"$",
"red",
","... | Creates a new colour from the supplied rgba values
@param int $red
@param int $green
@param int $blue
@param float $alpha
@return TransparentColour | [
"Creates",
"a",
"new",
"colour",
"from",
"the",
"supplied",
"rgba",
"values"
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Colour/TransparentColour.php#L74-L77 | train |
dms-org/common.structure | src/Colour/TransparentColour.php | TransparentColour.fromRgbaString | public static function fromRgbaString(string $string) : TransparentColour
{
list($r, $g, $b, $a) = ColourStringParser::parseRgbaString($string);
return new self(new Colour($r, $g, $b), $a);
} | php | public static function fromRgbaString(string $string) : TransparentColour
{
list($r, $g, $b, $a) = ColourStringParser::parseRgbaString($string);
return new self(new Colour($r, $g, $b), $a);
} | [
"public",
"static",
"function",
"fromRgbaString",
"(",
"string",
"$",
"string",
")",
":",
"TransparentColour",
"{",
"list",
"(",
"$",
"r",
",",
"$",
"g",
",",
"$",
"b",
",",
"$",
"a",
")",
"=",
"ColourStringParser",
"::",
"parseRgbaString",
"(",
"$",
"... | Creates a new colour from the supplied rgba string value
@param string $string eg: "rgba(100, 100, 100, 0.5)"
@return TransparentColour
@throws InvalidArgumentException | [
"Creates",
"a",
"new",
"colour",
"from",
"the",
"supplied",
"rgba",
"string",
"value"
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Colour/TransparentColour.php#L87-L92 | train |
battis/configxml | src/ConfigXML.php | ConfigXML.toArray | public function toArray($query)
{
$nodes = $this->xpath->query((string) $query);
if ($nodes->length) {
$result = array();
foreach ($nodes as $node) {
$result[] = json_decode(
json_encode(
simplexml_load_string(
... | php | public function toArray($query)
{
$nodes = $this->xpath->query((string) $query);
if ($nodes->length) {
$result = array();
foreach ($nodes as $node) {
$result[] = json_decode(
json_encode(
simplexml_load_string(
... | [
"public",
"function",
"toArray",
"(",
"$",
"query",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"xpath",
"->",
"query",
"(",
"(",
"string",
")",
"$",
"query",
")",
";",
"if",
"(",
"$",
"nodes",
"->",
"length",
")",
"{",
"$",
"result",
"=",
... | Extract an XPath query as an associative array
@param string $query XPath query
@return array An array of matches converted to associative arrays. `null`
if no matches found. | [
"Extract",
"an",
"XPath",
"query",
"as",
"an",
"associative",
"array"
] | 7c6aeddce5c26bee553d7160bae47b30344ae122 | https://github.com/battis/configxml/blob/7c6aeddce5c26bee553d7160bae47b30344ae122/src/ConfigXML.php#L74-L92 | train |
battis/configxml | src/ConfigXML.php | ConfigXML.recursiveImplode | private static function recursiveImplode($glue, $pieces)
{
if (is_array($pieces)) {
$strings = array();
foreach ($pieces as $key => $piece) {
if (is_int($key) || $key !== self::ATTRIBUTES) {
if (is_array($piece)) {
$strings[... | php | private static function recursiveImplode($glue, $pieces)
{
if (is_array($pieces)) {
$strings = array();
foreach ($pieces as $key => $piece) {
if (is_int($key) || $key !== self::ATTRIBUTES) {
if (is_array($piece)) {
$strings[... | [
"private",
"static",
"function",
"recursiveImplode",
"(",
"$",
"glue",
",",
"$",
"pieces",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pieces",
")",
")",
"{",
"$",
"strings",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"pieces",
"as",
"$",
"k... | Recursively implode nested ArrayAccess
@param string $glue Glue to hold together imploded list of pieces
@param array $pieces
@return string | [
"Recursively",
"implode",
"nested",
"ArrayAccess"
] | 7c6aeddce5c26bee553d7160bae47b30344ae122 | https://github.com/battis/configxml/blob/7c6aeddce5c26bee553d7160bae47b30344ae122/src/ConfigXML.php#L114-L131 | train |
battis/configxml | src/ConfigXML.php | ConfigXML.DOMtoArray | private static function DOMtoArray($node)
{
$occurence = array();
$result = null;
if ($node->childNodes) {
foreach ($node->childNodes as $child) {
if (isset($occurence[$child->nodeName])) {
$occurence[$child->nodeName]++;
} els... | php | private static function DOMtoArray($node)
{
$occurence = array();
$result = null;
if ($node->childNodes) {
foreach ($node->childNodes as $child) {
if (isset($occurence[$child->nodeName])) {
$occurence[$child->nodeName]++;
} els... | [
"private",
"static",
"function",
"DOMtoArray",
"(",
"$",
"node",
")",
"{",
"$",
"occurence",
"=",
"array",
"(",
")",
";",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"$",
"node",
"->",
"childNodes",
")",
"{",
"foreach",
"(",
"$",
"node",
"->",
"chi... | Convert the XML DOM into a nested associative array
@param DOMNode $node Root node of the array
@return array | [
"Convert",
"the",
"XML",
"DOM",
"into",
"a",
"nested",
"associative",
"array"
] | 7c6aeddce5c26bee553d7160bae47b30344ae122 | https://github.com/battis/configxml/blob/7c6aeddce5c26bee553d7160bae47b30344ae122/src/ConfigXML.php#L139-L203 | train |
vaniocz/stdlib | src/Enum.php | Enum.box | final public static function box($plainValue): self
{
foreach (static::valueNames() as $name) {
if (self::constant($name) === $plainValue) {
return self::__callStatic($name, []);
}
}
$message = sprintf('Value %s is not within %s enumeration.', $plainV... | php | final public static function box($plainValue): self
{
foreach (static::valueNames() as $name) {
if (self::constant($name) === $plainValue) {
return self::__callStatic($name, []);
}
}
$message = sprintf('Value %s is not within %s enumeration.', $plainV... | [
"final",
"public",
"static",
"function",
"box",
"(",
"$",
"plainValue",
")",
":",
"self",
"{",
"foreach",
"(",
"static",
"::",
"valueNames",
"(",
")",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"self",
"::",
"constant",
"(",
"$",
"name",
")",
"===",
"... | Box the given plain value.
@param mixed $plainValue The plain value to be boxed.
@return static The boxed value.
@throws InvalidArgumentException If the given plain value is not within the enumeration. | [
"Box",
"the",
"given",
"plain",
"value",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/Enum.php#L52-L62 | train |
vaniocz/stdlib | src/Enum.php | Enum.valueNames | public static function valueNames(): array
{
static $valueNames = [];
if (!isset($valueNames[static::class])) {
$valueNames[static::class] = [];
foreach ((new ReflectionClass(static::class))->getReflectionConstants() as $reflectionConstant) {
if ($reflection... | php | public static function valueNames(): array
{
static $valueNames = [];
if (!isset($valueNames[static::class])) {
$valueNames[static::class] = [];
foreach ((new ReflectionClass(static::class))->getReflectionConstants() as $reflectionConstant) {
if ($reflection... | [
"public",
"static",
"function",
"valueNames",
"(",
")",
":",
"array",
"{",
"static",
"$",
"valueNames",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"valueNames",
"[",
"static",
"::",
"class",
"]",
")",
")",
"{",
"$",
"valueNames",
"[",
"... | Get names of all the values in this enumeration.
@return string[] Names of all the values in this enumeration. | [
"Get",
"names",
"of",
"all",
"the",
"values",
"in",
"this",
"enumeration",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/Enum.php#L121-L136 | train |
vaniocz/stdlib | src/Enum.php | Enum.instantiate | private static function instantiate(string $valueName): self
{
$value = new static(...(array) self::constant($valueName));
$value->name = $valueName;
return $value;
} | php | private static function instantiate(string $valueName): self
{
$value = new static(...(array) self::constant($valueName));
$value->name = $valueName;
return $value;
} | [
"private",
"static",
"function",
"instantiate",
"(",
"string",
"$",
"valueName",
")",
":",
"self",
"{",
"$",
"value",
"=",
"new",
"static",
"(",
"...",
"(",
"array",
")",
"self",
"::",
"constant",
"(",
"$",
"valueName",
")",
")",
";",
"$",
"value",
"... | Instantiate value with the given name.
@param string $valueName The name of the value.
@return static The newly instantiated value. | [
"Instantiate",
"value",
"with",
"the",
"given",
"name",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/Enum.php#L145-L151 | train |
vaniocz/stdlib | src/Enum.php | Enum.constant | private static function constant(string $name)
{
$constant = static::class . '::' . $name;
if (!defined($constant)) {
$message = sprintf('Enum %s does not contain value named %s.', static::class, $name);
throw new InvalidArgumentException($message);
}
return... | php | private static function constant(string $name)
{
$constant = static::class . '::' . $name;
if (!defined($constant)) {
$message = sprintf('Enum %s does not contain value named %s.', static::class, $name);
throw new InvalidArgumentException($message);
}
return... | [
"private",
"static",
"function",
"constant",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"constant",
"=",
"static",
"::",
"class",
".",
"'::'",
".",
"$",
"name",
";",
"if",
"(",
"!",
"defined",
"(",
"$",
"constant",
")",
")",
"{",
"$",
"message",
"=... | Get the value of the given constant.
@param string $name The name of the constant.
@return mixed The value of the given constant.
@throws InvalidArgumentException If no such constant exists. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"constant",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/Enum.php#L162-L172 | train |
OxfordInfoLabs/kinikit-core | src/Validation/Validator.php | Validator.validateObject | public function validateObject($object) {
if (!$object instanceof SerialisableObject) {
throw new ClassNotSerialisableException(get_class($object));
}
$classAnnotations = ClassAnnotationParser::instance()->parse($object);
$validationFields = $classAnnotations->getFieldAnnot... | php | public function validateObject($object) {
if (!$object instanceof SerialisableObject) {
throw new ClassNotSerialisableException(get_class($object));
}
$classAnnotations = ClassAnnotationParser::instance()->parse($object);
$validationFields = $classAnnotations->getFieldAnnot... | [
"public",
"function",
"validateObject",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"SerialisableObject",
")",
"{",
"throw",
"new",
"ClassNotSerialisableException",
"(",
"get_class",
"(",
"$",
"object",
")",
")",
";",
"}",
"$",... | Validate a serialisable object
@param SerialisableObject $object | [
"Validate",
"a",
"serialisable",
"object"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Validation/Validator.php#L60-L115 | train |
Wedeto/Util | src/Cache/Manager.php | Manager.setCachePath | public function setCachePath(string $path)
{
$rpath = substr($path, 0, 6) === "vfs://" ? $path : realpath($path);
if (empty($rpath) || !file_exists($path))
throw new InvalidArgumentException("Path does not exist: " . $rpath);
$this->cache_path = $rpath;
} | php | public function setCachePath(string $path)
{
$rpath = substr($path, 0, 6) === "vfs://" ? $path : realpath($path);
if (empty($rpath) || !file_exists($path))
throw new InvalidArgumentException("Path does not exist: " . $rpath);
$this->cache_path = $rpath;
} | [
"public",
"function",
"setCachePath",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"rpath",
"=",
"substr",
"(",
"$",
"path",
",",
"0",
",",
"6",
")",
"===",
"\"vfs://\"",
"?",
"$",
"path",
":",
"realpath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"em... | Set the base directory for the cache files
@param string $path The cache directory | [
"Set",
"the",
"base",
"directory",
"for",
"the",
"cache",
"files"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Manager.php#L90-L96 | train |
Wedeto/Util | src/Cache/Manager.php | Manager.setHook | public function setHook()
{
Hook::subscribe(Hook::SHUTDOWN_HOOK, [$this, 'saveCacheHook'], 10);
foreach ($this->repository as $name => $cache)
$this->checkExpiry($name);
} | php | public function setHook()
{
Hook::subscribe(Hook::SHUTDOWN_HOOK, [$this, 'saveCacheHook'], 10);
foreach ($this->repository as $name => $cache)
$this->checkExpiry($name);
} | [
"public",
"function",
"setHook",
"(",
")",
"{",
"Hook",
"::",
"subscribe",
"(",
"Hook",
"::",
"SHUTDOWN_HOOK",
",",
"[",
"$",
"this",
",",
"'saveCacheHook'",
"]",
",",
"10",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"repository",
"as",
"$",
"name",
... | Add the hook after the configuration has been loaded, and apply invalidation to the
cache once it times out. | [
"Add",
"the",
"hook",
"after",
"the",
"configuration",
"has",
"been",
"loaded",
"and",
"apply",
"invalidation",
"to",
"the",
"cache",
"once",
"it",
"times",
"out",
"."
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Manager.php#L110-L116 | train |
Wedeto/Util | src/Cache/Manager.php | Manager.unsetHook | public function unsetHook()
{
if ($this->hook_reference !== null)
{
Hook::unsubscribe(Hook::SHUTDOWN_HOOK, $this->hook_reference);
}
} | php | public function unsetHook()
{
if ($this->hook_reference !== null)
{
Hook::unsubscribe(Hook::SHUTDOWN_HOOK, $this->hook_reference);
}
} | [
"public",
"function",
"unsetHook",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hook_reference",
"!==",
"null",
")",
"{",
"Hook",
"::",
"unsubscribe",
"(",
"Hook",
"::",
"SHUTDOWN_HOOK",
",",
"$",
"this",
"->",
"hook_reference",
")",
";",
"}",
"}"
] | Remove the hook - cancelling automatic save on termination | [
"Remove",
"the",
"hook",
"-",
"cancelling",
"automatic",
"save",
"on",
"termination"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Manager.php#L121-L127 | train |
Wedeto/Util | src/Cache/Manager.php | Manager.loadCache | protected function loadCache(string $name)
{
$path = $this->cache_path;
$cache_file = $path . '/' . $name . '.cache';
if (file_exists($cache_file))
{
if (!is_readable($cache_file))
{
self::getLogger()->error("Cannot read cache from {0}", [$ca... | php | protected function loadCache(string $name)
{
$path = $this->cache_path;
$cache_file = $path . '/' . $name . '.cache';
if (file_exists($cache_file))
{
if (!is_readable($cache_file))
{
self::getLogger()->error("Cannot read cache from {0}", [$ca... | [
"protected",
"function",
"loadCache",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"cache_path",
";",
"$",
"cache_file",
"=",
"$",
"path",
".",
"'/'",
".",
"$",
"name",
".",
"'.cache'",
";",
"if",
"(",
"file_exists",
"("... | Load the cache from the cache files. The data will be stored in the class-internal cache storage
@param $name string The name of the cache to load | [
"Load",
"the",
"cache",
"from",
"the",
"cache",
"files",
".",
"The",
"data",
"will",
"be",
"stored",
"in",
"the",
"class",
"-",
"internal",
"cache",
"storage"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Manager.php#L158-L193 | train |
Wedeto/Util | src/Cache/Manager.php | Manager.getCache | public function getCache(string $name)
{
if (!isset($this->repository[$name]))
$this->loadCache($name);
return new Cache($name, $this->repository[$name]);
} | php | public function getCache(string $name)
{
if (!isset($this->repository[$name]))
$this->loadCache($name);
return new Cache($name, $this->repository[$name]);
} | [
"public",
"function",
"getCache",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"repository",
"[",
"$",
"name",
"]",
")",
")",
"$",
"this",
"->",
"loadCache",
"(",
"$",
"name",
")",
";",
"return",
"new",
"... | Return a cache | [
"Return",
"a",
"cache"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Manager.php#L246-L252 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/Generators/Generator.php | Generator.getStub | protected function getStub( $name )
{
if ( stripos( $name, '.php' ) === false )
$name = $name . '.php';
$this->files->get( $this->getStubPath() . '/' . $name );
} | php | protected function getStub( $name )
{
if ( stripos( $name, '.php' ) === false )
$name = $name . '.php';
$this->files->get( $this->getStubPath() . '/' . $name );
} | [
"protected",
"function",
"getStub",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"name",
",",
"'.php'",
")",
"===",
"false",
")",
"$",
"name",
"=",
"$",
"name",
".",
"'.php'",
";",
"$",
"this",
"->",
"files",
"->",
"get",
"(",
"$",... | Get the given stub by name.
@param string $table | [
"Get",
"the",
"given",
"stub",
"by",
"name",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Generators/Generator.php#L40-L46 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/Generators/Generator.php | Generator.parseStub | protected function parseStub( $stub, $replacements = [] )
{
$output = $stub;
foreach ( $replacements as $key => $replacement )
{
$search = '{{' . $key . '}}';
$output = str_replace( $search, $replacement, $output );
}
return $output;
} | php | protected function parseStub( $stub, $replacements = [] )
{
$output = $stub;
foreach ( $replacements as $key => $replacement )
{
$search = '{{' . $key . '}}';
$output = str_replace( $search, $replacement, $output );
}
return $output;
} | [
"protected",
"function",
"parseStub",
"(",
"$",
"stub",
",",
"$",
"replacements",
"=",
"[",
"]",
")",
"{",
"$",
"output",
"=",
"$",
"stub",
";",
"foreach",
"(",
"$",
"replacements",
"as",
"$",
"key",
"=>",
"$",
"replacement",
")",
"{",
"$",
"search",... | Parse the provided stub and replace via the array given.
@param string $stub
@param string $replacements
@return string | [
"Parse",
"the",
"provided",
"stub",
"and",
"replace",
"via",
"the",
"array",
"given",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Generators/Generator.php#L65-L76 | train |
WellCommerce/DistributionBundle | Command/Package/AbstractPackageCommand.php | AbstractPackageCommand.getCommandArguments | protected function getCommandArguments(InputInterface $input)
{
$package = $this->getPackageInformation($input->getOption('package'));
return [
$this->getComposer(),
$this->composerOperation,
$package,
];
} | php | protected function getCommandArguments(InputInterface $input)
{
$package = $this->getPackageInformation($input->getOption('package'));
return [
$this->getComposer(),
$this->composerOperation,
$package,
];
} | [
"protected",
"function",
"getCommandArguments",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"getPackageInformation",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'package'",
")",
")",
";",
"return",
"[",
"$",
"this",... | Returns command arguments used in ProcessBuilder
@param InputInterface $input
@return array | [
"Returns",
"command",
"arguments",
"used",
"in",
"ProcessBuilder"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Command/Package/AbstractPackageCommand.php#L105-L114 | train |
WellCommerce/DistributionBundle | Command/Package/AbstractPackageCommand.php | AbstractPackageCommand.getPackageInformation | protected function getPackageInformation($id)
{
$package = $this->getContainer()->get('package.repository')->find($id);
if (!$package instanceof PackageInterface) {
throw new \InvalidArgumentException(sprintf('Package "%s" not found', $id));
}
return $package->getFullNam... | php | protected function getPackageInformation($id)
{
$package = $this->getContainer()->get('package.repository')->find($id);
if (!$package instanceof PackageInterface) {
throw new \InvalidArgumentException(sprintf('Package "%s" not found', $id));
}
return $package->getFullNam... | [
"protected",
"function",
"getPackageInformation",
"(",
"$",
"id",
")",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'package.repository'",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
... | Returns package information by identifier
@param int $id Package identifier
@return string | [
"Returns",
"package",
"information",
"by",
"identifier"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Command/Package/AbstractPackageCommand.php#L123-L131 | train |
WellCommerce/DistributionBundle | Command/Package/AbstractPackageCommand.php | AbstractPackageCommand.initializeServer | protected function initializeServer(LoopInterface $loop, $port)
{
$writer = new Stream("php://output");
$logger = new Logger();
$logger->addWriter($writer);
return new WebSocketServer("tcp://0.0.0.0:{$port}", $loop, $logger);
} | php | protected function initializeServer(LoopInterface $loop, $port)
{
$writer = new Stream("php://output");
$logger = new Logger();
$logger->addWriter($writer);
return new WebSocketServer("tcp://0.0.0.0:{$port}", $loop, $logger);
} | [
"protected",
"function",
"initializeServer",
"(",
"LoopInterface",
"$",
"loop",
",",
"$",
"port",
")",
"{",
"$",
"writer",
"=",
"new",
"Stream",
"(",
"\"php://output\"",
")",
";",
"$",
"logger",
"=",
"new",
"Logger",
"(",
")",
";",
"$",
"logger",
"->",
... | Initializes web-socket server
@param LoopInterface $loop
@param int $port
@return WebSocketServer | [
"Initializes",
"web",
"-",
"socket",
"server"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Command/Package/AbstractPackageCommand.php#L159-L166 | train |
WellCommerce/DistributionBundle | Command/Package/AbstractPackageCommand.php | AbstractPackageCommand.addEnvironmentInfo | protected function addEnvironmentInfo($port, $command)
{
$translator = $this->getContainer()->get('translator');
$info = [
$translator->trans('environment.server.port') => $port,
$translator->trans('environment.console.command') => $command,
$translator->tran... | php | protected function addEnvironmentInfo($port, $command)
{
$translator = $this->getContainer()->get('translator');
$info = [
$translator->trans('environment.server.port') => $port,
$translator->trans('environment.console.command') => $command,
$translator->tran... | [
"protected",
"function",
"addEnvironmentInfo",
"(",
"$",
"port",
",",
"$",
"command",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'translator'",
")",
";",
"$",
"info",
"=",
"[",
"$",
"translator",
"... | Adds additional environment information to buffer
@param int $port
@param string $command | [
"Adds",
"additional",
"environment",
"information",
"to",
"buffer"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Command/Package/AbstractPackageCommand.php#L174-L188 | train |
WellCommerce/DistributionBundle | Command/Package/AbstractPackageCommand.php | AbstractPackageCommand.broadcastToClients | protected function broadcastToClients(\SplObjectStorage $clients)
{
foreach ($clients as $client) {
$client->sendString($this->processOutput());
}
} | php | protected function broadcastToClients(\SplObjectStorage $clients)
{
foreach ($clients as $client) {
$client->sendString($this->processOutput());
}
} | [
"protected",
"function",
"broadcastToClients",
"(",
"\\",
"SplObjectStorage",
"$",
"clients",
")",
"{",
"foreach",
"(",
"$",
"clients",
"as",
"$",
"client",
")",
"{",
"$",
"client",
"->",
"sendString",
"(",
"$",
"this",
"->",
"processOutput",
"(",
")",
")"... | Sends processed output to all connected clients | [
"Sends",
"processed",
"output",
"to",
"all",
"connected",
"clients"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Command/Package/AbstractPackageCommand.php#L193-L198 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/View.php | View.setSQL | public function setSQL($sql)
{
if ((is_string($sql) && (strlen($sql) <= 0)) || (!is_string($sql) && ($sql !== null))) {
throw SchemaException::invalidViewSQL($this->getName());
}
$this->sql = $sql;
} | php | public function setSQL($sql)
{
if ((is_string($sql) && (strlen($sql) <= 0)) || (!is_string($sql) && ($sql !== null))) {
throw SchemaException::invalidViewSQL($this->getName());
}
$this->sql = $sql;
} | [
"public",
"function",
"setSQL",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"(",
"is_string",
"(",
"$",
"sql",
")",
"&&",
"(",
"strlen",
"(",
"$",
"sql",
")",
"<=",
"0",
")",
")",
"||",
"(",
"!",
"is_string",
"(",
"$",
"sql",
")",
"&&",
"(",
"$",
... | Sets the SQL query.
@param string $sql The SQL query.
@throws \Fridge\DBAL\Exception\SchemaException If the sql is not a valid string. | [
"Sets",
"the",
"SQL",
"query",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/View.php#L56-L63 | train |
nicmart/DomainSpecificQuery | src/Lucene/Compiler/LuceneCompiler.php | LuceneCompiler.notFieldExpression | public function notFieldExpression(FieldExpression $expr, self $compiler)
{
$not = new TreeExpression('not');
$not->addChild(new FieldExpression($expr->getField(), $expr->getValue()));
return $this->notExpression($not, $compiler);
} | php | public function notFieldExpression(FieldExpression $expr, self $compiler)
{
$not = new TreeExpression('not');
$not->addChild(new FieldExpression($expr->getField(), $expr->getValue()));
return $this->notExpression($not, $compiler);
} | [
"public",
"function",
"notFieldExpression",
"(",
"FieldExpression",
"$",
"expr",
",",
"self",
"$",
"compiler",
")",
"{",
"$",
"not",
"=",
"new",
"TreeExpression",
"(",
"'not'",
")",
";",
"$",
"not",
"->",
"addChild",
"(",
"new",
"FieldExpression",
"(",
"$"... | Delegate a "not equal" field expression to the previous map
@param FieldExpression $expr
@param LuceneCompiler $compiler
@return BooleanExpression | [
"Delegate",
"a",
"not",
"equal",
"field",
"expression",
"to",
"the",
"previous",
"map"
] | 7c01fe94337afdfae5884809e8b5487127a63ac3 | https://github.com/nicmart/DomainSpecificQuery/blob/7c01fe94337afdfae5884809e8b5487127a63ac3/src/Lucene/Compiler/LuceneCompiler.php#L116-L122 | train |
nicmart/DomainSpecificQuery | src/Lucene/Compiler/LuceneCompiler.php | LuceneCompiler.phrasizeOrTermize | public function phrasizeOrTermize($value, $phrase = true, $escape = true)
{
if (!$phrase && !$escape)
return $value;
if (!is_array($value))
return $phrase
? new PhraseExpression($value)
: new TermExpression($value)
;
$ary ... | php | public function phrasizeOrTermize($value, $phrase = true, $escape = true)
{
if (!$phrase && !$escape)
return $value;
if (!is_array($value))
return $phrase
? new PhraseExpression($value)
: new TermExpression($value)
;
$ary ... | [
"public",
"function",
"phrasizeOrTermize",
"(",
"$",
"value",
",",
"$",
"phrase",
"=",
"true",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"phrase",
"&&",
"!",
"$",
"escape",
")",
"return",
"$",
"value",
";",
"if",
"(",
"!",
"... | Helper function that wraps an expression value with a phrase expression or a term expression
Phrasing wins on termizing
@param mixed $value
@param bool $phrase
@param bool $escape
@return PhraseExpression|TermExpression|string | [
"Helper",
"function",
"that",
"wraps",
"an",
"expression",
"value",
"with",
"a",
"phrase",
"expression",
"or",
"a",
"term",
"expression",
"Phrasing",
"wins",
"on",
"termizing"
] | 7c01fe94337afdfae5884809e8b5487127a63ac3 | https://github.com/nicmart/DomainSpecificQuery/blob/7c01fe94337afdfae5884809e8b5487127a63ac3/src/Lucene/Compiler/LuceneCompiler.php#L196-L213 | train |
ekyna/RequireJsBundle | Configuration/Provider.php | Provider.getMainConfig | public function getMainConfig()
{
$config = null;
if ($this->cache) {
$config = $this->cache->fetch(self::CONFIG_CACHE_KEY);
}
if (empty($config)) {
$config = $this->generateMainConfig();
if ($this->cache) {
$this->cache->save(self:... | php | public function getMainConfig()
{
$config = null;
if ($this->cache) {
$config = $this->cache->fetch(self::CONFIG_CACHE_KEY);
}
if (empty($config)) {
$config = $this->generateMainConfig();
if ($this->cache) {
$this->cache->save(self:... | [
"public",
"function",
"getMainConfig",
"(",
")",
"{",
"$",
"config",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"cache",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"cache",
"->",
"fetch",
"(",
"self",
"::",
"CONFIG_CACHE_KEY",
")",
";",
... | Fetches piece of JS-code with require.js main config from cache
or if it was not there - generates and put into a cache
@return string | [
"Fetches",
"piece",
"of",
"JS",
"-",
"code",
"with",
"require",
".",
"js",
"main",
"config",
"from",
"cache",
"or",
"if",
"it",
"was",
"not",
"there",
"-",
"generates",
"and",
"put",
"into",
"a",
"cache"
] | 2b746d25c17487838447d72a03d1050819bcf66a | https://github.com/ekyna/RequireJsBundle/blob/2b746d25c17487838447d72a03d1050819bcf66a/Configuration/Provider.php#L74-L87 | train |
ekyna/RequireJsBundle | Configuration/Provider.php | Provider.generateMainConfig | public function generateMainConfig()
{
$requirejs = $this->collectConfigs();
$config = $requirejs['config'];
if (!empty($config['paths']) && is_array($config['paths'])) {
foreach ($config['paths'] as &$path) {
if (is_array($path)) {
$path = $th... | php | public function generateMainConfig()
{
$requirejs = $this->collectConfigs();
$config = $requirejs['config'];
if (!empty($config['paths']) && is_array($config['paths'])) {
foreach ($config['paths'] as &$path) {
if (is_array($path)) {
$path = $th... | [
"public",
"function",
"generateMainConfig",
"(",
")",
"{",
"$",
"requirejs",
"=",
"$",
"this",
"->",
"collectConfigs",
"(",
")",
";",
"$",
"config",
"=",
"$",
"requirejs",
"[",
"'config'",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"config",
"[",
"... | Generates main config for require.js
@return array | [
"Generates",
"main",
"config",
"for",
"require",
".",
"js"
] | 2b746d25c17487838447d72a03d1050819bcf66a | https://github.com/ekyna/RequireJsBundle/blob/2b746d25c17487838447d72a03d1050819bcf66a/Configuration/Provider.php#L94-L114 | train |
ekyna/RequireJsBundle | Configuration/Provider.php | Provider.generateBuildConfig | public function generateBuildConfig($configPath)
{
$config = $this->collectConfigs();
$config['build']['baseUrl'] = './';
$config['build']['out'] = './' . $config['build_path'];
$config['build']['mainConfigFile'] = './' . $configPath;
$paths = [
// build-in config... | php | public function generateBuildConfig($configPath)
{
$config = $this->collectConfigs();
$config['build']['baseUrl'] = './';
$config['build']['out'] = './' . $config['build_path'];
$config['build']['mainConfigFile'] = './' . $configPath;
$paths = [
// build-in config... | [
"public",
"function",
"generateBuildConfig",
"(",
"$",
"configPath",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"collectConfigs",
"(",
")",
";",
"$",
"config",
"[",
"'build'",
"]",
"[",
"'baseUrl'",
"]",
"=",
"'./'",
";",
"$",
"config",
"[",
"'bu... | Generates build config for require.js
@param string $configPath path to require.js main config
@return array | [
"Generates",
"build",
"config",
"for",
"require",
".",
"js"
] | 2b746d25c17487838447d72a03d1050819bcf66a | https://github.com/ekyna/RequireJsBundle/blob/2b746d25c17487838447d72a03d1050819bcf66a/Configuration/Provider.php#L122-L141 | train |
ekyna/RequireJsBundle | Configuration/Provider.php | Provider.collectConfigs | public function collectConfigs()
{
if (!$this->collectedConfig) {
$config = $this->config;
foreach ($this->bundles as $bundle) {
$reflection = new \ReflectionClass($bundle);
if (is_file($file = dirname($reflection->getFileName()) . '/Resources/config/r... | php | public function collectConfigs()
{
if (!$this->collectedConfig) {
$config = $this->config;
foreach ($this->bundles as $bundle) {
$reflection = new \ReflectionClass($bundle);
if (is_file($file = dirname($reflection->getFileName()) . '/Resources/config/r... | [
"public",
"function",
"collectConfigs",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"collectedConfig",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"foreach",
"(",
"$",
"this",
"->",
"bundles",
"as",
"$",
"bundle",
")",
"{",
... | Goes across bundles and collects configurations
@return array | [
"Goes",
"across",
"bundles",
"and",
"collects",
"configurations"
] | 2b746d25c17487838447d72a03d1050819bcf66a | https://github.com/ekyna/RequireJsBundle/blob/2b746d25c17487838447d72a03d1050819bcf66a/Configuration/Provider.php#L148-L162 | train |
miBadger/miBadger.Mvc | src/View.php | View.get | public static function get($path, $data = [])
{
ob_start();
extract($data);
try {
$basePath = static::getInstance()->basePath;
if ($basePath !== null) {
if (mb_substr($path, 0, 1) === static::DIRECTORY_SEPARATOR) {
$path = mb_substr($path, 1);
}
if (mb_substr($basePath, -1) === static:... | php | public static function get($path, $data = [])
{
ob_start();
extract($data);
try {
$basePath = static::getInstance()->basePath;
if ($basePath !== null) {
if (mb_substr($path, 0, 1) === static::DIRECTORY_SEPARATOR) {
$path = mb_substr($path, 1);
}
if (mb_substr($basePath, -1) === static:... | [
"public",
"static",
"function",
"get",
"(",
"$",
"path",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"ob_start",
"(",
")",
";",
"extract",
"(",
"$",
"data",
")",
";",
"try",
"{",
"$",
"basePath",
"=",
"static",
"::",
"getInstance",
"(",
")",
"->",... | Returns the view at the given path with the given data.
@param string $path
@param string[] $data = []
@return string a string representation of the view. | [
"Returns",
"the",
"view",
"at",
"the",
"given",
"path",
"with",
"the",
"given",
"data",
"."
] | d6725938a7c7c198deacb907c0db03e5db110d77 | https://github.com/miBadger/miBadger.Mvc/blob/d6725938a7c7c198deacb907c0db03e5db110d77/src/View.php#L64-L92 | train |
bytic/orm | src/Navigator/Pagination/AbstractPaginator.php | AbstractPaginator.doCount | protected function doCount()
{
$query = $this->getCountQuery();
$result = $query->execute()->fetchResult();
$this->count = intval($result['count']);
$this->pages = intval($this->count / $this->itemsPerPage);
if ($this->count % $this->itemsPerPage != 0) {
$this->... | php | protected function doCount()
{
$query = $this->getCountQuery();
$result = $query->execute()->fetchResult();
$this->count = intval($result['count']);
$this->pages = intval($this->count / $this->itemsPerPage);
if ($this->count % $this->itemsPerPage != 0) {
$this->... | [
"protected",
"function",
"doCount",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getCountQuery",
"(",
")",
";",
"$",
"result",
"=",
"$",
"query",
"->",
"execute",
"(",
")",
"->",
"fetchResult",
"(",
")",
";",
"$",
"this",
"->",
"count",
"=... | Does the count for all records | [
"Does",
"the",
"count",
"for",
"all",
"records"
] | 8d9a79b47761af0bfd9b8d1d28c83221dcac0de0 | https://github.com/bytic/orm/blob/8d9a79b47761af0bfd9b8d1d28c83221dcac0de0/src/Navigator/Pagination/AbstractPaginator.php#L79-L94 | train |
brightnucleus/options-store | src/OptionRepository/IdentityMap.php | IdentityMap.getOption | public function getOption(string $key): Option
{
if (! $this->has($key)) {
throw UnknownOptionKey::fromKey($key);
}
return $this->map[$key][self::SUBKEY_OPTION];
} | php | public function getOption(string $key): Option
{
if (! $this->has($key)) {
throw UnknownOptionKey::fromKey($key);
}
return $this->map[$key][self::SUBKEY_OPTION];
} | [
"public",
"function",
"getOption",
"(",
"string",
"$",
"key",
")",
":",
"Option",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"UnknownOptionKey",
"::",
"fromKey",
"(",
"$",
"key",
")",
";",
"}",
"return",... | Get the associated option for a specific key.
@since 0.1.0
@param string $key Key to fetch the option for.
@return Option The option that is associated with the requested key. | [
"Get",
"the",
"associated",
"option",
"for",
"a",
"specific",
"key",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionRepository/IdentityMap.php#L90-L97 | train |
brightnucleus/options-store | src/OptionRepository/IdentityMap.php | IdentityMap.getRepository | public function getRepository(string $key): OptionRepository
{
if (! $this->has($key)) {
throw UnknownOptionKey::fromKey($key);
}
return $this->map[$key][self::SUBKEY_REPOSITORY];
} | php | public function getRepository(string $key): OptionRepository
{
if (! $this->has($key)) {
throw UnknownOptionKey::fromKey($key);
}
return $this->map[$key][self::SUBKEY_REPOSITORY];
} | [
"public",
"function",
"getRepository",
"(",
"string",
"$",
"key",
")",
":",
"OptionRepository",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"UnknownOptionKey",
"::",
"fromKey",
"(",
"$",
"key",
")",
";",
"}... | Get the associated repository for a specific key.
@since 0.1.0
@param string $key Key to fetch the repository for.
@return OptionRepository The repository that is associated with the requested key. | [
"Get",
"the",
"associated",
"repository",
"for",
"a",
"specific",
"key",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionRepository/IdentityMap.php#L108-L115 | train |
brightnucleus/options-store | src/OptionRepository/IdentityMap.php | IdentityMap.put | public function put(Option $option, OptionRepository $repository): Option
{
$this->map[$option->getKey()] = [
self::SUBKEY_OPTION => $option,
self::SUBKEY_REPOSITORY => $repository,
];
return $option;
} | php | public function put(Option $option, OptionRepository $repository): Option
{
$this->map[$option->getKey()] = [
self::SUBKEY_OPTION => $option,
self::SUBKEY_REPOSITORY => $repository,
];
return $option;
} | [
"public",
"function",
"put",
"(",
"Option",
"$",
"option",
",",
"OptionRepository",
"$",
"repository",
")",
":",
"Option",
"{",
"$",
"this",
"->",
"map",
"[",
"$",
"option",
"->",
"getKey",
"(",
")",
"]",
"=",
"[",
"self",
"::",
"SUBKEY_OPTION",
"=>",
... | Put a new association into the identity map.
@since 0.1.0
@param Option $option Option to store for the given key.
@param OptionRepository $repository Repository to store for the given key.
@return Option $option Option that was stored in the identity map. This might differ from the passed-in $option. | [
"Put",
"a",
"new",
"association",
"into",
"the",
"identity",
"map",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionRepository/IdentityMap.php#L127-L135 | train |
dmitrya2e/filtration-bundle | Form/Creator/FormCreator.php | FormCreator.createForm | protected function createForm(
CollectionInterface $filterCollection,
$name = null,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = []
) {
// Create the root form builder, which is used as the container for all filter forms.
$rootFormBui... | php | protected function createForm(
CollectionInterface $filterCollection,
$name = null,
array $rootFormBuilderOptions = [],
array $filterFormBuilderOptions = []
) {
// Create the root form builder, which is used as the container for all filter forms.
$rootFormBui... | [
"protected",
"function",
"createForm",
"(",
"CollectionInterface",
"$",
"filterCollection",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"rootFormBuilderOptions",
"=",
"[",
"]",
",",
"array",
"$",
"filterFormBuilderOptions",
"=",
"[",
"]",
")",
"{",
"// C... | Creates the filtration form.
@param CollectionInterface $filterCollection The collection of the filters
@param null|string $name (Optional) The name of the root form
@param array $rootFormBuilderOptions (Optional) The options for the root form
@param array ... | [
"Creates",
"the",
"filtration",
"form",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Form/Creator/FormCreator.php#L95-L129 | train |
dmitrya2e/filtration-bundle | Form/Creator/FormCreator.php | FormCreator.appendFormField | protected function appendFormField(FilterHasFormInterface $filter, FormBuilderInterface $filterFormBuilder)
{
if (!($filter instanceof CustomAppendFormFieldsInterface)) {
$filter->appendFormFieldsToForm($filterFormBuilder);
return $filter;
}
$callableFunctio... | php | protected function appendFormField(FilterHasFormInterface $filter, FormBuilderInterface $filterFormBuilder)
{
if (!($filter instanceof CustomAppendFormFieldsInterface)) {
$filter->appendFormFieldsToForm($filterFormBuilder);
return $filter;
}
$callableFunctio... | [
"protected",
"function",
"appendFormField",
"(",
"FilterHasFormInterface",
"$",
"filter",
",",
"FormBuilderInterface",
"$",
"filterFormBuilder",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"filter",
"instanceof",
"CustomAppendFormFieldsInterface",
")",
")",
"{",
"$",
"filte... | The main "actor" here.
Appends a filter to the representation form.
If the filter has defined a custom function for form appending, than it will be used.
@param FilterHasFormInterface $filter The filter
@param FormBuilderInterface $filterFormBuilder A form builder for a specific filter
@return FilterHasF... | [
"The",
"main",
"actor",
"here",
".",
"Appends",
"a",
"filter",
"to",
"the",
"representation",
"form",
".",
"If",
"the",
"filter",
"has",
"defined",
"a",
"custom",
"function",
"for",
"form",
"appending",
"than",
"it",
"will",
"be",
"used",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Form/Creator/FormCreator.php#L141-L161 | train |
dmitrya2e/filtration-bundle | Form/Creator/FormCreator.php | FormCreator.createFormBuilder | protected function createFormBuilder($name = null, $type = 'form', $data = null, array $options = [])
{
if ($name !== null) {
return $this->formFactory->createNamedBuilder($name, $type, $data, $options);
}
return $this->formFactory->createBuilder($type, $data, $options);
... | php | protected function createFormBuilder($name = null, $type = 'form', $data = null, array $options = [])
{
if ($name !== null) {
return $this->formFactory->createNamedBuilder($name, $type, $data, $options);
}
return $this->formFactory->createBuilder($type, $data, $options);
... | [
"protected",
"function",
"createFormBuilder",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"type",
"=",
"'form'",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"null",
")",
"{",
"... | Creates and returns a form builder.
@param null|string $name For named form builder must not be null
@param string|object $type Form type
@param mixed|null $data Form data
@param array $options Form builder options
@return FormBuilderInterface | [
"Creates",
"and",
"returns",
"a",
"form",
"builder",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Form/Creator/FormCreator.php#L173-L180 | train |
dmitrya2e/filtration-bundle | Form/Creator/FormCreator.php | FormCreator.validateConfig | protected function validateConfig(array $config)
{
// For now it's only required to pass a filter form type class.
// If you don't want to use a defined form type class,
// you can override the FormCreator object, implement FormCreatorInterface and customize it.
$requiredKeys = ... | php | protected function validateConfig(array $config)
{
// For now it's only required to pass a filter form type class.
// If you don't want to use a defined form type class,
// you can override the FormCreator object, implement FormCreatorInterface and customize it.
$requiredKeys = ... | [
"protected",
"function",
"validateConfig",
"(",
"array",
"$",
"config",
")",
"{",
"// For now it's only required to pass a filter form type class.\r",
"// If you don't want to use a defined form type class,\r",
"// you can override the FormCreator object, implement FormCreatorInterface and cus... | Validates configuration.
@param array $config
@throws FormCreatorException | [
"Validates",
"configuration",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Form/Creator/FormCreator.php#L199-L217 | train |
gplcart/cli | controllers/commands/CategoryGroup.php | CategoryGroup.cmdGetCategoryGroup | public function cmdGetCategoryGroup()
{
$result = $this->getListCategoryGroup();
$this->outputFormat($result);
$this->outputFormatTableCategoryGroup($result);
$this->output();
} | php | public function cmdGetCategoryGroup()
{
$result = $this->getListCategoryGroup();
$this->outputFormat($result);
$this->outputFormatTableCategoryGroup($result);
$this->output();
} | [
"public",
"function",
"cmdGetCategoryGroup",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListCategoryGroup",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableCategoryGroup",
"(... | Callback for "category-group-get" command | [
"Callback",
"for",
"category",
"-",
"group",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CategoryGroup.php#L40-L46 | train |
gplcart/cli | controllers/commands/CategoryGroup.php | CategoryGroup.cmdUpdateCategoryGroup | public function cmdUpdateCategoryGroup()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));... | php | public function cmdUpdateCategoryGroup()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));... | [
"public",
"function",
"cmdUpdateCategoryGroup",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{... | Callback for "category-group-update" command | [
"Callback",
"for",
"category",
"-",
"group",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CategoryGroup.php#L110-L128 | train |
gplcart/cli | controllers/commands/CategoryGroup.php | CategoryGroup.addCategoryGroup | protected function addCategoryGroup()
{
if (!$this->isError()) {
$id = $this->category_group->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addCategoryGroup()
{
if (!$this->isError()) {
$id = $this->category_group->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addCategoryGroup",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"category_group",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
"... | Add a new category group | [
"Add",
"a",
"new",
"category",
"group"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CategoryGroup.php#L193-L202 | train |
gplcart/cli | controllers/commands/CategoryGroup.php | CategoryGroup.submitAddCategoryGroup | protected function submitAddCategoryGroup()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('category_group');
$this->addCategoryGroup();
} | php | protected function submitAddCategoryGroup()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('category_group');
$this->addCategoryGroup();
} | [
"protected",
"function",
"submitAddCategoryGroup",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'category_group'",
")",
";",
"$",
"this"... | Add a new category group at once | [
"Add",
"a",
"new",
"category",
"group",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CategoryGroup.php#L218-L223 | train |
gplcart/cli | controllers/commands/CategoryGroup.php | CategoryGroup.wizardAddCategoryGroup | protected function wizardAddCategoryGroup()
{
$this->validatePrompt('title', $this->text('Name'), 'category_group');
$this->validatePrompt('store_id', $this->text('Store ID'), 'category_group');
$this->validateMenu('type', $this->text('Type'), 'category_group', $this->category_group->getType... | php | protected function wizardAddCategoryGroup()
{
$this->validatePrompt('title', $this->text('Name'), 'category_group');
$this->validatePrompt('store_id', $this->text('Store ID'), 'category_group');
$this->validateMenu('type', $this->text('Type'), 'category_group', $this->category_group->getType... | [
"protected",
"function",
"wizardAddCategoryGroup",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'title'",
",",
"$",
"this",
"->",
"text",
"(",
"'Name'",
")",
",",
"'category_group'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'store_id... | Add a new category group step by step | [
"Add",
"a",
"new",
"category",
"group",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CategoryGroup.php#L228-L236 | train |
agentmedia/phine-core | src/Core/Snippets/BackendRights/Base/RightsCheckboxes.php | RightsCheckboxes.RenderCheckbox | protected function RenderCheckbox($name)
{
$checkbox = new Checkbox($this->namePrefix . $name);
$class = new \ReflectionClass($this);
$checkbox->SetLabel(Trans('Core.' . $class->getShortName() . '.' . $name));
if ($this->Value($name))
{
$checkbox->SetChecked();
... | php | protected function RenderCheckbox($name)
{
$checkbox = new Checkbox($this->namePrefix . $name);
$class = new \ReflectionClass($this);
$checkbox->SetLabel(Trans('Core.' . $class->getShortName() . '.' . $name));
if ($this->Value($name))
{
$checkbox->SetChecked();
... | [
"protected",
"function",
"RenderCheckbox",
"(",
"$",
"name",
")",
"{",
"$",
"checkbox",
"=",
"new",
"Checkbox",
"(",
"$",
"this",
"->",
"namePrefix",
".",
"$",
"name",
")",
";",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
... | Renders a specific checkbox
@param string $name
@return string | [
"Renders",
"a",
"specific",
"checkbox"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/BackendRights/Base/RightsCheckboxes.php#L51-L62 | train |
agentmedia/phine-core | src/Core/Snippets/BackendRights/Base/RightsCheckboxes.php | RightsCheckboxes.Value | protected function Value($name)
{
if (Request::IsPost())
{
return (bool)trim(Request::PostData($this->namePrefix . $name));
}
if ($this->Rights())
{
return $this->Rights()->$name;
}
if ($this->ParentRights())
{
retur... | php | protected function Value($name)
{
if (Request::IsPost())
{
return (bool)trim(Request::PostData($this->namePrefix . $name));
}
if ($this->Rights())
{
return $this->Rights()->$name;
}
if ($this->ParentRights())
{
retur... | [
"protected",
"function",
"Value",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"Request",
"::",
"IsPost",
"(",
")",
")",
"{",
"return",
"(",
"bool",
")",
"trim",
"(",
"Request",
"::",
"PostData",
"(",
"$",
"this",
"->",
"namePrefix",
".",
"$",
"name",
")... | Gets the posted value of the name, optional name prefix automatically attached
@param string $name The checkbox name without prefix | [
"Gets",
"the",
"posted",
"value",
"of",
"the",
"name",
"optional",
"name",
"prefix",
"automatically",
"attached"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/BackendRights/Base/RightsCheckboxes.php#L67-L82 | train |
leogitpro/php-network | src/Client.php | Client.reset | public function reset()
{
$this->_headers->clearHeaders();
$this->params = [];
$this->postRawData = null;
$this->httpClient->reset();
return $this;
} | php | public function reset()
{
$this->_headers->clearHeaders();
$this->params = [];
$this->postRawData = null;
$this->httpClient->reset();
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"_headers",
"->",
"clearHeaders",
"(",
")",
";",
"$",
"this",
"->",
"params",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"postRawData",
"=",
"null",
";",
"$",
"this",
"->",
"httpClient",
... | Reset request information
@return Client | [
"Reset",
"request",
"information"
] | 6428e5081dce336ef36edcca28d8ea2b45bd2fce | https://github.com/leogitpro/php-network/blob/6428e5081dce336ef36edcca28d8ea2b45bd2fce/src/Client.php#L172-L179 | train |
leogitpro/php-network | src/Client.php | Client.send | public function send()
{
if (empty($this->uri)) {
throw new InvalidArgumentException('Invalid url for request.');
}
$customRequest = new Request();
$customRequest->setHeaders($this->_headers);
$this->httpClient->setRequest($customRequest);
$this->httpCli... | php | public function send()
{
if (empty($this->uri)) {
throw new InvalidArgumentException('Invalid url for request.');
}
$customRequest = new Request();
$customRequest->setHeaders($this->_headers);
$this->httpClient->setRequest($customRequest);
$this->httpCli... | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"uri",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid url for request.'",
")",
";",
"}",
"$",
"customRequest",
"=",
"new",
"Request",
"(",
... | Send http request
@throws InvalidArgumentException
@throws RuntimeException
@return Response | [
"Send",
"http",
"request"
] | 6428e5081dce336ef36edcca28d8ea2b45bd2fce | https://github.com/leogitpro/php-network/blob/6428e5081dce336ef36edcca28d8ea2b45bd2fce/src/Client.php#L291-L334 | train |
leogitpro/php-network | src/Client.php | Client.genericDefaultHeaders | private function genericDefaultHeaders()
{
//Cache-Control: no-cache
$this->addRawHeaderLine('Cache-Control', 'no-cache');
//Pragma: no-cache
$this->addRawHeaderLine('Pragma', 'no-cache');
//Connection: keep-alive
$this->addRawHeaderLine('Connection', 'keep-alive')... | php | private function genericDefaultHeaders()
{
//Cache-Control: no-cache
$this->addRawHeaderLine('Cache-Control', 'no-cache');
//Pragma: no-cache
$this->addRawHeaderLine('Pragma', 'no-cache');
//Connection: keep-alive
$this->addRawHeaderLine('Connection', 'keep-alive')... | [
"private",
"function",
"genericDefaultHeaders",
"(",
")",
"{",
"//Cache-Control: no-cache",
"$",
"this",
"->",
"addRawHeaderLine",
"(",
"'Cache-Control'",
",",
"'no-cache'",
")",
";",
"//Pragma: no-cache",
"$",
"this",
"->",
"addRawHeaderLine",
"(",
"'Pragma'",
",",
... | Default request headers | [
"Default",
"request",
"headers"
] | 6428e5081dce336ef36edcca28d8ea2b45bd2fce | https://github.com/leogitpro/php-network/blob/6428e5081dce336ef36edcca28d8ea2b45bd2fce/src/Client.php#L339-L363 | train |
koolkode/k2 | src/Log/LoggerManager.php | LoggerManager.getLogger | public function getLogger(ExposedContainerInterface $container, InjectionPointInterface $point = NULL)
{
$channel = ($point === NULL) ? 'app' : str_replace('\\', '.', $point->getTypeName());
if(isset($this->loggers[$channel]))
{
return $this->loggers[$channel];
}
$logger = new Logger($channel);
$l... | php | public function getLogger(ExposedContainerInterface $container, InjectionPointInterface $point = NULL)
{
$channel = ($point === NULL) ? 'app' : str_replace('\\', '.', $point->getTypeName());
if(isset($this->loggers[$channel]))
{
return $this->loggers[$channel];
}
$logger = new Logger($channel);
$l... | [
"public",
"function",
"getLogger",
"(",
"ExposedContainerInterface",
"$",
"container",
",",
"InjectionPointInterface",
"$",
"point",
"=",
"NULL",
")",
"{",
"$",
"channel",
"=",
"(",
"$",
"point",
"===",
"NULL",
")",
"?",
"'app'",
":",
"str_replace",
"(",
"'\... | Obtain a logger instance, the log channel will consist of the type name provided by the injection point
where all namespace separators will be replaced by periods.
@param ExposedContainerInterface $container DI container being used for log handler creation.
@param InjectionPointInterface $point The target of the injec... | [
"Obtain",
"a",
"logger",
"instance",
"the",
"log",
"channel",
"will",
"consist",
"of",
"the",
"type",
"name",
"provided",
"by",
"the",
"injection",
"point",
"where",
"all",
"namespace",
"separators",
"will",
"be",
"replaced",
"by",
"periods",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Log/LoggerManager.php#L69-L103 | train |
koolkode/k2 | src/Log/LoggerManager.php | LoggerManager.replaceSpecialChars | protected function replaceSpecialChars($input)
{
if(is_array($input))
{
$result = [];
foreach($input as $k => $v)
{
$result[$k] = $this->replaceSpecialChars($v);
}
return $result;
}
return strtr($input, [
'\n' => "\n",
'\t' => "\t"
]);
} | php | protected function replaceSpecialChars($input)
{
if(is_array($input))
{
$result = [];
foreach($input as $k => $v)
{
$result[$k] = $this->replaceSpecialChars($v);
}
return $result;
}
return strtr($input, [
'\n' => "\n",
'\t' => "\t"
]);
} | [
"protected",
"function",
"replaceSpecialChars",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"input",
")",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"input",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
... | Recursively replaces special escape characters for line breaks and tabs with according characters.
@param mixed $input
@return mixed | [
"Recursively",
"replaces",
"special",
"escape",
"characters",
"for",
"line",
"breaks",
"and",
"tabs",
"with",
"according",
"characters",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Log/LoggerManager.php#L158-L176 | train |
ekyna/Table | Bridge/Doctrine/ORM/Source/EntityAdapter.php | EntityAdapter.getQueryBuilderPath | public function getQueryBuilderPath($propertyPath)
{
if (false === strpos($propertyPath, '.')) {
return $this->alias . '.' . $propertyPath;
}
if (isset($this->paths[$propertyPath])) {
return $this->paths[$propertyPath];
}
$paths = explode('.', $prope... | php | public function getQueryBuilderPath($propertyPath)
{
if (false === strpos($propertyPath, '.')) {
return $this->alias . '.' . $propertyPath;
}
if (isset($this->paths[$propertyPath])) {
return $this->paths[$propertyPath];
}
$paths = explode('.', $prope... | [
"public",
"function",
"getQueryBuilderPath",
"(",
"$",
"propertyPath",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"propertyPath",
",",
"'.'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"alias",
".",
"'.'",
".",
"$",
"propertyPath",
";",
... | Converts the property path to a query builder path and configures the necessary joins.
@param string $propertyPath
@return string | [
"Converts",
"the",
"property",
"path",
"to",
"a",
"query",
"builder",
"path",
"and",
"configures",
"the",
"necessary",
"joins",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Bridge/Doctrine/ORM/Source/EntityAdapter.php#L94-L139 | train |
ekyna/Table | Bridge/Doctrine/ORM/Source/EntityAdapter.php | EntityAdapter.getClassMetadata | private function getClassMetadata()
{
if (null !== $this->metadata) {
return $this->metadata;
}
return $this->metadata = $this->manager->getClassMetadata($this->getSource()->getClass());
} | php | private function getClassMetadata()
{
if (null !== $this->metadata) {
return $this->metadata;
}
return $this->metadata = $this->manager->getClassMetadata($this->getSource()->getClass());
} | [
"private",
"function",
"getClassMetadata",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"metadata",
")",
"{",
"return",
"$",
"this",
"->",
"metadata",
";",
"}",
"return",
"$",
"this",
"->",
"metadata",
"=",
"$",
"this",
"->",
"manager",
... | Returns the class metadata.
@return ClassMetadata | [
"Returns",
"the",
"class",
"metadata",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Bridge/Doctrine/ORM/Source/EntityAdapter.php#L242-L249 | train |
OpenConext-Attic/OpenConext-engineblock-metadata | src/AttributeReleasePolicy.php | AttributeReleasePolicy.getRulesWithSourceSpecification | public function getRulesWithSourceSpecification()
{
$rulesWithSource = [];
foreach ($this->attributeRules as $name => $rules) {
$rulesWithSource[$name] = array_filter(
$rules,
function ($rule) {
return isset($rule['source']);
... | php | public function getRulesWithSourceSpecification()
{
$rulesWithSource = [];
foreach ($this->attributeRules as $name => $rules) {
$rulesWithSource[$name] = array_filter(
$rules,
function ($rule) {
return isset($rule['source']);
... | [
"public",
"function",
"getRulesWithSourceSpecification",
"(",
")",
"{",
"$",
"rulesWithSource",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributeRules",
"as",
"$",
"name",
"=>",
"$",
"rules",
")",
"{",
"$",
"rulesWithSource",
"[",
"$",
"nam... | Return all attribute rules eligible for attribute aggregation.
A rule is eligible for attribute aggregation if it contains a source.
@return array | [
"Return",
"all",
"attribute",
"rules",
"eligible",
"for",
"attribute",
"aggregation",
"."
] | 236e2f52ef9cf28e71404544a1c4388f63ee535d | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/AttributeReleasePolicy.php#L87-L101 | train |
OpenConext-Attic/OpenConext-engineblock-metadata | src/AttributeReleasePolicy.php | AttributeReleasePolicy.getSource | public function getSource($attributeName)
{
if ($this->hasAttribute($attributeName) && isset($this->attributeRules[$attributeName][0]['source'])) {
return $this->attributeRules[$attributeName][0]['source'];
}
return 'idp';
} | php | public function getSource($attributeName)
{
if ($this->hasAttribute($attributeName) && isset($this->attributeRules[$attributeName][0]['source'])) {
return $this->attributeRules[$attributeName][0]['source'];
}
return 'idp';
} | [
"public",
"function",
"getSource",
"(",
"$",
"attributeName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"attributeName",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"attributeRules",
"[",
"$",
"attributeName",
"]",
"[",
"0",
"]",
... | Loads the first source it finds in the list of attribute rules for the given attributeName.
@param $attributeName
@return string | [
"Loads",
"the",
"first",
"source",
"it",
"finds",
"in",
"the",
"list",
"of",
"attribute",
"rules",
"for",
"the",
"given",
"attributeName",
"."
] | 236e2f52ef9cf28e71404544a1c4388f63ee535d | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/AttributeReleasePolicy.php#L182-L188 | train |
phpffcms/ffcms-core | src/Managers/EventManager.php | EventManager.on | public function on($event, \Closure $callback): void
{
// check if event is a single string and parse it to array single item
if (!Any::isArray($event)) {
$event = [$event];
}
foreach ($event as $item) {
$this->events[$item][] = $callback;
}
... | php | public function on($event, \Closure $callback): void
{
// check if event is a single string and parse it to array single item
if (!Any::isArray($event)) {
$event = [$event];
}
foreach ($event as $item) {
$this->events[$item][] = $callback;
}
... | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"\\",
"Closure",
"$",
"callback",
")",
":",
"void",
"{",
"// check if event is a single string and parse it to array single item",
"if",
"(",
"!",
"Any",
"::",
"isArray",
"(",
"$",
"event",
")",
")",
"{",
"$"... | Catch the event if it occurred after this initiation of interception
@param string|array $event
@param \Closure $callback | [
"Catch",
"the",
"event",
"if",
"it",
"occurred",
"after",
"this",
"initiation",
"of",
"interception"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Managers/EventManager.php#L34-L44 | train |
phpffcms/ffcms-core | src/Managers/EventManager.php | EventManager.listen | public function listen($event, \Closure $callback): void
{
// check if $event is a single string and set it as array with one item
if (!Any::isArray($event)) {
$event = [$event];
}
// each every one event in array
foreach ($event as $item) {
i... | php | public function listen($event, \Closure $callback): void
{
// check if $event is a single string and set it as array with one item
if (!Any::isArray($event)) {
$event = [$event];
}
// each every one event in array
foreach ($event as $item) {
i... | [
"public",
"function",
"listen",
"(",
"$",
"event",
",",
"\\",
"Closure",
"$",
"callback",
")",
":",
"void",
"{",
"// check if $event is a single string and set it as array with one item",
"if",
"(",
"!",
"Any",
"::",
"isArray",
"(",
"$",
"event",
")",
")",
"{",
... | Catch the event if it occurred before the initiation of interception
@param string|array $event
@param \Closure $callback
@return void | [
"Catch",
"the",
"event",
"if",
"it",
"occurred",
"before",
"the",
"initiation",
"of",
"interception"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Managers/EventManager.php#L52-L65 | train |
phpffcms/ffcms-core | src/Managers/EventManager.php | EventManager.run | public function run(): void
{
// dynamicly parse input params
$args = func_get_args();
if (count($args) < 1) {
return;
}
// get event name
$eventName = array_shift($args);
// get event args as array if passed
$eventArgs = ... | php | public function run(): void
{
// dynamicly parse input params
$args = func_get_args();
if (count($args) < 1) {
return;
}
// get event name
$eventName = array_shift($args);
// get event args as array if passed
$eventArgs = ... | [
"public",
"function",
"run",
"(",
")",
":",
"void",
"{",
"// dynamicly parse input params",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"<",
"1",
")",
"{",
"return",
";",
"}",
"// get event name",
"$",
"... | Process event on happens
@return void | [
"Process",
"event",
"on",
"happens"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Managers/EventManager.php#L71-L95 | train |
miguelibero/meinhof | src/Meinhof/DependencyInjection/Compiler/EventListenerPass.php | EventListenerPass.getMethodFromAttributes | protected function getMethodFromAttributes($attrs)
{
if (!is_array($attrs) || !isset($attrs['method'])) {
return $this->getEventFromAttributes($attrs);
}
return $attrs['method'];
} | php | protected function getMethodFromAttributes($attrs)
{
if (!is_array($attrs) || !isset($attrs['method'])) {
return $this->getEventFromAttributes($attrs);
}
return $attrs['method'];
} | [
"protected",
"function",
"getMethodFromAttributes",
"(",
"$",
"attrs",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attrs",
")",
"||",
"!",
"isset",
"(",
"$",
"attrs",
"[",
"'method'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getEventFromA... | Returns the event method from the tag attributes.
@param mixed $attrs tag attributes
@return string event method | [
"Returns",
"the",
"event",
"method",
"from",
"the",
"tag",
"attributes",
"."
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/DependencyInjection/Compiler/EventListenerPass.php#L56-L63 | train |
miguelibero/meinhof | src/Meinhof/DependencyInjection/Compiler/EventListenerPass.php | EventListenerPass.getPriorityFromAttributes | protected function getPriorityFromAttributes($attrs)
{
if (!is_array($attrs) || !isset($attrs['priority'])) {
return 0;
}
$p = intval($attrs['priority']);
return $p < 0 ? 0 : $p;
} | php | protected function getPriorityFromAttributes($attrs)
{
if (!is_array($attrs) || !isset($attrs['priority'])) {
return 0;
}
$p = intval($attrs['priority']);
return $p < 0 ? 0 : $p;
} | [
"protected",
"function",
"getPriorityFromAttributes",
"(",
"$",
"attrs",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attrs",
")",
"||",
"!",
"isset",
"(",
"$",
"attrs",
"[",
"'priority'",
"]",
")",
")",
"{",
"return",
"0",
";",
"}",
"$",
"p",
... | Returns the event priority from the tag attributes.
If no priority specified returns priority 0.
@param mixed $attrs tag attributes
@return string event priotity | [
"Returns",
"the",
"event",
"priority",
"from",
"the",
"tag",
"attributes",
".",
"If",
"no",
"priority",
"specified",
"returns",
"priority",
"0",
"."
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/DependencyInjection/Compiler/EventListenerPass.php#L73-L81 | train |
alexlcdee/colorcli | src/Logger.php | Logger.checkLevel | public function checkLevel($level)
{
if (static::$levels === null) {
// Psr\Log does not provide Enum, so we need to load levels from LogLevel constants
$reflection = new \ReflectionClass(LogLevel::class);
static::$levels = $reflection->getConstants();
}
... | php | public function checkLevel($level)
{
if (static::$levels === null) {
// Psr\Log does not provide Enum, so we need to load levels from LogLevel constants
$reflection = new \ReflectionClass(LogLevel::class);
static::$levels = $reflection->getConstants();
}
... | [
"public",
"function",
"checkLevel",
"(",
"$",
"level",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"levels",
"===",
"null",
")",
"{",
"// Psr\\Log does not provide Enum, so we need to load levels from LogLevel constants",
"$",
"reflection",
"=",
"new",
"\\",
"Reflection... | Check if level exists in list of possible levels
Psr\Log suggests to throw Psr\Log\InvalidArgumentException if incompatible log level passed
@param mixed $level
@throws InvalidArgumentException | [
"Check",
"if",
"level",
"exists",
"in",
"list",
"of",
"possible",
"levels",
"Psr",
"\\",
"Log",
"suggests",
"to",
"throw",
"Psr",
"\\",
"Log",
"\\",
"InvalidArgumentException",
"if",
"incompatible",
"log",
"level",
"passed"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L61-L73 | train |
alexlcdee/colorcli | src/Logger.php | Logger.resetFGColors | public function resetFGColors()
{
static::$foregroundColorMap = [
LogLevel::EMERGENCY => ForegroundColors::YELLOW(),
LogLevel::ALERT => ForegroundColors::WHITE(),
LogLevel::CRITICAL => ForegroundColors::RED(),
LogLevel::ERROR => ForegroundColors::LIGHT_RED(),
... | php | public function resetFGColors()
{
static::$foregroundColorMap = [
LogLevel::EMERGENCY => ForegroundColors::YELLOW(),
LogLevel::ALERT => ForegroundColors::WHITE(),
LogLevel::CRITICAL => ForegroundColors::RED(),
LogLevel::ERROR => ForegroundColors::LIGHT_RED(),
... | [
"public",
"function",
"resetFGColors",
"(",
")",
"{",
"static",
"::",
"$",
"foregroundColorMap",
"=",
"[",
"LogLevel",
"::",
"EMERGENCY",
"=>",
"ForegroundColors",
"::",
"YELLOW",
"(",
")",
",",
"LogLevel",
"::",
"ALERT",
"=>",
"ForegroundColors",
"::",
"WHITE... | Set foreground colors map to default ones | [
"Set",
"foreground",
"colors",
"map",
"to",
"default",
"ones"
] | 2107917987f6c300ac5ce4a26102c9bf8e6b3d95 | https://github.com/alexlcdee/colorcli/blob/2107917987f6c300ac5ce4a26102c9bf8e6b3d95/src/Logger.php#L91-L103 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.