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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Eden-PHP/Block | Field.php | Field.wysiwyg | public function wysiwyg($name = null, $value = null)
{
Argument::i()
->test(1, 'string', 'null')
->test(2, 'scalar', 'null');
$field = Wysiwyg::i();
if(!is_null($name)) {
$field->setName($name);
}
if(!is_null($value)) {
$field->setValue($value);
}
return $field;
} | php | public function wysiwyg($name = null, $value = null)
{
Argument::i()
->test(1, 'string', 'null')
->test(2, 'scalar', 'null');
$field = Wysiwyg::i();
if(!is_null($name)) {
$field->setName($name);
}
if(!is_null($value)) {
$field->setValue($value);
}
return $field;
} | [
"public",
"function",
"wysiwyg",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"Argument",
"::",
"i",
"(",
")",
"->",
"test",
"(",
"1",
",",
"'string'",
",",
"'null'",
")",
"->",
"test",
"(",
"2",
",",
"'scalar'",
",",
... | Returns a WYSIWYG field
@param string|null
@param scalar|null
@return Eden\Block\Field\Wysiwyg | [
"Returns",
"a",
"WYSIWYG",
"field"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Field.php#L582-L599 | train |
Innmind/Compose | src/Dependencies.php | Dependencies.exposed | public function exposed(): MapInterface
{
return $this->dependencies->reduce(
new Map(Name::class, MapInterface::class),
static function(Map $exposed, string $name, Dependency $dependency): Map {
return $exposed->put(
$dependency->name(),
... | php | public function exposed(): MapInterface
{
return $this->dependencies->reduce(
new Map(Name::class, MapInterface::class),
static function(Map $exposed, string $name, Dependency $dependency): Map {
return $exposed->put(
$dependency->name(),
... | [
"public",
"function",
"exposed",
"(",
")",
":",
"MapInterface",
"{",
"return",
"$",
"this",
"->",
"dependencies",
"->",
"reduce",
"(",
"new",
"Map",
"(",
"Name",
"::",
"class",
",",
"MapInterface",
"::",
"class",
")",
",",
"static",
"function",
"(",
"Map... | Return the list of exposed services per dependency
@return MapInterface<Name, MapInterface<Name, Constructor>> | [
"Return",
"the",
"list",
"of",
"exposed",
"services",
"per",
"dependency"
] | 1a833d7ba2f6248e9c472c00cd7aca041c1a2ba9 | https://github.com/Innmind/Compose/blob/1a833d7ba2f6248e9c472c00cd7aca041c1a2ba9/src/Dependencies.php#L138-L149 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/permissions/NodePermissions.php | NodePermissions.check | public function check($action, NodeRef &$nodeRef, &$newData = null, $isRead = false)
{
return $this->checkInternal($action, $nodeRef, $newData, false, $isRead);
} | php | public function check($action, NodeRef &$nodeRef, &$newData = null, $isRead = false)
{
return $this->checkInternal($action, $nodeRef, $newData, false, $isRead);
} | [
"public",
"function",
"check",
"(",
"$",
"action",
",",
"NodeRef",
"&",
"$",
"nodeRef",
",",
"&",
"$",
"newData",
"=",
"null",
",",
"$",
"isRead",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"checkInternal",
"(",
"$",
"action",
",",
"$",
"... | Returns true if the user is permitted to access the node
@param $action
@param $nodeRef
@param $newData
@param $isRead
@return unknown_type | [
"Returns",
"true",
"if",
"the",
"user",
"is",
"permitted",
"to",
"access",
"the",
"node"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/permissions/NodePermissions.php#L102-L105 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/permissions/NodePermissions.php | NodePermissions.checkThrow | public function checkThrow($action, NodeRef &$nodeRef, &$newData = null, $isRead = false)
{
return $this->checkInternal($action, $nodeRef, $newData, true, $isRead);
} | php | public function checkThrow($action, NodeRef &$nodeRef, &$newData = null, $isRead = false)
{
return $this->checkInternal($action, $nodeRef, $newData, true, $isRead);
} | [
"public",
"function",
"checkThrow",
"(",
"$",
"action",
",",
"NodeRef",
"&",
"$",
"nodeRef",
",",
"&",
"$",
"newData",
"=",
"null",
",",
"$",
"isRead",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"checkInternal",
"(",
"$",
"action",
",",
"$"... | Throws a PermissionsException if the user is unable to access the node, otherwise returns true
@param $action
@param $nodeRef
@param $newData
@param $isRead
@return unknown_type | [
"Throws",
"a",
"PermissionsException",
"if",
"the",
"user",
"is",
"unable",
"to",
"access",
"the",
"node",
"otherwise",
"returns",
"true"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/permissions/NodePermissions.php#L116-L119 | train |
ekyna/MediaBundle | Twig/BrowserExtension.php | BrowserExtension.renderMediaThumb | public function renderMediaThumb(MediaInterface $media = null, array $controls = array())
{
if (null !== $media) {
$media->setThumb($this->thumbGenerator->generateThumbUrl($media));
}
/*if (empty($controls)) {
$controls = array(
array('role' => 'edit',... | php | public function renderMediaThumb(MediaInterface $media = null, array $controls = array())
{
if (null !== $media) {
$media->setThumb($this->thumbGenerator->generateThumbUrl($media));
}
/*if (empty($controls)) {
$controls = array(
array('role' => 'edit',... | [
"public",
"function",
"renderMediaThumb",
"(",
"MediaInterface",
"$",
"media",
"=",
"null",
",",
"array",
"$",
"controls",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"media",
")",
"{",
"$",
"media",
"->",
"setThumb",
"(",
"$",
"... | Renders the media thumb.
@param MediaInterface $media
@param array $controls
@return string | [
"Renders",
"the",
"media",
"thumb",
"."
] | 512cf86c801a130a9f17eba8b48d646d23acdbab | https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Twig/BrowserExtension.php#L119-L149 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.build | public function build($configs)
{
foreach ($configs as $config) {
$this->config = $config;
$this->initVars();
$this->loadColumns();
$this->buildDataClasses();
$this->buildMapperClasses();
$this->generateClasses();
}
... | php | public function build($configs)
{
foreach ($configs as $config) {
$this->config = $config;
$this->initVars();
$this->loadColumns();
$this->buildDataClasses();
$this->buildMapperClasses();
$this->generateClasses();
}
... | [
"public",
"function",
"build",
"(",
"$",
"configs",
")",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"$",
"this",
"->",
"initVars",
"(",
")",
";",
"$",
"this",
"->",
"l... | Build model classes.
@param ConfigInterface[] $configs
@return $this | [
"Build",
"model",
"classes",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L119-L134 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.loadColumns | protected function loadColumns()
{
$statement = $this->db->query('SHOW COLUMNS FROM ' . $this->config->getDbTable());
$this->columns = array();
while (false !== ($column = $statement->fetchObject())) {
$this->columns[] = new Column($column, $this->config->getDbPrefix());
... | php | protected function loadColumns()
{
$statement = $this->db->query('SHOW COLUMNS FROM ' . $this->config->getDbTable());
$this->columns = array();
while (false !== ($column = $statement->fetchObject())) {
$this->columns[] = new Column($column, $this->config->getDbPrefix());
... | [
"protected",
"function",
"loadColumns",
"(",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"'SHOW COLUMNS FROM '",
".",
"$",
"this",
"->",
"config",
"->",
"getDbTable",
"(",
")",
")",
";",
"$",
"this",
"->",
"columns",
"... | Load columns data.
@return void | [
"Load",
"columns",
"data",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L156-L164 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataProperties | protected function buildDataProperties()
{
$properties = '';
$hasAutoincrement = false;
foreach ($this->columns as $column) {
$properties .= "\n" . $column->getProperty();
$hasAutoincrement |= $column->isAutoIncrement();
}
if ($hasAutoincrement) {
... | php | protected function buildDataProperties()
{
$properties = '';
$hasAutoincrement = false;
foreach ($this->columns as $column) {
$properties .= "\n" . $column->getProperty();
$hasAutoincrement |= $column->isAutoIncrement();
}
if ($hasAutoincrement) {
... | [
"protected",
"function",
"buildDataProperties",
"(",
")",
"{",
"$",
"properties",
"=",
"''",
";",
"$",
"hasAutoincrement",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"properties",
".=",
"\"\\n\"",
... | Build properties var
@return void | [
"Build",
"properties",
"var"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L192-L211 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataGetters | protected function buildDataGetters()
{
$getters = '';
foreach ($this->columns as $column) {
$getters .= "\n" . $column->getGetter();
}
$this->vars['getters'] = $getters;
} | php | protected function buildDataGetters()
{
$getters = '';
foreach ($this->columns as $column) {
$getters .= "\n" . $column->getGetter();
}
$this->vars['getters'] = $getters;
} | [
"protected",
"function",
"buildDataGetters",
"(",
")",
"{",
"$",
"getters",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"getters",
".=",
"\"\\n\"",
".",
"$",
"column",
"->",
"getGetter",
"(",
")",
... | Build getters var
@return void | [
"Build",
"getters",
"var"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L218-L227 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataGetterCacheKey | protected function buildDataGetterCacheKey()
{
$keys = array();
foreach ($this->columns as $column) {
if ($column->isPrimaryKey()) {
$keys[] = '$this->' . $column->getMethodNameGet() . '()';
}
}
$key = "'" . $this->config->getCachePrefix() . ... | php | protected function buildDataGetterCacheKey()
{
$keys = array();
foreach ($this->columns as $column) {
if ($column->isPrimaryKey()) {
$keys[] = '$this->' . $column->getMethodNameGet() . '()';
}
}
$key = "'" . $this->config->getCachePrefix() . ... | [
"protected",
"function",
"buildDataGetterCacheKey",
"(",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"isPrimaryKey",
"(",
")",
")",
"... | Build cache key method
@return void | [
"Build",
"cache",
"key",
"method"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L234-L256 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataSetters | protected function buildDataSetters()
{
$setters = '';
foreach ($this->columns as $column) {
$setters .= "\n" . $column->getSetter();
}
$this->vars['setters'] = $setters;
} | php | protected function buildDataSetters()
{
$setters = '';
foreach ($this->columns as $column) {
$setters .= "\n" . $column->getSetter();
}
$this->vars['setters'] = $setters;
} | [
"protected",
"function",
"buildDataSetters",
"(",
")",
"{",
"$",
"setters",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"setters",
".=",
"\"\\n\"",
".",
"$",
"column",
"->",
"getSetter",
"(",
")",
... | Build setters var
@return void | [
"Build",
"setters",
"var"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L263-L272 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataJoins | protected function buildDataJoins()
{
$joins = array('one' => array(), 'many' => array());
$joinsUse = array();
foreach ($this->config->getAllJoin() as $name => $join) {
$config = $join['class'];
if (!($config instanceof ConfigInterface)) {
throw... | php | protected function buildDataJoins()
{
$joins = array('one' => array(), 'many' => array());
$joinsUse = array();
foreach ($this->config->getAllJoin() as $name => $join) {
$config = $join['class'];
if (!($config instanceof ConfigInterface)) {
throw... | [
"protected",
"function",
"buildDataJoins",
"(",
")",
"{",
"$",
"joins",
"=",
"array",
"(",
"'one'",
"=>",
"array",
"(",
")",
",",
"'many'",
"=>",
"array",
"(",
")",
")",
";",
"$",
"joinsUse",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this"... | Build join getters
@return void
@throws \LogicException | [
"Build",
"join",
"getters"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L280-L309 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildDataJoinsMany | protected function buildDataJoinsMany(ConfigInterface $config, array $joinKeys)
{
//~ Search for keys
$keys = '';
$joinKeys = array_flip($joinKeys);
foreach ($this->columns as $column) {
if (!isset($joinKeys[$column->getName()])) {
continue;
}
... | php | protected function buildDataJoinsMany(ConfigInterface $config, array $joinKeys)
{
//~ Search for keys
$keys = '';
$joinKeys = array_flip($joinKeys);
foreach ($this->columns as $column) {
if (!isset($joinKeys[$column->getName()])) {
continue;
}
... | [
"protected",
"function",
"buildDataJoinsMany",
"(",
"ConfigInterface",
"$",
"config",
",",
"array",
"$",
"joinKeys",
")",
"{",
"//~ Search for keys",
"$",
"keys",
"=",
"''",
";",
"$",
"joinKeys",
"=",
"array_flip",
"(",
"$",
"joinKeys",
")",
";",
"foreach",
... | Build join many getters
@param ConfigInterface $config
@param array $joinKeys
@return string
@throws \LogicException | [
"Build",
"join",
"many",
"getters"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L374-L420 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildMapperFields | protected function buildMapperFields()
{
$fields = array();
$dataNamesMap = '';
foreach ($this->columns as $column) {
$field = $column->getName();
$fields[] = " '" . $field . "'";
$dataNamesMap .= "
'" . $field . "' => array(
... | php | protected function buildMapperFields()
{
$fields = array();
$dataNamesMap = '';
foreach ($this->columns as $column) {
$field = $column->getName();
$fields[] = " '" . $field . "'";
$dataNamesMap .= "
'" . $field . "' => array(
... | [
"protected",
"function",
"buildMapperFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"$",
"dataNamesMap",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"field",
"=",
"$",
"column... | Build fields var
@return void | [
"Build",
"fields",
"var"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L456-L474 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.buildMapperPrimaryKeys | protected function buildMapperPrimaryKeys()
{
$fields = array();
foreach ($this->columns as $column) {
if ($column->isPrimaryKey()) {
$fields[] = " '" . $column->getName() . "'";
}
}
$this->vars['db_primary_keys'] = implode(",\n", $fi... | php | protected function buildMapperPrimaryKeys()
{
$fields = array();
foreach ($this->columns as $column) {
if ($column->isPrimaryKey()) {
$fields[] = " '" . $column->getName() . "'";
}
}
$this->vars['db_primary_keys'] = implode(",\n", $fi... | [
"protected",
"function",
"buildMapperPrimaryKeys",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"->",
"isPrimaryKey",
"(",
")",
")",
... | Build primary keys var
@return void | [
"Build",
"primary",
"keys",
"var"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L481-L493 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.generateDataFileAbstract | protected function generateDataFileAbstract($dir)
{
$file = $dir . '/' . $this->config->getClassname() . 'Abstract.php';
if (!is_readable($file) && false === file_put_contents($file, '')) {
throw new \RuntimeException('Cannot create empty class file: ' . $file);
}
$cont... | php | protected function generateDataFileAbstract($dir)
{
$file = $dir . '/' . $this->config->getClassname() . 'Abstract.php';
if (!is_readable($file) && false === file_put_contents($file, '')) {
throw new \RuntimeException('Cannot create empty class file: ' . $file);
}
$cont... | [
"protected",
"function",
"generateDataFileAbstract",
"(",
"$",
"dir",
")",
"{",
"$",
"file",
"=",
"$",
"dir",
".",
"'/'",
".",
"$",
"this",
"->",
"config",
"->",
"getClassname",
"(",
")",
".",
"'Abstract.php'",
";",
"if",
"(",
"!",
"is_readable",
"(",
... | Generate abstract file class.
@param string $dir Directory for class
@return void
@throws \RuntimeException | [
"Generate",
"abstract",
"file",
"class",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L539-L579 | train |
eureka-framework/component-orm | src/Orm/Builder.php | Builder.generateDataFile | protected function generateDataFile($dir)
{
$file = $dir . '/' . $this->config->getClassname() . '.php';
if (file_exists($file)) {
return;
}
if (!is_readable($file) && false === file_put_contents($file, '')) {
throw new \RuntimeException('Cannot create empty... | php | protected function generateDataFile($dir)
{
$file = $dir . '/' . $this->config->getClassname() . '.php';
if (file_exists($file)) {
return;
}
if (!is_readable($file) && false === file_put_contents($file, '')) {
throw new \RuntimeException('Cannot create empty... | [
"protected",
"function",
"generateDataFile",
"(",
"$",
"dir",
")",
"{",
"$",
"file",
"=",
"$",
"dir",
".",
"'/'",
".",
"$",
"this",
"->",
"config",
"->",
"getClassname",
"(",
")",
".",
"'.php'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
... | Generate child class if not already exists.
@param string $dir Directory for class
@return void
@throws \RuntimeException | [
"Generate",
"child",
"class",
"if",
"not",
"already",
"exists",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Builder.php#L588-L624 | train |
ciims/ciims-modules-dashboard | controllers/ContentController.php | ContentController.actionSave | public function actionSave($id = NULL)
{
$asModel = NULL;
if ($id == NULL)
{
$model = new Content;
$model->savePrototype(Yii::app()->user->id);
$this->redirect('/dashboard/content/save/id/' . $model->id);
}
else
{
$model = $this->loadModel($id);
$asModel = Content... | php | public function actionSave($id = NULL)
{
$asModel = NULL;
if ($id == NULL)
{
$model = new Content;
$model->savePrototype(Yii::app()->user->id);
$this->redirect('/dashboard/content/save/id/' . $model->id);
}
else
{
$model = $this->loadModel($id);
$asModel = Content... | [
"public",
"function",
"actionSave",
"(",
"$",
"id",
"=",
"NULL",
")",
"{",
"$",
"asModel",
"=",
"NULL",
";",
"if",
"(",
"$",
"id",
"==",
"NULL",
")",
"{",
"$",
"model",
"=",
"new",
"Content",
";",
"$",
"model",
"->",
"savePrototype",
"(",
"Yii",
... | Rndering action for the entry
@param int $id The content ID | [
"Rndering",
"action",
"for",
"the",
"entry"
] | 94b89239e9ee34ac3b9c398e8d1ba67a08c68c11 | https://github.com/ciims/ciims-modules-dashboard/blob/94b89239e9ee34ac3b9c398e8d1ba67a08c68c11/controllers/ContentController.php#L31-L56 | train |
jabernardo/lollipop-php | Library/TimeDate.php | TimeDate.longDateString | static function longDateString($date) {
str_replace('now', date('m.d.y'), $date);
if (!self::parsable($date)) return null;
$r = self::fromString($date);
return $r->format('M d, Y');
} | php | static function longDateString($date) {
str_replace('now', date('m.d.y'), $date);
if (!self::parsable($date)) return null;
$r = self::fromString($date);
return $r->format('M d, Y');
} | [
"static",
"function",
"longDateString",
"(",
"$",
"date",
")",
"{",
"str_replace",
"(",
"'now'",
",",
"date",
"(",
"'m.d.y'",
")",
",",
"$",
"date",
")",
";",
"if",
"(",
"!",
"self",
"::",
"parsable",
"(",
"$",
"date",
")",
")",
"return",
"null",
"... | Returns date in long date format
@param string $date Date
@return string Long Date
@return string | [
"Returns",
"date",
"in",
"long",
"date",
"format"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/TimeDate.php#L71-L79 | train |
jabernardo/lollipop-php | Library/TimeDate.php | TimeDate.shortDateString | static function shortDateString($date, $separator = '/') {
str_replace('now', date('m.d.y'), $date);
if (!self::parsable($date)) return null;
$r = self::fromString($date);
return $r->format('m' . $separator . 'd' . $separator . 'Y');
} | php | static function shortDateString($date, $separator = '/') {
str_replace('now', date('m.d.y'), $date);
if (!self::parsable($date)) return null;
$r = self::fromString($date);
return $r->format('m' . $separator . 'd' . $separator . 'Y');
} | [
"static",
"function",
"shortDateString",
"(",
"$",
"date",
",",
"$",
"separator",
"=",
"'/'",
")",
"{",
"str_replace",
"(",
"'now'",
",",
"date",
"(",
"'m.d.y'",
")",
",",
"$",
"date",
")",
";",
"if",
"(",
"!",
"self",
"::",
"parsable",
"(",
"$",
"... | Returns date in short date format
@param string $date Date
@param string $separator Separator
@return string | [
"Returns",
"date",
"in",
"short",
"date",
"format"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/TimeDate.php#L90-L98 | train |
jabernardo/lollipop-php | Library/TimeDate.php | TimeDate.longTimeString | static function longTimeString($time) {
str_replace('now', date('h:i:s t'), $time);
if (!self::parsable($time)) return null;
$r = self::fromString($time);
return $r->format('h:i:s a');
} | php | static function longTimeString($time) {
str_replace('now', date('h:i:s t'), $time);
if (!self::parsable($time)) return null;
$r = self::fromString($time);
return $r->format('h:i:s a');
} | [
"static",
"function",
"longTimeString",
"(",
"$",
"time",
")",
"{",
"str_replace",
"(",
"'now'",
",",
"date",
"(",
"'h:i:s t'",
")",
",",
"$",
"time",
")",
";",
"if",
"(",
"!",
"self",
"::",
"parsable",
"(",
"$",
"time",
")",
")",
"return",
"null",
... | Returns time in long time format
@param string $time Time
@return string | [
"Returns",
"time",
"in",
"long",
"time",
"format"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/TimeDate.php#L107-L115 | train |
Wedeto/HTTP | src/Accept.php | Accept.parseAccept | public static function parseAccept(string $accept, bool $is_lang)
{
// By default accept everything but prefer HTML
if (empty($accept))
$accept = "text/html;q=1.0,*/*;q=0.9";
// Normalize locales when the intl extension is available
$is_lang = $is_lang && class_exists('L... | php | public static function parseAccept(string $accept, bool $is_lang)
{
// By default accept everything but prefer HTML
if (empty($accept))
$accept = "text/html;q=1.0,*/*;q=0.9";
// Normalize locales when the intl extension is available
$is_lang = $is_lang && class_exists('L... | [
"public",
"static",
"function",
"parseAccept",
"(",
"string",
"$",
"accept",
",",
"bool",
"$",
"is_lang",
")",
"{",
"// By default accept everything but prefer HTML",
"if",
"(",
"empty",
"(",
"$",
"accept",
")",
")",
"$",
"accept",
"=",
"\"text/html;q=1.0,*/*;q=0.... | Parse the HTTP Accept headers into an array of Type => Priority pairs.
@param string $accept The accept header to parse
@return The parsed accept list | [
"Parse",
"the",
"HTTP",
"Accept",
"headers",
"into",
"an",
"array",
"of",
"Type",
"=",
">",
"Priority",
"pairs",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L78-L106 | train |
Wedeto/HTTP | src/Accept.php | Accept.accepts | public function accepts($type)
{
foreach ($this->accept as $accept_type => $priority)
{
if (strpos($accept_type, "*") !== false)
{
$regexp = "/" . str_replace("WC", ".*", preg_quote(str_replace("*", "WC", $accept_type), "/")) . "/i";
if (preg_m... | php | public function accepts($type)
{
foreach ($this->accept as $accept_type => $priority)
{
if (strpos($accept_type, "*") !== false)
{
$regexp = "/" . str_replace("WC", ".*", preg_quote(str_replace("*", "WC", $accept_type), "/")) . "/i";
if (preg_m... | [
"public",
"function",
"accepts",
"(",
"$",
"type",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"accept",
"as",
"$",
"accept_type",
"=>",
"$",
"priority",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"accept_type",
",",
"\"*\"",
")",
"!==",
"false",
")",... | Check if a specified response type is accepted by the client. When
no types are specified, everything is accepted.
@param string $type The type of the response that is to be checked
@return float Returns 0 if the type is not accepted, and otherwise the priority | [
"Check",
"if",
"a",
"specified",
"response",
"type",
"is",
"accepted",
"by",
"the",
"client",
".",
"When",
"no",
"types",
"are",
"specified",
"everything",
"is",
"accepted",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L115-L130 | train |
Wedeto/HTTP | src/Accept.php | Accept.compareTypes | public function compareTypes(string $l, string $r)
{
$lq = $this->accept[$l] ?? 0;
$rq = $this->accept[$r] ?? 0;
return $lq === $rq ? -1 : ($lq < $rq ? 1 : -1);
} | php | public function compareTypes(string $l, string $r)
{
$lq = $this->accept[$l] ?? 0;
$rq = $this->accept[$r] ?? 0;
return $lq === $rq ? -1 : ($lq < $rq ? 1 : -1);
} | [
"public",
"function",
"compareTypes",
"(",
"string",
"$",
"l",
",",
"string",
"$",
"r",
")",
"{",
"$",
"lq",
"=",
"$",
"this",
"->",
"accept",
"[",
"$",
"l",
"]",
"??",
"0",
";",
"$",
"rq",
"=",
"$",
"this",
"->",
"accept",
"[",
"$",
"r",
"]"... | Compare the types based on the priorty in the accept header. Aliases
for common types are supported.
@param string $l The left-hand side of the comparison. Should be a type
@param string $r The right-hand side of the comparison. Should be a type | [
"Compare",
"the",
"types",
"based",
"on",
"the",
"priorty",
"in",
"the",
"accept",
"header",
".",
"Aliases",
"for",
"common",
"types",
"are",
"supported",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L139-L145 | train |
Wedeto/HTTP | src/Accept.php | Accept.sortTypes | public function sortTypes(array &$types)
{
if (WF::is_numeric_array($types))
return usort($types, [$this, 'compareTypes']);
return uksort($types, [$this, 'compareTypes']);
} | php | public function sortTypes(array &$types)
{
if (WF::is_numeric_array($types))
return usort($types, [$this, 'compareTypes']);
return uksort($types, [$this, 'compareTypes']);
} | [
"public",
"function",
"sortTypes",
"(",
"array",
"&",
"$",
"types",
")",
"{",
"if",
"(",
"WF",
"::",
"is_numeric_array",
"(",
"$",
"types",
")",
")",
"return",
"usort",
"(",
"$",
"types",
",",
"[",
"$",
"this",
",",
"'compareTypes'",
"]",
")",
";",
... | Sort a list by their accept priority
@param array $types The list to sort. For arrays with numeric keys, the
values are expected to be types. Otherwise,
the keys are expected to be types. The array is
passed by reference.
@return bool True on success, false on failure | [
"Sort",
"a",
"list",
"by",
"their",
"accept",
"priority"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L155-L161 | train |
Wedeto/HTTP | src/Accept.php | Accept.getBestResponseType | public function getBestResponseType(array $types)
{
if (empty($types))
return "";
$this->sortTypes($types);
$type = reset($types);
return $this->accepts($type) ? current($types) : null;
} | php | public function getBestResponseType(array $types)
{
if (empty($types))
return "";
$this->sortTypes($types);
$type = reset($types);
return $this->accepts($type) ? current($types) : null;
} | [
"public",
"function",
"getBestResponseType",
"(",
"array",
"$",
"types",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"types",
")",
")",
"return",
"\"\"",
";",
"$",
"this",
"->",
"sortTypes",
"(",
"$",
"types",
")",
";",
"$",
"type",
"=",
"reset",
"(",
... | Select the best response type to return from a list of available types.
@param array $types The types that the script is willing to return
@return string The type preferred by the client | [
"Select",
"the",
"best",
"response",
"type",
"to",
"return",
"from",
"a",
"list",
"of",
"available",
"types",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L169-L177 | train |
Wedeto/HTTP | src/Accept.php | Accept.chooseResponse | public function chooseResponse(array $types)
{
if (empty($types))
return null;
$this->sortTypes($types);
$first = reset($types);
$type = key($types);
return $this->accepts($type) ? $first : null;
} | php | public function chooseResponse(array $types)
{
if (empty($types))
return null;
$this->sortTypes($types);
$first = reset($types);
$type = key($types);
return $this->accepts($type) ? $first : null;
} | [
"public",
"function",
"chooseResponse",
"(",
"array",
"$",
"types",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"types",
")",
")",
"return",
"null",
";",
"$",
"this",
"->",
"sortTypes",
"(",
"$",
"types",
")",
";",
"$",
"first",
"=",
"reset",
"(",
"$",... | Select the preferred reponse type based on a list of response types.
The response types should be provided in preference of the script, if any.
These are then matched with the accepted response types by the client,
and the most preferred one is selected. If more than one type is equally
desired by the client, the first... | [
"Select",
"the",
"preferred",
"reponse",
"type",
"based",
"on",
"a",
"list",
"of",
"response",
"types",
".",
"The",
"response",
"types",
"should",
"be",
"provided",
"in",
"preference",
"of",
"the",
"script",
"if",
"any",
".",
"These",
"are",
"then",
"match... | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Accept.php#L190-L200 | train |
faizalpribadi/Cache | Driver/OpCache/FileCache.php | FileCache.setDirectory | public function setDirectory($directory)
{
if (!is_dir($directory) && !is_writable($directory)) {
throw new FileCacheException(
sprintf('The directory "%s" is not directory and not writable', $directory)
);
}
if (is_null($directory) && !$this->getFile... | php | public function setDirectory($directory)
{
if (!is_dir($directory) && !is_writable($directory)) {
throw new FileCacheException(
sprintf('The directory "%s" is not directory and not writable', $directory)
);
}
if (is_null($directory) && !$this->getFile... | [
"public",
"function",
"setDirectory",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
")",
"&&",
"!",
"is_writable",
"(",
"$",
"directory",
")",
")",
"{",
"throw",
"new",
"FileCacheException",
"(",
"sprintf",
"(",
"'The ... | Set the directory to store you're cache
@param string|__DIR__ $directory
@throws \Mozart\Library\Cache\Exception\FileCacheException | [
"Set",
"the",
"directory",
"to",
"store",
"you",
"re",
"cache"
] | e62a4d71739e542ca6e7bac77f5cc522accef8cb | https://github.com/faizalpribadi/Cache/blob/e62a4d71739e542ca6e7bac77f5cc522accef8cb/Driver/OpCache/FileCache.php#L58-L73 | train |
BapCat/Remodel | src/GatewayQuery.php | GatewayQuery.insert | public function insert(array $values): bool {
$this->coerceDataTypesToDatabase($values);
return $this->builder->insert($values);
} | php | public function insert(array $values): bool {
$this->coerceDataTypesToDatabase($values);
return $this->builder->insert($values);
} | [
"public",
"function",
"insert",
"(",
"array",
"$",
"values",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"coerceDataTypesToDatabase",
"(",
"$",
"values",
")",
";",
"return",
"$",
"this",
"->",
"builder",
"->",
"insert",
"(",
"$",
"values",
")",
";",
"}"
... | Insert a new record into the database
@param mixed[] $values
@return bool | [
"Insert",
"a",
"new",
"record",
"into",
"the",
"database"
] | 80fcdec8bca22b88c5af9a0a93622c796cf3e7b1 | https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GatewayQuery.php#L96-L99 | train |
BapCat/Remodel | src/GatewayQuery.php | GatewayQuery.insertGetId | public function insertGetId(array $values): int {
$this->coerceDataTypesToDatabase($values);
return $this->builder->insertGetId($values);
} | php | public function insertGetId(array $values): int {
$this->coerceDataTypesToDatabase($values);
return $this->builder->insertGetId($values);
} | [
"public",
"function",
"insertGetId",
"(",
"array",
"$",
"values",
")",
":",
"int",
"{",
"$",
"this",
"->",
"coerceDataTypesToDatabase",
"(",
"$",
"values",
")",
";",
"return",
"$",
"this",
"->",
"builder",
"->",
"insertGetId",
"(",
"$",
"values",
")",
";... | Insert a new record and get the value of the primary key
@param mixed[] $values
@return int | [
"Insert",
"a",
"new",
"record",
"and",
"get",
"the",
"value",
"of",
"the",
"primary",
"key"
] | 80fcdec8bca22b88c5af9a0a93622c796cf3e7b1 | https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GatewayQuery.php#L108-L111 | train |
BapCat/Remodel | src/GatewayQuery.php | GatewayQuery.update | public function update(array $values): int {
$this->coerceDataTypesToDatabase($values);
return $this->builder->update($values);
} | php | public function update(array $values): int {
$this->coerceDataTypesToDatabase($values);
return $this->builder->update($values);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"values",
")",
":",
"int",
"{",
"$",
"this",
"->",
"coerceDataTypesToDatabase",
"(",
"$",
"values",
")",
";",
"return",
"$",
"this",
"->",
"builder",
"->",
"update",
"(",
"$",
"values",
")",
";",
"}"
] | Update a record in the database
@param mixed[] $values
@return int | [
"Update",
"a",
"record",
"in",
"the",
"database"
] | 80fcdec8bca22b88c5af9a0a93622c796cf3e7b1 | https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GatewayQuery.php#L120-L123 | train |
WellCommerce/AdminBundle | Provider/AdminMenuProvider.php | AdminMenuProvider.generateTree | protected function generateTree(Collection $collection, Collection $children)
{
$children->map(function (AdminMenuInterface $menuItem) use ($collection, &$tree) {
$tree[] = [
'routeName' => $menuItem->getRouteName(),
'cssClass' => $menuItem->getCssClass(),
... | php | protected function generateTree(Collection $collection, Collection $children)
{
$children->map(function (AdminMenuInterface $menuItem) use ($collection, &$tree) {
$tree[] = [
'routeName' => $menuItem->getRouteName(),
'cssClass' => $menuItem->getCssClass(),
... | [
"protected",
"function",
"generateTree",
"(",
"Collection",
"$",
"collection",
",",
"Collection",
"$",
"children",
")",
"{",
"$",
"children",
"->",
"map",
"(",
"function",
"(",
"AdminMenuInterface",
"$",
"menuItem",
")",
"use",
"(",
"$",
"collection",
",",
"... | Generates a tree for given children elements
@param Collection $collection
@param Collection $children
@return array | [
"Generates",
"a",
"tree",
"for",
"given",
"children",
"elements"
] | 5721f0b9a506023ed6beb6bdf79e4ccbbe546516 | https://github.com/WellCommerce/AdminBundle/blob/5721f0b9a506023ed6beb6bdf79e4ccbbe546516/Provider/AdminMenuProvider.php#L87-L99 | train |
brunschgi/TerrificComposerBundle | EventListener/ToolbarListener.php | ToolbarListener.injectToolbar | protected function injectToolbar(Response $response, $params)
{
if (function_exists('mb_stripos')) {
$posrFunction = 'mb_strripos';
$substrFunction = 'mb_substr';
} else {
$posrFunction = 'strripos';
$substrFunction = 'substr';
}
$cont... | php | protected function injectToolbar(Response $response, $params)
{
if (function_exists('mb_stripos')) {
$posrFunction = 'mb_strripos';
$substrFunction = 'mb_substr';
} else {
$posrFunction = 'strripos';
$substrFunction = 'substr';
}
$cont... | [
"protected",
"function",
"injectToolbar",
"(",
"Response",
"$",
"response",
",",
"$",
"params",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'mb_stripos'",
")",
")",
"{",
"$",
"posrFunction",
"=",
"'mb_strripos'",
";",
"$",
"substrFunction",
"=",
"'mb_substr'... | Injects the Terrific Composer Toolbar into the given Response.
@param Response $response A Response instance
@param array $params The parameters | [
"Injects",
"the",
"Terrific",
"Composer",
"Toolbar",
"into",
"the",
"given",
"Response",
"."
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/EventListener/ToolbarListener.php#L111-L130 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.parseCommand | public function parseCommand($originCommand)
{
$mappings = [
'create' => ['create'],
'drop' => ['drop', 'dropIfExists'],
];
foreach ($mappings as $key => $mapping) {
if (in_array($originCommand, $mapping)) {
return $key;
}
... | php | public function parseCommand($originCommand)
{
$mappings = [
'create' => ['create'],
'drop' => ['drop', 'dropIfExists'],
];
foreach ($mappings as $key => $mapping) {
if (in_array($originCommand, $mapping)) {
return $key;
}
... | [
"public",
"function",
"parseCommand",
"(",
"$",
"originCommand",
")",
"{",
"$",
"mappings",
"=",
"[",
"'create'",
"=>",
"[",
"'create'",
"]",
",",
"'drop'",
"=>",
"[",
"'drop'",
",",
"'dropIfExists'",
"]",
",",
"]",
";",
"foreach",
"(",
"$",
"mappings",
... | Parse origin command to human command
@param $originCommand
@return int|null|string | [
"Parse",
"origin",
"command",
"to",
"human",
"command"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L26-L40 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.primary | public function primary($columns, $name = null)
{
$this->addCachePrimary($columns);
return parent::primary($columns, $name);
} | php | public function primary($columns, $name = null)
{
$this->addCachePrimary($columns);
return parent::primary($columns, $name);
} | [
"public",
"function",
"primary",
"(",
"$",
"columns",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addCachePrimary",
"(",
"$",
"columns",
")",
";",
"return",
"parent",
"::",
"primary",
"(",
"$",
"columns",
",",
"$",
"name",
")",
";",
... | Store list primary to create i18n
@param array|string $columns
@param null $name
@return \Illuminate\Support\Fluent | [
"Store",
"list",
"primary",
"to",
"create",
"i18n"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L80-L85 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.build | public function build(Connection $connection, Grammar $grammar)
{
$command = $this->parseCommand($this->commands[0]->get('name'));
$schema = $connection->getSchemaBuilder();
if ($command === "drop") {
$schema->dropIfExists($this->getI18NTableName());
}
parent::... | php | public function build(Connection $connection, Grammar $grammar)
{
$command = $this->parseCommand($this->commands[0]->get('name'));
$schema = $connection->getSchemaBuilder();
if ($command === "drop") {
$schema->dropIfExists($this->getI18NTableName());
}
parent::... | [
"public",
"function",
"build",
"(",
"Connection",
"$",
"connection",
",",
"Grammar",
"$",
"grammar",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"parseCommand",
"(",
"$",
"this",
"->",
"commands",
"[",
"0",
"]",
"->",
"get",
"(",
"'name'",
")",
... | Overrride build function
@param Connection $connection
@param Grammar $grammar | [
"Overrride",
"build",
"function"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L119-L149 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.createColumn | protected function createColumn($name, $type, array $parameters = [])
{
$attributes = array_merge(compact('type', 'name'), $parameters);
$column = new Fluent($attributes);
return $column;
} | php | protected function createColumn($name, $type, array $parameters = [])
{
$attributes = array_merge(compact('type', 'name'), $parameters);
$column = new Fluent($attributes);
return $column;
} | [
"protected",
"function",
"createColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"attributes",
"=",
"array_merge",
"(",
"compact",
"(",
"'type'",
",",
"'name'",
")",
",",
"$",
"parameters",
")"... | Create column fluent
@param $name
@param $type
@param array $parameters
@return Fluent | [
"Create",
"column",
"fluent"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L160-L167 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.i18n_string | public function i18n_string($name, $length = 255)
{
$this->i18n_columns[] = $column = $this->createColumn($name, 'string', compact('length'));
return $column;
} | php | public function i18n_string($name, $length = 255)
{
$this->i18n_columns[] = $column = $this->createColumn($name, 'string', compact('length'));
return $column;
} | [
"public",
"function",
"i18n_string",
"(",
"$",
"name",
",",
"$",
"length",
"=",
"255",
")",
"{",
"$",
"this",
"->",
"i18n_columns",
"[",
"]",
"=",
"$",
"column",
"=",
"$",
"this",
"->",
"createColumn",
"(",
"$",
"name",
",",
"'string'",
",",
"compact... | Add i18n string field
@param $name
@param int $length
@return \Illuminate\Support\Fluent | [
"Add",
"i18n",
"string",
"field"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L205-L210 | train |
tuanlq11/dbi18n | src/I18NBlueprint.php | I18NBlueprint.i18n_char | public function i18n_char($name, $length = 255)
{
$this->i18n_columns[] = $column = $this->createColumn($name, 'char', compact('length'));
return $column;
} | php | public function i18n_char($name, $length = 255)
{
$this->i18n_columns[] = $column = $this->createColumn($name, 'char', compact('length'));
return $column;
} | [
"public",
"function",
"i18n_char",
"(",
"$",
"name",
",",
"$",
"length",
"=",
"255",
")",
"{",
"$",
"this",
"->",
"i18n_columns",
"[",
"]",
"=",
"$",
"column",
"=",
"$",
"this",
"->",
"createColumn",
"(",
"$",
"name",
",",
"'char'",
",",
"compact",
... | Add i18n char field
@param $name
@param int $length
@return \Illuminate\Support\Fluent | [
"Add",
"i18n",
"char",
"field"
] | 56d01eceae043f2770e01b92e7bcc7e52a5047e7 | https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NBlueprint.php#L220-L225 | train |
OliverMonneke/pennePHP | src/Filesystem/File.php | File.setHandle | private function setHandle($mode)
{
$this->closeExistingHandle();
$this->handle = fopen($this->file, $mode);
return $this->handle;
} | php | private function setHandle($mode)
{
$this->closeExistingHandle();
$this->handle = fopen($this->file, $mode);
return $this->handle;
} | [
"private",
"function",
"setHandle",
"(",
"$",
"mode",
")",
"{",
"$",
"this",
"->",
"closeExistingHandle",
"(",
")",
";",
"$",
"this",
"->",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"file",
",",
"$",
"mode",
")",
";",
"return",
"$",
"this",
"... | Set file handle
@param string $mode Mode for file opening
@return resource | [
"Set",
"file",
"handle"
] | dd0de7944685a3f1947157e1254fc54b55ff9942 | https://github.com/OliverMonneke/pennePHP/blob/dd0de7944685a3f1947157e1254fc54b55ff9942/src/Filesystem/File.php#L54-L61 | train |
OliverMonneke/pennePHP | src/Filesystem/File.php | File.write | public function write($string, $append = true)
{
$mode = $this->getMode($append);
$this->setHandle($mode);
return fwrite($this->handle, $string);
} | php | public function write($string, $append = true)
{
$mode = $this->getMode($append);
$this->setHandle($mode);
return fwrite($this->handle, $string);
} | [
"public",
"function",
"write",
"(",
"$",
"string",
",",
"$",
"append",
"=",
"true",
")",
"{",
"$",
"mode",
"=",
"$",
"this",
"->",
"getMode",
"(",
"$",
"append",
")",
";",
"$",
"this",
"->",
"setHandle",
"(",
"$",
"mode",
")",
";",
"return",
"fwr... | Write a string into a file
@param string $string The string to write
@param bool $append Append to file
@return int | [
"Write",
"a",
"string",
"into",
"a",
"file"
] | dd0de7944685a3f1947157e1254fc54b55ff9942 | https://github.com/OliverMonneke/pennePHP/blob/dd0de7944685a3f1947157e1254fc54b55ff9942/src/Filesystem/File.php#L181-L187 | train |
OliverMonneke/pennePHP | src/Filesystem/File.php | File.read | public function read($length = 0, $asArray = false)
{
if ($asArray &&
Number::isZero($length)) {
return file($this->file);
} elseif (Number::isPositive($length)) {
$this->setHandle('r');
return fread($this->handle, $length);
} else {
... | php | public function read($length = 0, $asArray = false)
{
if ($asArray &&
Number::isZero($length)) {
return file($this->file);
} elseif (Number::isPositive($length)) {
$this->setHandle('r');
return fread($this->handle, $length);
} else {
... | [
"public",
"function",
"read",
"(",
"$",
"length",
"=",
"0",
",",
"$",
"asArray",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"asArray",
"&&",
"Number",
"::",
"isZero",
"(",
"$",
"length",
")",
")",
"{",
"return",
"file",
"(",
"$",
"this",
"->",
"file... | Read content from file
@param int $length Length of content to read
@param bool $asArray Get as array
@return array|string|bool | [
"Read",
"content",
"from",
"file"
] | dd0de7944685a3f1947157e1254fc54b55ff9942 | https://github.com/OliverMonneke/pennePHP/blob/dd0de7944685a3f1947157e1254fc54b55ff9942/src/Filesystem/File.php#L209-L222 | train |
Krinkle/toollabs-base | src/Request.php | Request.getSessionData | public function getSessionData( $key ) {
self::ensureSession();
if ( !isset( $_SESSION[ $key ] ) ) {
return null;
}
return $_SESSION[$key];
} | php | public function getSessionData( $key ) {
self::ensureSession();
if ( !isset( $_SESSION[ $key ] ) ) {
return null;
}
return $_SESSION[$key];
} | [
"public",
"function",
"getSessionData",
"(",
"$",
"key",
")",
"{",
"self",
"::",
"ensureSession",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"_SESSIO... | Get data from session
@param string $key
@return mixed | [
"Get",
"data",
"from",
"session"
] | 784150ca58f4b48cc89534fd6142c54b4f138cd2 | https://github.com/Krinkle/toollabs-base/blob/784150ca58f4b48cc89534fd6142c54b4f138cd2/src/Request.php#L115-L121 | train |
Krinkle/toollabs-base | src/Request.php | Request.initHeaders | private function initHeaders() {
if ( $this->headers !== null ) {
return;
}
$apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : false;
if ( $apacheHeaders ) {
foreach ( $apacheHeaders as $key => $val ) {
$this->headers[strtoupper( $key )] = $val;
}
} else {
... | php | private function initHeaders() {
if ( $this->headers !== null ) {
return;
}
$apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : false;
if ( $apacheHeaders ) {
foreach ( $apacheHeaders as $key => $val ) {
$this->headers[strtoupper( $key )] = $val;
}
} else {
... | [
"private",
"function",
"initHeaders",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"apacheHeaders",
"=",
"function_exists",
"(",
"'apache_request_headers'",
")",
"?",
"apache_request_headers",
"(",
... | Initialise the header list | [
"Initialise",
"the",
"header",
"list"
] | 784150ca58f4b48cc89534fd6142c54b4f138cd2 | https://github.com/Krinkle/toollabs-base/blob/784150ca58f4b48cc89534fd6142c54b4f138cd2/src/Request.php#L180-L200 | train |
Krinkle/toollabs-base | src/Request.php | Request.getHeader | public function getHeader( $name ) {
$this->initHeaders();
$name = strtoupper( $name );
if ( !isset( $this->headers[$name] ) ) {
return false;
}
return $this->headers[$name];
} | php | public function getHeader( $name ) {
$this->initHeaders();
$name = strtoupper( $name );
if ( !isset( $this->headers[$name] ) ) {
return false;
}
return $this->headers[$name];
} | [
"public",
"function",
"getHeader",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"initHeaders",
"(",
")",
";",
"$",
"name",
"=",
"strtoupper",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"$",
"nam... | Get a request header, or false if it isn't set
@param string $name Case-insensitive header name
@return string|bool False on failure | [
"Get",
"a",
"request",
"header",
"or",
"false",
"if",
"it",
"isn",
"t",
"set"
] | 784150ca58f4b48cc89534fd6142c54b4f138cd2 | https://github.com/Krinkle/toollabs-base/blob/784150ca58f4b48cc89534fd6142c54b4f138cd2/src/Request.php#L218-L225 | train |
Krinkle/toollabs-base | src/Request.php | Request.tryLastModified | public function tryLastModified( $modifiedTime ) {
$clientCache = $this->getHeader( 'If-Modified-Since' );
if ( $clientCache !== false ) {
# IE sends sizes after the date like "Wed, 20 Aug 2003 06:51:19 GMT; length=5202"
# which would break strtotime() parsing.
$clientCache = preg_replace( '/;.*$/', '', $c... | php | public function tryLastModified( $modifiedTime ) {
$clientCache = $this->getHeader( 'If-Modified-Since' );
if ( $clientCache !== false ) {
# IE sends sizes after the date like "Wed, 20 Aug 2003 06:51:19 GMT; length=5202"
# which would break strtotime() parsing.
$clientCache = preg_replace( '/;.*$/', '', $c... | [
"public",
"function",
"tryLastModified",
"(",
"$",
"modifiedTime",
")",
"{",
"$",
"clientCache",
"=",
"$",
"this",
"->",
"getHeader",
"(",
"'If-Modified-Since'",
")",
";",
"if",
"(",
"$",
"clientCache",
"!==",
"false",
")",
"{",
"# IE sends sizes after the date ... | Respond with 304 Last Modified if appropiate
@param int $modifiedTime
@return bool True if 304 header was sent | [
"Respond",
"with",
"304",
"Last",
"Modified",
"if",
"appropiate"
] | 784150ca58f4b48cc89534fd6142c54b4f138cd2 | https://github.com/Krinkle/toollabs-base/blob/784150ca58f4b48cc89534fd6142c54b4f138cd2/src/Request.php#L233-L246 | train |
Wedeto/HTTP | src/URL.php | URL.parse | public static function parse(string $url, string $default_scheme = null)
{
if (substr($url, 0, 4) === "www." && !empty($default_scheme))
$url = $default_scheme . '://' . $url;
elseif (substr($url, 0, 2) === '//' && !empty($_SERVER['REQUEST_SCHEME']))
$url = $_SERVER['REQUEST_... | php | public static function parse(string $url, string $default_scheme = null)
{
if (substr($url, 0, 4) === "www." && !empty($default_scheme))
$url = $default_scheme . '://' . $url;
elseif (substr($url, 0, 2) === '//' && !empty($_SERVER['REQUEST_SCHEME']))
$url = $_SERVER['REQUEST_... | [
"public",
"static",
"function",
"parse",
"(",
"string",
"$",
"url",
",",
"string",
"$",
"default_scheme",
"=",
"null",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"url",
",",
"0",
",",
"4",
")",
"===",
"\"www.\"",
"&&",
"!",
"empty",
"(",
"$",
"defaul... | Parse a URL
@param string $url The URL to parse
@param string $default_scheme A default scheme to use when no scheme is
used in the URL. | [
"Parse",
"a",
"URL"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L69-L113 | train |
Wedeto/HTTP | src/URL.php | URL.parseQuery | protected static function parseQuery($query)
{
if (is_array($query))
return $query;
if (empty($query))
return null;
if (!is_string($query))
throw new \InvalidArgumentException('Query must be associative array or string');
$query = ltrim(... | php | protected static function parseQuery($query)
{
if (is_array($query))
return $query;
if (empty($query))
return null;
if (!is_string($query))
throw new \InvalidArgumentException('Query must be associative array or string');
$query = ltrim(... | [
"protected",
"static",
"function",
"parseQuery",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"query",
")",
")",
"return",
"$",
"query",
";",
"if",
"(",
"empty",
"(",
"$",
"query",
")",
")",
"return",
"null",
";",
"if",
"(",
"!",
... | Parse a query string or array
@param string|array $query The query to parse
@return array The associative array of key/value pairs. If an array was passed in,
it is returned as-is. | [
"Parse",
"a",
"query",
"string",
"or",
"array"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L121-L146 | train |
Wedeto/HTTP | src/URL.php | URL.setPath | public function setPath(string $path)
{
$path = '/' . ltrim($path, '/');
$this->query = null;
$this->fragment = null;
if (preg_match('/^(.*?)(\\?([^#]*))?(#(.*))?$/u', $path, $matches))
{
$path = $matches[1];
$this->query = !empty($matches[3]) ? $match... | php | public function setPath(string $path)
{
$path = '/' . ltrim($path, '/');
$this->query = null;
$this->fragment = null;
if (preg_match('/^(.*?)(\\?([^#]*))?(#(.*))?$/u', $path, $matches))
{
$path = $matches[1];
$this->query = !empty($matches[3]) ? $match... | [
"public",
"function",
"setPath",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"'/'",
".",
"ltrim",
"(",
"$",
"path",
",",
"'/'",
")",
";",
"$",
"this",
"->",
"query",
"=",
"null",
";",
"$",
"this",
"->",
"fragment",
"=",
"null",
";",
... | Set the path of the URL. This will unset the currently set
fragment and query and overwrite them with whatever is appended in the path.
@param string $path The path to set. May include query and fragment
@return URL Provides fluent interface | [
"Set",
"the",
"path",
"of",
"the",
"URL",
".",
"This",
"will",
"unset",
"the",
"currently",
"set",
"fragment",
"and",
"query",
"and",
"overwrite",
"them",
"with",
"whatever",
"is",
"appended",
"in",
"the",
"path",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L154-L168 | train |
Wedeto/HTTP | src/URL.php | URL.toString | public function toString(bool $idn = false)
{
$o = "";
if (!empty($this->scheme))
$o .= $this->scheme . "://";
if (!empty($this->username) && !empty($this->password))
$o .= $this->username . ':' . $this->password . '@';
// Check for IDN
$host... | php | public function toString(bool $idn = false)
{
$o = "";
if (!empty($this->scheme))
$o .= $this->scheme . "://";
if (!empty($this->username) && !empty($this->password))
$o .= $this->username . ':' . $this->password . '@';
// Check for IDN
$host... | [
"public",
"function",
"toString",
"(",
"bool",
"$",
"idn",
"=",
"false",
")",
"{",
"$",
"o",
"=",
"\"\"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"scheme",
")",
")",
"$",
"o",
".=",
"$",
"this",
"->",
"scheme",
".",
"\"://\"",
";"... | Convert a URL to a string.
@param bool $idn Whether to allow IDN names or convert them to punycode.
@return string A string representation of the URL | [
"Convert",
"a",
"URL",
"to",
"a",
"string",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L183-L218 | train |
Wedeto/HTTP | src/URL.php | URL.setHost | public function setHost(string $hostname)
{
if (($ppos = strrpos($hostname, ":")) !== false)
{
$this->port = substr($hostname, $ppos + 1);
$hostname = substr($hostname, 0, $ppos);
}
if (substr($hostname, 0, 4) === "xn--")
$hostname = \idn_to_utf8(... | php | public function setHost(string $hostname)
{
if (($ppos = strrpos($hostname, ":")) !== false)
{
$this->port = substr($hostname, $ppos + 1);
$hostname = substr($hostname, 0, $ppos);
}
if (substr($hostname, 0, 4) === "xn--")
$hostname = \idn_to_utf8(... | [
"public",
"function",
"setHost",
"(",
"string",
"$",
"hostname",
")",
"{",
"if",
"(",
"(",
"$",
"ppos",
"=",
"strrpos",
"(",
"$",
"hostname",
",",
"\":\"",
")",
")",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"port",
"=",
"substr",
"(",
"$",
"h... | Set the host name of the URL
@param string $hostname The hostname to set | [
"Set",
"the",
"host",
"name",
"of",
"the",
"URL"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L224-L237 | train |
Wedeto/HTTP | src/URL.php | URL.set | public function set(string $field, $value)
{
if ($value === null)
$value = "";
switch ($field)
{
case "scheme":
$this->scheme = strtolower($value);
return $this;
case "port":
$value = empty($value) ? null : ... | php | public function set(string $field, $value)
{
if ($value === null)
$value = "";
switch ($field)
{
case "scheme":
$this->scheme = strtolower($value);
return $this;
case "port":
$value = empty($value) ? null : ... | [
"public",
"function",
"set",
"(",
"string",
"$",
"field",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"$",
"value",
"=",
"\"\"",
";",
"switch",
"(",
"$",
"field",
")",
"{",
"case",
"\"scheme\"",
":",
"$",
"this",
"->... | Set a field to a new value
@param string $field The field to set
@param mixed $value The value to update
@return URL Provides fluent interface | [
"Set",
"a",
"field",
"to",
"a",
"new",
"value"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L287-L314 | train |
Wedeto/HTTP | src/URL.php | URL.get | public function get(string $field)
{
if ($field === "secure")
return $this->scheme === "https";
if ($field === "port" && $this->port === null)
{
if ($this->scheme === "http") return 80;
if ($this->scheme === "https") return 443;
if ($this->sch... | php | public function get(string $field)
{
if ($field === "secure")
return $this->scheme === "https";
if ($field === "port" && $this->port === null)
{
if ($this->scheme === "http") return 80;
if ($this->scheme === "https") return 443;
if ($this->sch... | [
"public",
"function",
"get",
"(",
"string",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"===",
"\"secure\"",
")",
"return",
"$",
"this",
"->",
"scheme",
"===",
"\"https\"",
";",
"if",
"(",
"$",
"field",
"===",
"\"port\"",
"&&",
"$",
"this",
"->"... | Get the value for a field
@param string field The field to get
@return string The value for the field | [
"Get",
"the",
"value",
"for",
"a",
"field"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L321-L343 | train |
Wedeto/HTTP | src/URL.php | URL.setQueryVariable | public function setQueryVariable(string $key, string $value)
{
if (empty($value))
unset($this->query[$key]);
else
$this->query[$key] = $value;
return $this;
} | php | public function setQueryVariable(string $key, string $value)
{
if (empty($value))
unset($this->query[$key]);
else
$this->query[$key] = $value;
return $this;
} | [
"public",
"function",
"setQueryVariable",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"unset",
"(",
"$",
"this",
"->",
"query",
"[",
"$",
"key",
"]",
")",
";",
"else",
"$",
"t... | Set or update a query variable
@param string $key The name of the query parameter
@param string $value The value for the parameter
@return URL Provides fluent interface | [
"Set",
"or",
"update",
"a",
"query",
"variable"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/URL.php#L391-L398 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.getVendorPath | public function getVendorPath()
{
if (is_null($this->vendorPath)) {
// We get the current package install path
$installPath = $this->composer->getInstallationManager()->getInstallPath($this->package);
// We get the name of the package in order to get its target path
... | php | public function getVendorPath()
{
if (is_null($this->vendorPath)) {
// We get the current package install path
$installPath = $this->composer->getInstallationManager()->getInstallPath($this->package);
// We get the name of the package in order to get its target path
... | [
"public",
"function",
"getVendorPath",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"vendorPath",
")",
")",
"{",
"// We get the current package install path",
"$",
"installPath",
"=",
"$",
"this",
"->",
"composer",
"->",
"getInstallationManager",
... | Returns the vendor path of the current package
@return string | [
"Returns",
"the",
"vendor",
"path",
"of",
"the",
"current",
"package"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L107-L118 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.install | public function install()
{
// We get all the packages required
$packages = $this->composer->getPackage()->getRequires();
/** @var Package\Link $package */
foreach ($packages as $package) {
$this->packagesStatuses[$package->getTarget()] = array('extra' => null, 'dirs' => ... | php | public function install()
{
// We get all the packages required
$packages = $this->composer->getPackage()->getRequires();
/** @var Package\Link $package */
foreach ($packages as $package) {
$this->packagesStatuses[$package->getTarget()] = array('extra' => null, 'dirs' => ... | [
"public",
"function",
"install",
"(",
")",
"{",
"// We get all the packages required",
"$",
"packages",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
"->",
"getRequires",
"(",
")",
";",
"/** @var Package\\Link $package */",
"foreach",
"(",
"$",... | Installs all the assets directories of the dependency packages
@return $this | [
"Installs",
"all",
"the",
"assets",
"directories",
"of",
"the",
"dependency",
"packages"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L124-L134 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.installPackage | public function installPackage($package)
{
// We read its composer file
$jsonData = $this->getPackageJsonFile($package);
// We get the package assets dirs
$packagesAssetsDir = $this->getPackageAssetsDirs($jsonData);
if (!is_null($packagesAssetsDir)) {
$this->log($... | php | public function installPackage($package)
{
// We read its composer file
$jsonData = $this->getPackageJsonFile($package);
// We get the package assets dirs
$packagesAssetsDir = $this->getPackageAssetsDirs($jsonData);
if (!is_null($packagesAssetsDir)) {
$this->log($... | [
"public",
"function",
"installPackage",
"(",
"$",
"package",
")",
"{",
"// We read its composer file",
"$",
"jsonData",
"=",
"$",
"this",
"->",
"getPackageJsonFile",
"(",
"$",
"package",
")",
";",
"// We get the package assets dirs",
"$",
"packagesAssetsDir",
"=",
"... | Installs all the assets directories of the given package
@param Package\Link $package | [
"Installs",
"all",
"the",
"assets",
"directories",
"of",
"the",
"given",
"package"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L140-L161 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.getPackageJsonFile | public function getPackageJsonFile($package)
{
// We get the project vendor path
$vendorPath = $this->getVendorPath();
// We get the target dir of the iterated package
$targetDir = $package->getTarget();
$jsonPath = $vendorPath . $targetDir . "/composer.json";
if (met... | php | public function getPackageJsonFile($package)
{
// We get the project vendor path
$vendorPath = $this->getVendorPath();
// We get the target dir of the iterated package
$targetDir = $package->getTarget();
$jsonPath = $vendorPath . $targetDir . "/composer.json";
if (met... | [
"public",
"function",
"getPackageJsonFile",
"(",
"$",
"package",
")",
"{",
"// We get the project vendor path",
"$",
"vendorPath",
"=",
"$",
"this",
"->",
"getVendorPath",
"(",
")",
";",
"// We get the target dir of the iterated package",
"$",
"targetDir",
"=",
"$",
"... | Returns the Json file of the given Package
@param Package\Link $package
@return mixed | [
"Returns",
"the",
"Json",
"file",
"of",
"the",
"given",
"Package"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L168-L184 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.getPackageAssetsDirs | public function getPackageAssetsDirs($jsonData)
{
$packagesAssetsDir = null;
// If some assets were set on the package
if (isset($jsonData["extra"][self::LABEL_ASSETS_DIR])) {
// We get the assets-dir of this package
$packagesAssetsDir = $jsonData["extra"][self::LABEL... | php | public function getPackageAssetsDirs($jsonData)
{
$packagesAssetsDir = null;
// If some assets were set on the package
if (isset($jsonData["extra"][self::LABEL_ASSETS_DIR])) {
// We get the assets-dir of this package
$packagesAssetsDir = $jsonData["extra"][self::LABEL... | [
"public",
"function",
"getPackageAssetsDirs",
"(",
"$",
"jsonData",
")",
"{",
"$",
"packagesAssetsDir",
"=",
"null",
";",
"// If some assets were set on the package",
"if",
"(",
"isset",
"(",
"$",
"jsonData",
"[",
"\"extra\"",
"]",
"[",
"self",
"::",
"LABEL_ASSETS... | Returns all the assets directories contained in the given jsonData
@param array $jsonData
@return array|null | [
"Returns",
"all",
"the",
"assets",
"directories",
"contained",
"in",
"the",
"given",
"jsonData"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L191-L204 | train |
ReputationVIP/composer-assets-installer | src/AssetsInstaller.php | AssetsInstaller.installPackageDir | public function installPackageDir($package, $namespace, $packageAssetsDir)
{
$this->log($package->getTarget(), self::LOG_INFO, self::CODE_INSTALLING_DIR, array('namespace' => $namespace));
if (!isset($this->assetsDirectories[$namespace])) {
$this->log($package->getTarget(), self::LOG_WAR... | php | public function installPackageDir($package, $namespace, $packageAssetsDir)
{
$this->log($package->getTarget(), self::LOG_INFO, self::CODE_INSTALLING_DIR, array('namespace' => $namespace));
if (!isset($this->assetsDirectories[$namespace])) {
$this->log($package->getTarget(), self::LOG_WAR... | [
"public",
"function",
"installPackageDir",
"(",
"$",
"package",
",",
"$",
"namespace",
",",
"$",
"packageAssetsDir",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"$",
"package",
"->",
"getTarget",
"(",
")",
",",
"self",
"::",
"LOG_INFO",
",",
"self",
"::",
... | Installs a specific directory from the given package
@param Package\Link $package
@param string $namespace
@param string $packageAssetsDir | [
"Installs",
"a",
"specific",
"directory",
"from",
"the",
"given",
"package"
] | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstaller.php#L212-L245 | train |
ebidtech/options-resolver | src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php | OptionsResolver.setCast | public function setCast($option, $type)
{
/* Ensure the option exists: not very important, but ensures consistent behavior with underlying code. */
if (! $this->isDefined($option)) {
throw new UndefinedOptionsException(
sprintf(
'The option "%s" does n... | php | public function setCast($option, $type)
{
/* Ensure the option exists: not very important, but ensures consistent behavior with underlying code. */
if (! $this->isDefined($option)) {
throw new UndefinedOptionsException(
sprintf(
'The option "%s" does n... | [
"public",
"function",
"setCast",
"(",
"$",
"option",
",",
"$",
"type",
")",
"{",
"/* Ensure the option exists: not very important, but ensures consistent behavior with underlying code. */",
"if",
"(",
"!",
"$",
"this",
"->",
"isDefined",
"(",
"$",
"option",
")",
")",
... | Sets a cast for a specific option. The given option will be cast to the given type before any validation, if
possible.
@param string $option Option name.
@param string|\Closure $type Type to cast the option to or a closure to be lazily evaluated.
@return OptionsResolver Returns itself.
@throws UndefinedOp... | [
"Sets",
"a",
"cast",
"for",
"a",
"specific",
"option",
".",
"The",
"given",
"option",
"will",
"be",
"cast",
"to",
"the",
"given",
"type",
"before",
"any",
"validation",
"if",
"possible",
"."
] | a5a3a81571c4ceaa94d674c3e60b22b5ee720d72 | https://github.com/ebidtech/options-resolver/blob/a5a3a81571c4ceaa94d674c3e60b22b5ee720d72/src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php#L115-L158 | train |
ebidtech/options-resolver | src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php | OptionsResolver.clearUndefinedOptions | protected function clearUndefinedOptions(array $options, $allowUndefinedOptions)
{
if (! $allowUndefinedOptions) {
return $options;
}
/* Find out undefined options by computing the difference between given and defined options. */
$undefinedOptions = array_diff(
... | php | protected function clearUndefinedOptions(array $options, $allowUndefinedOptions)
{
if (! $allowUndefinedOptions) {
return $options;
}
/* Find out undefined options by computing the difference between given and defined options. */
$undefinedOptions = array_diff(
... | [
"protected",
"function",
"clearUndefinedOptions",
"(",
"array",
"$",
"options",
",",
"$",
"allowUndefinedOptions",
")",
"{",
"if",
"(",
"!",
"$",
"allowUndefinedOptions",
")",
"{",
"return",
"$",
"options",
";",
"}",
"/* Find out undefined options by computing the dif... | Clears undefined options before resolving, if the appropriate flag is set.
@param array $options Map of option names to values.
@param bool $allowUndefinedOptions If set to true undefined options will not raise an error.
@return array Clean options. | [
"Clears",
"undefined",
"options",
"before",
"resolving",
"if",
"the",
"appropriate",
"flag",
"is",
"set",
"."
] | a5a3a81571c4ceaa94d674c3e60b22b5ee720d72 | https://github.com/ebidtech/options-resolver/blob/a5a3a81571c4ceaa94d674c3e60b22b5ee720d72/src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php#L180-L199 | train |
ebidtech/options-resolver | src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php | OptionsResolver.resolveCasts | protected function resolveCasts(array $options = [])
{
/* Create a copy of the options to work on. */
$castOptions = $options;
/* Iterate every options and cast as needed. */
foreach ($options as $option => $value) {
/* No cast was defined, continue. */
if (... | php | protected function resolveCasts(array $options = [])
{
/* Create a copy of the options to work on. */
$castOptions = $options;
/* Iterate every options and cast as needed. */
foreach ($options as $option => $value) {
/* No cast was defined, continue. */
if (... | [
"protected",
"function",
"resolveCasts",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"/* Create a copy of the options to work on. */",
"$",
"castOptions",
"=",
"$",
"options",
";",
"/* Iterate every options and cast as needed. */",
"foreach",
"(",
"$",
"optio... | Resolves a variable casts in the initial options.
@param array $options Options to cast.
@return array Options after applying the relevant casts. | [
"Resolves",
"a",
"variable",
"casts",
"in",
"the",
"initial",
"options",
"."
] | a5a3a81571c4ceaa94d674c3e60b22b5ee720d72 | https://github.com/ebidtech/options-resolver/blob/a5a3a81571c4ceaa94d674c3e60b22b5ee720d72/src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php#L208-L229 | train |
ebidtech/options-resolver | src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php | OptionsResolver.castToType | protected function castToType($value, $type)
{
switch ($type) {
case self::TYPE_CAST_INT:
$newValue = filter_var($value, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
$value = (null === $newValue) ? $value : $newValue;
break;
case se... | php | protected function castToType($value, $type)
{
switch ($type) {
case self::TYPE_CAST_INT:
$newValue = filter_var($value, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
$value = (null === $newValue) ? $value : $newValue;
break;
case se... | [
"protected",
"function",
"castToType",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_CAST_INT",
":",
"$",
"newValue",
"=",
"filter_var",
"(",
"$",
"value",
",",
"FILTER_VALIDATE_INT",
","... | Applies specific cast logic for each type.
@param mixed $value Value to cast.
@param string $type Type to cast to.
@return mixed Cast value. | [
"Applies",
"specific",
"cast",
"logic",
"for",
"each",
"type",
"."
] | a5a3a81571c4ceaa94d674c3e60b22b5ee720d72 | https://github.com/ebidtech/options-resolver/blob/a5a3a81571c4ceaa94d674c3e60b22b5ee720d72/src/EBT/OptionsResolver/Model/OptionsResolver/OptionsResolver.php#L239-L257 | train |
stubbles/stubbles-reflect | src/main/php/annotation/Annotations.php | Annotations.add | public function add(Annotation $annotation)
{
if (!isset($this->types[$annotation->type()])) {
$this->types[$annotation->type()] = [$annotation];
} else {
$this->types[$annotation->type()][] = $annotation;
}
return $this;
} | php | public function add(Annotation $annotation)
{
if (!isset($this->types[$annotation->type()])) {
$this->types[$annotation->type()] = [$annotation];
} else {
$this->types[$annotation->type()][] = $annotation;
}
return $this;
} | [
"public",
"function",
"add",
"(",
"Annotation",
"$",
"annotation",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"annotation",
"->",
"type",
"(",
")",
"]",
")",
")",
"{",
"$",
"this",
"->",
"types",
"[",
"$",
"anno... | adds given annotation
@internal only to be called by the parser
@param \stubbles\reflect\annotation\Annotation $annotation | [
"adds",
"given",
"annotation"
] | ab48f9b8692293ef0d276b52619625dbb8869c97 | https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/Annotations.php#L67-L76 | train |
stubbles/stubbles-reflect | src/main/php/annotation/Annotations.php | Annotations.firstNamed | public function firstNamed(string $type): Annotation
{
if ($this->contain($type)) {
return $this->types[$type][0];
}
throw new \ReflectionException('Can not find annotation ' . $type . ' for ' . $this->target);
} | php | public function firstNamed(string $type): Annotation
{
if ($this->contain($type)) {
return $this->types[$type][0];
}
throw new \ReflectionException('Can not find annotation ' . $type . ' for ' . $this->target);
} | [
"public",
"function",
"firstNamed",
"(",
"string",
"$",
"type",
")",
":",
"Annotation",
"{",
"if",
"(",
"$",
"this",
"->",
"contain",
"(",
"$",
"type",
")",
")",
"{",
"return",
"$",
"this",
"->",
"types",
"[",
"$",
"type",
"]",
"[",
"0",
"]",
";"... | returns first annotation with given type name
If no such annotation exists a ReflectionException is thrown.
@param string $type
@return \stubbles\reflect\annotation\Annotation
@throws \ReflectionException
@since 5.3.0 | [
"returns",
"first",
"annotation",
"with",
"given",
"type",
"name"
] | ab48f9b8692293ef0d276b52619625dbb8869c97 | https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/Annotations.php#L110-L117 | train |
ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents.php | HTMLServerComponents.addAlias | public function addAlias(string $alias, string $original): self
{
$this->aliases[$alias] = $original;
return $this;
} | php | public function addAlias(string $alias, string $original): self
{
$this->aliases[$alias] = $original;
return $this;
} | [
"public",
"function",
"addAlias",
"(",
"string",
"$",
"alias",
",",
"string",
"$",
"original",
")",
":",
"self",
"{",
"$",
"this",
"->",
"aliases",
"[",
"$",
"alias",
"]",
"=",
"$",
"original",
";",
"return",
"$",
"this",
";",
"}"
] | Adds an alias
@param string $alias The alias
@param string $original The original source name
@return IvoPetkov\BearFramework\Addons\HTMLServerComponents Instance of itself. | [
"Adds",
"an",
"alias"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents.php#L51-L55 | train |
ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents.php | HTMLServerComponents.addTag | public function addTag(string $tagName, string $src): self
{
$this->tagNames[$tagName] = $src;
return $this;
} | php | public function addTag(string $tagName, string $src): self
{
$this->tagNames[$tagName] = $src;
return $this;
} | [
"public",
"function",
"addTag",
"(",
"string",
"$",
"tagName",
",",
"string",
"$",
"src",
")",
":",
"self",
"{",
"$",
"this",
"->",
"tagNames",
"[",
"$",
"tagName",
"]",
"=",
"$",
"src",
";",
"return",
"$",
"this",
";",
"}"
] | Defines a new tag
@param string $tagName The alias
@param string $src The original source name
@return IvoPetkov\BearFramework\Addons\HTMLServerComponents Instance of itself. | [
"Defines",
"a",
"new",
"tag"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents.php#L64-L68 | train |
ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents.php | HTMLServerComponents.make | public function make()
{
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
return clone(self::$newComponentCache);
} | php | public function make()
{
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
return clone(self::$newComponentCache);
} | [
"public",
"function",
"make",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"newComponentCache",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"newComponentCache",
"=",
"new",
"\\",
"IvoPetkov",
"\\",
"BearFramework",
"\\",
"Addons",
"\\",
"HTMLServerComponents... | Creates new component and return it
@return \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component | [
"Creates",
"new",
"component",
"and",
"return",
"it"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents.php#L114-L120 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createCreateForm | private function createCreateForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_create'),
'method' => 'POS... | php | private function createCreateForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_create'),
'method' => 'POS... | [
"private",
"function",
"createCreateForm",
"(",
"Country",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CountryType",
"(",
"$",
"this",
"->",
"get",
"(",
"'doctrine.orm.entity_manager'",
")",
"->",
"getRepository",
... | Creates a form to create a Country entity.
@param Country $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L74-L84 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.newAction | public function newAction()
{
$entity = new Country();
$form = $this->createCreateForm($entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | php | public function newAction()
{
$entity = new Country();
$form = $this->createCreateForm($entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"entity",
"=",
"new",
"Country",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"entity",
")",
";",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"entity",
","... | Displays a form to create a new Country entity.
@Route("/new", name="orkestro_backend_country_new")
@Method("GET")
@Template() | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L93-L102 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.showAction | public function showAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | php | public function showAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | [
"public",
"function",
"showAction",
"(",
"$",
"iso_code",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'OrkestroCountryBundle:Country'",... | Finds and displays a Country entity.
@Route("/{iso_code}", name="orkestro_backend_country_show")
@Method("GET")
@Template() | [
"Finds",
"and",
"displays",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L111-L129 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.editAction | public function editAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | php | public function editAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | [
"public",
"function",
"editAction",
"(",
"$",
"iso_code",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'OrkestroCountryBundle:Country'",... | Displays a form to edit an existing Country entity.
@Route("/{iso_code}/edit", name="orkestro_backend_country_edit")
@Method("GET")
@Template() | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L138-L158 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createEditForm | private function createEditForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->ge... | php | private function createEditForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->ge... | [
"private",
"function",
"createEditForm",
"(",
"Country",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CountryType",
"(",
"$",
"this",
"->",
"get",
"(",
"'doctrine.orm.entity_manager'",
")",
"->",
"getRepository",
"... | Creates a form to edit a Country entity.
@param Country $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L167-L177 | train |
Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createDeleteForm | private function createDeleteForm($iso_code)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('orkestro_backend_country_delete', array('iso_code' => $iso_code)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->ge... | php | private function createDeleteForm($iso_code)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('orkestro_backend_country_delete', array('iso_code' => $iso_code)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->ge... | [
"private",
"function",
"createDeleteForm",
"(",
"$",
"iso_code",
")",
"{",
"return",
"$",
"this",
"->",
"createFormBuilder",
"(",
")",
"->",
"setAction",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'orkestro_backend_country_delete'",
",",
"array",
"(",
"'iso_co... | Creates a form to delete a Country entity by iso code.
@param mixed $iso_code The entity iso code
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"delete",
"a",
"Country",
"entity",
"by",
"iso",
"code",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L250-L258 | train |
Dhii/exception-helper-base | src/CreateOutOfBoundsExceptionCapableTrait.php | CreateOutOfBoundsExceptionCapableTrait._createOutOfBoundsException | protected function _createOutOfBoundsException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfBoundsException($message, $code, $previous, $argument);
} | php | protected function _createOutOfBoundsException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfBoundsException($message, $code, $previous, $argument);
} | [
"protected",
"function",
"_createOutOfBoundsException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"RootException",
"$",
"previous",
"=",
"null",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"return",
"new",
"OutOfBoundsException",
... | Creates a new Dhii Out Of Bounds exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@pa... | [
"Creates",
"a",
"new",
"Dhii",
"Out",
"Of",
"Bounds",
"exception",
"."
] | e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5 | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateOutOfBoundsExceptionCapableTrait.php#L27-L34 | train |
modulusphp/support | Arr.php | Arr.replace_key | public static function replace_key(array $array, $oldKey, $newKey) : array
{
$newArray = array();
foreach ($array as $key => $value) {
if ($key == $oldKey) {
$newArray = array_merge($newArray, [$newKey => $value]);
} else {
$newArray = array_merge($newArray, [$key => $value]);
... | php | public static function replace_key(array $array, $oldKey, $newKey) : array
{
$newArray = array();
foreach ($array as $key => $value) {
if ($key == $oldKey) {
$newArray = array_merge($newArray, [$newKey => $value]);
} else {
$newArray = array_merge($newArray, [$key => $value]);
... | [
"public",
"static",
"function",
"replace_key",
"(",
"array",
"$",
"array",
",",
"$",
"oldKey",
",",
"$",
"newKey",
")",
":",
"array",
"{",
"$",
"newArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"val... | Replace array key
@param array $array
@param mixed $oldKey
@param mixed $newKey
@return array $newArray | [
"Replace",
"array",
"key"
] | b5c5b48dcbeb379e6cd1f29159dc8cdacef3adab | https://github.com/modulusphp/support/blob/b5c5b48dcbeb379e6cd1f29159dc8cdacef3adab/Arr.php#L31-L44 | train |
SlaxWeb/Router | src/Route.php | Route.set | public function set(string $uri, int $method, callable $action, bool $default = false): self
{
if ((self::METHOD_ANY & $method) !== $method) {
throw new Exception\InvalidMethodException(
"Route does not contain a valid HTTP Method."
);
}
$this->uri = ... | php | public function set(string $uri, int $method, callable $action, bool $default = false): self
{
if ((self::METHOD_ANY & $method) !== $method) {
throw new Exception\InvalidMethodException(
"Route does not contain a valid HTTP Method."
);
}
$this->uri = ... | [
"public",
"function",
"set",
"(",
"string",
"$",
"uri",
",",
"int",
"$",
"method",
",",
"callable",
"$",
"action",
",",
"bool",
"$",
"default",
"=",
"false",
")",
":",
"self",
"{",
"if",
"(",
"(",
"self",
"::",
"METHOD_ANY",
"&",
"$",
"method",
")"... | Set Route data
Sets the retrieved data to internal properties. Prior to setting, the
method is checked, that it is valid, and raises an
'InvalidMethodException' on error.
@param string $uri Request URI regex without delimiter
@param int $method HTTP Request Method, accepts METHODO_* constant
@param callable $action R... | [
"Set",
"Route",
"data"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Route.php#L128-L148 | train |
SlaxWeb/Router | src/Route.php | Route.set404Route | public function set404Route(callable $action): self
{
$this->uri = "404RouteNotFound";
$this->method = self::METHOD_ANY;
$this->action = $action;
$this->is404 = true;
return $this;
} | php | public function set404Route(callable $action): self
{
$this->uri = "404RouteNotFound";
$this->method = self::METHOD_ANY;
$this->action = $action;
$this->is404 = true;
return $this;
} | [
"public",
"function",
"set404Route",
"(",
"callable",
"$",
"action",
")",
":",
"self",
"{",
"$",
"this",
"->",
"uri",
"=",
"\"404RouteNotFound\"",
";",
"$",
"this",
"->",
"method",
"=",
"self",
"::",
"METHOD_ANY",
";",
"$",
"this",
"->",
"action",
"=",
... | Set 404 Route
Sets the '404NoRouteFound' Route to its properties. This Route is used by
the Dispatcher if it can not find a matching Route for its Request.
@param callable $action Route action
@return self | [
"Set",
"404",
"Route"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Route.php#L159-L167 | train |
codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.iterate | protected function iterate($value, PropertyDefinitionInterface $definition = null)
{
if (empty($value) || !is_array($value)) {
return $value;
}
$type = $definition->getGenericType();
foreach ($value as $key => $item) {
if (is_null($item)) {
c... | php | protected function iterate($value, PropertyDefinitionInterface $definition = null)
{
if (empty($value) || !is_array($value)) {
return $value;
}
$type = $definition->getGenericType();
foreach ($value as $key => $item) {
if (is_null($item)) {
c... | [
"protected",
"function",
"iterate",
"(",
"$",
"value",
",",
"PropertyDefinitionInterface",
"$",
"definition",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
"||",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"va... | Attempte to iterate the value and cast all child items to the require generic type.
@param $value
@param PropertyDefinitionInterface $definition
@return array | [
"Attempte",
"to",
"iterate",
"the",
"value",
"and",
"cast",
"all",
"child",
"items",
"to",
"the",
"require",
"generic",
"type",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L106-L123 | train |
codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.castValue | protected function castValue($value, $type)
{
if (isset($this->scalarMap[$type])) {
$cast = $this->castToScalar($value, $this->scalarMap[$type]);
return $cast == $value ? $cast : $value;
}
if (is_null($value)) {
return null;
}
if (!is_ar... | php | protected function castValue($value, $type)
{
if (isset($this->scalarMap[$type])) {
$cast = $this->castToScalar($value, $this->scalarMap[$type]);
return $cast == $value ? $cast : $value;
}
if (is_null($value)) {
return null;
}
if (!is_ar... | [
"protected",
"function",
"castValue",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"scalarMap",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"cast",
"=",
"$",
"this",
"->",
"castToScalar",
"(",
"$",
"va... | Cast a value to the desired type non-destructively.
@param mixed $value
@param string $type
@return mixed Cast value | [
"Cast",
"a",
"value",
"to",
"the",
"desired",
"type",
"non",
"-",
"destructively",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L133-L154 | train |
codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.castToScalar | protected function castToScalar($value, $type)
{
if ($type === 'integer') {
return (integer) $value;
}
if ($type === 'boolean') {
return (boolean) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'st... | php | protected function castToScalar($value, $type)
{
if ($type === 'integer') {
return (integer) $value;
}
if ($type === 'boolean') {
return (boolean) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'st... | [
"protected",
"function",
"castToScalar",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"'integer'",
")",
"{",
"return",
"(",
"integer",
")",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"type",
"===",
"'boolean'",
")",
"{... | Cast a value to the desired scalar type. Value remains unchanged if type is not scalar.
@param mixed $value The value you went to cast
@param string $type The type you want to cast to
@return mixed | [
"Cast",
"a",
"value",
"to",
"the",
"desired",
"scalar",
"type",
".",
"Value",
"remains",
"unchanged",
"if",
"type",
"is",
"not",
"scalar",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L164-L180 | train |
TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/PluginManager.php | PluginManager.loadPlugins | public function loadPlugins($plugins)
{
foreach($plugins as $plugin) {
$pluginClass = str_replace(':','\\',$plugin);
$this->plugins[] = new $pluginClass($this->core);
}
} | php | public function loadPlugins($plugins)
{
foreach($plugins as $plugin) {
$pluginClass = str_replace(':','\\',$plugin);
$this->plugins[] = new $pluginClass($this->core);
}
} | [
"public",
"function",
"loadPlugins",
"(",
"$",
"plugins",
")",
"{",
"foreach",
"(",
"$",
"plugins",
"as",
"$",
"plugin",
")",
"{",
"$",
"pluginClass",
"=",
"str_replace",
"(",
"':'",
",",
"'\\\\'",
",",
"$",
"plugin",
")",
";",
"$",
"this",
"->",
"pl... | Load all plugins from an array
@param array $plugins The array containing the plugins to load | [
"Load",
"all",
"plugins",
"from",
"an",
"array"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/PluginManager.php#L28-L35 | train |
TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/PluginManager.php | PluginManager.invokePluginHook | public function invokePluginHook($hookName)
{
$args = func_get_args();
array_shift($args);
foreach($this->plugins as $plugin) {
if(method_exists($plugin, $hookName) === false)
continue;
call_user_func_array(array($plugin, $hookName), $args);
}
} | php | public function invokePluginHook($hookName)
{
$args = func_get_args();
array_shift($args);
foreach($this->plugins as $plugin) {
if(method_exists($plugin, $hookName) === false)
continue;
call_user_func_array(array($plugin, $hookName), $args);
}
} | [
"public",
"function",
"invokePluginHook",
"(",
"$",
"hookName",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"args",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"plugins",
"as",
"$",
"plugin",
")",
"{",
"if",
... | Invokes a specific plugin hook
@param string $hookName The name of the hook to invoke
@param mixed $parameter,... Parameters for the hook | [
"Invokes",
"a",
"specific",
"plugin",
"hook"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/PluginManager.php#L43-L54 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Model/LazyPropertiesTrait.php | LazyPropertiesTrait.load | protected function load($field)
{
if (!is_null($this->$field)
|| !$this->delegatesCollection
|| !$this->delegatesCollection->containsKey($key = strtolower($field))
) {
return $this->$field;
}
$loader = $this->delegatesCollection->get($key);
... | php | protected function load($field)
{
if (!is_null($this->$field)
|| !$this->delegatesCollection
|| !$this->delegatesCollection->containsKey($key = strtolower($field))
) {
return $this->$field;
}
$loader = $this->delegatesCollection->get($key);
... | [
"protected",
"function",
"load",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"$",
"field",
")",
"||",
"!",
"$",
"this",
"->",
"delegatesCollection",
"||",
"!",
"$",
"this",
"->",
"delegatesCollection",
"->",
"contain... | Load given field if able to, define his value and return it.
@example
public function getRelatedEntity()
{
return $this->load('relatedEntity');
}
@param string $field
@return mixed|null field value if retrieved | [
"Load",
"given",
"field",
"if",
"able",
"to",
"define",
"his",
"value",
"and",
"return",
"it",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Model/LazyPropertiesTrait.php#L50-L63 | train |
eureka-framework/component-controller | src/Controller/Controller.php | Controller.setMetas | protected function setMetas($title = null, $description = null)
{
$meta = Config::getInstance()->get('Eureka\Global\Meta');
if ($title !== null) {
$meta['title'] = strip_tags($title . ' - ' . $meta['title']);
}
if ($description !== null) {
$meta['description... | php | protected function setMetas($title = null, $description = null)
{
$meta = Config::getInstance()->get('Eureka\Global\Meta');
if ($title !== null) {
$meta['title'] = strip_tags($title . ' - ' . $meta['title']);
}
if ($description !== null) {
$meta['description... | [
"protected",
"function",
"setMetas",
"(",
"$",
"title",
"=",
"null",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"meta",
"=",
"Config",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"'Eureka\\Global\\Meta'",
")",
";",
"if",
"(",
"$",
"title... | Override meta description with given description.
@param string $description
@return $this | [
"Override",
"meta",
"description",
"with",
"given",
"description",
"."
] | 368efb6fb9eece4f7f69233e6190e1fdbb0ace2c | https://github.com/eureka-framework/component-controller/blob/368efb6fb9eece4f7f69233e6190e1fdbb0ace2c/src/Controller/Controller.php#L207-L222 | train |
stubbles/stubbles-peer | src/main/php/http/Http.php | Http.statusClassFor | public static function statusClassFor(int $statusCode): string
{
$class = substr((string) $statusCode, 0, 1);
return self::$statusClass[$class] ?? self::STATUS_CLASS_UNKNOWN;
} | php | public static function statusClassFor(int $statusCode): string
{
$class = substr((string) $statusCode, 0, 1);
return self::$statusClass[$class] ?? self::STATUS_CLASS_UNKNOWN;
} | [
"public",
"static",
"function",
"statusClassFor",
"(",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"$",
"class",
"=",
"substr",
"(",
"(",
"string",
")",
"$",
"statusCode",
",",
"0",
",",
"1",
")",
";",
"return",
"self",
"::",
"$",
"statusClass",... | returns status class for given status code
Returns null if given status code is empty.
@api
@param int $statusCode
@return string
@since 4.0.0 | [
"returns",
"status",
"class",
"for",
"given",
"status",
"code"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L191-L195 | train |
stubbles/stubbles-peer | src/main/php/http/Http.php | Http.reasonPhraseFor | public static function reasonPhraseFor(int $statusCode): string
{
if (isset(self::$reasonPhrases[$statusCode])) {
return self::$reasonPhrases[$statusCode];
}
throw new \InvalidArgumentException(
'Invalid or unknown HTTP status code ' . $statusCode
);
... | php | public static function reasonPhraseFor(int $statusCode): string
{
if (isset(self::$reasonPhrases[$statusCode])) {
return self::$reasonPhrases[$statusCode];
}
throw new \InvalidArgumentException(
'Invalid or unknown HTTP status code ' . $statusCode
);
... | [
"public",
"static",
"function",
"reasonPhraseFor",
"(",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"reasonPhrases",
"[",
"$",
"statusCode",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"reasonPhrase... | returns reason phrase for given status code
@api
@param int $statusCode
@return string
@throws \InvalidArgumentException
@since 4.0.0 | [
"returns",
"reason",
"phrase",
"for",
"given",
"status",
"code"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L218-L227 | train |
stubbles/stubbles-peer | src/main/php/http/Http.php | Http.lines | public static function lines(string ...$lines): string
{
$head = true;
return join(
'',
array_map(
function($line) use (&$head)
{
if (empty($line) && $head) {
$... | php | public static function lines(string ...$lines): string
{
$head = true;
return join(
'',
array_map(
function($line) use (&$head)
{
if (empty($line) && $head) {
$... | [
"public",
"static",
"function",
"lines",
"(",
"string",
"...",
"$",
"lines",
")",
":",
"string",
"{",
"$",
"head",
"=",
"true",
";",
"return",
"join",
"(",
"''",
",",
"array_map",
"(",
"function",
"(",
"$",
"line",
")",
"use",
"(",
"&",
"$",
"head"... | creates valid http lines from given input lines
If the array contains an empty line all lines after this empty line are
considered to belong to the body and will be returned as they are.
@param string[] $lines
@return string
@since 4.0.0 | [
"creates",
"valid",
"http",
"lines",
"from",
"given",
"input",
"lines"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L250-L272 | train |
stubbles/stubbles-peer | src/main/php/http/Http.php | Http.isValidRfc | public static function isValidRfc(string $rfc): bool
{
return in_array($rfc, [self::RFC_2616, self::RFC_7230]);
} | php | public static function isValidRfc(string $rfc): bool
{
return in_array($rfc, [self::RFC_2616, self::RFC_7230]);
} | [
"public",
"static",
"function",
"isValidRfc",
"(",
"string",
"$",
"rfc",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"$",
"rfc",
",",
"[",
"self",
"::",
"RFC_2616",
",",
"self",
"::",
"RFC_7230",
"]",
")",
";",
"}"
] | checks if given RFC is a valid and known RFC
@param string $rfc
@return bool | [
"checks",
"if",
"given",
"RFC",
"is",
"a",
"valid",
"and",
"known",
"RFC"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L290-L293 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.toModel | public function toModel()
{
$nodeClass = $this->getElement()->NodeClass;
if ($nodeClass === 'Node') {
throw new LogicException('You must set a custom node in <node_class/> for element: ' . $this->getElement()->getSlug());
} else {
throw new LogicException('You must cr... | php | public function toModel()
{
$nodeClass = $this->getElement()->NodeClass;
if ($nodeClass === 'Node') {
throw new LogicException('You must set a custom node in <node_class/> for element: ' . $this->getElement()->getSlug());
} else {
throw new LogicException('You must cr... | [
"public",
"function",
"toModel",
"(",
")",
"{",
"$",
"nodeClass",
"=",
"$",
"this",
"->",
"getElement",
"(",
")",
"->",
"NodeClass",
";",
"if",
"(",
"$",
"nodeClass",
"===",
"'Node'",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'You must set a custom... | You must implement a toModel method in a subclass of Node, defined in
a plugin.xml or system.xml in order to have toModel functionality.
@return mixed
@throws LogicException | [
"You",
"must",
"implement",
"a",
"toModel",
"method",
"in",
"a",
"subclass",
"of",
"Node",
"defined",
"in",
"a",
"plugin",
".",
"xml",
"or",
"system",
".",
"xml",
"in",
"order",
"to",
"have",
"toModel",
"functionality",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L71-L79 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.setNodeRef | public function setNodeRef($newNodeRef)
{
$this->fields['NodeRef'] = $newNodeRef;
$this->fields['Slug'] = $newNodeRef->isFullyQualified()?$newNodeRef->getSlug():'';
} | php | public function setNodeRef($newNodeRef)
{
$this->fields['NodeRef'] = $newNodeRef;
$this->fields['Slug'] = $newNodeRef->isFullyQualified()?$newNodeRef->getSlug():'';
} | [
"public",
"function",
"setNodeRef",
"(",
"$",
"newNodeRef",
")",
"{",
"$",
"this",
"->",
"fields",
"[",
"'NodeRef'",
"]",
"=",
"$",
"newNodeRef",
";",
"$",
"this",
"->",
"fields",
"[",
"'Slug'",
"]",
"=",
"$",
"newNodeRef",
"->",
"isFullyQualified",
"(",... | Changes our NodeRef
@param NodeRef $newNodeRef | [
"Changes",
"our",
"NodeRef"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L96-L100 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.setSlug | public function setSlug($slug)
{
if(empty($this->fields['Slug']) || empty($this->fields['OriginalSlug']))
{
$this->fields['NodeRef'] = new NodeRef($this->getNodeRef()->getElement(), $slug);
}
$this->fields['Slug'] = $slug;
} | php | public function setSlug($slug)
{
if(empty($this->fields['Slug']) || empty($this->fields['OriginalSlug']))
{
$this->fields['NodeRef'] = new NodeRef($this->getNodeRef()->getElement(), $slug);
}
$this->fields['Slug'] = $slug;
} | [
"public",
"function",
"setSlug",
"(",
"$",
"slug",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"fields",
"[",
"'Slug'",
"]",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"fields",
"[",
"'OriginalSlug'",
"]",
")",
")",
"{",
"$",
"this",
"... | Sets the Slug
@param string $slug A valid
@return void | [
"Sets",
"the",
"Slug"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L177-L185 | train |
wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.getNodePartials | public function getNodePartials()
{
if(!array_key_exists('NodePartials', $this->fields) || is_null($this->fields['NodePartials']))
$this->fields['NodePartials'] = new NodePartials();
return $this->fields['NodePartials'];
} | php | public function getNodePartials()
{
if(!array_key_exists('NodePartials', $this->fields) || is_null($this->fields['NodePartials']))
$this->fields['NodePartials'] = new NodePartials();
return $this->fields['NodePartials'];
} | [
"public",
"function",
"getNodePartials",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'NodePartials'",
",",
"$",
"this",
"->",
"fields",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"fields",
"[",
"'NodePartials'",
"]",
")",
")",
"$",
"this"... | Returns a reference to the partials for this node.
@return NodePartials | [
"Returns",
"a",
"reference",
"to",
"the",
"partials",
"for",
"this",
"node",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L555-L561 | train |
jenskooij/cloudcontrol | src/cc/application/UrlMatcher.php | UrlMatcher.redirectMatching | public function redirectMatching(Request $request)
{
$redirects = $this->storage->getRedirects()->getRedirects();
$relativeUri = '/' . $request::$relativeUri;
foreach ($redirects as $redirect) {
if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
$t... | php | public function redirectMatching(Request $request)
{
$redirects = $this->storage->getRedirects()->getRedirects();
$relativeUri = '/' . $request::$relativeUri;
foreach ($redirects as $redirect) {
if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
$t... | [
"public",
"function",
"redirectMatching",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"redirects",
"=",
"$",
"this",
"->",
"storage",
"->",
"getRedirects",
"(",
")",
"->",
"getRedirects",
"(",
")",
";",
"$",
"relativeUri",
"=",
"'/'",
".",
"$",
"reque... | Loop through the redirects and see if a redirect needs to take place
@param Request $request
@throws \Exception | [
"Loop",
"through",
"the",
"redirects",
"and",
"see",
"if",
"a",
"redirect",
"needs",
"to",
"take",
"place"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/UrlMatcher.php#L36-L59 | train |
jenskooij/cloudcontrol | src/cc/application/UrlMatcher.php | UrlMatcher.sitemapMatching | public function sitemapMatching($request)
{
$sitemap = $this->storage->getSitemap()->getSitemap();
$relativeUri = '/' . $request::$relativeUri;
foreach ($sitemap as $sitemapItem) {
if ($sitemapItem->regex) {
$matches = array();
if (preg_match_all(... | php | public function sitemapMatching($request)
{
$sitemap = $this->storage->getSitemap()->getSitemap();
$relativeUri = '/' . $request::$relativeUri;
foreach ($sitemap as $sitemapItem) {
if ($sitemapItem->regex) {
$matches = array();
if (preg_match_all(... | [
"public",
"function",
"sitemapMatching",
"(",
"$",
"request",
")",
"{",
"$",
"sitemap",
"=",
"$",
"this",
"->",
"storage",
"->",
"getSitemap",
"(",
")",
"->",
"getSitemap",
"(",
")",
";",
"$",
"relativeUri",
"=",
"'/'",
".",
"$",
"request",
"::",
"$",
... | Loop through sitemap items and see if one matches the requestUri.
If it does, add it tot the matchedSitemapItems array
@param Request $request | [
"Loop",
"through",
"sitemap",
"items",
"and",
"see",
"if",
"one",
"matches",
"the",
"requestUri",
".",
"If",
"it",
"does",
"add",
"it",
"tot",
"the",
"matchedSitemapItems",
"array"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/UrlMatcher.php#L67-L89 | train |
SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.connect | public function connect($host, $port, $secure = true)
{
$this->socket->setBlocking(false);
if (!$this->socket->connect($host, $port, $secure)) {
throw new Exception\ConnectionFailedException(
sprintf(
'%s failed to %s:%d with error %s (%d).',
... | php | public function connect($host, $port, $secure = true)
{
$this->socket->setBlocking(false);
if (!$this->socket->connect($host, $port, $secure)) {
throw new Exception\ConnectionFailedException(
sprintf(
'%s failed to %s:%d with error %s (%d).',
... | [
"public",
"function",
"connect",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"secure",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"socket",
"->",
"setBlocking",
"(",
"false",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"socket",
"->",
"connect",
... | Set up a connection to the server.
@param string $host
@param integer $port
@param boolean $secure
@return void | [
"Set",
"up",
"a",
"connection",
"to",
"the",
"server",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L69-L85 | train |
SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.read | protected function read()
{
$data = '';
// TODO Invesigate if a time out is required
do {
if ($this->socket->closed()) {
throw new Exception\ConnectionDroppedException('The connection has been dropped.');
}
$data .= $this->socket->read();... | php | protected function read()
{
$data = '';
// TODO Invesigate if a time out is required
do {
if ($this->socket->closed()) {
throw new Exception\ConnectionDroppedException('The connection has been dropped.');
}
$data .= $this->socket->read();... | [
"protected",
"function",
"read",
"(",
")",
"{",
"$",
"data",
"=",
"''",
";",
"// TODO Invesigate if a time out is required",
"do",
"{",
"if",
"(",
"$",
"this",
"->",
"socket",
"->",
"closed",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"Connecti... | Retrieve a response from the server.
@return string
@throws ConnectionDroppedException
@todo Always UTF8 decode? | [
"Retrieve",
"a",
"response",
"from",
"the",
"server",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L106-L120 | train |
SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.getResponse | public function getResponse(RequestInterface $request)
{
$this->write($request->getPacket());
return $request->getResponse()->init($this->read());
} | php | public function getResponse(RequestInterface $request)
{
$this->write($request->getPacket());
return $request->getResponse()->init($this->read());
} | [
"public",
"function",
"getResponse",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"$",
"request",
"->",
"getPacket",
"(",
")",
")",
";",
"return",
"$",
"request",
"->",
"getResponse",
"(",
")",
"->",
"init",
"(",
... | Send a request to the server and construct an appropriate response.
@param RequestInterface $request
@return ResponseInterface | [
"Send",
"a",
"request",
"to",
"the",
"server",
"and",
"construct",
"an",
"appropriate",
"response",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L129-L134 | train |
congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.setTransactionMethod | public function setTransactionMethod($method)
{
// check if is array
if (!is_array($this->transactionMethods)) {
$this->transactionMethods = [$method];
return $this;
}
// check if method is already in array
if (!in_array($method, $this->transactionMe... | php | public function setTransactionMethod($method)
{
// check if is array
if (!is_array($this->transactionMethods)) {
$this->transactionMethods = [$method];
return $this;
}
// check if method is already in array
if (!in_array($method, $this->transactionMe... | [
"public",
"function",
"setTransactionMethod",
"(",
"$",
"method",
")",
"{",
"// check if is array",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"transactionMethods",
")",
")",
"{",
"$",
"this",
"->",
"transactionMethods",
"=",
"[",
"$",
"method",
"]"... | Set transaction method.
@param string $method - method name
@return $this | [
"Set",
"transaction",
"method",
"."
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L133-L148 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.