repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
unimapper/unimapper | src/Validator.php | Validator.addRule | public function addRule($validation, $message, $severity = Validator\Rule::ERROR)
{
$this->rules[] = new Validator\Rule(
$this->entity,
$this->_getValidation($validation),
$message,
$this->property,
$severity,
$this->child
);
... | php | public function addRule($validation, $message, $severity = Validator\Rule::ERROR)
{
$this->rules[] = new Validator\Rule(
$this->entity,
$this->_getValidation($validation),
$message,
$this->property,
$severity,
$this->child
);
... | [
"public",
"function",
"addRule",
"(",
"$",
"validation",
",",
"$",
"message",
",",
"$",
"severity",
"=",
"Validator",
"\\",
"Rule",
"::",
"ERROR",
")",
"{",
"$",
"this",
"->",
"rules",
"[",
"]",
"=",
"new",
"Validator",
"\\",
"Rule",
"(",
"$",
"this"... | Addd validation rule
@param mixed $validation Callable or some default validation method name
@param string $message
@param integer $severity
@return \UniMapper\Validator | [
"Addd",
"validation",
"rule"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L176-L187 |
unimapper/unimapper | src/Validator.php | Validator.validate | public function validate($failOn = Validator\Rule::ERROR)
{
$this->warnings = [];
$this->errors = [];
foreach ($this->rules as $rule) {
if ($rule instanceof Validator\Condition) {
// Condition
$condition = $rule;
if ($condition->... | php | public function validate($failOn = Validator\Rule::ERROR)
{
$this->warnings = [];
$this->errors = [];
foreach ($this->rules as $rule) {
if ($rule instanceof Validator\Condition) {
// Condition
$condition = $rule;
if ($condition->... | [
"public",
"function",
"validate",
"(",
"$",
"failOn",
"=",
"Validator",
"\\",
"Rule",
"::",
"ERROR",
")",
"{",
"$",
"this",
"->",
"warnings",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Run all validations
@param integer $failOn Severity level
@return boolean | [
"Run",
"all",
"validations"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L204-L275 |
unimapper/unimapper | src/Validator.php | Validator.getMessages | public function getMessages(
$minSeverity = Validator\Rule::DEBUG,
callable $factory = null
) {
if ($factory === null) {
$factory = function ($text, $severity, $path) {
return new Validator\Message($text, $severity, $path);
};
}
$messa... | php | public function getMessages(
$minSeverity = Validator\Rule::DEBUG,
callable $factory = null
) {
if ($factory === null) {
$factory = function ($text, $severity, $path) {
return new Validator\Message($text, $severity, $path);
};
}
$messa... | [
"public",
"function",
"getMessages",
"(",
"$",
"minSeverity",
"=",
"Validator",
"\\",
"Rule",
"::",
"DEBUG",
",",
"callable",
"$",
"factory",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"factory",
"===",
"null",
")",
"{",
"$",
"factory",
"=",
"function",
"(... | Get messages
@param integer $minSeverity
@param callable $factory
@return array | [
"Get",
"messages"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L295-L343 |
jfusion/org.jfusion.platform.joomla | src/Recaptcha/Captcha/Captcha.php | Captcha.html | public function html()
{
if (!$this->getPublicKey()) {
throw new Exception('You must set public key provided by reCaptcha');
}
$error = ($this->getError() ? '&error=' . $this->getError() : null);
$theme = null;
// If user specified a reCaptcha theme, output... | php | public function html()
{
if (!$this->getPublicKey()) {
throw new Exception('You must set public key provided by reCaptcha');
}
$error = ($this->getError() ? '&error=' . $this->getError() : null);
$theme = null;
// If user specified a reCaptcha theme, output... | [
"public",
"function",
"html",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getPublicKey",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'You must set public key provided by reCaptcha'",
")",
";",
"}",
"$",
"error",
"=",
"(",
"$",
"this",
"... | Generates reCaptcha form to output to your end user
@throws Exception
@return string | [
"Generates",
"reCaptcha",
"form",
"to",
"output",
"to",
"your",
"end",
"user"
] | train | https://github.com/jfusion/org.jfusion.platform.joomla/blob/1f0591321909720e218b6381c41546685e999e13/src/Recaptcha/Captcha/Captcha.php#L204-L226 |
jfusion/org.jfusion.platform.joomla | src/Recaptcha/Captcha/Captcha.php | Captcha.check | public function check($captcha_challenge = false, $captcha_response = false)
{
if (!$this->getPrivateKey()) {
throw new Exception('You must set private key provided by reCaptcha');
}
// Skip processing of empty data
if (!$captcha_challenge && !$captcha_response) {
... | php | public function check($captcha_challenge = false, $captcha_response = false)
{
if (!$this->getPrivateKey()) {
throw new Exception('You must set private key provided by reCaptcha');
}
// Skip processing of empty data
if (!$captcha_challenge && !$captcha_response) {
... | [
"public",
"function",
"check",
"(",
"$",
"captcha_challenge",
"=",
"false",
",",
"$",
"captcha_response",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getPrivateKey",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'You must set priva... | Checks and validates user's response
@param bool|string $captcha_challenge Optional challenge string. If empty, value from $_POST will be used
@param bool|string $captcha_response Optional response string. If empty, value from $_POST will be used
@throws Exception
@return Response | [
"Checks",
"and",
"validates",
"user",
"s",
"response"
] | train | https://github.com/jfusion/org.jfusion.platform.joomla/blob/1f0591321909720e218b6381c41546685e999e13/src/Recaptcha/Captcha/Captcha.php#L236-L278 |
jfusion/org.jfusion.platform.joomla | src/Recaptcha/Captcha/Captcha.php | Captcha.process | protected function process($parameters)
{
// Properly encode parameters
$parameters = $this->encode($parameters);
$request = "POST /recaptcha/api/verify HTTP/1.0\r\n";
$request .= "Host: " . self::VERIFY_SERVER . "\r\n";
$request .= "Content-Type: application/x-www-form-url... | php | protected function process($parameters)
{
// Properly encode parameters
$parameters = $this->encode($parameters);
$request = "POST /recaptcha/api/verify HTTP/1.0\r\n";
$request .= "Host: " . self::VERIFY_SERVER . "\r\n";
$request .= "Content-Type: application/x-www-form-url... | [
"protected",
"function",
"process",
"(",
"$",
"parameters",
")",
"{",
"// Properly encode parameters",
"$",
"parameters",
"=",
"$",
"this",
"->",
"encode",
"(",
"$",
"parameters",
")",
";",
"$",
"request",
"=",
"\"POST /recaptcha/api/verify HTTP/1.0\\r\\n\"",
";",
... | Make a signed validation request to reCaptcha's servers
@throws Exception
@param array $parameters
@return string | [
"Make",
"a",
"signed",
"validation",
"request",
"to",
"reCaptcha",
"s",
"servers"
] | train | https://github.com/jfusion/org.jfusion.platform.joomla/blob/1f0591321909720e218b6381c41546685e999e13/src/Recaptcha/Captcha/Captcha.php#L287-L315 |
jfusion/org.jfusion.platform.joomla | src/Recaptcha/Captcha/Captcha.php | Captcha.encode | protected function encode(array $parameters)
{
$uri = '';
if ($parameters) {
foreach ($parameters as $parameter => $value) {
$uri .= $parameter . '=' . urlencode(stripslashes($value)) . '&';
}
}
$uri = substr($uri, 0, strlen($uri)-1);
... | php | protected function encode(array $parameters)
{
$uri = '';
if ($parameters) {
foreach ($parameters as $parameter => $value) {
$uri .= $parameter . '=' . urlencode(stripslashes($value)) . '&';
}
}
$uri = substr($uri, 0, strlen($uri)-1);
... | [
"protected",
"function",
"encode",
"(",
"array",
"$",
"parameters",
")",
"{",
"$",
"uri",
"=",
"''",
";",
"if",
"(",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameter",
"=>",
"$",
"value",
")",
"{",
"$",
"uri",
"... | Construct encoded URI string from an array
@param array $parameters
@return string | [
"Construct",
"encoded",
"URI",
"string",
"from",
"an",
"array"
] | train | https://github.com/jfusion/org.jfusion.platform.joomla/blob/1f0591321909720e218b6381c41546685e999e13/src/Recaptcha/Captcha/Captcha.php#L323-L336 |
jfusion/org.jfusion.platform.joomla | src/Recaptcha/Captcha/Captcha.php | Captcha.setTheme | public function setTheme($theme)
{
if (!self::isValidTheme($theme)) {
throw new Exception(
'Theme ' . $theme . ' is not valid. Please use one of [' . join(', ', self::$themes) . ']'
);
}
$this->theme = $theme;
} | php | public function setTheme($theme)
{
if (!self::isValidTheme($theme)) {
throw new Exception(
'Theme ' . $theme . ' is not valid. Please use one of [' . join(', ', self::$themes) . ']'
);
}
$this->theme = $theme;
} | [
"public",
"function",
"setTheme",
"(",
"$",
"theme",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isValidTheme",
"(",
"$",
"theme",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Theme '",
".",
"$",
"theme",
".",
"' is not valid. Please use one of ['",
"."... | Set a reCaptcha theme
@param string $theme
@throws Exception
@see https://developers.google.com/recaptcha/docs/customization | [
"Set",
"a",
"reCaptcha",
"theme"
] | train | https://github.com/jfusion/org.jfusion.platform.joomla/blob/1f0591321909720e218b6381c41546685e999e13/src/Recaptcha/Captcha/Captcha.php#L356-L365 |
cicada/cicada | src/Invoker.php | Invoker.invoke | public function invoke($callable, array $namedParams = [], array $classParams = [])
{
$classParams = $this->reindexclassParams($classParams);
if ($callable instanceof \Closure) {
return $this->invokeFunction($callable, $namedParams, $classParams);
}
if (is_string($calla... | php | public function invoke($callable, array $namedParams = [], array $classParams = [])
{
$classParams = $this->reindexclassParams($classParams);
if ($callable instanceof \Closure) {
return $this->invokeFunction($callable, $namedParams, $classParams);
}
if (is_string($calla... | [
"public",
"function",
"invoke",
"(",
"$",
"callable",
",",
"array",
"$",
"namedParams",
"=",
"[",
"]",
",",
"array",
"$",
"classParams",
"=",
"[",
"]",
")",
"{",
"$",
"classParams",
"=",
"$",
"this",
"->",
"reindexclassParams",
"(",
"$",
"classParams",
... | Invokes a method or anonymous function and returns the result.
Parameter injection is done in two ways:
1. `$classParams` array may contain only objects. For each of the objects
in the array, if the callable function has a parameter with a type hing
to that class, it will be injected.
For example, in the following c... | [
"Invokes",
"a",
"method",
"or",
"anonymous",
"function",
"and",
"returns",
"the",
"result",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Invoker.php#L75-L103 |
cicada/cicada | src/Invoker.php | Invoker.invokeClassMethod | private function invokeClassMethod($class, $method, $namedParams, $classParams)
{
if (!class_exists($class)) {
throw new \InvalidArgumentException("Class $class does not exist.");
}
$object = new $class();
return $this->invokeObjectMethod($object, $method, $namedParams,... | php | private function invokeClassMethod($class, $method, $namedParams, $classParams)
{
if (!class_exists($class)) {
throw new \InvalidArgumentException("Class $class does not exist.");
}
$object = new $class();
return $this->invokeObjectMethod($object, $method, $namedParams,... | [
"private",
"function",
"invokeClassMethod",
"(",
"$",
"class",
",",
"$",
"method",
",",
"$",
"namedParams",
",",
"$",
"classParams",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException... | Invokes a method on a class, by creating an instance of the class and
then invoking the method. | [
"Invokes",
"a",
"method",
"on",
"a",
"class",
"by",
"creating",
"an",
"instance",
"of",
"the",
"class",
"and",
"then",
"invoking",
"the",
"method",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Invoker.php#L109-L118 |
cicada/cicada | src/Invoker.php | Invoker.invokeObjectMethod | private function invokeObjectMethod($object, $method, $namedParams, $classParams)
{
if (!method_exists($object, $method)) {
$class = get_class($object);
throw new \InvalidArgumentException("Method $class::$method does not exist.");
}
$reflection = new \ReflectionMeth... | php | private function invokeObjectMethod($object, $method, $namedParams, $classParams)
{
if (!method_exists($object, $method)) {
$class = get_class($object);
throw new \InvalidArgumentException("Method $class::$method does not exist.");
}
$reflection = new \ReflectionMeth... | [
"private",
"function",
"invokeObjectMethod",
"(",
"$",
"object",
",",
"$",
"method",
",",
"$",
"namedParams",
",",
"$",
"classParams",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"object",
",",
"$",
"method",
")",
")",
"{",
"$",
"class",
"=",
... | Invokes a method on an object. | [
"Invokes",
"a",
"method",
"on",
"an",
"object",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Invoker.php#L123-L136 |
cicada/cicada | src/Invoker.php | Invoker.invokeFunction | private function invokeFunction($function, $namedParams, $classParams)
{
$reflection = new \ReflectionFunction($function);
$params = $reflection->getParameters();
$invokeParams = $this->mapParameters($params, $namedParams, $classParams);
return call_user_func_array($function, $invo... | php | private function invokeFunction($function, $namedParams, $classParams)
{
$reflection = new \ReflectionFunction($function);
$params = $reflection->getParameters();
$invokeParams = $this->mapParameters($params, $namedParams, $classParams);
return call_user_func_array($function, $invo... | [
"private",
"function",
"invokeFunction",
"(",
"$",
"function",
",",
"$",
"namedParams",
",",
"$",
"classParams",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionFunction",
"(",
"$",
"function",
")",
";",
"$",
"params",
"=",
"$",
"reflection",
"->... | Invokes an anonymous function. | [
"Invokes",
"an",
"anonymous",
"function",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Invoker.php#L139-L147 |
cicada/cicada | src/Invoker.php | Invoker.reindexClassParams | private function reindexClassParams(array $classParams)
{
$reindexed = [];
foreach ($classParams as $param) {
if (!is_object($param)) {
throw new \InvalidArgumentException("\$classParams entries must be objects.");
}
// Iterate for param class an... | php | private function reindexClassParams(array $classParams)
{
$reindexed = [];
foreach ($classParams as $param) {
if (!is_object($param)) {
throw new \InvalidArgumentException("\$classParams entries must be objects.");
}
// Iterate for param class an... | [
"private",
"function",
"reindexClassParams",
"(",
"array",
"$",
"classParams",
")",
"{",
"$",
"reindexed",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"classParams",
"as",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"param",
")",
")",
... | Reindexes an array of objects by class name. | [
"Reindexes",
"an",
"array",
"of",
"objects",
"by",
"class",
"name",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Invoker.php#L172-L193 |
rfdy/imagemagick | CLI/Operation/Unsharp.php | Unsharp.process | public function process(Image $image, $command_line = '') {
$result = new Result();
$result->setCommandLine($command_line . ' -unsharp ' . escapeshellarg($this->radius . 'x' . $this->sigma . '+' . $this->gain . '+' . $this->threshold));
return $result;
} | php | public function process(Image $image, $command_line = '') {
$result = new Result();
$result->setCommandLine($command_line . ' -unsharp ' . escapeshellarg($this->radius . 'x' . $this->sigma . '+' . $this->gain . '+' . $this->threshold));
return $result;
} | [
"public",
"function",
"process",
"(",
"Image",
"$",
"image",
",",
"$",
"command_line",
"=",
"''",
")",
"{",
"$",
"result",
"=",
"new",
"Result",
"(",
")",
";",
"$",
"result",
"->",
"setCommandLine",
"(",
"$",
"command_line",
".",
"' -unsharp '",
".",
"... | @param Image $image
@param string $command_line
@return Result | [
"@param",
"Image",
"$image",
"@param",
"string",
"$command_line"
] | train | https://github.com/rfdy/imagemagick/blob/dd1e52fbd66093828dd013e64c53dc7d68f1bc91/CLI/Operation/Unsharp.php#L14-L20 |
mimmi20/Wurfl | src/FileUtils.php | FileUtils.read | public static function read($file)
{
if (!is_readable($file)) {
return;
}
$data = @file_get_contents($file);
if ($data === false) {
return;
}
$value = @unserialize($data);
if ($value === false) {
return;
}
r... | php | public static function read($file)
{
if (!is_readable($file)) {
return;
}
$data = @file_get_contents($file);
if ($data === false) {
return;
}
$value = @unserialize($data);
if ($value === false) {
return;
}
r... | [
"public",
"static",
"function",
"read",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"return",
";",
"}",
"$",
"data",
"=",
"@",
"file_get_contents",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"data"... | Returns the unserialized contents of the given $file
@param string $file filename
@return mixed Unserialized data or null if file does not exist | [
"Returns",
"the",
"unserialized",
"contents",
"of",
"the",
"given",
"$file"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/FileUtils.php#L79-L94 |
mimmi20/Wurfl | src/FileUtils.php | FileUtils.write | public static function write($path, $data, $mtime = 0)
{
if (!file_exists(dirname($path))) {
self::mkdir(dirname($path), 0755, true);
}
if (file_put_contents($path, serialize($data), LOCK_EX)) {
$mtime = ($mtime > 0) ? $mtime : time();
@chmod($path, 0777);... | php | public static function write($path, $data, $mtime = 0)
{
if (!file_exists(dirname($path))) {
self::mkdir(dirname($path), 0755, true);
}
if (file_put_contents($path, serialize($data), LOCK_EX)) {
$mtime = ($mtime > 0) ? $mtime : time();
@chmod($path, 0777);... | [
"public",
"static",
"function",
"write",
"(",
"$",
"path",
",",
"$",
"data",
",",
"$",
"mtime",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"dirname",
"(",
"$",
"path",
")",
")",
")",
"{",
"self",
"::",
"mkdir",
"(",
"dirname",
"(",
... | Serializes and saves $data in the file $path and sets the last modified time to $mtime
@param string $path filename to save data in
@param mixed $data data to be serialized and saved
@param int $mtime Last modified date in epoch time | [
"Serializes",
"and",
"saves",
"$data",
"in",
"the",
"file",
"$path",
"and",
"sets",
"the",
"last",
"modified",
"time",
"to",
"$mtime"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/FileUtils.php#L103-L113 |
gorkalaucirica/HipchatAPIv2Client | Model/Message.php | Message.toJson | public function toJson()
{
$json = array();
$json['id'] = $this->id;
$json['from'] = $this->from;
$json['color'] = $this->color;
$json['message'] = $this->message;
$json['notify'] = $this->notify;
$json['message_format'] = $this->messageFormat;
$json['... | php | public function toJson()
{
$json = array();
$json['id'] = $this->id;
$json['from'] = $this->from;
$json['color'] = $this->color;
$json['message'] = $this->message;
$json['notify'] = $this->notify;
$json['message_format'] = $this->messageFormat;
$json['... | [
"public",
"function",
"toJson",
"(",
")",
"{",
"$",
"json",
"=",
"array",
"(",
")",
";",
"$",
"json",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"json",
"[",
"'from'",
"]",
"=",
"$",
"this",
"->",
"from",
";",
"$",
"json",
"[",... | Serializes Message object
@return array | [
"Serializes",
"Message",
"object"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/Message.php#L65-L78 |
markwatkinson/luminous | src/Luminous/Scanners/EcmaScriptScanner.php | EcmaScriptScanner.scanChild | public function scanChild($lang)
{
assert(isset($this->childScanners[$lang]));
$scanner = $this->childScanners[$lang];
$scanner->pos($this->pos());
$substr = $scanner->main();
$this->record($scanner->tagged(), 'XML', true);
$this->pos($scanner->pos());
if ($sc... | php | public function scanChild($lang)
{
assert(isset($this->childScanners[$lang]));
$scanner = $this->childScanners[$lang];
$scanner->pos($this->pos());
$substr = $scanner->main();
$this->record($scanner->tagged(), 'XML', true);
$this->pos($scanner->pos());
if ($sc... | [
"public",
"function",
"scanChild",
"(",
"$",
"lang",
")",
"{",
"assert",
"(",
"isset",
"(",
"$",
"this",
"->",
"childScanners",
"[",
"$",
"lang",
"]",
")",
")",
";",
"$",
"scanner",
"=",
"$",
"this",
"->",
"childScanners",
"[",
"$",
"lang",
"]",
";... | c+p from HTML scanner | [
"c",
"+",
"p",
"from",
"HTML",
"scanner"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/EcmaScriptScanner.php#L223-L236 |
unimapper/unimapper | src/Entity.php | Entity.getValidator | public function getValidator()
{
if (!$this->validator) {
$this->validator = new Validator($this);
}
return $this->validator->onEntity();
} | php | public function getValidator()
{
if (!$this->validator) {
$this->validator = new Validator($this);
}
return $this->validator->onEntity();
} | [
"public",
"function",
"getValidator",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validator",
")",
"{",
"$",
"this",
"->",
"validator",
"=",
"new",
"Validator",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"validator",
"->",
... | Get entity validator
@return \UniMapper\Validator | [
"Get",
"entity",
"validator"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity.php#L371-L377 |
unimapper/unimapper | src/Entity.php | Entity.toArray | public function toArray($nesting = false)
{
$output = [];
foreach ($this::getReflection()->getProperties() as $propertyName => $property) {
$value = $this->{$propertyName};
if (($value instanceof Entity\Collection || $value instanceof Entity)
&& $nesting
... | php | public function toArray($nesting = false)
{
$output = [];
foreach ($this::getReflection()->getProperties() as $propertyName => $property) {
$value = $this->{$propertyName};
if (($value instanceof Entity\Collection || $value instanceof Entity)
&& $nesting
... | [
"public",
"function",
"toArray",
"(",
"$",
"nesting",
"=",
"false",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"::",
"getReflection",
"(",
")",
"->",
"getProperties",
"(",
")",
"as",
"$",
"propertyName",
"=>",
"$",
"pro... | Get entity values as array
@param boolean $nesting Convert nested entities and collections too
@return array | [
"Get",
"entity",
"values",
"as",
"array"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity.php#L396-L412 |
unimapper/unimapper | src/Entity.php | Entity.jsonSerialize | public function jsonSerialize()
{
$output = [];
foreach ($this::getReflection()->getProperties() as $propertyName => $property) {
$value = $this->{$propertyName};
if ($value instanceof Entity\Collection || $value instanceof Entity) {
$output[$propertyName] = ... | php | public function jsonSerialize()
{
$output = [];
foreach ($this::getReflection()->getProperties() as $propertyName => $property) {
$value = $this->{$propertyName};
if ($value instanceof Entity\Collection || $value instanceof Entity) {
$output[$propertyName] = ... | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"::",
"getReflection",
"(",
")",
"->",
"getProperties",
"(",
")",
"as",
"$",
"propertyName",
"=>",
"$",
"property",
")",
"{",
"$",
"... | Gets data which should be serialized to JSON
@return array | [
"Gets",
"data",
"which",
"should",
"be",
"serialized",
"to",
"JSON"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity.php#L419-L438 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Menu.php | Menu.menu_tree_all_data | public function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL)
{
return menu_tree_all_data($menu_name, $link, $max_depth);
} | php | public function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL)
{
return menu_tree_all_data($menu_name, $link, $max_depth);
} | [
"public",
"function",
"menu_tree_all_data",
"(",
"$",
"menu_name",
",",
"$",
"link",
"=",
"NULL",
",",
"$",
"max_depth",
"=",
"NULL",
")",
"{",
"return",
"menu_tree_all_data",
"(",
"$",
"menu_name",
",",
"$",
"link",
",",
"$",
"max_depth",
")",
";",
"}"
... | Get the data structure representing a named menu tree.
Since this can be the full tree including hidden items, the data returned
may be used for generating an an admin interface or a select.
@param $menu_name
The named menu links to return
@param $link
A fully loaded menu link, or NULL. If a link is supplied, only th... | [
"Get",
"the",
"data",
"structure",
"representing",
"a",
"named",
"menu",
"tree",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Menu.php#L259-L262 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Menu.php | Menu.menu_tree_page_data | public function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = FALSE)
{
return menu_tree_page_data($menu_name, $max_depth, $only_active_trail);
} | php | public function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = FALSE)
{
return menu_tree_page_data($menu_name, $max_depth, $only_active_trail);
} | [
"public",
"function",
"menu_tree_page_data",
"(",
"$",
"menu_name",
",",
"$",
"max_depth",
"=",
"NULL",
",",
"$",
"only_active_trail",
"=",
"FALSE",
")",
"{",
"return",
"menu_tree_page_data",
"(",
"$",
"menu_name",
",",
"$",
"max_depth",
",",
"$",
"only_active... | Get the data structure representing a named menu tree, based on the current page.
The tree order is maintained by storing each parent in an individual
field, see http://drupal.org/node/141866 for more.
@param $menu_name
The named menu links to return.
@param $max_depth
(optional) The maximum depth of links to retriev... | [
"Get",
"the",
"data",
"structure",
"representing",
"a",
"named",
"menu",
"tree",
"based",
"on",
"the",
"current",
"page",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Menu.php#L323-L326 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Menu.php | Menu.menu_link_maintain | public function menu_link_maintain($module, $op, $link_path, $link_title)
{
return menu_link_maintain($module, $op, $link_path, $link_title);
} | php | public function menu_link_maintain($module, $op, $link_path, $link_title)
{
return menu_link_maintain($module, $op, $link_path, $link_title);
} | [
"public",
"function",
"menu_link_maintain",
"(",
"$",
"module",
",",
"$",
"op",
",",
"$",
"link_path",
",",
"$",
"link_title",
")",
"{",
"return",
"menu_link_maintain",
"(",
"$",
"module",
",",
"$",
"op",
",",
"$",
"link_path",
",",
"$",
"link_title",
")... | Insert, update or delete an uncustomized menu link related to a module.
@param $module
The name of the module.
@param $op
Operation to perform: insert, update or delete.
@param $link_path
The path this link points to.
@param $link_title
Title of the link to insert or new title to update the link to.
Unused for delete.... | [
"Insert",
"update",
"or",
"delete",
"an",
"uncustomized",
"menu",
"link",
"related",
"to",
"a",
"module",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Menu.php#L1038-L1041 |
PeeHaa/Minifine | src/Factory.php | Factory.build | public function build($basePath, $production = false)
{
$minifine = new Minifine($basePath, $production);
$minifine->appendJsMinifier(new MatthiasMullieJs(new JS()));
$minifine->appendCssMinifier(new MatthiasMullieCss(new Css()));
return $minifine;
} | php | public function build($basePath, $production = false)
{
$minifine = new Minifine($basePath, $production);
$minifine->appendJsMinifier(new MatthiasMullieJs(new JS()));
$minifine->appendCssMinifier(new MatthiasMullieCss(new Css()));
return $minifine;
} | [
"public",
"function",
"build",
"(",
"$",
"basePath",
",",
"$",
"production",
"=",
"false",
")",
"{",
"$",
"minifine",
"=",
"new",
"Minifine",
"(",
"$",
"basePath",
",",
"$",
"production",
")",
";",
"$",
"minifine",
"->",
"appendJsMinifier",
"(",
"new",
... | Builds a new minifine instance
@param string $basePath The base path to the resources (under most common cases this will be the public web
root directory)
@param bool $production The current environment
@return \Minifine\Minifine | [
"Builds",
"a",
"new",
"minifine",
"instance"
] | train | https://github.com/PeeHaa/Minifine/blob/8f8841fa8503de1557af96f1d2546cc6d02cc0a2/src/Factory.php#L37-L45 |
unimapper/unimapper | src/Exception/ReflectionException.php | ReflectionException.getEntityLine | public function getEntityLine()
{
if ($this->definition) {
foreach (file($this->getEntityPath(), FILE_IGNORE_NEW_LINES)
as $lineNumber => $line
) {
if (strpos($line, $this->definition) !== false) {
return $lineNumber + 1;
... | php | public function getEntityLine()
{
if ($this->definition) {
foreach (file($this->getEntityPath(), FILE_IGNORE_NEW_LINES)
as $lineNumber => $line
) {
if (strpos($line, $this->definition) !== false) {
return $lineNumber + 1;
... | [
"public",
"function",
"getEntityLine",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"definition",
")",
"{",
"foreach",
"(",
"file",
"(",
"$",
"this",
"->",
"getEntityPath",
"(",
")",
",",
"FILE_IGNORE_NEW_LINES",
")",
"as",
"$",
"lineNumber",
"=>",
"$",
... | Get problematic entity line number
@return integer | [
"Get",
"problematic",
"entity",
"line",
"number"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Exception/ReflectionException.php#L42-L54 |
terdia/legato-framework | src/Console/AbstractFileGenerator.php | AbstractFileGenerator.runFileGeneratorCommand | public function runFileGeneratorCommand($path, $argument)
{
if ($this->filesystem->exists($path)) {
return 'File with the name '.$argument.' already exist';
}
$folder_name = explode('/', $argument);
$folder = '';
if (count($folder_name) > 1) {
$folder_... | php | public function runFileGeneratorCommand($path, $argument)
{
if ($this->filesystem->exists($path)) {
return 'File with the name '.$argument.' already exist';
}
$folder_name = explode('/', $argument);
$folder = '';
if (count($folder_name) > 1) {
$folder_... | [
"public",
"function",
"runFileGeneratorCommand",
"(",
"$",
"path",
",",
"$",
"argument",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"'File with the name '",
".",
"$",
"argument",
".",
... | Generate and move file to specified path.
@param $path
@param $argument
@return string | [
"Generate",
"and",
"move",
"file",
"to",
"specified",
"path",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/AbstractFileGenerator.php#L105-L128 |
terdia/legato-framework | src/Console/AbstractFileGenerator.php | AbstractFileGenerator.execute | public function execute(InputInterface $input, OutputInterface $output)
{
$argument = $input->getArgument($this->argumentName);
$path = $this->basePath.'/'.$argument.'.php';
if ($input->hasOption('restful') && $input->getOption('restful') == true) {
$this->restful = true;
... | php | public function execute(InputInterface $input, OutputInterface $output)
{
$argument = $input->getArgument($this->argumentName);
$path = $this->basePath.'/'.$argument.'.php';
if ($input->hasOption('restful') && $input->getOption('restful') == true) {
$this->restful = true;
... | [
"public",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"argument",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"$",
"this",
"->",
"argumentName",
")",
";",
"$",
"path",
"=",
"$",
"this... | Execute the command.
@param InputInterface $input
@param OutputInterface $output
@return int|null|void | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Console/AbstractFileGenerator.php#L138-L158 |
PandaPlatform/framework | src/Panda/Routing/RouteCollection.php | RouteCollection.match | public function match(Request $request)
{
// Get all the routes
$routes = $this->getByMethod($request->getMethod());
// Get the matching route out of the collection.
$route = $this->getMatchingRoute($routes, $request);
if (!is_null($route)) {
return $route->bind(... | php | public function match(Request $request)
{
// Get all the routes
$routes = $this->getByMethod($request->getMethod());
// Get the matching route out of the collection.
$route = $this->getMatchingRoute($routes, $request);
if (!is_null($route)) {
return $route->bind(... | [
"public",
"function",
"match",
"(",
"Request",
"$",
"request",
")",
"{",
"// Get all the routes",
"$",
"routes",
"=",
"$",
"this",
"->",
"getByMethod",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
")",
";",
"// Get the matching route out of the collection.",
... | Find the first route matching a given request.
@param Request $request
@return mixed
@throws NotFoundHttpException
@throws \UnexpectedValueException
@throws \LogicException | [
"Find",
"the",
"first",
"route",
"matching",
"a",
"given",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/RouteCollection.php#L59-L79 |
PandaPlatform/framework | src/Panda/Routing/RouteCollection.php | RouteCollection.getMatchingRoute | public function getMatchingRoute($routes, Request $request)
{
foreach ($routes as $matchingRoute) {
if ($matchingRoute->matches($request)) {
return $matchingRoute;
}
}
return null;
} | php | public function getMatchingRoute($routes, Request $request)
{
foreach ($routes as $matchingRoute) {
if ($matchingRoute->matches($request)) {
return $matchingRoute;
}
}
return null;
} | [
"public",
"function",
"getMatchingRoute",
"(",
"$",
"routes",
",",
"Request",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"matchingRoute",
")",
"{",
"if",
"(",
"$",
"matchingRoute",
"->",
"matches",
"(",
"$",
"request",
")",
")",
... | Check which of the given routes matches the given request.
@param Route[] $routes
@param Request $request
@return Route|null
@throws \LogicException | [
"Check",
"which",
"of",
"the",
"given",
"routes",
"matches",
"the",
"given",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/RouteCollection.php#L90-L99 |
PandaPlatform/framework | src/Panda/Routing/RouteCollection.php | RouteCollection.getByMethod | public function getByMethod($method = null)
{
if (is_null($method)) {
return $this->getRoutes();
}
// Filter routes by the given method
return ArrayHelper::get($this->routes, $method, []);
} | php | public function getByMethod($method = null)
{
if (is_null($method)) {
return $this->getRoutes();
}
// Filter routes by the given method
return ArrayHelper::get($this->routes, $method, []);
} | [
"public",
"function",
"getByMethod",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"method",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getRoutes",
"(",
")",
";",
"}",
"// Filter routes by the given method",
"return",
"ArrayH... | Get all matched routes according to the given request method.
@param string|null $method
@return array | [
"Get",
"all",
"matched",
"routes",
"according",
"to",
"the",
"given",
"request",
"method",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/RouteCollection.php#L108-L116 |
PandaPlatform/framework | src/Panda/Routing/RouteCollection.php | RouteCollection.addToCollections | protected function addToCollections($route)
{
$fullUri = $route->getDomain() . $route->getUri();
$method = null;
foreach ($route->getMethods() as $method) {
$this->routes[$method][$fullUri] = $route;
}
$this->allRoutes[$method . $fullUri] = $route;
} | php | protected function addToCollections($route)
{
$fullUri = $route->getDomain() . $route->getUri();
$method = null;
foreach ($route->getMethods() as $method) {
$this->routes[$method][$fullUri] = $route;
}
$this->allRoutes[$method . $fullUri] = $route;
} | [
"protected",
"function",
"addToCollections",
"(",
"$",
"route",
")",
"{",
"$",
"fullUri",
"=",
"$",
"route",
"->",
"getDomain",
"(",
")",
".",
"$",
"route",
"->",
"getUri",
"(",
")",
";",
"$",
"method",
"=",
"null",
";",
"foreach",
"(",
"$",
"route",... | Add the given route to the arrays of routes.
@param Route $route | [
"Add",
"the",
"given",
"route",
"to",
"the",
"arrays",
"of",
"routes",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/RouteCollection.php#L148-L158 |
samjarrett/DoctrineSluggableBundle | src/SamJ/DoctrineSluggableBundle/Slugger.php | Slugger.getSlug | public function getSlug($fields, $exclude = array())
{
// Determine if we are dealing with single-field or multiple-field slugs
if (!is_array($fields)) {
$fields = array($fields);
}
foreach ($fields as &$field) {
// Add special treatment for 's i.e. "Sam's" becomes "Sams"
$field = preg_replace('~\'s(... | php | public function getSlug($fields, $exclude = array())
{
// Determine if we are dealing with single-field or multiple-field slugs
if (!is_array($fields)) {
$fields = array($fields);
}
foreach ($fields as &$field) {
// Add special treatment for 's i.e. "Sam's" becomes "Sams"
$field = preg_replace('~\'s(... | [
"public",
"function",
"getSlug",
"(",
"$",
"fields",
",",
"$",
"exclude",
"=",
"array",
"(",
")",
")",
"{",
"// Determine if we are dealing with single-field or multiple-field slugs",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
... | Return a slug, ensuring it does not appear in exclude (prior collisions)
@param $fields
@param array $exclude list of slugs to exclude
@return void
Reference: Doctrine 1_4 slugify | [
"Return",
"a",
"slug",
"ensuring",
"it",
"does",
"not",
"appear",
"in",
"exclude",
"(",
"prior",
"collisions",
")"
] | train | https://github.com/samjarrett/DoctrineSluggableBundle/blob/e01bb68cbc4339a379efe36e8294205fd3a48a5c/src/SamJ/DoctrineSluggableBundle/Slugger.php#L31-L73 |
mimmi20/Wurfl | src/Handlers/Normalizer/Generic/CFNetwork.php | CFNetwork.normalize | public function normalize($userAgent)
{
//Match a CFNetwork UA
if (preg_match('#CFNetwork/(\d+\.?[0-9]*)#', $userAgent, $matches)) {
$cfNetworkVersion = sprintf('%.2f', round($matches[1], 2, PHP_ROUND_HALF_DOWN));
return 'CFNetwork/' . $cfNetworkVersion . ' ' . $userAgent;
... | php | public function normalize($userAgent)
{
//Match a CFNetwork UA
if (preg_match('#CFNetwork/(\d+\.?[0-9]*)#', $userAgent, $matches)) {
$cfNetworkVersion = sprintf('%.2f', round($matches[1], 2, PHP_ROUND_HALF_DOWN));
return 'CFNetwork/' . $cfNetworkVersion . ' ' . $userAgent;
... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"//Match a CFNetwork UA",
"if",
"(",
"preg_match",
"(",
"'#CFNetwork/(\\d+\\.?[0-9]*)#'",
",",
"$",
"userAgent",
",",
"$",
"matches",
")",
")",
"{",
"$",
"cfNetworkVersion",
"=",
"sprintf",
"(",... | @param string $userAgent
@return mixed|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Generic/CFNetwork.php#L33-L44 |
ptlis/conneg | src/Preference/Matched/MatchedPreferenceComparator.php | MatchedPreferenceComparator.compare | public function compare(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
{
// Compare by quality factors - highest quality factor has precedence.
$result = $this->compareQualityFactorPair($lValue, $rValue);
// Quality factors are equal attempt to sort by match precede... | php | public function compare(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
{
// Compare by quality factors - highest quality factor has precedence.
$result = $this->compareQualityFactorPair($lValue, $rValue);
// Quality factors are equal attempt to sort by match precede... | [
"public",
"function",
"compare",
"(",
"MatchedPreferenceInterface",
"$",
"lValue",
",",
"MatchedPreferenceInterface",
"$",
"rValue",
")",
"{",
"// Compare by quality factors - highest quality factor has precedence.",
"$",
"result",
"=",
"$",
"this",
"->",
"compareQualityFacto... | Comparison function used for ordering matched preferences.
@param MatchedPreferenceInterface $lValue
@param MatchedPreferenceInterface $rValue
@return int -1, 0, 1 (see usort() callback for meaning) | [
"Comparison",
"function",
"used",
"for",
"ordering",
"matched",
"preferences",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreferenceComparator.php#L26-L42 |
ptlis/conneg | src/Preference/Matched/MatchedPreferenceComparator.php | MatchedPreferenceComparator.compareQualityFactorPair | private function compareQualityFactorPair(
MatchedPreferenceInterface $lValue,
MatchedPreferenceInterface $rValue
) {
// Build a list of quality factor comparisons to perform; highest preference given to quality factor products,
// followed by those provided by the client & finally t... | php | private function compareQualityFactorPair(
MatchedPreferenceInterface $lValue,
MatchedPreferenceInterface $rValue
) {
// Build a list of quality factor comparisons to perform; highest preference given to quality factor products,
// followed by those provided by the client & finally t... | [
"private",
"function",
"compareQualityFactorPair",
"(",
"MatchedPreferenceInterface",
"$",
"lValue",
",",
"MatchedPreferenceInterface",
"$",
"rValue",
")",
"{",
"// Build a list of quality factor comparisons to perform; highest preference given to quality factor products,",
"// followed ... | Comparison function for quality factors of matched preferences.
@param MatchedPreferenceInterface $lValue
@param MatchedPreferenceInterface $rValue
@return int -1, 0, 1 (see usort() callback for meaning) | [
"Comparison",
"function",
"for",
"quality",
"factors",
"of",
"matched",
"preferences",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreferenceComparator.php#L52-L84 |
ptlis/conneg | src/Preference/Matched/MatchedPreferenceComparator.php | MatchedPreferenceComparator.compareQualityFactor | private function compareQualityFactor(PreferenceInterface $lValue, PreferenceInterface $rValue)
{
if ($rValue->getQualityFactor() < $lValue->getQualityFactor()) {
return -1;
} elseif ($rValue->getQualityFactor() > $lValue->getQualityFactor()) {
return 1;
} else {
... | php | private function compareQualityFactor(PreferenceInterface $lValue, PreferenceInterface $rValue)
{
if ($rValue->getQualityFactor() < $lValue->getQualityFactor()) {
return -1;
} elseif ($rValue->getQualityFactor() > $lValue->getQualityFactor()) {
return 1;
} else {
... | [
"private",
"function",
"compareQualityFactor",
"(",
"PreferenceInterface",
"$",
"lValue",
",",
"PreferenceInterface",
"$",
"rValue",
")",
"{",
"if",
"(",
"$",
"rValue",
"->",
"getQualityFactor",
"(",
")",
"<",
"$",
"lValue",
"->",
"getQualityFactor",
"(",
")",
... | Compare quality factors of preferences.
@param PreferenceInterface $lValue
@param PreferenceInterface $rValue
@return int -1, 0, 1 (see usort() callback for meaning) | [
"Compare",
"quality",
"factors",
"of",
"preferences",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreferenceComparator.php#L94-L103 |
ptlis/conneg | src/Preference/Matched/MatchedPreferenceComparator.php | MatchedPreferenceComparator.comparePrecedence | private function comparePrecedence(PreferenceInterface $lValue, PreferenceInterface $rValue)
{
if ($rValue->getPrecedence() < $lValue->getPrecedence()) {
return -1;
} elseif ($rValue->getPrecedence() > $lValue->getPrecedence()) {
return 1;
} else {
return ... | php | private function comparePrecedence(PreferenceInterface $lValue, PreferenceInterface $rValue)
{
if ($rValue->getPrecedence() < $lValue->getPrecedence()) {
return -1;
} elseif ($rValue->getPrecedence() > $lValue->getPrecedence()) {
return 1;
} else {
return ... | [
"private",
"function",
"comparePrecedence",
"(",
"PreferenceInterface",
"$",
"lValue",
",",
"PreferenceInterface",
"$",
"rValue",
")",
"{",
"if",
"(",
"$",
"rValue",
"->",
"getPrecedence",
"(",
")",
"<",
"$",
"lValue",
"->",
"getPrecedence",
"(",
")",
")",
"... | Compare precedences of preferences.
@param PreferenceInterface $lValue
@param PreferenceInterface $rValue
@return int -1, 0, 1 (see usort() callback for meaning) | [
"Compare",
"precedences",
"of",
"preferences",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreferenceComparator.php#L113-L122 |
ptlis/conneg | src/Preference/Matched/MatchedPreferenceComparator.php | MatchedPreferenceComparator.compareVariant | private function compareVariant(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
{
return strcasecmp($lValue->getVariant(), $rValue->getVariant());
} | php | private function compareVariant(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
{
return strcasecmp($lValue->getVariant(), $rValue->getVariant());
} | [
"private",
"function",
"compareVariant",
"(",
"MatchedPreferenceInterface",
"$",
"lValue",
",",
"MatchedPreferenceInterface",
"$",
"rValue",
")",
"{",
"return",
"strcasecmp",
"(",
"$",
"lValue",
"->",
"getVariant",
"(",
")",
",",
"$",
"rValue",
"->",
"getVariant",... | Compare preferences alphabetically
@param MatchedPreferenceInterface $lValue
@param MatchedPreferenceInterface $rValue
@return int -1, 0, 1 (see usort() callback for meaning) | [
"Compare",
"preferences",
"alphabetically"
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreferenceComparator.php#L132-L135 |
incraigulous/contentful-sdk | src/ManagementResources/ResourceBase.php | ResourceBase.post | function post($payload)
{
$this->requestDecorator->setPayload($payload);
$result = $this->client->post($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | php | function post($payload)
{
$this->requestDecorator->setPayload($payload);
$result = $this->client->post($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | [
"function",
"post",
"(",
"$",
"payload",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setPayload",
"(",
"$",
"payload",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"requestDecorator",
"->"... | Make a post request.
@param $payload
@return mixed | [
"Make",
"a",
"post",
"request",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/ResourceBase.php#L14-L20 |
incraigulous/contentful-sdk | src/ManagementResources/ResourceBase.php | ResourceBase.put | function put($id, $payload)
{
$this->requestDecorator->setId($id);
$this->requestDecorator->setPayload($payload);
if ((is_array($payload)) && (!empty($payload['sys']['version']))) {
$this->requestDecorator->addHeader('X-Contentful-Version', $payload['sys']['version']);
}
... | php | function put($id, $payload)
{
$this->requestDecorator->setId($id);
$this->requestDecorator->setPayload($payload);
if ((is_array($payload)) && (!empty($payload['sys']['version']))) {
$this->requestDecorator->addHeader('X-Contentful-Version', $payload['sys']['version']);
}
... | [
"function",
"put",
"(",
"$",
"id",
",",
"$",
"payload",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setId",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"requestDecorator",
"->",
"setPayload",
"(",
"$",
"payload",
")",
";",
"if",
"(",
"... | Make a put request.
@param $id
@param $payload
@return mixed | [
"Make",
"a",
"put",
"request",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/ResourceBase.php#L28-L38 |
incraigulous/contentful-sdk | src/ManagementResources/ResourceBase.php | ResourceBase.delete | function delete($id)
{
$this->requestDecorator->setId($id);
$result = $this->client->delete($this->requestDecorator->makeResource(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | php | function delete($id)
{
$this->requestDecorator->setId($id);
$result = $this->client->delete($this->requestDecorator->makeResource(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | [
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setId",
"(",
"$",
"id",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"$",
"this",
"->",
"requestDecorator",
"->",
"makeRe... | Make a delete request.
@param $id
@return mixed | [
"Make",
"a",
"delete",
"request",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/ResourceBase.php#L45-L51 |
wangsir0624/queue | src/RedisQueue.php | RedisQueue.push | public function push(AbstractJob $job)
{
if($job->getRunAt() > time()) {
return $this->addJobToRetrySet($job, $job->getRunAt());
}
return (bool)$this->client->rpush(
$this->getQueueNameWithPrefix($job->getQueue()),
serialize($job)
);
} | php | public function push(AbstractJob $job)
{
if($job->getRunAt() > time()) {
return $this->addJobToRetrySet($job, $job->getRunAt());
}
return (bool)$this->client->rpush(
$this->getQueueNameWithPrefix($job->getQueue()),
serialize($job)
);
} | [
"public",
"function",
"push",
"(",
"AbstractJob",
"$",
"job",
")",
"{",
"if",
"(",
"$",
"job",
"->",
"getRunAt",
"(",
")",
">",
"time",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"addJobToRetrySet",
"(",
"$",
"job",
",",
"$",
"job",
"->",
"... | push a job to the queue
@param AbstractJob $job
@return bool | [
"push",
"a",
"job",
"to",
"the",
"queue"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/RedisQueue.php#L38-L48 |
wangsir0624/queue | src/RedisQueue.php | RedisQueue.pop | public function pop($queue)
{
//migrate the retry jobs
$this->migrateRetryJobs($queue);
$data = $this->client->lpop($this->getQueueNameWithPrefix($queue));
if (!empty($data)) {
$job = @unserialize($data);
if ($job instanceof AbstractJob) {
re... | php | public function pop($queue)
{
//migrate the retry jobs
$this->migrateRetryJobs($queue);
$data = $this->client->lpop($this->getQueueNameWithPrefix($queue));
if (!empty($data)) {
$job = @unserialize($data);
if ($job instanceof AbstractJob) {
re... | [
"public",
"function",
"pop",
"(",
"$",
"queue",
")",
"{",
"//migrate the retry jobs",
"$",
"this",
"->",
"migrateRetryJobs",
"(",
"$",
"queue",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"client",
"->",
"lpop",
"(",
"$",
"this",
"->",
"getQueueNameWi... | get a job from the queue
@param string $queue
@return AbstractJob|null | [
"get",
"a",
"job",
"from",
"the",
"queue"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/RedisQueue.php#L55-L70 |
wangsir0624/queue | src/RedisQueue.php | RedisQueue.retry | public function retry(AbstractJob $job)
{
if ($job->shouldRetry()) {
return $this->addJobToRetrySet($job, $job->getRetryTime());
}
return false;
} | php | public function retry(AbstractJob $job)
{
if ($job->shouldRetry()) {
return $this->addJobToRetrySet($job, $job->getRetryTime());
}
return false;
} | [
"public",
"function",
"retry",
"(",
"AbstractJob",
"$",
"job",
")",
"{",
"if",
"(",
"$",
"job",
"->",
"shouldRetry",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"addJobToRetrySet",
"(",
"$",
"job",
",",
"$",
"job",
"->",
"getRetryTime",
"(",
")"... | retry a job
@param AbstractJob $job
@return bool | [
"retry",
"a",
"job"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/RedisQueue.php#L77-L84 |
wangsir0624/queue | src/RedisQueue.php | RedisQueue.migrateRetryJobs | protected function migrateRetryJobs($queue)
{
$luaScript = <<<LUA
-- Get all of the jobs with an expired "score"...
local val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])
-- If we have values in the array, we will remove them from the first queue
-- and add them onto the destination queue in chu... | php | protected function migrateRetryJobs($queue)
{
$luaScript = <<<LUA
-- Get all of the jobs with an expired "score"...
local val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])
-- If we have values in the array, we will remove them from the first queue
-- and add them onto the destination queue in chu... | [
"protected",
"function",
"migrateRetryJobs",
"(",
"$",
"queue",
")",
"{",
"$",
"luaScript",
"=",
" <<<LUA\n-- Get all of the jobs with an expired \"score\"...\nlocal val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])\n\n-- If we have values in the array, we will remove them from the f... | migrate the retry jobs of a queue
@param string $queue
@return array | [
"migrate",
"the",
"retry",
"jobs",
"of",
"a",
"queue"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/RedisQueue.php#L91-L118 |
wangsir0624/queue | src/RedisQueue.php | RedisQueue.addJobToRetrySet | protected function addJobToRetrySet($job, $retryAt)
{
return (bool)$this->client->zadd(
$this->getRetryZsetNameWithPrefix($job->getQueue()),
$retryAt,
serialize($job)
);
} | php | protected function addJobToRetrySet($job, $retryAt)
{
return (bool)$this->client->zadd(
$this->getRetryZsetNameWithPrefix($job->getQueue()),
$retryAt,
serialize($job)
);
} | [
"protected",
"function",
"addJobToRetrySet",
"(",
"$",
"job",
",",
"$",
"retryAt",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"client",
"->",
"zadd",
"(",
"$",
"this",
"->",
"getRetryZsetNameWithPrefix",
"(",
"$",
"job",
"->",
"getQueue",
"... | add job to the retry set
@param AbstractJob $job
@param int $retryAt
@return bool | [
"add",
"job",
"to",
"the",
"retry",
"set"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/RedisQueue.php#L126-L133 |
ptlis/conneg | src/Preference/Builder/PreferenceBuilder.php | PreferenceBuilder.get | public function get()
{
if (is_null($this->fromField)) {
throw new \RuntimeException(
'The HTTP field must be provided to the builder.'
);
}
return new Preference(
$this->variant,
$this->getQualityFactor(),
$this->g... | php | public function get()
{
if (is_null($this->fromField)) {
throw new \RuntimeException(
'The HTTP field must be provided to the builder.'
);
}
return new Preference(
$this->variant,
$this->getQualityFactor(),
$this->g... | [
"public",
"function",
"get",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"fromField",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The HTTP field must be provided to the builder.'",
")",
";",
"}",
"return",
"new",
"Preferenc... | @inheritDoc
@throws \RuntimeException if the HTTP field was not provided | [
"@inheritDoc"
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/PreferenceBuilder.php#L34-L47 |
ptlis/conneg | src/Preference/Builder/PreferenceBuilder.php | PreferenceBuilder.getPrecedence | private function getPrecedence()
{
$precedence = Preference::ABSENT;
// Wildcards
if ('*' === $this->variant) {
$precedence = Preference::WILDCARD;
// Special handling for Accept-Language field
} elseif (Preference::LANGUAGE === $this->fromField && '-*' === subs... | php | private function getPrecedence()
{
$precedence = Preference::ABSENT;
// Wildcards
if ('*' === $this->variant) {
$precedence = Preference::WILDCARD;
// Special handling for Accept-Language field
} elseif (Preference::LANGUAGE === $this->fromField && '-*' === subs... | [
"private",
"function",
"getPrecedence",
"(",
")",
"{",
"$",
"precedence",
"=",
"Preference",
"::",
"ABSENT",
";",
"// Wildcards",
"if",
"(",
"'*'",
"===",
"$",
"this",
"->",
"variant",
")",
"{",
"$",
"precedence",
"=",
"Preference",
"::",
"WILDCARD",
";",
... | Determine the precedence from the variant.
@return int | [
"Determine",
"the",
"precedence",
"from",
"the",
"variant",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/PreferenceBuilder.php#L70-L88 |
csun-metalab/laravel-directory-authentication | src/Authentication/Factories/LDAPPasswordFactory.php | LDAPPasswordFactory.SSHA | public static function SSHA($password, $salt=null) {
if(empty($salt)) {
if(function_exists('openssl_random_pseudo_bytes')) {
// salts should be four bytes
$salt = bin2hex(openssl_random_pseudo_bytes(4));
}
else
{
throw new Exception(
"You must have the openssl extension installed and enab... | php | public static function SSHA($password, $salt=null) {
if(empty($salt)) {
if(function_exists('openssl_random_pseudo_bytes')) {
// salts should be four bytes
$salt = bin2hex(openssl_random_pseudo_bytes(4));
}
else
{
throw new Exception(
"You must have the openssl extension installed and enab... | [
"public",
"static",
"function",
"SSHA",
"(",
"$",
"password",
",",
"$",
"salt",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"salt",
")",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'openssl_random_pseudo_bytes'",
")",
")",
"{",
"// salts shoul... | Generates and returns a new password as a SSHA hash for use in LDAP. If
the salt is not specified, one will be generated using the openssl
extension and have a length of four bytes.
@param string $password The plaintext password to hash
@param string $salt Optional salt for the algorithm
@return string | [
"Generates",
"and",
"returns",
"a",
"new",
"password",
"as",
"a",
"SSHA",
"hash",
"for",
"use",
"in",
"LDAP",
".",
"If",
"the",
"salt",
"is",
"not",
"specified",
"one",
"will",
"be",
"generated",
"using",
"the",
"openssl",
"extension",
"and",
"have",
"a"... | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Factories/LDAPPasswordFactory.php#L23-L37 |
dphn/ScContent | src/ScContent/Controller/Back/ArticleController.php | ArticleController.addAction | public function addAction()
{
$parent = $this->params()->fromRoute('parent');
if (! is_numeric($parent)) {
$this->flashMessenger()->addMessage(
$this->scTranslate('The article location was not specified.')
);
return $this->redirect()
... | php | public function addAction()
{
$parent = $this->params()->fromRoute('parent');
if (! is_numeric($parent)) {
$this->flashMessenger()->addMessage(
$this->scTranslate('The article location was not specified.')
);
return $this->redirect()
... | [
"public",
"function",
"addAction",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'parent'",
")",
";",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"parent",
")",
")",
"{",
"$",
"this",
"->",
"flashMes... | Add File.
@return \Zend\Stdlib\ResponseInterface | [
"Add",
"File",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Controller/Back/ArticleController.php#L39-L63 |
dphn/ScContent | src/ScContent/Controller/Back/ArticleController.php | ArticleController.editAction | public function editAction()
{
$id = $this->params()->fromRoute('id');
if (! is_numeric($id)) {
$this->flashMessenger()->addMessage(
$this->scTranslate('The article identifier was not specified.')
);
return $this->redirect()
->toRou... | php | public function editAction()
{
$id = $this->params()->fromRoute('id');
if (! is_numeric($id)) {
$this->flashMessenger()->addMessage(
$this->scTranslate('The article identifier was not specified.')
);
return $this->redirect()
->toRou... | [
"public",
"function",
"editAction",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'id'",
")",
";",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"flashMessenger",
... | Edit File.
@return \Zend\Stdlib\ResponseInterface|\Zend\View\Model\ViewModel | [
"Edit",
"File",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Controller/Back/ArticleController.php#L70-L108 |
christophe-brachet/aspi-framework | src/Framework/Routing/RouteGenerator/StrictLocaleRouteGenerator.php | StrictLocaleRouteGenerator.generateRoutes | public function generateRoutes($name, array $localesWithPaths, Route $baseRoute)
{
$this->assertLocalesAreSupported(array_keys($localesWithPaths));
return $this->routeGenerator->generateRoutes($name, $localesWithPaths, $baseRoute);
} | php | public function generateRoutes($name, array $localesWithPaths, Route $baseRoute)
{
$this->assertLocalesAreSupported(array_keys($localesWithPaths));
return $this->routeGenerator->generateRoutes($name, $localesWithPaths, $baseRoute);
} | [
"public",
"function",
"generateRoutes",
"(",
"$",
"name",
",",
"array",
"$",
"localesWithPaths",
",",
"Route",
"$",
"baseRoute",
")",
"{",
"$",
"this",
"->",
"assertLocalesAreSupported",
"(",
"array_keys",
"(",
"$",
"localesWithPaths",
")",
")",
";",
"return",... | Generate localized versions of the given route.
@param $name
@param array $localesWithPaths
@param Route $baseRoute
@return RouteCollection | [
"Generate",
"localized",
"versions",
"of",
"the",
"given",
"route",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/RouteGenerator/StrictLocaleRouteGenerator.php#L60-L64 |
christophe-brachet/aspi-framework | src/Framework/Routing/RouteGenerator/StrictLocaleRouteGenerator.php | StrictLocaleRouteGenerator.generateCollection | public function generateCollection($localesWithPrefix, RouteCollection $baseCollection)
{
if (is_array($localesWithPrefix)) {
$this->assertLocalesAreSupported(array_keys($localesWithPrefix));
}
return $this->routeGenerator->generateCollection($localesWithPrefix, $baseCollection);... | php | public function generateCollection($localesWithPrefix, RouteCollection $baseCollection)
{
if (is_array($localesWithPrefix)) {
$this->assertLocalesAreSupported(array_keys($localesWithPrefix));
}
return $this->routeGenerator->generateCollection($localesWithPrefix, $baseCollection);... | [
"public",
"function",
"generateCollection",
"(",
"$",
"localesWithPrefix",
",",
"RouteCollection",
"$",
"baseCollection",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"localesWithPrefix",
")",
")",
"{",
"$",
"this",
"->",
"assertLocalesAreSupported",
"(",
"array_key... | Generate a localized version of the given route collection.
@param array|string $localesWithPrefix
@param RouteCollection $baseCollection
@return RouteCollection | [
"Generate",
"a",
"localized",
"version",
"of",
"the",
"given",
"route",
"collection",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/RouteGenerator/StrictLocaleRouteGenerator.php#L72-L78 |
DevGroup-ru/yii2-data-structure-tools | src/traits/PropertiesTrait.php | PropertiesTrait.buildTableName | protected static function buildTableName($suffix = '')
{
if (true === empty(static::$tablePrefix)) {
if (strpos(static::tableName(), '}}') !== false) {
$name = str_replace('}}', $suffix . '}}', static::tableName());
} else {
$name = static::tableName()... | php | protected static function buildTableName($suffix = '')
{
if (true === empty(static::$tablePrefix)) {
if (strpos(static::tableName(), '}}') !== false) {
$name = str_replace('}}', $suffix . '}}', static::tableName());
} else {
$name = static::tableName()... | [
"protected",
"static",
"function",
"buildTableName",
"(",
"$",
"suffix",
"=",
"''",
")",
"{",
"if",
"(",
"true",
"===",
"empty",
"(",
"static",
"::",
"$",
"tablePrefix",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"static",
"::",
"tableName",
"(",
")",
... | Build a valid table name with suffix
@param string $suffix
@return mixed|string | [
"Build",
"a",
"valid",
"table",
"name",
"with",
"suffix"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/traits/PropertiesTrait.php#L45-L57 |
DevGroup-ru/yii2-data-structure-tools | src/traits/PropertiesTrait.php | PropertiesTrait.ensurePropertiesIds | public function ensurePropertiesIds($force = false)
{
if ($this->propertiesIds === null || $force === true) {
$this->ensurePropertyGroupIds();
$this->propertiesIds = [];
foreach ($this->propertyGroupIds as $propertyGroupId) {
$propertyIds = PropertyGroup:... | php | public function ensurePropertiesIds($force = false)
{
if ($this->propertiesIds === null || $force === true) {
$this->ensurePropertyGroupIds();
$this->propertiesIds = [];
foreach ($this->propertyGroupIds as $propertyGroupId) {
$propertyIds = PropertyGroup:... | [
"public",
"function",
"ensurePropertiesIds",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"propertiesIds",
"===",
"null",
"||",
"$",
"force",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"ensurePropertyGroupIds",
"(",
")",
";",... | Ensures that $propertiesIds is filled. Also fills $property_group_ids if needed.
@param boolean $force True to force refreshing properties ids even if they are filled. | [
"Ensures",
"that",
"$propertiesIds",
"is",
"filled",
".",
"Also",
"fills",
"$property_group_ids",
"if",
"needed",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/traits/PropertiesTrait.php#L75-L89 |
DevGroup-ru/yii2-data-structure-tools | src/traits/PropertiesTrait.php | PropertiesTrait.ensurePropertiesAttributes | public function ensurePropertiesAttributes($force = false)
{
if ($this->propertiesAttributes === null || $force === true) {
$this->ensurePropertiesIds($force);
$this->propertiesAttributes = [];
foreach ($this->propertiesIds as $propertyId) {
$this->proper... | php | public function ensurePropertiesAttributes($force = false)
{
if ($this->propertiesAttributes === null || $force === true) {
$this->ensurePropertiesIds($force);
$this->propertiesAttributes = [];
foreach ($this->propertiesIds as $propertyId) {
$this->proper... | [
"public",
"function",
"ensurePropertiesAttributes",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"propertiesAttributes",
"===",
"null",
"||",
"$",
"force",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"ensurePropertiesIds",
"(",
... | Ensures that $propertiesAttributes is filled. Also fills $propertiesIds and $property_group_ids if needed.
@param boolean $force True to force refreshing propertiesAttributes even if they are filled. | [
"Ensures",
"that",
"$propertiesAttributes",
"is",
"filled",
".",
"Also",
"fills",
"$propertiesIds",
"and",
"$property_group_ids",
"if",
"needed",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/traits/PropertiesTrait.php#L96-L106 |
DevGroup-ru/yii2-data-structure-tools | src/traits/PropertiesTrait.php | PropertiesTrait.iterateGroupProperties | public function iterateGroupProperties($propertyGroupId)
{
$propertyIds = PropertyGroup::propertyIdsForGroup($propertyGroupId);
foreach ($propertyIds as $id) {
/** @var Property $property */
$property = Property::findById($id);
$key = $property->key;
y... | php | public function iterateGroupProperties($propertyGroupId)
{
$propertyIds = PropertyGroup::propertyIdsForGroup($propertyGroupId);
foreach ($propertyIds as $id) {
/** @var Property $property */
$property = Property::findById($id);
$key = $property->key;
y... | [
"public",
"function",
"iterateGroupProperties",
"(",
"$",
"propertyGroupId",
")",
"{",
"$",
"propertyIds",
"=",
"PropertyGroup",
"::",
"propertyIdsForGroup",
"(",
"$",
"propertyGroupId",
")",
";",
"foreach",
"(",
"$",
"propertyIds",
"as",
"$",
"id",
")",
"{",
... | @param int $propertyGroupId
@return \Generator
@throws \Exception | [
"@param",
"int",
"$propertyGroupId"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/traits/PropertiesTrait.php#L133-L142 |
DevGroup-ru/yii2-data-structure-tools | src/traits/PropertiesTrait.php | PropertiesTrait.propertiesRules | public function propertiesRules()
{
$rules = [];
$this->ensurePropertiesAttributes();
if (empty($this->propertiesIds) === false) {
foreach ($this->propertiesIds as $propertyId) {
/** @var Property $property */
$property = Property::findById($prope... | php | public function propertiesRules()
{
$rules = [];
$this->ensurePropertiesAttributes();
if (empty($this->propertiesIds) === false) {
foreach ($this->propertiesIds as $propertyId) {
/** @var Property $property */
$property = Property::findById($prope... | [
"public",
"function",
"propertiesRules",
"(",
")",
"{",
"$",
"rules",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"ensurePropertiesAttributes",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"propertiesIds",
")",
"===",
"false",
")",
"{",
"forea... | Array of validation rules for properties
@return array | [
"Array",
"of",
"validation",
"rules",
"for",
"properties"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/traits/PropertiesTrait.php#L214-L232 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Bootstrap.php | Bootstrap.drupal_set_message | public function drupal_set_message($message = null, $type = 'status', $repeat = true)
{
return drupal_set_message($message, $type, $repeat);
} | php | public function drupal_set_message($message = null, $type = 'status', $repeat = true)
{
return drupal_set_message($message, $type, $repeat);
} | [
"public",
"function",
"drupal_set_message",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"type",
"=",
"'status'",
",",
"$",
"repeat",
"=",
"true",
")",
"{",
"return",
"drupal_set_message",
"(",
"$",
"message",
",",
"$",
"type",
",",
"$",
"repeat",
")",
... | Sets a message to display to the user.
Messages are stored in a session variable and displayed in page.tpl.php via
the $messages theme variable.
Example usage:
@code
drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
@endcode
@param string $message
(optional) The translated message ... | [
"Sets",
"a",
"message",
"to",
"display",
"to",
"the",
"user",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Bootstrap.php#L103-L106 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Bootstrap.php | Bootstrap.& | public function &drupal_static($name, $default_value = null, $reset = false)
{
return drupal_static($name, $default_value, $reset);
} | php | public function &drupal_static($name, $default_value = null, $reset = false)
{
return drupal_static($name, $default_value, $reset);
} | [
"public",
"function",
"&",
"drupal_static",
"(",
"$",
"name",
",",
"$",
"default_value",
"=",
"null",
",",
"$",
"reset",
"=",
"false",
")",
"{",
"return",
"drupal_static",
"(",
"$",
"name",
",",
"$",
"default_value",
",",
"$",
"reset",
")",
";",
"}"
] | Provides central static variable storage.
All functions requiring a static variable to persist or cache data within
a single page request are encouraged to use this function unless it is
absolutely certain that the static variable will not need to be reset during
the page request. By centralizing static variable stora... | [
"Provides",
"central",
"static",
"variable",
"storage",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Bootstrap.php#L220-L223 |
taskforcedev/laravel-support | src/Http/Controllers/Controller.php | Controller.buildData | protected function buildData($data = [])
{
$uiHelper = new UIHelper();
$data['layout'] = $this->getLayout(); // Configuration
$data['isAdmin'] = $this->canAdministrate(); // Permissions
$data['sitename'] = $this->getSitename(); // Configuration
$data['framework'] = $uiHelper... | php | protected function buildData($data = [])
{
$uiHelper = new UIHelper();
$data['layout'] = $this->getLayout(); // Configuration
$data['isAdmin'] = $this->canAdministrate(); // Permissions
$data['sitename'] = $this->getSitename(); // Configuration
$data['framework'] = $uiHelper... | [
"protected",
"function",
"buildData",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"uiHelper",
"=",
"new",
"UIHelper",
"(",
")",
";",
"$",
"data",
"[",
"'layout'",
"]",
"=",
"$",
"this",
"->",
"getLayout",
"(",
")",
";",
"// Configuration",
"$",
... | Populates $data object for use in controlers. | [
"Populates",
"$data",
"object",
"for",
"use",
"in",
"controlers",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Http/Controllers/Controller.php#L19-L34 |
taskforcedev/laravel-support | src/Http/Controllers/Controller.php | Controller.getModel | public function getModel($model)
{
/* Get the namespace */
$ns = $this->getAppNamespace();
if ($ns) {
/* Try laravel default convention (models in the app folder). */
$qm = $ns . $model;
if (class_exists($qm)) {
return new $qm;
... | php | public function getModel($model)
{
/* Get the namespace */
$ns = $this->getAppNamespace();
if ($ns) {
/* Try laravel default convention (models in the app folder). */
$qm = $ns . $model;
if (class_exists($qm)) {
return new $qm;
... | [
"public",
"function",
"getModel",
"(",
"$",
"model",
")",
"{",
"/* Get the namespace */",
"$",
"ns",
"=",
"$",
"this",
"->",
"getAppNamespace",
"(",
")",
";",
"if",
"(",
"$",
"ns",
")",
"{",
"/* Try laravel default convention (models in the app folder). */",
"$",
... | Attempt to get an apps model from namespace.
@param $model
@return bool | [
"Attempt",
"to",
"get",
"an",
"apps",
"model",
"from",
"namespace",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Http/Controllers/Controller.php#L96-L113 |
wpup/digster | src/extensions/class-filter-extensions.php | Filter_Extensions.apply_filters | public function apply_filters() {
$args = func_get_args();
$tag = current( array_splice( $args, 1, 1 ) );
return apply_filters_ref_array( $tag, $args );
} | php | public function apply_filters() {
$args = func_get_args();
$tag = current( array_splice( $args, 1, 1 ) );
return apply_filters_ref_array( $tag, $args );
} | [
"public",
"function",
"apply_filters",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"tag",
"=",
"current",
"(",
"array_splice",
"(",
"$",
"args",
",",
"1",
",",
"1",
")",
")",
";",
"return",
"apply_filters_ref_array",
"(",
"$",... | Call WordPress filter.
@return mixed | [
"Call",
"WordPress",
"filter",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-filter-extensions.php#L12-L16 |
wpup/digster | src/extensions/class-filter-extensions.php | Filter_Extensions.getFilters | public function getFilters() {
$filters = [
'apply_filters' => [$this, 'apply_filters'],
'excerpt' => 'wp_trim_words',
'shortcodes' => 'do_shortcode',
'wpautop' => 'wpautop'
];
/**
* Modify filters or add custom.
*
* @param array $callables
*/
$filters = apply_filters( 'd... | php | public function getFilters() {
$filters = [
'apply_filters' => [$this, 'apply_filters'],
'excerpt' => 'wp_trim_words',
'shortcodes' => 'do_shortcode',
'wpautop' => 'wpautop'
];
/**
* Modify filters or add custom.
*
* @param array $callables
*/
$filters = apply_filters( 'd... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"filters",
"=",
"[",
"'apply_filters'",
"=>",
"[",
"$",
"this",
",",
"'apply_filters'",
"]",
",",
"'excerpt'",
"=>",
"'wp_trim_words'",
",",
"'shortcodes'",
"=>",
"'do_shortcode'",
",",
"'wpautop'",
"=>",... | Get filters.
@return array | [
"Get",
"filters",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-filter-extensions.php#L23-L47 |
peridot-php/peridot-httpkernel-plugin | src/HttpKernelPlugin.php | HttpKernelPlugin.onRunnerStart | public function onRunnerStart()
{
$rootSuite = Context::getInstance()->getCurrentSuite();
$rootSuite->getScope()->peridotAddChildScope($this->scope);
} | php | public function onRunnerStart()
{
$rootSuite = Context::getInstance()->getCurrentSuite();
$rootSuite->getScope()->peridotAddChildScope($this->scope);
} | [
"public",
"function",
"onRunnerStart",
"(",
")",
"{",
"$",
"rootSuite",
"=",
"Context",
"::",
"getInstance",
"(",
")",
"->",
"getCurrentSuite",
"(",
")",
";",
"$",
"rootSuite",
"->",
"getScope",
"(",
")",
"->",
"peridotAddChildScope",
"(",
"$",
"this",
"->... | When the runner starts we will mix in the http kernel scope into the root suite,
thereby making it available EVERYWHERE. | [
"When",
"the",
"runner",
"starts",
"we",
"will",
"mix",
"in",
"the",
"http",
"kernel",
"scope",
"into",
"the",
"root",
"suite",
"thereby",
"making",
"it",
"available",
"EVERYWHERE",
"."
] | train | https://github.com/peridot-php/peridot-httpkernel-plugin/blob/db53e0b756f92da9423e5bfc4e9c36affa55473f/src/HttpKernelPlugin.php#L35-L39 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Filter/ExtractStyleBlocks.php | HTMLPurifier_Filter_ExtractStyleBlocks.preFilter | public function preFilter($html, $config, $context) {
$tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
if ($tidy !== null) $this->_tidy = $tidy;
$html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
$style_blocks = $this->_st... | php | public function preFilter($html, $config, $context) {
$tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
if ($tidy !== null) $this->_tidy = $tidy;
$html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
$style_blocks = $this->_st... | [
"public",
"function",
"preFilter",
"(",
"$",
"html",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"tidy",
"=",
"$",
"config",
"->",
"get",
"(",
"'Filter.ExtractStyleBlocks.TidyImpl'",
")",
";",
"if",
"(",
"$",
"tidy",
"!==",
"null",
")",
"$"... | Removes inline <style> tags from HTML, saves them for later use
@todo Extend to indicate non-text/css style blocks | [
"Removes",
"inline",
"<style",
">",
"tags",
"from",
"HTML",
"saves",
"them",
"for",
"later",
"use"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Filter/ExtractStyleBlocks.php#L40-L53 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Filter/ExtractStyleBlocks.php | HTMLPurifier_Filter_ExtractStyleBlocks.cleanCSS | public function cleanCSS($css, $config, $context) {
// prepare scope
$scope = $config->get('Filter.ExtractStyleBlocks.Scope');
if ($scope !== null) {
$scopes = array_map('trim', explode(',', $scope));
} else {
$scopes = array();
}
// remove comment... | php | public function cleanCSS($css, $config, $context) {
// prepare scope
$scope = $config->get('Filter.ExtractStyleBlocks.Scope');
if ($scope !== null) {
$scopes = array_map('trim', explode(',', $scope));
} else {
$scopes = array();
}
// remove comment... | [
"public",
"function",
"cleanCSS",
"(",
"$",
"css",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"// prepare scope",
"$",
"scope",
"=",
"$",
"config",
"->",
"get",
"(",
"'Filter.ExtractStyleBlocks.Scope'",
")",
";",
"if",
"(",
"$",
"scope",
"!==",
"... | Takes CSS (the stuff found in <style>) and cleans it.
@warning Requires CSSTidy <http://csstidy.sourceforge.net/>
@param $css CSS styling to clean
@param $config Instance of HTMLPurifier_Config
@param $context Instance of HTMLPurifier_Context
@return Cleaned CSS | [
"Takes",
"CSS",
"(",
"the",
"stuff",
"found",
"in",
"<style",
">",
")",
"and",
"cleans",
"it",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Filter/ExtractStyleBlocks.php#L63-L131 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/ObjectReferenceNormalizer.php | ObjectReferenceNormalizer.supports | public function supports($data, Resource $resource)
{
$data = $data['value']['name'];
return parent::supports($data, $resource);
} | php | public function supports($data, Resource $resource)
{
$data = $data['value']['name'];
return parent::supports($data, $resource);
} | [
"public",
"function",
"supports",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"[",
"'value'",
"]",
"[",
"'name'",
"]",
";",
"return",
"parent",
"::",
"supports",
"(",
"$",
"data",
",",
"$",
"resource",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/ObjectReferenceNormalizer.php#L24-L29 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/ObjectReferenceNormalizer.php | ObjectReferenceNormalizer.normalize | public function normalize($data, Resource $resource)
{
if (isset($data['value']['option'])) {
$data['value'] = $this->xmlKit->extractContent($data['value']['option']);
}
return $this->createDefinition($data['value']);
} | php | public function normalize($data, Resource $resource)
{
if (isset($data['value']['option'])) {
$data['value'] = $this->xmlKit->extractContent($data['value']['option']);
}
return $this->createDefinition($data['value']);
} | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'value'",
"]",
"[",
"'option'",
"]",
")",
")",
"{",
"$",
"data",
"[",
"'value'",
"]",
"=",
"$",
"this",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/ObjectReferenceNormalizer.php#L34-L41 |
skeeks-cms/cms-rbac | src/controllers/AdminPermissionController.php | AdminPermissionController.actionIndex | public function actionIndex()
{
$searchModel = new AuthItemSearch(['type' => Item::TYPE_PERMISSION]);
$dataProvider = $searchModel->search(Yii::$app->getRequest()->getQueryParams());
return $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $se... | php | public function actionIndex()
{
$searchModel = new AuthItemSearch(['type' => Item::TYPE_PERMISSION]);
$dataProvider = $searchModel->search(Yii::$app->getRequest()->getQueryParams());
return $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $se... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"searchModel",
"=",
"new",
"AuthItemSearch",
"(",
"[",
"'type'",
"=>",
"Item",
"::",
"TYPE_PERMISSION",
"]",
")",
";",
"$",
"dataProvider",
"=",
"$",
"searchModel",
"->",
"search",
"(",
"Yii",
"::",
... | Lists all AuthItem models.
@return mixed | [
"Lists",
"all",
"AuthItem",
"models",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminPermissionController.php#L185-L194 |
skeeks-cms/cms-rbac | src/controllers/AdminPermissionController.php | AdminPermissionController.actionView | public function actionView()
{
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
$authManager = Yii::$app->getAuthManager();
$avaliable = $assigned = [
'Permission' => [],
'Routes' => [],
];
$children = array_ke... | php | public function actionView()
{
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
$authManager = Yii::$app->getAuthManager();
$avaliable = $assigned = [
'Permission' => [],
'Routes' => [],
];
$children = array_ke... | [
"public",
"function",
"actionView",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
";",
"$",
"id",
"=",
"$",
"model",
"->",
"name",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"$",
"authManager... | Displays a single AuthItem model.
@param string $id
@return mixed | [
"Displays",
"a",
"single",
"AuthItem",
"model",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminPermissionController.php#L201-L227 |
skeeks-cms/cms-rbac | src/controllers/AdminPermissionController.php | AdminPermissionController.actionDelete | public function actionDelete()
{
$rr = new RequestResponse();
if ($rr->isRequestAjaxPost()) {
try {
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
if (!in_array($model->item->name, CmsManager::pro... | php | public function actionDelete()
{
$rr = new RequestResponse();
if ($rr->isRequestAjaxPost()) {
try {
$model = $this->model;
$id = $model->name;
$model = $this->findModel($id);
if (!in_array($model->item->name, CmsManager::pro... | [
"public",
"function",
"actionDelete",
"(",
")",
"{",
"$",
"rr",
"=",
"new",
"RequestResponse",
"(",
")",
";",
"if",
"(",
"$",
"rr",
"->",
"isRequestAjaxPost",
"(",
")",
")",
"{",
"try",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
";",
"$",
... | Deletes an existing Game model.
If deletion is successful, the browser will be redirected to the 'index' page.
@return mixed | [
"Deletes",
"an",
"existing",
"Game",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminPermissionController.php#L281-L307 |
skeeks-cms/cms-rbac | src/controllers/AdminPermissionController.php | AdminPermissionController.actionPermissionForRole | public function actionPermissionForRole()
{
$rr = new RequestResponse();
if (!$permissionName = \Yii::$app->request->post('permissionName')) {
$rr->success = false;
$rr->message = "Некорректные параметры";
return $rr;
}
$permission = \Yii::$app->... | php | public function actionPermissionForRole()
{
$rr = new RequestResponse();
if (!$permissionName = \Yii::$app->request->post('permissionName')) {
$rr->success = false;
$rr->message = "Некорректные параметры";
return $rr;
}
$permission = \Yii::$app->... | [
"public",
"function",
"actionPermissionForRole",
"(",
")",
"{",
"$",
"rr",
"=",
"new",
"RequestResponse",
"(",
")",
";",
"if",
"(",
"!",
"$",
"permissionName",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
"'permissionName'",
")... | Выбор файла
@return string | [
"Выбор",
"файла"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/controllers/AdminPermissionController.php#L388-L424 |
dphn/ScContent | src/ScContent/Migration/Schema.php | Schema.up | public function up()
{
$this->down();
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.Content'
)
->up();
$this->buildMapper(
'ScContent.Migration.MapperBase.Search'
)
->up();
... | php | public function up()
{
$this->down();
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.Content'
)
->up();
$this->buildMapper(
'ScContent.Migration.MapperBase.Search'
)
->up();
... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"this",
"->",
"down",
"(",
")",
";",
"try",
"{",
"$",
"this",
"->",
"buildMapper",
"(",
"'ScContent.Migration.MapperBase.Content'",
")",
"->",
"up",
"(",
")",
";",
"$",
"this",
"->",
"buildMapper",
"(",
"... | Migrate.
@throws \ScContent\Exception\MigrationException
@return void | [
"Migrate",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Migration/Schema.php#L27-L80 |
dphn/ScContent | src/ScContent/Migration/Schema.php | Schema.down | public function down()
{
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.Content'
)
->down();
} catch (Exception $e) {
//
}
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.... | php | public function down()
{
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.Content'
)
->down();
} catch (Exception $e) {
//
}
try {
$this->buildMapper(
'ScContent.Migration.MapperBase.... | [
"public",
"function",
"down",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"buildMapper",
"(",
"'ScContent.Migration.MapperBase.Content'",
")",
"->",
"down",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"//",
"}",
"try",
"{",
"$"... | Remove migration from the database.
@return void | [
"Remove",
"migration",
"from",
"the",
"database",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Migration/Schema.php#L87-L160 |
MissAllSunday/Ohara | src/Suki/Config.php | Config.getConfig | public function getConfig(): array
{
global $txt, $modSettings;
$file = $this->_app->boardDir .'/_config'. $this->_app->name .'.json';
// Already loaded or does not use config?
if ($this->_config || !$this->_app->useConfig)
return $this->_config;
// Check for a $modSettings key first.
if (!empty($mod... | php | public function getConfig(): array
{
global $txt, $modSettings;
$file = $this->_app->boardDir .'/_config'. $this->_app->name .'.json';
// Already loaded or does not use config?
if ($this->_config || !$this->_app->useConfig)
return $this->_config;
// Check for a $modSettings key first.
if (!empty($mod... | [
"public",
"function",
"getConfig",
"(",
")",
":",
"array",
"{",
"global",
"$",
"txt",
",",
"$",
"modSettings",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"_app",
"->",
"boardDir",
".",
"'/_config'",
".",
"$",
"this",
"->",
"_app",
"->",
"name",
".",
... | Gets a mod's config settings, loads it and store it on {@link $_config}
Checks if a $modSettings key exists and tries to load the info from it, defaults to check for a json file.
@access public
@return array | [
"Gets",
"a",
"mod",
"s",
"config",
"settings",
"loads",
"it",
"and",
"store",
"it",
"on",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Config.php#L29-L54 |
MissAllSunday/Ohara | src/Suki/Config.php | Config.get | public function get($name = '')
{
// This needs to be extended by somebody else!
if(!$this->_app->name)
return [];
// Not defined huh?
if (!$this->_config)
$this->getConfig();
return $name ? (isset($this->_config['_'. $name]) ? $this->_config['_'. $name] : []) : $this->_config;
} | php | public function get($name = '')
{
// This needs to be extended by somebody else!
if(!$this->_app->name)
return [];
// Not defined huh?
if (!$this->_config)
$this->getConfig();
return $name ? (isset($this->_config['_'. $name]) ? $this->_config['_'. $name] : []) : $this->_config;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"// This needs to be extended by somebody else!",
"if",
"(",
"!",
"$",
"this",
"->",
"_app",
"->",
"name",
")",
"return",
"[",
"]",
";",
"// Not defined huh?",
"if",
"(",
"!",
"$",
"this",... | Gets a specific mod config array.
@access public
@param string $name The name of an specific setting, if empty it will return the entire array.
@return array | [
"Gets",
"a",
"specific",
"mod",
"config",
"array",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Config.php#L62-L73 |
MissAllSunday/Ohara | src/Suki/Config.php | Config.put | public function put($values = [])
{
// The usual checks.
if (empty($values) || !$this->_app->name)
return [];
// Work with arrays.
$values = (array) $values;
// Does it exists?
if (!$this->_config)
$this->getConfig();
// Perform. Overwrite the values.
$this->_config = array_merge($this->_confi... | php | public function put($values = [])
{
// The usual checks.
if (empty($values) || !$this->_app->name)
return [];
// Work with arrays.
$values = (array) $values;
// Does it exists?
if (!$this->_config)
$this->getConfig();
// Perform. Overwrite the values.
$this->_config = array_merge($this->_confi... | [
"public",
"function",
"put",
"(",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"// The usual checks.",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
"||",
"!",
"$",
"this",
"->",
"_app",
"->",
"name",
")",
"return",
"[",
"]",
";",
"// Work with arrays.",
"... | Insert/Updates a mod config value.
@access public
@param array $values an array of values to be inserted, it follows a name => value format
@return array the full modified config array. An empty array if the process couldn't be performed. | [
"Insert",
"/",
"Updates",
"a",
"mod",
"config",
"value",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Config.php#L81-L102 |
mimmi20/Wurfl | src/Handlers/Matcher/RISMatcher.php | RISMatcher.match | public function match(&$collection, $needle, $tolerance)
{
$match = null;
$bestDistance = 0;
$low = 0;
$high = count($collection) - 1;
$bestIndex = 0;
while ($low <= $high) {
$mid = (int) round(($low + $high) / 2);
... | php | public function match(&$collection, $needle, $tolerance)
{
$match = null;
$bestDistance = 0;
$low = 0;
$high = count($collection) - 1;
$bestIndex = 0;
while ($low <= $high) {
$mid = (int) round(($low + $high) / 2);
... | [
"public",
"function",
"match",
"(",
"&",
"$",
"collection",
",",
"$",
"needle",
",",
"$",
"tolerance",
")",
"{",
"$",
"match",
"=",
"null",
";",
"$",
"bestDistance",
"=",
"0",
";",
"$",
"low",
"=",
"0",
";",
"$",
"high",
"=",
"count",
"(",
"$",
... | Returns the closest match of $needle in $collection of user agents
@param array &$collection array Array of user agents
@param string $needle string substring to look for in user agent
@param int $tolerance integer Minimum required length of prefix match
@return string Device ID that matches user agent or ... | [
"Returns",
"the",
"closest",
"match",
"of",
"$needle",
"in",
"$collection",
"of",
"user",
"agents"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Matcher/RISMatcher.php#L61-L101 |
mimmi20/Wurfl | src/Handlers/Matcher/RISMatcher.php | RISMatcher.firstOfTheBests | private function firstOfTheBests($collection, $needle, $bestIndex, $bestDistance)
{
while ($bestIndex > 0 && $this->longestCommonPrefixLength(
$collection[$bestIndex - 1],
$needle
) === $bestDistance) {
--$bestIndex;
}
return $collection[$bestInde... | php | private function firstOfTheBests($collection, $needle, $bestIndex, $bestDistance)
{
while ($bestIndex > 0 && $this->longestCommonPrefixLength(
$collection[$bestIndex - 1],
$needle
) === $bestDistance) {
--$bestIndex;
}
return $collection[$bestInde... | [
"private",
"function",
"firstOfTheBests",
"(",
"$",
"collection",
",",
"$",
"needle",
",",
"$",
"bestIndex",
",",
"$",
"bestDistance",
")",
"{",
"while",
"(",
"$",
"bestIndex",
">",
"0",
"&&",
"$",
"this",
"->",
"longestCommonPrefixLength",
"(",
"$",
"coll... | Returns the most accurate match of $needle in $collection
@param $collection array Array of user agents
@param string $needle string String to search for in user agents
@param int $bestIndex integer
@param int $bestDistance integer
@return string Device ID | [
"Returns",
"the",
"most",
"accurate",
"match",
"of",
"$needle",
"in",
"$collection"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Matcher/RISMatcher.php#L113-L123 |
mimmi20/Wurfl | src/Handlers/Matcher/RISMatcher.php | RISMatcher.longestCommonPrefixLength | private function longestCommonPrefixLength($string1, $string2)
{
$length = min(strlen($string1), strlen($string2));
$index = 0;
while ($index < $length) {
if ($string1[$index] !== $string2[$index]) {
break;
}
++$index;
}
... | php | private function longestCommonPrefixLength($string1, $string2)
{
$length = min(strlen($string1), strlen($string2));
$index = 0;
while ($index < $length) {
if ($string1[$index] !== $string2[$index]) {
break;
}
++$index;
}
... | [
"private",
"function",
"longestCommonPrefixLength",
"(",
"$",
"string1",
",",
"$",
"string2",
")",
"{",
"$",
"length",
"=",
"min",
"(",
"strlen",
"(",
"$",
"string1",
")",
",",
"strlen",
"(",
"$",
"string2",
")",
")",
";",
"$",
"index",
"=",
"0",
";"... | Returns the largest number of matching characters between $s and $t
@param $string1 string String 1
@param $string2 string String 2
@return int Longest prefix length | [
"Returns",
"the",
"largest",
"number",
"of",
"matching",
"characters",
"between",
"$s",
"and",
"$t"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Matcher/RISMatcher.php#L133-L147 |
cicada/cicada | src/Routing/Route.php | Route.matches | public function matches($url)
{
$pattern = $this->getRegexPattern();
if (preg_match($pattern, $url, $matches)) {
// Remove entries with int keys to filter out only named matches
foreach ($matches as $key => $value) {
if (is_int($key)) {
u... | php | public function matches($url)
{
$pattern = $this->getRegexPattern();
if (preg_match($pattern, $url, $matches)) {
// Remove entries with int keys to filter out only named matches
foreach ($matches as $key => $value) {
if (is_int($key)) {
u... | [
"public",
"function",
"matches",
"(",
"$",
"url",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"getRegexPattern",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"url",
",",
"$",
"matches",
")",
")",
"{",
"// Remove entrie... | Checks whether this route matches the given url. | [
"Checks",
"whether",
"this",
"route",
"matches",
"the",
"given",
"url",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Routing/Route.php#L92-L109 |
cicada/cicada | src/Routing/Route.php | Route.run | public function run(Application $app, Request $request, array $arguments = [])
{
return $this->processRequest($app, $request, $this->callback, $arguments);
} | php | public function run(Application $app, Request $request, array $arguments = [])
{
return $this->processRequest($app, $request, $this->callback, $arguments);
} | [
"public",
"function",
"run",
"(",
"Application",
"$",
"app",
",",
"Request",
"$",
"request",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"processRequest",
"(",
"$",
"app",
",",
"$",
"request",
",",
"$",
"this... | Processes the Request and returns a Response.
@throws UnexpectedValueException If the route callback returns a value
which is not a string or Response object. | [
"Processes",
"the",
"Request",
"and",
"returns",
"a",
"Response",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Routing/Route.php#L117-L120 |
cicada/cicada | src/Routing/Route.php | Route.getRealPath | public function getRealPath($params)
{
$route = $this->getName();
if (empty($route)) {
$route = $this->path;
}
$path = $this->prefix . $this->path;
// Locate placeholders in curly braces
$count = preg_match_all('/{([^}]+)}/', $path, $matches);
f... | php | public function getRealPath($params)
{
$route = $this->getName();
if (empty($route)) {
$route = $this->path;
}
$path = $this->prefix . $this->path;
// Locate placeholders in curly braces
$count = preg_match_all('/{([^}]+)}/', $path, $matches);
f... | [
"public",
"function",
"getRealPath",
"(",
"$",
"params",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"route",
")",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"path",
";",
"}",
"$"... | Returns the route's path, with {placeholders} substituted with values
from $params.
For example, if `$this->path = "/hello/{name}"`, and
`$params = ["name" => "ivan"]`, this method will return `/hello/ivan`.
@param array $params Associative array holding parameters to substitute.
@return string The route's path.
@... | [
"Returns",
"the",
"route",
"s",
"path",
"with",
"{",
"placeholders",
"}",
"substituted",
"with",
"values",
"from",
"$params",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Routing/Route.php#L136-L169 |
cicada/cicada | src/Routing/Route.php | Route.method | public function method($method)
{
if (!in_array($method, $this->methods)) {
throw new \InvalidArgumentException("Unknown HTTP method: $method");
}
$this->method = $method;
return $this;
} | php | public function method($method)
{
if (!in_array($method, $this->methods)) {
throw new \InvalidArgumentException("Unknown HTTP method: $method");
}
$this->method = $method;
return $this;
} | [
"public",
"function",
"method",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"method",
",",
"$",
"this",
"->",
"methods",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Unknown HTTP method: $method\"",
")",
... | Sets the route's HTTP method. | [
"Sets",
"the",
"route",
"s",
"HTTP",
"method",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Routing/Route.php#L174-L183 |
cicada/cicada | src/Routing/Route.php | Route.compileRegex | private function compileRegex()
{
// Prepend the prefix
$path = $this->prefix . $this->path;
$asserts = $this->asserts;
// Replace placeholders in curly braces with named regex groups
$callback = function ($matches) use ($asserts) {
$name = $matches[1];
... | php | private function compileRegex()
{
// Prepend the prefix
$path = $this->prefix . $this->path;
$asserts = $this->asserts;
// Replace placeholders in curly braces with named regex groups
$callback = function ($matches) use ($asserts) {
$name = $matches[1];
... | [
"private",
"function",
"compileRegex",
"(",
")",
"{",
"// Prepend the prefix",
"$",
"path",
"=",
"$",
"this",
"->",
"prefix",
".",
"$",
"this",
"->",
"path",
";",
"$",
"asserts",
"=",
"$",
"this",
"->",
"asserts",
";",
"// Replace placeholders in curly braces ... | Compiles a regex pattern which matches this route. | [
"Compiles",
"a",
"regex",
"pattern",
"which",
"matches",
"this",
"route",
"."
] | train | https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/Routing/Route.php#L281-L306 |
boxberry-delivery/php-api-common | src/Message/Request/AbstractRequest.php | AbstractRequest.validateData | public function validateData()
{
$constraint = new Assert\Collection([
'fields' => $this->getValidationRules(),
]);
$violations = $this->validator->validate($this->getParameters(), $constraint);
if ($violations->count()) {
throw new ValidatorException($violat... | php | public function validateData()
{
$constraint = new Assert\Collection([
'fields' => $this->getValidationRules(),
]);
$violations = $this->validator->validate($this->getParameters(), $constraint);
if ($violations->count()) {
throw new ValidatorException($violat... | [
"public",
"function",
"validateData",
"(",
")",
"{",
"$",
"constraint",
"=",
"new",
"Assert",
"\\",
"Collection",
"(",
"[",
"'fields'",
"=>",
"$",
"this",
"->",
"getValidationRules",
"(",
")",
",",
"]",
")",
";",
"$",
"violations",
"=",
"$",
"this",
"-... | Валидация параметров запроса
@throws \Symfony\Component\Validator\Exception\MissingOptionsException
@throws \Symfony\Component\Validator\Exception\InvalidOptionsException
@throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException | [
"Валидация",
"параметров",
"запроса"
] | train | https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Message/Request/AbstractRequest.php#L106-L118 |
boxberry-delivery/php-api-common | src/Message/Request/AbstractRequest.php | AbstractRequest.getValidationRules | public function getValidationRules()
{
return [
'endPoint' => new Assert\Required([
new Assert\NotNull(),
new Assert\Type(['type' => 'string']),
]),
'api_token' => new Assert\Required([
new Assert\NotNull(),
... | php | public function getValidationRules()
{
return [
'endPoint' => new Assert\Required([
new Assert\NotNull(),
new Assert\Type(['type' => 'string']),
]),
'api_token' => new Assert\Required([
new Assert\NotNull(),
... | [
"public",
"function",
"getValidationRules",
"(",
")",
"{",
"return",
"[",
"'endPoint'",
"=>",
"new",
"Assert",
"\\",
"Required",
"(",
"[",
"new",
"Assert",
"\\",
"NotNull",
"(",
")",
",",
"new",
"Assert",
"\\",
"Type",
"(",
"[",
"'type'",
"=>",
"'string'... | Возвращает правила валидации
@return array
@throws \Symfony\Component\Validator\Exception\MissingOptionsException
@throws \Symfony\Component\Validator\Exception\InvalidOptionsException
@throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException | [
"Возвращает",
"правила",
"валидации"
] | train | https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Message/Request/AbstractRequest.php#L128-L140 |
boxberry-delivery/php-api-common | src/Message/Request/AbstractRequest.php | AbstractRequest.setParameter | protected function setParameter($key, $value)
{
if (null !== $this->response) {
throw new RuntimeException('Request cannot be modified after it has been sent!');
}
$this->parameters->set($key, $value);
return $this;
} | php | protected function setParameter($key, $value)
{
if (null !== $this->response) {
throw new RuntimeException('Request cannot be modified after it has been sent!');
}
$this->parameters->set($key, $value);
return $this;
} | [
"protected",
"function",
"setParameter",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"response",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Request cannot be modified after it has been sent!'",
")",
";",
... | Устанавливает параметр запроса
@param $key
@param $value
@return $this
@throws RuntimeException | [
"Устанавливает",
"параметр",
"запроса"
] | train | https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Message/Request/AbstractRequest.php#L266-L274 |
leadthread/php-bitly | src/Bitly.php | Bitly.handleResponse | protected function handleResponse($raw){
$data = json_decode($raw,true);
if(!isset($data['status_code'])){
return $raw;
}
if($data['status_code']>=300 || $data['status_code']<200){
switch ($data['status_txt']) {
case 'RATE_LIMIT_EXCEEDED':
... | php | protected function handleResponse($raw){
$data = json_decode($raw,true);
if(!isset($data['status_code'])){
return $raw;
}
if($data['status_code']>=300 || $data['status_code']<200){
switch ($data['status_txt']) {
case 'RATE_LIMIT_EXCEEDED':
... | [
"protected",
"function",
"handleResponse",
"(",
"$",
"raw",
")",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"raw",
",",
"true",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'status_code'",
"]",
")",
")",
"{",
"return",
"$",
"raw"... | Returns the response data or throws an Exception if it was unsuccessful
@param string $raw The data from the response
@return array | [
"Returns",
"the",
"response",
"data",
"or",
"throws",
"an",
"Exception",
"if",
"it",
"was",
"unsuccessful"
] | train | https://github.com/leadthread/php-bitly/blob/1ffdac16afbb192862f71abe2e263161727dee84/src/Bitly.php#L51-L74 |
leadthread/php-bitly | src/Bitly.php | Bitly.fixUrl | protected function fixUrl($url, $encode){
if(strpos($url, "http") !== 0){
$url = "http://".$url;
}
if($encode){
$url = urlencode($url);
}
return $url;
} | php | protected function fixUrl($url, $encode){
if(strpos($url, "http") !== 0){
$url = "http://".$url;
}
if($encode){
$url = urlencode($url);
}
return $url;
} | [
"protected",
"function",
"fixUrl",
"(",
"$",
"url",
",",
"$",
"encode",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"\"http\"",
")",
"!==",
"0",
")",
"{",
"$",
"url",
"=",
"\"http://\"",
".",
"$",
"url",
";",
"}",
"if",
"(",
"$",
"enco... | Returns a corrected URL
@param string $url The URL to modify
@param boolean $encode Whether or not to encode the URL
@return string The corrected URL | [
"Returns",
"a",
"corrected",
"URL"
] | train | https://github.com/leadthread/php-bitly/blob/1ffdac16afbb192862f71abe2e263161727dee84/src/Bitly.php#L82-L92 |
leadthread/php-bitly | src/Bitly.php | Bitly.exec | protected function exec($url)
{
$client = $this->getRequest();
$response = $client->request('GET',$url);
return $this->handleResponse($response->getBody());
} | php | protected function exec($url)
{
$client = $this->getRequest();
$response = $client->request('GET',$url);
return $this->handleResponse($response->getBody());
} | [
"protected",
"function",
"exec",
"(",
"$",
"url",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"client",
"->",
"request",
"(",
"'GET'",
",",
"$",
"url",
")",
";",
"return",
"$",
"this",
... | Executes a CURL request to the Bitly API
@param string $url The URL to send to
@return mixed The response data | [
"Executes",
"a",
"CURL",
"request",
"to",
"the",
"Bitly",
"API"
] | train | https://github.com/leadthread/php-bitly/blob/1ffdac16afbb192862f71abe2e263161727dee84/src/Bitly.php#L121-L126 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Services.php | Services.search | public function search($filter, $fields){
$param = array(
'filter' => json_encode($filter),
'fields' => json_encode($fields)
);
return $this->get('inventory/resources/', $param);
} | php | public function search($filter, $fields){
$param = array(
'filter' => json_encode($filter),
'fields' => json_encode($fields)
);
return $this->get('inventory/resources/', $param);
} | [
"public",
"function",
"search",
"(",
"$",
"filter",
",",
"$",
"fields",
")",
"{",
"$",
"param",
"=",
"array",
"(",
"'filter'",
"=>",
"json_encode",
"(",
"$",
"filter",
")",
",",
"'fields'",
"=>",
"json_encode",
"(",
"$",
"fields",
")",
")",
";",
"ret... | Search a service
@link https://developer.serverdensity.com/docs/searching-for-a-service
@param array $filter an array of arrays of fields to filter on
@param array $fields an array of fields to keep in search
@return an array of arrays with all services. | [
"Search",
"a",
"service"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Services.php#L58-L65 |
todstoychev/icr | src/ServiceProvider.php | ServiceProvider.register | public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/../config/config.php',
'icr'
);
$this->app->bind(
'manipulator.factory',
function () {
return new ManipulatorFactory(new Box(), new Point());
}
... | php | public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/../config/config.php',
'icr'
);
$this->app->bind(
'manipulator.factory',
function () {
return new ManipulatorFactory(new Box(), new Point());
}
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/config.php'",
",",
"'icr'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'manipulator.factory'",
",",
"function",
"(",
")",
... | Register the application services.
@return void | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/ServiceProvider.php#L35-L60 |
joomla-projects/jorobo | src/Tasks/Build/Template.php | Template.run | public function run()
{
$this->say('Building template: ' . $this->templateName);
// Prepare directories
$this->prepareDirectories();
$files = $this->copyTarget($this->source, $this->target);
// Build media (relative path)
$media = $this->buildMedia("media/" . $this->templateName, $this->templateName);
... | php | public function run()
{
$this->say('Building template: ' . $this->templateName);
// Prepare directories
$this->prepareDirectories();
$files = $this->copyTarget($this->source, $this->target);
// Build media (relative path)
$media = $this->buildMedia("media/" . $this->templateName, $this->templateName);
... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Building template: '",
".",
"$",
"this",
"->",
"templateName",
")",
";",
"// Prepare directories",
"$",
"this",
"->",
"prepareDirectories",
"(",
")",
";",
"$",
"files",
"=",
"$",
... | Build the package
@return bool
@since 1.0 | [
"Build",
"the",
"package"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Template.php#L63-L86 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/RationalTypeFactory.php | RationalTypeFactory.create | public static function create($numerator, $denominator = null)
{
if (is_string($numerator)) {
return self::fromString($numerator);
}
if (is_float($numerator) || $numerator instanceof FloatType) {
return self::fromFloat($numerator);
}
if ($numerator i... | php | public static function create($numerator, $denominator = null)
{
if (is_string($numerator)) {
return self::fromString($numerator);
}
if (is_float($numerator) || $numerator instanceof FloatType) {
return self::fromFloat($numerator);
}
if ($numerator i... | [
"public",
"static",
"function",
"create",
"(",
"$",
"numerator",
",",
"$",
"denominator",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"numerator",
")",
")",
"{",
"return",
"self",
"::",
"fromString",
"(",
"$",
"numerator",
")",
";",
"}",
... | Rational type factory
Construct and return a rational. You can send in
- a NumericInterface as numerator and no denominator - will return that as a rational
- a string conforming to 'n/d'
- a float
- two ints or two IntTypes (numerator, denominator)
@param mixed $numerator
@param mixed $denominator
@return \Chippyash... | [
"Rational",
"type",
"factory",
"Construct",
"and",
"return",
"a",
"rational",
".",
"You",
"can",
"send",
"in",
"-",
"a",
"NumericInterface",
"as",
"numerator",
"and",
"no",
"denominator",
"-",
"will",
"return",
"that",
"as",
"a",
"rational",
"-",
"a",
"str... | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L55-L80 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/RationalTypeFactory.php | RationalTypeFactory.fromFloat | public static function fromFloat($float, $tolerance = null)
{
if ($float instanceof FloatType) {
$float = $float();
}
if ($float == 0.0) {
return new RationalType(new IntType(0), new IntType(1));
}
if ($tolerance instanceof FloatType) {
$to... | php | public static function fromFloat($float, $tolerance = null)
{
if ($float instanceof FloatType) {
$float = $float();
}
if ($float == 0.0) {
return new RationalType(new IntType(0), new IntType(1));
}
if ($tolerance instanceof FloatType) {
$to... | [
"public",
"static",
"function",
"fromFloat",
"(",
"$",
"float",
",",
"$",
"tolerance",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"float",
"instanceof",
"FloatType",
")",
"{",
"$",
"float",
"=",
"$",
"float",
"(",
")",
";",
"}",
"if",
"(",
"$",
"float"... | Create a rational number from a float or FloatType
Use Continued Fractions method of determining the rational number
@param float|FloatType $float
@param float|FloatType $tolerance -
Default is whatever is currently set but normally self::CF_DEFAULT_TOLERANCE
@return \Chippyash\Type\Number\Rational\RationalType|\Chip... | [
"Create",
"a",
"rational",
"number",
"from",
"a",
"float",
"or",
"FloatType",
"Use",
"Continued",
"Fractions",
"method",
"of",
"determining",
"the",
"rational",
"number"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L94-L134 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/RationalTypeFactory.php | RationalTypeFactory.fromString | public static function fromString($string)
{
$matches = array();
$valid = \preg_match(
'#^(-)? *?(\d+) *?/ *?(-)? *?(\d+)$#',
\trim($string),
$matches
);
if ($valid !== 1) {
throw new \InvalidArgumentException(
'The str... | php | public static function fromString($string)
{
$matches = array();
$valid = \preg_match(
'#^(-)? *?(\d+) *?/ *?(-)? *?(\d+)$#',
\trim($string),
$matches
);
if ($valid !== 1) {
throw new \InvalidArgumentException(
'The str... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"string",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"$",
"valid",
"=",
"\\",
"preg_match",
"(",
"'#^(-)? *?(\\d+) *?/ *?(-)? *?(\\d+)$#'",
",",
"\\",
"trim",
"(",
"$",
"string",
")",
",",... | Create a rational number from a string in form 'n/d'
Thanks to Florian Wolters where I lifted this from and amended it
@link http://github.com/FlorianWolters/PHP-Component-Number-Fraction
@param string $string
@return \Chippyash\Type\Number\Rational\RationalType|\Chippyash\Type\Number\Rational\GMPRationalType
@thro... | [
"Create",
"a",
"rational",
"number",
"from",
"a",
"string",
"in",
"form",
"n",
"/",
"d"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L148-L172 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/RationalTypeFactory.php | RationalTypeFactory.createCorrectRational | protected static function createCorrectRational($num, $den)
{
if (self::getRequiredType() == self::TYPE_GMP) {
// @codeCoverageIgnoreStart
return new GMPRationalType(new GMPIntType($num), new GMPIntType($den));
// @codeCoverageIgnoreEnd
}
return ... | php | protected static function createCorrectRational($num, $den)
{
if (self::getRequiredType() == self::TYPE_GMP) {
// @codeCoverageIgnoreStart
return new GMPRationalType(new GMPIntType($num), new GMPIntType($den));
// @codeCoverageIgnoreEnd
}
return ... | [
"protected",
"static",
"function",
"createCorrectRational",
"(",
"$",
"num",
",",
"$",
"den",
")",
"{",
"if",
"(",
"self",
"::",
"getRequiredType",
"(",
")",
"==",
"self",
"::",
"TYPE_GMP",
")",
"{",
"// @codeCoverageIgnoreStart",
"return",
"new",
"GMPRational... | Create and return the correct number type rational
@param int $num
@param int $den
@return \Chippyash\Type\Number\Rational\RationalType|\Chippyash\Type\Number\Rational\GMPRationalType | [
"Create",
"and",
"return",
"the",
"correct",
"number",
"type",
"rational"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L197-L207 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.