repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mpf-soft/admin-widgets | form/Field.php | Field.getLabel | public function getLabel() {
if ($this->label) {
return $this->translate($this->label);
}
$labels = array();
if ($this->form->model && is_string($this->form->model)) {
$class = $this->form->model;
$labels = $class::getLabels();
} elseif ($this-... | php | public function getLabel() {
if ($this->label) {
return $this->translate($this->label);
}
$labels = array();
if ($this->form->model && is_string($this->form->model)) {
$class = $this->form->model;
$labels = $class::getLabels();
} elseif ($this-... | [
"public",
"function",
"getLabel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"label",
")",
"{",
"return",
"$",
"this",
"->",
"translate",
"(",
"$",
"this",
"->",
"label",
")",
";",
"}",
"$",
"labels",
"=",
"array",
"(",
")",
";",
"if",
"(",
"... | Get label for current field. It will first try to get label attribute, if that's not specified it will check for a model
and read the label from there, if it's still not found then it will generate one using the name.
@return string | [
"Get",
"label",
"for",
"current",
"field",
".",
"It",
"will",
"first",
"try",
"to",
"get",
"label",
"attribute",
"if",
"that",
"s",
"not",
"specified",
"it",
"will",
"check",
"for",
"a",
"model",
"and",
"read",
"the",
"label",
"from",
"there",
"if",
"i... | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/form/Field.php#L123-L139 | train |
mpf-soft/admin-widgets | form/Field.php | Field.display | public function display(Form $form) {
if (!$this->visible){
return "";
}
$this->form = $form;
if (!isset($this->rowHtmlOptions['class'])) {
$this->rowHtmlOptions['class'] = $this->rowClass;
} else {
$this->rowHtmlOptions['class'] .= ' ' . $this... | php | public function display(Form $form) {
if (!$this->visible){
return "";
}
$this->form = $form;
if (!isset($this->rowHtmlOptions['class'])) {
$this->rowHtmlOptions['class'] = $this->rowClass;
} else {
$this->rowHtmlOptions['class'] .= ' ' . $this... | [
"public",
"function",
"display",
"(",
"Form",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
"\"\"",
";",
"}",
"$",
"this",
"->",
"form",
"=",
"$",
"form",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this"... | Get html content for current field.
@param \mpf\widgets\form\Form $form
@return string | [
"Get",
"html",
"content",
"for",
"current",
"field",
"."
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/form/Field.php#L146-L160 | train |
mpf-soft/admin-widgets | form/Field.php | Field.getHTMLError | public function getHTMLError() {
$error = $this->getError();
if (!is_null($error)) {
if (is_string($error)) {
$errorContent = Html::get()->tag('span', $error);
} elseif (is_array($error)) {
$errors = array();
foreach ($error as $mes... | php | public function getHTMLError() {
$error = $this->getError();
if (!is_null($error)) {
if (is_string($error)) {
$errorContent = Html::get()->tag('span', $error);
} elseif (is_array($error)) {
$errors = array();
foreach ($error as $mes... | [
"public",
"function",
"getHTMLError",
"(",
")",
"{",
"$",
"error",
"=",
"$",
"this",
"->",
"getError",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"error",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"error",
")",
")",
"{",
"$",
"e... | Get HTML code for errors.
@return string | [
"Get",
"HTML",
"code",
"for",
"errors",
"."
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/form/Field.php#L173-L190 | train |
mpf-soft/admin-widgets | form/Field.php | Field.getError | public function getError() {
if ($this->error) {
return $this->translate($this->error);
}
if ($this->form->model && is_object($this->form->model) && $this->form->model->hasErrors($this->name)) {
$errors = $this->form->model->getErrors($this->name);
foreach ($e... | php | public function getError() {
if ($this->error) {
return $this->translate($this->error);
}
if ($this->form->model && is_object($this->form->model) && $this->form->model->hasErrors($this->name)) {
$errors = $this->form->model->getErrors($this->name);
foreach ($e... | [
"public",
"function",
"getError",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"error",
")",
"{",
"return",
"$",
"this",
"->",
"translate",
"(",
"$",
"this",
"->",
"error",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"form",
"->",
"model",
"&&",... | Return a simple text message or a list of messages with errors for current field
@return string|string[]|null | [
"Return",
"a",
"simple",
"text",
"message",
"or",
"a",
"list",
"of",
"messages",
"with",
"errors",
"for",
"current",
"field"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/form/Field.php#L202-L214 | train |
SlabPHP/database | src/Driver.php | Driver.query | public function query($sql, $binders = array(), $suggestedClass = null, $debug = false)
{
//By keeping track of the last binding location, we can skip
//binders that are within bound data
$minBinderLocation = 0;
if (!is_array($binders)) $binders = array($binders);
if (!empt... | php | public function query($sql, $binders = array(), $suggestedClass = null, $debug = false)
{
//By keeping track of the last binding location, we can skip
//binders that are within bound data
$minBinderLocation = 0;
if (!is_array($binders)) $binders = array($binders);
if (!empt... | [
"public",
"function",
"query",
"(",
"$",
"sql",
",",
"$",
"binders",
"=",
"array",
"(",
")",
",",
"$",
"suggestedClass",
"=",
"null",
",",
"$",
"debug",
"=",
"false",
")",
"{",
"//By keeping track of the last binding location, we can skip",
"//binders that are wit... | Run an SQL query
@param string $sql
@param string[] $binders
@param string $suggestedClass
@return \Slab\Components\Database\ResponseInterface | [
"Run",
"an",
"SQL",
"query"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Driver.php#L72-L109 | train |
OxfordInfoLabs/kinikit-core | src/Util/Serialisation/Serialisable.php | Serialisable.__getSerialisablePropertyValue | public function __getSerialisablePropertyValue($propertyName) {
$map = $this->__getSerialisablePropertyMap();
if (array_key_exists($propertyName, $map)) {
return $map [$propertyName];
} elseif (array_key_exists(substr(strtoupper($propertyName), 0, 1) . substr($propertyName, 1), $map)... | php | public function __getSerialisablePropertyValue($propertyName) {
$map = $this->__getSerialisablePropertyMap();
if (array_key_exists($propertyName, $map)) {
return $map [$propertyName];
} elseif (array_key_exists(substr(strtoupper($propertyName), 0, 1) . substr($propertyName, 1), $map)... | [
"public",
"function",
"__getSerialisablePropertyValue",
"(",
"$",
"propertyName",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"__getSerialisablePropertyMap",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"propertyName",
",",
"$",
"map",
")",
")",
... | Get a serialisable property value by name if it exists. Throw an exception if it doesn't exist.
@param string $propertyName | [
"Get",
"a",
"serialisable",
"property",
"value",
"by",
"name",
"if",
"it",
"exists",
".",
"Throw",
"an",
"exception",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/Serialisable.php#L32-L41 | train |
OxfordInfoLabs/kinikit-core | src/Util/Serialisation/Serialisable.php | Serialisable.__getSerialisablePropertyMap | public function __getSerialisablePropertyMap() {
$propertyAccessors = $this->__findSerialisablePropertyAccessors();
$propertyMap = array();
foreach ($propertyAccessors as $accessorSet) {
// If a get accessor exists, add it to the map
if (isset ($accessorSet ["get"])) {
... | php | public function __getSerialisablePropertyMap() {
$propertyAccessors = $this->__findSerialisablePropertyAccessors();
$propertyMap = array();
foreach ($propertyAccessors as $accessorSet) {
// If a get accessor exists, add it to the map
if (isset ($accessorSet ["get"])) {
... | [
"public",
"function",
"__getSerialisablePropertyMap",
"(",
")",
"{",
"$",
"propertyAccessors",
"=",
"$",
"this",
"->",
"__findSerialisablePropertyAccessors",
"(",
")",
";",
"$",
"propertyMap",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"propertyAccessors",
... | Get an associative array of all of the serialisable properties defined on this class. | [
"Get",
"an",
"associative",
"array",
"of",
"all",
"of",
"the",
"serialisable",
"properties",
"defined",
"on",
"this",
"class",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/Serialisable.php#L56-L98 | train |
OxfordInfoLabs/kinikit-core | src/Util/Serialisation/Serialisable.php | Serialisable.__setSerialisablePropertyMap | public function __setSerialisablePropertyMap($propertyMap, $ignoreNoneWritableProperties = false) {
$propertyAccessors = $this->__findSerialisablePropertyAccessors();
$noneWritables = array();
foreach ($propertyMap as $inputPropertyName => $propertyValue) {
$propertyName = strtolowe... | php | public function __setSerialisablePropertyMap($propertyMap, $ignoreNoneWritableProperties = false) {
$propertyAccessors = $this->__findSerialisablePropertyAccessors();
$noneWritables = array();
foreach ($propertyMap as $inputPropertyName => $propertyValue) {
$propertyName = strtolowe... | [
"public",
"function",
"__setSerialisablePropertyMap",
"(",
"$",
"propertyMap",
",",
"$",
"ignoreNoneWritableProperties",
"=",
"false",
")",
"{",
"$",
"propertyAccessors",
"=",
"$",
"this",
"->",
"__findSerialisablePropertyAccessors",
"(",
")",
";",
"$",
"noneWritables... | Set an associative array of serialisable properties | [
"Set",
"an",
"associative",
"array",
"of",
"serialisable",
"properties"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/Serialisable.php#L104-L148 | train |
OxfordInfoLabs/kinikit-core | src/Util/Serialisation/Serialisable.php | Serialisable.__findSerialisablePropertyAccessors | public function __findSerialisablePropertyAccessors() {
// Grab the class name first.
$className = get_class($this);
// If no accessor map has been previously cached for this class type, cache it now.
if (!isset (self::$__accessorMaps [$className])) {
$reflectionClass = n... | php | public function __findSerialisablePropertyAccessors() {
// Grab the class name first.
$className = get_class($this);
// If no accessor map has been previously cached for this class type, cache it now.
if (!isset (self::$__accessorMaps [$className])) {
$reflectionClass = n... | [
"public",
"function",
"__findSerialisablePropertyAccessors",
"(",
")",
"{",
"// Grab the class name first.",
"$",
"className",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"// If no accessor map has been previously cached for this class type, cache it now.",
"if",
"(",
"!",
... | Find all serialisable property objects, return a map of accessor objects keyed in by GET and SET. | [
"Find",
"all",
"serialisable",
"property",
"objects",
"return",
"a",
"map",
"of",
"accessor",
"objects",
"keyed",
"in",
"by",
"GET",
"and",
"SET",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/Serialisable.php#L154-L214 | train |
AnonymPHP/Anonym-Cookie | src/Anonym/Components/Cookie.php | Cookie.forever | public function forever(
$name = '',
$value = '',
$path = '/',
$domain = null,
$secure = false,
$httpOnly = false
) {
$this->set($name, $value, 2628000, $path, $domain, $secure, $httpOnly);
return $this;
} | php | public function forever(
$name = '',
$value = '',
$path = '/',
$domain = null,
$secure = false,
$httpOnly = false
) {
$this->set($name, $value, 2628000, $path, $domain, $secure, $httpOnly);
return $this;
} | [
"public",
"function",
"forever",
"(",
"$",
"name",
"=",
"''",
",",
"$",
"value",
"=",
"''",
",",
"$",
"path",
"=",
"'/'",
",",
"$",
"domain",
"=",
"null",
",",
"$",
"secure",
"=",
"false",
",",
"$",
"httpOnly",
"=",
"false",
")",
"{",
"$",
"thi... | this cookie life very long time
@param string $name
@param string $value
@param string $path
@param null $domain
@param bool $secure
@param bool $httpOnly
@return $this | [
"this",
"cookie",
"life",
"very",
"long",
"time"
] | 7e02403f76fab42355f02326c5589d3fca271e3b | https://github.com/AnonymPHP/Anonym-Cookie/blob/7e02403f76fab42355f02326c5589d3fca271e3b/src/Anonym/Components/Cookie.php#L174-L184 | train |
togucms/FrontendBundle | Data/Formatter.php | Formatter.format | public function format($entities) {
$data = array(
'models' => array(),
'images' => array(),
'links' => array()
);
if(! is_array($entities)) {
$entities = array($entities->getId() => $entities);
}
foreach ($entities as $entity) {
if($entity instanceof \Application\Togu\ApplicationModelsBundle... | php | public function format($entities) {
$data = array(
'models' => array(),
'images' => array(),
'links' => array()
);
if(! is_array($entities)) {
$entities = array($entities->getId() => $entities);
}
foreach ($entities as $entity) {
if($entity instanceof \Application\Togu\ApplicationModelsBundle... | [
"public",
"function",
"format",
"(",
"$",
"entities",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'models'",
"=>",
"array",
"(",
")",
",",
"'images'",
"=>",
"array",
"(",
")",
",",
"'links'",
"=>",
"array",
"(",
")",
")",
";",
"if",
"(",
"!",
"is_... | Prepares the data to be serialized
@param mixed $entity The entity to serialize
@return string The serialized data | [
"Prepares",
"the",
"data",
"to",
"be",
"serialized"
] | fd165aca0fb6498ce85b39c1ff536cc1bd8ba285 | https://github.com/togucms/FrontendBundle/blob/fd165aca0fb6498ce85b39c1ff536cc1bd8ba285/Data/Formatter.php#L55-L83 | train |
Wedeto/HTTP | src/Forms/AddNonceToForm.php | AddNonceToForm.register | public function register()
{
$this->prepare_hook = $this->prepare_hook ?: Hook::subscribe('Wedeto.HTTP.Forms.Form.prepare', [$this, 'hookPrepareForm']);
$this->validate_hook = $this->validate_hook ?: Hook::subscribe('Wedeto.HTTP.Forms.Form.isValid', [$this, 'hookIsValid']);
} | php | public function register()
{
$this->prepare_hook = $this->prepare_hook ?: Hook::subscribe('Wedeto.HTTP.Forms.Form.prepare', [$this, 'hookPrepareForm']);
$this->validate_hook = $this->validate_hook ?: Hook::subscribe('Wedeto.HTTP.Forms.Form.isValid', [$this, 'hookIsValid']);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"prepare_hook",
"=",
"$",
"this",
"->",
"prepare_hook",
"?",
":",
"Hook",
"::",
"subscribe",
"(",
"'Wedeto.HTTP.Forms.Form.prepare'",
",",
"[",
"$",
"this",
",",
"'hookPrepareForm'",
"]",
")... | Subscribe to two hooks, prepare and isValid | [
"Subscribe",
"to",
"two",
"hooks",
"prepare",
"and",
"isValid"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/AddNonceToForm.php#L56-L60 | train |
Wedeto/HTTP | src/Forms/AddNonceToForm.php | AddNonceToForm.unregister | public function unregister()
{
if ($this->prepare_hook)
{
Hook::unsubscribe('Wedeto.HTTP.Forms.Form.prepare', $this->prepare_hook);
$this->prepare_hook = null;
}
if ($this->validate_hook)
{
Hook::unsubscribe('Wedeto.HTTP.Forms.Form.isValid... | php | public function unregister()
{
if ($this->prepare_hook)
{
Hook::unsubscribe('Wedeto.HTTP.Forms.Form.prepare', $this->prepare_hook);
$this->prepare_hook = null;
}
if ($this->validate_hook)
{
Hook::unsubscribe('Wedeto.HTTP.Forms.Form.isValid... | [
"public",
"function",
"unregister",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"prepare_hook",
")",
"{",
"Hook",
"::",
"unsubscribe",
"(",
"'Wedeto.HTTP.Forms.Form.prepare'",
",",
"$",
"this",
"->",
"prepare_hook",
")",
";",
"$",
"this",
"->",
"prepare_hoo... | Unsubscribe from the two hooks | [
"Unsubscribe",
"from",
"the",
"two",
"hooks"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/AddNonceToForm.php#L65-L78 | train |
Wedeto/HTTP | src/Forms/AddNonceToForm.php | AddNonceToForm.hookPrepareForm | public function hookPrepareForm(Dictionary $params)
{
$session = $params['session'];
$form = $params['form'];
if ($session !== null)
{
$nonce_name = Nonce::getParameterName();
if (!isset($form[$nonce_name]))
{
$context = [];
... | php | public function hookPrepareForm(Dictionary $params)
{
$session = $params['session'];
$form = $params['form'];
if ($session !== null)
{
$nonce_name = Nonce::getParameterName();
if (!isset($form[$nonce_name]))
{
$context = [];
... | [
"public",
"function",
"hookPrepareForm",
"(",
"Dictionary",
"$",
"params",
")",
"{",
"$",
"session",
"=",
"$",
"params",
"[",
"'session'",
"]",
";",
"$",
"form",
"=",
"$",
"params",
"[",
"'form'",
"]",
";",
"if",
"(",
"$",
"session",
"!==",
"null",
"... | The hook called when the form is being prepared. Is used to
add the nonce field to the form. | [
"The",
"hook",
"called",
"when",
"the",
"form",
"is",
"being",
"prepared",
".",
"Is",
"used",
"to",
"add",
"the",
"nonce",
"field",
"to",
"the",
"form",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/AddNonceToForm.php#L84-L98 | train |
Wedeto/HTTP | src/Forms/AddNonceToForm.php | AddNonceToForm.hookIsValid | public function hookIsValid(Dictionary $params)
{
// Validate nonce
$form = $params['form'];
$request = $params['request'];
$arguments = $params['arguments'];
$result = Nonce::validateNonce($form->getName(), $request->session, $arguments);
$nonce_name = Nonce::getPar... | php | public function hookIsValid(Dictionary $params)
{
// Validate nonce
$form = $params['form'];
$request = $params['request'];
$arguments = $params['arguments'];
$result = Nonce::validateNonce($form->getName(), $request->session, $arguments);
$nonce_name = Nonce::getPar... | [
"public",
"function",
"hookIsValid",
"(",
"Dictionary",
"$",
"params",
")",
"{",
"// Validate nonce",
"$",
"form",
"=",
"$",
"params",
"[",
"'form'",
"]",
";",
"$",
"request",
"=",
"$",
"params",
"[",
"'request'",
"]",
";",
"$",
"arguments",
"=",
"$",
... | The hook called when the form is validated. Is used to validate that the
received nonce is valid. | [
"The",
"hook",
"called",
"when",
"the",
"form",
"is",
"validated",
".",
"Is",
"used",
"to",
"validate",
"that",
"the",
"received",
"nonce",
"is",
"valid",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/AddNonceToForm.php#L104-L129 | train |
FlorianWolters/PHP-Component-Util-Reflection | src/main/php/ReflectionUtils.php | ReflectionUtils.createNewInstanceWithoutConstructor | public static function createNewInstanceWithoutConstructor(
$className,
array $arguments = []
) {
$reflectedClass = new ReflectionClass($className);
$newInstance = $reflectedClass->newInstanceWithoutConstructor();
$reflectedConstructor = $reflectedClass->getConstructor();
... | php | public static function createNewInstanceWithoutConstructor(
$className,
array $arguments = []
) {
$reflectedClass = new ReflectionClass($className);
$newInstance = $reflectedClass->newInstanceWithoutConstructor();
$reflectedConstructor = $reflectedClass->getConstructor();
... | [
"public",
"static",
"function",
"createNewInstanceWithoutConstructor",
"(",
"$",
"className",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"reflectedClass",
"=",
"new",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"$",
"newInstance",
"=... | Creates a new instance of the class with the specified class name
without invoking its constructor.
The constructor is set accessible if it is not declared with `public`
visibility.
The method `createNewInstanceWithoutConstructor` accepts a variable
number of arguments which are passed to the constructor of the class... | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"class",
"with",
"the",
"specified",
"class",
"name",
"without",
"invoking",
"its",
"constructor",
"."
] | b905c0cd04fc9232da2456fd9eb09752680188dd | https://github.com/FlorianWolters/PHP-Component-Util-Reflection/blob/b905c0cd04fc9232da2456fd9eb09752680188dd/src/main/php/ReflectionUtils.php#L67-L81 | train |
FlorianWolters/PHP-Component-Util-Reflection | src/main/php/ReflectionUtils.php | ReflectionUtils.invokeMethod | public static function invokeMethod(
$object,
$methodName,
array $arguments = []
) {
$reflectedObject = new ReflectionObject($object);
$reflectedMethod = $reflectedObject->getMethod($methodName);
$reflectedMethod->setAccessible(true);
$reflectedMethod->invokeA... | php | public static function invokeMethod(
$object,
$methodName,
array $arguments = []
) {
$reflectedObject = new ReflectionObject($object);
$reflectedMethod = $reflectedObject->getMethod($methodName);
$reflectedMethod->setAccessible(true);
$reflectedMethod->invokeA... | [
"public",
"static",
"function",
"invokeMethod",
"(",
"$",
"object",
",",
"$",
"methodName",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"reflectedObject",
"=",
"new",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"$",
"reflectedMethod... | Invokes the specified method on the specified object.
The method `invokeMethod` accepts a variable number of arguments which
are passed to the method of the object.
@param object $object The object on which to invoke the method.
@param strin $methodName The name of the method to invoke.
@param mixed[] $argumen... | [
"Invokes",
"the",
"specified",
"method",
"on",
"the",
"specified",
"object",
"."
] | b905c0cd04fc9232da2456fd9eb09752680188dd | https://github.com/FlorianWolters/PHP-Component-Util-Reflection/blob/b905c0cd04fc9232da2456fd9eb09752680188dd/src/main/php/ReflectionUtils.php#L96-L105 | train |
ivopetkov/server-requests-bearframework-addon | classes/ServerRequests.php | ServerRequests.add | public function add(string $name, callable $callback): \IvoPetkov\BearFrameworkAddons\ServerRequests
{
$this->callbacks[$name] = $callback;
return $this;
} | php | public function add(string $name, callable $callback): \IvoPetkov\BearFrameworkAddons\ServerRequests
{
$this->callbacks[$name] = $callback;
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"callable",
"$",
"callback",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"ServerRequests",
"{",
"$",
"this",
"->",
"callbacks",
"[",
"$",
"name",
"]",
"=",
"$",
"callback",
... | Register a named callback
@param string $name
@param callable $callback
@return IvoPetkov\BearFrameworkAddons\ServerRequests Returns a reference to the object itself. | [
"Register",
"a",
"named",
"callback"
] | 66d6a594557e988dc458d569c7e81ea6af60a58a | https://github.com/ivopetkov/server-requests-bearframework-addon/blob/66d6a594557e988dc458d569c7e81ea6af60a58a/classes/ServerRequests.php#L32-L36 | train |
ivopetkov/server-requests-bearframework-addon | classes/ServerRequests.php | ServerRequests.execute | public function execute(string $name, array $data, \BearFramework\App\Response $response): string
{
if (isset($this->callbacks[$name])) {
return (string) call_user_func($this->callbacks[$name], $data, $response);
}
return '';
} | php | public function execute(string $name, array $data, \BearFramework\App\Response $response): string
{
if (isset($this->callbacks[$name])) {
return (string) call_user_func($this->callbacks[$name], $data, $response);
}
return '';
} | [
"public",
"function",
"execute",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"data",
",",
"\\",
"BearFramework",
"\\",
"App",
"\\",
"Response",
"$",
"response",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"callbacks",
"[",
... | Executes the callback for the name specified
@param string $name The name of the callback
@param array $data The data that will be passed to the callback
@param \BearFramework\App\Response $response The response object that will be passed to the callback
@return string Returns the callback result | [
"Executes",
"the",
"callback",
"for",
"the",
"name",
"specified"
] | 66d6a594557e988dc458d569c7e81ea6af60a58a | https://github.com/ivopetkov/server-requests-bearframework-addon/blob/66d6a594557e988dc458d569c7e81ea6af60a58a/classes/ServerRequests.php#L57-L63 | train |
Palmabit-IT/library | src/Palmabit/Library/Form/FormModel.php | FormModel.process | public function process(array $input)
{
try
{
$success = $this->v->validate($input);
}
catch(ValidationException $e)
{
$this->setErrorsAndThrowException();
}
if( ! $success)
{
$this->setErrorsAndThrowException();
... | php | public function process(array $input)
{
try
{
$success = $this->v->validate($input);
}
catch(ValidationException $e)
{
$this->setErrorsAndThrowException();
}
if( ! $success)
{
$this->setErrorsAndThrowException();
... | [
"public",
"function",
"process",
"(",
"array",
"$",
"input",
")",
"{",
"try",
"{",
"$",
"success",
"=",
"$",
"this",
"->",
"v",
"->",
"validate",
"(",
"$",
"input",
")",
";",
"}",
"catch",
"(",
"ValidationException",
"$",
"e",
")",
"{",
"$",
"this"... | Processa l'input e chiama create o opdate a seconda
@param array $input
@throws \Palmabit\Library\Exceptions\PalmabitExceptionsInterface | [
"Processa",
"l",
"input",
"e",
"chiama",
"create",
"o",
"opdate",
"a",
"seconda"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/Form/FormModel.php#L52-L69 | train |
eureka-framework/component-response | src/Response/Html/Html.php | Html.renderContent | public function renderContent()
{
if (is_object($this->content) && !method_exists($this->content, '__toString')) {
throw new \LogicException('Cannot render content: it is an object without __toString method!');
}
if (is_array($this->content)) {
throw new \LogicExcept... | php | public function renderContent()
{
if (is_object($this->content) && !method_exists($this->content, '__toString')) {
throw new \LogicException('Cannot render content: it is an object without __toString method!');
}
if (is_array($this->content)) {
throw new \LogicExcept... | [
"public",
"function",
"renderContent",
"(",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"content",
")",
"&&",
"!",
"method_exists",
"(",
"$",
"this",
"->",
"content",
",",
"'__toString'",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException... | Render content.
@return string
@throws \LogicException | [
"Render",
"content",
"."
] | f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a | https://github.com/eureka-framework/component-response/blob/f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a/src/Response/Html/Html.php#L36-L47 | train |
ScaraMVC/Framework | src/Scara/Html/BaseBuilder.php | BaseBuilder.attributes | protected function attributes($attributes = [])
{
$ar = [];
foreach ($attributes as $key => $value) {
$element = $this->attribute($key, $value);
if (!is_null($element)) {
$ar[] = $element;
}
}
return count($ar) > 0 ? ' '.implode('... | php | protected function attributes($attributes = [])
{
$ar = [];
foreach ($attributes as $key => $value) {
$element = $this->attribute($key, $value);
if (!is_null($element)) {
$ar[] = $element;
}
}
return count($ar) > 0 ? ' '.implode('... | [
"protected",
"function",
"attributes",
"(",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"ar",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"att... | Cycles through given attributes and sets them for the element.
@param array $attributes - The elements given options (attributes)
@return string | [
"Cycles",
"through",
"given",
"attributes",
"and",
"sets",
"them",
"for",
"the",
"element",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/BaseBuilder.php#L17-L29 | train |
ScaraMVC/Framework | src/Scara/Html/BaseBuilder.php | BaseBuilder.attribute | protected function attribute($key, $value)
{
if (is_numeric($key)) {
$key = $value;
}
if (!is_null($value)) {
return $key.'="'.$value.'"';
}
} | php | protected function attribute($key, $value)
{
if (is_numeric($key)) {
$key = $value;
}
if (!is_null($value)) {
return $key.'="'.$value.'"';
}
} | [
"protected",
"function",
"attribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"$",
"value",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
... | Creates the attribute string.
@param string $key - The attribute's key
@param string $value - The $key's value
@return string | [
"Creates",
"the",
"attribute",
"string",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/BaseBuilder.php#L39-L48 | train |
ScaraMVC/Framework | src/Scara/Html/BaseBuilder.php | BaseBuilder.obfuscate | public function obfuscate($value)
{
$safe = '';
foreach (str_split($value) as $letter) {
if (ord($letter) > 128) {
return $letter;
}
switch (rand(1, 3)) {
case 1:
$safe .= '&#'.ord($letter).';';
bre... | php | public function obfuscate($value)
{
$safe = '';
foreach (str_split($value) as $letter) {
if (ord($letter) > 128) {
return $letter;
}
switch (rand(1, 3)) {
case 1:
$safe .= '&#'.ord($letter).';';
bre... | [
"public",
"function",
"obfuscate",
"(",
"$",
"value",
")",
"{",
"$",
"safe",
"=",
"''",
";",
"foreach",
"(",
"str_split",
"(",
"$",
"value",
")",
"as",
"$",
"letter",
")",
"{",
"if",
"(",
"ord",
"(",
"$",
"letter",
")",
">",
"128",
")",
"{",
"r... | Obfuscates a string.
@param string $value - The string to obfuscate
@return string | [
"Obfuscates",
"a",
"string",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/BaseBuilder.php#L82-L104 | train |
togucms/MediaBundle | Controller/MediaController.php | MediaController.postMediaAction | public function postMediaAction($provider, Request $request) {
$pool = $this->get("sonata.media.pool");
$manager = $this->get("sonata.media.manager.media");
$formFactory = $this->get('form.factory');
try {
$mediaProvider = $pool->getProvider($provider);
} catch (\RuntimeException $ex)... | php | public function postMediaAction($provider, Request $request) {
$pool = $this->get("sonata.media.pool");
$manager = $this->get("sonata.media.manager.media");
$formFactory = $this->get('form.factory');
try {
$mediaProvider = $pool->getProvider($provider);
} catch (\RuntimeException $ex)... | [
"public",
"function",
"postMediaAction",
"(",
"$",
"provider",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"pool",
"=",
"$",
"this",
"->",
"get",
"(",
"\"sonata.media.pool\"",
")",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"get",
"(",
"\"sonata.med... | Create a new media
@Route(requirements={"provider"="[A-Za-z0-9.]*"})
@return \Symfony\Component\HttpFoundation\Response | [
"Create",
"a",
"new",
"media"
] | 42065d5fa419654540a52ae8f0047708eac9930b | https://github.com/togucms/MediaBundle/blob/42065d5fa419654540a52ae8f0047708eac9930b/Controller/MediaController.php#L66-L106 | train |
Krinkle/toollabs-base | src/BaseTool.php | BaseTool.addOut | public function addOut( $str, $wrapTag = 0, $attributes = array() ) {
if ( is_string( $str ) ) {
if ( is_string( $wrapTag ) ) {
$str = Html::element( $wrapTag, $attributes, $str );
}
$this->mainOutput['body'] .= $str;
return true;
} else {
return false;
}
} | php | public function addOut( $str, $wrapTag = 0, $attributes = array() ) {
if ( is_string( $str ) ) {
if ( is_string( $wrapTag ) ) {
$str = Html::element( $wrapTag, $attributes, $str );
}
$this->mainOutput['body'] .= $str;
return true;
} else {
return false;
}
} | [
"public",
"function",
"addOut",
"(",
"$",
"str",
",",
"$",
"wrapTag",
"=",
"0",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"str",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"wrapTag",
")",
... | Add a string to the output memory
@param $str string String to be added to the memory
@param $wrapTag string (optional) Name of the tag to wrap the string in.
If this is used the contents of $str will be html-escaped!
@param $attributes string (optional) When using a wrapTag these attributes
will be applied as well. B... | [
"Add",
"a",
"string",
"to",
"the",
"output",
"memory"
] | 784150ca58f4b48cc89534fd6142c54b4f138cd2 | https://github.com/Krinkle/toollabs-base/blob/784150ca58f4b48cc89534fd6142c54b4f138cd2/src/BaseTool.php#L234-L244 | train |
theomessin/ts-framework | src/Node/Server.php | Server.clientKick | public function clientKick($clid, $reasonid = Teamspeak::KICK_CHANNEL, $reasonmsg = null)
{
$this->clientListReset();
$this->execute("clientkick", array("clid" => $clid, "reasonid" => $reasonid, "reasonmsg" => $reasonmsg));
} | php | public function clientKick($clid, $reasonid = Teamspeak::KICK_CHANNEL, $reasonmsg = null)
{
$this->clientListReset();
$this->execute("clientkick", array("clid" => $clid, "reasonid" => $reasonid, "reasonmsg" => $reasonmsg));
} | [
"public",
"function",
"clientKick",
"(",
"$",
"clid",
",",
"$",
"reasonid",
"=",
"Teamspeak",
"::",
"KICK_CHANNEL",
",",
"$",
"reasonmsg",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"clientListReset",
"(",
")",
";",
"$",
"this",
"->",
"execute",
"(",
"\... | Kicks one or more clients from their currently joined channel or from the server.
@param integer $clid
@param integer $reasonid
@param string $reasonmsg
@return void | [
"Kicks",
"one",
"or",
"more",
"clients",
"from",
"their",
"currently",
"joined",
"channel",
"or",
"from",
"the",
"server",
"."
] | d60e36553241db05cb05ef19e749866cc977437c | https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Node/Server.php#L911-L916 | train |
theomessin/ts-framework | src/Node/Server.php | Server.channelGroupGetByName | public function channelGroupGetByName($name, $type = Teamspeak::GROUP_DBTYPE_REGULAR)
{
foreach ($this->channelGroupList() as $group) {
if ($group["name"] == $name && $group["type"] == $type) {
return $group;
}
}
throw new Ts3Exception("invalid groupI... | php | public function channelGroupGetByName($name, $type = Teamspeak::GROUP_DBTYPE_REGULAR)
{
foreach ($this->channelGroupList() as $group) {
if ($group["name"] == $name && $group["type"] == $type) {
return $group;
}
}
throw new Ts3Exception("invalid groupI... | [
"public",
"function",
"channelGroupGetByName",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"Teamspeak",
"::",
"GROUP_DBTYPE_REGULAR",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"channelGroupList",
"(",
")",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"g... | Returns the Channelgroup object matching the given name.
@param string $name
@param integer $type
@throws Ts3Exception
@return Channelgroup | [
"Returns",
"the",
"Channelgroup",
"object",
"matching",
"the",
"given",
"name",
"."
] | d60e36553241db05cb05ef19e749866cc977437c | https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Node/Server.php#L1507-L1516 | train |
theomessin/ts-framework | src/Node/Server.php | Server.snapshotCreate | public function snapshotCreate($mode = Teamspeak::SNAPSHOT_STRING)
{
$snapshot = $this->request("serversnapshotcreate")->toString(false);
switch ($mode) {
case Teamspeak::SNAPSHOT_BASE64:
return $snapshot->toBase64();
break;
case Teamspeak::S... | php | public function snapshotCreate($mode = Teamspeak::SNAPSHOT_STRING)
{
$snapshot = $this->request("serversnapshotcreate")->toString(false);
switch ($mode) {
case Teamspeak::SNAPSHOT_BASE64:
return $snapshot->toBase64();
break;
case Teamspeak::S... | [
"public",
"function",
"snapshotCreate",
"(",
"$",
"mode",
"=",
"Teamspeak",
"::",
"SNAPSHOT_STRING",
")",
"{",
"$",
"snapshot",
"=",
"$",
"this",
"->",
"request",
"(",
"\"serversnapshotcreate\"",
")",
"->",
"toString",
"(",
"false",
")",
";",
"switch",
"(",
... | Creates and returns snapshot data for the selected virtual server.
@param string $mode
@return string | [
"Creates",
"and",
"returns",
"snapshot",
"data",
"for",
"the",
"selected",
"virtual",
"server",
"."
] | d60e36553241db05cb05ef19e749866cc977437c | https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Node/Server.php#L1880-L1897 | train |
kaiohken1982/NeobazaarMailerModule | src/Mailer/Mail/ClassifiedActivation.php | ClassifiedActivation.checkData | public function checkData(array $data)
{
$keys = array('to', 'fullname', 'title', 'activationLink', 'siteurl', 'cdnurl', 'siteName');
foreach($keys as $key) {
if(!array_key_exists($key, $data)) {
throw new \Exception('Key not in data');
}
}
return $this;
} | php | public function checkData(array $data)
{
$keys = array('to', 'fullname', 'title', 'activationLink', 'siteurl', 'cdnurl', 'siteName');
foreach($keys as $key) {
if(!array_key_exists($key, $data)) {
throw new \Exception('Key not in data');
}
}
return $this;
} | [
"public",
"function",
"checkData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
"'to'",
",",
"'fullname'",
",",
"'title'",
",",
"'activationLink'",
",",
"'siteurl'",
",",
"'cdnurl'",
",",
"'siteName'",
")",
";",
"foreach",
"(",
"$... | Checks if data contains neede keye
@param array $data
@throws \Exception
@return \Mailer\Mail\ClassifiedAnswer | [
"Checks",
"if",
"data",
"contains",
"neede",
"keye"
] | 0afc66196a0a392ecb4f052f483f2b5ff606bd8f | https://github.com/kaiohken1982/NeobazaarMailerModule/blob/0afc66196a0a392ecb4f052f483f2b5ff606bd8f/src/Mailer/Mail/ClassifiedActivation.php#L45-L56 | train |
FuzeWorks/Core | src/FuzeWorks/LoggerTracyBridge.php | LoggerTracyBridge.register | public static function register()
{
$class = new self();
Events::addListener(array($class, 'screenLogEventListener'), 'screenLogEvent', EventPriority::NORMAL);
$bar = Debugger::getBar();
$bar->addPanel($class);
} | php | public static function register()
{
$class = new self();
Events::addListener(array($class, 'screenLogEventListener'), 'screenLogEvent', EventPriority::NORMAL);
$bar = Debugger::getBar();
$bar->addPanel($class);
} | [
"public",
"static",
"function",
"register",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"self",
"(",
")",
";",
"Events",
"::",
"addListener",
"(",
"array",
"(",
"$",
"class",
",",
"'screenLogEventListener'",
")",
",",
"'screenLogEvent'",
",",
"EventPriority",
... | Register the bar and register the event which will block the screen log | [
"Register",
"the",
"bar",
"and",
"register",
"the",
"event",
"which",
"will",
"block",
"the",
"screen",
"log"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/LoggerTracyBridge.php#L53-L59 | train |
net-tools/core | src/Helpers/SecurityHelper.php | SecurityHelper.cryptoJsAesDecrypt | static function cryptoJsAesDecrypt($passphrase, $jsonString){
$jsondata = json_decode($jsonString, true);
try {
$salt = hex2bin($jsondata["s"]);
$iv = hex2bin($jsondata["iv"]);
} catch(\Exception $e) { return null; }
$ct = base64_decode($jsondata["ct"]);
$concatedPassphrase = $passphrase.$salt;
$md5 ... | php | static function cryptoJsAesDecrypt($passphrase, $jsonString){
$jsondata = json_decode($jsonString, true);
try {
$salt = hex2bin($jsondata["s"]);
$iv = hex2bin($jsondata["iv"]);
} catch(\Exception $e) { return null; }
$ct = base64_decode($jsondata["ct"]);
$concatedPassphrase = $passphrase.$salt;
$md5 ... | [
"static",
"function",
"cryptoJsAesDecrypt",
"(",
"$",
"passphrase",
",",
"$",
"jsonString",
")",
"{",
"$",
"jsondata",
"=",
"json_decode",
"(",
"$",
"jsonString",
",",
"true",
")",
";",
"try",
"{",
"$",
"salt",
"=",
"hex2bin",
"(",
"$",
"jsondata",
"[",
... | Decrypt data from a CryptoJS json encoding string
@param mixed $passphrase
@param mixed $jsonString
@return mixed | [
"Decrypt",
"data",
"from",
"a",
"CryptoJS",
"json",
"encoding",
"string"
] | 51446641cee22c0cf53d2b409c76cc8bd1a187e7 | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Helpers/SecurityHelper.php#L90-L108 | train |
net-tools/core | src/Helpers/SecurityHelper.php | SecurityHelper.cryptoJsAesEncrypt | static function cryptoJsAesEncrypt($passphrase, $value){
$salt = openssl_random_pseudo_bytes(8);
$salted = '';
$dx = '';
while (strlen($salted) < 48) {
$dx = md5($dx.$passphrase.$salt, true);
$salted .= $dx;
}
$key = substr($salted, 0, 32);
$iv = substr($salted, 32,16);
$encrypted_data = openssl_... | php | static function cryptoJsAesEncrypt($passphrase, $value){
$salt = openssl_random_pseudo_bytes(8);
$salted = '';
$dx = '';
while (strlen($salted) < 48) {
$dx = md5($dx.$passphrase.$salt, true);
$salted .= $dx;
}
$key = substr($salted, 0, 32);
$iv = substr($salted, 32,16);
$encrypted_data = openssl_... | [
"static",
"function",
"cryptoJsAesEncrypt",
"(",
"$",
"passphrase",
",",
"$",
"value",
")",
"{",
"$",
"salt",
"=",
"openssl_random_pseudo_bytes",
"(",
"8",
")",
";",
"$",
"salted",
"=",
"''",
";",
"$",
"dx",
"=",
"''",
";",
"while",
"(",
"strlen",
"(",... | Encrypt value to a cryptojs compatiable json encoding string
@param mixed $passphrase
@param mixed $value
@return string | [
"Encrypt",
"value",
"to",
"a",
"cryptojs",
"compatiable",
"json",
"encoding",
"string"
] | 51446641cee22c0cf53d2b409c76cc8bd1a187e7 | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Helpers/SecurityHelper.php#L118-L131 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/Login.php | Login.Init | protected function Init()
{
$this->login = ContentLogin::Schema()->ByContent($this->Content());
$this->HandleLoggedIn();
$passwordUrl = $this->login->GetPasswordUrl();
$this->passwordUrl = $passwordUrl ? FrontendRouter::Url($passwordUrl) : '';
$this->AddNameField();
$... | php | protected function Init()
{
$this->login = ContentLogin::Schema()->ByContent($this->Content());
$this->HandleLoggedIn();
$passwordUrl = $this->login->GetPasswordUrl();
$this->passwordUrl = $passwordUrl ? FrontendRouter::Url($passwordUrl) : '';
$this->AddNameField();
$... | [
"protected",
"function",
"Init",
"(",
")",
"{",
"$",
"this",
"->",
"login",
"=",
"ContentLogin",
"::",
"Schema",
"(",
")",
"->",
"ByContent",
"(",
"$",
"this",
"->",
"Content",
"(",
")",
")",
";",
"$",
"this",
"->",
"HandleLoggedIn",
"(",
")",
";",
... | Initializes the login element
@return boolean Returns always true | [
"Initializes",
"the",
"login",
"element"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/Login.php#L45-L57 | train |
Montage-Inc/php-montage | src/Documents.php | Documents.getIterator | public function getIterator()
{
//Run the query
$resp = $this->query->execute();
//Return the documents as an ArrayIterator to satisfy the requirements
//of the getIterator function.
foreach ($resp->data as $document)
{
yield $document;
}
... | php | public function getIterator()
{
//Run the query
$resp = $this->query->execute();
//Return the documents as an ArrayIterator to satisfy the requirements
//of the getIterator function.
foreach ($resp->data as $document)
{
yield $document;
}
... | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"//Run the query",
"$",
"resp",
"=",
"$",
"this",
"->",
"query",
"->",
"execute",
"(",
")",
";",
"//Return the documents as an ArrayIterator to satisfy the requirements",
"//of the getIterator function.",
"foreach",
"(",... | Required function for any class that implements IteratorAggregate. Will
yield documents as they become available. If cursors are returned
then subsequent requests will be made, yielding more documents.
@return \Generator
@throws MontageException | [
"Required",
"function",
"for",
"any",
"class",
"that",
"implements",
"IteratorAggregate",
".",
"Will",
"yield",
"documents",
"as",
"they",
"become",
"available",
".",
"If",
"cursors",
"are",
"returned",
"then",
"subsequent",
"requests",
"will",
"be",
"made",
"yi... | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Documents.php#L62-L83 | train |
Montage-Inc/php-montage | src/Documents.php | Documents.save | public function save($doc)
{
return $this->montage->request(
'post',
$this->montage->url('document-save', $this->schema->name),
['body' => json_encode($doc)]
);
} | php | public function save($doc)
{
return $this->montage->request(
'post',
$this->montage->url('document-save', $this->schema->name),
['body' => json_encode($doc)]
);
} | [
"public",
"function",
"save",
"(",
"$",
"doc",
")",
"{",
"return",
"$",
"this",
"->",
"montage",
"->",
"request",
"(",
"'post'",
",",
"$",
"this",
"->",
"montage",
"->",
"url",
"(",
"'document-save'",
",",
"$",
"this",
"->",
"schema",
"->",
"name",
"... | Persist one or more document objects to montage.
@param $doc
@return mixed | [
"Persist",
"one",
"or",
"more",
"document",
"objects",
"to",
"montage",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Documents.php#L91-L98 | train |
Montage-Inc/php-montage | src/Documents.php | Documents.get | public function get($docId)
{
return $this->montage->request(
'get',
$this->montage->url('document-detail', $this->schema->name, $docId)
);
} | php | public function get($docId)
{
return $this->montage->request(
'get',
$this->montage->url('document-detail', $this->schema->name, $docId)
);
} | [
"public",
"function",
"get",
"(",
"$",
"docId",
")",
"{",
"return",
"$",
"this",
"->",
"montage",
"->",
"request",
"(",
"'get'",
",",
"$",
"this",
"->",
"montage",
"->",
"url",
"(",
"'document-detail'",
",",
"$",
"this",
"->",
"schema",
"->",
"name",
... | Get a single document by it's ID from montage.
@param $docId
@return mixed | [
"Get",
"a",
"single",
"document",
"by",
"it",
"s",
"ID",
"from",
"montage",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Documents.php#L106-L112 | train |
Montage-Inc/php-montage | src/Documents.php | Documents.delete | public function delete($docId)
{
return $this->montage->request(
'delete',
$this->montage->url('document-detail', $this->schema->name, $docId)
);
} | php | public function delete($docId)
{
return $this->montage->request(
'delete',
$this->montage->url('document-detail', $this->schema->name, $docId)
);
} | [
"public",
"function",
"delete",
"(",
"$",
"docId",
")",
"{",
"return",
"$",
"this",
"->",
"montage",
"->",
"request",
"(",
"'delete'",
",",
"$",
"this",
"->",
"montage",
"->",
"url",
"(",
"'document-detail'",
",",
"$",
"this",
"->",
"schema",
"->",
"na... | Delete a record with montage.
@param $docId
@return mixed | [
"Delete",
"a",
"record",
"with",
"montage",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Documents.php#L136-L142 | train |
SlabPHP/controllers | src/Traits/Sequenced.php | Sequenced.initializeCallQueues | protected function initializeCallQueues()
{
$this->inputs = new \Slab\Sequencer\CallQueue();
$this->operations = new \Slab\Sequencer\CallQueue();
$this->outputs = new \Slab\Sequencer\CallQueue();
} | php | protected function initializeCallQueues()
{
$this->inputs = new \Slab\Sequencer\CallQueue();
$this->operations = new \Slab\Sequencer\CallQueue();
$this->outputs = new \Slab\Sequencer\CallQueue();
} | [
"protected",
"function",
"initializeCallQueues",
"(",
")",
"{",
"$",
"this",
"->",
"inputs",
"=",
"new",
"\\",
"Slab",
"\\",
"Sequencer",
"\\",
"CallQueue",
"(",
")",
";",
"$",
"this",
"->",
"operations",
"=",
"new",
"\\",
"Slab",
"\\",
"Sequencer",
"\\"... | Sequenced constructor. | [
"Sequenced",
"constructor",
"."
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Traits/Sequenced.php#L36-L41 | train |
SlabPHP/controllers | src/Traits/Sequenced.php | Sequenced.executeCallQueues | protected function executeCallQueues()
{
foreach ($this->inputs->getEntries() as $entry)
{
$this->executeCallQueueEntry($entry);
if (!$this->executeQueues) return;
}
foreach ($this->operations->getEntries() as $entry)
{
$this->executeCallQ... | php | protected function executeCallQueues()
{
foreach ($this->inputs->getEntries() as $entry)
{
$this->executeCallQueueEntry($entry);
if (!$this->executeQueues) return;
}
foreach ($this->operations->getEntries() as $entry)
{
$this->executeCallQ... | [
"protected",
"function",
"executeCallQueues",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"inputs",
"->",
"getEntries",
"(",
")",
"as",
"$",
"entry",
")",
"{",
"$",
"this",
"->",
"executeCallQueueEntry",
"(",
"$",
"entry",
")",
";",
"if",
"(",
"!... | Execute call queues
@throws \Exception | [
"Execute",
"call",
"queues"
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Traits/Sequenced.php#L47-L66 | train |
SlabPHP/controllers | src/Traits/Sequenced.php | Sequenced.stopCallQueues | protected function stopCallQueues()
{
$this->executeQueues = false;
$this->inputs->stopExecution();
$this->operations->stopExecution();
$this->outputs->stopExecution();
} | php | protected function stopCallQueues()
{
$this->executeQueues = false;
$this->inputs->stopExecution();
$this->operations->stopExecution();
$this->outputs->stopExecution();
} | [
"protected",
"function",
"stopCallQueues",
"(",
")",
"{",
"$",
"this",
"->",
"executeQueues",
"=",
"false",
";",
"$",
"this",
"->",
"inputs",
"->",
"stopExecution",
"(",
")",
";",
"$",
"this",
"->",
"operations",
"->",
"stopExecution",
"(",
")",
";",
"$"... | Stop call queues | [
"Stop",
"call",
"queues"
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Traits/Sequenced.php#L85-L91 | train |
kaiohken1982/Thumbnailer | src/Thumbnailer/Thumbnailer/Thumbnailer.php | Thumbnailer.initSourceImageResource | protected function initSourceImageResource()
{
$ext = $this->getExtension();
switch($ext) {
case 'gif':
$this->sourceImageResource = ImageCreateFromGif($this->sourceImagePath);
break;
case 'jpg':
$this->sourceImageResource = ImageCreateFromJpeg($this->sourceImagePath);
break;... | php | protected function initSourceImageResource()
{
$ext = $this->getExtension();
switch($ext) {
case 'gif':
$this->sourceImageResource = ImageCreateFromGif($this->sourceImagePath);
break;
case 'jpg':
$this->sourceImageResource = ImageCreateFromJpeg($this->sourceImagePath);
break;... | [
"protected",
"function",
"initSourceImageResource",
"(",
")",
"{",
"$",
"ext",
"=",
"$",
"this",
"->",
"getExtension",
"(",
")",
";",
"switch",
"(",
"$",
"ext",
")",
"{",
"case",
"'gif'",
":",
"$",
"this",
"->",
"sourceImageResource",
"=",
"ImageCreateFrom... | Init the source image resource
@throws \RuntimeException
@return \Thumbnailer\Thumbnailer\Thumbnailer | [
"Init",
"the",
"source",
"image",
"resource"
] | 8625d41c153fef41979d402837335b1c2320077d | https://github.com/kaiohken1982/Thumbnailer/blob/8625d41c153fef41979d402837335b1c2320077d/src/Thumbnailer/Thumbnailer/Thumbnailer.php#L238-L261 | train |
kaiohken1982/Thumbnailer | src/Thumbnailer/Thumbnailer/Thumbnailer.php | Thumbnailer.initDestImageResource | protected function initDestImageResource()
{
// gif does not supports truecolor for resize
if (function_exists("ImageCreateTrueColor") && $this->getExtension() != 'gif') {
$this->destImageResource = ImageCreateTrueColor($this->destImageWidth, $this->destImageHeight);
} else {
$this->dest... | php | protected function initDestImageResource()
{
// gif does not supports truecolor for resize
if (function_exists("ImageCreateTrueColor") && $this->getExtension() != 'gif') {
$this->destImageResource = ImageCreateTrueColor($this->destImageWidth, $this->destImageHeight);
} else {
$this->dest... | [
"protected",
"function",
"initDestImageResource",
"(",
")",
"{",
"// gif does not supports truecolor for resize",
"if",
"(",
"function_exists",
"(",
"\"ImageCreateTrueColor\"",
")",
"&&",
"$",
"this",
"->",
"getExtension",
"(",
")",
"!=",
"'gif'",
")",
"{",
"$",
"th... | Init the destination resource image.
This is an empty image and use the width and height values
of the source image if resize is not called by the user
@throws \RuntimeException
@return resource | [
"Init",
"the",
"destination",
"resource",
"image",
".",
"This",
"is",
"an",
"empty",
"image",
"and",
"use",
"the",
"width",
"and",
"height",
"values",
"of",
"the",
"source",
"image",
"if",
"resize",
"is",
"not",
"called",
"by",
"the",
"user"
] | 8625d41c153fef41979d402837335b1c2320077d | https://github.com/kaiohken1982/Thumbnailer/blob/8625d41c153fef41979d402837335b1c2320077d/src/Thumbnailer/Thumbnailer/Thumbnailer.php#L271-L281 | train |
libreworks/microformats | src/GeoFormatter.php | GeoFormatter.format | public function format(Geo $geo)
{
return '<span class="h-geo">'
. '<span class="p-latitude">' . (string)$geo->getLatitude() . '</span>, '
. '<span class="p-longitude">' . (string)$geo->getLongitude() . '</span>'
. ($geo->getAltitude() === null ? '' : ' (elevation <span c... | php | public function format(Geo $geo)
{
return '<span class="h-geo">'
. '<span class="p-latitude">' . (string)$geo->getLatitude() . '</span>, '
. '<span class="p-longitude">' . (string)$geo->getLongitude() . '</span>'
. ($geo->getAltitude() === null ? '' : ' (elevation <span c... | [
"public",
"function",
"format",
"(",
"Geo",
"$",
"geo",
")",
"{",
"return",
"'<span class=\"h-geo\">'",
".",
"'<span class=\"p-latitude\">'",
".",
"(",
"string",
")",
"$",
"geo",
"->",
"getLatitude",
"(",
")",
".",
"'</span>, '",
".",
"'<span class=\"p-longitude\"... | Formats a geo.
@param \Libreworks\Microformats\Geo $geo The geo coordinates
@return string The HTML markup | [
"Formats",
"a",
"geo",
"."
] | f208650cb83e8711f5f35878cfa285b7cb505d3d | https://github.com/libreworks/microformats/blob/f208650cb83e8711f5f35878cfa285b7cb505d3d/src/GeoFormatter.php#L36-L43 | train |
agentmedia/phine-core | src/Core/Snippets/BackendRights/SiteRights.php | SiteRights.Save | function Save()
{
$this->pageRights->Save();
if (!$this->rights)
{
$this->rights = new BackendSiteRights();
}
$this->rights->SetEdit($this->Value('Edit'));
$this->rights->SetRemove($this->Value('Remove'));
$this->rights->SetPageRights($thi... | php | function Save()
{
$this->pageRights->Save();
if (!$this->rights)
{
$this->rights = new BackendSiteRights();
}
$this->rights->SetEdit($this->Value('Edit'));
$this->rights->SetRemove($this->Value('Remove'));
$this->rights->SetPageRights($thi... | [
"function",
"Save",
"(",
")",
"{",
"$",
"this",
"->",
"pageRights",
"->",
"Save",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"rights",
")",
"{",
"$",
"this",
"->",
"rights",
"=",
"new",
"BackendSiteRights",
"(",
")",
";",
"}",
"$",
"this",... | Saves the site rights | [
"Saves",
"the",
"site",
"rights"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/BackendRights/SiteRights.php#L41-L53 | train |
SergioMadness/pwf-helpers | src/ConvertHelper.php | ConvertHelper.XML2Array | public static function XML2Array($xmlString)
{
try {
$xml = simplexml_load_string($xmlString, "SimpleXMLElement",
LIBXML_NOCDATA);
$json = json_encode($xml);
$result = json_decode($json, TRUE);
} catch (\Exception $ex) {
$result = ... | php | public static function XML2Array($xmlString)
{
try {
$xml = simplexml_load_string($xmlString, "SimpleXMLElement",
LIBXML_NOCDATA);
$json = json_encode($xml);
$result = json_decode($json, TRUE);
} catch (\Exception $ex) {
$result = ... | [
"public",
"static",
"function",
"XML2Array",
"(",
"$",
"xmlString",
")",
"{",
"try",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"xmlString",
",",
"\"SimpleXMLElement\"",
",",
"LIBXML_NOCDATA",
")",
";",
"$",
"json",
"=",
"json_encode",
"(",
"$"... | Convert XML to array
@param string $xmlString
@return string | [
"Convert",
"XML",
"to",
"array"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/ConvertHelper.php#L14-L25 | train |
SergioMadness/pwf-helpers | src/ConvertHelper.php | ConvertHelper.array2XML | public static function array2XML($haystack, $rootElementName = '')
{
$args = func_get_args();
$isRoot = !isset($args[2]);
$root = isset($args[3]) ? $args[3] : new \DOMDocument('1.0', 'utf-8');
$parent = isset($args[2]) ? $args[2] : ($rootElementName !== '' ? $root->createElement(... | php | public static function array2XML($haystack, $rootElementName = '')
{
$args = func_get_args();
$isRoot = !isset($args[2]);
$root = isset($args[3]) ? $args[3] : new \DOMDocument('1.0', 'utf-8');
$parent = isset($args[2]) ? $args[2] : ($rootElementName !== '' ? $root->createElement(... | [
"public",
"static",
"function",
"array2XML",
"(",
"$",
"haystack",
",",
"$",
"rootElementName",
"=",
"''",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"isRoot",
"=",
"!",
"isset",
"(",
"$",
"args",
"[",
"2",
"]",
")",
";",
"$",... | Convert array to XML object
@param array $haystack
@param string $rootElementName
@return DOMDocument | [
"Convert",
"array",
"to",
"XML",
"object"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/ConvertHelper.php#L34-L57 | train |
PuKoren/php-inline-images | src/Fetcher.php | Fetcher.fetchLocal | private function fetchLocal() {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$this->mime = finfo_file($finfo, $this->path);
finfo_close($finfo);
$this->data = file_get_contents($this->path, FILE_USE_INCLUDE_PATH);
} | php | private function fetchLocal() {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$this->mime = finfo_file($finfo, $this->path);
finfo_close($finfo);
$this->data = file_get_contents($this->path, FILE_USE_INCLUDE_PATH);
} | [
"private",
"function",
"fetchLocal",
"(",
")",
"{",
"$",
"finfo",
"=",
"finfo_open",
"(",
"FILEINFO_MIME_TYPE",
")",
";",
"$",
"this",
"->",
"mime",
"=",
"finfo_file",
"(",
"$",
"finfo",
",",
"$",
"this",
"->",
"path",
")",
";",
"finfo_close",
"(",
"$"... | Fetch a local file and grab its mime type and file content
@return void | [
"Fetch",
"a",
"local",
"file",
"and",
"grab",
"its",
"mime",
"type",
"and",
"file",
"content"
] | 22df5d37ad766d06552121d4422d97edc6608c5d | https://github.com/PuKoren/php-inline-images/blob/22df5d37ad766d06552121d4422d97edc6608c5d/src/Fetcher.php#L45-L50 | train |
DzikuVx/phpCache | src/PhpCache.php | PhpCache.create | public function create($sMethod = null) {
/*
* If no method passed, use default
*/
if (empty($sMethod)) {
$sMethod = self::$sDefaultMechanism;
}
/*
* check if passed name is an registered method
*/
if (array_search($sMethod, $this->aRegisteredMechanisms) === false) {
throw new Exception(... | php | public function create($sMethod = null) {
/*
* If no method passed, use default
*/
if (empty($sMethod)) {
$sMethod = self::$sDefaultMechanism;
}
/*
* check if passed name is an registered method
*/
if (array_search($sMethod, $this->aRegisteredMechanisms) === false) {
throw new Exception(... | [
"public",
"function",
"create",
"(",
"$",
"sMethod",
"=",
"null",
")",
"{",
"/*\n\t\t * If no method passed, use default\n\t\t */",
"if",
"(",
"empty",
"(",
"$",
"sMethod",
")",
")",
"{",
"$",
"sMethod",
"=",
"self",
"::",
"$",
"sDefaultMechanism",
";",
"}",
... | Create and return caching mechanism object according to passed name
@param string $sMethod
@return Apc,File,Memcached,Session,Variable
@throws Exception | [
"Create",
"and",
"return",
"caching",
"mechanism",
"object",
"according",
"to",
"passed",
"name"
] | faf3003795ab21913e7ebb02fb04d6a480b7786c | https://github.com/DzikuVx/phpCache/blob/faf3003795ab21913e7ebb02fb04d6a480b7786c/src/PhpCache.php#L52-L84 | train |
DzikuVx/phpCache | src/PhpCache.php | CacheKey.setModule | public function setModule($value) {
if (is_object($value)) {
$this->module = get_class($value);
}else {
$this->module = (string) $value;
}
} | php | public function setModule($value) {
if (is_object($value)) {
$this->module = get_class($value);
}else {
$this->module = (string) $value;
}
} | [
"public",
"function",
"setModule",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"module",
"=",
"get_class",
"(",
"$",
"value",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"module",
"... | Set module property
@param mixed $value | [
"Set",
"module",
"property"
] | faf3003795ab21913e7ebb02fb04d6a480b7786c | https://github.com/DzikuVx/phpCache/blob/faf3003795ab21913e7ebb02fb04d6a480b7786c/src/PhpCache.php#L133-L139 | train |
aztech-digital/phinject | src/Config/AbstractConfig.php | AbstractConfig.compile | public function compile()
{
$this->doLoad();
$data = (array) $this->data;
$this->removeKey($data, 'include');
$this->removeKey($data, '__META__');
return var_export($data, true);
} | php | public function compile()
{
$this->doLoad();
$data = (array) $this->data;
$this->removeKey($data, 'include');
$this->removeKey($data, '__META__');
return var_export($data, true);
} | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"this",
"->",
"doLoad",
"(",
")",
";",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"data",
";",
"$",
"this",
"->",
"removeKey",
"(",
"$",
"data",
",",
"'include'",
")",
";",
"$",
... | Compiles the current configuration to a valid PHP snippet.
@return string | [
"Compiles",
"the",
"current",
"configuration",
"to",
"a",
"valid",
"PHP",
"snippet",
"."
] | 1bb2fb3b5ef44e62f168af71134c613c48b58d95 | https://github.com/aztech-digital/phinject/blob/1bb2fb3b5ef44e62f168af71134c613c48b58d95/src/Config/AbstractConfig.php#L28-L38 | train |
aztech-digital/phinject | src/Config/AbstractConfig.php | AbstractConfig.load | public function load()
{
if (empty($this->data)) {
$this->data = $this->doLoad();
}
return $this->data;
} | php | public function load()
{
if (empty($this->data)) {
$this->data = $this->doLoad();
}
return $this->data;
} | [
"public",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"this",
"->",
"doLoad",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"data",
";",
"}"
] | Loads and returns the configuration data.
@return ArrayResolver | [
"Loads",
"and",
"returns",
"the",
"configuration",
"data",
"."
] | 1bb2fb3b5ef44e62f168af71134c613c48b58d95 | https://github.com/aztech-digital/phinject/blob/1bb2fb3b5ef44e62f168af71134c613c48b58d95/src/Config/AbstractConfig.php#L58-L65 | train |
agentmedia/phine-builtin | src/BuiltIn/Logic/Registration/Confirmer.php | Confirmer.CalcKey | private static function CalcKey(Member $member)
{
return sha1($member->GetPasswordSalt() . $member->GetConfirmed() . $member->GetName());
} | php | private static function CalcKey(Member $member)
{
return sha1($member->GetPasswordSalt() . $member->GetConfirmed() . $member->GetName());
} | [
"private",
"static",
"function",
"CalcKey",
"(",
"Member",
"$",
"member",
")",
"{",
"return",
"sha1",
"(",
"$",
"member",
"->",
"GetPasswordSalt",
"(",
")",
".",
"$",
"member",
"->",
"GetConfirmed",
"(",
")",
".",
"$",
"member",
"->",
"GetName",
"(",
"... | Returns the password key
@param Member $member
@return string Returns the calculated key for the member | [
"Returns",
"the",
"password",
"key"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Logic/Registration/Confirmer.php#L77-L80 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.assign | public function assign($value, int $type = PDO::PARAM_STR)
{
$key = $this->getNextKey();
$this->params[$key] = $value;
$this->param_types[$key] = $type;
return $key;
} | php | public function assign($value, int $type = PDO::PARAM_STR)
{
$key = $this->getNextKey();
$this->params[$key] = $value;
$this->param_types[$key] = $type;
return $key;
} | [
"public",
"function",
"assign",
"(",
"$",
"value",
",",
"int",
"$",
"type",
"=",
"PDO",
"::",
"PARAM_STR",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getNextKey",
"(",
")",
";",
"$",
"this",
"->",
"params",
"[",
"$",
"key",
"]",
"=",
"$",
"... | Set a value for the next parameters in the query
@param mixed $value The value to set
@param int $type The parameter type, one of PDO::PARAM_*
@return string The assigned key | [
"Set",
"a",
"value",
"for",
"the",
"next",
"parameters",
"in",
"the",
"query"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L77-L83 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.getParameterType | public function getParameterType(string $key)
{
if (!array_key_exists($key, $this->params))
throw new OutOfRangeException("Invalid key: $key");
return $this->param_types[$key];
} | php | public function getParameterType(string $key)
{
if (!array_key_exists($key, $this->params))
throw new OutOfRangeException("Invalid key: $key");
return $this->param_types[$key];
} | [
"public",
"function",
"getParameterType",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"params",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"\"Invalid key: $key\"",
")",
";",
"... | Get the type of parameter the key is set to
@param string $key The key to get the parameter type for
@return int The parameter type, one of PDO::PARAM_* | [
"Get",
"the",
"type",
"of",
"parameter",
"the",
"key",
"is",
"set",
"to"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L102-L108 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.set | public function set(string $key, $value, int $type = PDO::PARAM_STR)
{
$this->params[$key] = $value;
$this->param_types[$key] = $type;
return $this;
} | php | public function set(string $key, $value, int $type = PDO::PARAM_STR)
{
$this->params[$key] = $value;
$this->param_types[$key] = $type;
return $this;
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
",",
"int",
"$",
"type",
"=",
"PDO",
"::",
"PARAM_STR",
")",
"{",
"$",
"this",
"->",
"params",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"param_type... | Set the value for an existing parameters.
@param string $key The key to set
@param mixed $value The value to set it to
@param int $type The parameter type, one of PDO::PARAM_* | [
"Set",
"the",
"value",
"for",
"an",
"existing",
"parameters",
"."
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L116-L121 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.registerTable | public function registerTable($name, $alias)
{
if (!empty($alias) && empty($name))
return;
if (!empty($alias) && !empty($this->parent_scope))
{
$table = $this->parent_scope->resolveAlias($alias);
if (!empty($table))
throw new QueryExcepti... | php | public function registerTable($name, $alias)
{
if (!empty($alias) && empty($name))
return;
if (!empty($alias) && !empty($this->parent_scope))
{
$table = $this->parent_scope->resolveAlias($alias);
if (!empty($table))
throw new QueryExcepti... | [
"public",
"function",
"registerTable",
"(",
"$",
"name",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"alias",
")",
"&&",
"empty",
"(",
"$",
"name",
")",
")",
"return",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"alias",
")",
"&... | Register a table used in the query
@param string $name The name of the table
@param string $alias The alias for the table
@return $this Provides fluent interface | [
"Register",
"a",
"table",
"used",
"in",
"the",
"query"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L172-L208 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.resolveAlias | public function resolveAlias(string $alias)
{
if (isset($this->aliases[$alias]))
return $this->aliases[$alias];
if (empty($this->parent_scope))
return null;
return $this->parent_scope->resolveAlias($alias);
} | php | public function resolveAlias(string $alias)
{
if (isset($this->aliases[$alias]))
return $this->aliases[$alias];
if (empty($this->parent_scope))
return null;
return $this->parent_scope->resolveAlias($alias);
} | [
"public",
"function",
"resolveAlias",
"(",
"string",
"$",
"alias",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aliases",
"[",
"$",
"alias",
"]",
")",
")",
"return",
"$",
"this",
"->",
"aliases",
"[",
"$",
"alias",
"]",
";",
"if",
"(",
... | Find a table by its alias
@param string $alias The alias to find
@return TableClause The table the alias refers to - can be from an outer scope | [
"Find",
"a",
"table",
"by",
"its",
"alias"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L215-L224 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.resolveTable | public function resolveTable(string $name)
{
if (!empty($name) && is_string($name))
{
if (isset($this->aliases[$name]))
return array($this->aliases[$name], $name);
if (isset($this->tables[$name]))
{
if (count($this->tables[$name]) ... | php | public function resolveTable(string $name)
{
if (!empty($name) && is_string($name))
{
if (isset($this->aliases[$name]))
return array($this->aliases[$name], $name);
if (isset($this->tables[$name]))
{
if (count($this->tables[$name]) ... | [
"public",
"function",
"resolveTable",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"name",
")",
"&&",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aliases",
"[",
"$",
"name... | Find a table by its name
@param string $name The name of the table
@return TableClause The table searched for - can be from an outer scope | [
"Find",
"a",
"table",
"by",
"its",
"name"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L231-L252 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.bindParameters | public function bindParameters(\PDOStatement $statement)
{
foreach (array_keys($this->params) as $key)
{
$type = $this->param_types[$key];
$statement->bindParam($key, $this->params[$key], $type);
}
return $this;
} | php | public function bindParameters(\PDOStatement $statement)
{
foreach (array_keys($this->params) as $key)
{
$type = $this->param_types[$key];
$statement->bindParam($key, $this->params[$key], $type);
}
return $this;
} | [
"public",
"function",
"bindParameters",
"(",
"\\",
"PDOStatement",
"$",
"statement",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"params",
")",
"as",
"$",
"key",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"param_types",
"[",
"$"... | Bind the paramters to a PDOStatement
@param PDOStatement $statement The statement to bind to
@return $this Provides fluent interface | [
"Bind",
"the",
"paramters",
"to",
"a",
"PDOStatement"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L348-L356 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.generateAlias | public function generateAlias(Clause $clause)
{
if ($clause instanceof FieldName)
{
$table = $clause->getTable();
if (empty($table))
{
// When no table is defined, it means only one table is being
// used in the query. Aliases will ... | php | public function generateAlias(Clause $clause)
{
if ($clause instanceof FieldName)
{
$table = $clause->getTable();
if (empty($table))
{
// When no table is defined, it means only one table is being
// used in the query. Aliases will ... | [
"public",
"function",
"generateAlias",
"(",
"Clause",
"$",
"clause",
")",
"{",
"if",
"(",
"$",
"clause",
"instanceof",
"FieldName",
")",
"{",
"$",
"table",
"=",
"$",
"clause",
"->",
"getTable",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"table",
")... | Generate an alias for a table
@param Clause $clause The field or sub query to refer to
@return string The alias for the table | [
"Generate",
"an",
"alias",
"for",
"a",
"table"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L363-L393 | train |
Wedeto/DB | src/Query/Parameters.php | Parameters.getSubScope | public function getSubScope(int $num = null)
{
// Resolve an existing scope
if ($num !== null)
{
if (!isset($this->scopes[$num]))
throw new QueryException("Invalid scope number: $num");
return $this->scopes[$num];
}
$scope = new Parame... | php | public function getSubScope(int $num = null)
{
// Resolve an existing scope
if ($num !== null)
{
if (!isset($this->scopes[$num]))
throw new QueryException("Invalid scope number: $num");
return $this->scopes[$num];
}
$scope = new Parame... | [
"public",
"function",
"getSubScope",
"(",
"int",
"$",
"num",
"=",
"null",
")",
"{",
"// Resolve an existing scope",
"if",
"(",
"$",
"num",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scopes",
"[",
"$",
"num",
"]",
")",
... | Create a sub scope for a nester query
@param int $num The scope level
@return Parameters A nested parameters object | [
"Create",
"a",
"sub",
"scope",
"for",
"a",
"nester",
"query"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Parameters.php#L401-L430 | train |
praxigento/mobi_mod_pv | Helper/PvProvider.php | PvProvider.loadPvForQuote | private function loadPvForQuote($quoteId)
{
if (!isset($this->cachePvQuote[$quoteId])) {
$found = $this->daoPvQuote->getById((int)$quoteId);
$this->cachePvQuote[$quoteId] = $found;
}
return $this->cachePvQuote[$quoteId];
} | php | private function loadPvForQuote($quoteId)
{
if (!isset($this->cachePvQuote[$quoteId])) {
$found = $this->daoPvQuote->getById((int)$quoteId);
$this->cachePvQuote[$quoteId] = $found;
}
return $this->cachePvQuote[$quoteId];
} | [
"private",
"function",
"loadPvForQuote",
"(",
"$",
"quoteId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cachePvQuote",
"[",
"$",
"quoteId",
"]",
")",
")",
"{",
"$",
"found",
"=",
"$",
"this",
"->",
"daoPvQuote",
"->",
"getById",
"("... | Cacheable loader for quote's PV.
@param int $quoteId
@return \Praxigento\Pv\Repo\Data\Quote | [
"Cacheable",
"loader",
"for",
"quote",
"s",
"PV",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Helper/PvProvider.php#L123-L130 | train |
praxigento/mobi_mod_pv | Helper/PvProvider.php | PvProvider.loadPvForQuoteItem | private function loadPvForQuoteItem($itemId)
{
if (!isset($this->cachePvQuoteItem[$itemId])) {
$found = $this->daoPvQuoteItem->getById((int)$itemId);
$this->cachePvQuoteItem[$itemId] = $found;
}
return $this->cachePvQuoteItem[$itemId];
} | php | private function loadPvForQuoteItem($itemId)
{
if (!isset($this->cachePvQuoteItem[$itemId])) {
$found = $this->daoPvQuoteItem->getById((int)$itemId);
$this->cachePvQuoteItem[$itemId] = $found;
}
return $this->cachePvQuoteItem[$itemId];
} | [
"private",
"function",
"loadPvForQuoteItem",
"(",
"$",
"itemId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cachePvQuoteItem",
"[",
"$",
"itemId",
"]",
")",
")",
"{",
"$",
"found",
"=",
"$",
"this",
"->",
"daoPvQuoteItem",
"->",
"getBy... | Cacheable loader for quote item's PV.
@param int $itemId
@return \Praxigento\Pv\Repo\Data\Quote\Item | [
"Cacheable",
"loader",
"for",
"quote",
"item",
"s",
"PV",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Helper/PvProvider.php#L138-L145 | train |
dmitrya2e/filtration-bundle | Filter/Collection/BaseCollection.php | BaseCollection.remove | protected function remove($filterOrName)
{
$name = $this->getNameByFilter($filterOrName);
if ($this->has($name)) {
unset($this->collection[$name]);
return true;
}
return false;
} | php | protected function remove($filterOrName)
{
$name = $this->getNameByFilter($filterOrName);
if ($this->has($name)) {
unset($this->collection[$name]);
return true;
}
return false;
} | [
"protected",
"function",
"remove",
"(",
"$",
"filterOrName",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getNameByFilter",
"(",
"$",
"filterOrName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"unset",
"(",
"... | Removes a filter from the collection.
@param string|FilterInterface $filterOrName
@return bool True on success, false on failure (if the filter is not found in the collection) | [
"Removes",
"a",
"filter",
"from",
"the",
"collection",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Collection/BaseCollection.php#L91-L102 | train |
phpguard/listen | src/PhpGuard/Listen/Util/PathUtil.php | PathUtil.createSplFileInfo | static public function createSplFileInfo($baseDir, $path)
{
$absPath = realpath($path);
$baseDirLen = strlen($baseDir);
if($baseDir === substr($absPath,0,$baseDirLen)){
$subPathName = ltrim(substr($absPath,$baseDirLen),'\\/');
$dir = dirname($subPathName);
... | php | static public function createSplFileInfo($baseDir, $path)
{
$absPath = realpath($path);
$baseDirLen = strlen($baseDir);
if($baseDir === substr($absPath,0,$baseDirLen)){
$subPathName = ltrim(substr($absPath,$baseDirLen),'\\/');
$dir = dirname($subPathName);
... | [
"static",
"public",
"function",
"createSplFileInfo",
"(",
"$",
"baseDir",
",",
"$",
"path",
")",
"{",
"$",
"absPath",
"=",
"realpath",
"(",
"$",
"path",
")",
";",
"$",
"baseDirLen",
"=",
"strlen",
"(",
"$",
"baseDir",
")",
";",
"if",
"(",
"$",
"baseD... | Generate SplFileInfo from base dir
@param string $baseDir Base dir for path
@param string $path A file/directory name
@return SplFileInfo | [
"Generate",
"SplFileInfo",
"from",
"base",
"dir"
] | cd0cda150858d6d85deb025a72996873d2af3532 | https://github.com/phpguard/listen/blob/cd0cda150858d6d85deb025a72996873d2af3532/src/PhpGuard/Listen/Util/PathUtil.php#L29-L43 | train |
miguelibero/meinhof | src/Meinhof/Config/Loader/TemplateMatterLoader.php | TemplateMatterLoader.loadStorage | protected function loadStorage($resource)
{
$template = $this->parser->parse($resource);
$key = $template->getLogicalName();
if (isset($this->cache[$key])) {
return $this->cache[$key];
}
$storage = $this->template_loader->load($template);
if (!$storage i... | php | protected function loadStorage($resource)
{
$template = $this->parser->parse($resource);
$key = $template->getLogicalName();
if (isset($this->cache[$key])) {
return $this->cache[$key];
}
$storage = $this->template_loader->load($template);
if (!$storage i... | [
"protected",
"function",
"loadStorage",
"(",
"$",
"resource",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"resource",
")",
";",
"$",
"key",
"=",
"$",
"template",
"->",
"getLogicalName",
"(",
")",
";",
"if",
"... | Loads a resource from the template loader
@param string $resource the name of the resource to load
@throws \RuntimeException if the template loader does not return a MatterStorage | [
"Loads",
"a",
"resource",
"from",
"the",
"template",
"loader"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Config/Loader/TemplateMatterLoader.php#L83-L98 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.write | public function write($text, $color = null, $bgColor = null)
{
$this->adapter->write($text, $color, $bgColor);
} | php | public function write($text, $color = null, $bgColor = null)
{
$this->adapter->write($text, $color, $bgColor);
} | [
"public",
"function",
"write",
"(",
"$",
"text",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bgColor",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"adapter",
"->",
"write",
"(",
"$",
"text",
",",
"$",
"color",
",",
"$",
"bgColor",
")",
";",
"}"
] | Write a chunk of text to console.
@param string $text
@param null|int $color
@param null|int $bgColor
@return void | [
"Write",
"a",
"chunk",
"of",
"text",
"to",
"console",
"."
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L71-L74 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeLine | public function writeLine($text = "", $color = null, $bgColor = null)
{
$this->adapter->writeLine($text, $color, $bgColor);
} | php | public function writeLine($text = "", $color = null, $bgColor = null)
{
$this->adapter->writeLine($text, $color, $bgColor);
} | [
"public",
"function",
"writeLine",
"(",
"$",
"text",
"=",
"\"\"",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bgColor",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"adapter",
"->",
"writeLine",
"(",
"$",
"text",
",",
"$",
"color",
",",
"$",
"bgColor",... | Write a single line of text to console and advance cursor to the next line.
If the text is longer than console width it will be truncated.
@param string $text
@param null|int $color
@param null|int $bgColor
@return void | [
"Write",
"a",
"single",
"line",
"of",
"text",
"to",
"console",
"and",
"advance",
"cursor",
"to",
"the",
"next",
"line",
".",
"If",
"the",
"text",
"is",
"longer",
"than",
"console",
"width",
"it",
"will",
"be",
"truncated",
"."
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L100-L103 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeTextBlock | public function writeTextBlock(
$text,
$width,
$height = null,
$x = 0,
$y = 0,
$color = null,
$bgColor = null
) {
$this->adapter->writeTextBlock(
$text, $width, $height, $x, $y, $color, $bgColor
);
} | php | public function writeTextBlock(
$text,
$width,
$height = null,
$x = 0,
$y = 0,
$color = null,
$bgColor = null
) {
$this->adapter->writeTextBlock(
$text, $width, $height, $x, $y, $color, $bgColor
);
} | [
"public",
"function",
"writeTextBlock",
"(",
"$",
"text",
",",
"$",
"width",
",",
"$",
"height",
"=",
"null",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bgColor",
"=",
"null",
")",
"{",
"$",
"... | Write a block of text at the given coordinates, matching the supplied width and height.
In case a line of text does not fit desired width, it will be wrapped to the next line.
In case the whole text does not fit in desired height, it will be truncated.
@param string $text Text to write
@param int $width Ma... | [
"Write",
"a",
"block",
"of",
"text",
"at",
"the",
"given",
"coordinates",
"matching",
"the",
"supplied",
"width",
"and",
"height",
".",
"In",
"case",
"a",
"line",
"of",
"text",
"does",
"not",
"fit",
"desired",
"width",
"it",
"will",
"be",
"wrapped",
"to"... | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L172-L184 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.colorize | public function colorize($string, $color = null, $bgColor = null)
{
return $this->adapter->colorize($string, $color, $bgColor);
} | php | public function colorize($string, $color = null, $bgColor = null)
{
return $this->adapter->colorize($string, $color, $bgColor);
} | [
"public",
"function",
"colorize",
"(",
"$",
"string",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bgColor",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"adapter",
"->",
"colorize",
"(",
"$",
"string",
",",
"$",
"color",
",",
"$",
"bgColor",
... | Prepare a string that will be rendered in color.
@param string $string
@param null|int $color Foreground color
@param null|int $bgColor Background color
@return string | [
"Prepare",
"a",
"string",
"that",
"will",
"be",
"rendered",
"in",
"color",
"."
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L278-L281 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeSelectPrompt | public function writeSelectPrompt($message, &$options)
{
$this->writeLine();
// translate options
foreach ($options as $optionKey => $optionValue) {
$options[$optionKey] = $this->translator->translate($optionValue);
}
// write prompt badge
$this->writeBa... | php | public function writeSelectPrompt($message, &$options)
{
$this->writeLine();
// translate options
foreach ($options as $optionKey => $optionValue) {
$options[$optionKey] = $this->translator->translate($optionValue);
}
// write prompt badge
$this->writeBa... | [
"public",
"function",
"writeSelectPrompt",
"(",
"$",
"message",
",",
"&",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"writeLine",
"(",
")",
";",
"// translate options",
"foreach",
"(",
"$",
"options",
"as",
"$",
"optionKey",
"=>",
"$",
"optionValue",
")"... | Write a customizable prompt
@param $message
@param $options
@return string | [
"Write",
"a",
"customizable",
"prompt"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L409-L434 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeLinePrompt | public function writeLinePrompt($message)
{
$this->writeLine();
// write prompt badge
$this->writeBadge('badge_pick', Color::RED);
// output prompt
$prompt = new Line(
$this->translator->translate($message),
false
);
$answer = $promp... | php | public function writeLinePrompt($message)
{
$this->writeLine();
// write prompt badge
$this->writeBadge('badge_pick', Color::RED);
// output prompt
$prompt = new Line(
$this->translator->translate($message),
false
);
$answer = $promp... | [
"public",
"function",
"writeLinePrompt",
"(",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"writeLine",
"(",
")",
";",
"// write prompt badge",
"$",
"this",
"->",
"writeBadge",
"(",
"'badge_pick'",
",",
"Color",
"::",
"RED",
")",
";",
"// output prompt",
"$"... | Write a customizable line prompt
@param $message
@return string | [
"Write",
"a",
"customizable",
"line",
"prompt"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L443-L461 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeConfirmPrompt | public function writeConfirmPrompt($message, $yes, $no)
{
$this->writeLine();
// write prompt badge
$this->writeBadge('badge_pick', Color::RED);
// output prompt
$prompt = new Confirm(
$this->translator->translate($message),
$this->translator->transl... | php | public function writeConfirmPrompt($message, $yes, $no)
{
$this->writeLine();
// write prompt badge
$this->writeBadge('badge_pick', Color::RED);
// output prompt
$prompt = new Confirm(
$this->translator->translate($message),
$this->translator->transl... | [
"public",
"function",
"writeConfirmPrompt",
"(",
"$",
"message",
",",
"$",
"yes",
",",
"$",
"no",
")",
"{",
"$",
"this",
"->",
"writeLine",
"(",
")",
";",
"// write prompt badge",
"$",
"this",
"->",
"writeBadge",
"(",
"'badge_pick'",
",",
"Color",
"::",
... | Write a customizable confirm prompt
@param string $message
@param string $yes
@param string $no
@return bool | [
"Write",
"a",
"customizable",
"confirm",
"prompt"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L472-L489 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeBadge | public function writeBadge($badgeText, $badgeColor)
{
$this->adapter->write(
$this->translator->translate($badgeText),
Color::NORMAL,
$badgeColor
);
$this->adapter->write(' ');
} | php | public function writeBadge($badgeText, $badgeColor)
{
$this->adapter->write(
$this->translator->translate($badgeText),
Color::NORMAL,
$badgeColor
);
$this->adapter->write(' ');
} | [
"public",
"function",
"writeBadge",
"(",
"$",
"badgeText",
",",
"$",
"badgeColor",
")",
"{",
"$",
"this",
"->",
"adapter",
"->",
"write",
"(",
"$",
"this",
"->",
"translator",
"->",
"translate",
"(",
"$",
"badgeText",
")",
",",
"Color",
"::",
"NORMAL",
... | Write a customizable badge
@param string $badgeText
@param string $badgeColor | [
"Write",
"a",
"customizable",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L497-L505 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeBadgeLine | public function writeBadgeLine(
$message, array $placeholders = [], $badgeText, $badgeColor,
$preNewLine = false, $postNewLine = false
) {
if ($preNewLine) {
$this->adapter->writeLine();
}
$this->adapter->write(
$this->translator->translate($badgeText... | php | public function writeBadgeLine(
$message, array $placeholders = [], $badgeText, $badgeColor,
$preNewLine = false, $postNewLine = false
) {
if ($preNewLine) {
$this->adapter->writeLine();
}
$this->adapter->write(
$this->translator->translate($badgeText... | [
"public",
"function",
"writeBadgeLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"badgeText",
",",
"$",
"badgeColor",
",",
"$",
"preNewLine",
"=",
"false",
",",
"$",
"postNewLine",
"=",
"false",
")",
"{",
"if",
"... | Write a line with customizable badge
@param string $message
@param array $placeholders
@param string $badgeText
@param string $badgeColor
@param bool $preNewLine
@param bool $postNewLine | [
"Write",
"a",
"line",
"with",
"customizable",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L517-L539 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeListItemLineLevel3 | public function writeListItemLineLevel3($message, array $placeholders = [])
{
$this->adapter->write(' * ');
$this->adapter->writeLine(
vsprintf($this->translator->translate($message), $placeholders)
);
} | php | public function writeListItemLineLevel3($message, array $placeholders = [])
{
$this->adapter->write(' * ');
$this->adapter->writeLine(
vsprintf($this->translator->translate($message), $placeholders)
);
} | [
"public",
"function",
"writeListItemLineLevel3",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"adapter",
"->",
"write",
"(",
"' * '",
")",
";",
"$",
"this",
"->",
"adapter",
"->",
"writeLine"... | Write a list item line for third level
@param string $message
@param array $placeholders | [
"Write",
"a",
"list",
"item",
"line",
"for",
"third",
"level"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L590-L596 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeGoLine | public function writeGoLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_go', Color::YELLOW, false, true
);
} | php | public function writeGoLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_go', Color::YELLOW, false, true
);
} | [
"public",
"function",
"writeGoLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_go'",
",",
"Color",
"::",
"YELLOW",
","... | Write a line with a yellow GO badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"yellow",
"GO",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L604-L609 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeTaskLine | public function writeTaskLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_task', Color::BLUE, false, false
);
} | php | public function writeTaskLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_task', Color::BLUE, false, false
);
} | [
"public",
"function",
"writeTaskLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_task'",
",",
"Color",
"::",
"BLUE",
"... | Write a line with a Blue Done badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"Blue",
"Done",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L617-L622 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeOkLine | public function writeOkLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_ok', Color::GREEN, true, true
);
} | php | public function writeOkLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_ok', Color::GREEN, true, true
);
} | [
"public",
"function",
"writeOkLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_ok'",
",",
"Color",
"::",
"GREEN",
",",... | Write a line with a green OK badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"green",
"OK",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L630-L635 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeFailLine | public function writeFailLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_fail', Color::RED, true, true
);
} | php | public function writeFailLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_fail', Color::RED, true, true
);
} | [
"public",
"function",
"writeFailLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_fail'",
",",
"Color",
"::",
"RED",
",... | Write a line with a red Fail badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"red",
"Fail",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L643-L648 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeWarnLine | public function writeWarnLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_warning', Color::RED, true, true
);
} | php | public function writeWarnLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_warning', Color::RED, true, true
);
} | [
"public",
"function",
"writeWarnLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_warning'",
",",
"Color",
"::",
"RED",
... | Write a line with a red Warn badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"red",
"Warn",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L656-L661 | train |
ZFrapid/zfrapid-core | src/Console/Console.php | Console.writeTodoLine | public function writeTodoLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_todo', Color::GREEN, false, true
);
} | php | public function writeTodoLine($message, array $placeholders = [])
{
$this->writeBadgeLine(
$message, $placeholders, 'badge_todo', Color::GREEN, false, true
);
} | [
"public",
"function",
"writeTodoLine",
"(",
"$",
"message",
",",
"array",
"$",
"placeholders",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeBadgeLine",
"(",
"$",
"message",
",",
"$",
"placeholders",
",",
"'badge_todo'",
",",
"Color",
"::",
"GREEN",
... | Write a line with a yellow to-do badge
@param string $message
@param array $placeholders | [
"Write",
"a",
"line",
"with",
"a",
"yellow",
"to",
"-",
"do",
"badge"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Console/Console.php#L669-L674 | train |
mitogh/Katana | src/Helpers/Formatter.php | Formatter.katana_filter | public static function katana_filter( $param = '' ) {
if ( $param ) {
$param = trim( $param, ' _' );
return sprintf( '%s_%s', Config::KATANA_FILTER, $param );
} else {
return Config::KATANA_FILTER;
}
} | php | public static function katana_filter( $param = '' ) {
if ( $param ) {
$param = trim( $param, ' _' );
return sprintf( '%s_%s', Config::KATANA_FILTER, $param );
} else {
return Config::KATANA_FILTER;
}
} | [
"public",
"static",
"function",
"katana_filter",
"(",
"$",
"param",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"param",
")",
"{",
"$",
"param",
"=",
"trim",
"(",
"$",
"param",
",",
"' _'",
")",
";",
"return",
"sprintf",
"(",
"'%s_%s'",
",",
"Config",
"::... | Creates a specific katana filter based on a param, like a post_id,
a page template name or similar.
@param string $param The suffix of the filter.
@return string KATANA_FILTER by default and adding a suffix is param is provided.
@since 2.0.0 | [
"Creates",
"a",
"specific",
"katana",
"filter",
"based",
"on",
"a",
"param",
"like",
"a",
"post_id",
"a",
"page",
"template",
"name",
"or",
"similar",
"."
] | 9eb7267f061fbe555dbe9c12461650bb4153915f | https://github.com/mitogh/Katana/blob/9eb7267f061fbe555dbe9c12461650bb4153915f/src/Helpers/Formatter.php#L40-L47 | train |
eliasis-framework/wp-plugin-info | src/controller/class-main.php | Main.get | public function get( $option, $slug ) {
if ( $this->is_active() ) {
$this->prepare( $slug );
$slug = $this->slug;
if ( isset( $this->plugin[ $slug ][ $option ] ) ) {
return $this->plugin[ $slug ][ $option ];
} elseif ( '*' == $option && isset( $this->plugin[ $slug ] ) ) {
return $this->plugin[... | php | public function get( $option, $slug ) {
if ( $this->is_active() ) {
$this->prepare( $slug );
$slug = $this->slug;
if ( isset( $this->plugin[ $slug ][ $option ] ) ) {
return $this->plugin[ $slug ][ $option ];
} elseif ( '*' == $option && isset( $this->plugin[ $slug ] ) ) {
return $this->plugin[... | [
"public",
"function",
"get",
"(",
"$",
"option",
",",
"$",
"slug",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_active",
"(",
")",
")",
"{",
"$",
"this",
"->",
"prepare",
"(",
"$",
"slug",
")",
";",
"$",
"slug",
"=",
"$",
"this",
"->",
"slug",
... | Get plugin options.
@param string $option → option to get.
@param string $slug → WordPress plugin slug.
@return mixed → value or false | [
"Get",
"plugin",
"options",
"."
] | 052843260394a457c9f8336a07d1a986cfbc5860 | https://github.com/eliasis-framework/wp-plugin-info/blob/052843260394a457c9f8336a07d1a986cfbc5860/src/controller/class-main.php#L45-L61 | train |
eliasis-framework/wp-plugin-info | src/controller/class-main.php | Main.is_updated | protected function is_updated() {
if ( $this->is_active() && isset( $this->plugin[ $this->slug ]['last-update'] ) ) {
$interval = Plugin::WP_Plugin_Info()->getOption( 'interval' );
$last_update = $this->plugin[ $this->slug ]['last-update'];
if ( ( time() - $last_update ) < $interval ) {
return true... | php | protected function is_updated() {
if ( $this->is_active() && isset( $this->plugin[ $this->slug ]['last-update'] ) ) {
$interval = Plugin::WP_Plugin_Info()->getOption( 'interval' );
$last_update = $this->plugin[ $this->slug ]['last-update'];
if ( ( time() - $last_update ) < $interval ) {
return true... | [
"protected",
"function",
"is_updated",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_active",
"(",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"plugin",
"[",
"$",
"this",
"->",
"slug",
"]",
"[",
"'last-update'",
"]",
")",
")",
"{",
"$",
"interva... | Check the last update.
@return bool | [
"Check",
"the",
"last",
"update",
"."
] | 052843260394a457c9f8336a07d1a986cfbc5860 | https://github.com/eliasis-framework/wp-plugin-info/blob/052843260394a457c9f8336a07d1a986cfbc5860/src/controller/class-main.php#L68-L81 | train |
eliasis-framework/wp-plugin-info | src/controller/class-main.php | Main.prepare | protected function prepare( $slug ) {
$this->slug = $slug;
$file = Plugin::WP_Plugin_Info()->getOption( 'file', 'plugins' );
if ( empty( $this->plugin ) ) {
$this->plugin = $this->model->get_plugins_info( $file );
}
if ( ! $this->is_updated() ) {
$this->plugin[ $slug ] = $this->get_plugin_info( $s... | php | protected function prepare( $slug ) {
$this->slug = $slug;
$file = Plugin::WP_Plugin_Info()->getOption( 'file', 'plugins' );
if ( empty( $this->plugin ) ) {
$this->plugin = $this->model->get_plugins_info( $file );
}
if ( ! $this->is_updated() ) {
$this->plugin[ $slug ] = $this->get_plugin_info( $s... | [
"protected",
"function",
"prepare",
"(",
"$",
"slug",
")",
"{",
"$",
"this",
"->",
"slug",
"=",
"$",
"slug",
";",
"$",
"file",
"=",
"Plugin",
"::",
"WP_Plugin_Info",
"(",
")",
"->",
"getOption",
"(",
"'file'",
",",
"'plugins'",
")",
";",
"if",
"(",
... | Get plugin info.
@param string $slug → WordPress plugin slug. | [
"Get",
"plugin",
"info",
"."
] | 052843260394a457c9f8336a07d1a986cfbc5860 | https://github.com/eliasis-framework/wp-plugin-info/blob/052843260394a457c9f8336a07d1a986cfbc5860/src/controller/class-main.php#L98-L117 | train |
eliasis-framework/wp-plugin-info | src/controller/class-main.php | Main.get_plugin_info | protected function get_plugin_info( $slug ) {
$args = (object) [ 'slug' => $slug ];
$request = [
'action' => 'plugin_information',
'timeout' => 15,
'request' => serialize( $args ),
];
$url = Plugin::WP_Plugin_Info()->getOption( 'url', 'wp-api' );
$resp = wp_remote_post( $url, [ 'body' => $reques... | php | protected function get_plugin_info( $slug ) {
$args = (object) [ 'slug' => $slug ];
$request = [
'action' => 'plugin_information',
'timeout' => 15,
'request' => serialize( $args ),
];
$url = Plugin::WP_Plugin_Info()->getOption( 'url', 'wp-api' );
$resp = wp_remote_post( $url, [ 'body' => $reques... | [
"protected",
"function",
"get_plugin_info",
"(",
"$",
"slug",
")",
"{",
"$",
"args",
"=",
"(",
"object",
")",
"[",
"'slug'",
"=>",
"$",
"slug",
"]",
";",
"$",
"request",
"=",
"[",
"'action'",
"=>",
"'plugin_information'",
",",
"'timeout'",
"=>",
"15",
... | Get plugin info in WordPress API.
@param string $slug → WordPress plugin slug.
@return array → plugin info | [
"Get",
"plugin",
"info",
"in",
"WordPress",
"API",
"."
] | 052843260394a457c9f8336a07d1a986cfbc5860 | https://github.com/eliasis-framework/wp-plugin-info/blob/052843260394a457c9f8336a07d1a986cfbc5860/src/controller/class-main.php#L126-L145 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Hydrator/HydratorFactory.php | HydratorFactory.hydrate | public function hydrate($document, $data, $readOnly = false)
{
$metadata = $this->dm->getClassMetadata(get_class($document));
// Invoke preLoad lifecycle events and listeners
if (!empty($metadata->lifecycleCallbacks[Event::preLoad])) {
$args = [new PreLoadEventArgs($document, $th... | php | public function hydrate($document, $data, $readOnly = false)
{
$metadata = $this->dm->getClassMetadata(get_class($document));
// Invoke preLoad lifecycle events and listeners
if (!empty($metadata->lifecycleCallbacks[Event::preLoad])) {
$args = [new PreLoadEventArgs($document, $th... | [
"public",
"function",
"hydrate",
"(",
"$",
"document",
",",
"$",
"data",
",",
"$",
"readOnly",
"=",
"false",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"get_class",
"(",
"$",
"document",
")",
")",
";",
"//... | Hydrate array of DynamoDB document data into the given document object.
@param object $document The document object to hydrate the data into.
@param array $data The array of document data.
@param bool $readOnly
@return array $values The array of hydrated values. | [
"Hydrate",
"array",
"of",
"DynamoDB",
"document",
"data",
"into",
"the",
"given",
"document",
"object",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Hydrator/HydratorFactory.php#L384-L437 | train |
anime-db/catalog-bundle | src/Service/Item/Search/Selector/Builder.php | Builder.addLabels | public function addLabels(Search $entity)
{
if ($entity->getLabels()->count()) {
$this->add(function (QueryBuilder $query) use ($entity) {
$ids = [];
foreach ($entity->getLabels() as $label) {
$ids[] = (int) $label->getId();
}
... | php | public function addLabels(Search $entity)
{
if ($entity->getLabels()->count()) {
$this->add(function (QueryBuilder $query) use ($entity) {
$ids = [];
foreach ($entity->getLabels() as $label) {
$ids[] = (int) $label->getId();
}
... | [
"public",
"function",
"addLabels",
"(",
"Search",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"getLabels",
"(",
")",
"->",
"count",
"(",
")",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"function",
"(",
"QueryBuilder",
"$",
"query",
")",
... | Add labels.
@param Search $entity
@return Builder | [
"Add",
"labels",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Service/Item/Search/Selector/Builder.php#L224-L240 | train |
pixelpolishers/makedocs | src/MakeDocs/WebHook/GitHub/GitHub.php | GitHub.listen | public function listen()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
throw new InvalidRequestException('Expected a POST request.');
}
$remoteAddress = $this->getRemoteAddress();
if (!$this->isValidRemoteAddress($remoteAddress)) {
throw new InvalidRequestExc... | php | public function listen()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
throw new InvalidRequestException('Expected a POST request.');
}
$remoteAddress = $this->getRemoteAddress();
if (!$this->isValidRemoteAddress($remoteAddress)) {
throw new InvalidRequestExc... | [
"public",
"function",
"listen",
"(",
")",
"{",
"if",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
"!=",
"'POST'",
")",
"{",
"throw",
"new",
"InvalidRequestException",
"(",
"'Expected a POST request.'",
")",
";",
"}",
"$",
"remoteAddress",
"=",
"$",
"th... | Listens for incoming requests.
@throws InvalidRequestException | [
"Listens",
"for",
"incoming",
"requests",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/WebHook/GitHub/GitHub.php#L155-L190 | train |
jamset/process-load-manager | src/TerminatorPauseStander.php | TerminatorPauseStander.checkSubscription | public function checkSubscription()
{
if (!$this->subscriberSocket) {
$this->subscriberSocket = $this->context->getSocket(\ZMQ::SOCKET_SUB);
$this->subscriberSocket->connect($this->publisherPmSocketAddress);
$this->subscriberSocket->setSockOpt(\ZMQ::SOCKOPT_SUBSCRIBE, "")... | php | public function checkSubscription()
{
if (!$this->subscriberSocket) {
$this->subscriberSocket = $this->context->getSocket(\ZMQ::SOCKET_SUB);
$this->subscriberSocket->connect($this->publisherPmSocketAddress);
$this->subscriberSocket->setSockOpt(\ZMQ::SOCKOPT_SUBSCRIBE, "")... | [
"public",
"function",
"checkSubscription",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"subscriberSocket",
")",
"{",
"$",
"this",
"->",
"subscriberSocket",
"=",
"$",
"this",
"->",
"context",
"->",
"getSocket",
"(",
"\\",
"ZMQ",
"::",
"SOCKET_SUB",
... | Check if subscription contain pid of process
@return mixed | [
"Check",
"if",
"subscription",
"contain",
"pid",
"of",
"process"
] | cffed6ff73bf66617565707ec4f2c9251a497cc6 | https://github.com/jamset/process-load-manager/blob/cffed6ff73bf66617565707ec4f2c9251a497cc6/src/TerminatorPauseStander.php#L115-L138 | train |
jamset/process-load-manager | src/TerminatorPauseStander.php | TerminatorPauseStander.standOnPauseIfMust | public function standOnPauseIfMust()
{
if ($this->mustStandOnPause) {
$this->iAmInPause = true;
while ($this->canContinue === false) {
$this->logger->info(getmypid() . " come to usleep for microseconds: " . $this->uSleepTime);
usleep($this->uSleepTi... | php | public function standOnPauseIfMust()
{
if ($this->mustStandOnPause) {
$this->iAmInPause = true;
while ($this->canContinue === false) {
$this->logger->info(getmypid() . " come to usleep for microseconds: " . $this->uSleepTime);
usleep($this->uSleepTi... | [
"public",
"function",
"standOnPauseIfMust",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mustStandOnPause",
")",
"{",
"$",
"this",
"->",
"iAmInPause",
"=",
"true",
";",
"while",
"(",
"$",
"this",
"->",
"canContinue",
"===",
"false",
")",
"{",
"$",
"th... | Go into infinite loop with periodic checking of the subscription if it allows to continue
@return mixed | [
"Go",
"into",
"infinite",
"loop",
"with",
"periodic",
"checking",
"of",
"the",
"subscription",
"if",
"it",
"allows",
"to",
"continue"
] | cffed6ff73bf66617565707ec4f2c9251a497cc6 | https://github.com/jamset/process-load-manager/blob/cffed6ff73bf66617565707ec4f2c9251a497cc6/src/TerminatorPauseStander.php#L143-L164 | train |
jamset/process-load-manager | src/TerminatorPauseStander.php | TerminatorPauseStander.continueExecution | public function continueExecution()
{
$this->logger->info("TerminatorPauseStander " . getmypid() . " CONTINUED.");
$this->iAmInPause = false;
$this->mustStandOnPause = false;
$this->canContinue = false;
return null;
} | php | public function continueExecution()
{
$this->logger->info("TerminatorPauseStander " . getmypid() . " CONTINUED.");
$this->iAmInPause = false;
$this->mustStandOnPause = false;
$this->canContinue = false;
return null;
} | [
"public",
"function",
"continueExecution",
"(",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"TerminatorPauseStander \"",
".",
"getmypid",
"(",
")",
".",
"\" CONTINUED.\"",
")",
";",
"$",
"this",
"->",
"iAmInPause",
"=",
"false",
";",
"$",
"... | Exit from infinite loop
@return mixed | [
"Exit",
"from",
"infinite",
"loop"
] | cffed6ff73bf66617565707ec4f2c9251a497cc6 | https://github.com/jamset/process-load-manager/blob/cffed6ff73bf66617565707ec4f2c9251a497cc6/src/TerminatorPauseStander.php#L169-L178 | train |
Fulfillment-dot-com/api-wrapper-php | src/Utilities/RequestParser.php | RequestParser.parseError | public static function parseError(RequestException $requestException, $isAssoc = true)
{
$error = $error = json_decode($requestException->getResponse()->getBody(), $isAssoc);
if (!is_null($error))
{
return $error;
}
else
{
return $requestException->getMessage();
}
} | php | public static function parseError(RequestException $requestException, $isAssoc = true)
{
$error = $error = json_decode($requestException->getResponse()->getBody(), $isAssoc);
if (!is_null($error))
{
return $error;
}
else
{
return $requestException->getMessage();
}
} | [
"public",
"static",
"function",
"parseError",
"(",
"RequestException",
"$",
"requestException",
",",
"$",
"isAssoc",
"=",
"true",
")",
"{",
"$",
"error",
"=",
"$",
"error",
"=",
"json_decode",
"(",
"$",
"requestException",
"->",
"getResponse",
"(",
")",
"->"... | Returns an object or array of the FDC error parsed from the Guzzle Request exception
@param RequestException $requestException
@param bool $isAssoc
@return string | [
"Returns",
"an",
"object",
"or",
"array",
"of",
"the",
"FDC",
"error",
"parsed",
"from",
"the",
"Guzzle",
"Request",
"exception"
] | f4352843d060bc1b460c1283f25c210c9b94d324 | https://github.com/Fulfillment-dot-com/api-wrapper-php/blob/f4352843d060bc1b460c1283f25c210c9b94d324/src/Utilities/RequestParser.php#L23-L36 | train |
gplcart/cli | controllers/commands/Alias.php | Alias.cmdGetAlias | public function cmdGetAlias()
{
$result = $this->getListAlias();
$this->outputFormat($result);
$this->outputFormatTableAlias($result);
$this->output();
} | php | public function cmdGetAlias()
{
$result = $this->getListAlias();
$this->outputFormat($result);
$this->outputFormatTableAlias($result);
$this->output();
} | [
"public",
"function",
"cmdGetAlias",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListAlias",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableAlias",
"(",
"$",
"result",
... | Callback for "alias-get" command | [
"Callback",
"for",
"alias",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L42-L48 | train |
gplcart/cli | controllers/commands/Alias.php | Alias.cmdAddAlias | public function cmdAddAlias()
{
$params = $this->getParam();
if (count($params) != 3) {
$this->errorAndExit($this->text('Invalid command'));
}
list($entity, $entity_id, $alias) = $params;
if (empty($entity) || empty($entity_id) || empty($alias) || !is_numeric($... | php | public function cmdAddAlias()
{
$params = $this->getParam();
if (count($params) != 3) {
$this->errorAndExit($this->text('Invalid command'));
}
list($entity, $entity_id, $alias) = $params;
if (empty($entity) || empty($entity_id) || empty($alias) || !is_numeric($... | [
"public",
"function",
"cmdAddAlias",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"params",
")",
"!=",
"3",
")",
"{",
"$",
"this",
"->",
"errorAndExit",
"(",
"$",
"this",
"->",
"te... | Callback for "alias-add" command | [
"Callback",
"for",
"alias",
"-",
"add",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L53-L79 | train |
gplcart/cli | controllers/commands/Alias.php | Alias.cmdGenerateAlias | public function cmdGenerateAlias()
{
$entity = $this->getParam(0);
$entity_id = $this->getParam(1);
$all = $this->getParam('all');
if (empty($entity)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!isset($entity_id) && empty($all)) {
... | php | public function cmdGenerateAlias()
{
$entity = $this->getParam(0);
$entity_id = $this->getParam(1);
$all = $this->getParam('all');
if (empty($entity)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!isset($entity_id) && empty($all)) {
... | [
"public",
"function",
"cmdGenerateAlias",
"(",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"entity_id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"1",
")",
";",
"$",
"all",
"=",
"$",
"this",
"->",
"getParam"... | Callback for "alias-generate" command | [
"Callback",
"for",
"alias",
"-",
"generate",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L84-L129 | train |
gplcart/cli | controllers/commands/Alias.php | Alias.addAlias | protected function addAlias($entity, $entity_id, $alias)
{
$this->alias->delete(array('entity' => $entity, 'entity_id' => $entity_id));
$data = array(
'alias' => $alias,
'entity' => $entity,
'entity_id' => $entity_id
);
return $this->alias->add($... | php | protected function addAlias($entity, $entity_id, $alias)
{
$this->alias->delete(array('entity' => $entity, 'entity_id' => $entity_id));
$data = array(
'alias' => $alias,
'entity' => $entity,
'entity_id' => $entity_id
);
return $this->alias->add($... | [
"protected",
"function",
"addAlias",
"(",
"$",
"entity",
",",
"$",
"entity_id",
",",
"$",
"alias",
")",
"{",
"$",
"this",
"->",
"alias",
"->",
"delete",
"(",
"array",
"(",
"'entity'",
"=>",
"$",
"entity",
",",
"'entity_id'",
"=>",
"$",
"entity_id",
")"... | Add a URL alias
@param string $entity
@param int $entity_id
@param string $alias
@return int | [
"Add",
"a",
"URL",
"alias"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L137-L148 | train |
gplcart/cli | controllers/commands/Alias.php | Alias.generateListAlias | protected function generateListAlias($entity)
{
if (!$this->alias->isSupportedEntity($entity)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$model = gplcart_instance_model($entity);
if (!$model instanceof CrudInterface) {
$this->errorAndExit($th... | php | protected function generateListAlias($entity)
{
if (!$this->alias->isSupportedEntity($entity)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$model = gplcart_instance_model($entity);
if (!$model instanceof CrudInterface) {
$this->errorAndExit($th... | [
"protected",
"function",
"generateListAlias",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"alias",
"->",
"isSupportedEntity",
"(",
"$",
"entity",
")",
")",
"{",
"$",
"this",
"->",
"errorAndExit",
"(",
"$",
"this",
"->",
"text",
"("... | Mass generate URL aliases for the given entity
@param string $entity
@return bool | [
"Mass",
"generate",
"URL",
"aliases",
"for",
"the",
"given",
"entity"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L155-L194 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.