repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade.inner | public function inner($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->inner($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | public function inner($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->inner($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | [
"public",
"function",
"inner",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"preparedTablesArray",
"=",
"$",
"this",
"->",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"$",
"optionalTables",
")",
";"... | Join the expected table with an inner join.
In the second argument can pass optional tables for the join operation.
@param string $table Name of the table for the join.
@param array $optionalTables (Optional) Array with table names as elements
@return $this The same instance to concatenate methods. | [
"Join",
"the",
"expected",
"table",
"with",
"an",
"inner",
"join",
".",
"In",
"the",
"second",
"argument",
"can",
"pass",
"optional",
"tables",
"for",
"the",
"join",
"operation",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L77-L83 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade.left | public function left($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->left($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | public function left($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->left($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | [
"public",
"function",
"left",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"preparedTablesArray",
"=",
"$",
"this",
"->",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"$",
"optionalTables",
")",
";",... | Join the expected table with a left join.
In the second argument can pass optional tables for the join operation.
@param string $table Name of the table for the join.
@param array $optionalTables (Optional) Array with table names as elements
@return $this The same instance to concatenate methods. | [
"Join",
"the",
"expected",
"table",
"with",
"a",
"left",
"join",
".",
"In",
"the",
"second",
"argument",
"can",
"pass",
"optional",
"tables",
"for",
"the",
"join",
"operation",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L95-L101 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade.right | public function right($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->right($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | public function right($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->right($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | [
"public",
"function",
"right",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"preparedTablesArray",
"=",
"$",
"this",
"->",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"$",
"optionalTables",
")",
";"... | Join the expected table with a right join.
In the second argument can pass optional tables for the join operation.
@param string $table Name of the table for the join.
@param array $optionalTables (Optional) Array with table names as elements
@return $this The same instance to concatenate methods. | [
"Join",
"the",
"expected",
"table",
"with",
"a",
"right",
"join",
".",
"In",
"the",
"second",
"argument",
"can",
"pass",
"optional",
"tables",
"for",
"the",
"join",
"operation",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L113-L119 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade.leftOuter | public function leftOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->leftOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | public function leftOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->leftOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | [
"public",
"function",
"leftOuter",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"preparedTablesArray",
"=",
"$",
"this",
"->",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"$",
"optionalTables",
")",
... | Join the expected table with a left outer join.
In the second argument can pass optional tables for the join operation.
@param string $table Name of the table for the join.
@param array $optionalTables (Optional) Array with table names as elements
@return $this The same instance to concatenate methods. | [
"Join",
"the",
"expected",
"table",
"with",
"a",
"left",
"outer",
"join",
".",
"In",
"the",
"second",
"argument",
"can",
"pass",
"optional",
"tables",
"for",
"the",
"join",
"operation",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L131-L137 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade.rightOuter | public function rightOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->rightOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | public function rightOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->rightOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | [
"public",
"function",
"rightOuter",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
"=",
"array",
"(",
")",
")",
"{",
"$",
"preparedTablesArray",
"=",
"$",
"this",
"->",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"$",
"optionalTables",
")",
... | Join the expected table with a right outer join.
In the second argument can pass optional tables for the join operation.
@param string $table Name of the table for the join.
@param array $optionalTables (Optional) Array with table names as elements
@return $this The same instance to concatenate methods. | [
"Join",
"the",
"expected",
"table",
"with",
"a",
"right",
"outer",
"join",
".",
"In",
"the",
"second",
"argument",
"can",
"pass",
"optional",
"tables",
"for",
"the",
"join",
"operation",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L149-L155 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade._getPreparedTableObjects | private function _getPreparedTableObjects($table, array $optionalTables)
{
$tableObj = $this->factory->references('Table', $table);
$optionalTablesObj = array();
foreach($optionalTables as $tbl)
{
$optionalTablesObj[] = $this->factory->references('Table', $tbl);
}
return array('table' => $tableObj, 'optionalTables' => $optionalTablesObj);
} | php | private function _getPreparedTableObjects($table, array $optionalTables)
{
$tableObj = $this->factory->references('Table', $table);
$optionalTablesObj = array();
foreach($optionalTables as $tbl)
{
$optionalTablesObj[] = $this->factory->references('Table', $tbl);
}
return array('table' => $tableObj, 'optionalTables' => $optionalTablesObj);
} | [
"private",
"function",
"_getPreparedTableObjects",
"(",
"$",
"table",
",",
"array",
"$",
"optionalTables",
")",
"{",
"$",
"tableObj",
"=",
"$",
"this",
"->",
"factory",
"->",
"references",
"(",
"'Table'",
",",
"$",
"table",
")",
";",
"$",
"optionalTablesObj"... | Create table objects from the passed arguments.
An array will return with the key 'table' for the main table and 'optionalTables' for optional tables.
When no optional tables are passed, the key 'optionalTables' return an empty array.
@param string $table Name of the main table.
@param array $optionalTables Optional table names, hold in an array.
@return array Array with prepared table objects, format: ['table' => $tbl, 'optionalTables' => array]. | [
"Create",
"table",
"objects",
"from",
"the",
"passed",
"arguments",
".",
"An",
"array",
"will",
"return",
"with",
"the",
"key",
"table",
"for",
"the",
"main",
"table",
"and",
"optionalTables",
"for",
"optional",
"tables",
".",
"When",
"no",
"optional",
"tabl... | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L237-L247 | train |
AlcyZ/Alcys-ORM | src/Core/Db/Facade/JoinFacade.php | JoinFacade._checkOnArguments | private function _checkOnArguments(array $firstColumn, array $secondColumn)
{
if(!array_key_exists('column', $firstColumn) || !array_key_exists('table', $firstColumn) ||
!array_key_exists('column', $secondColumn) || !array_key_exists('table', $secondColumn)
)
{
throw new \InvalidArgumentException('Both arguments of on method require "column" and "table" as key');
}
} | php | private function _checkOnArguments(array $firstColumn, array $secondColumn)
{
if(!array_key_exists('column', $firstColumn) || !array_key_exists('table', $firstColumn) ||
!array_key_exists('column', $secondColumn) || !array_key_exists('table', $secondColumn)
)
{
throw new \InvalidArgumentException('Both arguments of on method require "column" and "table" as key');
}
} | [
"private",
"function",
"_checkOnArguments",
"(",
"array",
"$",
"firstColumn",
",",
"array",
"$",
"secondColumn",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'column'",
",",
"$",
"firstColumn",
")",
"||",
"!",
"array_key_exists",
"(",
"'table'",
",",
... | Check the passed arguments of the on method. If they don't have keys equivalent to column and table,
an invalid argument exception will thrown.
@param array $firstColumn First argument of on method.
@param array $secondColumn Second argument of on method. | [
"Check",
"the",
"passed",
"arguments",
"of",
"the",
"on",
"method",
".",
"If",
"they",
"don",
"t",
"have",
"keys",
"equivalent",
"to",
"column",
"and",
"table",
"an",
"invalid",
"argument",
"exception",
"will",
"thrown",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/Facade/JoinFacade.php#L257-L265 | train |
weew/kernel | src/Weew/Kernel/Kernel.php | Kernel.createEach | protected function createEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_get($data, 'instance')) {
$instance = $this->getProviderInvoker()
->create($class, $this->getSharedArguments());
array_set($data, 'instance', $instance);
$this->create();
break;
}
}
} | php | protected function createEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_get($data, 'instance')) {
$instance = $this->getProviderInvoker()
->create($class, $this->getSharedArguments());
array_set($data, 'instance', $instance);
$this->create();
break;
}
}
} | [
"protected",
"function",
"createEach",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"class",
"=>",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_get",
"(",
"$",
"data",
",",
"'instance'",
")",
")",
"{",
"$",
"insta... | Instantiate all providers. | [
"Instantiate",
"all",
"providers",
"."
] | 4dada4aa36ed1f5bebad2a2864941c68fa568a58 | https://github.com/weew/kernel/blob/4dada4aa36ed1f5bebad2a2864941c68fa568a58/src/Weew/Kernel/Kernel.php#L49-L60 | train |
weew/kernel | src/Weew/Kernel/Kernel.php | Kernel.configureEach | protected function configureEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::CONFIGURED)) {
$this->create();
array_add($data, 'tags', ProviderTag::CONFIGURED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'configure')) {
$this->getProviderInvoker()
->configure($instance, $this->getSharedArguments());
}
$this->configureEach();
break;
}
}
} | php | protected function configureEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::CONFIGURED)) {
$this->create();
array_add($data, 'tags', ProviderTag::CONFIGURED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'configure')) {
$this->getProviderInvoker()
->configure($instance, $this->getSharedArguments());
}
$this->configureEach();
break;
}
}
} | [
"protected",
"function",
"configureEach",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"class",
"=>",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_contains",
"(",
"array_get",
"(",
"$",
"data",
",",
"'tags'",
")",
"... | Configure all providers.
@return void | [
"Configure",
"all",
"providers",
"."
] | 4dada4aa36ed1f5bebad2a2864941c68fa568a58 | https://github.com/weew/kernel/blob/4dada4aa36ed1f5bebad2a2864941c68fa568a58/src/Weew/Kernel/Kernel.php#L76-L93 | train |
weew/kernel | src/Weew/Kernel/Kernel.php | Kernel.initializeEach | protected function initializeEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::INITIALIZED)) {
$this->configure();
array_add($data, 'tags', ProviderTag::INITIALIZED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'initialize')) {
$this->getProviderInvoker()
->initialize($instance, $this->getSharedArguments());
}
$this->initializeEach();
break;
}
}
} | php | protected function initializeEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::INITIALIZED)) {
$this->configure();
array_add($data, 'tags', ProviderTag::INITIALIZED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'initialize')) {
$this->getProviderInvoker()
->initialize($instance, $this->getSharedArguments());
}
$this->initializeEach();
break;
}
}
} | [
"protected",
"function",
"initializeEach",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"class",
"=>",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_contains",
"(",
"array_get",
"(",
"$",
"data",
",",
"'tags'",
")",
... | Initialize all providers.
@return void | [
"Initialize",
"all",
"providers",
"."
] | 4dada4aa36ed1f5bebad2a2864941c68fa568a58 | https://github.com/weew/kernel/blob/4dada4aa36ed1f5bebad2a2864941c68fa568a58/src/Weew/Kernel/Kernel.php#L109-L126 | train |
weew/kernel | src/Weew/Kernel/Kernel.php | Kernel.bootEach | protected function bootEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::BOOTED)) {
$this->initialize();
array_add($data, 'tags', ProviderTag::BOOTED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'boot')) {
$this->getProviderInvoker()
->boot($instance, $this->getSharedArguments());
}
$this->bootEach();
break;
}
}
} | php | protected function bootEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::BOOTED)) {
$this->initialize();
array_add($data, 'tags', ProviderTag::BOOTED);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'boot')) {
$this->getProviderInvoker()
->boot($instance, $this->getSharedArguments());
}
$this->bootEach();
break;
}
}
} | [
"protected",
"function",
"bootEach",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"class",
"=>",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_contains",
"(",
"array_get",
"(",
"$",
"data",
",",
"'tags'",
")",
",",
... | Boot all providers.
@return void | [
"Boot",
"all",
"providers",
"."
] | 4dada4aa36ed1f5bebad2a2864941c68fa568a58 | https://github.com/weew/kernel/blob/4dada4aa36ed1f5bebad2a2864941c68fa568a58/src/Weew/Kernel/Kernel.php#L142-L159 | train |
weew/kernel | src/Weew/Kernel/Kernel.php | Kernel.shutdownEach | protected function shutdownEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::SHUTDOWN)) {
$this->boot();
array_add($data, 'tags', ProviderTag::SHUTDOWN);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'shutdown')) {
$this->getProviderInvoker()
->boot($instance, $this->getSharedArguments());
}
$this->shutdownEach();
break;
}
}
} | php | protected function shutdownEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::SHUTDOWN)) {
$this->boot();
array_add($data, 'tags', ProviderTag::SHUTDOWN);
$instance = array_get($data, 'instance');
if (method_exists($instance, 'shutdown')) {
$this->getProviderInvoker()
->boot($instance, $this->getSharedArguments());
}
$this->shutdownEach();
break;
}
}
} | [
"protected",
"function",
"shutdownEach",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"class",
"=>",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_contains",
"(",
"array_get",
"(",
"$",
"data",
",",
"'tags'",
")",
",... | Shutdown all providers. | [
"Shutdown",
"all",
"providers",
"."
] | 4dada4aa36ed1f5bebad2a2864941c68fa568a58 | https://github.com/weew/kernel/blob/4dada4aa36ed1f5bebad2a2864941c68fa568a58/src/Weew/Kernel/Kernel.php#L177-L194 | train |
antaresproject/tester | src/Adapter/MessageAdapter.php | MessageAdapter.add | public function add($message, $code, $type)
{
$default = ['message' => $message, 'code' => $code, 'type' => $type];
if ($type == 'error' && is_numeric($code) && $code >= 0) {
$default['descriptor'] = array_search($code, $this->codes['codes']);
}
if ($this->domain !== self::DEFAULT_DOMAIN) {
$default['domain'] = $this->domain;
}
array_push($this->messages, $default);
return $this;
} | php | public function add($message, $code, $type)
{
$default = ['message' => $message, 'code' => $code, 'type' => $type];
if ($type == 'error' && is_numeric($code) && $code >= 0) {
$default['descriptor'] = array_search($code, $this->codes['codes']);
}
if ($this->domain !== self::DEFAULT_DOMAIN) {
$default['domain'] = $this->domain;
}
array_push($this->messages, $default);
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"message",
",",
"$",
"code",
",",
"$",
"type",
")",
"{",
"$",
"default",
"=",
"[",
"'message'",
"=>",
"$",
"message",
",",
"'code'",
"=>",
"$",
"code",
",",
"'type'",
"=>",
"$",
"type",
"]",
";",
"if",
"(",
... | add message to container;
@param String $message
@param numeric $code
@param String $type
@return \Antares\Tester\Adapter\ResponseAdapter | [
"add",
"message",
"to",
"container",
";"
] | 23e9b4dd7880475769486a8c8f979ab6530c99df | https://github.com/antaresproject/tester/blob/23e9b4dd7880475769486a8c8f979ab6530c99df/src/Adapter/MessageAdapter.php#L91-L102 | train |
20centcroak/DBManagement | src/DbManagementTable.php | DbManagementTable.populate | public function populate(DbManagement $db, DbManagementObject $DbManagementObject, $query)
{
$keys = array_values($DbManagementObject->getKeys());
$db->add($query, $keys);
$array = array_values($DbManagementObject->getValues());
$db->query($query, $array);
return $db->lastInsertId();
} | php | public function populate(DbManagement $db, DbManagementObject $DbManagementObject, $query)
{
$keys = array_values($DbManagementObject->getKeys());
$db->add($query, $keys);
$array = array_values($DbManagementObject->getValues());
$db->query($query, $array);
return $db->lastInsertId();
} | [
"public",
"function",
"populate",
"(",
"DbManagement",
"$",
"db",
",",
"DbManagementObject",
"$",
"DbManagementObject",
",",
"$",
"query",
")",
"{",
"$",
"keys",
"=",
"array_values",
"(",
"$",
"DbManagementObject",
"->",
"getKeys",
"(",
")",
")",
";",
"$",
... | add an Object to the table in the database
@param DbManagement $db the database connector
@param DbManagementObject $DbManagementObject the DbManagementObject containing all needed data to populate database
@param String $query the query to populate database
@throws DataBaseException error in connecting to the database
@return id of the record | [
"add",
"an",
"Object",
"to",
"the",
"table",
"in",
"the",
"database"
] | 1c137bb284712c2830e8cf792237adcc1d86d6f4 | https://github.com/20centcroak/DBManagement/blob/1c137bb284712c2830e8cf792237adcc1d86d6f4/src/DbManagementTable.php#L23-L30 | train |
20centcroak/DBManagement | src/DbManagementTable.php | DbManagementTable.getData | public function getData(DbManagement $db, $query, $params, DbManagementObject $DbManagementObject)
{
$keys = $DbManagementObject->getKeys();
//parse params to check their validity and
//use the conventions to sort and filter results
$parsed = $this->parseParams($params, $keys, $DbManagementObject->getTypes());
$array=[];
//if valid params have been detected
//query is filled in with arguments
if(isset($parsed)){
foreach ($parsed as $type => $values) {
switch($type){
case "min":
foreach ($values as $key => $val) {
$min = $keys[$key]."-min";
$db->sortMin($query,$keys[$key],$min);
$array[]=$val;
}
break;
case "max":
foreach ($values as $key => $val) {
$max = $keys[$key]."-max";
$db->sortMax($query,$keys[$key],$max);
$array[]=$val;
}
break;
case "up":
foreach ($values as $val) {
$db->orderUp($query,$keys[$val]);
}
break;
case "down":
foreach ($values as $val) {
$db->orderDown($query,$keys[$val]);
}
break;
case "equals":
foreach ($values as $key => $val) {
$db->sort($query,$keys[$key], $keys[$key]);
$array[]=$val;
}
break;
}
}
}
//close query
$db->closeQuery($query);
$answer = $db->query($query, $array);
$args=[];
while ($row = $answer->fetch(\PDO::FETCH_ASSOC)) {
foreach ($keys as $key => $val) {
$argsDbManagementObject[$val]=$row[$val];
}
$args[] = $argsDbManagementObject;
}
return $args;
} | php | public function getData(DbManagement $db, $query, $params, DbManagementObject $DbManagementObject)
{
$keys = $DbManagementObject->getKeys();
//parse params to check their validity and
//use the conventions to sort and filter results
$parsed = $this->parseParams($params, $keys, $DbManagementObject->getTypes());
$array=[];
//if valid params have been detected
//query is filled in with arguments
if(isset($parsed)){
foreach ($parsed as $type => $values) {
switch($type){
case "min":
foreach ($values as $key => $val) {
$min = $keys[$key]."-min";
$db->sortMin($query,$keys[$key],$min);
$array[]=$val;
}
break;
case "max":
foreach ($values as $key => $val) {
$max = $keys[$key]."-max";
$db->sortMax($query,$keys[$key],$max);
$array[]=$val;
}
break;
case "up":
foreach ($values as $val) {
$db->orderUp($query,$keys[$val]);
}
break;
case "down":
foreach ($values as $val) {
$db->orderDown($query,$keys[$val]);
}
break;
case "equals":
foreach ($values as $key => $val) {
$db->sort($query,$keys[$key], $keys[$key]);
$array[]=$val;
}
break;
}
}
}
//close query
$db->closeQuery($query);
$answer = $db->query($query, $array);
$args=[];
while ($row = $answer->fetch(\PDO::FETCH_ASSOC)) {
foreach ($keys as $key => $val) {
$argsDbManagementObject[$val]=$row[$val];
}
$args[] = $argsDbManagementObject;
}
return $args;
} | [
"public",
"function",
"getData",
"(",
"DbManagement",
"$",
"db",
",",
"$",
"query",
",",
"$",
"params",
",",
"DbManagementObject",
"$",
"DbManagementObject",
")",
"{",
"$",
"keys",
"=",
"$",
"DbManagementObject",
"->",
"getKeys",
"(",
")",
";",
"//parse para... | get data from the table in the database according to the params and the expected DbManagementObject
@param DbManagement $db the database connector
@param String $query the query to select data in database
@param array $params parameters for the query to indicate filters or sorting
@param DbManagementObject $DbManagementObject the DbManagementObject for which data are expected
@throws DataBaseException error in connecting to the database
@return mixed array containing key/value pair defining a DbManagementObject | [
"get",
"data",
"from",
"the",
"table",
"in",
"the",
"database",
"according",
"to",
"the",
"params",
"and",
"the",
"expected",
"DbManagementObject"
] | 1c137bb284712c2830e8cf792237adcc1d86d6f4 | https://github.com/20centcroak/DBManagement/blob/1c137bb284712c2830e8cf792237adcc1d86d6f4/src/DbManagementTable.php#L41-L104 | train |
20centcroak/DBManagement | src/DbManagementTable.php | DbManagementTable.convertValue | private function convertValue($value, $type){
switch($type){
case "is_numeric":
$value = floatval($value);
break;
case "is_float":
$value = floatval($value);
break;
case "is_string":
$value = strval($value);
break;
default:
$value = strval($value);
}
return $value;
} | php | private function convertValue($value, $type){
switch($type){
case "is_numeric":
$value = floatval($value);
break;
case "is_float":
$value = floatval($value);
break;
case "is_string":
$value = strval($value);
break;
default:
$value = strval($value);
}
return $value;
} | [
"private",
"function",
"convertValue",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"\"is_numeric\"",
":",
"$",
"value",
"=",
"floatval",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"\"is_float\"",... | values are converted thanks to the given type
@param mixed $value the value to convert
@param String $type the function name for data type testing: "is_numeric" or "is_string"
@return the converted value | [
"values",
"are",
"converted",
"thanks",
"to",
"the",
"given",
"type"
] | 1c137bb284712c2830e8cf792237adcc1d86d6f4 | https://github.com/20centcroak/DBManagement/blob/1c137bb284712c2830e8cf792237adcc1d86d6f4/src/DbManagementTable.php#L191-L208 | train |
novuso/common | src/Application/EventSourcing/EventProcessor.php | EventProcessor.process | public function process(EventRecord $eventRecord): void
{
$this->eventStore->append($eventRecord);
$this->eventDispatcher->dispatch($eventRecord->eventMessage());
} | php | public function process(EventRecord $eventRecord): void
{
$this->eventStore->append($eventRecord);
$this->eventDispatcher->dispatch($eventRecord->eventMessage());
} | [
"public",
"function",
"process",
"(",
"EventRecord",
"$",
"eventRecord",
")",
":",
"void",
"{",
"$",
"this",
"->",
"eventStore",
"->",
"append",
"(",
"$",
"eventRecord",
")",
";",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"$",
"eventReco... | Processes an event record
Only dispatches an event if the event store does not throw an exception.
@param EventRecord $eventRecord The event record
@return void
@throws Throwable When an error occurs | [
"Processes",
"an",
"event",
"record"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Application/EventSourcing/EventProcessor.php#L56-L60 | train |
ForceLabsDev/framework | src/Html/Html.php | Html.create | public static function create($name, $content = '', $singleTag = false): Element
{
return new Element($name, $content, $singleTag);
} | php | public static function create($name, $content = '', $singleTag = false): Element
{
return new Element($name, $content, $singleTag);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"content",
"=",
"''",
",",
"$",
"singleTag",
"=",
"false",
")",
":",
"Element",
"{",
"return",
"new",
"Element",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"singleTag",
")",
... | creates a new Html object.
@param string $name
@param mixed $content string or Closure
@param bool $singleTag
@return Element | [
"creates",
"a",
"new",
"Html",
"object",
"."
] | e2288582432857771e85c9859acd6d32e5f2f9b7 | https://github.com/ForceLabsDev/framework/blob/e2288582432857771e85c9859acd6d32e5f2f9b7/src/Html/Html.php#L16-L19 | train |
flavorzyb/simple | src/Support/SimpleString.php | SimpleString.isSameString | public function isSameString($leftString, $rightString)
{
if (is_string($leftString) && is_string($rightString) &&
strlen($leftString) == strlen($rightString) &&
md5($leftString) == md5($rightString)
)
{
return true;
}
return false;
} | php | public function isSameString($leftString, $rightString)
{
if (is_string($leftString) && is_string($rightString) &&
strlen($leftString) == strlen($rightString) &&
md5($leftString) == md5($rightString)
)
{
return true;
}
return false;
} | [
"public",
"function",
"isSameString",
"(",
"$",
"leftString",
",",
"$",
"rightString",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"leftString",
")",
"&&",
"is_string",
"(",
"$",
"rightString",
")",
"&&",
"strlen",
"(",
"$",
"leftString",
")",
"==",
"str... | check the strings is the same or not
@param string $leftString
@param string $rightString
@return bool | [
"check",
"the",
"strings",
"is",
"the",
"same",
"or",
"not"
] | 8c4c539ae2057217b2637fc72c2a90ba266e8e6c | https://github.com/flavorzyb/simple/blob/8c4c539ae2057217b2637fc72c2a90ba266e8e6c/src/Support/SimpleString.php#L37-L48 | train |
BudgeIt/composer-builder | src/Runner.php | Runner.runInstallers | public function runInstallers(PackageWrapper $package, $isDevMode)
{
foreach ($this->installers as $installer) {
if ($installer->supports($package)) {
$this->io->write(
sprintf(
'<info>Running %s installer for %s</info>',
$installer->getName(),
$package->getPackage()->getPrettyName()
)
);
$installer->install($package, $isDevMode);
}
}
} | php | public function runInstallers(PackageWrapper $package, $isDevMode)
{
foreach ($this->installers as $installer) {
if ($installer->supports($package)) {
$this->io->write(
sprintf(
'<info>Running %s installer for %s</info>',
$installer->getName(),
$package->getPackage()->getPrettyName()
)
);
$installer->install($package, $isDevMode);
}
}
} | [
"public",
"function",
"runInstallers",
"(",
"PackageWrapper",
"$",
"package",
",",
"$",
"isDevMode",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"installers",
"as",
"$",
"installer",
")",
"{",
"if",
"(",
"$",
"installer",
"->",
"supports",
"(",
"$",
"pa... | Run the installers for a package
@param PackageWrapper $package
@param bool $isDevMode | [
"Run",
"the",
"installers",
"for",
"a",
"package"
] | ce39fdd501425cf87ec8b20d1db2700c77ee2563 | https://github.com/BudgeIt/composer-builder/blob/ce39fdd501425cf87ec8b20d1db2700c77ee2563/src/Runner.php#L61-L75 | train |
BudgeIt/composer-builder | src/Runner.php | Runner.runBuildTools | public function runBuildTools(PackageWrapper $package, $isDevMode)
{
foreach ($this->buildTools as $buildTool) {
if ($buildTool->supports($package)) {
$this->io->write(
sprintf(
'<info>Running %s builder for %s</info>',
$buildTool->getName(),
$package->getPackage()->getPrettyName()
)
);
$buildTool->build($package, $isDevMode);
}
}
} | php | public function runBuildTools(PackageWrapper $package, $isDevMode)
{
foreach ($this->buildTools as $buildTool) {
if ($buildTool->supports($package)) {
$this->io->write(
sprintf(
'<info>Running %s builder for %s</info>',
$buildTool->getName(),
$package->getPackage()->getPrettyName()
)
);
$buildTool->build($package, $isDevMode);
}
}
} | [
"public",
"function",
"runBuildTools",
"(",
"PackageWrapper",
"$",
"package",
",",
"$",
"isDevMode",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"buildTools",
"as",
"$",
"buildTool",
")",
"{",
"if",
"(",
"$",
"buildTool",
"->",
"supports",
"(",
"$",
"pa... | Run the build tools for a package
@param PackageWrapper $package
@param bool $isDevMode | [
"Run",
"the",
"build",
"tools",
"for",
"a",
"package"
] | ce39fdd501425cf87ec8b20d1db2700c77ee2563 | https://github.com/BudgeIt/composer-builder/blob/ce39fdd501425cf87ec8b20d1db2700c77ee2563/src/Runner.php#L83-L97 | train |
liftkit/core | src/Application/Application.php | Application.registerHook | public function registerHook ($key, Hook $hook)
{
if (isset($this->hooks[$key])) {
throw new ReregisterHookException('Attempt to re-register hook ' . $key);
}
if (! $key || ! is_string($key)) {
throw new InvalidHookIdentifierException('Invalid hook identifier ' . var_export($key, true));
}
$this->hooks[$key] = $hook;
} | php | public function registerHook ($key, Hook $hook)
{
if (isset($this->hooks[$key])) {
throw new ReregisterHookException('Attempt to re-register hook ' . $key);
}
if (! $key || ! is_string($key)) {
throw new InvalidHookIdentifierException('Invalid hook identifier ' . var_export($key, true));
}
$this->hooks[$key] = $hook;
} | [
"public",
"function",
"registerHook",
"(",
"$",
"key",
",",
"Hook",
"$",
"hook",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hooks",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"ReregisterHookException",
"(",
"'Attempt to re-register ... | Registers a hook with the application for future interactions.
@see Hook
@api
@param string $key String identifier for hook used in subsequent calls to bindHook() and triggerHook().
@param Hook $hook The hook to be registered.
@throws InvalidHookIdentifierException
@throws ReregisterHookException | [
"Registers",
"a",
"hook",
"with",
"the",
"application",
"for",
"future",
"interactions",
"."
] | c98dcffa65450bd11332dbffe2064650c3a72aae | https://github.com/liftkit/core/blob/c98dcffa65450bd11332dbffe2064650c3a72aae/src/Application/Application.php#L48-L59 | train |
liftkit/core | src/Application/Application.php | Application.bindHook | public function bindHook ($key, $closure, $precedence = 0)
{
if (isset($this->hooks[$key])) {
$this->hooks[$key]->bind($closure, $precedence);
} else {
throw new UnregisteredHookException('Attempt to bind unregistered hook ' . $key);
}
} | php | public function bindHook ($key, $closure, $precedence = 0)
{
if (isset($this->hooks[$key])) {
$this->hooks[$key]->bind($closure, $precedence);
} else {
throw new UnregisteredHookException('Attempt to bind unregistered hook ' . $key);
}
} | [
"public",
"function",
"bindHook",
"(",
"$",
"key",
",",
"$",
"closure",
",",
"$",
"precedence",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hooks",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"hooks",
"[",
"$",
... | Binds an action to be taken when a hook is triggered. The hook must be registered before it can be bound to an action.
@see Hook::bind()
@api
@param string $key String identifier of registered hook.
@param callable $closure A closure representing the action to be taken when the hook is triggered.
@param int $precedence Determines the order that the actions will occur in when the hook is triggered, lowest first.
@throws UnregisteredHookException | [
"Binds",
"an",
"action",
"to",
"be",
"taken",
"when",
"a",
"hook",
"is",
"triggered",
".",
"The",
"hook",
"must",
"be",
"registered",
"before",
"it",
"can",
"be",
"bound",
"to",
"an",
"action",
"."
] | c98dcffa65450bd11332dbffe2064650c3a72aae | https://github.com/liftkit/core/blob/c98dcffa65450bd11332dbffe2064650c3a72aae/src/Application/Application.php#L74-L81 | train |
liftkit/core | src/Application/Application.php | Application.triggerHook | public function triggerHook ($key, $args = array(), $precedence = null)
{
if (isset($this->hooks[$key])) {
return $this->hooks[$key]->trigger($args, $precedence);
} else {
throw new UnregisteredHookException('Attempt to trigger unregistered hook ' . $key);
}
} | php | public function triggerHook ($key, $args = array(), $precedence = null)
{
if (isset($this->hooks[$key])) {
return $this->hooks[$key]->trigger($args, $precedence);
} else {
throw new UnregisteredHookException('Attempt to trigger unregistered hook ' . $key);
}
} | [
"public",
"function",
"triggerHook",
"(",
"$",
"key",
",",
"$",
"args",
"=",
"array",
"(",
")",
",",
"$",
"precedence",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hooks",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"... | Will sequentially call each action bound to the hook. The hook must be registered before it can be bound to an action.
The format of the result of this call as well as the behavior from call to call varies by the type of hook.
@see Hook::trigger()
@api
@param string $key String identifier of registered hook.
@param array $args Arguments which will be passed to each callback.
@param null $precedence If supplied, the hook's actions will only be executed for a given precedence.
@return mixed
@throws UnregisteredHookException | [
"Will",
"sequentially",
"call",
"each",
"action",
"bound",
"to",
"the",
"hook",
".",
"The",
"hook",
"must",
"be",
"registered",
"before",
"it",
"can",
"be",
"bound",
"to",
"an",
"action",
"."
] | c98dcffa65450bd11332dbffe2064650c3a72aae | https://github.com/liftkit/core/blob/c98dcffa65450bd11332dbffe2064650c3a72aae/src/Application/Application.php#L99-L106 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.typeCastModel | private static function typeCastModel(LightModel $model)
{
if (in_array(self::OPTIONS_TYPECAST, self::$initOptions))
{
foreach ($model->getTable()->getColumns() as $column)
{
/* @var $column Column */
if (in_array($column->getField(), get_object_vars($model)))
{
if ($column->getType() === Column::TYPE_INT)
{
$field = $column->getField();
settype($model->$field, Column::TYPE_INT);
}
}
}
}
return $model;
} | php | private static function typeCastModel(LightModel $model)
{
if (in_array(self::OPTIONS_TYPECAST, self::$initOptions))
{
foreach ($model->getTable()->getColumns() as $column)
{
/* @var $column Column */
if (in_array($column->getField(), get_object_vars($model)))
{
if ($column->getType() === Column::TYPE_INT)
{
$field = $column->getField();
settype($model->$field, Column::TYPE_INT);
}
}
}
}
return $model;
} | [
"private",
"static",
"function",
"typeCastModel",
"(",
"LightModel",
"$",
"model",
")",
"{",
"if",
"(",
"in_array",
"(",
"self",
"::",
"OPTIONS_TYPECAST",
",",
"self",
"::",
"$",
"initOptions",
")",
")",
"{",
"foreach",
"(",
"$",
"model",
"->",
"getTable",... | Typecast the models columns to the associated mysql data types.
@param LightModel $model
@return LightModel
TODO implement typecasting to other types | [
"Typecast",
"the",
"models",
"columns",
"to",
"the",
"associated",
"mysql",
"data",
"types",
"."
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L77-L96 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.init | public static function init(PDO $pdo, $options = [])
{
DB::init($pdo);
self::$initOptions = $options;
} | php | public static function init(PDO $pdo, $options = [])
{
DB::init($pdo);
self::$initOptions = $options;
} | [
"public",
"static",
"function",
"init",
"(",
"PDO",
"$",
"pdo",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"DB",
"::",
"init",
"(",
"$",
"pdo",
")",
";",
"self",
"::",
"$",
"initOptions",
"=",
"$",
"options",
";",
"}"
] | Set up our options and pass PDO to our DB Singleton
@param PDO $pdo
@param array $options | [
"Set",
"up",
"our",
"options",
"and",
"pass",
"PDO",
"to",
"our",
"DB",
"Singleton"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L116-L120 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.getTableName | public function getTableName(): string
{
if ($this->tableName === null)
{
$this->tableName = (new \ReflectionClass($this))->getShortName();
}
return $this->tableName;
} | php | public function getTableName(): string
{
if ($this->tableName === null)
{
$this->tableName = (new \ReflectionClass($this))->getShortName();
}
return $this->tableName;
} | [
"public",
"function",
"getTableName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"tableName",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"tableName",
"=",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
")",
"->",
"getSh... | Check if tableName has been set or return based on class;
@return String | [
"Check",
"if",
"tableName",
"has",
"been",
"set",
"or",
"return",
"based",
"on",
"class",
";"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L126-L134 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.handleFilter | private static function handleFilter(String &$sql, $filter, LightModel $class): array
{
$params = [];
if (isset($filter[self::FILTER_ORDER]))
{
$order = $filter[self::FILTER_ORDER];
unset($filter[self::FILTER_ORDER]);
}
if (isset($filter[self::FILTER_LIMIT]))
{
$limit = (int) $filter[self::FILTER_LIMIT];
unset($filter[self::FILTER_LIMIT]);
}
foreach ($filter as $filter => $value)
{
if (! $class->getTable()->hasColumn($filter))
continue;
//Default operator for all queries
$operator = '=';
//Check if the operator was passed in
if (is_array($value))
{
$operator = $value[0];
$value = $value[1];
}
switch ($class->getTable()->getColumn($filter)->getType())
{
case Column::TYPE_INT:
$value = (int) $value;
break;
default:
$value = (string) $value;
}
$sql .= ' AND `' . $filter . '` ' . $operator . ' :' . $filter;
$params[':' . $filter] = $value;
}
if (isset($order))
{
$sql .= ' ORDER BY ' . $order;
}
if (isset($limit))
{
$sql .= ' LIMIT ' . $limit;
}
return $params;
} | php | private static function handleFilter(String &$sql, $filter, LightModel $class): array
{
$params = [];
if (isset($filter[self::FILTER_ORDER]))
{
$order = $filter[self::FILTER_ORDER];
unset($filter[self::FILTER_ORDER]);
}
if (isset($filter[self::FILTER_LIMIT]))
{
$limit = (int) $filter[self::FILTER_LIMIT];
unset($filter[self::FILTER_LIMIT]);
}
foreach ($filter as $filter => $value)
{
if (! $class->getTable()->hasColumn($filter))
continue;
//Default operator for all queries
$operator = '=';
//Check if the operator was passed in
if (is_array($value))
{
$operator = $value[0];
$value = $value[1];
}
switch ($class->getTable()->getColumn($filter)->getType())
{
case Column::TYPE_INT:
$value = (int) $value;
break;
default:
$value = (string) $value;
}
$sql .= ' AND `' . $filter . '` ' . $operator . ' :' . $filter;
$params[':' . $filter] = $value;
}
if (isset($order))
{
$sql .= ' ORDER BY ' . $order;
}
if (isset($limit))
{
$sql .= ' LIMIT ' . $limit;
}
return $params;
} | [
"private",
"static",
"function",
"handleFilter",
"(",
"String",
"&",
"$",
"sql",
",",
"$",
"filter",
",",
"LightModel",
"$",
"class",
")",
":",
"array",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"filter",
"[",
"self",
":... | Parse filters & return the associated params for passing into PDO query
@param String $sql
@param $filter
@param LightModel $class
@return array | [
"Parse",
"filters",
"&",
"return",
"the",
"associated",
"params",
"for",
"passing",
"into",
"PDO",
"query"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L198-L253 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.getItems | public static function getItems($filter = []): array
{
$res = [];
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
{
$res[] = self::typeCastModel($item);
}
return $res;
} | php | public static function getItems($filter = []): array
{
$res = [];
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
{
$res[] = self::typeCastModel($item);
}
return $res;
} | [
"public",
"static",
"function",
"getItems",
"(",
"$",
"filter",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"/* @var $class LightModel */",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"$",
"class",
"=",
"new",
"... | Get all items based on filter
@param array $filter
@return array | [
"Get",
"all",
"items",
"based",
"on",
"filter"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L261-L281 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.getKeys | public static function getKeys($filter = []): array
{
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$tableKey = $class->getKeyName();
$sql = 'SELECT ' . $tableKey . ' FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
$res = [];
foreach ($query->fetchAll() as $key => $value)
{
$res[] = $value[0];
}
return $res;
} | php | public static function getKeys($filter = []): array
{
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$tableKey = $class->getKeyName();
$sql = 'SELECT ' . $tableKey . ' FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
$res = [];
foreach ($query->fetchAll() as $key => $value)
{
$res[] = $value[0];
}
return $res;
} | [
"public",
"static",
"function",
"getKeys",
"(",
"$",
"filter",
"=",
"[",
"]",
")",
":",
"array",
"{",
"/* @var $class LightModel */",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"$",
"class",
"=",
"new",
"$",
"className",
";",
"$",
"tableKey"... | Get array of keys that match the specified filters.
Can be used when loading large quantities of models is not an option.
@param array $filter
@return array | [
"Get",
"array",
"of",
"keys",
"that",
"match",
"the",
"specified",
"filters",
".",
"Can",
"be",
"used",
"when",
"loading",
"large",
"quantities",
"of",
"models",
"is",
"not",
"an",
"option",
"."
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L290-L311 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.count | public static function count($filter = []): int
{
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$tableKey = $class->getKeyName();
$sql = 'SELECT COUNT(' . $tableKey . ') FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
return (int) $query->fetchColumn(0);
} | php | public static function count($filter = []): int
{
/* @var $class LightModel */
$className = get_called_class();
$class = new $className;
$tableKey = $class->getKeyName();
$sql = 'SELECT COUNT(' . $tableKey . ') FROM ' . $class->getTableName() . ' WHERE 1=1';
$params = self::handleFilter($sql, $filter, $class);
$query = DB::getConnection()->prepare($sql);
$query->execute($params);
return (int) $query->fetchColumn(0);
} | [
"public",
"static",
"function",
"count",
"(",
"$",
"filter",
"=",
"[",
"]",
")",
":",
"int",
"{",
"/* @var $class LightModel */",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"$",
"class",
"=",
"new",
"$",
"className",
";",
"$",
"tableKey",
... | Count items based on filter
@param array $filter
@return int | [
"Count",
"items",
"based",
"on",
"filter"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L319-L333 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.exists | public function exists(): bool
{
$tableKey = $this->getKeyName();
//If key isn't set we cant associate this record with DB
if (! isset($this->$tableKey))
{
return false;
}
$sql = 'SELECT EXISTS(SELECT ' . $tableKey . ' FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key LIMIT 1)';
$query = DB::getConnection()->prepare($sql);
$query->execute(['key' => $this->getKey()]);
return boolval($query->fetchColumn(0));
} | php | public function exists(): bool
{
$tableKey = $this->getKeyName();
//If key isn't set we cant associate this record with DB
if (! isset($this->$tableKey))
{
return false;
}
$sql = 'SELECT EXISTS(SELECT ' . $tableKey . ' FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key LIMIT 1)';
$query = DB::getConnection()->prepare($sql);
$query->execute(['key' => $this->getKey()]);
return boolval($query->fetchColumn(0));
} | [
"public",
"function",
"exists",
"(",
")",
":",
"bool",
"{",
"$",
"tableKey",
"=",
"$",
"this",
"->",
"getKeyName",
"(",
")",
";",
"//If key isn't set we cant associate this record with DB",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"$",
"tableKey",
")... | Check does the current item exist.
@return bool | [
"Check",
"does",
"the",
"current",
"item",
"exist",
"."
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L341-L356 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.refresh | public function refresh()
{
$keyName = $this->keyName;
//If we don't have a key we cant refresh
if (! isset($this->$keyName))
{
return;
}
$dbItem = self::getOneByKey($this->getKey());
//Check if we are already the same
if ($dbItem == $this)
{
return;
}
//Get values from DB & check if they match. Update if needed
foreach (get_object_vars($dbItem) as $var => $val)
{
if ($this->$var !== $val)
{
$this->$var = $val;
}
}
} | php | public function refresh()
{
$keyName = $this->keyName;
//If we don't have a key we cant refresh
if (! isset($this->$keyName))
{
return;
}
$dbItem = self::getOneByKey($this->getKey());
//Check if we are already the same
if ($dbItem == $this)
{
return;
}
//Get values from DB & check if they match. Update if needed
foreach (get_object_vars($dbItem) as $var => $val)
{
if ($this->$var !== $val)
{
$this->$var = $val;
}
}
} | [
"public",
"function",
"refresh",
"(",
")",
"{",
"$",
"keyName",
"=",
"$",
"this",
"->",
"keyName",
";",
"//If we don't have a key we cant refresh",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"$",
"keyName",
")",
")",
"{",
"return",
";",
"}",
"$",
... | Reload the current Model
TODO fetchColumns instead of self::getOneByKey() to only update column values | [
"Reload",
"the",
"current",
"Model"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L363-L389 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.delete | public function delete(): bool
{
if (! $this->exists())
{
return false;
}
$sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key';
$query = DB::getConnection()->prepare($sql);
return $query->execute(['key' => $this->getKey()]);
} | php | public function delete(): bool
{
if (! $this->exists())
{
return false;
}
$sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key';
$query = DB::getConnection()->prepare($sql);
return $query->execute(['key' => $this->getKey()]);
} | [
"public",
"function",
"delete",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"sql",
"=",
"'DELETE FROM '",
".",
"$",
"this",
"->",
"getTableName",
"(",
")",
".",
"'... | Delete a model from the DB
@return bool | [
"Delete",
"a",
"model",
"from",
"the",
"DB"
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L468-L479 | train |
mattvb91/LightModel | src/LightModel.php | LightModel.belongsTo | protected function belongsTo($class, $foreignKey): ?LightModel
{
$identifier = implode('_', [$class, $foreignKey]);
if (! isset($this->_belongsTo[$identifier]))
{
if (! $this->getTable()->hasColumn($foreignKey))
{
throw new ColumnMissingException($this->getTableName() . ' does not have column: ' . $foreignKey);
}
$this->_belongsTo[$identifier] = $class::getOneByKey($this->$foreignKey);
}
return $this->_belongsTo[$identifier];
} | php | protected function belongsTo($class, $foreignKey): ?LightModel
{
$identifier = implode('_', [$class, $foreignKey]);
if (! isset($this->_belongsTo[$identifier]))
{
if (! $this->getTable()->hasColumn($foreignKey))
{
throw new ColumnMissingException($this->getTableName() . ' does not have column: ' . $foreignKey);
}
$this->_belongsTo[$identifier] = $class::getOneByKey($this->$foreignKey);
}
return $this->_belongsTo[$identifier];
} | [
"protected",
"function",
"belongsTo",
"(",
"$",
"class",
",",
"$",
"foreignKey",
")",
":",
"?",
"LightModel",
"{",
"$",
"identifier",
"=",
"implode",
"(",
"'_'",
",",
"[",
"$",
"class",
",",
"$",
"foreignKey",
"]",
")",
";",
"if",
"(",
"!",
"isset",
... | Load the specified belongsTo relation model.
@param $class
@param $foreignKey
@return LightModel
@throws Exception | [
"Load",
"the",
"specified",
"belongsTo",
"relation",
"model",
"."
] | 139b50320bb88ce7618503bbabab8712510eb69f | https://github.com/mattvb91/LightModel/blob/139b50320bb88ce7618503bbabab8712510eb69f/src/LightModel.php#L489-L504 | train |
dreadlokeur/Midi-ChloriansPHP | src/utility/Date.php | Date.getAge | public function getAge($day, $month, $year) {
$years = date('Y') - $year;
if (date('m') < $month)
$years--;
elseif (date('d') < $day && date('m') == $month)
$years--;
return $years;
} | php | public function getAge($day, $month, $year) {
$years = date('Y') - $year;
if (date('m') < $month)
$years--;
elseif (date('d') < $day && date('m') == $month)
$years--;
return $years;
} | [
"public",
"function",
"getAge",
"(",
"$",
"day",
",",
"$",
"month",
",",
"$",
"year",
")",
"{",
"$",
"years",
"=",
"date",
"(",
"'Y'",
")",
"-",
"$",
"year",
";",
"if",
"(",
"date",
"(",
"'m'",
")",
"<",
"$",
"month",
")",
"$",
"years",
"--",... | Permet de calculer un age depuis une date de naissance
@access public
@param string $day le jour de naissance
@param string $month le mois de naissance
@param string $year l'année de naissance
@return string $years l'age | [
"Permet",
"de",
"calculer",
"un",
"age",
"depuis",
"une",
"date",
"de",
"naissance"
] | 4842e0a662c8b9448e69c8e5da35f55066f3bd9e | https://github.com/dreadlokeur/Midi-ChloriansPHP/blob/4842e0a662c8b9448e69c8e5da35f55066f3bd9e/src/utility/Date.php#L144-L152 | train |
hediet/php-type-reflection | src/Hediet/Types/ClassType.php | ClassType.getProperties | public function getProperties()
{
//todo cache
$result = array();
foreach ($this->getReflectionClass()->getProperties() as $m)
{
$result[] = PropertyInfo::__internal_create($this, $m);
}
return $result;
} | php | public function getProperties()
{
//todo cache
$result = array();
foreach ($this->getReflectionClass()->getProperties() as $m)
{
$result[] = PropertyInfo::__internal_create($this, $m);
}
return $result;
} | [
"public",
"function",
"getProperties",
"(",
")",
"{",
"//todo cache",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getReflectionClass",
"(",
")",
"->",
"getProperties",
"(",
")",
"as",
"$",
"m",
")",
"{",
"$",
"result... | Gets a list of all defined properties.
@return PropertyInfo[] | [
"Gets",
"a",
"list",
"of",
"all",
"defined",
"properties",
"."
] | 4a049c0e35f35cf95769f3823c915a3c41d6a292 | https://github.com/hediet/php-type-reflection/blob/4a049c0e35f35cf95769f3823c915a3c41d6a292/src/Hediet/Types/ClassType.php#L37-L46 | train |
hediet/php-type-reflection | src/Hediet/Types/ClassType.php | ClassType.getProperty | public function getProperty($name)
{
$m = $this->getReflectionClass()->getProperty($name);
return PropertyInfo::__internal_create($this, $m);
} | php | public function getProperty($name)
{
$m = $this->getReflectionClass()->getProperty($name);
return PropertyInfo::__internal_create($this, $m);
} | [
"public",
"function",
"getProperty",
"(",
"$",
"name",
")",
"{",
"$",
"m",
"=",
"$",
"this",
"->",
"getReflectionClass",
"(",
")",
"->",
"getProperty",
"(",
"$",
"name",
")",
";",
"return",
"PropertyInfo",
"::",
"__internal_create",
"(",
"$",
"this",
","... | Gets a property by its name.
@param string $name
@return PropertyInfo
@throws ReflectionException A reflection exception will be thrown, if the property does not exist. | [
"Gets",
"a",
"property",
"by",
"its",
"name",
"."
] | 4a049c0e35f35cf95769f3823c915a3c41d6a292 | https://github.com/hediet/php-type-reflection/blob/4a049c0e35f35cf95769f3823c915a3c41d6a292/src/Hediet/Types/ClassType.php#L55-L59 | train |
hediet/php-type-reflection | src/Hediet/Types/ClassType.php | ClassType.isAssignableFrom | public function isAssignableFrom(Type $type)
{
if ($type->getName() === $this->getName())
return true;
if (!($type instanceof ClassType))
return false;
return $type->isSubtypeOf($this);
} | php | public function isAssignableFrom(Type $type)
{
if ($type->getName() === $this->getName())
return true;
if (!($type instanceof ClassType))
return false;
return $type->isSubtypeOf($this);
} | [
"public",
"function",
"isAssignableFrom",
"(",
"Type",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"->",
"getName",
"(",
")",
"===",
"$",
"this",
"->",
"getName",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"$",
"type",
"instanceo... | Checks whether the provided type equals this type or is a subtype of this type.
@param Type $type
@return boolean | [
"Checks",
"whether",
"the",
"provided",
"type",
"equals",
"this",
"type",
"or",
"is",
"a",
"subtype",
"of",
"this",
"type",
"."
] | 4a049c0e35f35cf95769f3823c915a3c41d6a292 | https://github.com/hediet/php-type-reflection/blob/4a049c0e35f35cf95769f3823c915a3c41d6a292/src/Hediet/Types/ClassType.php#L78-L87 | train |
hediet/php-type-reflection | src/Hediet/Types/ClassType.php | ClassType.isAssignableFromValue | public function isAssignableFromValue($value)
{
if (!is_object($value))
return false;
if (get_class($value) === $this->getName())
return true;
return is_subclass_of($value, $this->className);
} | php | public function isAssignableFromValue($value)
{
if (!is_object($value))
return false;
if (get_class($value) === $this->getName())
return true;
return is_subclass_of($value, $this->className);
} | [
"public",
"function",
"isAssignableFromValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"return",
"false",
";",
"if",
"(",
"get_class",
"(",
"$",
"value",
")",
"===",
"$",
"this",
"->",
"getName",
"(",
")... | Checks whether the provided value is an instance of either this type or a subclass of this type.
@param mixed $value
@return boolean | [
"Checks",
"whether",
"the",
"provided",
"value",
"is",
"an",
"instance",
"of",
"either",
"this",
"type",
"or",
"a",
"subclass",
"of",
"this",
"type",
"."
] | 4a049c0e35f35cf95769f3823c915a3c41d6a292 | https://github.com/hediet/php-type-reflection/blob/4a049c0e35f35cf95769f3823c915a3c41d6a292/src/Hediet/Types/ClassType.php#L95-L104 | train |
hediet/php-type-reflection | src/Hediet/Types/ClassType.php | ClassType.getImplementedInterfaces | public function getImplementedInterfaces()
{
$result = array();
foreach ($this->getReflectionClass()->getInterfaces() as $interface)
{
$result[] = Type::byReflectionClass($interface);
}
return $result;
} | php | public function getImplementedInterfaces()
{
$result = array();
foreach ($this->getReflectionClass()->getInterfaces() as $interface)
{
$result[] = Type::byReflectionClass($interface);
}
return $result;
} | [
"public",
"function",
"getImplementedInterfaces",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getReflectionClass",
"(",
")",
"->",
"getInterfaces",
"(",
")",
"as",
"$",
"interface",
")",
"{",
"$",
"resul... | Gets all interfaces that were implemented by this class.
@return InterfaceType[] | [
"Gets",
"all",
"interfaces",
"that",
"were",
"implemented",
"by",
"this",
"class",
"."
] | 4a049c0e35f35cf95769f3823c915a3c41d6a292 | https://github.com/hediet/php-type-reflection/blob/4a049c0e35f35cf95769f3823c915a3c41d6a292/src/Hediet/Types/ClassType.php#L122-L130 | train |
WellCommerce/Form | DataTransformer/DateTransformer.php | DateTransformer.reverseTransform | public function reverseTransform($modelData, PropertyPathInterface $propertyPath, $value)
{
if (false === $date = $this->createDateFromString($value)) {
$date = null;
}
$this->propertyAccessor->setValue($modelData, $propertyPath, $date);
} | php | public function reverseTransform($modelData, PropertyPathInterface $propertyPath, $value)
{
if (false === $date = $this->createDateFromString($value)) {
$date = null;
}
$this->propertyAccessor->setValue($modelData, $propertyPath, $date);
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"modelData",
",",
"PropertyPathInterface",
"$",
"propertyPath",
",",
"$",
"value",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"date",
"=",
"$",
"this",
"->",
"createDateFromString",
"(",
"$",
"value",
")",
... | Transforms date string to DateTime object
@param object $modelData
@param PropertyPathInterface $propertyPath
@param mixed $value | [
"Transforms",
"date",
"string",
"to",
"DateTime",
"object"
] | dad15dbdcf1d13f927fa86f5198bcb6abed1974a | https://github.com/WellCommerce/Form/blob/dad15dbdcf1d13f927fa86f5198bcb6abed1974a/DataTransformer/DateTransformer.php#L70-L77 | train |
las93/apollina2 | Apollina/I18n.php | I18n.getText | public function getText($sValue)
{
//ad callback to add translation before Apollina - You could see the method use in Venus2
foreach (self::$_aCallbacks as $aOneCallback) {
$sValueReturn = $aOneCallback($sValue);
if ($sValueReturn !== '') { return $sValueReturn; }
}
if (file_exists($this->getI18nDirectory().$this->getLanguage().$this->getIntermediaiteDirectory().$this->getI18nDomain().'.json')) {
if (!Translator::isConfigurated()) {
Translator::setConfig($this->getI18nDirectory().$this->getLanguage().$this->getIntermediaiteDirectory().$this->getI18nDomain().'.json');
}
return Translator::_($sValue);
}
else if (!function_exists("gettext")) {
if (!Gettext::isConfigurated()) { Gettext::setConfig($this->getLanguage(), $this->getI18nDomain(), $this->getI18nDirectory()); }
return Gettext::_($sValue);
}
else {
return Mock::_($sValue);
}
} | php | public function getText($sValue)
{
//ad callback to add translation before Apollina - You could see the method use in Venus2
foreach (self::$_aCallbacks as $aOneCallback) {
$sValueReturn = $aOneCallback($sValue);
if ($sValueReturn !== '') { return $sValueReturn; }
}
if (file_exists($this->getI18nDirectory().$this->getLanguage().$this->getIntermediaiteDirectory().$this->getI18nDomain().'.json')) {
if (!Translator::isConfigurated()) {
Translator::setConfig($this->getI18nDirectory().$this->getLanguage().$this->getIntermediaiteDirectory().$this->getI18nDomain().'.json');
}
return Translator::_($sValue);
}
else if (!function_exists("gettext")) {
if (!Gettext::isConfigurated()) { Gettext::setConfig($this->getLanguage(), $this->getI18nDomain(), $this->getI18nDirectory()); }
return Gettext::_($sValue);
}
else {
return Mock::_($sValue);
}
} | [
"public",
"function",
"getText",
"(",
"$",
"sValue",
")",
"{",
"//ad callback to add translation before Apollina - You could see the method use in Venus2",
"foreach",
"(",
"self",
"::",
"$",
"_aCallbacks",
"as",
"$",
"aOneCallback",
")",
"{",
"$",
"sValueReturn",
"=",
"... | get a translation
@access public
@param string $sValue text to translate
@return string | [
"get",
"a",
"translation"
] | 7567e35573d8b3133d49f98816d9f3314a1aaf6a | https://github.com/las93/apollina2/blob/7567e35573d8b3133d49f98816d9f3314a1aaf6a/Apollina/I18n.php#L205-L234 | train |
nztim/input | src/BaseProcessor.php | BaseProcessor.normalize | protected function normalize(array $input) : array
{
$normalized = [];
foreach ($this->rules() as $field => $value) {
$normalized[$field] = $input[$field] ?? '';
}
return $normalized;
} | php | protected function normalize(array $input) : array
{
$normalized = [];
foreach ($this->rules() as $field => $value) {
$normalized[$field] = $input[$field] ?? '';
}
return $normalized;
} | [
"protected",
"function",
"normalize",
"(",
"array",
"$",
"input",
")",
":",
"array",
"{",
"$",
"normalized",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"normalize... | Remove unexpected fields and ensure all fields in rules array are present
@param $input
@return array | [
"Remove",
"unexpected",
"fields",
"and",
"ensure",
"all",
"fields",
"in",
"rules",
"array",
"are",
"present"
] | d64c9f853a84c256a1ae4ef934d2122a9acd5536 | https://github.com/nztim/input/blob/d64c9f853a84c256a1ae4ef934d2122a9acd5536/src/BaseProcessor.php#L105-L112 | train |
appcia/utils | src/Appcia/Utils/Val.php | Val.prop | public static function prop($value, $chain)
{
if (empty($chain)) {
throw new \InvalidArgumentException("Value property name cannot be empty.");
}
if (!is_string($chain)) {
throw new \InvalidArgumentException(sprintf(
"Value property name must be a string, %s given.",
gettype($chain)
));
}
$chain = explode('.', $chain);
foreach ($chain as $property) {
if (is_object($value)) {
$getter = 'get' . ucfirst($property);
if (is_callable(array($value, $getter))) {
$value = $value->$getter();
} elseif (isset($value->{$property})) {
$value = $value->{$property};
} else {
return null;
}
} elseif (Arrays::isArray($value)) {
if (!isset($value[$property])) {
return null;
}
$value = $value[$property];
} elseif (is_null($value)) {
return null;
} else {
throw new \InvalidArgumentException(sprintf(
"Value property '%s' in chain '%s' has invalid type: '%s'.",
$property,
$chain,
gettype($value)
));
}
}
return $value;
} | php | public static function prop($value, $chain)
{
if (empty($chain)) {
throw new \InvalidArgumentException("Value property name cannot be empty.");
}
if (!is_string($chain)) {
throw new \InvalidArgumentException(sprintf(
"Value property name must be a string, %s given.",
gettype($chain)
));
}
$chain = explode('.', $chain);
foreach ($chain as $property) {
if (is_object($value)) {
$getter = 'get' . ucfirst($property);
if (is_callable(array($value, $getter))) {
$value = $value->$getter();
} elseif (isset($value->{$property})) {
$value = $value->{$property};
} else {
return null;
}
} elseif (Arrays::isArray($value)) {
if (!isset($value[$property])) {
return null;
}
$value = $value[$property];
} elseif (is_null($value)) {
return null;
} else {
throw new \InvalidArgumentException(sprintf(
"Value property '%s' in chain '%s' has invalid type: '%s'.",
$property,
$chain,
gettype($value)
));
}
}
return $value;
} | [
"public",
"static",
"function",
"prop",
"(",
"$",
"value",
",",
"$",
"chain",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"chain",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Value property name cannot be empty.\"",
")",
";",
"}",
... | Get chained property
@param mixed $value
@param string $chain Chain of properties (dot as separator)
@throws \InvalidArgumentException
@return mixed | [
"Get",
"chained",
"property"
] | 8f7874e2c6563bcac0be821381d0c3b541999e40 | https://github.com/appcia/utils/blob/8f7874e2c6563bcac0be821381d0c3b541999e40/src/Appcia/Utils/Val.php#L39-L81 | train |
appcia/utils | src/Appcia/Utils/Val.php | Val.props | public static function props($value, array $chains)
{
$props = array();
foreach ($chains as $chain) {
$props[$chain] = static::prop($value, $chain);
}
return $props;
} | php | public static function props($value, array $chains)
{
$props = array();
foreach ($chains as $chain) {
$props[$chain] = static::prop($value, $chain);
}
return $props;
} | [
"public",
"static",
"function",
"props",
"(",
"$",
"value",
",",
"array",
"$",
"chains",
")",
"{",
"$",
"props",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"chains",
"as",
"$",
"chain",
")",
"{",
"$",
"props",
"[",
"$",
"chain",
"]",
"=",
... | Plural form of prop
@param mixed $value
@param array $chains
@see prop()
@return array | [
"Plural",
"form",
"of",
"prop"
] | 8f7874e2c6563bcac0be821381d0c3b541999e40 | https://github.com/appcia/utils/blob/8f7874e2c6563bcac0be821381d0c3b541999e40/src/Appcia/Utils/Val.php#L93-L101 | train |
appcia/utils | src/Appcia/Utils/Val.php | Val.nulls | public static function nulls(array $data, $keys = null)
{
if ($keys === null) {
$keys = array_keys($data);
}
if (!Arrays::isArray($keys)) {
$keys = array($keys);
}
foreach ($keys as $key) {
if (array_key_exists($key, $data) && empty($data[$key])) {
$data[$key] = null;
}
}
return $data;
} | php | public static function nulls(array $data, $keys = null)
{
if ($keys === null) {
$keys = array_keys($data);
}
if (!Arrays::isArray($keys)) {
$keys = array($keys);
}
foreach ($keys as $key) {
if (array_key_exists($key, $data) && empty($data[$key])) {
$data[$key] = null;
}
}
return $data;
} | [
"public",
"static",
"function",
"nulls",
"(",
"array",
"$",
"data",
",",
"$",
"keys",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"keys",
"===",
"null",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"data",
")",
";",
"}",
"if",
"(",
"!",
"Arra... | Filter empty values to be treated as nulls
@param mixed $keys
@param array $data
@return array | [
"Filter",
"empty",
"values",
"to",
"be",
"treated",
"as",
"nulls"
] | 8f7874e2c6563bcac0be821381d0c3b541999e40 | https://github.com/appcia/utils/blob/8f7874e2c6563bcac0be821381d0c3b541999e40/src/Appcia/Utils/Val.php#L111-L128 | train |
appcia/utils | src/Appcia/Utils/Val.php | Val.string | public static function string($value)
{
if (static::stringable($value)) {
$value = (string) $value;
} else {
$value = null;
}
return $value;
} | php | public static function string($value)
{
if (static::stringable($value)) {
$value = (string) $value;
} else {
$value = null;
}
return $value;
} | [
"public",
"static",
"function",
"string",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"static",
"::",
"stringable",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"value",
"=",
"null... | Get value treated as string
@param mixed $value Value
@return string|null | [
"Get",
"value",
"treated",
"as",
"string"
] | 8f7874e2c6563bcac0be821381d0c3b541999e40 | https://github.com/appcia/utils/blob/8f7874e2c6563bcac0be821381d0c3b541999e40/src/Appcia/Utils/Val.php#L150-L159 | train |
appcia/utils | src/Appcia/Utils/Val.php | Val.hash | public static function hash($value)
{
$hash = is_object($value)
? spl_object_hash($value)
: md5(Php::encode($value));
return $hash;
} | php | public static function hash($value)
{
$hash = is_object($value)
? spl_object_hash($value)
: md5(Php::encode($value));
return $hash;
} | [
"public",
"static",
"function",
"hash",
"(",
"$",
"value",
")",
"{",
"$",
"hash",
"=",
"is_object",
"(",
"$",
"value",
")",
"?",
"spl_object_hash",
"(",
"$",
"value",
")",
":",
"md5",
"(",
"Php",
"::",
"encode",
"(",
"$",
"value",
")",
")",
";",
... | Get hash for value for any type
@param mixed $value
@return string | [
"Get",
"hash",
"for",
"value",
"for",
"any",
"type"
] | 8f7874e2c6563bcac0be821381d0c3b541999e40 | https://github.com/appcia/utils/blob/8f7874e2c6563bcac0be821381d0c3b541999e40/src/Appcia/Utils/Val.php#L194-L201 | train |
tekkla/core-security | Core/Security/Token/ActivationToken.php | ActivationToken.generateSelector | private function generateSelector(): string
{
// Make sure the selector is not in use. Such case is very uncommon and rare but can happen.
$in_use = true;
while ($in_use == true) {
// Generate random selector and token
$this->setSize(6);
$this->generateRandomToken();
$selector = bin2hex($this->token);
// And check if it is already in use
$in_use = $this->db->count('core_activation_tokens', 'selector = :selector', [
'selector' => $selector
]) > 0;
}
$this->selector = $selector;
return $this->selector;
} | php | private function generateSelector(): string
{
// Make sure the selector is not in use. Such case is very uncommon and rare but can happen.
$in_use = true;
while ($in_use == true) {
// Generate random selector and token
$this->setSize(6);
$this->generateRandomToken();
$selector = bin2hex($this->token);
// And check if it is already in use
$in_use = $this->db->count('core_activation_tokens', 'selector = :selector', [
'selector' => $selector
]) > 0;
}
$this->selector = $selector;
return $this->selector;
} | [
"private",
"function",
"generateSelector",
"(",
")",
":",
"string",
"{",
"// Make sure the selector is not in use. Such case is very uncommon and rare but can happen.",
"$",
"in_use",
"=",
"true",
";",
"while",
"(",
"$",
"in_use",
"==",
"true",
")",
"{",
"// Generate rand... | Creates a random and unique selector
@return string | [
"Creates",
"a",
"random",
"and",
"unique",
"selector"
] | 66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582 | https://github.com/tekkla/core-security/blob/66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582/Core/Security/Token/ActivationToken.php#L116-L138 | train |
tekkla/core-security | Core/Security/Token/ActivationToken.php | ActivationToken.getSelector | public function getSelector(bool $refresh = false): string
{
if (!isset($this->selector) || $refresh) {
$this->generateSelector();
}
return $this->selector;
} | php | public function getSelector(bool $refresh = false): string
{
if (!isset($this->selector) || $refresh) {
$this->generateSelector();
}
return $this->selector;
} | [
"public",
"function",
"getSelector",
"(",
"bool",
"$",
"refresh",
"=",
"false",
")",
":",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"selector",
")",
"||",
"$",
"refresh",
")",
"{",
"$",
"this",
"->",
"generateSelector",
"(",
")"... | Returns the selector.
Will generate a random and unique selector when no selector is set.
@return string | [
"Returns",
"the",
"selector",
"."
] | 66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582 | https://github.com/tekkla/core-security/blob/66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582/Core/Security/Token/ActivationToken.php#L147-L154 | train |
tekkla/core-security | Core/Security/Token/ActivationToken.php | ActivationToken.generateActivationToken | private function generateActivationToken(): string
{
$this->setSize(32);
$this->generateRandomToken();
$this->activation_token = hash('sha256', $this->token);
return $this->activation_token;
} | php | private function generateActivationToken(): string
{
$this->setSize(32);
$this->generateRandomToken();
$this->activation_token = hash('sha256', $this->token);
return $this->activation_token;
} | [
"private",
"function",
"generateActivationToken",
"(",
")",
":",
"string",
"{",
"$",
"this",
"->",
"setSize",
"(",
"32",
")",
";",
"$",
"this",
"->",
"generateRandomToken",
"(",
")",
";",
"$",
"this",
"->",
"activation_token",
"=",
"hash",
"(",
"'sha256'",... | Generates a random sha265 token | [
"Generates",
"a",
"random",
"sha265",
"token"
] | 66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582 | https://github.com/tekkla/core-security/blob/66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582/Core/Security/Token/ActivationToken.php#L159-L167 | train |
etcinit/tutum-php | src/Chromabits/TutumClient/Requests/CreateServiceRequest.php | CreateServiceRequest.linkTo | public function linkTo(Service $service, $name = null)
{
$link = [
'to_service' => $service->getResourceUri()
];
if (!is_null($name)) {
$link['name'] = $name;
}
$this->linked_to_service[] = $link;
} | php | public function linkTo(Service $service, $name = null)
{
$link = [
'to_service' => $service->getResourceUri()
];
if (!is_null($name)) {
$link['name'] = $name;
}
$this->linked_to_service[] = $link;
} | [
"public",
"function",
"linkTo",
"(",
"Service",
"$",
"service",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"link",
"=",
"[",
"'to_service'",
"=>",
"$",
"service",
"->",
"getResourceUri",
"(",
")",
"]",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"... | Add a service to link to this service
@param Service $service
@param string $name | [
"Add",
"a",
"service",
"to",
"link",
"to",
"this",
"service"
] | 39fb3375e0d47109a5da70a0e441efb8fd4f4008 | https://github.com/etcinit/tutum-php/blob/39fb3375e0d47109a5da70a0e441efb8fd4f4008/src/Chromabits/TutumClient/Requests/CreateServiceRequest.php#L284-L295 | train |
erikkubica/netlime-theme-megamenu | ThemeMegaMenu.php | ThemeMegaMenu.registerFields | public function registerFields($id, $item, $depth, $args)
{
foreach ($this->fields as $_key => $data) :
$key = sprintf('menu-item-%s', $_key);
$id = sprintf('edit-%s-%s', $key, $item->ID);
$name = sprintf('%s[%s]', $key, $item->ID);
$value = get_post_meta($item->ID, $key, true);
$class = sprintf('field-%s', $_key);
?>
<p class="description description-wide <?php echo esc_attr($class) ?>">
<?php if ($data["type"] == "bool"): ?>
<label>
<?= esc_html($data["name"]) ?><br/>
<select id="<?= esc_attr($id) ?>" class="widefat <?= esc_attr($id) ?>" name="<?= esc_attr($name) ?>">
<option value="0" <?= $value !== 1 ? " selected" : "" ?>><?= __("No", "theme") ?></option>
<option value="1" <?= $value == 1 ? " selected" : "" ?>><?= __("Yes", "theme") ?></option>
</select>
</label>
<?php else: ?>
<label>
<?= esc_html($data["name"]) ?><br/>
<input type="text" id="<?= esc_attr($id) ?>" class="widefat <?= esc_attr($id) ?>" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"/>
</label>
<?php endif; ?>
</p>
<?php
endforeach;
} | php | public function registerFields($id, $item, $depth, $args)
{
foreach ($this->fields as $_key => $data) :
$key = sprintf('menu-item-%s', $_key);
$id = sprintf('edit-%s-%s', $key, $item->ID);
$name = sprintf('%s[%s]', $key, $item->ID);
$value = get_post_meta($item->ID, $key, true);
$class = sprintf('field-%s', $_key);
?>
<p class="description description-wide <?php echo esc_attr($class) ?>">
<?php if ($data["type"] == "bool"): ?>
<label>
<?= esc_html($data["name"]) ?><br/>
<select id="<?= esc_attr($id) ?>" class="widefat <?= esc_attr($id) ?>" name="<?= esc_attr($name) ?>">
<option value="0" <?= $value !== 1 ? " selected" : "" ?>><?= __("No", "theme") ?></option>
<option value="1" <?= $value == 1 ? " selected" : "" ?>><?= __("Yes", "theme") ?></option>
</select>
</label>
<?php else: ?>
<label>
<?= esc_html($data["name"]) ?><br/>
<input type="text" id="<?= esc_attr($id) ?>" class="widefat <?= esc_attr($id) ?>" name="<?= esc_attr($name) ?>" value="<?= esc_attr($value) ?>"/>
</label>
<?php endif; ?>
</p>
<?php
endforeach;
} | [
"public",
"function",
"registerFields",
"(",
"$",
"id",
",",
"$",
"item",
",",
"$",
"depth",
",",
"$",
"args",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"_key",
"=>",
"$",
"data",
")",
":",
"$",
"key",
"=",
"sprintf",
"(",... | Register fields for menu item required for mega menu
@param $id
@param $item
@param $depth
@param $args | [
"Register",
"fields",
"for",
"menu",
"item",
"required",
"for",
"mega",
"menu"
] | cd9c364fa8fcf9ca63bb17935f5af215ad234cf1 | https://github.com/erikkubica/netlime-theme-megamenu/blob/cd9c364fa8fcf9ca63bb17935f5af215ad234cf1/ThemeMegaMenu.php#L46-L73 | train |
tekkla/core-html | Core/Html/Bootstrap/Navbar/BrandElement.php | BrandElement.createImage | public function createImage($src, $alt = '')
{
/* @var $img \Core\Html\Elements\Img */
$img = $this->factory->create('Elements\Img');
$img->setSrc($src);
if (! empty($alt)) {
$img->setAlt($alt);
}
return $this->content = $img;
} | php | public function createImage($src, $alt = '')
{
/* @var $img \Core\Html\Elements\Img */
$img = $this->factory->create('Elements\Img');
$img->setSrc($src);
if (! empty($alt)) {
$img->setAlt($alt);
}
return $this->content = $img;
} | [
"public",
"function",
"createImage",
"(",
"$",
"src",
",",
"$",
"alt",
"=",
"''",
")",
"{",
"/* @var $img \\Core\\Html\\Elements\\Img */",
"$",
"img",
"=",
"$",
"this",
"->",
"factory",
"->",
"create",
"(",
"'Elements\\Img'",
")",
";",
"$",
"img",
"->",
"s... | Creates a brand imageobject and returns reference.
@param string $src
@param string $alt Optional
@return \Core\Html\Elements\Img | [
"Creates",
"a",
"brand",
"imageobject",
"and",
"returns",
"reference",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Bootstrap/Navbar/BrandElement.php#L43-L54 | train |
MarcusFulbright/represent | src/Represent/Serializer/RepresentSerializer.php | RepresentSerializer.toJson | private function toJson($object, $view = null)
{
return json_encode($this->builder->buildRepresentation($object, $view));
} | php | private function toJson($object, $view = null)
{
return json_encode($this->builder->buildRepresentation($object, $view));
} | [
"private",
"function",
"toJson",
"(",
"$",
"object",
",",
"$",
"view",
"=",
"null",
")",
"{",
"return",
"json_encode",
"(",
"$",
"this",
"->",
"builder",
"->",
"buildRepresentation",
"(",
"$",
"object",
",",
"$",
"view",
")",
")",
";",
"}"
] | Handles serializing an object to json
@param $object
@param null $view
@return string | [
"Handles",
"serializing",
"an",
"object",
"to",
"json"
] | f7b624f473a3247a29f05c4a694d04bba4038e59 | https://github.com/MarcusFulbright/represent/blob/f7b624f473a3247a29f05c4a694d04bba4038e59/src/Represent/Serializer/RepresentSerializer.php#L47-L50 | train |
flowcode/AmulenShopBundle | src/Flowcode/ShopBundle/Service/ProductService.php | ProductService.findAll | public function findAll($page = 1, $max = 50)
{
$offset = (($page - 1) * $max);
$products = $this->getEm()->getRepository("AmulenShopBundle:Product")->findBy(array(), array(), $max, $offset);
return $products;
} | php | public function findAll($page = 1, $max = 50)
{
$offset = (($page - 1) * $max);
$products = $this->getEm()->getRepository("AmulenShopBundle:Product")->findBy(array(), array(), $max, $offset);
return $products;
} | [
"public",
"function",
"findAll",
"(",
"$",
"page",
"=",
"1",
",",
"$",
"max",
"=",
"50",
")",
"{",
"$",
"offset",
"=",
"(",
"(",
"$",
"page",
"-",
"1",
")",
"*",
"$",
"max",
")",
";",
"$",
"products",
"=",
"$",
"this",
"->",
"getEm",
"(",
"... | Find al Products with pagination options.
@param integer $page [description]
@param integer $max [description]
@return ArrayCollection Products. | [
"Find",
"al",
"Products",
"with",
"pagination",
"options",
"."
] | 500aaf4364be3c42fca69ecd10a449da03993814 | https://github.com/flowcode/AmulenShopBundle/blob/500aaf4364be3c42fca69ecd10a449da03993814/src/Flowcode/ShopBundle/Service/ProductService.php#L36-L41 | train |
linkorb/pushover | src/LinkORB/Pushover/Message.php | Message.send | public function send() {
$curl_handle = curl_init();
$postfields=array();
$postfields['token'] = $this->token;
$postfields['user'] = $this->userkey;
$postfields['message'] = $this->message;
$postfields['url'] = $this->url;
$postfields['priority'] = $this->priority;
$postfields['url_title'] = $this->url_title;
$postfields['retry'] = $this->retry;
$postfields['expire'] = $this->expire;
curl_setopt_array($curl_handle,
array(
CURLOPT_URL => $this->pushover_messages_url,
CURLOPT_POSTFIELDS => $postfields,
CURLOPT_RETURNTRANSFER => true,
));
$response = curl_exec($curl_handle);
curl_close($curl_handle);
if (isset($response['status']) && $response['status'] == 1) {
return true;
}
return false;
} | php | public function send() {
$curl_handle = curl_init();
$postfields=array();
$postfields['token'] = $this->token;
$postfields['user'] = $this->userkey;
$postfields['message'] = $this->message;
$postfields['url'] = $this->url;
$postfields['priority'] = $this->priority;
$postfields['url_title'] = $this->url_title;
$postfields['retry'] = $this->retry;
$postfields['expire'] = $this->expire;
curl_setopt_array($curl_handle,
array(
CURLOPT_URL => $this->pushover_messages_url,
CURLOPT_POSTFIELDS => $postfields,
CURLOPT_RETURNTRANSFER => true,
));
$response = curl_exec($curl_handle);
curl_close($curl_handle);
if (isset($response['status']) && $response['status'] == 1) {
return true;
}
return false;
} | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"curl_handle",
"=",
"curl_init",
"(",
")",
";",
"$",
"postfields",
"=",
"array",
"(",
")",
";",
"$",
"postfields",
"[",
"'token'",
"]",
"=",
"$",
"this",
"->",
"token",
";",
"$",
"postfields",
"[",
... | Send this message
@return bool Indicates the message was send successful. | [
"Send",
"this",
"message"
] | 2063a0d13f4e54199e911110fb1baba1460d2ec9 | https://github.com/linkorb/pushover/blob/2063a0d13f4e54199e911110fb1baba1460d2ec9/src/LinkORB/Pushover/Message.php#L176-L202 | train |
crater-framework/crater-php-framework | Language.php | Language.get | public function get($value)
{
if (!empty($this->_array[$value])) {
return $this->_array[$value];
} else {
return $value;
}
} | php | public function get($value)
{
if (!empty($this->_array[$value])) {
return $this->_array[$value];
} else {
return $value;
}
} | [
"public",
"function",
"get",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_array",
"[",
"$",
"value",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_array",
"[",
"$",
"value",
"]",
";",
"}",
"else",
"{",
... | Get element from language array by key
@param string $value Key of string
@return string | [
"Get",
"element",
"from",
"language",
"array",
"by",
"key"
] | ff7a4f69f8ee7beb37adee348b67d1be84c51ff1 | https://github.com/crater-framework/crater-php-framework/blob/ff7a4f69f8ee7beb37adee348b67d1be84c51ff1/Language.php#L64-L73 | train |
crater-framework/crater-php-framework | Language.php | Language.show | public static function show($value, $name, $code = null)
{
if (is_null($code)) $code = self::$_languageCode;
// Lang file
$file = "../App/Language/$code/$name.php";
// Check if is readable
if (is_readable($file)) {
// Require file
$_array = include($file);
} else {
// Display error
echo \Core\Error::display("Could not load language file '$code/$name.php'");
die;
}
if (!empty($_array[$value])) {
return $_array[$value];
} else {
return $value;
}
} | php | public static function show($value, $name, $code = null)
{
if (is_null($code)) $code = self::$_languageCode;
// Lang file
$file = "../App/Language/$code/$name.php";
// Check if is readable
if (is_readable($file)) {
// Require file
$_array = include($file);
} else {
// Display error
echo \Core\Error::display("Could not load language file '$code/$name.php'");
die;
}
if (!empty($_array[$value])) {
return $_array[$value];
} else {
return $value;
}
} | [
"public",
"static",
"function",
"show",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"code",
")",
")",
"$",
"code",
"=",
"self",
"::",
"$",
"_languageCode",
";",
"// Lang file",
"$",
... | Get language for views
@param string $value this is "word" value from language file
@param string $name name of file with language
@param string $code optional, language code
@return string | [
"Get",
"language",
"for",
"views"
] | ff7a4f69f8ee7beb37adee348b67d1be84c51ff1 | https://github.com/crater-framework/crater-php-framework/blob/ff7a4f69f8ee7beb37adee348b67d1be84c51ff1/Language.php#L83-L110 | train |
open-orchestra/open-orchestra-bbcode-bundle | BBcodeBundle/Definition/BBcodeDefinitionFactory.php | BBcodeDefinitionFactory.create | public function create(
$tag, $html, $useOption = false, $parseContent = true,
$nestLimit = -1, array $optionValidator = array(), InputValidator $bodyValidator = null
) {
return new $this->className($tag, $html, $useOption, $parseContent, $nestLimit, $optionValidator, $bodyValidator);
} | php | public function create(
$tag, $html, $useOption = false, $parseContent = true,
$nestLimit = -1, array $optionValidator = array(), InputValidator $bodyValidator = null
) {
return new $this->className($tag, $html, $useOption, $parseContent, $nestLimit, $optionValidator, $bodyValidator);
} | [
"public",
"function",
"create",
"(",
"$",
"tag",
",",
"$",
"html",
",",
"$",
"useOption",
"=",
"false",
",",
"$",
"parseContent",
"=",
"true",
",",
"$",
"nestLimit",
"=",
"-",
"1",
",",
"array",
"$",
"optionValidator",
"=",
"array",
"(",
")",
",",
... | Create a new definition
@param string $tag
@param string $html
@param boolean $useOption
@param boolean $parseContent
@param integer $nestLimit
@param array $optionValidator
@param InputValidator $bodyValidator | [
"Create",
"a",
"new",
"definition"
] | 4c3ccd668c9b6d2f5c0c8bac384da0c2cd08ad54 | https://github.com/open-orchestra/open-orchestra-bbcode-bundle/blob/4c3ccd668c9b6d2f5c0c8bac384da0c2cd08ad54/BBcodeBundle/Definition/BBcodeDefinitionFactory.php#L33-L38 | train |
aedart/overload | src/Traits/GetterInvokerTrait.php | GetterInvokerTrait.invokeGetter | protected function invokeGetter(ReflectionProperty $property)
{
$methodName = $this->generateGetterName($property->getName());
if ($this->hasInternalMethod($methodName)) {
return $this->$methodName();
}
throw new UndefinedPropertyException(sprintf(
'No "%s"() method available for property "%s"', $methodName,
$property->getName()
));
} | php | protected function invokeGetter(ReflectionProperty $property)
{
$methodName = $this->generateGetterName($property->getName());
if ($this->hasInternalMethod($methodName)) {
return $this->$methodName();
}
throw new UndefinedPropertyException(sprintf(
'No "%s"() method available for property "%s"', $methodName,
$property->getName()
));
} | [
"protected",
"function",
"invokeGetter",
"(",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"methodName",
"=",
"$",
"this",
"->",
"generateGetterName",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasInt... | Invoke and return the given property's getter-method
@param ReflectionProperty $property The property in question
@return mixed Property value
@throws UndefinedPropertyException If given property doesn't have a corresponding get | [
"Invoke",
"and",
"return",
"the",
"given",
"property",
"s",
"getter",
"-",
"method"
] | 530a5f71454e69c58107ae864d2aa473277dcdfd | https://github.com/aedart/overload/blob/530a5f71454e69c58107ae864d2aa473277dcdfd/src/Traits/GetterInvokerTrait.php#L69-L80 | train |
aedart/overload | src/Traits/GetterInvokerTrait.php | GetterInvokerTrait.generateGetterName | protected function generateGetterName(string $propertyName) : string
{
static $methods = [];
if (isset($methods[$propertyName])) {
return $methods[$propertyName];
}
$method = 'get' . ucfirst(Str::camel($propertyName));
$methods[$propertyName] = $method;
return $method;
} | php | protected function generateGetterName(string $propertyName) : string
{
static $methods = [];
if (isset($methods[$propertyName])) {
return $methods[$propertyName];
}
$method = 'get' . ucfirst(Str::camel($propertyName));
$methods[$propertyName] = $method;
return $method;
} | [
"protected",
"function",
"generateGetterName",
"(",
"string",
"$",
"propertyName",
")",
":",
"string",
"{",
"static",
"$",
"methods",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"methods",
"[",
"$",
"propertyName",
"]",
")",
")",
"{",
"return",
"... | Generate and return a 'getter' name, based upon the given
property name
<b>Example</b><br />
<pre>
$propertyName = 'logger';
return generateGetterName($propertyName) // Returns getLogger
</pre>
@param string $propertyName Name of a given property
@return string Getter method name | [
"Generate",
"and",
"return",
"a",
"getter",
"name",
"based",
"upon",
"the",
"given",
"property",
"name"
] | 530a5f71454e69c58107ae864d2aa473277dcdfd | https://github.com/aedart/overload/blob/530a5f71454e69c58107ae864d2aa473277dcdfd/src/Traits/GetterInvokerTrait.php#L96-L108 | train |
pletfix/core | src/Services/Auth.php | Auth.loadPrincipalFromRememberMeCookie | private function loadPrincipalFromRememberMeCookie()
{
$hash = cookie('remember_me');
if ($hash === null) {
return;
}
try {
list($id, $token) = explode('|', base64_decode($hash));
}
catch (Exception $e) {
$this->deleteRememberMeCookie();
return;
}
/** @var Model $user */
$model = config('auth.model.class');
$user = call_user_func([$model, 'find'], $id);
//$user = User::find($id);
if ($user !== null && !empty($token) && $token === $user->getAttribute('remember_token')) {
$this->setPrincipal($user->getId(), $user->getAttribute('name'), $user->getAttribute('role'));
}
} | php | private function loadPrincipalFromRememberMeCookie()
{
$hash = cookie('remember_me');
if ($hash === null) {
return;
}
try {
list($id, $token) = explode('|', base64_decode($hash));
}
catch (Exception $e) {
$this->deleteRememberMeCookie();
return;
}
/** @var Model $user */
$model = config('auth.model.class');
$user = call_user_func([$model, 'find'], $id);
//$user = User::find($id);
if ($user !== null && !empty($token) && $token === $user->getAttribute('remember_token')) {
$this->setPrincipal($user->getId(), $user->getAttribute('name'), $user->getAttribute('role'));
}
} | [
"private",
"function",
"loadPrincipalFromRememberMeCookie",
"(",
")",
"{",
"$",
"hash",
"=",
"cookie",
"(",
"'remember_me'",
")",
";",
"if",
"(",
"$",
"hash",
"===",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"list",
"(",
"$",
"id",
",",
"$",
... | Read the "remember me" cookie if exist and store the principal into the session. | [
"Read",
"the",
"remember",
"me",
"cookie",
"if",
"exist",
"and",
"store",
"the",
"principal",
"into",
"the",
"session",
"."
] | 974945500f278eb6c1779832e08bbfca1007a7b3 | https://github.com/pletfix/core/blob/974945500f278eb6c1779832e08bbfca1007a7b3/src/Services/Auth.php#L98-L120 | train |
pletfix/core | src/Services/Auth.php | Auth.getAbilities | private function getAbilities($role)
{
$abilities = [];
foreach (config('auth.acl') as $ability => $roles) {
if (in_array($role, $roles)) {
$abilities[] = $ability;
}
}
return $abilities;
} | php | private function getAbilities($role)
{
$abilities = [];
foreach (config('auth.acl') as $ability => $roles) {
if (in_array($role, $roles)) {
$abilities[] = $ability;
}
}
return $abilities;
} | [
"private",
"function",
"getAbilities",
"(",
"$",
"role",
")",
"{",
"$",
"abilities",
"=",
"[",
"]",
";",
"foreach",
"(",
"config",
"(",
"'auth.acl'",
")",
"as",
"$",
"ability",
"=>",
"$",
"roles",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"role",
... | Read the abilities from the ACL for the given role.
@param $role
@return array | [
"Read",
"the",
"abilities",
"from",
"the",
"ACL",
"for",
"the",
"given",
"role",
"."
] | 974945500f278eb6c1779832e08bbfca1007a7b3 | https://github.com/pletfix/core/blob/974945500f278eb6c1779832e08bbfca1007a7b3/src/Services/Auth.php#L145-L155 | train |
pletfix/core | src/Services/Auth.php | Auth.attribute | private function attribute($key)
{
if ($this->attributes === null) {
$this->attributes = session('_auth', []);
if (empty($this->attributes)) {
$this->loadPrincipalFromRememberMeCookie();
}
}
return isset($this->attributes[$key]) ? $this->attributes[$key] : null;
} | php | private function attribute($key)
{
if ($this->attributes === null) {
$this->attributes = session('_auth', []);
if (empty($this->attributes)) {
$this->loadPrincipalFromRememberMeCookie();
}
}
return isset($this->attributes[$key]) ? $this->attributes[$key] : null;
} | [
"private",
"function",
"attribute",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"attributes",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"session",
"(",
"'_auth'",
",",
"[",
"]",
")",
";",
"if",
"(",
"empty",
"(",
... | Load the user attributes from the session and get the attribute.
@param string $key
@return mixed | [
"Load",
"the",
"user",
"attributes",
"from",
"the",
"session",
"and",
"get",
"the",
"attribute",
"."
] | 974945500f278eb6c1779832e08bbfca1007a7b3 | https://github.com/pletfix/core/blob/974945500f278eb6c1779832e08bbfca1007a7b3/src/Services/Auth.php#L163-L173 | train |
n0m4dz/laracasa | Zend/Gdata/Books.php | Zend_Gdata_Books.getVolumeFeed | public function getVolumeFeed($location = null)
{
if ($location == null) {
$uri = self::VOLUME_FEED_URI;
} else if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | php | public function getVolumeFeed($location = null)
{
if ($location == null) {
$uri = self::VOLUME_FEED_URI;
} else if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | [
"public",
"function",
"getVolumeFeed",
"(",
"$",
"location",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"location",
"==",
"null",
")",
"{",
"$",
"uri",
"=",
"self",
"::",
"VOLUME_FEED_URI",
";",
"}",
"else",
"if",
"(",
"$",
"location",
"instanceof",
"Zend_... | Retrieves a feed of volumes.
@param Zend_Gdata_Query|string|null $location (optional) The URL to
query or a Zend_Gdata_Query object from which a URL can be
determined.
@return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
specified URL. | [
"Retrieves",
"a",
"feed",
"of",
"volumes",
"."
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Books.php#L104-L114 | train |
n0m4dz/laracasa | Zend/Gdata/Books.php | Zend_Gdata_Books.getVolumeEntry | public function getVolumeEntry($volumeId = null, $location = null)
{
if ($volumeId !== null) {
$uri = self::VOLUME_FEED_URI . "/" . $volumeId;
} else if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry');
} | php | public function getVolumeEntry($volumeId = null, $location = null)
{
if ($volumeId !== null) {
$uri = self::VOLUME_FEED_URI . "/" . $volumeId;
} else if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry');
} | [
"public",
"function",
"getVolumeEntry",
"(",
"$",
"volumeId",
"=",
"null",
",",
"$",
"location",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"volumeId",
"!==",
"null",
")",
"{",
"$",
"uri",
"=",
"self",
"::",
"VOLUME_FEED_URI",
".",
"\"/\"",
".",
"$",
"vo... | Retrieves a specific volume entry.
@param string|null $volumeId The volumeId of interest.
@param Zend_Gdata_Query|string|null $location (optional) The URL to
query or a Zend_Gdata_Query object from which a URL can be
determined.
@return Zend_Gdata_Books_VolumeEntry The feed of volumes found at the
specified URL. | [
"Retrieves",
"a",
"specific",
"volume",
"entry",
"."
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Books.php#L126-L136 | train |
n0m4dz/laracasa | Zend/Gdata/Books.php | Zend_Gdata_Books.getUserLibraryFeed | public function getUserLibraryFeed($location = null)
{
if ($location == null) {
$uri = self::MY_LIBRARY_FEED_URI;
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | php | public function getUserLibraryFeed($location = null)
{
if ($location == null) {
$uri = self::MY_LIBRARY_FEED_URI;
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | [
"public",
"function",
"getUserLibraryFeed",
"(",
"$",
"location",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"location",
"==",
"null",
")",
"{",
"$",
"uri",
"=",
"self",
"::",
"MY_LIBRARY_FEED_URI",
";",
"}",
"else",
"{",
"$",
"uri",
"=",
"$",
"location",
... | Retrieves a feed of volumes, by default the User library feed.
@param Zend_Gdata_Query|string|null $location (optional) The URL to
query.
@return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
specified URL. | [
"Retrieves",
"a",
"feed",
"of",
"volumes",
"by",
"default",
"the",
"User",
"library",
"feed",
"."
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Books.php#L146-L154 | train |
n0m4dz/laracasa | Zend/Gdata/Books.php | Zend_Gdata_Books.getUserAnnotationFeed | public function getUserAnnotationFeed($location = null)
{
if ($location == null) {
$uri = self::MY_ANNOTATION_FEED_URI;
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | php | public function getUserAnnotationFeed($location = null)
{
if ($location == null) {
$uri = self::MY_ANNOTATION_FEED_URI;
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
} | [
"public",
"function",
"getUserAnnotationFeed",
"(",
"$",
"location",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"location",
"==",
"null",
")",
"{",
"$",
"uri",
"=",
"self",
"::",
"MY_ANNOTATION_FEED_URI",
";",
"}",
"else",
"{",
"$",
"uri",
"=",
"$",
"locat... | Retrieves a feed of volumes, by default the User annotation feed
@param Zend_Gdata_Query|string|null $location (optional) The URL to
query.
@return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
specified URL. | [
"Retrieves",
"a",
"feed",
"of",
"volumes",
"by",
"default",
"the",
"User",
"annotation",
"feed"
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Books.php#L164-L172 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.findFilter | private function findFilter($filterId) {
foreach(filter_list() as $filterName) {
if(filter_id($filterName)===$filterId) {
return $filterName;
}
}
throw new \Exception('Could not find filter '.$filterId);
} | php | private function findFilter($filterId) {
foreach(filter_list() as $filterName) {
if(filter_id($filterName)===$filterId) {
return $filterName;
}
}
throw new \Exception('Could not find filter '.$filterId);
} | [
"private",
"function",
"findFilter",
"(",
"$",
"filterId",
")",
"{",
"foreach",
"(",
"filter_list",
"(",
")",
"as",
"$",
"filterName",
")",
"{",
"if",
"(",
"filter_id",
"(",
"$",
"filterName",
")",
"===",
"$",
"filterId",
")",
"{",
"return",
"$",
"filt... | Finds the filter name by filter id
@param int $filterId
@return string
@throws SanitizationException | [
"Finds",
"the",
"filter",
"name",
"by",
"filter",
"id"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L102-L110 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.setSanitizeFilter | public function setSanitizeFilter($filter) {
$this->filterName = $this->findFilter($filter);
$this->sanitizeFilter = $filter;
} | php | public function setSanitizeFilter($filter) {
$this->filterName = $this->findFilter($filter);
$this->sanitizeFilter = $filter;
} | [
"public",
"function",
"setSanitizeFilter",
"(",
"$",
"filter",
")",
"{",
"$",
"this",
"->",
"filterName",
"=",
"$",
"this",
"->",
"findFilter",
"(",
"$",
"filter",
")",
";",
"$",
"this",
"->",
"sanitizeFilter",
"=",
"$",
"filter",
";",
"}"
] | Sets sanitization filter
@param int $filter | [
"Sets",
"sanitization",
"filter"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L117-L120 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.filter | public function filter($value) {
return $this->checkSanitizedValue(filter_var($value, $this->sanitizeFilter, $this->sanitizeFlags));
} | php | public function filter($value) {
return $this->checkSanitizedValue(filter_var($value, $this->sanitizeFilter, $this->sanitizeFlags));
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"checkSanitizedValue",
"(",
"filter_var",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"sanitizeFilter",
",",
"$",
"this",
"->",
"sanitizeFlags",
")",
")",
";",
"}"
] | Sanitizes the value with the sanitization filter and flags assigned to this sanitizer
@param mixed $value The value to filter
@return mixed
@throws SanitizationException | [
"Sanitizes",
"the",
"value",
"with",
"the",
"sanitization",
"filter",
"and",
"flags",
"assigned",
"to",
"this",
"sanitizer"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L176-L178 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.filterEnv | public function filterEnv($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!$this->filterHas(\INPUT_ENV, $variableName)) {
return null;
}
// Sadly INPUT_ENV is broken and does not work
// getenv() has to be used
return $this->filter(getenv($variableName));
} | php | public function filterEnv($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!$this->filterHas(\INPUT_ENV, $variableName)) {
return null;
}
// Sadly INPUT_ENV is broken and does not work
// getenv() has to be used
return $this->filter(getenv($variableName));
} | [
"public",
"function",
"filterEnv",
"(",
"$",
"variableName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"variableName",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Variable name expected as string'",
")",
";",
"}",
"if",
"(",
"!",
"$",
... | Sanitizes a ENV-variable
Returns null, if the variable does not exist
@param string $variableName
@return mixed | [
"Sanitizes",
"a",
"ENV",
"-",
"variable"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L261-L273 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.filterSession | public function filterSession($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!isset($_SESSION[$variableName])) {
return null;
}
return $this->filter($_SESSION[$variableName]);
} | php | public function filterSession($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!isset($_SESSION[$variableName])) {
return null;
}
return $this->filter($_SESSION[$variableName]);
} | [
"public",
"function",
"filterSession",
"(",
"$",
"variableName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"variableName",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Variable name expected as string'",
")",
";",
"}",
"if",
"(",
"!",
"i... | Sanitizes a SESSION-variable
Experimental.
Returns null, if the variable does not exist
@param string $variableName
@return mixed | [
"Sanitizes",
"a",
"SESSION",
"-",
"variable"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L285-L295 | train |
broeser/sanitor | src/Sanitizer.php | Sanitizer.filterRequest | public function filterRequest($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!isset($_REQUEST[$variableName])) {
return null;
}
return $this->filter($_REQUEST[$variableName]);
} | php | public function filterRequest($variableName) {
if(!is_string($variableName)) {
throw new \Exception('Variable name expected as string');
}
if(!isset($_REQUEST[$variableName])) {
return null;
}
return $this->filter($_REQUEST[$variableName]);
} | [
"public",
"function",
"filterRequest",
"(",
"$",
"variableName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"variableName",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Variable name expected as string'",
")",
";",
"}",
"if",
"(",
"!",
"i... | Sanitizes a REQUEST-variable
Experimental.
Returns null, if the variable does not exist
@param string $variableName
@return mixed | [
"Sanitizes",
"a",
"REQUEST",
"-",
"variable"
] | 580e539a2747e3d66527cbbde968004743481a5c | https://github.com/broeser/sanitor/blob/580e539a2747e3d66527cbbde968004743481a5c/src/Sanitizer.php#L307-L317 | train |
Flowpack/Flowpack.SingleSignOn.DemoInstance | Classes/Flowpack/SingleSignOn/DemoInstance/Controller/ConfigurationController.php | ConfigurationController.indexAction | public function indexAction() {
$clientSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Flowpack.SingleSignOn.Client');
$clientSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($clientSettings, 99, 2);
$this->view->assign('clientSettings', $clientSettingsYaml);
$authenticationSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication');
$authenticationSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($authenticationSettings, 99, 2);
$this->view->assign('authenticationSettings', $authenticationSettingsYaml);
} | php | public function indexAction() {
$clientSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Flowpack.SingleSignOn.Client');
$clientSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($clientSettings, 99, 2);
$this->view->assign('clientSettings', $clientSettingsYaml);
$authenticationSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication');
$authenticationSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($authenticationSettings, 99, 2);
$this->view->assign('authenticationSettings', $authenticationSettingsYaml);
} | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"clientSettings",
"=",
"$",
"this",
"->",
"configurationManager",
"->",
"getConfiguration",
"(",
"\\",
"TYPO3",
"\\",
"Flow",
"\\",
"Configuration",
"\\",
"ConfigurationManager",
"::",
"CONFIGURATION_TYPE_SETT... | Display configuration of client | [
"Display",
"configuration",
"of",
"client"
] | a3de8fef092cec34e2577832576e32b37ca507c5 | https://github.com/Flowpack/Flowpack.SingleSignOn.DemoInstance/blob/a3de8fef092cec34e2577832576e32b37ca507c5/Classes/Flowpack/SingleSignOn/DemoInstance/Controller/ConfigurationController.php#L32-L40 | train |
vinala/kernel | src/Atomium/Compiler/AtomiumCompileInstructions.php | AtomiumCompileInstructions.open | protected static function open($script, $openTag, $closeChar, $phpFunc, $phpClose)
{
//
$data = Strings::splite($script, $openTag);
//
$output = $data[0];
//
for ($i = 1; $i < Collection::count($data); $i++) {
$items = self::getParmas($data[$i], $closeChar);
//
$params = $items['params'];
$rest = $items['rest'];
//
$output .= self::compile($params, $phpFunc, $phpClose);
$output .= $rest;
}
//
return $output;
} | php | protected static function open($script, $openTag, $closeChar, $phpFunc, $phpClose)
{
//
$data = Strings::splite($script, $openTag);
//
$output = $data[0];
//
for ($i = 1; $i < Collection::count($data); $i++) {
$items = self::getParmas($data[$i], $closeChar);
//
$params = $items['params'];
$rest = $items['rest'];
//
$output .= self::compile($params, $phpFunc, $phpClose);
$output .= $rest;
}
//
return $output;
} | [
"protected",
"static",
"function",
"open",
"(",
"$",
"script",
",",
"$",
"openTag",
",",
"$",
"closeChar",
",",
"$",
"phpFunc",
",",
"$",
"phpClose",
")",
"{",
"//",
"$",
"data",
"=",
"Strings",
"::",
"splite",
"(",
"$",
"script",
",",
"$",
"openTag"... | To compile de open tag.
@var string, string, string, string, string
@return string | [
"To",
"compile",
"de",
"open",
"tag",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Atomium/Compiler/AtomiumCompileInstructions.php#L47-L66 | train |
vinala/kernel | src/Atomium/Compiler/AtomiumCompileInstructions.php | AtomiumCompileInstructions.getParmas | protected static function getParmas($row, $closeChar)
{
$params = '';
$rest = '';
$taken = false;
$string = false; // 1 "" - 2 ''
$opened = 0; // 1 "" - 2 ''
//
for ($j = 0; $j < strlen($row); $j++) {
//
if ($row[$j] == "'" && !$string) {
$string = 2;
} elseif ($row[$j] == '"' && !$string) {
$string = 1;
} elseif ($row[$j] == "'" && $string) {
$string = false;
} elseif ($row[$j] == '"' && $string) {
$string = false;
}
//
if ($row[$j] == '(') {
$opened++;
} elseif ($row[$j] == ')') {
$opened--;
}
//
if (!$string && $opened == 0 && $row[$j] == $closeChar && !$taken) {
$taken = true;
} elseif (!$taken) {
$params .= $row[$j];
} elseif ($taken) {
$rest .= $row[$j];
}
}
//
return ['params' => $params, 'rest' => $rest];
} | php | protected static function getParmas($row, $closeChar)
{
$params = '';
$rest = '';
$taken = false;
$string = false; // 1 "" - 2 ''
$opened = 0; // 1 "" - 2 ''
//
for ($j = 0; $j < strlen($row); $j++) {
//
if ($row[$j] == "'" && !$string) {
$string = 2;
} elseif ($row[$j] == '"' && !$string) {
$string = 1;
} elseif ($row[$j] == "'" && $string) {
$string = false;
} elseif ($row[$j] == '"' && $string) {
$string = false;
}
//
if ($row[$j] == '(') {
$opened++;
} elseif ($row[$j] == ')') {
$opened--;
}
//
if (!$string && $opened == 0 && $row[$j] == $closeChar && !$taken) {
$taken = true;
} elseif (!$taken) {
$params .= $row[$j];
} elseif ($taken) {
$rest .= $row[$j];
}
}
//
return ['params' => $params, 'rest' => $rest];
} | [
"protected",
"static",
"function",
"getParmas",
"(",
"$",
"row",
",",
"$",
"closeChar",
")",
"{",
"$",
"params",
"=",
"''",
";",
"$",
"rest",
"=",
"''",
";",
"$",
"taken",
"=",
"false",
";",
"$",
"string",
"=",
"false",
";",
"// 1 \"\" - 2 ''",
"$",
... | Get Fucntion params and the rest of script.
@var string, string
@return array | [
"Get",
"Fucntion",
"params",
"and",
"the",
"rest",
"of",
"script",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Atomium/Compiler/AtomiumCompileInstructions.php#L75-L111 | train |
BuildrPHP/Utils | src/Enumeration/EnumerationBase.php | EnumerationBase.toArray | public static function toArray() {
$enumClass = get_called_class();
if(!array_key_exists($enumClass, self::$cache)) {
$reflector = new ReflectionClass($enumClass);
self::$cache[$enumClass] = $reflector->getConstants();
}
return self::$cache[$enumClass];
} | php | public static function toArray() {
$enumClass = get_called_class();
if(!array_key_exists($enumClass, self::$cache)) {
$reflector = new ReflectionClass($enumClass);
self::$cache[$enumClass] = $reflector->getConstants();
}
return self::$cache[$enumClass];
} | [
"public",
"static",
"function",
"toArray",
"(",
")",
"{",
"$",
"enumClass",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"enumClass",
",",
"self",
"::",
"$",
"cache",
")",
")",
"{",
"$",
"reflector",
"=",
"new",... | Translate the current enumeration to an associative array
@return array | [
"Translate",
"the",
"current",
"enumeration",
"to",
"an",
"associative",
"array"
] | e3b1b9e58f3ebc644e1b9f3838c69936812fc53c | https://github.com/BuildrPHP/Utils/blob/e3b1b9e58f3ebc644e1b9f3838c69936812fc53c/src/Enumeration/EnumerationBase.php#L72-L81 | train |
BuildrPHP/Utils | src/Enumeration/EnumerationBase.php | EnumerationBase.isValidKey | public static function isValidKey($key) {
if(!is_string($key)) {
throw EnumerationException::invalidKeyType(gettype($key));
}
return array_key_exists($key, self::toArray());
} | php | public static function isValidKey($key) {
if(!is_string($key)) {
throw EnumerationException::invalidKeyType(gettype($key));
}
return array_key_exists($key, self::toArray());
} | [
"public",
"static",
"function",
"isValidKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"EnumerationException",
"::",
"invalidKeyType",
"(",
"gettype",
"(",
"$",
"key",
")",
")",
";",
"}",
"return"... | Determines that the given key is exist in the current enumeration or not.
@param string $key
@return bool
@throws \BuildR\Utils\Enumeration\Exception\EnumerationException | [
"Determines",
"that",
"the",
"given",
"key",
"is",
"exist",
"in",
"the",
"current",
"enumeration",
"or",
"not",
"."
] | e3b1b9e58f3ebc644e1b9f3838c69936812fc53c | https://github.com/BuildrPHP/Utils/blob/e3b1b9e58f3ebc644e1b9f3838c69936812fc53c/src/Enumeration/EnumerationBase.php#L101-L107 | train |
OWeb/OWeb-Framework | OWeb/manage/Template.php | Template.prepareDisplay | private function prepareDisplay()
{
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Start@OWeb\manage\Template');
//We save the content so that if there is an error we don't show half displayed codes
ob_start();
try {
\OWeb\manage\Controller::getInstance()->display();
} catch (\Exception $e) {
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Fail@OWeb\manage\Template');
ob_end_clean();
ob_start();
$ctr = \OWeb\manage\Controller::getInstance()->loadException($e);
$ctr->addParams("exception", $e);
\OWeb\manage\Controller::getInstance()->display();
}
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Succ@OWeb\manage\Template');
$this->content = ob_get_contents();
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_End@OWeb\manage\Template');
ob_end_clean();
//$this->content_heads = \OWeb\manage\Headers::getInstance()->toString();
// \OWeb\manage\Headers::getInstance()->reset();
} | php | private function prepareDisplay()
{
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Start@OWeb\manage\Template');
//We save the content so that if there is an error we don't show half displayed codes
ob_start();
try {
\OWeb\manage\Controller::getInstance()->display();
} catch (\Exception $e) {
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Fail@OWeb\manage\Template');
ob_end_clean();
ob_start();
$ctr = \OWeb\manage\Controller::getInstance()->loadException($e);
$ctr->addParams("exception", $e);
\OWeb\manage\Controller::getInstance()->display();
}
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Succ@OWeb\manage\Template');
$this->content = ob_get_contents();
\OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_End@OWeb\manage\Template');
ob_end_clean();
//$this->content_heads = \OWeb\manage\Headers::getInstance()->toString();
// \OWeb\manage\Headers::getInstance()->reset();
} | [
"private",
"function",
"prepareDisplay",
"(",
")",
"{",
"\\",
"OWeb",
"\\",
"manage",
"\\",
"Events",
"::",
"getInstance",
"(",
")",
"->",
"sendEvent",
"(",
"'PrepareContent_Start@OWeb\\manage\\Template'",
")",
";",
"//We save the content so that if there is an error we d... | Will get the output of the current controller to display it later on. | [
"Will",
"get",
"the",
"output",
"of",
"the",
"current",
"controller",
"to",
"display",
"it",
"later",
"on",
"."
] | fb441f51afb16860b0c946a55c36c789fbb125fa | https://github.com/OWeb/OWeb-Framework/blob/fb441f51afb16860b0c946a55c36c789fbb125fa/OWeb/manage/Template.php#L89-L117 | train |
pdenis/SnideTravinizerBundle | DependencyInjection/SnideTravinizerExtension.php | SnideTravinizerExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('model.xml');
$loader->load('form.xml');
$loader->load('helper.xml');
$loader->load('reader.xml');
$loader->load('converter.xml');
$loader->load('loader.xml');
$loader->load('manager.xml');
$loader->load('twig_extension.xml');
$loader->load('validator.xml');
$loader->load('cache.xml');
$this->loadRepository($loader, $container, $config);
$this->loadManager($loader, $container, $config);
$this->loadRepoClass($loader, $container, $config);
$this->loadCachePath($container, $config);
$this->loadVersionEyeKey($container, $config);
} | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('model.xml');
$loader->load('form.xml');
$loader->load('helper.xml');
$loader->load('reader.xml');
$loader->load('converter.xml');
$loader->load('loader.xml');
$loader->load('manager.xml');
$loader->load('twig_extension.xml');
$loader->load('validator.xml');
$loader->load('cache.xml');
$this->loadRepository($loader, $container, $config);
$this->loadManager($loader, $container, $config);
$this->loadRepoClass($loader, $container, $config);
$this->loadCachePath($container, $config);
$this->loadVersionEyeKey($container, $config);
} | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"con... | Load configuration of Bundle
@param array $configs Configuration parameters
@param \Symfony\Component\DependencyInjection\ContainerBuilder $container
@throws \Exception | [
"Load",
"configuration",
"of",
"Bundle"
] | 53a6fd647280d81a496018d379e4b5c446f81729 | https://github.com/pdenis/SnideTravinizerBundle/blob/53a6fd647280d81a496018d379e4b5c446f81729/DependencyInjection/SnideTravinizerExtension.php#L34-L56 | train |
pdenis/SnideTravinizerBundle | DependencyInjection/SnideTravinizerExtension.php | SnideTravinizerExtension.loadRepoClass | protected function loadRepoClass($loader, ContainerBuilder $container, array $config)
{
if (isset($config['repository']['repo']['class'])) {
$container->setParameter('snide_travinizer.model.repo.class', $config['repository']['repo']['class']);
}
} | php | protected function loadRepoClass($loader, ContainerBuilder $container, array $config)
{
if (isset($config['repository']['repo']['class'])) {
$container->setParameter('snide_travinizer.model.repo.class', $config['repository']['repo']['class']);
}
} | [
"protected",
"function",
"loadRepoClass",
"(",
"$",
"loader",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'repository'",
"]",
"[",
"'repo'",
"]",
"[",
"'class'",
"]",
")"... | Load repoClass entity
@param XmlFileLoader $loader
@param ContainerBuilder $container
@param array $config
@throws \Exception | [
"Load",
"repoClass",
"entity"
] | 53a6fd647280d81a496018d379e4b5c446f81729 | https://github.com/pdenis/SnideTravinizerBundle/blob/53a6fd647280d81a496018d379e4b5c446f81729/DependencyInjection/SnideTravinizerExtension.php#L114-L120 | train |
shov/wpci-core | Render/View.php | View.display | public function display(string $key, array $data, int $status = RegularResponse::HTTP_OK): ResponseInterface
{
$content = $this->templateStrategy->render($key, $data);
$this->responseStrategy->setContent($content);
$this->responseStrategy->setStatusCode($status);
return $this->responseStrategy;
} | php | public function display(string $key, array $data, int $status = RegularResponse::HTTP_OK): ResponseInterface
{
$content = $this->templateStrategy->render($key, $data);
$this->responseStrategy->setContent($content);
$this->responseStrategy->setStatusCode($status);
return $this->responseStrategy;
} | [
"public",
"function",
"display",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"data",
",",
"int",
"$",
"status",
"=",
"RegularResponse",
"::",
"HTTP_OK",
")",
":",
"ResponseInterface",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"templateStrategy",
"->",... | Make templating and give the response
@param string $key
@param array $data
@param int $status
@return RegularResponse | [
"Make",
"templating",
"and",
"give",
"the",
"response"
] | e31084cbc2f310882df2b9b0548330ea5fdb4f26 | https://github.com/shov/wpci-core/blob/e31084cbc2f310882df2b9b0548330ea5fdb4f26/Render/View.php#L39-L46 | train |
indigophp-archive/codeception-fuel-module | fuel/fuel/packages/orm/classes/observer/createdat.php | Observer_CreatedAt.before_insert | public function before_insert(Model $obj)
{
if ($this->_overwrite or empty($obj->{$this->_property}))
{
$obj->{$this->_property} = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
}
} | php | public function before_insert(Model $obj)
{
if ($this->_overwrite or empty($obj->{$this->_property}))
{
$obj->{$this->_property} = $this->_mysql_timestamp ? \Date::time()->format('mysql') : \Date::time()->get_timestamp();
}
} | [
"public",
"function",
"before_insert",
"(",
"Model",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_overwrite",
"or",
"empty",
"(",
"$",
"obj",
"->",
"{",
"$",
"this",
"->",
"_property",
"}",
")",
")",
"{",
"$",
"obj",
"->",
"{",
"$",
"thi... | Set the CreatedAt property to the current time.
@param Model Model object subject of this observer method | [
"Set",
"the",
"CreatedAt",
"property",
"to",
"the",
"current",
"time",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/packages/orm/classes/observer/createdat.php#L67-L73 | train |
heyday/heystack-ecommerce-core | src/Transaction/Subscriber.php | Subscriber.getSubscribedEvents | public static function getSubscribedEvents()
{
return [
Events::UPDATE => ['onUpdate',0],
Events::STORE => ['onStore', 0],
sprintf('%s.%s', Backend::IDENTIFIER, TransactionEvents::STORED) => ['onTransactionStored', 0]
];
} | php | public static function getSubscribedEvents()
{
return [
Events::UPDATE => ['onUpdate',0],
Events::STORE => ['onStore', 0],
sprintf('%s.%s', Backend::IDENTIFIER, TransactionEvents::STORED) => ['onTransactionStored', 0]
];
} | [
"public",
"static",
"function",
"getSubscribedEvents",
"(",
")",
"{",
"return",
"[",
"Events",
"::",
"UPDATE",
"=>",
"[",
"'onUpdate'",
",",
"0",
"]",
",",
"Events",
"::",
"STORE",
"=>",
"[",
"'onStore'",
",",
"0",
"]",
",",
"sprintf",
"(",
"'%s.%s'",
... | Returns an array of events to subscribe to and the methods to call when those events are fired
@return array | [
"Returns",
"an",
"array",
"of",
"events",
"to",
"subscribe",
"to",
"and",
"the",
"methods",
"to",
"call",
"when",
"those",
"events",
"are",
"fired"
] | b56c83839cd3396da6bc881d843fcb4f28b74685 | https://github.com/heyday/heystack-ecommerce-core/blob/b56c83839cd3396da6bc881d843fcb4f28b74685/src/Transaction/Subscriber.php#L68-L75 | train |
glynnforrest/reform | src/Reform/Form/Row/AbstractRow.php | AbstractRow.submitForm | public function submitForm(array $values)
{
$this->value = isset($values[$this->name]) ? $values[$this->name] : null;
} | php | public function submitForm(array $values)
{
$this->value = isset($values[$this->name]) ? $values[$this->name] : null;
} | [
"public",
"function",
"submitForm",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"isset",
"(",
"$",
"values",
"[",
"$",
"this",
"->",
"name",
"]",
")",
"?",
"$",
"values",
"[",
"$",
"this",
"->",
"name",
"]",
":",
"null... | Pass in submitted values to allow the row to assign any values
that are required.
@param array $values The values | [
"Pass",
"in",
"submitted",
"values",
"to",
"allow",
"the",
"row",
"to",
"assign",
"any",
"values",
"that",
"are",
"required",
"."
] | a2a33dfa73933875f9c1dd0691b21e678a541a9e | https://github.com/glynnforrest/reform/blob/a2a33dfa73933875f9c1dd0691b21e678a541a9e/src/Reform/Form/Row/AbstractRow.php#L213-L216 | train |
jmpantoja/planb-utils | src/DS/Resolver/Rule/Loader.php | Loader.resolve | protected function resolve(Input $input): Input
{
$this->call($input->value());
$input->ignore();
return $input;
} | php | protected function resolve(Input $input): Input
{
$this->call($input->value());
$input->ignore();
return $input;
} | [
"protected",
"function",
"resolve",
"(",
"Input",
"$",
"input",
")",
":",
"Input",
"{",
"$",
"this",
"->",
"call",
"(",
"$",
"input",
"->",
"value",
"(",
")",
")",
";",
"$",
"input",
"->",
"ignore",
"(",
")",
";",
"return",
"$",
"input",
";",
"}"... | Resuelve un input
@param \PlanB\DS\Resolver\Input $input
@return \PlanB\DS\Resolver\Input
@throws \Throwable | [
"Resuelve",
"un",
"input"
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Resolver/Rule/Loader.php#L33-L39 | train |
fireguard/form | src/Form/Elements/AbstractElement.php | AbstractElement.makeElement | protected function makeElement(array $options, $html)
{
if (isset($options['type']) && $options['type'] == 'hidden') return $html;
if (!empty($options['before-input'])) $html = $options['before-input'].$html;
$html = $this->getLabel($options).$html;
if (!empty($options['after-input'])) $html .= $options['after-input'];
$html .= $this->html->getDivError($options);
$html = $this->html->getFormGroup($options, $html);
if (!empty($options['script'])) $this->appendScript($options['script']);
if (!empty($options['mask'])) $this->appendScript($this->html->getMaskScript($options));
return $this->html->getGrid($options, $html);
} | php | protected function makeElement(array $options, $html)
{
if (isset($options['type']) && $options['type'] == 'hidden') return $html;
if (!empty($options['before-input'])) $html = $options['before-input'].$html;
$html = $this->getLabel($options).$html;
if (!empty($options['after-input'])) $html .= $options['after-input'];
$html .= $this->html->getDivError($options);
$html = $this->html->getFormGroup($options, $html);
if (!empty($options['script'])) $this->appendScript($options['script']);
if (!empty($options['mask'])) $this->appendScript($this->html->getMaskScript($options));
return $this->html->getGrid($options, $html);
} | [
"protected",
"function",
"makeElement",
"(",
"array",
"$",
"options",
",",
"$",
"html",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'type'",
"]",
")",
"&&",
"$",
"options",
"[",
"'type'",
"]",
"==",
"'hidden'",
")",
"return",
"$",
"html"... | Make an Element
@param array $options
@param $html
@return string | [
"Make",
"an",
"Element"
] | cae5b36e165083fd553e596171356284f6edc4d4 | https://github.com/fireguard/form/blob/cae5b36e165083fd553e596171356284f6edc4d4/src/Form/Elements/AbstractElement.php#L164-L178 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.Initialize | public static function Initialize($ForceEnable = FALSE, $ForceMethod = FALSE) {
$AllowCaching = self::ActiveEnabled($ForceEnable);
$ActiveCache = Gdn_Cache::ActiveCache();
if ($ForceMethod !== FALSE) $ActiveCache = $ForceMethod;
$ActiveCacheClass = 'Gdn_'.ucfirst($ActiveCache);
if (!$AllowCaching || !$ActiveCache || !class_exists($ActiveCacheClass)) {
$CacheObject = new Gdn_Dirtycache();
} else
$CacheObject = new $ActiveCacheClass();
if (method_exists($CacheObject,'Autorun'))
$CacheObject->Autorun();
// This should only fire when cache is loading automatically
if (!func_num_args() && Gdn::PluginManager() instanceof Gdn_PluginManager)
Gdn::PluginManager()->FireEvent('AfterActiveCache');
return $CacheObject;
} | php | public static function Initialize($ForceEnable = FALSE, $ForceMethod = FALSE) {
$AllowCaching = self::ActiveEnabled($ForceEnable);
$ActiveCache = Gdn_Cache::ActiveCache();
if ($ForceMethod !== FALSE) $ActiveCache = $ForceMethod;
$ActiveCacheClass = 'Gdn_'.ucfirst($ActiveCache);
if (!$AllowCaching || !$ActiveCache || !class_exists($ActiveCacheClass)) {
$CacheObject = new Gdn_Dirtycache();
} else
$CacheObject = new $ActiveCacheClass();
if (method_exists($CacheObject,'Autorun'))
$CacheObject->Autorun();
// This should only fire when cache is loading automatically
if (!func_num_args() && Gdn::PluginManager() instanceof Gdn_PluginManager)
Gdn::PluginManager()->FireEvent('AfterActiveCache');
return $CacheObject;
} | [
"public",
"static",
"function",
"Initialize",
"(",
"$",
"ForceEnable",
"=",
"FALSE",
",",
"$",
"ForceMethod",
"=",
"FALSE",
")",
"{",
"$",
"AllowCaching",
"=",
"self",
"::",
"ActiveEnabled",
"(",
"$",
"ForceEnable",
")",
";",
"$",
"ActiveCache",
"=",
"Gdn_... | Determines the currently installed cache solution and returns a fresh instance of its object
@return Gdn_Cache | [
"Determines",
"the",
"currently",
"installed",
"cache",
"solution",
"and",
"returns",
"a",
"fresh",
"instance",
"of",
"its",
"object"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L138-L159 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.ActiveCache | public static function ActiveCache() {
/*
* There is a catch 22 with caching the config file. We need
* an external way to define the cache layer before needing it
* in the config.
*/
if (defined('CACHE_METHOD_OVERRIDE'))
$ActiveCache = CACHE_METHOD_OVERRIDE;
else
$ActiveCache = C('Cache.Method', FALSE);
// This should only fire when cache is loading automatically
if (!func_num_args() && Gdn::PluginManager() instanceof Gdn_PluginManager) {
Gdn::PluginManager()->EventArguments['ActiveCache'] = &$ActiveCache;
Gdn::PluginManager()->FireEvent('BeforeActiveCache');
}
return $ActiveCache;
} | php | public static function ActiveCache() {
/*
* There is a catch 22 with caching the config file. We need
* an external way to define the cache layer before needing it
* in the config.
*/
if (defined('CACHE_METHOD_OVERRIDE'))
$ActiveCache = CACHE_METHOD_OVERRIDE;
else
$ActiveCache = C('Cache.Method', FALSE);
// This should only fire when cache is loading automatically
if (!func_num_args() && Gdn::PluginManager() instanceof Gdn_PluginManager) {
Gdn::PluginManager()->EventArguments['ActiveCache'] = &$ActiveCache;
Gdn::PluginManager()->FireEvent('BeforeActiveCache');
}
return $ActiveCache;
} | [
"public",
"static",
"function",
"ActiveCache",
"(",
")",
"{",
"/*\n * There is a catch 22 with caching the config file. We need\n * an external way to define the cache layer before needing it \n * in the config.\n */",
"if",
"(",
"defined",
"(",
"'CACHE_METHOD_OVERRID... | Gets the shortname of the currently active cache
This method retrieves the name of the active cache according to the config file.
It fires an event thereafter, allowing that value to be overridden
by loaded plugins.
@return string shortname of current auto active cache | [
"Gets",
"the",
"shortname",
"of",
"the",
"currently",
"active",
"cache"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L170-L189 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.ActiveEnabled | public static function ActiveEnabled($ForceEnable = FALSE) {
$AllowCaching = FALSE;
if (defined('CACHE_ENABLED_OVERRIDE'))
$AllowCaching |= CACHE_ENABLED_OVERRIDE;
$AllowCaching |= C('Cache.Enabled', FALSE);
$AllowCaching |= $ForceEnable;
return (bool)$AllowCaching;
} | php | public static function ActiveEnabled($ForceEnable = FALSE) {
$AllowCaching = FALSE;
if (defined('CACHE_ENABLED_OVERRIDE'))
$AllowCaching |= CACHE_ENABLED_OVERRIDE;
$AllowCaching |= C('Cache.Enabled', FALSE);
$AllowCaching |= $ForceEnable;
return (bool)$AllowCaching;
} | [
"public",
"static",
"function",
"ActiveEnabled",
"(",
"$",
"ForceEnable",
"=",
"FALSE",
")",
"{",
"$",
"AllowCaching",
"=",
"FALSE",
";",
"if",
"(",
"defined",
"(",
"'CACHE_ENABLED_OVERRIDE'",
")",
")",
"$",
"AllowCaching",
"|=",
"CACHE_ENABLED_OVERRIDE",
";",
... | Get the status of the active cache
Return whether or not the current cache method is enabled.
@param type $ForceEnable
@return bool status of active cache | [
"Get",
"the",
"status",
"of",
"the",
"active",
"cache"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L199-L209 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.ActiveStore | public static function ActiveStore($ForceMethod = NULL) {
// Get the active cache name
$ActiveCache = self::ActiveCache();
if (!is_null($ForceMethod))
$ActiveCache = $ForceMethod;
$ActiveCache = ucfirst($ActiveCache);
// Overrides
if (defined('CACHE_STORE_OVERRIDE') && defined('CACHE_METHOD_OVERRIDE') && CACHE_METHOD_OVERRIDE == $ActiveCache)
return unserialize(CACHE_STORE_OVERRIDE);
$apc = false;
if (C('Garden.Apc', false) && C('Garden.Cache.ApcPrecache', false) && function_exists('apc_fetch'))
$apc = true;
$LocalStore = null;
$ActiveStore = null;
$ActiveStoreKey = "Cache.{$ActiveCache}.Store";
// Check memory
if (is_null($LocalStore)) {
if (array_key_exists($ActiveCache, Gdn_Cache::$Stores)) {
$LocalStore = Gdn_Cache::$Stores[$ActiveCache];
}
}
// Check APC cache
if (is_null($LocalStore) && $apc) {
$LocalStore = apc_fetch($ActiveStoreKey);
if ($LocalStore) {
Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
}
}
if (is_array($LocalStore)) {
// Convert to ActiveStore format (with 'Active' key)
$Save = false;
$ActiveStore = array();
foreach ($LocalStore as $StoreServerName => &$StoreServer) {
$IsDelayed = &$StoreServer['Delay'];
$IsActive = &$StoreServer['Active'];
if (is_numeric($IsDelayed)) {
if ($IsDelayed < time()) {
$IsActive = true;
$IsDelayed = false;
$StoreServer['Fails'] = 0;
$Save = true;
} else {
if ($IsActive) {
$IsActive = false;
$Save = true;
}
}
}
// Add active servers to ActiveStore array
if ($IsActive)
$ActiveStore[] = $StoreServer['Server'];
}
}
// No local copy, get from config
if (is_null($ActiveStore)) {
$ActiveStore = C($ActiveStoreKey, false);
// Convert to LocalStore format
$LocalStore = array();
$ActiveStore = (array)$ActiveStore;
foreach ($ActiveStore as $StoreServer) {
$StoreServerName = md5($StoreServer);
$LocalStore[$StoreServerName] = array(
'Server' => $StoreServer,
'Active' => true,
'Delay' => false,
'Fails' => 0
);
}
$Save = true;
}
if ($Save) {
// Save to memory
Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
// Save back to APC for later
if ($apc) {
apc_store($ActiveStoreKey, $LocalStore, Gdn_Cache::APC_CACHE_DURATION);
}
}
return $ActiveStore;
} | php | public static function ActiveStore($ForceMethod = NULL) {
// Get the active cache name
$ActiveCache = self::ActiveCache();
if (!is_null($ForceMethod))
$ActiveCache = $ForceMethod;
$ActiveCache = ucfirst($ActiveCache);
// Overrides
if (defined('CACHE_STORE_OVERRIDE') && defined('CACHE_METHOD_OVERRIDE') && CACHE_METHOD_OVERRIDE == $ActiveCache)
return unserialize(CACHE_STORE_OVERRIDE);
$apc = false;
if (C('Garden.Apc', false) && C('Garden.Cache.ApcPrecache', false) && function_exists('apc_fetch'))
$apc = true;
$LocalStore = null;
$ActiveStore = null;
$ActiveStoreKey = "Cache.{$ActiveCache}.Store";
// Check memory
if (is_null($LocalStore)) {
if (array_key_exists($ActiveCache, Gdn_Cache::$Stores)) {
$LocalStore = Gdn_Cache::$Stores[$ActiveCache];
}
}
// Check APC cache
if (is_null($LocalStore) && $apc) {
$LocalStore = apc_fetch($ActiveStoreKey);
if ($LocalStore) {
Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
}
}
if (is_array($LocalStore)) {
// Convert to ActiveStore format (with 'Active' key)
$Save = false;
$ActiveStore = array();
foreach ($LocalStore as $StoreServerName => &$StoreServer) {
$IsDelayed = &$StoreServer['Delay'];
$IsActive = &$StoreServer['Active'];
if (is_numeric($IsDelayed)) {
if ($IsDelayed < time()) {
$IsActive = true;
$IsDelayed = false;
$StoreServer['Fails'] = 0;
$Save = true;
} else {
if ($IsActive) {
$IsActive = false;
$Save = true;
}
}
}
// Add active servers to ActiveStore array
if ($IsActive)
$ActiveStore[] = $StoreServer['Server'];
}
}
// No local copy, get from config
if (is_null($ActiveStore)) {
$ActiveStore = C($ActiveStoreKey, false);
// Convert to LocalStore format
$LocalStore = array();
$ActiveStore = (array)$ActiveStore;
foreach ($ActiveStore as $StoreServer) {
$StoreServerName = md5($StoreServer);
$LocalStore[$StoreServerName] = array(
'Server' => $StoreServer,
'Active' => true,
'Delay' => false,
'Fails' => 0
);
}
$Save = true;
}
if ($Save) {
// Save to memory
Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
// Save back to APC for later
if ($apc) {
apc_store($ActiveStoreKey, $LocalStore, Gdn_Cache::APC_CACHE_DURATION);
}
}
return $ActiveStore;
} | [
"public",
"static",
"function",
"ActiveStore",
"(",
"$",
"ForceMethod",
"=",
"NULL",
")",
"{",
"// Get the active cache name",
"$",
"ActiveCache",
"=",
"self",
"::",
"ActiveCache",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ForceMethod",
")",
")",
... | Returns the storage data for the active cache
For FileCache, the folder. For Memcache, the server(s).
@param type $ForceMethod
@return mixed Active Store Location | [
"Returns",
"the",
"storage",
"data",
"for",
"the",
"active",
"cache"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L219-L314 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.Fail | public function Fail($server) {
// Use APC?
$apc = false;
if (C('Garden.Apc', false) && function_exists('apc_fetch'))
$apc = true;
// Get the active cache name
$activeCache = Gdn_Cache::ActiveCache();
$activeCache = ucfirst($activeCache);
$sctiveStoreKey = "Cache.{$activeCache}.Store";
// Get the localstore
$localStore = GetValue($activeCache, Gdn_Cache::$Stores, null);
if (is_null($localStore)) {
Gdn_Cache::ActiveStore();
$localStore = GetValue($activeCache, Gdn_Cache::$Stores, null);
if (is_null($localStore)) {
return false;
}
}
$storeServerName = md5($server);
if (!array_key_exists($storeServerName, $localStore)) {
return false;
}
$storeServer = &$localStore[$storeServerName];
$isActive = &$storeServer['Active'];
if (!$isActive) return false;
$fails = &$storeServer['Fails'];
$fails++;
$active = $isActive ? 'active' : 'inactive';
// Check if we need to deactivate for 5 minutes
if ($isActive && $storeServer['Fails'] > 3) {
$isActive = false;
$storeServer['Delay'] = time() + Gdn_Cache::CACHE_EJECT_DURATION;
}
// Save
Gdn_Cache::$Stores[$activeCache] = $localStore;
// Save to APC
if ($apc) {
apc_store($sctiveStoreKey, $localStore, Gdn_Cache::APC_CACHE_DURATION);
}
return true;
} | php | public function Fail($server) {
// Use APC?
$apc = false;
if (C('Garden.Apc', false) && function_exists('apc_fetch'))
$apc = true;
// Get the active cache name
$activeCache = Gdn_Cache::ActiveCache();
$activeCache = ucfirst($activeCache);
$sctiveStoreKey = "Cache.{$activeCache}.Store";
// Get the localstore
$localStore = GetValue($activeCache, Gdn_Cache::$Stores, null);
if (is_null($localStore)) {
Gdn_Cache::ActiveStore();
$localStore = GetValue($activeCache, Gdn_Cache::$Stores, null);
if (is_null($localStore)) {
return false;
}
}
$storeServerName = md5($server);
if (!array_key_exists($storeServerName, $localStore)) {
return false;
}
$storeServer = &$localStore[$storeServerName];
$isActive = &$storeServer['Active'];
if (!$isActive) return false;
$fails = &$storeServer['Fails'];
$fails++;
$active = $isActive ? 'active' : 'inactive';
// Check if we need to deactivate for 5 minutes
if ($isActive && $storeServer['Fails'] > 3) {
$isActive = false;
$storeServer['Delay'] = time() + Gdn_Cache::CACHE_EJECT_DURATION;
}
// Save
Gdn_Cache::$Stores[$activeCache] = $localStore;
// Save to APC
if ($apc) {
apc_store($sctiveStoreKey, $localStore, Gdn_Cache::APC_CACHE_DURATION);
}
return true;
} | [
"public",
"function",
"Fail",
"(",
"$",
"server",
")",
"{",
"// Use APC?",
"$",
"apc",
"=",
"false",
";",
"if",
"(",
"C",
"(",
"'Garden.Apc'",
",",
"false",
")",
"&&",
"function_exists",
"(",
"'apc_fetch'",
")",
")",
"$",
"apc",
"=",
"true",
";",
"//... | Register a temporary server connection failure
This method will attempt to temporarily excise the offending server from
the connect roster for a period of time.
@param string $server | [
"Register",
"a",
"temporary",
"server",
"connection",
"failure"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L324-L374 | train |
bishopb/vanilla | library/core/class.cache.php | Gdn_Cache.HasFeature | public function HasFeature($Feature) {
return isset($this->Features[$Feature]) ? $this->Features[$Feature] : Gdn_Cache::CACHEOP_FAILURE;
} | php | public function HasFeature($Feature) {
return isset($this->Features[$Feature]) ? $this->Features[$Feature] : Gdn_Cache::CACHEOP_FAILURE;
} | [
"public",
"function",
"HasFeature",
"(",
"$",
"Feature",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"Features",
"[",
"$",
"Feature",
"]",
")",
"?",
"$",
"this",
"->",
"Features",
"[",
"$",
"Feature",
"]",
":",
"Gdn_Cache",
"::",
"CACHEOP_FAIL... | Check whether this cache supports the specified feature
@param int $Feature feature constant
@return mixed $Meta returns the meta data supplied during RegisterFeature() | [
"Check",
"whether",
"this",
"cache",
"supports",
"the",
"specified",
"feature"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.cache.php#L742-L744 | train |
agalbourdin/agl-core | src/Db/DbAbstract.php | DbAbstract.setConnection | public function setConnection($pHost, $pName, $pUser = NULL, $pPassword = NULL)
{
$this->_connection = $this->connect($pHost, $pName, $pUser, $pPassword);
$this->_dbName = $pName;
return $this;
} | php | public function setConnection($pHost, $pName, $pUser = NULL, $pPassword = NULL)
{
$this->_connection = $this->connect($pHost, $pName, $pUser, $pPassword);
$this->_dbName = $pName;
return $this;
} | [
"public",
"function",
"setConnection",
"(",
"$",
"pHost",
",",
"$",
"pName",
",",
"$",
"pUser",
"=",
"NULL",
",",
"$",
"pPassword",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"_connection",
"=",
"$",
"this",
"->",
"connect",
"(",
"$",
"pHost",
",",
... | Connect to database and register the connection.
@param string $pHost
@param string $pName
@param null|string $pUser
@param null|string $pPassword
@return Db | [
"Connect",
"to",
"database",
"and",
"register",
"the",
"connection",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/DbAbstract.php#L48-L53 | train |
agalbourdin/agl-core | src/Db/DbAbstract.php | DbAbstract.getConnection | public function getConnection()
{
if (is_null($this->_connection)) {
$this->setConnection(
Agl::app()->getConfig('main/db/host'),
Agl::app()->getConfig('main/db/name'),
Agl::app()->getConfig('main/db/user'),
Agl::app()->getConfig('main/db/password')
);
}
return $this->_connection;
} | php | public function getConnection()
{
if (is_null($this->_connection)) {
$this->setConnection(
Agl::app()->getConfig('main/db/host'),
Agl::app()->getConfig('main/db/name'),
Agl::app()->getConfig('main/db/user'),
Agl::app()->getConfig('main/db/password')
);
}
return $this->_connection;
} | [
"public",
"function",
"getConnection",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_connection",
")",
")",
"{",
"$",
"this",
"->",
"setConnection",
"(",
"Agl",
"::",
"app",
"(",
")",
"->",
"getConfig",
"(",
"'main/db/host'",
")",
",",... | Return the stored database connection.
@return mixed | [
"Return",
"the",
"stored",
"database",
"connection",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/DbAbstract.php#L60-L72 | train |
Puzzlout/FrameworkMvcLegacy | src/Helpers/MapHelper.php | MapHelper.GetCoordinatesToCenterOverARegion | public static function GetCoordinatesToCenterOverARegion($configManager) {
return array(
"lat" => $configManager->get(\Puzzlout\Framework\Enums\AppSettingKeys::GoogleMapsCenterLat),
"lng" => $configManager->get(\Puzzlout\Framework\Enums\AppSettingKeys::GoogleMapsCenterLng)
);
} | php | public static function GetCoordinatesToCenterOverARegion($configManager) {
return array(
"lat" => $configManager->get(\Puzzlout\Framework\Enums\AppSettingKeys::GoogleMapsCenterLat),
"lng" => $configManager->get(\Puzzlout\Framework\Enums\AppSettingKeys::GoogleMapsCenterLng)
);
} | [
"public",
"static",
"function",
"GetCoordinatesToCenterOverARegion",
"(",
"$",
"configManager",
")",
"{",
"return",
"array",
"(",
"\"lat\"",
"=>",
"$",
"configManager",
"->",
"get",
"(",
"\\",
"Puzzlout",
"\\",
"Framework",
"\\",
"Enums",
"\\",
"AppSettingKeys",
... | Retrieve the lattitude and longitude from the appsettings.xml
to build an associative array in the Google Maps API format
@param object $configManager
The object of Puzzlout\Framework\Config that read the appconfig.xml
@return array $coordinates
The array in Google Maps API format | [
"Retrieve",
"the",
"lattitude",
"and",
"longitude",
"from",
"the",
"appsettings",
".",
"xml",
"to",
"build",
"an",
"associative",
"array",
"in",
"the",
"Google",
"Maps",
"API",
"format"
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Helpers/MapHelper.php#L40-L45 | train |
Puzzlout/FrameworkMvcLegacy | src/Helpers/MapHelper.php | MapHelper.BuildLatAndLongCoordFromGeoObjects | public static function BuildLatAndLongCoordFromGeoObjects($objects, $latPropName, $lngPropName) {
$coordinates = array();
foreach ($objects as $object) {
if (self::CheckCoordinateValue($object->$latPropName()) && self::CheckCoordinateValue($object->$lngPropName())) {
$coordinate = array(
"lat" => $object->$latPropName(),
"lng" => $object->$lngPropName()
);
array_push($coordinates, $coordinate);
}
}
return $coordinates;
} | php | public static function BuildLatAndLongCoordFromGeoObjects($objects, $latPropName, $lngPropName) {
$coordinates = array();
foreach ($objects as $object) {
if (self::CheckCoordinateValue($object->$latPropName()) && self::CheckCoordinateValue($object->$lngPropName())) {
$coordinate = array(
"lat" => $object->$latPropName(),
"lng" => $object->$lngPropName()
);
array_push($coordinates, $coordinate);
}
}
return $coordinates;
} | [
"public",
"static",
"function",
"BuildLatAndLongCoordFromGeoObjects",
"(",
"$",
"objects",
",",
"$",
"latPropName",
",",
"$",
"lngPropName",
")",
"{",
"$",
"coordinates",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"objects",
"as",
"$",
"object",
")",
... | Retrieve the lattitudes and longitudes from a list of objects
based the lattitude and longitude property names filter.
Build as an output an associative array in the Google Maps API format
@param array $objects
The array of objects of a given type
@param string $latPropName
The lattitude property name of a given object type
@param string $lngPropName
The longitude property name of a given object type
@return array $coordinates
The array in Google Maps API format | [
"Retrieve",
"the",
"lattitudes",
"and",
"longitudes",
"from",
"a",
"list",
"of",
"objects",
"based",
"the",
"lattitude",
"and",
"longitude",
"property",
"names",
"filter",
"."
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Helpers/MapHelper.php#L66-L78 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.