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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eureka-framework/component-http | src/Http/File.php | File.move | public function move($toDir, $fileName = null, $mode = 0775)
{
if ($this->hasError()) {
throw new \Exception('Cannot move file, the file has not been correctly uploaded!');
}
$fileName = (empty($fileName) ? $this->get('name') : $fileName);
if (!file_exists($toDir) && !m... | php | public function move($toDir, $fileName = null, $mode = 0775)
{
if ($this->hasError()) {
throw new \Exception('Cannot move file, the file has not been correctly uploaded!');
}
$fileName = (empty($fileName) ? $this->get('name') : $fileName);
if (!file_exists($toDir) && !m... | [
"public",
"function",
"move",
"(",
"$",
"toDir",
",",
"$",
"fileName",
"=",
"null",
",",
"$",
"mode",
"=",
"0775",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasError",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Cannot move file, the... | Move uploaded file.
@param string $toDir
@param string $fileName
@param int $mode Right mode on directory to create (if not exists)
@return bool
@throws \Exception | [
"Move",
"uploaded",
"file",
"."
] | 698c3b73581a9703a9c932890c57e50f8774607a | https://github.com/eureka-framework/component-http/blob/698c3b73581a9703a9c932890c57e50f8774607a/src/Http/File.php#L78-L91 | train |
black-lamp/blcms-cart | backend/controllers/OrderController.php | OrderController.actionView | public function actionView($id)
{
if (!empty($id)) {
$model = Order::findOne($id);
if (empty($model)) {
$model = new Order();
}
if (Yii::$app->user->can('changeOrderStatus')) {
if ($model->load(Yii::$app->request->post())) {
... | php | public function actionView($id)
{
if (!empty($id)) {
$model = Order::findOne($id);
if (empty($model)) {
$model = new Order();
}
if (Yii::$app->user->can('changeOrderStatus')) {
if ($model->load(Yii::$app->request->post())) {
... | [
"public",
"function",
"actionView",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"model",
"=",
"Order",
"::",
"findOne",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"{",... | Displays a single Order model and changes status for this model.
@param integer $id
@return mixed
@throws NotFoundHttpException
@throws ForbiddenHttpException | [
"Displays",
"a",
"single",
"Order",
"model",
"and",
"changes",
"status",
"for",
"this",
"model",
"."
] | 314796eecae3ca4ed5fecfdc0231a738af50eba7 | https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/backend/controllers/OrderController.php#L84-L118 | train |
black-lamp/blcms-cart | backend/controllers/OrderController.php | OrderController.actionDeleteProduct | public function actionDeleteProduct($id)
{
if (($model = OrderProduct::findOne($id)) !== null) {
$model->delete();
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
return $this->redirect(\Yii::$app->request->referrer);
} | php | public function actionDeleteProduct($id)
{
if (($model = OrderProduct::findOne($id)) !== null) {
$model->delete();
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
return $this->redirect(\Yii::$app->request->referrer);
} | [
"public",
"function",
"actionDeleteProduct",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"OrderProduct",
"::",
"findOne",
"(",
"$",
"id",
")",
")",
"!==",
"null",
")",
"{",
"$",
"model",
"->",
"delete",
"(",
")",
";",
"}",
"else",
... | Deletes product from existing Order model.
If deletion is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
@throws NotFoundHttpException | [
"Deletes",
"product",
"from",
"existing",
"Order",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | 314796eecae3ca4ed5fecfdc0231a738af50eba7 | https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/backend/controllers/OrderController.php#L140-L149 | train |
danielgp/common-lib | source/DomDynamicSelectByDanielGP.php | DomDynamicSelectByDanielGP.calculateSelectOptionsSize | private function calculateSelectOptionsSize($aElements, $aFeatures = [])
{
$selectSize = $this->calculateSelectOptionsSizeForced($aElements, $aFeatures);
if ((in_array('include_null', $aFeatures)) && ($selectSize != '1')) {
$selectSize++;
}
return $selectSize;
} | php | private function calculateSelectOptionsSize($aElements, $aFeatures = [])
{
$selectSize = $this->calculateSelectOptionsSizeForced($aElements, $aFeatures);
if ((in_array('include_null', $aFeatures)) && ($selectSize != '1')) {
$selectSize++;
}
return $selectSize;
} | [
"private",
"function",
"calculateSelectOptionsSize",
"(",
"$",
"aElements",
",",
"$",
"aFeatures",
"=",
"[",
"]",
")",
"{",
"$",
"selectSize",
"=",
"$",
"this",
"->",
"calculateSelectOptionsSizeForced",
"(",
"$",
"aElements",
",",
"$",
"aFeatures",
")",
";",
... | Calculate the optimal for all options within a select tag
@param array $aElements
@param array $aFeatures
@return string|int | [
"Calculate",
"the",
"optimal",
"for",
"all",
"options",
"within",
"a",
"select",
"tag"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomDynamicSelectByDanielGP.php#L61-L68 | train |
danielgp/common-lib | source/DomDynamicSelectByDanielGP.php | DomDynamicSelectByDanielGP.setOptionsForSelect | private function setOptionsForSelect($aElements, $sDefaultValue, $featArray = null)
{
if (is_null($featArray)) {
$featArray = [];
}
$sReturn = [];
$crtGroup = null;
foreach ($aElements as $key => $value) {
$aFH = $this->setOptionGroupFooterHeade... | php | private function setOptionsForSelect($aElements, $sDefaultValue, $featArray = null)
{
if (is_null($featArray)) {
$featArray = [];
}
$sReturn = [];
$crtGroup = null;
foreach ($aElements as $key => $value) {
$aFH = $this->setOptionGroupFooterHeade... | [
"private",
"function",
"setOptionsForSelect",
"(",
"$",
"aElements",
",",
"$",
"sDefaultValue",
",",
"$",
"featArray",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"featArray",
")",
")",
"{",
"$",
"featArray",
"=",
"[",
"]",
";",
"}",
"$",
... | Creates all the child tags required to populate a SELECT tag
@param array $aElements
@param string|array $sDefaultValue
@param array $featArray
@return string | [
"Creates",
"all",
"the",
"child",
"tags",
"required",
"to",
"populate",
"a",
"SELECT",
"tag"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomDynamicSelectByDanielGP.php#L199-L216 | train |
Programie/JsonConfig | src/main/php/com/selfcoders/jsonconfig/ValueByPath.php | ValueByPath.getValueByPath | public static function getValueByPath($dataTree, $path)
{
$pathParts = explode(".", $path);
foreach ($pathParts as $name)
{
if (!isset($dataTree->{$name}))
{
return null;
}
$dataTree = $dataTree->{$name};
}
return $dataTree;
} | php | public static function getValueByPath($dataTree, $path)
{
$pathParts = explode(".", $path);
foreach ($pathParts as $name)
{
if (!isset($dataTree->{$name}))
{
return null;
}
$dataTree = $dataTree->{$name};
}
return $dataTree;
} | [
"public",
"static",
"function",
"getValueByPath",
"(",
"$",
"dataTree",
",",
"$",
"path",
")",
"{",
"$",
"pathParts",
"=",
"explode",
"(",
"\".\"",
",",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"pathParts",
"as",
"$",
"name",
")",
"{",
"if",
"(",
... | Get the value of the property in the data tree specified by the dotted path.
@param \StdClass $dataTree A tree of StdClass objects
@param string $path The dotted path to the property which should be returned
@return null|mixed The value of the property or null if not found | [
"Get",
"the",
"value",
"of",
"the",
"property",
"in",
"the",
"data",
"tree",
"specified",
"by",
"the",
"dotted",
"path",
"."
] | 51314ec4f00fb14c6eb17b36f322b723681a7d36 | https://github.com/Programie/JsonConfig/blob/51314ec4f00fb14c6eb17b36f322b723681a7d36/src/main/php/com/selfcoders/jsonconfig/ValueByPath.php#L13-L28 | train |
Programie/JsonConfig | src/main/php/com/selfcoders/jsonconfig/ValueByPath.php | ValueByPath.setValueByPath | public static function setValueByPath($dataTree, $path, $value, $add)
{
$pathParts = explode(".", $path);
$name = $pathParts[0];
if (!$add and !isset($dataTree->{$name}))
{
return false;
}
if (count($pathParts) == 1)
{
$dataTree->{$name} = $value;
return true;
}
if (isset($dataTree->{$n... | php | public static function setValueByPath($dataTree, $path, $value, $add)
{
$pathParts = explode(".", $path);
$name = $pathParts[0];
if (!$add and !isset($dataTree->{$name}))
{
return false;
}
if (count($pathParts) == 1)
{
$dataTree->{$name} = $value;
return true;
}
if (isset($dataTree->{$n... | [
"public",
"static",
"function",
"setValueByPath",
"(",
"$",
"dataTree",
",",
"$",
"path",
",",
"$",
"value",
",",
"$",
"add",
")",
"{",
"$",
"pathParts",
"=",
"explode",
"(",
"\".\"",
",",
"$",
"path",
")",
";",
"$",
"name",
"=",
"$",
"pathParts",
... | Set the value of the property specified by the given path in the data tree.
@param \StdClass $dataTree A tree of StdClass objects
@param string $path The path to the property which should be set
@param mixed $value The value for the property
@param bool $add Whether to add a new property if not existing or only set if... | [
"Set",
"the",
"value",
"of",
"the",
"property",
"specified",
"by",
"the",
"given",
"path",
"in",
"the",
"data",
"tree",
"."
] | 51314ec4f00fb14c6eb17b36f322b723681a7d36 | https://github.com/Programie/JsonConfig/blob/51314ec4f00fb14c6eb17b36f322b723681a7d36/src/main/php/com/selfcoders/jsonconfig/ValueByPath.php#L40-L70 | train |
Programie/JsonConfig | src/main/php/com/selfcoders/jsonconfig/ValueByPath.php | ValueByPath.removeValueByPath | public static function removeValueByPath($dataTree, $path)
{
$pathParts = explode(".", $path);
$name = $pathParts[0];
if (!isset($dataTree->{$name}))
{
return false;
}
if (count($pathParts) == 1)
{
unset($dataTree->{$name});
return true;
}
return ValueByPath::removeValueByPath($dataTree-... | php | public static function removeValueByPath($dataTree, $path)
{
$pathParts = explode(".", $path);
$name = $pathParts[0];
if (!isset($dataTree->{$name}))
{
return false;
}
if (count($pathParts) == 1)
{
unset($dataTree->{$name});
return true;
}
return ValueByPath::removeValueByPath($dataTree-... | [
"public",
"static",
"function",
"removeValueByPath",
"(",
"$",
"dataTree",
",",
"$",
"path",
")",
"{",
"$",
"pathParts",
"=",
"explode",
"(",
"\".\"",
",",
"$",
"path",
")",
";",
"$",
"name",
"=",
"$",
"pathParts",
"[",
"0",
"]",
";",
"if",
"(",
"!... | Remove the value of the property specified by the given path in the data tree.
@param \StdClass $dataTree A tree of StdClass objects
@param string $path The path to the property which should be removed
@return bool true if the property has been removed successfully, false if not (e.g. property not existing in tree) | [
"Remove",
"the",
"value",
"of",
"the",
"property",
"specified",
"by",
"the",
"given",
"path",
"in",
"the",
"data",
"tree",
"."
] | 51314ec4f00fb14c6eb17b36f322b723681a7d36 | https://github.com/Programie/JsonConfig/blob/51314ec4f00fb14c6eb17b36f322b723681a7d36/src/main/php/com/selfcoders/jsonconfig/ValueByPath.php#L80-L98 | train |
FuzeWorks/Core | src/FuzeWorks/Libraries.php | Libraries.getDriver | public function getDriver($libraryName, array $parameters = null, array $directory = null, $newInstance = false)
{
if (empty($libraryName))
{
throw new LibraryException("Could not load driver. No name provided", 1);
}
// Load the driver class if it is not yet loaded
if ( ! class_exists('FuzeWorks\FW_Driv... | php | public function getDriver($libraryName, array $parameters = null, array $directory = null, $newInstance = false)
{
if (empty($libraryName))
{
throw new LibraryException("Could not load driver. No name provided", 1);
}
// Load the driver class if it is not yet loaded
if ( ! class_exists('FuzeWorks\FW_Driv... | [
"public",
"function",
"getDriver",
"(",
"$",
"libraryName",
",",
"array",
"$",
"parameters",
"=",
"null",
",",
"array",
"$",
"directory",
"=",
"null",
",",
"$",
"newInstance",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"libraryName",
")",
")... | Driver Library Loader
Loads, instantiates and returns driver libraries.
@param string $library Driver Library name
@param array $params Optional parameters to pass to the library class constructor
@param array $directory Optional list of directories where the library can be found. Overrides default list
@param ... | [
"Driver",
"Library",
"Loader"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Libraries.php#L132-L147 | train |
FuzeWorks/Core | src/FuzeWorks/Libraries.php | Libraries.loadLibrary | protected function loadLibrary($libraryName, $parameters = null, array $directory = null, $newInstance = false)
{
// First get the directories where the library can be located
$directories = (is_null($directory) ? $this->libraryPaths : $directory);
// Now figure out the className and subdir
$class = trim($li... | php | protected function loadLibrary($libraryName, $parameters = null, array $directory = null, $newInstance = false)
{
// First get the directories where the library can be located
$directories = (is_null($directory) ? $this->libraryPaths : $directory);
// Now figure out the className and subdir
$class = trim($li... | [
"protected",
"function",
"loadLibrary",
"(",
"$",
"libraryName",
",",
"$",
"parameters",
"=",
"null",
",",
"array",
"$",
"directory",
"=",
"null",
",",
"$",
"newInstance",
"=",
"false",
")",
"{",
"// First get the directories where the library can be located",
"$",
... | Internal Library Loader
Determines what type of library needs to be loaded
@param string $library Library name
@param array $params Optional parameters to pass to the library class constructor
@param array $directory Optional list of directories where the library can be found. Overrides default list
@param boo... | [
"Internal",
"Library",
"Loader"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Libraries.php#L161-L192 | train |
FuzeWorks/Core | src/FuzeWorks/Libraries.php | Libraries.loadAppLibrary | protected function loadAppLibrary($class, $subdir, array $parameters = null, array $directories, $newInstance = false)
{
// First check if the input is correct
if (!is_array($directories))
{
throw new LibraryException("Could not load library. \$directory variable was not an array", 1);
}
// Search for ... | php | protected function loadAppLibrary($class, $subdir, array $parameters = null, array $directories, $newInstance = false)
{
// First check if the input is correct
if (!is_array($directories))
{
throw new LibraryException("Could not load library. \$directory variable was not an array", 1);
}
// Search for ... | [
"protected",
"function",
"loadAppLibrary",
"(",
"$",
"class",
",",
"$",
"subdir",
",",
"array",
"$",
"parameters",
"=",
"null",
",",
"array",
"$",
"directories",
",",
"$",
"newInstance",
"=",
"false",
")",
"{",
"// First check if the input is correct",
"if",
"... | Application Library Loader
Loads, instantiates and returns an application library.
Could possibly extend a core library if requested.
@param string $class Classname
@param string $subdir Sub directory in which the final class can be found
@param array $params Optional parameters to pass to the library class ... | [
"Application",
"Library",
"Loader"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Libraries.php#L320-L376 | train |
FuzeWorks/Core | src/FuzeWorks/Libraries.php | Libraries.removeLibraryPath | public function removeLibraryPath($directory)
{
if (($key = array_search($directory, $this->libraryPaths)) !== false)
{
unset($this->libraryPaths[$key]);
}
} | php | public function removeLibraryPath($directory)
{
if (($key = array_search($directory, $this->libraryPaths)) !== false)
{
unset($this->libraryPaths[$key]);
}
} | [
"public",
"function",
"removeLibraryPath",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"directory",
",",
"$",
"this",
"->",
"libraryPaths",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
... | Remove a path where libraries can be found
@param string $directory The directory
@return void | [
"Remove",
"a",
"path",
"where",
"libraries",
"can",
"be",
"found"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Libraries.php#L445-L451 | train |
freialib/fenrir.system | src/Trait/MysqlRepo.php | MysqlRepoTrait.find | function find(array $logic = null) {
$logic != null or $logic = [];
$opt = [];
foreach (['%fields', '%order_by', '%limit', '%offset'] as $key) {
if (isset($logic[$key])) {
$opt[$key] = $logic[$key];
unset($logic[$key]);
}
else { // %filter not set
$opt[$key] = [];
}
}
$entries = $th... | php | function find(array $logic = null) {
$logic != null or $logic = [];
$opt = [];
foreach (['%fields', '%order_by', '%limit', '%offset'] as $key) {
if (isset($logic[$key])) {
$opt[$key] = $logic[$key];
unset($logic[$key]);
}
else { // %filter not set
$opt[$key] = [];
}
}
$entries = $th... | [
"function",
"find",
"(",
"array",
"$",
"logic",
"=",
"null",
")",
"{",
"$",
"logic",
"!=",
"null",
"or",
"$",
"logic",
"=",
"[",
"]",
";",
"$",
"opt",
"=",
"[",
"]",
";",
"foreach",
"(",
"[",
"'%fields'",
",",
"'%order_by'",
",",
"'%limit'",
",",... | You can specify fields via %fields
You can specify limit via %limit and offset via %offset
You can specify order rules via %order_by
Everything else is interpreted as constraints on the entries.
@return array [ models ] | [
"You",
"can",
"specify",
"fields",
"via",
"%fields",
"You",
"can",
"specify",
"limit",
"via",
"%limit",
"and",
"offset",
"via",
"%offset",
"You",
"can",
"specify",
"order",
"rules",
"via",
"%order_by"
] | 388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8 | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Trait/MysqlRepo.php#L81-L106 | train |
freialib/fenrir.system | src/Trait/MysqlRepo.php | MysqlRepoTrait.sqlinsert | protected function sqlinsert(array $fields, array $nums = null, array $bools = null) {
$db = $this->db;
$nums != null or $nums = [];
$bools != null or $bools = [];
$keys = array_keys($fields);
$strs = array_diff($keys, $bools, $nums);
$key_fields = \hlin\Arr::join(', ', $keys, function ($_, $val) {
re... | php | protected function sqlinsert(array $fields, array $nums = null, array $bools = null) {
$db = $this->db;
$nums != null or $nums = [];
$bools != null or $bools = [];
$keys = array_keys($fields);
$strs = array_diff($keys, $bools, $nums);
$key_fields = \hlin\Arr::join(', ', $keys, function ($_, $val) {
re... | [
"protected",
"function",
"sqlinsert",
"(",
"array",
"$",
"fields",
",",
"array",
"$",
"nums",
"=",
"null",
",",
"array",
"$",
"bools",
"=",
"null",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"db",
";",
"$",
"nums",
"!=",
"null",
"or",
"$",
"num... | Inserts fields, if bools or nums are specified the fields mentioned are
treated as strings.
@return int new entry id | [
"Inserts",
"fields",
"if",
"bools",
"or",
"nums",
"are",
"specified",
"the",
"fields",
"mentioned",
"are",
"treated",
"as",
"strings",
"."
] | 388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8 | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Trait/MysqlRepo.php#L200-L231 | train |
freialib/fenrir.system | src/Trait/MysqlRepo.php | MysqlRepoTrait.sqlupdate | protected function sqlupdate(array $fields, array $nums = null, array $bools = null) {
$db = $this->db;
$idfield = $this->idfield();
$nums != null or $nums = [];
$bools != null or $bools = [];
$keys = array_diff(array_keys($fields), [ $idfield ]);
$strs = array_diff(array_keys($fields), $bools, $nums);
... | php | protected function sqlupdate(array $fields, array $nums = null, array $bools = null) {
$db = $this->db;
$idfield = $this->idfield();
$nums != null or $nums = [];
$bools != null or $bools = [];
$keys = array_diff(array_keys($fields), [ $idfield ]);
$strs = array_diff(array_keys($fields), $bools, $nums);
... | [
"protected",
"function",
"sqlupdate",
"(",
"array",
"$",
"fields",
",",
"array",
"$",
"nums",
"=",
"null",
",",
"array",
"$",
"bools",
"=",
"null",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"db",
";",
"$",
"idfield",
"=",
"$",
"this",
"->",
"i... | Update fields, if bools or nums are specified the fields mentioned are
treated as strings
@return int updated entry id | [
"Update",
"fields",
"if",
"bools",
"or",
"nums",
"are",
"specified",
"the",
"fields",
"mentioned",
"are",
"treated",
"as",
"strings"
] | 388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8 | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Trait/MysqlRepo.php#L239-L268 | train |
freialib/fenrir.system | src/Trait/MysqlRepo.php | MysqlRepoTrait.sqlentry | protected function sqlentry($entry_id) {
$res = $this->sqlfind([ $this->idfield() => $entry_id ], null, null, 1);
if (empty($res)) {
return null;
}
else { // found entry
return $res[0];
}
} | php | protected function sqlentry($entry_id) {
$res = $this->sqlfind([ $this->idfield() => $entry_id ], null, null, 1);
if (empty($res)) {
return null;
}
else { // found entry
return $res[0];
}
} | [
"protected",
"function",
"sqlentry",
"(",
"$",
"entry_id",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"sqlfind",
"(",
"[",
"$",
"this",
"->",
"idfield",
"(",
")",
"=>",
"$",
"entry_id",
"]",
",",
"null",
",",
"null",
",",
"1",
")",
";",
"if",
... | Mostly an alias to sqlsearch on id with limit of 1.
@return array|null | [
"Mostly",
"an",
"alias",
"to",
"sqlsearch",
"on",
"id",
"with",
"limit",
"of",
"1",
"."
] | 388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8 | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Trait/MysqlRepo.php#L337-L345 | train |
jyokum/healthgraph | src/HealthGraph/HealthGraphClient.php | HealthGraphClient.factory | public static function factory($config = array())
{
$default = array(
'base_url' => 'https://api.runkeeper.com',
'logger' => FALSE,
);
$required = array('base_url');
$config = Collection::fromConfig($config, $default, $required);
$client = new self($... | php | public static function factory($config = array())
{
$default = array(
'base_url' => 'https://api.runkeeper.com',
'logger' => FALSE,
);
$required = array('base_url');
$config = Collection::fromConfig($config, $default, $required);
$client = new self($... | [
"public",
"static",
"function",
"factory",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"default",
"=",
"array",
"(",
"'base_url'",
"=>",
"'https://api.runkeeper.com'",
",",
"'logger'",
"=>",
"FALSE",
",",
")",
";",
"$",
"required",
"=",
"a... | Factory method to create a new HealthGraphClient
@param array|Collection $config Configuration data. Array keys:
base_url - Base URL of web service
@return HealthGraphClient
@TODO update factory method and docblock for parameters | [
"Factory",
"method",
"to",
"create",
"a",
"new",
"HealthGraphClient"
] | 6b3b4c4eb797f1fcf056024c8b15a16665bf8758 | https://github.com/jyokum/healthgraph/blob/6b3b4c4eb797f1fcf056024c8b15a16665bf8758/src/HealthGraph/HealthGraphClient.php#L23-L55 | train |
faustbrian/HTTP | src/HttpRequest.php | HttpRequest.headers | public function headers(): array
{
return collect($this->request->getHeaders())->mapWithKeys(function ($values, $header) {
return [$header => $values[0]];
})->all();
} | php | public function headers(): array
{
return collect($this->request->getHeaders())->mapWithKeys(function ($values, $header) {
return [$header => $values[0]];
})->all();
} | [
"public",
"function",
"headers",
"(",
")",
":",
"array",
"{",
"return",
"collect",
"(",
"$",
"this",
"->",
"request",
"->",
"getHeaders",
"(",
")",
")",
"->",
"mapWithKeys",
"(",
"function",
"(",
"$",
"values",
",",
"$",
"header",
")",
"{",
"return",
... | Gets all header values.
@return array | [
"Gets",
"all",
"header",
"values",
"."
] | ab24b37ea211eb106237a813ec8d47ec1d4fe199 | https://github.com/faustbrian/HTTP/blob/ab24b37ea211eb106237a813ec8d47ec1d4fe199/src/HttpRequest.php#L65-L70 | train |
stubbles/stubbles-peer | src/main/php/QueryString.php | QueryString.build | public function build(): string
{
if (count($this->parameters) === 0) {
return '';
}
$queryString = '';
foreach ($this->parameters as $name => $value) {
$queryString .= $this->buildQuery($name, $value);
}
return substr($queryString, 1);
} | php | public function build(): string
{
if (count($this->parameters) === 0) {
return '';
}
$queryString = '';
foreach ($this->parameters as $name => $value) {
$queryString .= $this->buildQuery($name, $value);
}
return substr($queryString, 1);
} | [
"public",
"function",
"build",
"(",
")",
":",
"string",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"parameters",
")",
"===",
"0",
")",
"{",
"return",
"''",
";",
"}",
"$",
"queryString",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"pa... | build the query from parameters
@return string | [
"build",
"the",
"query",
"from",
"parameters"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/QueryString.php#L85-L97 | train |
stubbles/stubbles-peer | src/main/php/QueryString.php | QueryString.buildQuery | protected function buildQuery(string $name, $value, string $postfix= ''): string
{
$query = '';
if (is_array($value)) {
foreach ($value as $k => $v) {
if (is_int($k)) {
$query .= $this->buildQuery('', $v, $postfix . $name .'[]');
} else... | php | protected function buildQuery(string $name, $value, string $postfix= ''): string
{
$query = '';
if (is_array($value)) {
foreach ($value as $k => $v) {
if (is_int($k)) {
$query .= $this->buildQuery('', $v, $postfix . $name .'[]');
} else... | [
"protected",
"function",
"buildQuery",
"(",
"string",
"$",
"name",
",",
"$",
"value",
",",
"string",
"$",
"postfix",
"=",
"''",
")",
":",
"string",
"{",
"$",
"query",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach... | Calculates query string
@param string $name
@param mixed $value
@param string $postfix The postfix to use for each variable (defaults to '')
@return string | [
"Calculates",
"query",
"string"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/QueryString.php#L107-L129 | train |
stubbles/stubbles-peer | src/main/php/QueryString.php | QueryString.addParam | public function addParam(string $name, $value): self
{
if (!is_array($value) && !is_scalar($value) && null !== $value) {
if (is_object($value) && method_exists($value, '__toString')) {
$value = (string) $value;
} else {
throw new \InvalidArgumentExcept... | php | public function addParam(string $name, $value): self
{
if (!is_array($value) && !is_scalar($value) && null !== $value) {
if (is_object($value) && method_exists($value, '__toString')) {
$value = (string) $value;
} else {
throw new \InvalidArgumentExcept... | [
"public",
"function",
"addParam",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"self",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
"&&",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"&&",
"null",
"!==",
"$",
"value",
")",
"{... | add a parameter
@param string $name name of parameter
@param mixed $value value of parameter
@return \stubbles\peer\QueryString
@throws \InvalidArgumentException | [
"add",
"a",
"parameter"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/QueryString.php#L149-L165 | train |
stubbles/stubbles-peer | src/main/php/QueryString.php | QueryString.removeParam | public function removeParam(string $name): self
{
if (array_key_exists($name, $this->parameters)) {
unset($this->parameters[$name]);
}
return $this;
} | php | public function removeParam(string $name): self
{
if (array_key_exists($name, $this->parameters)) {
unset($this->parameters[$name]);
}
return $this;
} | [
"public",
"function",
"removeParam",
"(",
"string",
"$",
"name",
")",
":",
"self",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"parameters",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"parameters",
"[",
"$",
"na... | remove a param
@param string $name name of parameter
@return \stubbles\peer\QueryString | [
"remove",
"a",
"param"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/QueryString.php#L173-L180 | train |
shgysk8zer0/core_api | traits/magic/is_set.php | Is_Set.__isset | final public function __isset($prop)
{
$this->magicPropConvert($prop);
return is_array($this->{$this::MAGIC_PROPERTY})
? array_key_exists($prop, $this->{$this::MAGIC_PROPERTY})
: isset($this->{$this::MAGIC_PROPERTY}->$prop);
} | php | final public function __isset($prop)
{
$this->magicPropConvert($prop);
return is_array($this->{$this::MAGIC_PROPERTY})
? array_key_exists($prop, $this->{$this::MAGIC_PROPERTY})
: isset($this->{$this::MAGIC_PROPERTY}->$prop);
} | [
"final",
"public",
"function",
"__isset",
"(",
"$",
"prop",
")",
"{",
"$",
"this",
"->",
"magicPropConvert",
"(",
"$",
"prop",
")",
";",
"return",
"is_array",
"(",
"$",
"this",
"->",
"{",
"$",
"this",
"::",
"MAGIC_PROPERTY",
"}",
")",
"?",
"array_key_e... | Magic isset metod.
@param string $prop The property to work with
@return bool Whether or not it is set.
@example isset($magic_class->$prop) ? 'True' : 'False'; | [
"Magic",
"isset",
"metod",
"."
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/magic/is_set.php#L32-L38 | train |
stubbles/stubbles-streams | src/main/php/InputStreamIterator.php | InputStreamIterator.next | public function next()
{
$this->valid = !$this->inputStream->eof();
$this->currentLine = $this->inputStream->readLine();
$this->lineNumber++;
} | php | public function next()
{
$this->valid = !$this->inputStream->eof();
$this->currentLine = $this->inputStream->readLine();
$this->lineNumber++;
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"this",
"->",
"valid",
"=",
"!",
"$",
"this",
"->",
"inputStream",
"->",
"eof",
"(",
")",
";",
"$",
"this",
"->",
"currentLine",
"=",
"$",
"this",
"->",
"inputStream",
"->",
"readLine",
"(",
")",
";... | moves forward to next line | [
"moves",
"forward",
"to",
"next",
"line"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/InputStreamIterator.php#L78-L83 | train |
stubbles/stubbles-streams | src/main/php/InputStreamIterator.php | InputStreamIterator.rewind | public function rewind()
{
if (!($this->inputStream instanceof Seekable)) {
return;
}
$this->inputStream->seek(0, Seekable::SET);
$this->lineNumber = 0;
$this->currentLine = null;
$this->next();
} | php | public function rewind()
{
if (!($this->inputStream instanceof Seekable)) {
return;
}
$this->inputStream->seek(0, Seekable::SET);
$this->lineNumber = 0;
$this->currentLine = null;
$this->next();
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"inputStream",
"instanceof",
"Seekable",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"inputStream",
"->",
"seek",
"(",
"0",
",",
"Seekable",
"::",
"SET",... | rewinds to first line | [
"rewinds",
"to",
"first",
"line"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/InputStreamIterator.php#L88-L98 | train |
shampeak/GraceServer | src/Log/Log.php | Log.addDebug | public function addDebug($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::DEBUG, $message, $context);
} | php | public function addDebug($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::DEBUG, $message, $context);
} | [
"public",
"function",
"addDebug",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"DEBUG",
",",
"$",
"message"... | Adds a log record at the DEBUG level.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"DEBUG",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L115-L118 | train |
shampeak/GraceServer | src/Log/Log.php | Log.addInfo | public function addInfo($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::INFO, $message, $context);
} | php | public function addInfo($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::INFO, $message, $context);
} | [
"public",
"function",
"addInfo",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"INFO",
",",
"$",
"message",
... | Adds a log record at the INFO level.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"INFO",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L128-L131 | train |
shampeak/GraceServer | src/Log/Log.php | Log.addNotice | public function addNotice($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::NOTICE, $message, $context);
} | php | public function addNotice($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::NOTICE, $message, $context);
} | [
"public",
"function",
"addNotice",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"NOTICE",
",",
"$",
"messag... | Adds a log record at the NOTICE level.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"NOTICE",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L141-L144 | train |
shampeak/GraceServer | src/Log/Log.php | Log.addCritical | public function addCritical($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::CRITICAL, $message, $context);
} | php | public function addCritical($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::CRITICAL, $message, $context);
} | [
"public",
"function",
"addCritical",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"CRITICAL",
",",
"$",
"me... | Adds a log record at the CRITICAL level.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"CRITICAL",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L180-L183 | train |
shampeak/GraceServer | src/Log/Log.php | Log.addAlert | public function addAlert($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::ALERT, $message, $context);
} | php | public function addAlert($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::ALERT, $message, $context);
} | [
"public",
"function",
"addAlert",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"ALERT",
",",
"$",
"message"... | Adds a log record at the ALERT level.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"ALERT",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L193-L196 | train |
shampeak/GraceServer | src/Log/Log.php | Log.warn | public function warn($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::WARNING, $message, $context);
} | php | public function warn($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::WARNING, $message, $context);
} | [
"public",
"function",
"warn",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"WARNING",
",",
"$",
"message",
... | Adds a log record at the WARNING level.
This method allows for compatibility with common interfaces.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"WARNING",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L295-L298 | train |
shampeak/GraceServer | src/Log/Log.php | Log.err | public function err($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::ERROR, $message, $context);
} | php | public function err($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::ERROR, $message, $context);
} | [
"public",
"function",
"err",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"ERROR",
",",
"$",
"message",
"... | Adds a log record at the ERROR level.
This method allows for compatibility with common interfaces.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"ERROR",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L325-L328 | train |
shampeak/GraceServer | src/Log/Log.php | Log.emergency | public function emergency($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::EMERGENCY, $message, $context);
} | php | public function emergency($message, array $context = array())
{
return $this->_instance->addRecord(\Monolog\Logger::EMERGENCY, $message, $context);
} | [
"public",
"function",
"emergency",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance",
"->",
"addRecord",
"(",
"\\",
"Monolog",
"\\",
"Logger",
"::",
"EMERGENCY",
",",
"$",
"mes... | Adds a log record at the EMERGENCY level.
This method allows for compatibility with common interfaces.
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"the",
"EMERGENCY",
"level",
"."
] | e69891de3daae7d228c803c06213eb248fc88594 | https://github.com/shampeak/GraceServer/blob/e69891de3daae7d228c803c06213eb248fc88594/src/Log/Log.php#L415-L418 | train |
Panigale/laravel5-Points | src/Traits/AddPoint.php | AddPoint.addPointToUser | protected function addPointToUser($number, $beforePoint, $afterPoint)
{
if($this->pointNotIsset())
$point = $this->createPointToUser();
else
$point = Point::where('user_id' ,$this->id)
->where('rule_id' ,$this->ruleId)
->first(... | php | protected function addPointToUser($number, $beforePoint, $afterPoint)
{
if($this->pointNotIsset())
$point = $this->createPointToUser();
else
$point = Point::where('user_id' ,$this->id)
->where('rule_id' ,$this->ruleId)
->first(... | [
"protected",
"function",
"addPointToUser",
"(",
"$",
"number",
",",
"$",
"beforePoint",
",",
"$",
"afterPoint",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pointNotIsset",
"(",
")",
")",
"$",
"point",
"=",
"$",
"this",
"->",
"createPointToUser",
"(",
")",
... | update user point
@param int $ruleId
@param $number
@param $beforePoint
@param $afterPoint
@return mixed | [
"update",
"user",
"point"
] | 6fb559d91694a336f5a11d8408348a85395b4ff3 | https://github.com/Panigale/laravel5-Points/blob/6fb559d91694a336f5a11d8408348a85395b4ff3/src/Traits/AddPoint.php#L49-L62 | train |
Panigale/laravel5-Points | src/Traits/AddPoint.php | AddPoint.createPointToUser | private function createPointToUser($number = null)
{
return Point::create([
'user_id' => $this->id,
'rule_id' => $this->ruleId,
'number' => $number
]);
} | php | private function createPointToUser($number = null)
{
return Point::create([
'user_id' => $this->id,
'rule_id' => $this->ruleId,
'number' => $number
]);
} | [
"private",
"function",
"createPointToUser",
"(",
"$",
"number",
"=",
"null",
")",
"{",
"return",
"Point",
"::",
"create",
"(",
"[",
"'user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'rule_id'",
"=>",
"$",
"this",
"->",
"ruleId",
",",
"'number'",
"=>",
... | create point to user
@param null $number | [
"create",
"point",
"to",
"user"
] | 6fb559d91694a336f5a11d8408348a85395b4ff3 | https://github.com/Panigale/laravel5-Points/blob/6fb559d91694a336f5a11d8408348a85395b4ff3/src/Traits/AddPoint.php#L69-L76 | train |
N0rthernL1ghts/Command | src/Exec.php | Exec.command | public static function command(string $command, bool $passThrough = false): CommandResultInterface
{
return new CommandResult(
new static(
$command,
$passThrough
)
);
} | php | public static function command(string $command, bool $passThrough = false): CommandResultInterface
{
return new CommandResult(
new static(
$command,
$passThrough
)
);
} | [
"public",
"static",
"function",
"command",
"(",
"string",
"$",
"command",
",",
"bool",
"$",
"passThrough",
"=",
"false",
")",
":",
"CommandResultInterface",
"{",
"return",
"new",
"CommandResult",
"(",
"new",
"static",
"(",
"$",
"command",
",",
"$",
"passThro... | Creates new instance of self, and passes it to new instance of CommandResult
@param string $command
@param bool $passThrough
@return CommandResultInterface | [
"Creates",
"new",
"instance",
"of",
"self",
"and",
"passes",
"it",
"to",
"new",
"instance",
"of",
"CommandResult"
] | 52877330a1b150f2e410d1ef6eff8f404da01481 | https://github.com/N0rthernL1ghts/Command/blob/52877330a1b150f2e410d1ef6eff8f404da01481/src/Exec.php#L50-L58 | train |
romm/configuration_object | Classes/TypeConverter/ArrayConverter.php | ArrayConverter.convertFrom | public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
{
$result = [];
$array = ('array' === $targetType)
? $source
: $convertedChildProperties;
foreach ($array as $name => ... | php | public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
{
$result = [];
$array = ('array' === $targetType)
? $source
: $convertedChildProperties;
foreach ($array as $name => ... | [
"public",
"function",
"convertFrom",
"(",
"$",
"source",
",",
"$",
"targetType",
",",
"array",
"$",
"convertedChildProperties",
"=",
"[",
"]",
",",
"PropertyMappingConfigurationInterface",
"$",
"configuration",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"[",
"... | Converts into an array, leaving child properties types.
@inheritdoc | [
"Converts",
"into",
"an",
"array",
"leaving",
"child",
"properties",
"types",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/TypeConverter/ArrayConverter.php#L49-L68 | train |
devlabmtl/haven-cms | Controller/LayoutController.php | LayoutController.showAction | public function showAction($id, $extra) {
$entity = $this->container->get("layout.read_handler")->get($id);
$delete_form = $this->container->get("layout.form_handler")->createDeleteForm($id);
// $route_collection = $this->container->get('router')->getRouteCollection()->all();
// echo '<p... | php | public function showAction($id, $extra) {
$entity = $this->container->get("layout.read_handler")->get($id);
$delete_form = $this->container->get("layout.form_handler")->createDeleteForm($id);
// $route_collection = $this->container->get('router')->getRouteCollection()->all();
// echo '<p... | [
"public",
"function",
"showAction",
"(",
"$",
"id",
",",
"$",
"extra",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"\"layout.read_handler\"",
")",
"->",
"get",
"(",
"$",
"id",
")",
";",
"$",
"delete_form",
"=",
"$"... | Finds and displays a layout entity.
@Route("/admin/{show}/layout/{id}/{extra}", requirements={"id" = "\d+", "extra" = ".+"}, defaults={"extra" = ""})
@Method("GET")
@Template() | [
"Finds",
"and",
"displays",
"a",
"layout",
"entity",
"."
] | c20761a07c201a966dbda1f3eae33617f80e1ece | https://github.com/devlabmtl/haven-cms/blob/c20761a07c201a966dbda1f3eae33617f80e1ece/Controller/LayoutController.php#L67-L88 | train |
martinlindhe/php-debughelper | src/HexPrinter.php | HexPrinter.render | public static function render($m, $rowLength = 16, $fillChar = ' ', $showOffset = true)
{
$res = '';
$rowOffset = 0;
$bytes = '';
$hex = '';
$j = 0;
for ($i = 0; $i < strlen($m); $i++) {
$x = substr($m, $i, 1);
$bytes .= self::decodeReadable... | php | public static function render($m, $rowLength = 16, $fillChar = ' ', $showOffset = true)
{
$res = '';
$rowOffset = 0;
$bytes = '';
$hex = '';
$j = 0;
for ($i = 0; $i < strlen($m); $i++) {
$x = substr($m, $i, 1);
$bytes .= self::decodeReadable... | [
"public",
"static",
"function",
"render",
"(",
"$",
"m",
",",
"$",
"rowLength",
"=",
"16",
",",
"$",
"fillChar",
"=",
"' '",
",",
"$",
"showOffset",
"=",
"true",
")",
"{",
"$",
"res",
"=",
"''",
";",
"$",
"rowOffset",
"=",
"0",
";",
"$",
"bytes",... | Prints hex dump of a binary string, similar to xxd
@param string $m
@param int $rowLength
@param string $fillChar
@param bool $showOffset
@return string of hex + ascii values | [
"Prints",
"hex",
"dump",
"of",
"a",
"binary",
"string",
"similar",
"to",
"xxd"
] | 8fde5bbfd77d71f3f0990829f235242232094734 | https://github.com/martinlindhe/php-debughelper/blob/8fde5bbfd77d71f3f0990829f235242232094734/src/HexPrinter.php#L13-L49 | train |
danielgp/common-lib | source/DomHeaderFooterByDanielGP.php | DomHeaderFooterByDanielGP.setFooterCommon | protected function setFooterCommon($footerInjected = null)
{
$sHK = $this->tCmnSuperGlobals->get('specialHook');
if (!is_null($sHK) && (in_array('noHeader', $sHK))) {
return '';
}
return $this->setFooterCommonInjected($footerInjected) . '</body></html>';
} | php | protected function setFooterCommon($footerInjected = null)
{
$sHK = $this->tCmnSuperGlobals->get('specialHook');
if (!is_null($sHK) && (in_array('noHeader', $sHK))) {
return '';
}
return $this->setFooterCommonInjected($footerInjected) . '</body></html>';
} | [
"protected",
"function",
"setFooterCommon",
"(",
"$",
"footerInjected",
"=",
"null",
")",
"{",
"$",
"sHK",
"=",
"$",
"this",
"->",
"tCmnSuperGlobals",
"->",
"get",
"(",
"'specialHook'",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sHK",
")",
"&&",
"... | Outputs an HTML footer
@param array $footerInjected
@return string | [
"Outputs",
"an",
"HTML",
"footer"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomHeaderFooterByDanielGP.php#L76-L83 | train |
danielgp/common-lib | source/DomHeaderFooterByDanielGP.php | DomHeaderFooterByDanielGP.setHeaderCommon | protected function setHeaderCommon($headerFeatures = [])
{
$sReturn = [];
$this->initializeSprGlbAndSession();
$sHK = $this->tCmnSuperGlobals->get('specialHook');
if (!is_null($sHK) && (in_array('noHeader', $sHK))) {
return ''; // no Header
}
$fixedHea... | php | protected function setHeaderCommon($headerFeatures = [])
{
$sReturn = [];
$this->initializeSprGlbAndSession();
$sHK = $this->tCmnSuperGlobals->get('specialHook');
if (!is_null($sHK) && (in_array('noHeader', $sHK))) {
return ''; // no Header
}
$fixedHea... | [
"protected",
"function",
"setHeaderCommon",
"(",
"$",
"headerFeatures",
"=",
"[",
"]",
")",
"{",
"$",
"sReturn",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"initializeSprGlbAndSession",
"(",
")",
";",
"$",
"sHK",
"=",
"$",
"this",
"->",
"tCmnSuperGlobals",
"... | Outputs an HTML header
@param array $headerFeatures
@return string | [
"Outputs",
"an",
"HTML",
"header"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomHeaderFooterByDanielGP.php#L103-L129 | train |
AmericanCouncils/MediaInfoBundle | MediaInfo.php | MediaInfo.scan | public function scan($filepath)
{
$proc = new Process(sprintf('%s %s --Output=XML --Full', $this->path, $filepath));
$proc->run();
if (!$proc->isSuccessful()) {
throw new \RuntimeException($proc->getErrorOutput());
}
$result = $proc->getOutput();
//pars... | php | public function scan($filepath)
{
$proc = new Process(sprintf('%s %s --Output=XML --Full', $this->path, $filepath));
$proc->run();
if (!$proc->isSuccessful()) {
throw new \RuntimeException($proc->getErrorOutput());
}
$result = $proc->getOutput();
//pars... | [
"public",
"function",
"scan",
"(",
"$",
"filepath",
")",
"{",
"$",
"proc",
"=",
"new",
"Process",
"(",
"sprintf",
"(",
"'%s %s --Output=XML --Full'",
",",
"$",
"this",
"->",
"path",
",",
"$",
"filepath",
")",
")",
";",
"$",
"proc",
"->",
"run",
"(",
... | Scans a file to return any structured metadata.
@param string $filepath Path to file to analyze
@return array | [
"Scans",
"a",
"file",
"to",
"return",
"any",
"structured",
"metadata",
"."
] | c1a37134c3e1c56282c115abfd53caaea7c97201 | https://github.com/AmericanCouncils/MediaInfoBundle/blob/c1a37134c3e1c56282c115abfd53caaea7c97201/MediaInfo.php#L33-L77 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/URLUtils.php | URLUtils.fullUrl | public static function fullUrl()
{
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = StringUtils::strLeft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (... | php | public static function fullUrl()
{
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = StringUtils::strLeft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (... | [
"public",
"static",
"function",
"fullUrl",
"(",
")",
"{",
"$",
"s",
"=",
"empty",
"(",
"$",
"_SERVER",
"[",
"\"HTTPS\"",
"]",
")",
"?",
"''",
":",
"(",
"$",
"_SERVER",
"[",
"\"HTTPS\"",
"]",
"==",
"\"on\"",
")",
"?",
"\"s\"",
":",
"\"\"",
";",
"$... | Returns the current, full url
@return string the current url | [
"Returns",
"the",
"current",
"full",
"url"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/URLUtils.php#L328-L335 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/URLUtils.php | URLUtils.safeUrl | public static function safeUrl($url)
{
// Strip invalid characters (anything but [a-zA-Z0-9=?&:;#_\/.-])
// $url = preg_replace("/[^a-zA-Z0-9=?&:;#_\/.-]/", '', $url);
if (empty($url))
return '';
// Prepend http:// if no scheme is specified
if (!preg_match("/^(ht... | php | public static function safeUrl($url)
{
// Strip invalid characters (anything but [a-zA-Z0-9=?&:;#_\/.-])
// $url = preg_replace("/[^a-zA-Z0-9=?&:;#_\/.-]/", '', $url);
if (empty($url))
return '';
// Prepend http:// if no scheme is specified
if (!preg_match("/^(ht... | [
"public",
"static",
"function",
"safeUrl",
"(",
"$",
"url",
")",
"{",
"// Strip invalid characters (anything but [a-zA-Z0-9=?&:;#_\\/.-])",
"// $url = preg_replace(\"/[^a-zA-Z0-9=?&:;#_\\/.-]/\", '', $url);",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"return",
"''... | Outputs a "safe" url, stripped of xss, autolink on domain, and stripped of invalid chars
@param string $url The url to process
@return string Safe and happy URL | [
"Outputs",
"a",
"safe",
"url",
"stripped",
"of",
"xss",
"autolink",
"on",
"domain",
"and",
"stripped",
"of",
"invalid",
"chars"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/URLUtils.php#L393-L410 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/URLUtils.php | URLUtils.resolveContextVariables | public static function resolveContextVariables($value, $object)
{
$value = str_replace(
array('%PATH_BUILD%', '%CONTEXT%', '%REWRITE_BASE%', '%SERVER_NAME%', '%DEVICE_VIEW%', '%DESIGN%', '%DOMAIN%', '%DOMAIN_BASE_URI%', '%DEPLOYMENT_BASE_PATH%'),
array(PATH_BUILD, ($object i... | php | public static function resolveContextVariables($value, $object)
{
$value = str_replace(
array('%PATH_BUILD%', '%CONTEXT%', '%REWRITE_BASE%', '%SERVER_NAME%', '%DEVICE_VIEW%', '%DESIGN%', '%DOMAIN%', '%DOMAIN_BASE_URI%', '%DEPLOYMENT_BASE_PATH%'),
array(PATH_BUILD, ($object i... | [
"public",
"static",
"function",
"resolveContextVariables",
"(",
"$",
"value",
",",
"$",
"object",
")",
"{",
"$",
"value",
"=",
"str_replace",
"(",
"array",
"(",
"'%PATH_BUILD%'",
",",
"'%CONTEXT%'",
",",
"'%REWRITE_BASE%'",
",",
"'%SERVER_NAME%'",
",",
"'%DEVICE... | Replace variables inside a value using the object as an originating reference
@static
@param $value
@param $object
@return mixed | [
"Replace",
"variables",
"inside",
"a",
"value",
"using",
"the",
"object",
"as",
"an",
"originating",
"reference"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/URLUtils.php#L579-L591 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/URLUtils.php | URLUtils.resolveSiteFromArray | public static function resolveSiteFromArray($siteArray, $useDomainAlias = false)
{
$site = new Site();
return self::resolveSiteContextObject($site, $siteArray, $useDomainAlias);
} | php | public static function resolveSiteFromArray($siteArray, $useDomainAlias = false)
{
$site = new Site();
return self::resolveSiteContextObject($site, $siteArray, $useDomainAlias);
} | [
"public",
"static",
"function",
"resolveSiteFromArray",
"(",
"$",
"siteArray",
",",
"$",
"useDomainAlias",
"=",
"false",
")",
"{",
"$",
"site",
"=",
"new",
"Site",
"(",
")",
";",
"return",
"self",
"::",
"resolveSiteContextObject",
"(",
"$",
"site",
",",
"$... | Creates a Site object from an array originating from the environments.xml
@static
@param $siteArray
@param bool $useDomainAlias
@return | [
"Creates",
"a",
"Site",
"object",
"from",
"an",
"array",
"originating",
"from",
"the",
"environments",
".",
"xml"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/URLUtils.php#L601-L607 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/URLUtils.php | URLUtils.resolveContextFromArray | public static function resolveContextFromArray($contextArray, $useDomainAlias = false)
{
$context = new ContextObject();
return self::resolveSiteContextObject($context, $contextArray, $useDomainAlias);
} | php | public static function resolveContextFromArray($contextArray, $useDomainAlias = false)
{
$context = new ContextObject();
return self::resolveSiteContextObject($context, $contextArray, $useDomainAlias);
} | [
"public",
"static",
"function",
"resolveContextFromArray",
"(",
"$",
"contextArray",
",",
"$",
"useDomainAlias",
"=",
"false",
")",
"{",
"$",
"context",
"=",
"new",
"ContextObject",
"(",
")",
";",
"return",
"self",
"::",
"resolveSiteContextObject",
"(",
"$",
"... | Creates a ContextObject object from an array originating from the environments.xml
@static
@param $contextArray
@param bool $useDomainAlias
@return | [
"Creates",
"a",
"ContextObject",
"object",
"from",
"an",
"array",
"originating",
"from",
"the",
"environments",
".",
"xml"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/URLUtils.php#L617-L622 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.create | public function create ($request, $match, $p)
{
// check collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
$request->REQUEST['collection'] = $collectionId;
} else {
$collectionId = $request->REQUEST['collection'];
... | php | public function create ($request, $match, $p)
{
// check collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
$request->REQUEST['collection'] = $collectionId;
} else {
$collectionId = $request->REQUEST['collection'];
... | [
"public",
"function",
"create",
"(",
"$",
"request",
",",
"$",
"match",
",",
"$",
"p",
")",
"{",
"// check collection",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'c... | Creates new instance of a document
@param Pluf_HTTP_Request $request
@param array $match
@param array $p
@return Pluf_HTTP_Response | [
"Creates",
"new",
"instance",
"of",
"a",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L23-L39 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.get | public function get ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
$collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | php | public function get ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
$collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | [
"public",
"function",
"get",
"(",
"$",
"request",
",",
"$",
"match",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'collectionId'",
"]",
";",
"}",
"else",
"... | Gets a document
@param Pluf_HTTP_Request $request
@param array $match
@throws Pluf_Exception_DoesNotExist
@return Pluf_HTTP_Response_Json | [
"Gets",
"a",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L49-L67 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.find | public function find ($request, $match)
{
// check for collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} elseif (isset($request->REQUEST['collectionId'])) {
$collectionId = $request->REQUEST['collectionId'];
}
... | php | public function find ($request, $match)
{
// check for collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} elseif (isset($request->REQUEST['collectionId'])) {
$collectionId = $request->REQUEST['collectionId'];
}
... | [
"public",
"function",
"find",
"(",
"$",
"request",
",",
"$",
"match",
")",
"{",
"// check for collection",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'collectionId'",
"]... | Search for an document
@param Pluf_HTTP_Request $request
@param array $match
@return Pluf_HTTP_Response_Json | [
"Search",
"for",
"an",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L76-L114 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.remove | public function remove ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
$collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | php | public function remove ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
$collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | [
"public",
"function",
"remove",
"(",
"$",
"request",
",",
"$",
"match",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'collectionId'",
"]",
";",
"}",
"else",
... | Removes a document
@param Pluf_HTTP_Request $request
@param array $match
@throws Pluf_Exception_DoesNotExist
@return Pluf_HTTP_Response_Json | [
"Removes",
"a",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L124-L151 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.update | public function update ($request, $match, $p)
{
// check collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
$request->REQUEST['collection'] = $collectionId;
} else {
$collectionId = $request->REQUEST['collection'];
... | php | public function update ($request, $match, $p)
{
// check collection
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
$request->REQUEST['collection'] = $collectionId;
} else {
$collectionId = $request->REQUEST['collection'];
... | [
"public",
"function",
"update",
"(",
"$",
"request",
",",
"$",
"match",
",",
"$",
"p",
")",
"{",
"// check collection",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'c... | Updates a document
@param Pluf_HTTP_Request $request
@param array $match
@param array $p
@throws Pluf_Exception_DoesNotExist
@return Pluf_HTTP_Response | [
"Updates",
"a",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L162-L184 | train |
pluf/collection | src/Collection/Views/Document.php | Collection_Views_Document.putMap | public function putMap ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
// $collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | php | public function putMap ($request, $match)
{
if (isset($match['collectionId'])) {
$collectionId = $match['collectionId'];
} else {
$collectionId = $request->REQUEST['collectionId'];
}
// $collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection',
... | [
"public",
"function",
"putMap",
"(",
"$",
"request",
",",
"$",
"match",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"match",
"[",
"'collectionId'",
"]",
")",
")",
"{",
"$",
"collectionId",
"=",
"$",
"match",
"[",
"'collectionId'",
"]",
";",
"}",
"else",
... | Puts attributes of a document
@param Pluf_HTTP_Request $request
@param array $match | [
"Puts",
"attributes",
"of",
"a",
"document"
] | ae229d12e5ec352c66b31d5f89752f91f1342920 | https://github.com/pluf/collection/blob/ae229d12e5ec352c66b31d5f89752f91f1342920/src/Collection/Views/Document.php#L225-L251 | train |
opensourcerefinery/vicus | src/Storage/Handler/DeglobalizedMySQLSessionHandler.php | DeglobalizedMySQLSessionHandler.connect | private function connect()
{
$this->sessionLink = mysqli_connect($this->host_master,$this->user,$this->password,$this->name) or die("Error " . mysqli_error($this->sessionLink));
// $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions);
// $this->pdo->setAttribute(\... | php | private function connect()
{
$this->sessionLink = mysqli_connect($this->host_master,$this->user,$this->password,$this->name) or die("Error " . mysqli_error($this->sessionLink));
// $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions);
// $this->pdo->setAttribute(\... | [
"private",
"function",
"connect",
"(",
")",
"{",
"$",
"this",
"->",
"sessionLink",
"=",
"mysqli_connect",
"(",
"$",
"this",
"->",
"host_master",
",",
"$",
"this",
"->",
"user",
",",
"$",
"this",
"->",
"password",
",",
"$",
"this",
"->",
"name",
")",
... | NOT WORKING!!!
Lazy-connects to the database.
@param string $dsn DSN string | [
"NOT",
"WORKING!!!",
"Lazy",
"-",
"connects",
"to",
"the",
"database",
"."
] | 5be93d75bf6ab8009a299e9946c8333f0017fa3e | https://github.com/opensourcerefinery/vicus/blob/5be93d75bf6ab8009a299e9946c8333f0017fa3e/src/Storage/Handler/DeglobalizedMySQLSessionHandler.php#L218-L225 | train |
mwyatt/core | src/Iterator/Model.php | Model.getKeyedByPropertyMulti | public function getKeyedByPropertyMulti($property)
{
$keyed = [];
foreach ($this as $model) {
if (empty($keyed[$model->$property])) {
$keyed[$model->$property] = [];
}
$keyed[$model->$property][] = $model;
}
return $keyed;
} | php | public function getKeyedByPropertyMulti($property)
{
$keyed = [];
foreach ($this as $model) {
if (empty($keyed[$model->$property])) {
$keyed[$model->$property] = [];
}
$keyed[$model->$property][] = $model;
}
return $keyed;
} | [
"public",
"function",
"getKeyedByPropertyMulti",
"(",
"$",
"property",
")",
"{",
"$",
"keyed",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"model",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"keyed",
"[",
"$",
"model",
"->",
"$",
"prop... | key the iterator by the specified property
but go 2 levels
@param string $property
@return array | [
"key",
"the",
"iterator",
"by",
"the",
"specified",
"property",
"but",
"go",
"2",
"levels"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Iterator/Model.php#L78-L88 | train |
raulfraile/ladybug-plugin-extra | Type/CollectionType.php | CollectionType.loadFromArray | public function loadFromArray(array $data, $useKeys = true)
{
$this->items = array();
foreach ($data as $key => $item) {
$this->items[] = $item;
}
} | php | public function loadFromArray(array $data, $useKeys = true)
{
$this->items = array();
foreach ($data as $key => $item) {
$this->items[] = $item;
}
} | [
"public",
"function",
"loadFromArray",
"(",
"array",
"$",
"data",
",",
"$",
"useKeys",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$"... | Loads collection values from the given array
@param array $data
@param bool $useKeys | [
"Loads",
"collection",
"values",
"from",
"the",
"given",
"array"
] | 0d569c28eb4706506f0057d95a1da9dd2c76c329 | https://github.com/raulfraile/ladybug-plugin-extra/blob/0d569c28eb4706506f0057d95a1da9dd2c76c329/Type/CollectionType.php#L40-L47 | train |
geniv/nette-general-form | src/GeneralForm.php | GeneralForm.getDefinitionFormContainer | public static function getDefinitionFormContainer(CompilerExtension $compilerExtension, $indexConfig = 'formContainer', $prefixName = 'formContainer'): ServiceDefinition
{
$builder = $compilerExtension->getContainerBuilder();
$config = $compilerExtension->getConfig();
return $builder->addDe... | php | public static function getDefinitionFormContainer(CompilerExtension $compilerExtension, $indexConfig = 'formContainer', $prefixName = 'formContainer'): ServiceDefinition
{
$builder = $compilerExtension->getContainerBuilder();
$config = $compilerExtension->getConfig();
return $builder->addDe... | [
"public",
"static",
"function",
"getDefinitionFormContainer",
"(",
"CompilerExtension",
"$",
"compilerExtension",
",",
"$",
"indexConfig",
"=",
"'formContainer'",
",",
"$",
"prefixName",
"=",
"'formContainer'",
")",
":",
"ServiceDefinition",
"{",
"$",
"builder",
"=",
... | Get definition form container.
@param CompilerExtension $compilerExtension
@param string $indexConfig
@param string $prefixName
@return ServiceDefinition | [
"Get",
"definition",
"form",
"container",
"."
] | 0d0548b63cf7db58c17ee12d6933f2dd995a64e6 | https://github.com/geniv/nette-general-form/blob/0d0548b63cf7db58c17ee12d6933f2dd995a64e6/src/GeneralForm.php#L30-L38 | train |
geniv/nette-general-form | src/GeneralForm.php | GeneralForm.getDefinitionEventContainer | public static function getDefinitionEventContainer(CompilerExtension $compilerExtension, $indexConfig = 'events'): array
{
$builder = $compilerExtension->getContainerBuilder();
$config = $compilerExtension->getConfig();
$events = [];
foreach ($config[$indexConfig] as $index => $even... | php | public static function getDefinitionEventContainer(CompilerExtension $compilerExtension, $indexConfig = 'events'): array
{
$builder = $compilerExtension->getContainerBuilder();
$config = $compilerExtension->getConfig();
$events = [];
foreach ($config[$indexConfig] as $index => $even... | [
"public",
"static",
"function",
"getDefinitionEventContainer",
"(",
"CompilerExtension",
"$",
"compilerExtension",
",",
"$",
"indexConfig",
"=",
"'events'",
")",
":",
"array",
"{",
"$",
"builder",
"=",
"$",
"compilerExtension",
"->",
"getContainerBuilder",
"(",
")",... | Get definition event container.
@param CompilerExtension $compilerExtension
@param string $indexConfig
@return array | [
"Get",
"definition",
"event",
"container",
"."
] | 0d0548b63cf7db58c17ee12d6933f2dd995a64e6 | https://github.com/geniv/nette-general-form/blob/0d0548b63cf7db58c17ee12d6933f2dd995a64e6/src/GeneralForm.php#L48-L77 | train |
squareproton/Bond | src/Bond/Entity/Types/PgLargeObject.php | PgLargeObject.chainSaving | public function chainSaving( array &$tasks, $key )
{
if( $this->isNew() or $this->isChanged() ) {
$tasks[$key] = $this;
}
} | php | public function chainSaving( array &$tasks, $key )
{
if( $this->isNew() or $this->isChanged() ) {
$tasks[$key] = $this;
}
} | [
"public",
"function",
"chainSaving",
"(",
"array",
"&",
"$",
"tasks",
",",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
"or",
"$",
"this",
"->",
"isChanged",
"(",
")",
")",
"{",
"$",
"tasks",
"[",
"$",
"key",
"]",
"=",... | Add a object to the chain task array if it is changed or new
Required for ChainSavingInterface
@param array $task The existing array of tasks
@param string $key The string under which to add the object | [
"Add",
"a",
"object",
"to",
"the",
"chain",
"task",
"array",
"if",
"it",
"is",
"changed",
"or",
"new",
"Required",
"for",
"ChainSavingInterface"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/PgLargeObject.php#L96-L101 | train |
squareproton/Bond | src/Bond/Entity/Types/PgLargeObject.php | PgLargeObject.md5 | public function md5()
{
if( isset( $this->filePath ) ) {
return md5_file( $this->filePath );
} elseif( $this->oid ) {
$query = new Query(
"SELECT common.md5( %oid:oid|cast% );",
array(
'oid' => $this->oid
... | php | public function md5()
{
if( isset( $this->filePath ) ) {
return md5_file( $this->filePath );
} elseif( $this->oid ) {
$query = new Query(
"SELECT common.md5( %oid:oid|cast% );",
array(
'oid' => $this->oid
... | [
"public",
"function",
"md5",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
"{",
"return",
"md5_file",
"(",
"$",
"this",
"->",
"filePath",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"oid",
")",
"{",
"$",
... | Return the MD5 hash of the data
@return mixed | [
"Return",
"the",
"MD5",
"hash",
"of",
"the",
"data"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/PgLargeObject.php#L184-L207 | train |
squareproton/Bond | src/Bond/Entity/Types/PgLargeObject.php | PgLargeObject.data | public function data()
{
if( isset( $this->filePath ) ) {
return file_get_contents( $this->filePath );
} elseif( $this->oid ) {
$pg = $this->oid->pg;
$pg->query( new Query( 'BEGIN' ) );
$handle = pg_lo_open( $pg->resource->get(), $this->oid->oid, ... | php | public function data()
{
if( isset( $this->filePath ) ) {
return file_get_contents( $this->filePath );
} elseif( $this->oid ) {
$pg = $this->oid->pg;
$pg->query( new Query( 'BEGIN' ) );
$handle = pg_lo_open( $pg->resource->get(), $this->oid->oid, ... | [
"public",
"function",
"data",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
"{",
"return",
"file_get_contents",
"(",
"$",
"this",
"->",
"filePath",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"oid",
")",
"{",... | Get the data stored in the large object resource.
@param void
@return mixed | [
"Get",
"the",
"data",
"stored",
"in",
"the",
"large",
"object",
"resource",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/PgLargeObject.php#L214-L243 | train |
squareproton/Bond | src/Bond/Entity/Types/PgLargeObject.php | PgLargeObject.export | public function export( $destination, $overwriteIfExists = false )
{
if( !is_string( $destination ) ){
throw new \RuntimeException(sprintf(
'Expected $destination to be a string, got type: %s',
gettype($destination)
));
}
if( file_exi... | php | public function export( $destination, $overwriteIfExists = false )
{
if( !is_string( $destination ) ){
throw new \RuntimeException(sprintf(
'Expected $destination to be a string, got type: %s',
gettype($destination)
));
}
if( file_exi... | [
"public",
"function",
"export",
"(",
"$",
"destination",
",",
"$",
"overwriteIfExists",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"destination",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Expected $... | Export the data stored in the large object resource to the specified file.
@param mixed $destination
@return boolean. | [
"Export",
"the",
"data",
"stored",
"in",
"the",
"large",
"object",
"resource",
"to",
"the",
"specified",
"file",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/PgLargeObject.php#L250-L282 | train |
squareproton/Bond | src/Bond/Entity/Types/PgLargeObject.php | PgLargeObject.stream | public function stream()
{
// filesystem
if( isset( $this->filePath ) ) {
return readfile( $this->filePath );
} elseif ( $this->oid ) {
$pg = $this->oid->pg;
$pg->query( new Query( 'BEGIN' ) );
$handle = pg_lo_open( $pg->resource->get(), ... | php | public function stream()
{
// filesystem
if( isset( $this->filePath ) ) {
return readfile( $this->filePath );
} elseif ( $this->oid ) {
$pg = $this->oid->pg;
$pg->query( new Query( 'BEGIN' ) );
$handle = pg_lo_open( $pg->resource->get(), ... | [
"public",
"function",
"stream",
"(",
")",
"{",
"// filesystem",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
"{",
"return",
"readfile",
"(",
"$",
"this",
"->",
"filePath",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"oid",
... | Output the data stored in the large object resource to stdout.
@param void
@return void | [
"Output",
"the",
"data",
"stored",
"in",
"the",
"large",
"object",
"resource",
"to",
"stdout",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/PgLargeObject.php#L289-L316 | train |
phpffcms/ffcms-core | src/Managers/CronManager.php | CronManager.run | public function run()
{
// check if cron instances is defined
if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) {
return null;
}
// get timestamp
$time = time();
$log = [];
// each every one instance
f... | php | public function run()
{
// check if cron instances is defined
if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) {
return null;
}
// get timestamp
$time = time();
$log = [];
// each every one instance
f... | [
"public",
"function",
"run",
"(",
")",
"{",
"// check if cron instances is defined",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configs",
"[",
"'instances'",
"]",
")",
"||",
"!",
"Any",
"::",
"isArray",
"(",
"$",
"this",
"->",
"configs",
"[",
"'in... | Run cron task. Attention - this method is too 'fat' to run from any app's
@return array|null | [
"Run",
"cron",
"task",
".",
"Attention",
"-",
"this",
"method",
"is",
"too",
"fat",
"to",
"run",
"from",
"any",
"app",
"s"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Managers/CronManager.php#L34-L63 | train |
phpffcms/ffcms-core | src/Managers/CronManager.php | CronManager.remove | public function remove($class, $method)
{
$callback = $class . '::' . $method;
if (isset($this->configs['instances'][$callback])) {
unset($this->configs['instances'][$callback], $this->configs['log'][$callback]);
App::$Properties->writeConfig('Cron', $this->configs);
... | php | public function remove($class, $method)
{
$callback = $class . '::' . $method;
if (isset($this->configs['instances'][$callback])) {
unset($this->configs['instances'][$callback], $this->configs['log'][$callback]);
App::$Properties->writeConfig('Cron', $this->configs);
... | [
"public",
"function",
"remove",
"(",
"$",
"class",
",",
"$",
"method",
")",
"{",
"$",
"callback",
"=",
"$",
"class",
".",
"'::'",
".",
"$",
"method",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configs",
"[",
"'instances'",
"]",
"[",
"$",
"... | Remove registered cron task from configs
@param string $class
@param string $method | [
"Remove",
"registered",
"cron",
"task",
"from",
"configs"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Managers/CronManager.php#L95-L102 | train |
eltrino/PHPUnit_MockAnnotations | src/Eltrino/PHPUnit/MockAnnotations/PlainMockObjectFactory.php | PlainMockObjectFactory.create | public function create($classToMock)
{
$mockBuilder = new \PHPUnit_Framework_MockObject_MockBuilder(
$this->testCase, $classToMock
);
$mockBuilder->disableOriginalConstructor();
return $mockBuilder->getMock();
} | php | public function create($classToMock)
{
$mockBuilder = new \PHPUnit_Framework_MockObject_MockBuilder(
$this->testCase, $classToMock
);
$mockBuilder->disableOriginalConstructor();
return $mockBuilder->getMock();
} | [
"public",
"function",
"create",
"(",
"$",
"classToMock",
")",
"{",
"$",
"mockBuilder",
"=",
"new",
"\\",
"PHPUnit_Framework_MockObject_MockBuilder",
"(",
"$",
"this",
"->",
"testCase",
",",
"$",
"classToMock",
")",
";",
"$",
"mockBuilder",
"->",
"disableOriginal... | Creates simple PHPUnit Mock Object with disabled original constructor
@param string $classToMock
@return \PHPUnit_Framework_MockObject_MockObject | [
"Creates",
"simple",
"PHPUnit",
"Mock",
"Object",
"with",
"disabled",
"original",
"constructor"
] | 1a06ed59ea0702359848fc01e958f4f92abb503a | https://github.com/eltrino/PHPUnit_MockAnnotations/blob/1a06ed59ea0702359848fc01e958f4f92abb503a/src/Eltrino/PHPUnit/MockAnnotations/PlainMockObjectFactory.php#L21-L28 | train |
olobu/olobu | core/router.php | O_Router._parse_routes | private function _parse_routes()
{
$uri=implode('/', $this->uri->segments());
if (isset($this->router[$uri])) {
return $this->_set_request(explode('/', $this->router[$uri]));
}
foreach ($this->router as $key => $val) {
$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
if (preg_... | php | private function _parse_routes()
{
$uri=implode('/', $this->uri->segments());
if (isset($this->router[$uri])) {
return $this->_set_request(explode('/', $this->router[$uri]));
}
foreach ($this->router as $key => $val) {
$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
if (preg_... | [
"private",
"function",
"_parse_routes",
"(",
")",
"{",
"$",
"uri",
"=",
"implode",
"(",
"'/'",
",",
"$",
"this",
"->",
"uri",
"->",
"segments",
"(",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"router",
"[",
"$",
"uri",
"]",
")",
... | disini mo ba atur akan apa mo kamana | [
"disini",
"mo",
"ba",
"atur",
"akan",
"apa",
"mo",
"kamana"
] | 05bea2bff63d3e38b458fb42e8f07f1d850ae211 | https://github.com/olobu/olobu/blob/05bea2bff63d3e38b458fb42e8f07f1d850ae211/core/router.php#L58-L79 | train |
ARCANESOFT/SEO | src/Providers/PackagesServiceProvider.php | PackagesServiceProvider.registerLaravelSeoPackage | private function registerLaravelSeoPackage()
{
$this->registerProvider(LaravelSeoServiceProvider::class);
$this->app->booting(function () {
Seo::setConfig('database', config('arcanesoft.seo.database'));
Seo::setConfig('metas', config('arcanesoft.seo.metas'));
Seo... | php | private function registerLaravelSeoPackage()
{
$this->registerProvider(LaravelSeoServiceProvider::class);
$this->app->booting(function () {
Seo::setConfig('database', config('arcanesoft.seo.database'));
Seo::setConfig('metas', config('arcanesoft.seo.metas'));
Seo... | [
"private",
"function",
"registerLaravelSeoPackage",
"(",
")",
"{",
"$",
"this",
"->",
"registerProvider",
"(",
"LaravelSeoServiceProvider",
"::",
"class",
")",
";",
"$",
"this",
"->",
"app",
"->",
"booting",
"(",
"function",
"(",
")",
"{",
"Seo",
"::",
"setC... | Register Laravel Seo package. | [
"Register",
"Laravel",
"Seo",
"package",
"."
] | ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2 | https://github.com/ARCANESOFT/SEO/blob/ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2/src/Providers/PackagesServiceProvider.php#L41-L53 | train |
lasallecms/lasallecms-l5-mailgun-pkg | src/Processing/Validation.php | Validation.verifyWebhookSignature | public function verifyWebhookSignature() {
$timestamp = $this->request->input('timestamp');
$token = $this->request->input('token');
$signature = $this->request->input('signature');
// The Mailgun config param is an array, so grab the full array
$configMailgun = config('se... | php | public function verifyWebhookSignature() {
$timestamp = $this->request->input('timestamp');
$token = $this->request->input('token');
$signature = $this->request->input('signature');
// The Mailgun config param is an array, so grab the full array
$configMailgun = config('se... | [
"public",
"function",
"verifyWebhookSignature",
"(",
")",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"request",
"->",
"input",
"(",
"'timestamp'",
")",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"request",
"->",
"input",
"(",
"'token'",
")",
";",
"... | Ensure the authenticity of inbound Mailgun request
https://documentation.mailgun.com/user_manual.html#webhooks
https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Mailgun.php
http://php.net/manual/en/function.hash-hmac.php
@param timestamp $timestamp Mailgun's timestamp in the POST request
@param strin... | [
"Ensure",
"the",
"authenticity",
"of",
"inbound",
"Mailgun",
"request"
] | f6c1fb92211b2537db87a1f03c126dc46691ee5e | https://github.com/lasallecms/lasallecms-l5-mailgun-pkg/blob/f6c1fb92211b2537db87a1f03c126dc46691ee5e/src/Processing/Validation.php#L80-L99 | train |
lasallecms/lasallecms-l5-mailgun-pkg | src/Processing/Validation.php | Validation.isInboundEmailToEmailAddressMapToUser | public function isInboundEmailToEmailAddressMapToUser() {
// We map an inbound Mailgun route to a record in the "users" table, by email address
$mappedRoutes = config('lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address');
foreach ($mappedRoutes as $route => $user) {
... | php | public function isInboundEmailToEmailAddressMapToUser() {
// We map an inbound Mailgun route to a record in the "users" table, by email address
$mappedRoutes = config('lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address');
foreach ($mappedRoutes as $route => $user) {
... | [
"public",
"function",
"isInboundEmailToEmailAddressMapToUser",
"(",
")",
"{",
"// We map an inbound Mailgun route to a record in the \"users\" table, by email address",
"$",
"mappedRoutes",
"=",
"config",
"(",
"'lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address'",
")",
... | Does the recipient's email address map to an email address in the "users" database table?
@return bool | [
"Does",
"the",
"recipient",
"s",
"email",
"address",
"map",
"to",
"an",
"email",
"address",
"in",
"the",
"users",
"database",
"table?"
] | f6c1fb92211b2537db87a1f03c126dc46691ee5e | https://github.com/lasallecms/lasallecms-l5-mailgun-pkg/blob/f6c1fb92211b2537db87a1f03c126dc46691ee5e/src/Processing/Validation.php#L106-L120 | train |
lasallecms/lasallecms-l5-mailgun-pkg | src/Processing/Validation.php | Validation.isMappedUserExistInUsersTable | public function isMappedUserExistInUsersTable() {
// get the mapped recipient (valid because $this->isInboundEmailToEmailAddressMapToUser() is already done)
$mappedRoutes = config('lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address');
foreach ($mappedRoutes as $route => $user... | php | public function isMappedUserExistInUsersTable() {
// get the mapped recipient (valid because $this->isInboundEmailToEmailAddressMapToUser() is already done)
$mappedRoutes = config('lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address');
foreach ($mappedRoutes as $route => $user... | [
"public",
"function",
"isMappedUserExistInUsersTable",
"(",
")",
"{",
"// get the mapped recipient (valid because $this->isInboundEmailToEmailAddressMapToUser() is already done)",
"$",
"mappedRoutes",
"=",
"config",
"(",
"'lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address'... | Does the mapped user actually exist in the "users" db table?
@return bool | [
"Does",
"the",
"mapped",
"user",
"actually",
"exist",
"in",
"the",
"users",
"db",
"table?"
] | f6c1fb92211b2537db87a1f03c126dc46691ee5e | https://github.com/lasallecms/lasallecms-l5-mailgun-pkg/blob/f6c1fb92211b2537db87a1f03c126dc46691ee5e/src/Processing/Validation.php#L127-L145 | train |
Xsaven/laravel-intelect-admin | src/Addons/GoogleTranslate/TranslateClient.php | TranslateClient.staticTranslate | private static function staticTranslate($source, $target, $string)
{
self::checkStaticInstance();
try {
$result = self::$staticInstance
->setSource($source)
->setTarget($target)
->translate($string);
} catch (Exception $e) {
... | php | private static function staticTranslate($source, $target, $string)
{
self::checkStaticInstance();
try {
$result = self::$staticInstance
->setSource($source)
->setTarget($target)
->translate($string);
} catch (Exception $e) {
... | [
"private",
"static",
"function",
"staticTranslate",
"(",
"$",
"source",
",",
"$",
"target",
",",
"$",
"string",
")",
"{",
"self",
"::",
"checkStaticInstance",
"(",
")",
";",
"try",
"{",
"$",
"result",
"=",
"self",
"::",
"$",
"staticInstance",
"->",
"setS... | Translate text statically.
This can be called from static method translate() using __callStatic() magic method.
Use TranslateClient::translate($source, $target, $string) instead.
@param string $source Source language
@param string $target Target language
@param string $string Text to translate
@throws InvalidArgumen... | [
"Translate",
"text",
"statically",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Addons/GoogleTranslate/TranslateClient.php#L437-L450 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setLemma | public function setLemma(\Innova\LexiconBundle\Entity\Lemma $lemma = null)
{
$this->lemma = $lemma;
return $this;
} | php | public function setLemma(\Innova\LexiconBundle\Entity\Lemma $lemma = null)
{
$this->lemma = $lemma;
return $this;
} | [
"public",
"function",
"setLemma",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Lemma",
"$",
"lemma",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"lemma",
"=",
"$",
"lemma",
";",
"return",
"$",
"this",
";",
"}"
] | Set lemma.
@param \Innova\LexiconBundle\Entity\Lemma $lemma
@return Inflection | [
"Set",
"lemma",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L180-L185 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setNumber | public function setNumber(\Innova\LexiconBundle\Entity\Number $number = null)
{
$this->number = $number;
return $this;
} | php | public function setNumber(\Innova\LexiconBundle\Entity\Number $number = null)
{
$this->number = $number;
return $this;
} | [
"public",
"function",
"setNumber",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Number",
"$",
"number",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"number",
"=",
"$",
"number",
";",
"return",
"$",
"this",
";",
"}"
] | Set number.
@param \Innova\LexiconBundle\Entity\Number $number
@return Inflection | [
"Set",
"number",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L204-L209 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setGender | public function setGender(\Innova\LexiconBundle\Entity\Gender $gender = null)
{
$this->gender = $gender;
return $this;
} | php | public function setGender(\Innova\LexiconBundle\Entity\Gender $gender = null)
{
$this->gender = $gender;
return $this;
} | [
"public",
"function",
"setGender",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Gender",
"$",
"gender",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"gender",
"=",
"$",
"gender",
";",
"return",
"$",
"this",
";",
"}"
] | Set gender.
@param \Innova\LexiconBundle\Entity\Gender $gender
@return Inflection | [
"Set",
"gender",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L228-L233 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setTense | public function setTense(\Innova\LexiconBundle\Entity\Tense $tense = null)
{
$this->tense = $tense;
return $this;
} | php | public function setTense(\Innova\LexiconBundle\Entity\Tense $tense = null)
{
$this->tense = $tense;
return $this;
} | [
"public",
"function",
"setTense",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Tense",
"$",
"tense",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"tense",
"=",
"$",
"tense",
";",
"return",
"$",
"this",
";",
"}"
] | Set tense.
@param \Innova\LexiconBundle\Entity\Tense $tense
@return Inflection | [
"Set",
"tense",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L252-L257 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setPerson | public function setPerson(\Innova\LexiconBundle\Entity\Person $person = null)
{
$this->person = $person;
return $this;
} | php | public function setPerson(\Innova\LexiconBundle\Entity\Person $person = null)
{
$this->person = $person;
return $this;
} | [
"public",
"function",
"setPerson",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Person",
"$",
"person",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"person",
"=",
"$",
"person",
";",
"return",
"$",
"this",
";",
"}"
] | Set person.
@param \Innova\LexiconBundle\Entity\Person $person
@return Inflection | [
"Set",
"person",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L276-L281 | train |
InnovaLangues/LexiconBundle | Entity/Inflection.php | Inflection.setMood | public function setMood(\Innova\LexiconBundle\Entity\Mood $mood = null)
{
$this->mood = $mood;
return $this;
} | php | public function setMood(\Innova\LexiconBundle\Entity\Mood $mood = null)
{
$this->mood = $mood;
return $this;
} | [
"public",
"function",
"setMood",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Mood",
"$",
"mood",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"mood",
"=",
"$",
"mood",
";",
"return",
"$",
"this",
";",
"}"
] | Set mood.
@param \Innova\LexiconBundle\Entity\Mood $mood
@return Inflection | [
"Set",
"mood",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Inflection.php#L300-L305 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/JSONUtils.php | JSONUtils.decode | public static function decode($string, $returnArrays = false)
{
$result = json_decode($string, $returnArrays);
if (function_exists('json_last_error')) {
switch (json_last_error()) {
case JSON_ERROR_NONE:
return $result;
case JSON_ERRO... | php | public static function decode($string, $returnArrays = false)
{
$result = json_decode($string, $returnArrays);
if (function_exists('json_last_error')) {
switch (json_last_error()) {
case JSON_ERROR_NONE:
return $result;
case JSON_ERRO... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"string",
",",
"$",
"returnArrays",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"json_decode",
"(",
"$",
"string",
",",
"$",
"returnArrays",
")",
";",
"if",
"(",
"function_exists",
"(",
"'json_last_error'... | Performs a JSON decode of the string
@param string $string The json string being decoded.
@param boolean $returnArrays When TRUE, returned objects will be converted into associative arrays.
@throws Exception When a json error occurs
@return mixed | [
"Performs",
"a",
"JSON",
"decode",
"of",
"the",
"string"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/JSONUtils.php#L54-L80 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/JSONUtils.php | JSONUtils.encode | public static function encode($obj, $pretty = false, $html = false)
{
$s = json_encode($obj);
if ($pretty) {
return self::format($s, $html);
}
return $s;
} | php | public static function encode($obj, $pretty = false, $html = false)
{
$s = json_encode($obj);
if ($pretty) {
return self::format($s, $html);
}
return $s;
} | [
"public",
"static",
"function",
"encode",
"(",
"$",
"obj",
",",
"$",
"pretty",
"=",
"false",
",",
"$",
"html",
"=",
"false",
")",
"{",
"$",
"s",
"=",
"json_encode",
"(",
"$",
"obj",
")",
";",
"if",
"(",
"$",
"pretty",
")",
"{",
"return",
"self",
... | Encodes the object in json
@param mixed $obj The object to encode
@param boolean $pretty When TRUE, the output is "pretty" with proper indentation
@param boolean $html If true, return the JSON in a format suitable for display in a web browser
Default: false
@return string | [
"Encodes",
"the",
"object",
"in",
"json"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/JSONUtils.php#L92-L101 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/JSONUtils.php | JSONUtils.format | public static function format($json, $html = false)
{
$format = str_replace(
[
' ',
'\/',
], [
' ',
'/',
], json_encode(
json_decode(
str_replace(
... | php | public static function format($json, $html = false)
{
$format = str_replace(
[
' ',
'\/',
], [
' ',
'/',
], json_encode(
json_decode(
str_replace(
... | [
"public",
"static",
"function",
"format",
"(",
"$",
"json",
",",
"$",
"html",
"=",
"false",
")",
"{",
"$",
"format",
"=",
"str_replace",
"(",
"[",
"' '",
",",
"'\\/'",
",",
"]",
",",
"[",
"' '",
",",
"'/'",
",",
"]",
",",
"json_encode",
"(",
... | Indents a flat JSON string to make it more human-readable
Use php function JSON_PRETTY_PRINT. Require php >= 5.4
@param string $json The original JSON string to process
@param boolean $html If true, return the JSON in a format suitable for display in a web browser
Default: false
@return string Indented version of th... | [
"Indents",
"a",
"flat",
"JSON",
"string",
"to",
"make",
"it",
"more",
"human",
"-",
"readable",
"Use",
"php",
"function",
"JSON_PRETTY_PRINT",
".",
"Require",
"php",
">",
"=",
"5",
".",
"4"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/JSONUtils.php#L118-L158 | train |
Polosa/shade-framework-core | app/Router.php | Router.isRequestedUrlClean | public function isRequestedUrlClean(Request\Web $request)
{
$server = $request->getServer();
if (!isset($server['REQUEST_URI'])) {
throw new Exception('REQUEST_URI is not set');
}
return strpos($server['REQUEST_URI'], $this->entryPoint) !== 0;
} | php | public function isRequestedUrlClean(Request\Web $request)
{
$server = $request->getServer();
if (!isset($server['REQUEST_URI'])) {
throw new Exception('REQUEST_URI is not set');
}
return strpos($server['REQUEST_URI'], $this->entryPoint) !== 0;
} | [
"public",
"function",
"isRequestedUrlClean",
"(",
"Request",
"\\",
"Web",
"$",
"request",
")",
"{",
"$",
"server",
"=",
"$",
"request",
"->",
"getServer",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"server",
"[",
"'REQUEST_URI'",
"]",
")",
")",
... | Check that requested URL is clean
@param \Shade\Request\Web $request Request
@throws \Shade\Exception
@return bool | [
"Check",
"that",
"requested",
"URL",
"is",
"clean"
] | d735d3e8e0616fb9cf4ffc25b8425762ed07940f | https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/Router.php#L146-L154 | train |
Polosa/shade-framework-core | app/Router.php | Router.validateRouteMapping | protected function validateRouteMapping(Route\Mapping $mapping)
{
if (!class_exists($mapping->controller())) {
throw new Exception("Controller '{$mapping->controller()}' not found");
}
if (!method_exists($mapping->controller(), $mapping->action())) {
throw new Except... | php | protected function validateRouteMapping(Route\Mapping $mapping)
{
if (!class_exists($mapping->controller())) {
throw new Exception("Controller '{$mapping->controller()}' not found");
}
if (!method_exists($mapping->controller(), $mapping->action())) {
throw new Except... | [
"protected",
"function",
"validateRouteMapping",
"(",
"Route",
"\\",
"Mapping",
"$",
"mapping",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"mapping",
"->",
"controller",
"(",
")",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Controller '{$map... | Validate Route Mapping
@param \Shade\Route\Mapping $mapping Route Mapping
@throws \Shade\Exception | [
"Validate",
"Route",
"Mapping"
] | d735d3e8e0616fb9cf4ffc25b8425762ed07940f | https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/Router.php#L189-L198 | train |
bseddon/XPath20 | Value/TimeValue.php | TimeValue.TimezoneToInterval | public function TimezoneToInterval()
{
// Get the timezone
$timezone = $this->Value->getTimezone()->getName();
// No deviation returns an empty sequence
if ( $timezone == "Z" || $timezone == "+00:00" || $timezone == date_default_timezone_get() )
{
return DayTimeDurationValue::Parse( "PT0S" );
... | php | public function TimezoneToInterval()
{
// Get the timezone
$timezone = $this->Value->getTimezone()->getName();
// No deviation returns an empty sequence
if ( $timezone == "Z" || $timezone == "+00:00" || $timezone == date_default_timezone_get() )
{
return DayTimeDurationValue::Parse( "PT0S" );
... | [
"public",
"function",
"TimezoneToInterval",
"(",
")",
"{",
"// Get the timezone\r",
"$",
"timezone",
"=",
"$",
"this",
"->",
"Value",
"->",
"getTimezone",
"(",
")",
"->",
"getName",
"(",
")",
";",
"// No deviation returns an empty sequence\r",
"if",
"(",
"$",
"t... | Create a DayTimeDurationValue representation of the timezone offset
@return DayTimeDurationValue | [
"Create",
"a",
"DayTimeDurationValue",
"representation",
"of",
"the",
"timezone",
"offset"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/TimeValue.php#L159-L183 | train |
black-lamp/blcms-cart | frontend/components/user/controllers/SecurityController.php | SecurityController.actionLogin | public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
\Yii::$app->getResponse()->redirect(Url::to([\Yii::$app->getHomeUrl()]));
}
/** @var LoginForm $model */
$model = \Yii::createObject(LoginForm::className());
$event = $this->getFormEvent($model);
... | php | public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
\Yii::$app->getResponse()->redirect(Url::to([\Yii::$app->getHomeUrl()]));
}
/** @var LoginForm $model */
$model = \Yii::createObject(LoginForm::className());
$event = $this->getFormEvent($model);
... | [
"public",
"function",
"actionLogin",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"isGuest",
")",
"{",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getResponse",
"(",
")",
"->",
"redirect",
"(",
"Url",
"::",
"to",
"(... | Displays the login page.
@return string|Response | [
"Displays",
"the",
"login",
"page",
"."
] | 314796eecae3ca4ed5fecfdc0231a738af50eba7 | https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/frontend/components/user/controllers/SecurityController.php#L19-L59 | train |
black-lamp/blcms-cart | frontend/components/user/controllers/SecurityController.php | SecurityController.actionLogout | public function actionLogout()
{
$event = $this->getUserEvent(\Yii::$app->user->identity);
$this->trigger(self::EVENT_BEFORE_LOGOUT, $event);
\Yii::$app->getUser()->logout();
$this->trigger(self::EVENT_AFTER_LOGOUT, $event);
\Yii::$app->getResponse()->redirect(Url::to([\Y... | php | public function actionLogout()
{
$event = $this->getUserEvent(\Yii::$app->user->identity);
$this->trigger(self::EVENT_BEFORE_LOGOUT, $event);
\Yii::$app->getUser()->logout();
$this->trigger(self::EVENT_AFTER_LOGOUT, $event);
\Yii::$app->getResponse()->redirect(Url::to([\Y... | [
"public",
"function",
"actionLogout",
"(",
")",
"{",
"$",
"event",
"=",
"$",
"this",
"->",
"getUserEvent",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"identity",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_BEFORE_LOGO... | Logs the user out and then redirects to the homepage.
@return Response | [
"Logs",
"the",
"user",
"out",
"and",
"then",
"redirects",
"to",
"the",
"homepage",
"."
] | 314796eecae3ca4ed5fecfdc0231a738af50eba7 | https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/frontend/components/user/controllers/SecurityController.php#L66-L77 | train |
bheisig/cli | src/Command/Init.php | Init.askToSkip | protected function askToSkip() {
$question = 'This part is optional. Do you like to configure it? [y|N]:';
$answer = strtolower(IO::in($question));
switch ($answer) {
case 'yes':
case 'y':
case '1':
case 'true':
return false;
... | php | protected function askToSkip() {
$question = 'This part is optional. Do you like to configure it? [y|N]:';
$answer = strtolower(IO::in($question));
switch ($answer) {
case 'yes':
case 'y':
case '1':
case 'true':
return false;
... | [
"protected",
"function",
"askToSkip",
"(",
")",
"{",
"$",
"question",
"=",
"'This part is optional. Do you like to configure it? [y|N]:'",
";",
"$",
"answer",
"=",
"strtolower",
"(",
"IO",
"::",
"in",
"(",
"$",
"question",
")",
")",
";",
"switch",
"(",
"$",
"a... | Ask to skip optional part
@return bool true means yes, skip it; false means no, configure it
@throws Exception on error | [
"Ask",
"to",
"skip",
"optional",
"part"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Init.php#L249-L270 | train |
bheisig/cli | src/Command/Init.php | Init.askForString | protected function askForString($key, $required = false, $default = null, array $values = [], $minLength = 0) {
$question = sprintf(
'What is the value for configuration setting "%s"',
$key
);
if (count($values) > 0) {
$question .= sprintf(
' ... | php | protected function askForString($key, $required = false, $default = null, array $values = [], $minLength = 0) {
$question = sprintf(
'What is the value for configuration setting "%s"',
$key
);
if (count($values) > 0) {
$question .= sprintf(
' ... | [
"protected",
"function",
"askForString",
"(",
"$",
"key",
",",
"$",
"required",
"=",
"false",
",",
"$",
"default",
"=",
"null",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"$",
"minLength",
"=",
"0",
")",
"{",
"$",
"question",
"=",
"sprintf",
... | Ask user for a value which should be a string
@param string $key Setting
@param bool $required Is this setting required? Defaults to false (no, it isn't)
@param string $default Optional default value which will be used if user doesn't provide a value
@param array $values Optional possible values; no other values are a... | [
"Ask",
"user",
"for",
"a",
"value",
"which",
"should",
"be",
"a",
"string"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Init.php#L285-L328 | train |
bheisig/cli | src/Command/Init.php | Init.askForBoolean | protected function askForBoolean($key, $required = false, $default = null) {
$question = sprintf(
'Enable configuration setting "%s"?',
$key
);
if (isset($default)) {
switch ($default) {
case true:
$question .= ' [Y|n]:';
... | php | protected function askForBoolean($key, $required = false, $default = null) {
$question = sprintf(
'Enable configuration setting "%s"?',
$key
);
if (isset($default)) {
switch ($default) {
case true:
$question .= ' [Y|n]:';
... | [
"protected",
"function",
"askForBoolean",
"(",
"$",
"key",
",",
"$",
"required",
"=",
"false",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"question",
"=",
"sprintf",
"(",
"'Enable configuration setting \"%s\"?'",
",",
"$",
"key",
")",
";",
"if",
"(",... | Ask user for a value which should be a boolean
@param string $key Setting
@param bool $required Is this setting required? Defaults to false (no, it isn't)
@param bool $default Optional default value which will be used if user doesn't provide a value
@return bool|null Value or nothing
@throws Exception on error | [
"Ask",
"user",
"for",
"a",
"value",
"which",
"should",
"be",
"a",
"boolean"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Init.php#L399-L448 | train |
bheisig/cli | src/Command/Init.php | Init.askForMixed | protected function askForMixed($key, $required = false, $default = null, array $values = []) {
$question = sprintf(
'What is the value for configuration setting "%s"',
$key
);
$options = [];
if (count($values) > 0) {
foreach ($values as $value) {
... | php | protected function askForMixed($key, $required = false, $default = null, array $values = []) {
$question = sprintf(
'What is the value for configuration setting "%s"',
$key
);
$options = [];
if (count($values) > 0) {
foreach ($values as $value) {
... | [
"protected",
"function",
"askForMixed",
"(",
"$",
"key",
",",
"$",
"required",
"=",
"false",
",",
"$",
"default",
"=",
"null",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"$",
"question",
"=",
"sprintf",
"(",
"'What is the value for configuration... | Ask user for a value, but the data type doesn't matter
@param string $key Setting
@param bool $required Is this setting required? Defaults to false (no, it isn't)
@param mixed $default Optional default value which will be used if user doesn't provide a value
@param array $values Optional possible values; no other valu... | [
"Ask",
"user",
"for",
"a",
"value",
"but",
"the",
"data",
"type",
"doesn",
"t",
"matter"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Init.php#L590-L665 | train |
Erebot/Module_TriggerRegistry | src/TriggerRegistry.php | TriggerRegistry.containsRecursive | protected function containsRecursive(&$array, &$value)
{
if (!is_array($array)) {
return false;
}
foreach ($array as $sub) {
if (is_string($sub) && !strcasecmp($sub, $value)) {
return true;
}
if (is_array($sub) && $this->conta... | php | protected function containsRecursive(&$array, &$value)
{
if (!is_array($array)) {
return false;
}
foreach ($array as $sub) {
if (is_string($sub) && !strcasecmp($sub, $value)) {
return true;
}
if (is_array($sub) && $this->conta... | [
"protected",
"function",
"containsRecursive",
"(",
"&",
"$",
"array",
",",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"array",
"as",
"$",
"sub",
")",
... | Checks whether some array contains the given
data, in a recursive fashion.
\param array $array
Array to test.
\param mixed $value
Look for this specific value.
\retval bool
\b true if the given value is contained
in the passed array, \b false otherwise. | [
"Checks",
"whether",
"some",
"array",
"contains",
"the",
"given",
"data",
"in",
"a",
"recursive",
"fashion",
"."
] | 5b981d38ab8c5b6bd03e07deb3adad71303592a0 | https://github.com/Erebot/Module_TriggerRegistry/blob/5b981d38ab8c5b6bd03e07deb3adad71303592a0/src/TriggerRegistry.php#L115-L131 | train |
Erebot/Module_TriggerRegistry | src/TriggerRegistry.php | TriggerRegistry.registerTriggers | public function registerTriggers($triggers, $channel)
{
if (!is_array($triggers)) {
$triggers = array($triggers);
}
$fmt = $this->getFormatter(false);
$translator = $fmt->getTranslator();
if (!is_string($channel)) {
throw new \Erebot\InvalidVal... | php | public function registerTriggers($triggers, $channel)
{
if (!is_array($triggers)) {
$triggers = array($triggers);
}
$fmt = $this->getFormatter(false);
$translator = $fmt->getTranslator();
if (!is_string($channel)) {
throw new \Erebot\InvalidVal... | [
"public",
"function",
"registerTriggers",
"(",
"$",
"triggers",
",",
"$",
"channel",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"triggers",
")",
")",
"{",
"$",
"triggers",
"=",
"array",
"(",
"$",
"triggers",
")",
";",
"}",
"$",
"fmt",
"=",
"$"... | Registers a series of triggers, either globally
or for a specific channel.
\param mixed $triggers
Either a single string or an array of strings
with the names of the triggers to register.
\param string $channel
Either the name of a specific IRC channel
the triggers should be registered for (eg. #Erebot),
or the const... | [
"Registers",
"a",
"series",
"of",
"triggers",
"either",
"globally",
"or",
"for",
"a",
"specific",
"channel",
"."
] | 5b981d38ab8c5b6bd03e07deb3adad71303592a0 | https://github.com/Erebot/Module_TriggerRegistry/blob/5b981d38ab8c5b6bd03e07deb3adad71303592a0/src/TriggerRegistry.php#L161-L206 | train |
Erebot/Module_TriggerRegistry | src/TriggerRegistry.php | TriggerRegistry.getChanTriggers | public function getChanTriggers($channel)
{
if (!isset($this->triggers[$channel])) {
$fmt = $this->getFormatter(false);
throw new \Erebot\NotFoundException(
$fmt->_(
'No triggers found for channel "<var name="chan"/>"',
array('c... | php | public function getChanTriggers($channel)
{
if (!isset($this->triggers[$channel])) {
$fmt = $this->getFormatter(false);
throw new \Erebot\NotFoundException(
$fmt->_(
'No triggers found for channel "<var name="chan"/>"',
array('c... | [
"public",
"function",
"getChanTriggers",
"(",
"$",
"channel",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"triggers",
"[",
"$",
"channel",
"]",
")",
")",
"{",
"$",
"fmt",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
"false",
")",
";"... | Returns a list of all triggers
registered for a given channel.
\param string $channel
Either the name of a specific IRC channel
to return only those triggers that were
specifically registered for use in that channel,
or the constant Erebot::Module::TriggerRegistry::MATCH_ANY
to return triggers that were registered glo... | [
"Returns",
"a",
"list",
"of",
"all",
"triggers",
"registered",
"for",
"a",
"given",
"channel",
"."
] | 5b981d38ab8c5b6bd03e07deb3adad71303592a0 | https://github.com/Erebot/Module_TriggerRegistry/blob/5b981d38ab8c5b6bd03e07deb3adad71303592a0/src/TriggerRegistry.php#L257-L270 | train |
Erebot/Module_TriggerRegistry | src/TriggerRegistry.php | TriggerRegistry.getTriggers | public function getTriggers($token)
{
$fmt = $this->getFormatter(false);
if (!is_string($token) || strpos($token, ' ') === false) {
throw new \Erebot\InvalidValueException($fmt->_('Invalid token'));
}
list($chan, $pos) = explode(' ', $token);
if (!isset($this->... | php | public function getTriggers($token)
{
$fmt = $this->getFormatter(false);
if (!is_string($token) || strpos($token, ' ') === false) {
throw new \Erebot\InvalidValueException($fmt->_('Invalid token'));
}
list($chan, $pos) = explode(' ', $token);
if (!isset($this->... | [
"public",
"function",
"getTriggers",
"(",
"$",
"token",
")",
"{",
"$",
"fmt",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
"false",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"token",
")",
"||",
"strpos",
"(",
"$",
"token",
",",
"' '",
")",
... | Returns a list of all triggers
associated with the given key.
\param string $token
Some key associated with a series
of triggers.
\retval array
A list of all triggers associated
with the given key. | [
"Returns",
"a",
"list",
"of",
"all",
"triggers",
"associated",
"with",
"the",
"given",
"key",
"."
] | 5b981d38ab8c5b6bd03e07deb3adad71303592a0 | https://github.com/Erebot/Module_TriggerRegistry/blob/5b981d38ab8c5b6bd03e07deb3adad71303592a0/src/TriggerRegistry.php#L284-L299 | train |
jdmaymeow/cake-auth | src/Controller/ProfilesController.php | ProfilesController.my | public function my()
{
$profile = $this->Profiles->find()
->where([
'Profiles.user_id' => $this->Auth->user('id')
])->contain('Users')->first();
$this->set('profile', $profile);
$this->set('_serialize', ['profile']);
} | php | public function my()
{
$profile = $this->Profiles->find()
->where([
'Profiles.user_id' => $this->Auth->user('id')
])->contain('Users')->first();
$this->set('profile', $profile);
$this->set('_serialize', ['profile']);
} | [
"public",
"function",
"my",
"(",
")",
"{",
"$",
"profile",
"=",
"$",
"this",
"->",
"Profiles",
"->",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'Profiles.user_id'",
"=>",
"$",
"this",
"->",
"Auth",
"->",
"user",
"(",
"'id'",
")",
"]",
")",
"->",
... | Shows current user profile | [
"Shows",
"current",
"user",
"profile"
] | e9b498fb28fa8b48c520d08341cfab8c2459afab | https://github.com/jdmaymeow/cake-auth/blob/e9b498fb28fa8b48c520d08341cfab8c2459afab/src/Controller/ProfilesController.php#L50-L59 | train |
bheisig/cli | src/Command/Command.php | Command.tearDown | public function tearDown() {
$seconds = time() - $this->start;
switch ($seconds) {
case 1:
$this->log->debug('This took 1 second.');
break;
default:
$this->log->debug('This took %s seconds.', $seconds);
break;
... | php | public function tearDown() {
$seconds = time() - $this->start;
switch ($seconds) {
case 1:
$this->log->debug('This took 1 second.');
break;
default:
$this->log->debug('This took %s seconds.', $seconds);
break;
... | [
"public",
"function",
"tearDown",
"(",
")",
"{",
"$",
"seconds",
"=",
"time",
"(",
")",
"-",
"$",
"this",
"->",
"start",
";",
"switch",
"(",
"$",
"seconds",
")",
"{",
"case",
"1",
":",
"$",
"this",
"->",
"log",
"->",
"debug",
"(",
"'This took 1 sec... | Process some routines after executing command
@return self Returns itself
@throws Exception on error | [
"Process",
"some",
"routines",
"after",
"executing",
"command"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Command.php#L88-L135 | train |
bheisig/cli | src/Command/Command.php | Command.getQuery | protected function getQuery() {
$query = '';
foreach ($this->config['args'] as $index => $arg) {
if (array_key_exists('command', $this->config) &&
$arg === $this->config['command'] &&
array_key_exists(($index + 1), $this->config['args'])) {
$q... | php | protected function getQuery() {
$query = '';
foreach ($this->config['args'] as $index => $arg) {
if (array_key_exists('command', $this->config) &&
$arg === $this->config['command'] &&
array_key_exists(($index + 1), $this->config['args'])) {
$q... | [
"protected",
"function",
"getQuery",
"(",
")",
"{",
"$",
"query",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"config",
"[",
"'args'",
"]",
"as",
"$",
"index",
"=>",
"$",
"arg",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'command'",
",",
... | Looks for a query from given arguments
@return string
@deprecated Use $this->config['arguments'][0] instead! | [
"Looks",
"for",
"a",
"query",
"from",
"given",
"arguments"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Command.php#L144-L157 | train |
bheisig/cli | src/Command/Command.php | Command.getName | public function getName() {
foreach ($this->config['commands'] as $command => $details) {
if (strpos($details['class'], get_class($this)) !== false) {
return $command;
}
}
return '';
} | php | public function getName() {
foreach ($this->config['commands'] as $command => $details) {
if (strpos($details['class'], get_class($this)) !== false) {
return $command;
}
}
return '';
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"[",
"'commands'",
"]",
"as",
"$",
"command",
"=>",
"$",
"details",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"details",
"[",
"'class'",
"]",
",",
"get_class"... | Get command name
@return string | [
"Get",
"command",
"name"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Command.php#L202-L210 | train |
net-tools/core | src/ExceptionHandlers/Res/StackTrace.php | StackTrace._get | protected function _get(\Throwable $e)
{
$path_to_root = $_SERVER['DOCUMENT_ROOT'];
$rows = array();
// first row : current script with error line
$rows[] = [
// file
str_replace($path_to_root . '/', '', $e->getFile()),
// line
$e->getLine(),
// function
"throw new " . get... | php | protected function _get(\Throwable $e)
{
$path_to_root = $_SERVER['DOCUMENT_ROOT'];
$rows = array();
// first row : current script with error line
$rows[] = [
// file
str_replace($path_to_root . '/', '', $e->getFile()),
// line
$e->getLine(),
// function
"throw new " . get... | [
"protected",
"function",
"_get",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"$",
"path_to_root",
"=",
"$",
"_SERVER",
"[",
"'DOCUMENT_ROOT'",
"]",
";",
"$",
"rows",
"=",
"array",
"(",
")",
";",
"// first row : current script with error line",
"$",
"rows",
"... | Get a 2-dimensions array with exception stack trace
Each row has 4 0-indexed columns : 0=file, 1=line number, 2=function name, 3=function arguments
@param \Throwable $e Exception object
@return array | [
"Get",
"a",
"2",
"-",
"dimensions",
"array",
"with",
"exception",
"stack",
"trace"
] | 51446641cee22c0cf53d2b409c76cc8bd1a187e7 | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/ExceptionHandlers/Res/StackTrace.php#L41-L85 | train |
SagittariusX/Beluga.Translation | src/Beluga/Translation/Translator.php | Translator.translateByNumber | public function translateByNumber( int $number, string $defaultTranslation, ...$args ) : string
{
$transStr = $this->_source->getTranslation( $number, $defaultTranslation );
if ( \count( $args ) < 1 )
{
return $transStr;
}
return \sprintf( $transStr, $args );
} | php | public function translateByNumber( int $number, string $defaultTranslation, ...$args ) : string
{
$transStr = $this->_source->getTranslation( $number, $defaultTranslation );
if ( \count( $args ) < 1 )
{
return $transStr;
}
return \sprintf( $transStr, $args );
} | [
"public",
"function",
"translateByNumber",
"(",
"int",
"$",
"number",
",",
"string",
"$",
"defaultTranslation",
",",
"...",
"$",
"args",
")",
":",
"string",
"{",
"$",
"transStr",
"=",
"$",
"this",
"->",
"_source",
"->",
"getTranslation",
"(",
"$",
"number"... | Gets the translation by an numeric identifier.
@param int $number The numeric identifier
@param string $defaultTranslation This text is returned as translation if the source not holds the
translation with the requested identifier.
@param array ...$args If the translation contains sprintf compatible replacements
you ca... | [
"Gets",
"the",
"translation",
"by",
"an",
"numeric",
"identifier",
"."
] | 8f66c4fef6fa4494413972ca56bd8e13f5a7e444 | https://github.com/SagittariusX/Beluga.Translation/blob/8f66c4fef6fa4494413972ca56bd8e13f5a7e444/src/Beluga/Translation/Translator.php#L83-L95 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.