id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
204,700 | schpill/thin | src/OneModel.php | OneWrapper._createModelInstance | protected function _createModelInstance($One)
{
if ($One === false) {
return false;
}
$model = new $this->_class_name();
$model->set_one($One);
return $model;
} | php | protected function _createModelInstance($One)
{
if ($One === false) {
return false;
}
$model = new $this->_class_name();
$model->set_one($One);
return $model;
} | [
"protected",
"function",
"_createModelInstance",
"(",
"$",
"One",
")",
"{",
"if",
"(",
"$",
"One",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"model",
"=",
"new",
"$",
"this",
"->",
"_class_name",
"(",
")",
";",
"$",
"model",
"->",
... | Method to create an instance of the model class
associated with this wrapper and populate
it with the supplied One instance.
@param One $One
@return bool|Model | [
"Method",
"to",
"create",
"an",
"instance",
"of",
"the",
"model",
"class",
"associated",
"with",
"this",
"wrapper",
"and",
"populate",
"it",
"with",
"the",
"supplied",
"One",
"instance",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L72-L82 |
204,701 | schpill/thin | src/OneModel.php | OneWrapper.find_many | public function find_many()
{
$results = parent::find_many();
foreach($results as $key => $result) {
$results[$key] = $this->_createModelInstance($result);
}
return $results;
} | php | public function find_many()
{
$results = parent::find_many();
foreach($results as $key => $result) {
$results[$key] = $this->_createModelInstance($result);
}
return $results;
} | [
"public",
"function",
"find_many",
"(",
")",
"{",
"$",
"results",
"=",
"parent",
"::",
"find_many",
"(",
")",
";",
"foreach",
"(",
"$",
"results",
"as",
"$",
"key",
"=>",
"$",
"result",
")",
"{",
"$",
"results",
"[",
"$",
"key",
"]",
"=",
"$",
"t... | Wrap One's find_many method to return
an array of instances of the class associated
with this wrapper instead of the raw One class.
@return Array | [
"Wrap",
"One",
"s",
"find_many",
"method",
"to",
"return",
"an",
"array",
"of",
"instances",
"of",
"the",
"class",
"associated",
"with",
"this",
"wrapper",
"instead",
"of",
"the",
"raw",
"One",
"class",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L104-L113 |
204,702 | schpill/thin | src/OneModel.php | OneModel._hasOneOrMany | protected function _hasOneOrMany($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
$base_table_name = self::_getTableName(get_class($this));
$foreign_key_name = self::_buildForeignKeyName($foreign_key_name, $bas... | php | protected function _hasOneOrMany($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
$base_table_name = self::_getTableName(get_class($this));
$foreign_key_name = self::_buildForeignKeyName($foreign_key_name, $bas... | [
"protected",
"function",
"_hasOneOrMany",
"(",
"$",
"associated_class_name",
",",
"$",
"foreign_key_name",
"=",
"null",
",",
"$",
"foreign_key_name_in_current_models_table",
"=",
"null",
",",
"$",
"connection_name",
"=",
"null",
")",
"{",
"$",
"base_table_name",
"="... | Internal method to construct the queries for both the has_one and
has_many methods. These two types of association are identical; the
only difference is whether find_one or find_many is used to complete
the method chain.
@param string $associated_class_name
@param null|string $foreign_key_name
@param null|stri... | [
"Internal",
"method",
"to",
"construct",
"the",
"queries",
"for",
"both",
"the",
"has_one",
"and",
"has_many",
"methods",
".",
"These",
"two",
"types",
"of",
"association",
"are",
"identical",
";",
"the",
"only",
"difference",
"is",
"whether",
"find_one",
"or"... | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L318-L338 |
204,703 | schpill/thin | src/OneModel.php | OneModel.has_one | protected function has_one($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
return $this->_hasOneOrMany($associated_class_name, $foreign_key_name, $foreign_key_name_in_current_models_table, $connection_name);
} | php | protected function has_one($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
return $this->_hasOneOrMany($associated_class_name, $foreign_key_name, $foreign_key_name_in_current_models_table, $connection_name);
} | [
"protected",
"function",
"has_one",
"(",
"$",
"associated_class_name",
",",
"$",
"foreign_key_name",
"=",
"null",
",",
"$",
"foreign_key_name_in_current_models_table",
"=",
"null",
",",
"$",
"connection_name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
... | Helper method to manage one-to-one relations where the foreign
key is on the associated table.
@param string $associated_class_name
@param null|string $foreign_key_name
@param null|string $foreign_key_name_in_current_models_table
@param null|string $connection_name
@return OneWrapper | [
"Helper",
"method",
"to",
"manage",
"one",
"-",
"to",
"-",
"one",
"relations",
"where",
"the",
"foreign",
"key",
"is",
"on",
"the",
"associated",
"table",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L350-L353 |
204,704 | schpill/thin | src/OneModel.php | OneModel.has_many | protected function has_many($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
return $this->_hasOneOrMany($associated_class_name, $foreign_key_name, $foreign_key_name_in_current_models_table, $connection_name);
} | php | protected function has_many($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_current_models_table = null, $connection_name = null)
{
return $this->_hasOneOrMany($associated_class_name, $foreign_key_name, $foreign_key_name_in_current_models_table, $connection_name);
} | [
"protected",
"function",
"has_many",
"(",
"$",
"associated_class_name",
",",
"$",
"foreign_key_name",
"=",
"null",
",",
"$",
"foreign_key_name_in_current_models_table",
"=",
"null",
",",
"$",
"connection_name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
... | Helper method to manage one-to-many relations where the foreign
key is on the associated table.
@param string $associated_class_name
@param null|string $foreign_key_name
@param null|string $foreign_key_name_in_current_models_table
@param null|string $connection_name
@return OneWrapper | [
"Helper",
"method",
"to",
"manage",
"one",
"-",
"to",
"-",
"many",
"relations",
"where",
"the",
"foreign",
"key",
"is",
"on",
"the",
"associated",
"table",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L365-L368 |
204,705 | schpill/thin | src/OneModel.php | OneModel.belongs_to | protected function belongs_to($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_associated_models_table = null, $connection_name = null)
{
$associated_table_name = self::_getTableName(self::$auto_prefix_models . $associated_class_name);
$foreign_key_name = self::_bui... | php | protected function belongs_to($associated_class_name, $foreign_key_name = null, $foreign_key_name_in_associated_models_table = null, $connection_name = null)
{
$associated_table_name = self::_getTableName(self::$auto_prefix_models . $associated_class_name);
$foreign_key_name = self::_bui... | [
"protected",
"function",
"belongs_to",
"(",
"$",
"associated_class_name",
",",
"$",
"foreign_key_name",
"=",
"null",
",",
"$",
"foreign_key_name_in_associated_models_table",
"=",
"null",
",",
"$",
"connection_name",
"=",
"null",
")",
"{",
"$",
"associated_table_name",... | Helper method to manage one-to-one and one-to-many relations where
the foreign key is on the base table.
@param string $associated_class_name
@param null|string $foreign_key_name
@param null|string $foreign_key_name_in_associated_models_table
@param null|string $connection_name
@return $this|null | [
"Helper",
"method",
"to",
"manage",
"one",
"-",
"to",
"-",
"one",
"and",
"one",
"-",
"to",
"-",
"many",
"relations",
"where",
"the",
"foreign",
"key",
"is",
"on",
"the",
"base",
"table",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L380-L399 |
204,706 | schpill/thin | src/OneModel.php | OneModel.has_many_through | protected function has_many_through($associated_class_name, $join_class_name = null, $key_to_base_table = null, $key_to_associated_table = null, $key_in_base_table = null, $key_in_associated_table = null, $connection_name = null)
{
$base_class_name = get_class($this);
// The class name... | php | protected function has_many_through($associated_class_name, $join_class_name = null, $key_to_base_table = null, $key_to_associated_table = null, $key_in_base_table = null, $key_in_associated_table = null, $connection_name = null)
{
$base_class_name = get_class($this);
// The class name... | [
"protected",
"function",
"has_many_through",
"(",
"$",
"associated_class_name",
",",
"$",
"join_class_name",
"=",
"null",
",",
"$",
"key_to_base_table",
"=",
"null",
",",
"$",
"key_to_associated_table",
"=",
"null",
",",
"$",
"key_in_base_table",
"=",
"null",
",",... | Helper method to manage many-to-many relationships via an intermediate model. See
README for a full explanation of the parameters.
@param string $associated_class_name
@param null|string $join_class_name
@param null|string $key_to_base_table
@param null|string $key_to_associated_table
@param null|string $key... | [
"Helper",
"method",
"to",
"manage",
"many",
"-",
"to",
"-",
"many",
"relationships",
"via",
"an",
"intermediate",
"model",
".",
"See",
"README",
"for",
"a",
"full",
"explanation",
"of",
"the",
"parameters",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L414-L462 |
204,707 | 3ev/wordpress-core | src/Tev/Field/Factory.php | Factory.create | public function create($field, AbstractPost $post)
{
$data = get_field_object($field, $post->getId());
return $this->createFromField($data);
} | php | public function create($field, AbstractPost $post)
{
$data = get_field_object($field, $post->getId());
return $this->createFromField($data);
} | [
"public",
"function",
"create",
"(",
"$",
"field",
",",
"AbstractPost",
"$",
"post",
")",
"{",
"$",
"data",
"=",
"get_field_object",
"(",
"$",
"field",
",",
"$",
"post",
"->",
"getId",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"createFromField",... | Create a new custom field object.
If the field is not registered, a `\Tev\Field\Model\NullField` will be
returned.
@param string $field Field name or ID
@param \Tev\Post\Model\AbstractPost $post Post object field is for
@return \Tev\Field\Model\AbstractField Field object
@throws \... | [
"Create",
"a",
"new",
"custom",
"field",
"object",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Factory.php#L97-L102 |
204,708 | 3ev/wordpress-core | src/Tev/Field/Factory.php | Factory.createFromField | public function createFromField($field, $value = null)
{
if (!is_array($field)) {
return new NullField;
}
if ($value !== null) {
$field['value'] = $value;
}
return $this->resolve($field['type'], $field);
} | php | public function createFromField($field, $value = null)
{
if (!is_array($field)) {
return new NullField;
}
if ($value !== null) {
$field['value'] = $value;
}
return $this->resolve($field['type'], $field);
} | [
"public",
"function",
"createFromField",
"(",
"$",
"field",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"return",
"new",
"NullField",
";",
"}",
"if",
"(",
"$",
"value",
"!==",
"null",
")",... | Create a new custom field object from an existing set of field data.
If the field is not registered, a `\Tev\Field\Model\NullField` will be
returned.
@param array $field Field data array
@param mixed $value If supplied, will be set as the fields value
@return \Tev\F... | [
"Create",
"a",
"new",
"custom",
"field",
"object",
"from",
"an",
"existing",
"set",
"of",
"field",
"data",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Factory.php#L116-L127 |
204,709 | 3ev/wordpress-core | src/Tev/Field/Factory.php | Factory.resolve | protected function resolve($type, array $data)
{
if ($this->registered($type)) {
$f = $this->registry[$type];
if ($f instanceof Closure) {
return $f($data, $this->app);
} else {
return new $f($data);
}
} else {
... | php | protected function resolve($type, array $data)
{
if ($this->registered($type)) {
$f = $this->registry[$type];
if ($f instanceof Closure) {
return $f($data, $this->app);
} else {
return new $f($data);
}
} else {
... | [
"protected",
"function",
"resolve",
"(",
"$",
"type",
",",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"registered",
"(",
"$",
"type",
")",
")",
"{",
"$",
"f",
"=",
"$",
"this",
"->",
"registry",
"[",
"$",
"type",
"]",
";",
"i... | Resolve a field object using its type, from the registered factory
functions.
@param string $type Field type
@param array $data Field data
@return \Tev\Field\Model\AbstractField Field object
@throws \Exception If field type is not registered | [
"Resolve",
"a",
"field",
"object",
"using",
"its",
"type",
"from",
"the",
"registered",
"factory",
"functions",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Factory.php#L153-L165 |
204,710 | pmdevelopment/tool-bundle | Framework/Configuration/FontAwesomeConfig.php | FontAwesomeConfig.getClasses | public static function getClasses($version)
{
if (false === in_array($version, self::getVersions())) {
throw new \LogicException(sprintf("Version is not supported. Available: %s", implode(", ", self::getVersions())));
}
$version = explode(".", $version);
$subVersion = $v... | php | public static function getClasses($version)
{
if (false === in_array($version, self::getVersions())) {
throw new \LogicException(sprintf("Version is not supported. Available: %s", implode(", ", self::getVersions())));
}
$version = explode(".", $version);
$subVersion = $v... | [
"public",
"static",
"function",
"getClasses",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"false",
"===",
"in_array",
"(",
"$",
"version",
",",
"self",
"::",
"getVersions",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
... | Get Icon Classes
@param string $version
@return array | [
"Get",
"Icon",
"Classes"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Framework/Configuration/FontAwesomeConfig.php#L40-L59 |
204,711 | phavour/phavour | Phavour/Session/Storage.php | Storage.lock | public function lock()
{
$this->_validate();
$_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = true;
return true;
} | php | public function lock()
{
$this->_validate();
$_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = true;
return true;
} | [
"public",
"function",
"lock",
"(",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"secretStorage",
"]",
"[",
"'locks'",
"]",
"[",
"$",
"this",
"->",
"_namespaceName",
"]",
"=",
"true",
";",
"return",... | Lock the namespace, this will prevent removal of keys
@return boolean
@throws \Exception | [
"Lock",
"the",
"namespace",
"this",
"will",
"prevent",
"removal",
"of",
"keys"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L102-L107 |
204,712 | phavour/phavour | Phavour/Session/Storage.php | Storage.unlock | public function unlock()
{
$this->_validate();
$_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = false;
return true;
} | php | public function unlock()
{
$this->_validate();
$_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = false;
return true;
} | [
"public",
"function",
"unlock",
"(",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"secretStorage",
"]",
"[",
"'locks'",
"]",
"[",
"$",
"this",
"->",
"_namespaceName",
"]",
"=",
"false",
";",
"retur... | Unlock the namespace, this will allow removal of keys
@return boolean
@throws \Exception | [
"Unlock",
"the",
"namespace",
"this",
"will",
"allow",
"removal",
"of",
"keys"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L115-L120 |
204,713 | phavour/phavour | Phavour/Session/Storage.php | Storage.isLocked | public function isLocked()
{
$this->_validate();
if ($_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] == true) {
return true;
}
return false;
} | php | public function isLocked()
{
$this->_validate();
if ($_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] == true) {
return true;
}
return false;
} | [
"public",
"function",
"isLocked",
"(",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"if",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"secretStorage",
"]",
"[",
"'locks'",
"]",
"[",
"$",
"this",
"->",
"_namespaceName",
"]",
"==",
"true"... | Check if a namespace is currently locked.
@return boolean
@throws \Exception | [
"Check",
"if",
"a",
"namespace",
"is",
"currently",
"locked",
"."
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L128-L135 |
204,714 | phavour/phavour | Phavour/Session/Storage.php | Storage.set | public function set($name, $value)
{
if (!$this->isLocked()) {
$_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name] = $value;
return true;
}
return false;
} | php | public function set($name, $value)
{
if (!$this->isLocked()) {
$_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name] = $value;
return true;
}
return false;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isLocked",
"(",
")",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"publicStorage",
"]",
"[",
"'store'",
"]",
"[",
"$",
"this",
... | Set a value in the current namespace
@param string $name
@param mixed $value
@return boolean result of save
@throws \Exception | [
"Set",
"a",
"value",
"in",
"the",
"current",
"namespace"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L145-L152 |
204,715 | phavour/phavour | Phavour/Session/Storage.php | Storage.get | public function get($name)
{
$this->_validate();
if (array_key_exists($name, $_SESSION[$this->publicStorage]['store'][$this->_namespaceName])) {
return $_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name];
}
return false;
} | php | public function get($name)
{
$this->_validate();
if (array_key_exists($name, $_SESSION[$this->publicStorage]['store'][$this->_namespaceName])) {
return $_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name];
}
return false;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"publicStorage",
"]",
"[",
"'store'",
"]",
"[",
"... | Retrieve a single value from the namespace
@param string $name
@return mixed
@throws \Exception | [
"Retrieve",
"a",
"single",
"value",
"from",
"the",
"namespace"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L161-L168 |
204,716 | phavour/phavour | Phavour/Session/Storage.php | Storage.getAll | public function getAll()
{
$this->_validate();
if (array_key_exists($this->_namespaceName, $_SESSION[$this->publicStorage]['store'])) {
return $_SESSION[$this->publicStorage]['store'][$this->_namespaceName];
}
return false;
} | php | public function getAll()
{
$this->_validate();
if (array_key_exists($this->_namespaceName, $_SESSION[$this->publicStorage]['store'])) {
return $_SESSION[$this->publicStorage]['store'][$this->_namespaceName];
}
return false;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"_namespaceName",
",",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"publicStorage",
"]",
"[",
"'store'",
"... | Retrieve the entire namespace
@return array success | boolean false failure
@throws \Exception | [
"Retrieve",
"the",
"entire",
"namespace"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L176-L183 |
204,717 | phavour/phavour | Phavour/Session/Storage.php | Storage.remove | public function remove($name)
{
$this->_validate();
if (!$this->isLocked()) {
if (!$this->get($name)) {
return true;
}
unset($_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name]);
return true;
}
return ... | php | public function remove($name)
{
$this->_validate();
if (!$this->isLocked()) {
if (!$this->get($name)) {
return true;
}
unset($_SESSION[$this->publicStorage]['store'][$this->_namespaceName][$name]);
return true;
}
return ... | [
"public",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isLocked",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
")"... | Remove an key from the namespace
@param string $name
@return boolean result of removal
@throws \Exception | [
"Remove",
"an",
"key",
"from",
"the",
"namespace"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L192-L203 |
204,718 | phavour/phavour | Phavour/Session/Storage.php | Storage.removeAll | public function removeAll()
{
$this->_validate();
if (!$this->isLocked()) {
$_SESSION[$this->publicStorage]['store'][$this->_namespaceName] = array();
return true;
}
return false;
} | php | public function removeAll()
{
$this->_validate();
if (!$this->isLocked()) {
$_SESSION[$this->publicStorage]['store'][$this->_namespaceName] = array();
return true;
}
return false;
} | [
"public",
"function",
"removeAll",
"(",
")",
"{",
"$",
"this",
"->",
"_validate",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isLocked",
"(",
")",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"publicStorage",
"]",
"[",
"'store'",
"]",
... | Clear all values currently held in this namespace
@return boolean status of removal
@throws \Exception | [
"Clear",
"all",
"values",
"currently",
"held",
"in",
"this",
"namespace"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L211-L219 |
204,719 | phavour/phavour | Phavour/Session/Storage.php | Storage.setup | protected function setup()
{
if (array_key_exists($this->secretStorage, $_SESSION)) {
if (!is_array($_SESSION[$this->secretStorage])) {
$_SESSION[$this->secretStorage] = array('locks' => array($this->_namespaceName => false));
} else {
if (!array_key_e... | php | protected function setup()
{
if (array_key_exists($this->secretStorage, $_SESSION)) {
if (!is_array($_SESSION[$this->secretStorage])) {
$_SESSION[$this->secretStorage] = array('locks' => array($this->_namespaceName => false));
} else {
if (!array_key_e... | [
"protected",
"function",
"setup",
"(",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"secretStorage",
",",
"$",
"_SESSION",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"secretStorage",
"]"... | Ensure the session contains the data we expect to see.
@return boolean | [
"Ensure",
"the",
"session",
"contains",
"the",
"data",
"we",
"expect",
"to",
"see",
"."
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Session/Storage.php#L243-L274 |
204,720 | kiler129/TinyWs | src/NetworkFrame.php | NetworkFrame.collectPayload | private function collectPayload()
{
if ($this->payloadLength === 0) {
$this->logger->debug("Skipping payload collection [expected length === 0]");
return true;
}
$this->logger->debug("Trying to collect payload...");
if (!$this->headersCollected) {
... | php | private function collectPayload()
{
if ($this->payloadLength === 0) {
$this->logger->debug("Skipping payload collection [expected length === 0]");
return true;
}
$this->logger->debug("Trying to collect payload...");
if (!$this->headersCollected) {
... | [
"private",
"function",
"collectPayload",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"payloadLength",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Skipping payload collection [expected length === 0]\"",
")",
";",
"return",
"true",
... | Collects payload from buffer. Masked packets are decoded.
@return bool|null Returns false if payload not yet collected, true if it was collected. Null is returned if
payload cannot be collected yet
@throws LogicException In case of calling before collecting headers | [
"Collects",
"payload",
"from",
"buffer",
".",
"Masked",
"packets",
"are",
"decoded",
"."
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/NetworkFrame.php#L194-L222 |
204,721 | samsonos/php_core | src/XMLBuilder.php | XMLBuilder.setAttribute | protected function setAttribute(string $value, \DOMElement $node, array $classesMetadata)
{
if (array_key_exists($value, $classesMetadata)) {
$node->setAttribute('service', $value);
} elseif (class_exists($value)) {
$node->setAttribute('class', $value);
} else {
... | php | protected function setAttribute(string $value, \DOMElement $node, array $classesMetadata)
{
if (array_key_exists($value, $classesMetadata)) {
$node->setAttribute('service', $value);
} elseif (class_exists($value)) {
$node->setAttribute('class', $value);
} else {
... | [
"protected",
"function",
"setAttribute",
"(",
"string",
"$",
"value",
",",
"\\",
"DOMElement",
"$",
"node",
",",
"array",
"$",
"classesMetadata",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"value",
",",
"$",
"classesMetadata",
")",
")",
"{",
"$",
... | Set XML property or method argument value.
@param string $value
@param \DOMElement $node
@param ClassMetadata[] $classesMetadata | [
"Set",
"XML",
"property",
"or",
"method",
"argument",
"value",
"."
] | 15f30528e2efab9e9cf16e9aad3899edced49de1 | https://github.com/samsonos/php_core/blob/15f30528e2efab9e9cf16e9aad3899edced49de1/src/XMLBuilder.php#L24-L33 |
204,722 | samsonos/php_core | src/XMLBuilder.php | XMLBuilder.buildXMLConfig | public function buildXMLConfig(array $classesMetadata, string $path)
{
foreach ($classesMetadata as $alias => $classMetadata) {
$dom = new \DOMDocument("1.0", "utf-8");
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$root = $dom->createElement("d... | php | public function buildXMLConfig(array $classesMetadata, string $path)
{
foreach ($classesMetadata as $alias => $classMetadata) {
$dom = new \DOMDocument("1.0", "utf-8");
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$root = $dom->createElement("d... | [
"public",
"function",
"buildXMLConfig",
"(",
"array",
"$",
"classesMetadata",
",",
"string",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"classesMetadata",
"as",
"$",
"alias",
"=>",
"$",
"classMetadata",
")",
"{",
"$",
"dom",
"=",
"new",
"\\",
"DOMDocument... | Build class xml config from class metadata.
TODO: Scan for existing config and change only not filled values.
@param ClassMetadata[] $classesMetadata
@param string $path Path where to store XML files | [
"Build",
"class",
"xml",
"config",
"from",
"class",
"metadata",
"."
] | 15f30528e2efab9e9cf16e9aad3899edced49de1 | https://github.com/samsonos/php_core/blob/15f30528e2efab9e9cf16e9aad3899edced49de1/src/XMLBuilder.php#L43-L92 |
204,723 | IStranger/yii2-resource-smart-load | base/Helper.php | Helper.filterByKeys | public static function filterByKeys($array, array $keysInc = null, array $keysExc = null)
{
if ($keysInc !== null) {
$array = array_intersect_key($array, array_flip($keysInc));
}
if ($keysExc) {
$array = array_diff_key($array, array_flip($keysExc));
}
... | php | public static function filterByKeys($array, array $keysInc = null, array $keysExc = null)
{
if ($keysInc !== null) {
$array = array_intersect_key($array, array_flip($keysInc));
}
if ($keysExc) {
$array = array_diff_key($array, array_flip($keysExc));
}
... | [
"public",
"static",
"function",
"filterByKeys",
"(",
"$",
"array",
",",
"array",
"$",
"keysInc",
"=",
"null",
",",
"array",
"$",
"keysExc",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"keysInc",
"!==",
"null",
")",
"{",
"$",
"array",
"=",
"array_intersect_k... | Filters items by given keys.
@param array $array source assoc array
@param array $keysInc keys of items, that should be included
@param array $keysExc keys of items, that should be excluded
@return array|mixed|null filtered array | [
"Filters",
"items",
"by",
"given",
"keys",
"."
] | a4f203745d9a02fd97853b49c55b287aea6d7e6d | https://github.com/IStranger/yii2-resource-smart-load/blob/a4f203745d9a02fd97853b49c55b287aea6d7e6d/base/Helper.php#L72-L81 |
204,724 | buse974/Dal | src/Dal/AbstractFactory/ModelAbstractFactory.php | ModelAbstractFactory.canCreate | public function canCreate(ContainerInterface $container, $requestedName)
{
$namespace = $this->getConfig($container)['namespace'];
$ar = explode('_', $requestedName);
return (count($ar) >= 2 && array_key_exists($ar[0], $namespace) && $ar[1] === 'model');
} | php | public function canCreate(ContainerInterface $container, $requestedName)
{
$namespace = $this->getConfig($container)['namespace'];
$ar = explode('_', $requestedName);
return (count($ar) >= 2 && array_key_exists($ar[0], $namespace) && $ar[1] === 'model');
} | [
"public",
"function",
"canCreate",
"(",
"ContainerInterface",
"$",
"container",
",",
"$",
"requestedName",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"$",
"container",
")",
"[",
"'namespace'",
"]",
";",
"$",
"ar",
"=",
"explode",... | Determine if we can create a Model with name
{@inheritDoc}
@see \Zend\ServiceManager\Factory\AbstractFactoryInterface::canCreate() | [
"Determine",
"if",
"we",
"can",
"create",
"a",
"Model",
"with",
"name"
] | faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab | https://github.com/buse974/Dal/blob/faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab/src/Dal/AbstractFactory/ModelAbstractFactory.php#L25-L31 |
204,725 | jasny/entity | src/Traits/ToJsonTrait.php | ToJsonTrait.jsonSerialize | public function jsonSerialize(): stdClass
{
$object = (object)object_get_properties($this, $this instanceof DynamicEntity);
/** @var Event\ToJson $event */
$event = $this->dispatchEvent(new Event\ToJson($this, $object));
$data = i\type_check($event->getPayload(), stdClass::class, ne... | php | public function jsonSerialize(): stdClass
{
$object = (object)object_get_properties($this, $this instanceof DynamicEntity);
/** @var Event\ToJson $event */
$event = $this->dispatchEvent(new Event\ToJson($this, $object));
$data = i\type_check($event->getPayload(), stdClass::class, ne... | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"stdClass",
"{",
"$",
"object",
"=",
"(",
"object",
")",
"object_get_properties",
"(",
"$",
"this",
",",
"$",
"this",
"instanceof",
"DynamicEntity",
")",
";",
"/** @var Event\\ToJson $event */",
"$",
"event",... | Prepare entity for JsonSerialize encoding
@return stdClass | [
"Prepare",
"entity",
"for",
"JsonSerialize",
"encoding"
] | 5af7c94645671a3257d6565ff1891ff61fdcf69b | https://github.com/jasny/entity/blob/5af7c94645671a3257d6565ff1891ff61fdcf69b/src/Traits/ToJsonTrait.php#L32-L41 |
204,726 | Phpillip/phpillip | src/EventListener/TemplateListener.php | TemplateListener.onKernelController | public function onKernelController(FilterControllerEvent $event)
{
$request = $event->getRequest();
if ($template = $this->getTemplate($request, $event->getController())) {
$request->attributes->set('_template', $template);
}
} | php | public function onKernelController(FilterControllerEvent $event)
{
$request = $event->getRequest();
if ($template = $this->getTemplate($request, $event->getController())) {
$request->attributes->set('_template', $template);
}
} | [
"public",
"function",
"onKernelController",
"(",
"FilterControllerEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"getTemplate",
"(",
"$",
"request",
... | Handles Kernel Controller events
@param FilterControllerEvent $event | [
"Handles",
"Kernel",
"Controller",
"events"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/TemplateListener.php#L55-L62 |
204,727 | Phpillip/phpillip | src/EventListener/TemplateListener.php | TemplateListener.onKernelView | public function onKernelView(GetResponseForControllerResultEvent $event)
{
$request = $event->getRequest();
$response = $event->getResponse();
$parameters = $event->getControllerResult();
if (!$response instanceof Response && $template = $request->attributes->get('_template')) ... | php | public function onKernelView(GetResponseForControllerResultEvent $event)
{
$request = $event->getRequest();
$response = $event->getResponse();
$parameters = $event->getControllerResult();
if (!$response instanceof Response && $template = $request->attributes->get('_template')) ... | [
"public",
"function",
"onKernelView",
"(",
"GetResponseForControllerResultEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"$",
"pa... | Handles Kernel View events
@param GetResponseForControllerResultEvent $event | [
"Handles",
"Kernel",
"View",
"events"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/TemplateListener.php#L69-L78 |
204,728 | Phpillip/phpillip | src/EventListener/TemplateListener.php | TemplateListener.getTemplate | protected function getTemplate(Request $request, $controller)
{
if ($request->attributes->has('_template')) {
return null;
}
$format = $request->attributes->get('_format', 'html');
$templates = [];
if ($controllerInfo = $this->parseController($controller)) {
... | php | protected function getTemplate(Request $request, $controller)
{
if ($request->attributes->has('_template')) {
return null;
}
$format = $request->attributes->get('_format', 'html');
$templates = [];
if ($controllerInfo = $this->parseController($controller)) {
... | [
"protected",
"function",
"getTemplate",
"(",
"Request",
"$",
"request",
",",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"attributes",
"->",
"has",
"(",
"'_template'",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"format",
"=",
"$"... | Get template from the given request and controller
@param Request $request
@param mixed $controller
@return string|null | [
"Get",
"template",
"from",
"the",
"given",
"request",
"and",
"controller"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/TemplateListener.php#L88-L120 |
204,729 | Phpillip/phpillip | src/EventListener/TemplateListener.php | TemplateListener.parseController | protected function parseController($controller)
{
if (!is_array($controller) || !is_object($controller[0]) || !isset($controller[1])) {
return null;
}
if (!preg_match('#Controller\\\(.+)Controller$#', get_class($controller[0]), $matches)) {
return null;
}
... | php | protected function parseController($controller)
{
if (!is_array($controller) || !is_object($controller[0]) || !isset($controller[1])) {
return null;
}
if (!preg_match('#Controller\\\(.+)Controller$#', get_class($controller[0]), $matches)) {
return null;
}
... | [
"protected",
"function",
"parseController",
"(",
"$",
"controller",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"controller",
")",
"||",
"!",
"is_object",
"(",
"$",
"controller",
"[",
"0",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"controller",
"[",
... | Parse controller to extract its name
@param mixed $controller
@return string | [
"Parse",
"controller",
"to",
"extract",
"its",
"name"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/TemplateListener.php#L129-L140 |
204,730 | Phpillip/phpillip | src/EventListener/TemplateListener.php | TemplateListener.templateExists | protected function templateExists($template)
{
try {
$class = $this->templating->getTemplateClass($template);
} catch (Twig_Error_Loader $e) {
return false;
}
return $template;
} | php | protected function templateExists($template)
{
try {
$class = $this->templating->getTemplateClass($template);
} catch (Twig_Error_Loader $e) {
return false;
}
return $template;
} | [
"protected",
"function",
"templateExists",
"(",
"$",
"template",
")",
"{",
"try",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"templating",
"->",
"getTemplateClass",
"(",
"$",
"template",
")",
";",
"}",
"catch",
"(",
"Twig_Error_Loader",
"$",
"e",
")",
"{... | Does the given template exists?
@param string $template
@return boolean | [
"Does",
"the",
"given",
"template",
"exists?"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/TemplateListener.php#L149-L158 |
204,731 | Dhii/output-renderer-abstract | src/RenderCapableTemplateBlockTrait.php | RenderCapableTemplateBlockTrait._render | protected function _render()
{
try {
$template = $this->_getTemplate();
$context = $this->_getContextFor($template);
return $this->_renderTemplate($template, $context);
} catch (RootException $e) {
throw $this->_throwCouldNotRenderException($this->__... | php | protected function _render()
{
try {
$template = $this->_getTemplate();
$context = $this->_getContextFor($template);
return $this->_renderTemplate($template, $context);
} catch (RootException $e) {
throw $this->_throwCouldNotRenderException($this->__... | [
"protected",
"function",
"_render",
"(",
")",
"{",
"try",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"_getTemplate",
"(",
")",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"_getContextFor",
"(",
"$",
"template",
")",
";",
"return",
"$",
"this",
"-... | Renders an internal template.
@since [*next-version*]
@throws CouldNotRenderExceptionInterface If the template could not be rendered.
@throws RendererExceptionInterface If a problem related to a renderer occurs. | [
"Renders",
"an",
"internal",
"template",
"."
] | 0f6e5eed940025332dd1986d6c771e10f7197b1a | https://github.com/Dhii/output-renderer-abstract/blob/0f6e5eed940025332dd1986d6c771e10f7197b1a/src/RenderCapableTemplateBlockTrait.php#L27-L37 |
204,732 | schpill/thin | src/Html/Doctype.php | Doctype.doctype | public function doctype($doctype = null)
{
if (null !== $doctype) {
switch ($doctype) {
case static::XHTML11:
case static::XHTML1_STRICT:
case static::XHTML1_TRANSITIONAL:
case static::XHTML1_FRAMESET:
... | php | public function doctype($doctype = null)
{
if (null !== $doctype) {
switch ($doctype) {
case static::XHTML11:
case static::XHTML1_STRICT:
case static::XHTML1_TRANSITIONAL:
case static::XHTML1_FRAMESET:
... | [
"public",
"function",
"doctype",
"(",
"$",
"doctype",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"doctype",
")",
"{",
"switch",
"(",
"$",
"doctype",
")",
"{",
"case",
"static",
"::",
"XHTML11",
":",
"case",
"static",
"::",
"XHTML1_STRICT",
... | Set or retrieve doctype
@param string $doctype
@return FTV_Html_Doctype | [
"Set",
"or",
"retrieve",
"doctype"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Doctype.php#L84-L119 |
204,733 | zeyon/rest | src/localizer.php | Localizer.getInstance | public static function getInstance($arrAccepted=array(), $strDefault='de') {
if (self::$instance === NULL)
self::$instance = new self($arrAccepted, $strDefault);
return self::$instance;
} | php | public static function getInstance($arrAccepted=array(), $strDefault='de') {
if (self::$instance === NULL)
self::$instance = new self($arrAccepted, $strDefault);
return self::$instance;
} | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"arrAccepted",
"=",
"array",
"(",
")",
",",
"$",
"strDefault",
"=",
"'de'",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"instance",
"===",
"NULL",
")",
"self",
"::",
"$",
"instance",
"=",
"new",
"s... | Return the current instance
@param array $arrAccepted All accepted languages
@param string $strDefault Default language code
@return Localizer | [
"Return",
"the",
"current",
"instance"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L54-L58 |
204,734 | zeyon/rest | src/localizer.php | Localizer.fileFormatDir | private function fileFormatDir($strDirectory, $strSlash=DIRECTORY_SEPARATOR) {
return substr($strDirectory, -1) != $strSlash ? $strDirectory.$strSlash : $strDirectory;
} | php | private function fileFormatDir($strDirectory, $strSlash=DIRECTORY_SEPARATOR) {
return substr($strDirectory, -1) != $strSlash ? $strDirectory.$strSlash : $strDirectory;
} | [
"private",
"function",
"fileFormatDir",
"(",
"$",
"strDirectory",
",",
"$",
"strSlash",
"=",
"DIRECTORY_SEPARATOR",
")",
"{",
"return",
"substr",
"(",
"$",
"strDirectory",
",",
"-",
"1",
")",
"!=",
"$",
"strSlash",
"?",
"$",
"strDirectory",
".",
"$",
"strS... | Makes sure the directory ends with a slash
@param string $strDirectory
@return string | [
"Makes",
"sure",
"the",
"directory",
"ends",
"with",
"a",
"slash"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L66-L68 |
204,735 | zeyon/rest | src/localizer.php | Localizer.load | public function load($strSourcePath, $strCachePath=false, $bolStore=true) {
$strSourcePath = $this->fileFormatDir($strSourcePath);
$strLang = self::init($this->arrAccepted, $this->strDefault, $bolStore);
$this->strCurrent = $strLang;
if ($strCachePath) {
$strCachePath = $this->fileFormatDir($strCachePath);... | php | public function load($strSourcePath, $strCachePath=false, $bolStore=true) {
$strSourcePath = $this->fileFormatDir($strSourcePath);
$strLang = self::init($this->arrAccepted, $this->strDefault, $bolStore);
$this->strCurrent = $strLang;
if ($strCachePath) {
$strCachePath = $this->fileFormatDir($strCachePath);... | [
"public",
"function",
"load",
"(",
"$",
"strSourcePath",
",",
"$",
"strCachePath",
"=",
"false",
",",
"$",
"bolStore",
"=",
"true",
")",
"{",
"$",
"strSourcePath",
"=",
"$",
"this",
"->",
"fileFormatDir",
"(",
"$",
"strSourcePath",
")",
";",
"$",
"strLan... | Initialized the language variable
@param string $strSourcePath The source path for all localization files (.yml)
@param string $strCachePath The caching path; if specified, cache files will be enabled
@param bool $bolStore Switch to store language in the current session
@return array The language variable array | [
"Initialized",
"the",
"language",
"variable"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L78-L122 |
204,736 | zeyon/rest | src/localizer.php | Localizer.get | public function get($strKey, $bolReturnPath=true) {
$data = $this->arrData;
foreach (explode('.', $strKey) as $p) {
if (isset($data[$p]))
$data = $data[$p];
else
return $bolReturnPath ? $this->returnKey($strKey) : false;
}
// if key was not resolved completely
if ( is_array($data) )
return $... | php | public function get($strKey, $bolReturnPath=true) {
$data = $this->arrData;
foreach (explode('.', $strKey) as $p) {
if (isset($data[$p]))
$data = $data[$p];
else
return $bolReturnPath ? $this->returnKey($strKey) : false;
}
// if key was not resolved completely
if ( is_array($data) )
return $... | [
"public",
"function",
"get",
"(",
"$",
"strKey",
",",
"$",
"bolReturnPath",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"arrData",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"strKey",
")",
"as",
"$",
"p",
")",
"{",
"if"... | Gets a variable value
@param string $strKey The path for the language variable (e.g. "messages.error.single")
@param bool $bolReturnPath If set the function will return the variable path, instead of FALSE
@return string If the path could not be resolved, the path will be returned instead | [
"Gets",
"a",
"variable",
"value"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L177-L192 |
204,737 | zeyon/rest | src/localizer.php | Localizer.getDateFormat | public function getDateFormat($strKey) {
$format = $this->get($strKey, false);
return $format ? preg_replace('/%([A-Za-z%])/', '$1', $format) : 'Y-m-d H:i';
} | php | public function getDateFormat($strKey) {
$format = $this->get($strKey, false);
return $format ? preg_replace('/%([A-Za-z%])/', '$1', $format) : 'Y-m-d H:i';
} | [
"public",
"function",
"getDateFormat",
"(",
"$",
"strKey",
")",
"{",
"$",
"format",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"strKey",
",",
"false",
")",
";",
"return",
"$",
"format",
"?",
"preg_replace",
"(",
"'/%([A-Za-z%])/'",
",",
"'$1'",
",",
"$",... | Returns a date string without "%" for PHP compatibiltiy
@param string $strKey The path for the language variable (e.g. "messages.error.single")
@return string The date format string | [
"Returns",
"a",
"date",
"string",
"without",
"%",
"for",
"PHP",
"compatibiltiy"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L210-L213 |
204,738 | zeyon/rest | src/localizer.php | Localizer.insert | public function insert($strKey, $arrReplace) {
$data = $this->arrData;
foreach (explode('.', $strKey) as $p) {
if (isset($data[$p]))
$data = $data[$p];
else
return $this->returnKey($strKey).'('.json_encode($arrReplace).')';
}
$arrSearch = array();
$arrValues = array();
foreach ($arrReplace as... | php | public function insert($strKey, $arrReplace) {
$data = $this->arrData;
foreach (explode('.', $strKey) as $p) {
if (isset($data[$p]))
$data = $data[$p];
else
return $this->returnKey($strKey).'('.json_encode($arrReplace).')';
}
$arrSearch = array();
$arrValues = array();
foreach ($arrReplace as... | [
"public",
"function",
"insert",
"(",
"$",
"strKey",
",",
"$",
"arrReplace",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"arrData",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"strKey",
")",
"as",
"$",
"p",
")",
"{",
"if",
"(",
"isset... | Gets a variable value and replaces placeholders contained in it
@param string $strKey The path for the language variable (e.g. "messages.error.single")
@param array $arrReplace Associative array containing the placeholder variables
@return string If the path could not be resolved, the path will be returned instead | [
"Gets",
"a",
"variable",
"value",
"and",
"replaces",
"placeholders",
"contained",
"in",
"it"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L222-L239 |
204,739 | zeyon/rest | src/localizer.php | Localizer.replace | public function replace($strTemplate) {
preg_match_all($this->regex, $strTemplate, $matches);
$arrReplace = array();
foreach ($matches[1] as $match) {
$arrReplace[] = $this->get($match);
}
return str_replace($matches[0], $arrReplace, $strTemplate);
} | php | public function replace($strTemplate) {
preg_match_all($this->regex, $strTemplate, $matches);
$arrReplace = array();
foreach ($matches[1] as $match) {
$arrReplace[] = $this->get($match);
}
return str_replace($matches[0], $arrReplace, $strTemplate);
} | [
"public",
"function",
"replace",
"(",
"$",
"strTemplate",
")",
"{",
"preg_match_all",
"(",
"$",
"this",
"->",
"regex",
",",
"$",
"strTemplate",
",",
"$",
"matches",
")",
";",
"$",
"arrReplace",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"matches... | Insert placeholders into a string
@param string $strTemplate
@return $strTemplate | [
"Insert",
"placeholders",
"into",
"a",
"string"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L247-L255 |
204,740 | zeyon/rest | src/localizer.php | Localizer.init | public function init($arrAccepted, $strDefault, $bolStore=true) {
$strLang = isset($_GET['lang']) ? $_GET['lang']
: (isset($_SESSION['lang']) ? $_SESSION['lang']
: (isset($_COOKIE['lang']) ? $_COOKIE['lang'] : false));
if (!$strLang || !in_array($strLang, $arrAccepted)) {
$browser = self::askBrowser($arr... | php | public function init($arrAccepted, $strDefault, $bolStore=true) {
$strLang = isset($_GET['lang']) ? $_GET['lang']
: (isset($_SESSION['lang']) ? $_SESSION['lang']
: (isset($_COOKIE['lang']) ? $_COOKIE['lang'] : false));
if (!$strLang || !in_array($strLang, $arrAccepted)) {
$browser = self::askBrowser($arr... | [
"public",
"function",
"init",
"(",
"$",
"arrAccepted",
",",
"$",
"strDefault",
",",
"$",
"bolStore",
"=",
"true",
")",
"{",
"$",
"strLang",
"=",
"isset",
"(",
"$",
"_GET",
"[",
"'lang'",
"]",
")",
"?",
"$",
"_GET",
"[",
"'lang'",
"]",
":",
"(",
"... | Initialized the language variable and stores it in the session
@param array $arrAccepted All accepted languages
@param string $strDefault Default language code
@param bool $bolStore Switch to store language in the current session | [
"Initialized",
"the",
"language",
"variable",
"and",
"stores",
"it",
"in",
"the",
"session"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L264-L278 |
204,741 | zeyon/rest | src/localizer.php | Localizer.askBrowser | public static function askBrowser($arrAccepted, $strDefault='de') {
$res = array('lang' => $strDefault, 'other' => array());
try {
$lang_variable = (
isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
? $_SERVER['HTTP_ACCEPT_LANGUAGE']
: null
);
if ( empty($lang_variable) )
return $res;
$accepted... | php | public static function askBrowser($arrAccepted, $strDefault='de') {
$res = array('lang' => $strDefault, 'other' => array());
try {
$lang_variable = (
isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
? $_SERVER['HTTP_ACCEPT_LANGUAGE']
: null
);
if ( empty($lang_variable) )
return $res;
$accepted... | [
"public",
"static",
"function",
"askBrowser",
"(",
"$",
"arrAccepted",
",",
"$",
"strDefault",
"=",
"'de'",
")",
"{",
"$",
"res",
"=",
"array",
"(",
"'lang'",
"=>",
"$",
"strDefault",
",",
"'other'",
"=>",
"array",
"(",
")",
")",
";",
"try",
"{",
"$"... | Returns the accepted browser language
@param array $arrAccepted
@param string $strDefault
@return array {'lang': PRIMARY LANGUAGE, 'other': ADDITIONAL LANGUAGES} | [
"Returns",
"the",
"accepted",
"browser",
"language"
] | da73bd5799c9c44a3b36f618d9cbe769f1541ff1 | https://github.com/zeyon/rest/blob/da73bd5799c9c44a3b36f618d9cbe769f1541ff1/src/localizer.php#L287-L338 |
204,742 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.getWebSrvUser | public function getWebSrvUser() {
$result = '';
if ($this->isOsWindows()) {
return $result;
}
$cmd = "ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1 2>/dev/null";
$output = [];
$exitCode = -1;
exec($cmd, $output, $exitCode);
if (($exitCode !== 0... | php | public function getWebSrvUser() {
$result = '';
if ($this->isOsWindows()) {
return $result;
}
$cmd = "ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1 2>/dev/null";
$output = [];
$exitCode = -1;
exec($cmd, $output, $exitCode);
if (($exitCode !== 0... | [
"public",
"function",
"getWebSrvUser",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isOsWindows",
"(",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"cmd",
"=",
"\"ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|... | Return WEB server user.
@return string Return user name of WEB server | [
"Return",
"WEB",
"server",
"user",
"."
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L102-L119 |
204,743 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.getWebSrvUserGroup | public function getWebSrvUserGroup($username = null) {
$result = '';
if ($this->isOsWindows() || empty($username)) {
return $result;
}
$cmd = 'groups ' . $username . ' | head -1 | cut -d\ -f1 2>/dev/null';
$output = [];
$exitCode = -1;
exec($cmd, $output, $exitCode);
if (($exitCode !== 0) || (count... | php | public function getWebSrvUserGroup($username = null) {
$result = '';
if ($this->isOsWindows() || empty($username)) {
return $result;
}
$cmd = 'groups ' . $username . ' | head -1 | cut -d\ -f1 2>/dev/null';
$output = [];
$exitCode = -1;
exec($cmd, $output, $exitCode);
if (($exitCode !== 0) || (count... | [
"public",
"function",
"getWebSrvUserGroup",
"(",
"$",
"username",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isOsWindows",
"(",
")",
"||",
"empty",
"(",
"$",
"username",
")",
")",
"{",
"return",
"$",
"result"... | Return group of user.
@param string $username Username for retrieving group.
@return string Return group of user | [
"Return",
"group",
"of",
"user",
"."
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L127-L144 |
204,744 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.isAppInstalled | public function isAppInstalled($configKey = null, $createMarkerFile = true) {
$pathMarkerFileIsInstalled = $this->getPathMarkerFileIsInstalled();
if ($this->_checkMarkerFile($pathMarkerFileIsInstalled)) {
return true;
}
$installTasks = $this->_modelConfigInstaller->getListInstallerTasks();
if (empty($inst... | php | public function isAppInstalled($configKey = null, $createMarkerFile = true) {
$pathMarkerFileIsInstalled = $this->getPathMarkerFileIsInstalled();
if ($this->_checkMarkerFile($pathMarkerFileIsInstalled)) {
return true;
}
$installTasks = $this->_modelConfigInstaller->getListInstallerTasks();
if (empty($inst... | [
"public",
"function",
"isAppInstalled",
"(",
"$",
"configKey",
"=",
"null",
",",
"$",
"createMarkerFile",
"=",
"true",
")",
"{",
"$",
"pathMarkerFileIsInstalled",
"=",
"$",
"this",
"->",
"getPathMarkerFileIsInstalled",
"(",
")",
";",
"if",
"(",
"$",
"this",
... | Check application is installed successfully
@param string $configKey The identifier to check configuration
for application.
@param bool $createMarkerFile If True, create marker file,
if application is installed successfully.
@return bool True, if application is installed successfully.
False otherwise. | [
"Check",
"application",
"is",
"installed",
"successfully"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L170-L214 |
204,745 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.isAppReadyToInstall | public function isAppReadyToInstall() {
$checkPHPversion = $this->checkPhpVersion();
if ($checkPHPversion === false) {
return false;
}
$checkPHPextensions = $this->checkPhpExtensions(true);
if ($checkPHPextensions === false) {
return false;
}
return true;
} | php | public function isAppReadyToInstall() {
$checkPHPversion = $this->checkPhpVersion();
if ($checkPHPversion === false) {
return false;
}
$checkPHPextensions = $this->checkPhpExtensions(true);
if ($checkPHPextensions === false) {
return false;
}
return true;
} | [
"public",
"function",
"isAppReadyToInstall",
"(",
")",
"{",
"$",
"checkPHPversion",
"=",
"$",
"this",
"->",
"checkPhpVersion",
"(",
")",
";",
"if",
"(",
"$",
"checkPHPversion",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"checkPHPextensions",... | Check application is ready to install
@return bool True, if application is ready to install.
False otherwise. | [
"Check",
"application",
"is",
"ready",
"to",
"install"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L222-L234 |
204,746 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.checkPhpVersion | public function checkPhpVersion() {
$phpVesion = $this->_modelConfigInstaller->getPhpVersionConfig();
if (empty($phpVesion)) {
return null;
}
$result = true;
foreach ($phpVesion as $phpVesionItem) {
if (!is_array($phpVesionItem)) {
continue;
}
$phpVesionItem += ['', null];
list($version, ... | php | public function checkPhpVersion() {
$phpVesion = $this->_modelConfigInstaller->getPhpVersionConfig();
if (empty($phpVesion)) {
return null;
}
$result = true;
foreach ($phpVesion as $phpVesionItem) {
if (!is_array($phpVesionItem)) {
continue;
}
$phpVesionItem += ['', null];
list($version, ... | [
"public",
"function",
"checkPhpVersion",
"(",
")",
"{",
"$",
"phpVesion",
"=",
"$",
"this",
"->",
"_modelConfigInstaller",
"->",
"getPhpVersionConfig",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"phpVesion",
")",
")",
"{",
"return",
"null",
";",
"}",
"... | Check version of PHP
@return null|bool Return Null, if checking is not configured.
True, if PHP version is compatible. False otherwise. | [
"Check",
"version",
"of",
"PHP"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L242-L270 |
204,747 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.getListDbConn | public function getListDbConn($path = null) {
if (empty($path)) {
$path = APP;
}
$configFile = $path . 'Config' . DS . 'database.php';
$connections = [];
if (file_exists($configFile)) {
$connections = array_keys(ConnectionManager::enumConnectionObjects());
}
return $connections;
} | php | public function getListDbConn($path = null) {
if (empty($path)) {
$path = APP;
}
$configFile = $path . 'Config' . DS . 'database.php';
$connections = [];
if (file_exists($configFile)) {
$connections = array_keys(ConnectionManager::enumConnectionObjects());
}
return $connections;
} | [
"public",
"function",
"getListDbConn",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"APP",
";",
"}",
"$",
"configFile",
"=",
"$",
"path",
".",
"'Config'",
".",
"DS",
".",
"'databa... | Return list of configured database connection.
@param string $path Path to database connection configuration file.
@return array List of configured database connection. | [
"Return",
"list",
"of",
"configured",
"database",
"connection",
"."
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L378-L390 |
204,748 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.checkConnectDb | public function checkConnectDb($path = null, $returnBool = false) {
$connections = $this->getListDbConn($path);
if (empty($connections)) {
return null;
}
$cfgConnections = $this->_modelConfigInstaller->getListDbConnConfigs();
if (empty($cfgConnections)) {
return null;
}
$connections = array_inters... | php | public function checkConnectDb($path = null, $returnBool = false) {
$connections = $this->getListDbConn($path);
if (empty($connections)) {
return null;
}
$cfgConnections = $this->_modelConfigInstaller->getListDbConnConfigs();
if (empty($cfgConnections)) {
return null;
}
$connections = array_inters... | [
"public",
"function",
"checkConnectDb",
"(",
"$",
"path",
"=",
"null",
",",
"$",
"returnBool",
"=",
"false",
")",
"{",
"$",
"connections",
"=",
"$",
"this",
"->",
"getListDbConn",
"(",
"$",
"path",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"connections",... | Check connections to database
@param string $path Path to database connection configuration file.
@param bool $returnBool If True, return boolean. Otherwise,
return array otherwise in format:
- key - database connection name;
- value - True, if connection success. Otherwise False or Array or
error messages.
@return nu... | [
"Check",
"connections",
"to",
"database"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L403-L446 |
204,749 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.checkSymLinksExists | public function checkSymLinksExists() {
$symlinksList = $this->_modelConfigInstaller->getListSymlinksCreation();
if (empty($symlinksList)) {
return true;
}
foreach ($symlinksList as $link => $target) {
if (empty($link)) {
continue;
}
if (!file_exists($link) || (!is_link($link) && (DS !== '\\')... | php | public function checkSymLinksExists() {
$symlinksList = $this->_modelConfigInstaller->getListSymlinksCreation();
if (empty($symlinksList)) {
return true;
}
foreach ($symlinksList as $link => $target) {
if (empty($link)) {
continue;
}
if (!file_exists($link) || (!is_link($link) && (DS !== '\\')... | [
"public",
"function",
"checkSymLinksExists",
"(",
")",
"{",
"$",
"symlinksList",
"=",
"$",
"this",
"->",
"_modelConfigInstaller",
"->",
"getListSymlinksCreation",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"symlinksList",
")",
")",
"{",
"return",
"true",
"... | Check symbolic links exists
@return bool Success | [
"Check",
"symbolic",
"links",
"exists"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L536-L557 |
204,750 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck.checkCronJobsExists | public function checkCronJobsExists() {
if ($this->isOsWindows()) {
return true;
}
$apacheUser = $this->getWebSrvUser();
if (empty($apacheUser)) {
return false;
}
$cronjobsList = $this->_modelConfigInstaller->getListCronJobsCreation();
if (empty($cronjobsList)) {
return true;
}
$output = [... | php | public function checkCronJobsExists() {
if ($this->isOsWindows()) {
return true;
}
$apacheUser = $this->getWebSrvUser();
if (empty($apacheUser)) {
return false;
}
$cronjobsList = $this->_modelConfigInstaller->getListCronJobsCreation();
if (empty($cronjobsList)) {
return true;
}
$output = [... | [
"public",
"function",
"checkCronJobsExists",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOsWindows",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"apacheUser",
"=",
"$",
"this",
"->",
"getWebSrvUser",
"(",
")",
";",
"if",
"(",
"empty",
"(... | Check cron jobs exists
@return bool Success | [
"Check",
"cron",
"jobs",
"exists"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L564-L602 |
204,751 | anklimsk/cakephp-console-installer | Model/InstallerCheck.php | InstallerCheck._removeMarkerFile | protected function _removeMarkerFile($path) {
if (empty($path)) {
return false;
}
$oFile = new File($path, false);
if (!$oFile->exists()) {
return false;
}
return $oFile->delete();
} | php | protected function _removeMarkerFile($path) {
if (empty($path)) {
return false;
}
$oFile = new File($path, false);
if (!$oFile->exists()) {
return false;
}
return $oFile->delete();
} | [
"protected",
"function",
"_removeMarkerFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"oFile",
"=",
"new",
"File",
"(",
"$",
"path",
",",
"false",
")",
";",
"if",
"(",
"!"... | Remove marker file
@param string $path Path to marker file.
@return bool True, if file removed successful. False otherwise. | [
"Remove",
"marker",
"file"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Model/InstallerCheck.php#L668-L679 |
204,752 | phpextra/event-manager-silex-provider | src/PHPExtra/EventManager/Silex/ProxyMapper.php | ProxyMapper.createProxyEvent | public function createProxyEvent(Event $event)
{
if ($event instanceof GetResponseForControllerResultEvent) {
$silexEvent = new PostDispatchEvent($event);
} elseif ($event instanceof GetResponseEvent) {
$silexEvent = new RequestEvent($event);
} elseif ($event instan... | php | public function createProxyEvent(Event $event)
{
if ($event instanceof GetResponseForControllerResultEvent) {
$silexEvent = new PostDispatchEvent($event);
} elseif ($event instanceof GetResponseEvent) {
$silexEvent = new RequestEvent($event);
} elseif ($event instan... | [
"public",
"function",
"createProxyEvent",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"instanceof",
"GetResponseForControllerResultEvent",
")",
"{",
"$",
"silexEvent",
"=",
"new",
"PostDispatchEvent",
"(",
"$",
"event",
")",
";",
"}",
"elsei... | Create proxy event for given Symfony dispatcher event
@param Event $event
@return EventInterface | [
"Create",
"proxy",
"event",
"for",
"given",
"Symfony",
"dispatcher",
"event"
] | 9952b237feffa5a469dd2976317736a570526249 | https://github.com/phpextra/event-manager-silex-provider/blob/9952b237feffa5a469dd2976317736a570526249/src/PHPExtra/EventManager/Silex/ProxyMapper.php#L37-L68 |
204,753 | comodojo/extender.framework | src/Comodojo/Extender/Utils/Checks.php | Checks.database | final public static function database(Configuration $configuration) {
try {
$dbh = Database::init($configuration);
$dbh->connect();
$manager = $dbh->getSchemaManager();
$manager->getTable($configuration->get('database-jobs-table'));
$manager->getT... | php | final public static function database(Configuration $configuration) {
try {
$dbh = Database::init($configuration);
$dbh->connect();
$manager = $dbh->getSchemaManager();
$manager->getTable($configuration->get('database-jobs-table'));
$manager->getT... | [
"final",
"public",
"static",
"function",
"database",
"(",
"Configuration",
"$",
"configuration",
")",
"{",
"try",
"{",
"$",
"dbh",
"=",
"Database",
"::",
"init",
"(",
"$",
"configuration",
")",
";",
"$",
"dbh",
"->",
"connect",
"(",
")",
";",
"$",
"man... | Check if database is available and initialized correctly
@return bool | [
"Check",
"if",
"database",
"is",
"available",
"and",
"initialized",
"correctly"
] | cc9a4fbd29fe0e80965ce4535091c956aad70b27 | https://github.com/comodojo/extender.framework/blob/cc9a4fbd29fe0e80965ce4535091c956aad70b27/src/Comodojo/Extender/Utils/Checks.php#L63-L89 |
204,754 | matryoshka-model/matryoshka | library/Object/Service/ObjectAbstractServiceFactory.php | ObjectAbstractServiceFactory.getActiveRecordCriteriaByName | protected function getActiveRecordCriteriaByName($serviceLocator, $name)
{
$criteria = $serviceLocator->get($name);
if (!$criteria instanceof AbstractCriteria) {
throw new Exception\ServiceNotCreatedException(sprintf(
'Instance of type %s is invalid; must implement %s',
... | php | protected function getActiveRecordCriteriaByName($serviceLocator, $name)
{
$criteria = $serviceLocator->get($name);
if (!$criteria instanceof AbstractCriteria) {
throw new Exception\ServiceNotCreatedException(sprintf(
'Instance of type %s is invalid; must implement %s',
... | [
"protected",
"function",
"getActiveRecordCriteriaByName",
"(",
"$",
"serviceLocator",
",",
"$",
"name",
")",
"{",
"$",
"criteria",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"criteria",
"instanceof",
"AbstractCr... | Retrieve PaginableCriteriaInterface object from config
@param ServiceLocatorInterface $serviceLocator
@param $name
@return AbstractCriteria
@throws Exception\ServiceNotCreatedException | [
"Retrieve",
"PaginableCriteriaInterface",
"object",
"from",
"config"
] | 51792df00d9897f556d5a3c53193eed0974ff09d | https://github.com/matryoshka-model/matryoshka/blob/51792df00d9897f556d5a3c53193eed0974ff09d/library/Object/Service/ObjectAbstractServiceFactory.php#L137-L148 |
204,755 | andyburton/Sonic-Framework | src/Controller/JSON/Session.php | Session.authFail | protected function authFail ($message = null)
{
$this->error ($message);
$this->view->response['auth_fail'] = TRUE;
return FALSE;
} | php | protected function authFail ($message = null)
{
$this->error ($message);
$this->view->response['auth_fail'] = TRUE;
return FALSE;
} | [
"protected",
"function",
"authFail",
"(",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"view",
"->",
"response",
"[",
"'auth_fail'",
"]",
"=",
"TRUE",
";",
"return",
"FALSE",
";"... | Set response for an authentication failure
@param string $message Error message
@return false | [
"Set",
"response",
"for",
"an",
"authentication",
"failure"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Controller/JSON/Session.php#L89-L94 |
204,756 | luismareze/geomanager | src/app/Http/Controllers/Admin/GeoCrudController.php | GeoCrudController.useTemplate | public function useTemplate($template_name = false)
{
$templates = $this->getTemplates();
// set the default template
if ($template_name == false) {
$template_name = $templates[0]->name;
}
// actually use the template
if ($template_name) {
... | php | public function useTemplate($template_name = false)
{
$templates = $this->getTemplates();
// set the default template
if ($template_name == false) {
$template_name = $templates[0]->name;
}
// actually use the template
if ($template_name) {
... | [
"public",
"function",
"useTemplate",
"(",
"$",
"template_name",
"=",
"false",
")",
"{",
"$",
"templates",
"=",
"$",
"this",
"->",
"getTemplates",
"(",
")",
";",
"// set the default template\r",
"if",
"(",
"$",
"template_name",
"==",
"false",
")",
"{",
"$",
... | Add the fields defined for a specific template.
@param string $template_name The name of the template that should be used in the current form. | [
"Add",
"the",
"fields",
"defined",
"for",
"a",
"specific",
"template",
"."
] | 9325c4f0e2917abc2ec3ce99379d2a7fe7368d32 | https://github.com/luismareze/geomanager/blob/9325c4f0e2917abc2ec3ce99379d2a7fe7368d32/src/app/Http/Controllers/Admin/GeoCrudController.php#L150-L163 |
204,757 | luismareze/geomanager | src/app/Http/Controllers/Admin/GeoCrudController.php | GeoCrudController.getTemplates | public function getTemplates()
{
$templates_array = [];
$templates_trait = new \ReflectionClass('App\GeoTemplates');
$templates = $templates_trait->getMethods();
if (! count($templates)) {
abort('403', 'No templates have been found.');
}
retu... | php | public function getTemplates()
{
$templates_array = [];
$templates_trait = new \ReflectionClass('App\GeoTemplates');
$templates = $templates_trait->getMethods();
if (! count($templates)) {
abort('403', 'No templates have been found.');
}
retu... | [
"public",
"function",
"getTemplates",
"(",
")",
"{",
"$",
"templates_array",
"=",
"[",
"]",
";",
"$",
"templates_trait",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"'App\\GeoTemplates'",
")",
";",
"$",
"templates",
"=",
"$",
"templates_trait",
"->",
"getMethods... | Get all defined templates. | [
"Get",
"all",
"defined",
"templates",
"."
] | 9325c4f0e2917abc2ec3ce99379d2a7fe7368d32 | https://github.com/luismareze/geomanager/blob/9325c4f0e2917abc2ec3ce99379d2a7fe7368d32/src/app/Http/Controllers/Admin/GeoCrudController.php#L168-L180 |
204,758 | luismareze/geomanager | src/app/Http/Controllers/Admin/GeoCrudController.php | GeoCrudController.getTemplatesArray | public function getTemplatesArray()
{
$templates = $this->getTemplates();
foreach ($templates as $template) {
$templates_array[$template->name] = $this->crud->makeLabel($template->name);
}
return $templates_array;
} | php | public function getTemplatesArray()
{
$templates = $this->getTemplates();
foreach ($templates as $template) {
$templates_array[$template->name] = $this->crud->makeLabel($template->name);
}
return $templates_array;
} | [
"public",
"function",
"getTemplatesArray",
"(",
")",
"{",
"$",
"templates",
"=",
"$",
"this",
"->",
"getTemplates",
"(",
")",
";",
"foreach",
"(",
"$",
"templates",
"as",
"$",
"template",
")",
"{",
"$",
"templates_array",
"[",
"$",
"template",
"->",
"nam... | Get all defined template as an array.
Used to populate the template dropdown in the create/update forms. | [
"Get",
"all",
"defined",
"template",
"as",
"an",
"array",
"."
] | 9325c4f0e2917abc2ec3ce99379d2a7fe7368d32 | https://github.com/luismareze/geomanager/blob/9325c4f0e2917abc2ec3ce99379d2a7fe7368d32/src/app/Http/Controllers/Admin/GeoCrudController.php#L187-L196 |
204,759 | as3io/modlr | src/Metadata/EmbeddedPropMetadata.php | EmbeddedPropMetadata.validateType | protected function validateType($embedType)
{
$valid = ['one', 'many'];
if (!in_array($embedType, $valid)) {
throw MetadataException::invalidRelType($embedType, $valid);
}
return true;
} | php | protected function validateType($embedType)
{
$valid = ['one', 'many'];
if (!in_array($embedType, $valid)) {
throw MetadataException::invalidRelType($embedType, $valid);
}
return true;
} | [
"protected",
"function",
"validateType",
"(",
"$",
"embedType",
")",
"{",
"$",
"valid",
"=",
"[",
"'one'",
",",
"'many'",
"]",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"embedType",
",",
"$",
"valid",
")",
")",
"{",
"throw",
"MetadataException",
"::",... | Validates the embed type.
@param string $embedType
@return bool
@throws MetadataException | [
"Validates",
"the",
"embed",
"type",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Metadata/EmbeddedPropMetadata.php#L85-L92 |
204,760 | activecollab/databaseconnection | src/Record/ValueCaster.php | ValueCaster.castRowValues | public function castRowValues(array &$row)
{
foreach ($row as $field_name => $value) {
$row[$field_name] = $this->castValue($field_name, $value);
}
} | php | public function castRowValues(array &$row)
{
foreach ($row as $field_name => $value) {
$row[$field_name] = $this->castValue($field_name, $value);
}
} | [
"public",
"function",
"castRowValues",
"(",
"array",
"&",
"$",
"row",
")",
"{",
"foreach",
"(",
"$",
"row",
"as",
"$",
"field_name",
"=>",
"$",
"value",
")",
"{",
"$",
"row",
"[",
"$",
"field_name",
"]",
"=",
"$",
"this",
"->",
"castValue",
"(",
"$... | Cast row value to native PHP types based on caster settings.
@param array $row | [
"Cast",
"row",
"value",
"to",
"native",
"PHP",
"types",
"based",
"on",
"caster",
"settings",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Record/ValueCaster.php#L43-L48 |
204,761 | activecollab/databaseconnection | src/Record/ValueCaster.php | ValueCaster.castValue | public function castValue($field_name, $value)
{
if ($value === null) {
return null; // NULL remains NULL
}
switch ($this->getTypeByFieldName($field_name)) {
case self::CAST_INT:
return (int) $value;
case self::CAST_FLOAT:
... | php | public function castValue($field_name, $value)
{
if ($value === null) {
return null; // NULL remains NULL
}
switch ($this->getTypeByFieldName($field_name)) {
case self::CAST_INT:
return (int) $value;
case self::CAST_FLOAT:
... | [
"public",
"function",
"castValue",
"(",
"$",
"field_name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"null",
";",
"// NULL remains NULL",
"}",
"switch",
"(",
"$",
"this",
"->",
"getTypeByFieldName",
"(",
"$"... | Cast a single value.
@param string $field_name
@param mixed $value
@return mixed | [
"Cast",
"a",
"single",
"value",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Record/ValueCaster.php#L58-L92 |
204,762 | activecollab/databaseconnection | src/Record/ValueCaster.php | ValueCaster.getTypeByFieldName | public function getTypeByFieldName($field_name)
{
if (isset($this->dictated[$field_name])) {
return $this->dictated[$field_name];
}
if (substr($field_name, 0, 3) === 'is_' || in_array(substr($field_name, 0, 4), ['has_', 'had_', 'was_']) || in_array(substr($field_name, 0, 5), ['w... | php | public function getTypeByFieldName($field_name)
{
if (isset($this->dictated[$field_name])) {
return $this->dictated[$field_name];
}
if (substr($field_name, 0, 3) === 'is_' || in_array(substr($field_name, 0, 4), ['has_', 'had_', 'was_']) || in_array(substr($field_name, 0, 5), ['w... | [
"public",
"function",
"getTypeByFieldName",
"(",
"$",
"field_name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"dictated",
"[",
"$",
"field_name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"dictated",
"[",
"$",
"field_name",
"]",
";",... | Return type by field name.
@param string $field_name
@return string | [
"Return",
"type",
"by",
"field",
"name",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Record/ValueCaster.php#L101-L126 |
204,763 | PhoxPHP/Glider | src/Query/Builder/QueryBinder.php | QueryBinder.createBinding | public function createBinding(String $key, $queryPart, $params=[], $expr='', $with='', $addValue=true)
{
if (!array_key_exists($key, $this->bindings)) {
return false;
}
if ($key == 'sql') {
return $queryPart;
}
if ($addValue == true) {
$this->bindings[$key] = $queryPart;
}
return $this->$key(... | php | public function createBinding(String $key, $queryPart, $params=[], $expr='', $with='', $addValue=true)
{
if (!array_key_exists($key, $this->bindings)) {
return false;
}
if ($key == 'sql') {
return $queryPart;
}
if ($addValue == true) {
$this->bindings[$key] = $queryPart;
}
return $this->$key(... | [
"public",
"function",
"createBinding",
"(",
"String",
"$",
"key",
",",
"$",
"queryPart",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"expr",
"=",
"''",
",",
"$",
"with",
"=",
"''",
",",
"$",
"addValue",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"... | This method bindings together queries created with
the query builder.
@param $key <String>
@param $queryPart <Mixed>
@param $params <Mixed>
@param $expr <Mixed>
@param $with <Mixed>
@access public
@return <Mixed> | [
"This",
"method",
"bindings",
"together",
"queries",
"created",
"with",
"the",
"query",
"builder",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Query/Builder/QueryBinder.php#L90-L105 |
204,764 | PhoxPHP/Glider | src/Query/Builder/QueryBinder.php | QueryBinder.alias | public function alias(String $column, String $alias)
{
// if (!$this->getBinding('select') || empty($this->getBinding('select'))) {
// Since this method cannot be used without the SELECT statement,
// we will throw an exception if `SELECT` binding is null or false.
// throw new RuntimeException(sprintf('Ca... | php | public function alias(String $column, String $alias)
{
// if (!$this->getBinding('select') || empty($this->getBinding('select'))) {
// Since this method cannot be used without the SELECT statement,
// we will throw an exception if `SELECT` binding is null or false.
// throw new RuntimeException(sprintf('Ca... | [
"public",
"function",
"alias",
"(",
"String",
"$",
"column",
",",
"String",
"$",
"alias",
")",
"{",
"// if (!$this->getBinding('select') || empty($this->getBinding('select'))) {",
"// Since this method cannot be used without the SELECT statement,",
"// we will throw an exception if `SE... | Create and return alias for a column.
@param $column <String>
@param $alias <String>
@access public
@return <String> | [
"Create",
"and",
"return",
"alias",
"for",
"a",
"column",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Query/Builder/QueryBinder.php#L125-L134 |
204,765 | infusephp/auth | src/Libs/UserRegistration.php | UserRegistration.getTemporaryUser | public function getTemporaryUser($email)
{
$email = trim(strtolower($email));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return false;
}
$userClass = $this->auth->getUserClass();
$user = $userClass::where('email', $email)->first();
if (!$user) {
... | php | public function getTemporaryUser($email)
{
$email = trim(strtolower($email));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return false;
}
$userClass = $this->auth->getUserClass();
$user = $userClass::where('email', $email)->first();
if (!$user) {
... | [
"public",
"function",
"getTemporaryUser",
"(",
"$",
"email",
")",
"{",
"$",
"email",
"=",
"trim",
"(",
"strtolower",
"(",
"$",
"email",
")",
")",
";",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"email",
",",
"FILTER_VALIDATE_EMAIL",
")",
")",
"{",
"return... | Gets a temporary user from an email address if one exists.
@param string $email email address
@return UserInterface|false | [
"Gets",
"a",
"temporary",
"user",
"from",
"an",
"email",
"address",
"if",
"one",
"exists",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/UserRegistration.php#L72-L91 |
204,766 | infusephp/auth | src/Libs/UserRegistration.php | UserRegistration.createTemporaryUser | public function createTemporaryUser($parameters)
{
$email = trim(strtolower(array_value($parameters, 'email')));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new AuthException('Invalid email address');
}
$insertArray = array_replace($parameters, ['enabled' => ... | php | public function createTemporaryUser($parameters)
{
$email = trim(strtolower(array_value($parameters, 'email')));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new AuthException('Invalid email address');
}
$insertArray = array_replace($parameters, ['enabled' => ... | [
"public",
"function",
"createTemporaryUser",
"(",
"$",
"parameters",
")",
"{",
"$",
"email",
"=",
"trim",
"(",
"strtolower",
"(",
"array_value",
"(",
"$",
"parameters",
",",
"'email'",
")",
")",
")",
";",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"email",
... | Creates a temporary user. Useful for creating invites.
@param array $parameters user data
@throws AuthException when the user cannot be created.
@return UserInterface temporary user | [
"Creates",
"a",
"temporary",
"user",
".",
"Useful",
"for",
"creating",
"invites",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/UserRegistration.php#L102-L137 |
204,767 | infusephp/auth | src/Libs/UserRegistration.php | UserRegistration.upgradeTemporaryUser | public function upgradeTemporaryUser(UserInterface $user, $values = [])
{
if (!$user->isTemporary()) {
throw new AuthException('Cannot upgrade a non-temporary account');
}
$values = array_replace($values, [
'created_at' => Utility::unixToDb(time()),
'enab... | php | public function upgradeTemporaryUser(UserInterface $user, $values = [])
{
if (!$user->isTemporary()) {
throw new AuthException('Cannot upgrade a non-temporary account');
}
$values = array_replace($values, [
'created_at' => Utility::unixToDb(time()),
'enab... | [
"public",
"function",
"upgradeTemporaryUser",
"(",
"UserInterface",
"$",
"user",
",",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"->",
"isTemporary",
"(",
")",
")",
"{",
"throw",
"new",
"AuthException",
"(",
"'Cannot upgrade a non... | Upgrades the user from temporary to a fully registered account.
@param UserInterface $user
@param array $values properties to set on user model
@throws AuthException when the upgrade fails.
@return $this | [
"Upgrades",
"the",
"user",
"from",
"temporary",
"to",
"a",
"fully",
"registered",
"account",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/UserRegistration.php#L149-L186 |
204,768 | atelierdisko/cute_php | src/Worker.php | Worker.dispatch | public function dispatch() {
while (true) {
if ($this->_break) {
break;
}
if ($this->_paused) {
$this->_title('Paused, waiting');
$this->_log->debug('Paused, waiting.');
}
while ($this->_paused) {
pcntl_signal_dispatch();
sleep($this->_interval);
}
$this->_title('Waiting for ... | php | public function dispatch() {
while (true) {
if ($this->_break) {
break;
}
if ($this->_paused) {
$this->_title('Paused, waiting');
$this->_log->debug('Paused, waiting.');
}
while ($this->_paused) {
pcntl_signal_dispatch();
sleep($this->_interval);
}
$this->_title('Waiting for ... | [
"public",
"function",
"dispatch",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_break",
")",
"{",
"break",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_paused",
")",
"{",
"$",
"this",
"->",
"_title",
"(",
"'Paused, w... | Main method to start processing loop and dispatch jobs.
@return boolean | [
"Main",
"method",
"to",
"start",
"processing",
"loop",
"and",
"dispatch",
"jobs",
"."
] | 0302ed6f819794ed57a6663361ae4527aa05e183 | https://github.com/atelierdisko/cute_php/blob/0302ed6f819794ed57a6663361ae4527aa05e183/src/Worker.php#L118-L155 |
204,769 | atelierdisko/cute_php | src/Worker.php | Worker._trapSignals | protected function _trapSignals() {
$this->_log->debug('Trapping signals.');
$handler = function($number) {
switch ($number) {
case SIGQUIT:
$this->_log->debug('Received SIGQUIT, waiting and exiting.');
$this->_break = true;
$this->_connection->disconnect();
exit(0);
case SIGINT:
... | php | protected function _trapSignals() {
$this->_log->debug('Trapping signals.');
$handler = function($number) {
switch ($number) {
case SIGQUIT:
$this->_log->debug('Received SIGQUIT, waiting and exiting.');
$this->_break = true;
$this->_connection->disconnect();
exit(0);
case SIGINT:
... | [
"protected",
"function",
"_trapSignals",
"(",
")",
"{",
"$",
"this",
"->",
"_log",
"->",
"debug",
"(",
"'Trapping signals.'",
")",
";",
"$",
"handler",
"=",
"function",
"(",
"$",
"number",
")",
"{",
"switch",
"(",
"$",
"number",
")",
"{",
"case",
"SIGQ... | Registers signal handlers and handles signals once received.
Controls the current processing loop by setting object properties
and using the process manager.
@return void | [
"Registers",
"signal",
"handlers",
"and",
"handles",
"signals",
"once",
"received",
".",
"Controls",
"the",
"current",
"processing",
"loop",
"by",
"setting",
"object",
"properties",
"and",
"using",
"the",
"process",
"manager",
"."
] | 0302ed6f819794ed57a6663361ae4527aa05e183 | https://github.com/atelierdisko/cute_php/blob/0302ed6f819794ed57a6663361ae4527aa05e183/src/Worker.php#L164-L199 |
204,770 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.getAttribute | public function getAttribute($attribute)
{
return !empty($this->attributes[$attribute]) ? $this->attributes[$attribute] : null;
} | php | public function getAttribute($attribute)
{
return !empty($this->attributes[$attribute]) ? $this->attributes[$attribute] : null;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"attribute",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
")",
"?",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
":",
"null",
";",
... | Get a specific attribute for this tag.
@param string @attribute
@return string|null | [
"Get",
"a",
"specific",
"attribute",
"for",
"this",
"tag",
"."
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L243-L246 |
204,771 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.appendContent | public function appendContent($content)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t contain content.'
);
}
$this->content .= $content;
return $this;
} | php | public function appendContent($content)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t contain content.'
);
}
$this->content .= $content;
return $this;
} | [
"public",
"function",
"appendContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVoid",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Void elements can\\'t contain content.'",
")",
";",
"}",
"$",
"this",
"->",
... | Append content before other content
@param string $content
@throws Exception\RuntimeException
@return \SxCore\Html\HtmlElement | [
"Append",
"content",
"before",
"other",
"content"
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L293-L304 |
204,772 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.prependContent | public function prependContent($content)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t contain content.'
);
}
$this->content = $content . $this->content;
return $this;
} | php | public function prependContent($content)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t contain content.'
);
}
$this->content = $content . $this->content;
return $this;
} | [
"public",
"function",
"prependContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVoid",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Void elements can\\'t contain content.'",
")",
";",
"}",
"$",
"this",
"->",
... | Prepend content before other content
@param string $content
@throws Exception\RuntimeException
@return \SxCore\Html\HtmlElement | [
"Prepend",
"content",
"before",
"other",
"content"
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L314-L325 |
204,773 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.addChild | public function addChild(self $child)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t have child elements.'
);
}
$this->children[] = $child;
return $this;
} | php | public function addChild(self $child)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t have child elements.'
);
}
$this->children[] = $child;
return $this;
} | [
"public",
"function",
"addChild",
"(",
"self",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVoid",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Void elements can\\'t have child elements.'",
")",
";",
"}",
"$",
"this",
"... | Add child to tag
@param \SxCore\Html\HtmlElement $child
@throws Exception\RuntimeException
@return \SxCore\Html\HtmlElement | [
"Add",
"child",
"to",
"tag"
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L376-L387 |
204,774 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.addChildren | public function addChildren(array $children)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t have child elements.'
);
}
foreach ($children as $child) {
$this->addChild($child);
}
return $... | php | public function addChildren(array $children)
{
if ($this->isVoid) {
throw new Exception\RuntimeException(
'Void elements can\'t have child elements.'
);
}
foreach ($children as $child) {
$this->addChild($child);
}
return $... | [
"public",
"function",
"addChildren",
"(",
"array",
"$",
"children",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVoid",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Void elements can\\'t have child elements.'",
")",
";",
"}",
"foreach",
... | Add children to tag
@param array $children
@throws Exception\RuntimeException
@return \SxCore\Html\HtmlElement | [
"Add",
"children",
"to",
"tag"
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L397-L410 |
204,775 | SpoonX/SxCore | library/SxCore/Html/HtmlElement.php | HtmlElement.renderAttributes | protected function renderAttributes()
{
$attributes = '';
foreach ($this->attributes as $key => $value) {
$attributes .= " $key" . (null !== $value ? "=\"$value\"" : '');
}
return $attributes;
} | php | protected function renderAttributes()
{
$attributes = '';
foreach ($this->attributes as $key => $value) {
$attributes .= " $key" . (null !== $value ? "=\"$value\"" : '');
}
return $attributes;
} | [
"protected",
"function",
"renderAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"attributes",
".=",
"\" $key\"",
".",
"(",
"null",
"!==... | Render tag attributes
@return string | [
"Render",
"tag",
"attributes"
] | 8f914e3737826c408443d6d458dd9a169c82c940 | https://github.com/SpoonX/SxCore/blob/8f914e3737826c408443d6d458dd9a169c82c940/library/SxCore/Html/HtmlElement.php#L515-L524 |
204,776 | ekyna/AdminBundle | Menu/MenuGroup.php | MenuGroup.addEntry | public function addEntry(MenuEntry $entry)
{
if ($this->prepared) {
throw new \RuntimeException('MenuGroup has been prepared and can\'t receive new entries.');
}
$this->entries[] = $entry;
return $this;
} | php | public function addEntry(MenuEntry $entry)
{
if ($this->prepared) {
throw new \RuntimeException('MenuGroup has been prepared and can\'t receive new entries.');
}
$this->entries[] = $entry;
return $this;
} | [
"public",
"function",
"addEntry",
"(",
"MenuEntry",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"prepared",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'MenuGroup has been prepared and can\\'t receive new entries.'",
")",
";",
"}",
"$",
"... | Adds an entry.
@param MenuEntry $entry
@throws \RuntimeException
@return MenuGroup | [
"Adds",
"an",
"entry",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Menu/MenuGroup.php#L236-L244 |
204,777 | ekyna/AdminBundle | Menu/MenuGroup.php | MenuGroup.prepare | public function prepare()
{
if ($this->prepared) {
return;
}
usort($this->entries, function(MenuEntry $a, MenuEntry $b) {
if ($a->getPosition() == $b->getPosition()) {
return 0;
}
return $a->getPosition() > $b->getPosition() ? 1... | php | public function prepare()
{
if ($this->prepared) {
return;
}
usort($this->entries, function(MenuEntry $a, MenuEntry $b) {
if ($a->getPosition() == $b->getPosition()) {
return 0;
}
return $a->getPosition() > $b->getPosition() ? 1... | [
"public",
"function",
"prepare",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"prepared",
")",
"{",
"return",
";",
"}",
"usort",
"(",
"$",
"this",
"->",
"entries",
",",
"function",
"(",
"MenuEntry",
"$",
"a",
",",
"MenuEntry",
"$",
"b",
")",
"{",
... | Prepares the group for rendering. | [
"Prepares",
"the",
"group",
"for",
"rendering",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Menu/MenuGroup.php#L259-L271 |
204,778 | armazon/armazon | src/Armazon/Sesion/Manejador.php | Manejador.generarId | private function generarId()
{
if (function_exists('random_bytes')) {
$semilla = random_bytes(32);
} elseif (function_exists('mcrypt_create_iv')) {
$semilla = mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
... | php | private function generarId()
{
if (function_exists('random_bytes')) {
$semilla = random_bytes(32);
} elseif (function_exists('mcrypt_create_iv')) {
$semilla = mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
... | [
"private",
"function",
"generarId",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'random_bytes'",
")",
")",
"{",
"$",
"semilla",
"=",
"random_bytes",
"(",
"32",
")",
";",
"}",
"elseif",
"(",
"function_exists",
"(",
"'mcrypt_create_iv'",
")",
")",
"{"... | Genera un identificador nuevo usando una semilla aleatoria
@return string | [
"Genera",
"un",
"identificador",
"nuevo",
"usando",
"una",
"semilla",
"aleatoria"
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Sesion/Manejador.php#L34-L47 |
204,779 | armazon/armazon | src/Armazon/Sesion/Manejador.php | Manejador.anunciar | public function anunciar($mensaje, $tipo = 'error')
{
$this->requerirInicio();
$this->datos['__anuncio']['mensaje'] = $mensaje;
$this->datos['__anuncio']['tipo'] = $tipo;
} | php | public function anunciar($mensaje, $tipo = 'error')
{
$this->requerirInicio();
$this->datos['__anuncio']['mensaje'] = $mensaje;
$this->datos['__anuncio']['tipo'] = $tipo;
} | [
"public",
"function",
"anunciar",
"(",
"$",
"mensaje",
",",
"$",
"tipo",
"=",
"'error'",
")",
"{",
"$",
"this",
"->",
"requerirInicio",
"(",
")",
";",
"$",
"this",
"->",
"datos",
"[",
"'__anuncio'",
"]",
"[",
"'mensaje'",
"]",
"=",
"$",
"mensaje",
";... | Define anuncio importante para el usuario.
@param string $mensaje
@param string $tipo | [
"Define",
"anuncio",
"importante",
"para",
"el",
"usuario",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Sesion/Manejador.php#L126-L132 |
204,780 | armazon/armazon | src/Armazon/Sesion/Manejador.php | Manejador.obtener | public function obtener($llave, $valorAlterno = null)
{
$this->requerirInicio();
return isset($this->datos[$llave]) ? $this->datos[$llave] : $valorAlterno;
} | php | public function obtener($llave, $valorAlterno = null)
{
$this->requerirInicio();
return isset($this->datos[$llave]) ? $this->datos[$llave] : $valorAlterno;
} | [
"public",
"function",
"obtener",
"(",
"$",
"llave",
",",
"$",
"valorAlterno",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"requerirInicio",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"datos",
"[",
"$",
"llave",
"]",
")",
"?",
"$",
"thi... | Obtiene una variable de la sesion.
@param string $llave
@param mixed $valorAlterno
@return mixed | [
"Obtiene",
"una",
"variable",
"de",
"la",
"sesion",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Sesion/Manejador.php#L167-L172 |
204,781 | armazon/armazon | src/Armazon/Sesion/Manejador.php | Manejador.eliminar | public function eliminar($llave)
{
$this->requerirInicio();
if (isset($this->datos[$llave])) {
$valor = $this->datos[$llave];
unset($this->datos[$llave]);
return $valor;
} else {
return null;
}
} | php | public function eliminar($llave)
{
$this->requerirInicio();
if (isset($this->datos[$llave])) {
$valor = $this->datos[$llave];
unset($this->datos[$llave]);
return $valor;
} else {
return null;
}
} | [
"public",
"function",
"eliminar",
"(",
"$",
"llave",
")",
"{",
"$",
"this",
"->",
"requerirInicio",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"datos",
"[",
"$",
"llave",
"]",
")",
")",
"{",
"$",
"valor",
"=",
"$",
"this",
"->",
... | Elimina una variable en la sesion.
@param string $llave
@return mixed el valor de la variable eliminada o nulo si no existe variable | [
"Elimina",
"una",
"variable",
"en",
"la",
"sesion",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Sesion/Manejador.php#L194-L205 |
204,782 | chilimatic/chilimatic-framework | lib/route/parser/UrlParser.php | UrlParser.parse | public function parse($content)
{
// if there is no path it's not needed to try to get a clean one
if (empty($content)) return [];
$path = $this->getCleanPath($content);
$pathParts = [$this->delimiter];
// check if there is even a need for further checks
if (mb_strpo... | php | public function parse($content)
{
// if there is no path it's not needed to try to get a clean one
if (empty($content)) return [];
$path = $this->getCleanPath($content);
$pathParts = [$this->delimiter];
// check if there is even a need for further checks
if (mb_strpo... | [
"public",
"function",
"parse",
"(",
"$",
"content",
")",
"{",
"// if there is no path it's not needed to try to get a clean one",
"if",
"(",
"empty",
"(",
"$",
"content",
")",
")",
"return",
"[",
"]",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getCleanPath",
"... | parse method that fills the collection
@param string $content
@return array | [
"parse",
"method",
"that",
"fills",
"the",
"collection"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/route/parser/UrlParser.php#L62-L98 |
204,783 | makinacorpus/drupal-umenu | src/ItemStorage.php | ItemStorage.getMenuIdFor | public function getMenuIdFor(int $itemId): int
{
// Find parent identifier
$menuId = (int)$this
->database
->query(
"SELECT menu_id FROM {umenu_item} WHERE id = ?",
[$itemId]
)
->fetchField()
;
if (!$men... | php | public function getMenuIdFor(int $itemId): int
{
// Find parent identifier
$menuId = (int)$this
->database
->query(
"SELECT menu_id FROM {umenu_item} WHERE id = ?",
[$itemId]
)
->fetchField()
;
if (!$men... | [
"public",
"function",
"getMenuIdFor",
"(",
"int",
"$",
"itemId",
")",
":",
"int",
"{",
"// Find parent identifier",
"$",
"menuId",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"database",
"->",
"query",
"(",
"\"SELECT menu_id FROM {umenu_item} WHERE id = ?\"",
",",
... | Get menu identifier for item
@param int $itemId
@return int | [
"Get",
"menu",
"identifier",
"for",
"item"
] | 346574eb0f5982857c64144e99ad2eacc8c52c5b | https://github.com/makinacorpus/drupal-umenu/blob/346574eb0f5982857c64144e99ad2eacc8c52c5b/src/ItemStorage.php#L115-L132 |
204,784 | ElMijo/php-html-dom | src/PHPHtmlDom/Core/PHPHtmlDomElement.php | PHPHtmlDomElement.get_attrs | private function get_attrs()
{
$this->attrs = new \stdClass;
foreach($this->dom_element->attributes as $name => $node)
{
$this->attrs->{strtolower($name)} = $node->nodeValue;
}
return $this;
} | php | private function get_attrs()
{
$this->attrs = new \stdClass;
foreach($this->dom_element->attributes as $name => $node)
{
$this->attrs->{strtolower($name)} = $node->nodeValue;
}
return $this;
} | [
"private",
"function",
"get_attrs",
"(",
")",
"{",
"$",
"this",
"->",
"attrs",
"=",
"new",
"\\",
"stdClass",
";",
"foreach",
"(",
"$",
"this",
"->",
"dom_element",
"->",
"attributes",
"as",
"$",
"name",
"=>",
"$",
"node",
")",
"{",
"$",
"this",
"->",... | Metodo que permite obtener todos atributos del elementos y convertirlos en un objeto stdClass.
@return self | [
"Metodo",
"que",
"permite",
"obtener",
"todos",
"atributos",
"del",
"elementos",
"y",
"convertirlos",
"en",
"un",
"objeto",
"stdClass",
"."
] | 6f294e26f37571e100b885e32b76245c144da6e2 | https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomElement.php#L64-L73 |
204,785 | ElMijo/php-html-dom | src/PHPHtmlDom/Core/PHPHtmlDomElement.php | PHPHtmlDomElement.get_childs | private function get_childs()
{
$this->childs = new \PHPTools\PHPHtmlDom\Core\PHPHtmlDomList($this->dom_element->childNodes);
return $this;
} | php | private function get_childs()
{
$this->childs = new \PHPTools\PHPHtmlDom\Core\PHPHtmlDomList($this->dom_element->childNodes);
return $this;
} | [
"private",
"function",
"get_childs",
"(",
")",
"{",
"$",
"this",
"->",
"childs",
"=",
"new",
"\\",
"PHPTools",
"\\",
"PHPHtmlDom",
"\\",
"Core",
"\\",
"PHPHtmlDomList",
"(",
"$",
"this",
"->",
"dom_element",
"->",
"childNodes",
")",
";",
"return",
"$",
"... | Metodo que permite obtener los elementos hijos y convertirlos en un objeto lista PHPHtmlDomList.
@return self | [
"Metodo",
"que",
"permite",
"obtener",
"los",
"elementos",
"hijos",
"y",
"convertirlos",
"en",
"un",
"objeto",
"lista",
"PHPHtmlDomList",
"."
] | 6f294e26f37571e100b885e32b76245c144da6e2 | https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomElement.php#L79-L84 |
204,786 | ElMijo/php-html-dom | src/PHPHtmlDom/Core/PHPHtmlDomElement.php | PHPHtmlDomElement.get_Text | private function get_Text()
{
$text_formatting = array('b','strong','em','i','small','strong','sub','sup','ins','del','mark','br','hr');
foreach ($this->dom_element->childNodes as $node)
{
if($node->nodeType == 3)
{
$this->set_text(trim($node->textCon... | php | private function get_Text()
{
$text_formatting = array('b','strong','em','i','small','strong','sub','sup','ins','del','mark','br','hr');
foreach ($this->dom_element->childNodes as $node)
{
if($node->nodeType == 3)
{
$this->set_text(trim($node->textCon... | [
"private",
"function",
"get_Text",
"(",
")",
"{",
"$",
"text_formatting",
"=",
"array",
"(",
"'b'",
",",
"'strong'",
",",
"'em'",
",",
"'i'",
",",
"'small'",
",",
"'strong'",
",",
"'sub'",
",",
"'sup'",
",",
"'ins'",
",",
"'del'",
",",
"'mark'",
",",
... | Metodo que permite obtener el texto que se encuentra dentro del elemento.
@return self | [
"Metodo",
"que",
"permite",
"obtener",
"el",
"texto",
"que",
"se",
"encuentra",
"dentro",
"del",
"elemento",
"."
] | 6f294e26f37571e100b885e32b76245c144da6e2 | https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomElement.php#L90-L119 |
204,787 | ElMijo/php-html-dom | src/PHPHtmlDom/Core/PHPHtmlDomElement.php | PHPHtmlDomElement.set_text | private function set_text($text)
{
if(!!$text)
{
if(!!$this->text)
{
if(!!is_array($this->text))
{
$this->text[] = $text;
}
else
{
$this->text = array($this... | php | private function set_text($text)
{
if(!!$text)
{
if(!!$this->text)
{
if(!!is_array($this->text))
{
$this->text[] = $text;
}
else
{
$this->text = array($this... | [
"private",
"function",
"set_text",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"!",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"!",
"$",
"this",
"->",
"text",
")",
"{",
"if",
"(",
"!",
"!",
"is_array",
"(",
"$",
"this",
"->",
"text",
")",
")",
... | Metodo que permite definir e texto del elemento.
@param string $text Cden de texto a definirse.
@return self | [
"Metodo",
"que",
"permite",
"definir",
"e",
"texto",
"del",
"elemento",
"."
] | 6f294e26f37571e100b885e32b76245c144da6e2 | https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomElement.php#L126-L148 |
204,788 | ElMijo/php-html-dom | src/PHPHtmlDom/Core/PHPHtmlDomElement.php | PHPHtmlDomElement.attrs_to_string | private function attrs_to_string($attrs)
{
$attrs_string ='';
foreach($attrs as $name => $node)
{
$attrs_string.= sprintf(' %s="%s"',$name,$node->nodeValue);
}
return $attrs_string;
} | php | private function attrs_to_string($attrs)
{
$attrs_string ='';
foreach($attrs as $name => $node)
{
$attrs_string.= sprintf(' %s="%s"',$name,$node->nodeValue);
}
return $attrs_string;
} | [
"private",
"function",
"attrs_to_string",
"(",
"$",
"attrs",
")",
"{",
"$",
"attrs_string",
"=",
"''",
";",
"foreach",
"(",
"$",
"attrs",
"as",
"$",
"name",
"=>",
"$",
"node",
")",
"{",
"$",
"attrs_string",
".=",
"sprintf",
"(",
"' %s=\"%s\"'",
",",
"$... | Este metodo permite concatenar un objeto de atributos en una sola cadena.
@param attay $attrs Arreglo de atributos.
@return string | [
"Este",
"metodo",
"permite",
"concatenar",
"un",
"objeto",
"de",
"atributos",
"en",
"una",
"sola",
"cadena",
"."
] | 6f294e26f37571e100b885e32b76245c144da6e2 | https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomElement.php#L155-L165 |
204,789 | courtney-miles/schnoop-schema | src/MySQL/Routine/RoutineFunction.php | RoutineFunction.makeParametersDDL | protected function makeParametersDDL($separator = " ")
{
$params = [];
foreach ($this->parameters as $parameter) {
$params[] = $parameter->getDDL();
}
return implode(',' . $separator, $params);
} | php | protected function makeParametersDDL($separator = " ")
{
$params = [];
foreach ($this->parameters as $parameter) {
$params[] = $parameter->getDDL();
}
return implode(',' . $separator, $params);
} | [
"protected",
"function",
"makeParametersDDL",
"(",
"$",
"separator",
"=",
"\" \"",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"parameter",
")",
"{",
"$",
"params",
"[",
"]",
"=",
"$",
"par... | Make the portion of DDL for describing the parameters.
@param string $separator String to apply between parameters.
@return string Parameters DDL. | [
"Make",
"the",
"portion",
"of",
"DDL",
"for",
"describing",
"the",
"parameters",
"."
] | f96e9922257860171ecdcdbb6b78182276e2f60d | https://github.com/courtney-miles/schnoop-schema/blob/f96e9922257860171ecdcdbb6b78182276e2f60d/src/MySQL/Routine/RoutineFunction.php#L161-L170 |
204,790 | yii2lab/yii2-rbac | src/domain/repositories/disc/AssignmentRepository.php | AssignmentRepository.saveAssignments | protected function saveAssignments()
{
$assignmentData = [];
foreach ($this->assignments as $userId => $assignments) {
foreach ($assignments as $name => $assignment) {
/* @var $assignment Assignment */
$assignmentData[$userId][] = $assignment->roleName;
}
}
DiscHelper::saveToFile($assignmentData,... | php | protected function saveAssignments()
{
$assignmentData = [];
foreach ($this->assignments as $userId => $assignments) {
foreach ($assignments as $name => $assignment) {
/* @var $assignment Assignment */
$assignmentData[$userId][] = $assignment->roleName;
}
}
DiscHelper::saveToFile($assignmentData,... | [
"protected",
"function",
"saveAssignments",
"(",
")",
"{",
"$",
"assignmentData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"assignments",
"as",
"$",
"userId",
"=>",
"$",
"assignments",
")",
"{",
"foreach",
"(",
"$",
"assignments",
"as",
"$"... | Saves assignments data into persistent storage. | [
"Saves",
"assignments",
"data",
"into",
"persistent",
"storage",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/disc/AssignmentRepository.php#L197-L209 |
204,791 | yii2lab/yii2-rbac | src/domain/repositories/disc/AssignmentRepository.php | AssignmentRepository.load | protected function load()
{
$this->assignments = [];
$assignments = DiscHelper::loadFromFile($this->assignmentFile);
$assignmentsMtime = @filemtime($this->assignmentFile);
foreach ($assignments as $userId => $roles) {
foreach ($roles as $role) {
$this->assignments[$userId][$role] = new Assignment([
... | php | protected function load()
{
$this->assignments = [];
$assignments = DiscHelper::loadFromFile($this->assignmentFile);
$assignmentsMtime = @filemtime($this->assignmentFile);
foreach ($assignments as $userId => $roles) {
foreach ($roles as $role) {
$this->assignments[$userId][$role] = new Assignment([
... | [
"protected",
"function",
"load",
"(",
")",
"{",
"$",
"this",
"->",
"assignments",
"=",
"[",
"]",
";",
"$",
"assignments",
"=",
"DiscHelper",
"::",
"loadFromFile",
"(",
"$",
"this",
"->",
"assignmentFile",
")",
";",
"$",
"assignmentsMtime",
"=",
"@",
"fil... | Loads authorization data from persistent storage. | [
"Loads",
"authorization",
"data",
"from",
"persistent",
"storage",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/disc/AssignmentRepository.php#L222-L237 |
204,792 | tigron/skeleton-migrate | console/create.php | Migrate_Create.create_package_migration | private function create_package_migration($name) {
list($packagename, $name) = explode('/', $name);
$skeleton_packages = \Skeleton\Core\Skeleton::get_all();
$package = null;
foreach ($skeleton_packages as $skeleton_package) {
if ($skeleton_package->name == $packagename) {
$package = $skeleton_package;
... | php | private function create_package_migration($name) {
list($packagename, $name) = explode('/', $name);
$skeleton_packages = \Skeleton\Core\Skeleton::get_all();
$package = null;
foreach ($skeleton_packages as $skeleton_package) {
if ($skeleton_package->name == $packagename) {
$package = $skeleton_package;
... | [
"private",
"function",
"create_package_migration",
"(",
"$",
"name",
")",
"{",
"list",
"(",
"$",
"packagename",
",",
"$",
"name",
")",
"=",
"explode",
"(",
"'/'",
",",
"$",
"name",
")",
";",
"$",
"skeleton_packages",
"=",
"\\",
"Skeleton",
"\\",
"Core",
... | Create package migration
@access private
@param string $name
@return string $path | [
"Create",
"package",
"migration"
] | 53b6ea56e928d4f925257949e59467d2d9cbafd4 | https://github.com/tigron/skeleton-migrate/blob/53b6ea56e928d4f925257949e59467d2d9cbafd4/console/create.php#L64-L100 |
204,793 | tigron/skeleton-migrate | console/create.php | Migrate_Create.create_project_migration | private function create_project_migration($name) {
$name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $name);
$datetime = date('Ymd_His');
$filename = $datetime . '_' . strtolower($name) . '.php';
$classname = 'Migration_' . $datetime . '_' . ucfirst($name);
$template = fi... | php | private function create_project_migration($name) {
$name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $name);
$datetime = date('Ymd_His');
$filename = $datetime . '_' . strtolower($name) . '.php';
$classname = 'Migration_' . $datetime . '_' . ucfirst($name);
$template = fi... | [
"private",
"function",
"create_project_migration",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"preg_replace",
"(",
"array",
"(",
"'/\\s/'",
",",
"'/\\.[\\.]+/'",
",",
"'/[^\\w_\\.\\-]/'",
")",
",",
"array",
"(",
"'_'",
",",
"'.'",
",",
"''",
")",
",",
... | Create project migration
@access private
@param string $name
@return string $path | [
"Create",
"project",
"migration"
] | 53b6ea56e928d4f925257949e59467d2d9cbafd4 | https://github.com/tigron/skeleton-migrate/blob/53b6ea56e928d4f925257949e59467d2d9cbafd4/console/create.php#L109-L121 |
204,794 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.table | public static function table($table)
{
//as all calls will start with this function, first check if database connection has being established
if(Connect::getConn()==null){
//lets just return the object of the class in-case of connection error (developer will handle the rest)
... | php | public static function table($table)
{
//as all calls will start with this function, first check if database connection has being established
if(Connect::getConn()==null){
//lets just return the object of the class in-case of connection error (developer will handle the rest)
... | [
"public",
"static",
"function",
"table",
"(",
"$",
"table",
")",
"{",
"//as all calls will start with this function, first check if database connection has being established",
"if",
"(",
"Connect",
"::",
"getConn",
"(",
")",
"==",
"null",
")",
"{",
"//lets just return the o... | Sets the table on to which the various statements are executed.
@param $table
@return string | $this | [
"Sets",
"the",
"table",
"on",
"to",
"which",
"the",
"various",
"statements",
"are",
"executed",
"."
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L34-L44 |
204,795 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.sanitize | private static function sanitize($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
} | php | private static function sanitize($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
} | [
"private",
"static",
"function",
"sanitize",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"trim",
"(",
"$",
"data",
")",
";",
"$",
"data",
"=",
"stripslashes",
"(",
"$",
"data",
")",
";",
"$",
"data",
"=",
"htmlspecialchars",
"(",
"$",
"data",
")"... | Sanitizes the data input values
@param $data
@return string | [
"Sanitizes",
"the",
"data",
"input",
"values"
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L51-L57 |
204,796 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.orWhere | public function orWhere($param){
if (func_num_args() == 3) {
$operator =strtolower(func_get_arg(1));
if (is_numeric(array_search($operator, $this->condition))) {
$this->whereby .=' or '.self::sanitize(func_get_arg(0))
.' '. $operator . ' \''
... | php | public function orWhere($param){
if (func_num_args() == 3) {
$operator =strtolower(func_get_arg(1));
if (is_numeric(array_search($operator, $this->condition))) {
$this->whereby .=' or '.self::sanitize(func_get_arg(0))
.' '. $operator . ' \''
... | [
"public",
"function",
"orWhere",
"(",
"$",
"param",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"3",
")",
"{",
"$",
"operator",
"=",
"strtolower",
"(",
"func_get_arg",
"(",
"1",
")",
")",
";",
"if",
"(",
"is_numeric",
"(",
"array_search",
"... | Adds condition for or in where clause
@see where
@param $param
@return $this | [
"Adds",
"condition",
"for",
"or",
"in",
"where",
"clause"
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L172-L195 |
204,797 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.orderBy | public function orderBy($column = '', $sort = 'desc')
{
$column=self::sanitize($column);
$sort=strtoupper(self::sanitize($sort));
/*check if the sort method passed is valid */
if (!(hash_equals('DESC',$sort) || hash_equals('ASC',$sort))){
static::$response["status"] = "e... | php | public function orderBy($column = '', $sort = 'desc')
{
$column=self::sanitize($column);
$sort=strtoupper(self::sanitize($sort));
/*check if the sort method passed is valid */
if (!(hash_equals('DESC',$sort) || hash_equals('ASC',$sort))){
static::$response["status"] = "e... | [
"public",
"function",
"orderBy",
"(",
"$",
"column",
"=",
"''",
",",
"$",
"sort",
"=",
"'desc'",
")",
"{",
"$",
"column",
"=",
"self",
"::",
"sanitize",
"(",
"$",
"column",
")",
";",
"$",
"sort",
"=",
"strtoupper",
"(",
"self",
"::",
"sanitize",
"(... | Set order in which the return results will be return
@param string $column :column to base the order on
@param string $sort :asc or desc
@return $this|mixed | [
"Set",
"order",
"in",
"which",
"the",
"return",
"results",
"will",
"be",
"return"
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L203-L222 |
204,798 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.get | public function get($limit = 0, $offset = 0)
{
//check if there is an error
if (static::$response['status'] == "error") {
return static::terminate(static::$response);
}
//check if the limit is a number
if (!is_numeric($limit)) {
static::$response["sta... | php | public function get($limit = 0, $offset = 0)
{
//check if there is an error
if (static::$response['status'] == "error") {
return static::terminate(static::$response);
}
//check if the limit is a number
if (!is_numeric($limit)) {
static::$response["sta... | [
"public",
"function",
"get",
"(",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"//check if there is an error",
"if",
"(",
"static",
"::",
"$",
"response",
"[",
"'status'",
"]",
"==",
"\"error\"",
")",
"{",
"return",
"static",
"::",
"... | Fetch records form database
@param int $limit :optional limit of records to be retrieved
@param int $offset :the index which the record should be retrieved from
@return array|string | [
"Fetch",
"records",
"form",
"database"
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L245-L302 |
204,799 | mimidotsuser/sqlQueryuilder | src/Builder.php | Builder.fetch | protected function fetch($sql)
{
try {
try {
$stm = Connect::getConn()->prepare($sql);
} catch (Exception $e) {
static::$response["status"] = "error";
static::$response["response"] = $e->getMessage();
static::$response['... | php | protected function fetch($sql)
{
try {
try {
$stm = Connect::getConn()->prepare($sql);
} catch (Exception $e) {
static::$response["status"] = "error";
static::$response["response"] = $e->getMessage();
static::$response['... | [
"protected",
"function",
"fetch",
"(",
"$",
"sql",
")",
"{",
"try",
"{",
"try",
"{",
"$",
"stm",
"=",
"Connect",
"::",
"getConn",
"(",
")",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"static",
... | Executes a query that returns data
@param $sql
@return array|string | [
"Executes",
"a",
"query",
"that",
"returns",
"data"
] | a9339b6dea5be52b79095b9c001684c162a09bf6 | https://github.com/mimidotsuser/sqlQueryuilder/blob/a9339b6dea5be52b79095b9c001684c162a09bf6/src/Builder.php#L310-L365 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.