repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
libreworks/caridea-acl | src/Rule.php | Rule.deny | public static function deny(Subject $subject, array $verbs = null): Rule
{
return new self($subject, false, $verbs);
} | php | public static function deny(Subject $subject, array $verbs = null): Rule
{
return new self($subject, false, $verbs);
} | [
"public",
"static",
"function",
"deny",
"(",
"Subject",
"$",
"subject",
",",
"array",
"$",
"verbs",
"=",
"null",
")",
":",
"Rule",
"{",
"return",
"new",
"self",
"(",
"$",
"subject",
",",
"false",
",",
"$",
"verbs",
")",
";",
"}"
] | Creates an denying Rule.
@param \Caridea\Acl\Subject $subject The subject to allow access
@param array<string>|null $verbs Optional list of denied verbs.
Empty or `null` means *all*.
@return Rule The denying Rule | [
"Creates",
"an",
"denying",
"Rule",
"."
] | train | https://github.com/libreworks/caridea-acl/blob/64ff8f2e29926acc67b9fc4a8a9ea7bcc50e4916/src/Rule.php#L103-L106 |
goulaheau/symfony-rest-bundle | Core/RestSerializer.php | RestSerializer.denormalize | public function denormalize($data, $entityClass, $factory = null, $toEntity = null)
{
$context = $this->getDenormalizeContext($this->denormalizeContext, $toEntity);
if ($factory) {
$entityClass = $entityClass::$factory($data);
}
$entity = $this->serializer->denormalize(... | php | public function denormalize($data, $entityClass, $factory = null, $toEntity = null)
{
$context = $this->getDenormalizeContext($this->denormalizeContext, $toEntity);
if ($factory) {
$entityClass = $entityClass::$factory($data);
}
$entity = $this->serializer->denormalize(... | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"entityClass",
",",
"$",
"factory",
"=",
"null",
",",
"$",
"toEntity",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getDenormalizeContext",
"(",
"$",
"this",
"->",
"den... | @param mixed $data
@param string $entityClass
@param callable | null $factory
@param null $toEntity
@return object | [
"@param",
"mixed",
"$data",
"@param",
"string",
"$entityClass",
"@param",
"callable",
"|",
"null",
"$factory",
"@param",
"null",
"$toEntity"
] | train | https://github.com/goulaheau/symfony-rest-bundle/blob/688a120540f144aa1033a72b75803fae34ba3953/Core/RestSerializer.php#L36-L50 |
goulaheau/symfony-rest-bundle | Core/RestSerializer.php | RestSerializer.normalize | public function normalize($data, $attributes = null, $groups = null, $entityMethods = null)
{
$context = $this->getNormalizeContext($this->normalizeContext, $attributes, $groups);
$dataNormalized = $this->serializer->normalize($data, null, $context);
if ($entityMethods && count($entityMeth... | php | public function normalize($data, $attributes = null, $groups = null, $entityMethods = null)
{
$context = $this->getNormalizeContext($this->normalizeContext, $attributes, $groups);
$dataNormalized = $this->serializer->normalize($data, null, $context);
if ($entityMethods && count($entityMeth... | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"$",
"attributes",
"=",
"null",
",",
"$",
"groups",
"=",
"null",
",",
"$",
"entityMethods",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getNormalizeContext",
"(",
"$",
"this"... | @param mixed $data
@param array $groups
@param array $attributes
@param Method[] $entityMethods
@return array|bool|float|int|mixed|string | [
"@param",
"mixed",
"$data",
"@param",
"array",
"$groups",
"@param",
"array",
"$attributes",
"@param",
"Method",
"[]",
"$entityMethods"
] | train | https://github.com/goulaheau/symfony-rest-bundle/blob/688a120540f144aa1033a72b75803fae34ba3953/Core/RestSerializer.php#L60-L71 |
goulaheau/symfony-rest-bundle | Core/RestSerializer.php | RestSerializer.mergeEntityMethods | protected function mergeEntityMethods($entity, $entityNormalized, $entityMethods, $key = '_entityMethods')
{
if (!is_array($entityNormalized)) {
return $entityNormalized;
}
foreach ($entityMethods as $entityMethod) {
$methodEntity = $entity;
$name = $enti... | php | protected function mergeEntityMethods($entity, $entityNormalized, $entityMethods, $key = '_entityMethods')
{
if (!is_array($entityNormalized)) {
return $entityNormalized;
}
foreach ($entityMethods as $entityMethod) {
$methodEntity = $entity;
$name = $enti... | [
"protected",
"function",
"mergeEntityMethods",
"(",
"$",
"entity",
",",
"$",
"entityNormalized",
",",
"$",
"entityMethods",
",",
"$",
"key",
"=",
"'_entityMethods'",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"entityNormalized",
")",
")",
"{",
"return",... | @param $entity
@param $entityNormalized
@param Method[] $entityMethods
@return array | [
"@param",
"$entity",
"@param",
"$entityNormalized",
"@param",
"Method",
"[]",
"$entityMethods"
] | train | https://github.com/goulaheau/symfony-rest-bundle/blob/688a120540f144aa1033a72b75803fae34ba3953/Core/RestSerializer.php#L97-L161 |
gplcart/cli | controllers/commands/Page.php | Page.cmdGetPage | public function cmdGetPage()
{
$result = $this->getListPage();
$this->outputFormat($result);
$this->outputFormatTablePage($result);
$this->output();
} | php | public function cmdGetPage()
{
$result = $this->getListPage();
$this->outputFormat($result);
$this->outputFormatTablePage($result);
$this->output();
} | [
"public",
"function",
"cmdGetPage",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListPage",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTablePage",
"(",
"$",
"result",
")"... | Callback for "page-get" command | [
"Callback",
"for",
"page",
"-",
"get",
"command"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L40-L46 |
gplcart/cli | controllers/commands/Page.php | Page.cmdDeletePage | public function cmdDeletePage()
{
$id = $this->getParam(0);
$all = $this->getParam('all');
$blog = $this->getParam('blog');
if (empty($id) && empty($all) && empty($blog)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (isset($id) && (empty($... | php | public function cmdDeletePage()
{
$id = $this->getParam(0);
$all = $this->getParam('all');
$blog = $this->getParam('blog');
if (empty($id) && empty($all) && empty($blog)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (isset($id) && (empty($... | [
"public",
"function",
"cmdDeletePage",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"all",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'all'",
")",
";",
"$",
"blog",
"=",
"$",
"this",
"->",
"getParam",
"(",... | Callback for "page-delete" command | [
"Callback",
"for",
"page",
"-",
"delete",
"command"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L51-L102 |
gplcart/cli | controllers/commands/Page.php | Page.cmdUpdatePage | public function cmdUpdatePage()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdatePage()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdatePage",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"$",... | Callback for "page-update" command | [
"Callback",
"for",
"page",
"-",
"update",
"command"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L121-L139 |
gplcart/cli | controllers/commands/Page.php | Page.getListPage | protected function getListPage()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->page->getList(array('limit' => $this->getLimit()));
}
if (!is_numeric($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
if ($this->ge... | php | protected function getListPage()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->page->getList(array('limit' => $this->getLimit()));
}
if (!is_numeric($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
if ($this->ge... | [
"protected",
"function",
"getListPage",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"page",
"->",
"getList",
"(",
"array",
... | Returns an array of pages
@return array | [
"Returns",
"an",
"array",
"of",
"pages"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L145-L176 |
gplcart/cli | controllers/commands/Page.php | Page.addPage | protected function addPage()
{
if (!$this->isError()) {
$id = $this->page->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addPage()
{
if (!$this->isError()) {
$id = $this->page->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addPage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"page",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
"if",
"(",
... | Add a new page | [
"Add",
"a",
"new",
"page"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L212-L221 |
gplcart/cli | controllers/commands/Page.php | Page.updatePage | protected function updatePage($page_id)
{
if (!$this->isError() && !$this->page->update($page_id, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | php | protected function updatePage($page_id)
{
if (!$this->isError() && !$this->page->update($page_id, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | [
"protected",
"function",
"updatePage",
"(",
"$",
"page_id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"page",
"->",
"update",
"(",
"$",
"page_id",
",",
"$",
"this",
"->",
"getSubmitted",
"(",
")... | Updates a page
@param string $page_id | [
"Updates",
"a",
"page"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L227-L232 |
gplcart/cli | controllers/commands/Page.php | Page.submitAddPage | protected function submitAddPage()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('page');
$this->addPage();
} | php | protected function submitAddPage()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('page');
$this->addPage();
} | [
"protected",
"function",
"submitAddPage",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'page'",
")",
";",
"$",
"this",
"->",
"addPag... | Add a new page at once | [
"Add",
"a",
"new",
"page",
"at",
"once"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L237-L242 |
gplcart/cli | controllers/commands/Page.php | Page.wizardAddPage | protected function wizardAddPage()
{
// Required
$this->validatePrompt('title', $this->text('Title'), 'page');
$this->validatePrompt('description', $this->text('Description'), 'page');
$this->validatePrompt('store_id', $this->text('Store ID'), 'page');
// Optional
$t... | php | protected function wizardAddPage()
{
// Required
$this->validatePrompt('title', $this->text('Title'), 'page');
$this->validatePrompt('description', $this->text('Description'), 'page');
$this->validatePrompt('store_id', $this->text('Store ID'), 'page');
// Optional
$t... | [
"protected",
"function",
"wizardAddPage",
"(",
")",
"{",
"// Required",
"$",
"this",
"->",
"validatePrompt",
"(",
"'title'",
",",
"$",
"this",
"->",
"text",
"(",
"'Title'",
")",
",",
"'page'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'descripti... | Add a new page step by step | [
"Add",
"a",
"new",
"page",
"step",
"by",
"step"
] | train | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Page.php#L247-L264 |
peterfox/behat-resources-extension | src/ResourceExtension.php | ResourceExtension.configure | public function configure(ArrayNodeDefinition $builder)
{
$paths = $builder->children()->arrayNode('path')->children();
foreach (array('resources', 'base') as $namespaceType) {
$paths->scalarNode($namespaceType);
}
$builder->children()->variableNode('resource_map');
... | php | public function configure(ArrayNodeDefinition $builder)
{
$paths = $builder->children()->arrayNode('path')->children();
foreach (array('resources', 'base') as $namespaceType) {
$paths->scalarNode($namespaceType);
}
$builder->children()->variableNode('resource_map');
... | [
"public",
"function",
"configure",
"(",
"ArrayNodeDefinition",
"$",
"builder",
")",
"{",
"$",
"paths",
"=",
"$",
"builder",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'path'",
")",
"->",
"children",
"(",
")",
";",
"foreach",
"(",
"array",
"(",
... | Setups configuration for the extension.
@param ArrayNodeDefinition $builder | [
"Setups",
"configuration",
"for",
"the",
"extension",
"."
] | train | https://github.com/peterfox/behat-resources-extension/blob/85fc1c306867a1f141050b43651290245d81b51c/src/ResourceExtension.php#L55-L63 |
peterfox/behat-resources-extension | src/ResourceExtension.php | ResourceExtension.load | public function load(ContainerBuilder $container, array $config)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/config'));
$loader->load('services.xml');
if (!empty($config['path'])) {
if (isset($config['path']['resources'])) {
$container->se... | php | public function load(ContainerBuilder $container, array $config)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/config'));
$loader->load('services.xml');
if (!empty($config['path'])) {
if (isset($config['path']['resources'])) {
$container->se... | [
"public",
"function",
"load",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/config'",
")",
")",
";",
... | Loads extension services into temporary container.
@param ContainerBuilder $container
@param array $config | [
"Loads",
"extension",
"services",
"into",
"temporary",
"container",
"."
] | train | https://github.com/peterfox/behat-resources-extension/blob/85fc1c306867a1f141050b43651290245d81b51c/src/ResourceExtension.php#L71-L89 |
eclipxe13/engineworks-progress-status | src/EngineWorks/ProgressStatus/Status.php | Status.make | public static function make($total = 0, $message = '', $value = 0, $startTime = null, $current = null)
{
$now = time();
return new self($current ? : $now, $startTime ? : $now, $value, $total, $message);
} | php | public static function make($total = 0, $message = '', $value = 0, $startTime = null, $current = null)
{
$now = time();
return new self($current ? : $now, $startTime ? : $now, $value, $total, $message);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"total",
"=",
"0",
",",
"$",
"message",
"=",
"''",
",",
"$",
"value",
"=",
"0",
",",
"$",
"startTime",
"=",
"null",
",",
"$",
"current",
"=",
"null",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",... | Helper function to create a new object
@param int $total
@param string $message
@param int $value
@param int|null $startTime if null then uses the value of time()
@param int|null $current if null then uses the value of time()
@return Status | [
"Helper",
"function",
"to",
"create",
"a",
"new",
"object"
] | train | https://github.com/eclipxe13/engineworks-progress-status/blob/2eda8e17ba10ff93ca206ffa8039c38acac17bcd/src/EngineWorks/ProgressStatus/Status.php#L49-L53 |
Wedeto/Auth | src/ACL/ACL.php | ACL.registerClass | public function registerClass(string $class, string $name)
{
if (isset($this->classes[$name]))
throw new Exception("Cannot register the same name twice");
if (!is_a($class, ACLModel::class, true))
throw new TypeError("Class must be subclass of ACLModel");
$this->... | php | public function registerClass(string $class, string $name)
{
if (isset($this->classes[$name]))
throw new Exception("Cannot register the same name twice");
if (!is_a($class, ACLModel::class, true))
throw new TypeError("Class must be subclass of ACLModel");
$this->... | [
"public",
"function",
"registerClass",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"classes",
"[",
"$",
"name",
"]",
")",
")",
"throw",
"new",
"Exception",
"(",
"\"Cannot register the sam... | Register the name of the object class to be used in ACL entity naming.
@param string $class The name of the class
@param string $name The name of the ACL objects
@return $this Provides fluent interface | [
"Register",
"the",
"name",
"of",
"the",
"object",
"class",
"to",
"be",
"used",
"in",
"ACL",
"entity",
"naming",
"."
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L92-L102 |
Wedeto/Auth | src/ACL/ACL.php | ACL.loadByACLID | public function loadByACLID($id)
{
$parts = explode("#", $id);
if (count($parts) !== 2)
throw new Exception("Invalid DAO ID: {$id}");
if (!isset($this->classes[$parts[0]]))
throw new Exception("Invalid DAO type: {$parts[0]}");
$classname = $this->cla... | php | public function loadByACLID($id)
{
$parts = explode("#", $id);
if (count($parts) !== 2)
throw new Exception("Invalid DAO ID: {$id}");
if (!isset($this->classes[$parts[0]]))
throw new Exception("Invalid DAO type: {$parts[0]}");
$classname = $this->cla... | [
"public",
"function",
"loadByACLID",
"(",
"$",
"id",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\"#\"",
",",
"$",
"id",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"!==",
"2",
")",
"throw",
"new",
"Exception",
"(",
"\"Invalid DAO ID: {$i... | This method will load a new instance to be used in ACL inheritance | [
"This",
"method",
"will",
"load",
"a",
"new",
"instance",
"to",
"be",
"used",
"in",
"ACL",
"inheritance"
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L165-L181 |
Wedeto/Auth | src/ACL/ACL.php | ACL.getInstance | public function getInstance(string $class, $element_id)
{
if (!is_a($class, Hierarchy::class, true))
throw new TypeError("Not a subclass of Hierarchy: $class");
if (is_object($element_id) && get_class($element_id) === $class)
return $element_id;
if (!is_scalar($elem... | php | public function getInstance(string $class, $element_id)
{
if (!is_a($class, Hierarchy::class, true))
throw new TypeError("Not a subclass of Hierarchy: $class");
if (is_object($element_id) && get_class($element_id) === $class)
return $element_id;
if (!is_scalar($elem... | [
"public",
"function",
"getInstance",
"(",
"string",
"$",
"class",
",",
"$",
"element_id",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"class",
",",
"Hierarchy",
"::",
"class",
",",
"true",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"Not a subclass of ... | Get an hierarchy element by specifying its ID | [
"Get",
"an",
"hierarchy",
"element",
"by",
"specifying",
"its",
"ID"
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L186-L207 |
Wedeto/Auth | src/ACL/ACL.php | ACL.getRoot | public function getRoot(string $class)
{
if (!is_a($class, Hierarchy::class, true))
throw new TypeError("Not a subclass of Hierarchy: $class");
$root = $class::getRootName();
return $this->getInstance($class, $root);
} | php | public function getRoot(string $class)
{
if (!is_a($class, Hierarchy::class, true))
throw new TypeError("Not a subclass of Hierarchy: $class");
$root = $class::getRootName();
return $this->getInstance($class, $root);
} | [
"public",
"function",
"getRoot",
"(",
"string",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"class",
",",
"Hierarchy",
"::",
"class",
",",
"true",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"Not a subclass of Hierarchy: $class\"",
")",
";"... | Return the root element for a certain hierarchy
@param string $class The class name
@return Hierarchy The root element of the hierarchy
@throws Wedeto\Auth\ACL\Exception When an invalid class is passed | [
"Return",
"the",
"root",
"element",
"for",
"a",
"certain",
"hierarchy"
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L216-L223 |
Wedeto/Auth | src/ACL/ACL.php | ACL.createEntity | public function createEntity(string $entity_id, array $parents)
{
$entity = new Entity($this, $entity_id, $parents);
return $entity;
} | php | public function createEntity(string $entity_id, array $parents)
{
$entity = new Entity($this, $entity_id, $parents);
return $entity;
} | [
"public",
"function",
"createEntity",
"(",
"string",
"$",
"entity_id",
",",
"array",
"$",
"parents",
")",
"{",
"$",
"entity",
"=",
"new",
"Entity",
"(",
"$",
"this",
",",
"$",
"entity_id",
",",
"$",
"parents",
")",
";",
"return",
"$",
"entity",
";",
... | Create a new entity and store it.
@param string $entity_id The ID of the entity
@param array $parents The parents of the entity
@throws Exception When the entity_id has already been created for this class | [
"Create",
"a",
"new",
"entity",
"and",
"store",
"it",
"."
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L231-L235 |
Wedeto/Auth | src/ACL/ACL.php | ACL.setInstance | public function setInstance(Hierarchy $element)
{
$class = get_class($element);
$this->hierarchy[$class][$element->getID()] = $element;
return $this;
} | php | public function setInstance(Hierarchy $element)
{
$class = get_class($element);
$this->hierarchy[$class][$element->getID()] = $element;
return $this;
} | [
"public",
"function",
"setInstance",
"(",
"Hierarchy",
"$",
"element",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"element",
")",
";",
"$",
"this",
"->",
"hierarchy",
"[",
"$",
"class",
"]",
"[",
"$",
"element",
"->",
"getID",
"(",
")",
"]",... | Set the instance of a specific ID.
@param scalar $id The ID to set the instance for
@return $this Provides fluent interface | [
"Set",
"the",
"instance",
"of",
"a",
"specific",
"ID",
"."
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/ACL.php#L273-L278 |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Template/Loader.php | Loader.load | public function load($file, array $data = array())
{
$this->queries = array();
$this->data = $data;
include $file;
return $this;
} | php | public function load($file, array $data = array())
{
$this->queries = array();
$this->data = $data;
include $file;
return $this;
} | [
"public",
"function",
"load",
"(",
"$",
"file",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"queries",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"include",
"$",
"file",
";... | Load script file
@param $file
@return $this | [
"Load",
"script",
"file"
] | train | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Template/Loader.php#L49-L57 |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Template/Loader.php | Loader.override | public function override($query)
{
foreach ($this->data as $key => $value) {
$query = str_replace(
sprintf('{%s}', $key),
$value,
$query
);
}
return $query;
} | php | public function override($query)
{
foreach ($this->data as $key => $value) {
$query = str_replace(
sprintf('{%s}', $key),
$value,
$query
);
}
return $query;
} | [
"public",
"function",
"override",
"(",
"$",
"query",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"query",
"=",
"str_replace",
"(",
"sprintf",
"(",
"'{%s}'",
",",
"$",
"key",
")",
",",
... | Replace some parameters with value
parameter looks like {key}
@param $query
@return string | [
"Replace",
"some",
"parameters",
"with",
"value",
"parameter",
"looks",
"like",
"{",
"key",
"}"
] | train | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Template/Loader.php#L65-L76 |
beMang/phpgone | core/Core/BackController.php | BackController.execute | public function execute()
{
if (method_exists($this, 'setUp')) {
call_user_func_array([$this, 'setUp'], [$this->request]);
}
call_user_func_array([$this, $this->action], [$this->request]);
} | php | public function execute()
{
if (method_exists($this, 'setUp')) {
call_user_func_array([$this, 'setUp'], [$this->request]);
}
call_user_func_array([$this, $this->action], [$this->request]);
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'setUp'",
")",
")",
"{",
"call_user_func_array",
"(",
"[",
"$",
"this",
",",
"'setUp'",
"]",
",",
"[",
"$",
"this",
"->",
"request",
"]",
")",
";",
... | Execute la bonne fonction enfante en fonction de l'action
@return void | [
"Execute",
"la",
"bonne",
"fonction",
"enfante",
"en",
"fonction",
"de",
"l",
"action"
] | train | https://github.com/beMang/phpgone/blob/6da468283880b7f5b28dc3735f8f13c97382710b/core/Core/BackController.php#L34-L40 |
devlabmtl/haven-cms | Controller/WizardController.php | WizardController.getWizard | private function getWizard() {
$wizId = $this->container->get("request")->get('wizard_id');
$stId = $this->container->get("request")->get('step_id');
// echo "<p>-->" . print_r("<p>" . $wizId, 1) . "<--</p>";
// echo "<p>-->" . print_r("<p>" . $stId, 1) . "<--</p>";
$wizard = $this... | php | private function getWizard() {
$wizId = $this->container->get("request")->get('wizard_id');
$stId = $this->container->get("request")->get('step_id');
// echo "<p>-->" . print_r("<p>" . $wizId, 1) . "<--</p>";
// echo "<p>-->" . print_r("<p>" . $stId, 1) . "<--</p>";
$wizard = $this... | [
"private",
"function",
"getWizard",
"(",
")",
"{",
"$",
"wizId",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"\"request\"",
")",
"->",
"get",
"(",
"'wizard_id'",
")",
";",
"$",
"stId",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",... | } | [
"}"
] | train | https://github.com/devlabmtl/haven-cms/blob/c20761a07c201a966dbda1f3eae33617f80e1ece/Controller/WizardController.php#L76-L84 |
devlabmtl/haven-cms | Controller/WizardController.php | WizardController.wizardAction | public function wizardAction($wizard_id, $step_id) {
/**
* get request
* validate request
* not valide getView for error
* valide
* handle request and get aggregate
* choose view to display
*
*/
// should I use a manager (pageM... | php | public function wizardAction($wizard_id, $step_id) {
/**
* get request
* validate request
* not valide getView for error
* valide
* handle request and get aggregate
* choose view to display
*
*/
// should I use a manager (pageM... | [
"public",
"function",
"wizardAction",
"(",
"$",
"wizard_id",
",",
"$",
"step_id",
")",
"{",
"/**\n * get request\n * validate request\n * not valide getView for error\n * valide \n * handle request and get aggregate\n * choose view to display\... | @Route("/")
@Method({"GET"})
@param type $wizard_id
@param type $step_id | [
"@Route",
"(",
"/",
")",
"@Method",
"(",
"{",
"GET",
"}",
")"
] | train | https://github.com/devlabmtl/haven-cms/blob/c20761a07c201a966dbda1f3eae33617f80e1ece/Controller/WizardController.php#L94-L114 |
cmsgears/module-community | admin/controllers/group/CategoryController.php | CategoryController.init | public function init() {
parent::init();
// Permission
$this->crudPermission = CmnGlobal::PERM_GROUP_ADMIN;
// Config
$this->title = 'Group';
$this->type = CmnGlobal::TYPE_GROUP;
$this->templateType = CmnGlobal::TYPE_GROUP;
$this->apixBase = 'community/group/category';
$this->parentPath = '/com... | php | public function init() {
parent::init();
// Permission
$this->crudPermission = CmnGlobal::PERM_GROUP_ADMIN;
// Config
$this->title = 'Group';
$this->type = CmnGlobal::TYPE_GROUP;
$this->templateType = CmnGlobal::TYPE_GROUP;
$this->apixBase = 'community/group/category';
$this->parentPath = '/com... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"// Permission",
"$",
"this",
"->",
"crudPermission",
"=",
"CmnGlobal",
"::",
"PERM_GROUP_ADMIN",
";",
"// Config",
"$",
"this",
"->",
"title",
"=",
"'Group'",
";",
"$",
... | Constructor and Initialisation ------------------------------ | [
"Constructor",
"and",
"Initialisation",
"------------------------------"
] | train | https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/admin/controllers/group/CategoryController.php#L38-L73 |
stubbles/stubbles-webapp-session | src/main/php/storage/ArraySessionStorage.php | ArraySessionStorage.value | public function value($key)
{
if (isset($this->data[$key])) {
return $this->data[$key];
}
return null;
} | php | public function value($key)
{
if (isset($this->data[$key])) {
return $this->data[$key];
}
return null;
} | [
"public",
"function",
"value",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"null",
";",
"}"... | returns a value associated with the key or the default value
@param string $key key where value is stored under
@return mixed | [
"returns",
"a",
"value",
"associated",
"with",
"the",
"key",
"or",
"the",
"default",
"value"
] | train | https://github.com/stubbles/stubbles-webapp-session/blob/2976fa28995bfb6ad00e3eac59ad689dd7892450/src/main/php/storage/ArraySessionStorage.php#L62-L69 |
Rudloff/php-dicollecte-lexicon | classes/Lexicon.php | Lexicon.getBy | private function getBy($search, $column)
{
$search = mb_strtolower($search, mb_detect_encoding($search));
$this->procBuilder->setArguments(['-e', "\t$search\t"]);
$process = $this->procBuilder->getProcess();
$process->run();
$csv = Csv\Reader::createFromString($process->getOu... | php | private function getBy($search, $column)
{
$search = mb_strtolower($search, mb_detect_encoding($search));
$this->procBuilder->setArguments(['-e', "\t$search\t"]);
$process = $this->procBuilder->getProcess();
$process->run();
$csv = Csv\Reader::createFromString($process->getOu... | [
"private",
"function",
"getBy",
"(",
"$",
"search",
",",
"$",
"column",
")",
"{",
"$",
"search",
"=",
"mb_strtolower",
"(",
"$",
"search",
",",
"mb_detect_encoding",
"(",
"$",
"search",
")",
")",
";",
"$",
"this",
"->",
"procBuilder",
"->",
"setArguments... | Get inflections by searching in a specific column.
@param string $search String to search
@param string $column Column name
@return Inflection[] Search results | [
"Get",
"inflections",
"by",
"searching",
"in",
"a",
"specific",
"column",
"."
] | train | https://github.com/Rudloff/php-dicollecte-lexicon/blob/d868c1ef8d844edfdd012a7ef051cf9a2ca69f9e/classes/Lexicon.php#L57-L73 |
koolkode/security | src/Authentication/EntryPoint/HttpDigest.php | HttpDigest.startAuthentication | public function startAuthentication(TokenInterface $token, HttpRequest $request, HttpResponse $response)
{
if(!$token instanceof HttpDigestToken)
{
throw new SecurityException(sprintf('Invalid token %s passed to %s', get_class($token), get_class($this)));
}
$params = [
'realm' => $this->auth->getRealm... | php | public function startAuthentication(TokenInterface $token, HttpRequest $request, HttpResponse $response)
{
if(!$token instanceof HttpDigestToken)
{
throw new SecurityException(sprintf('Invalid token %s passed to %s', get_class($token), get_class($this)));
}
$params = [
'realm' => $this->auth->getRealm... | [
"public",
"function",
"startAuthentication",
"(",
"TokenInterface",
"$",
"token",
",",
"HttpRequest",
"$",
"request",
",",
"HttpResponse",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"token",
"instanceof",
"HttpDigestToken",
")",
"{",
"throw",
"new",
"Secu... | {@inheritdoc} | [
"{"
] | train | https://github.com/koolkode/security/blob/d3d8d42392f520754847d29b6df19aaa38c79e8e/src/Authentication/EntryPoint/HttpDigest.php#L43-L90 |
SimplyCodedSoftware/integration-messaging-cqrs | src/CallAggregateService.php | CallAggregateService.call | public function call(Message $message) : Message
{
$aggregate = $message->getHeaders()->containsKey(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
? $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
... | php | public function call(Message $message) : Message
{
$aggregate = $message->getHeaders()->containsKey(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
? $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
... | [
"public",
"function",
"call",
"(",
"Message",
"$",
"message",
")",
":",
"Message",
"{",
"$",
"aggregate",
"=",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"->",
"containsKey",
"(",
"CqrsMessagingModule",
"::",
"INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER",
")",
... | @param Message $message
@return Message
@throws MessageHandlingException | [
"@param",
"Message",
"$message"
] | train | https://github.com/SimplyCodedSoftware/integration-messaging-cqrs/blob/c59407d61ffbb29a1fdf5b363ca654d541482a2c/src/CallAggregateService.php#L51-L81 |
reliv/rcm-config | src/Factory/ConfigModel.php | ConfigModel.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
return new \Reliv\RcmConfig\Model\ConfigModel($config, null);
} | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
return new \Reliv\RcmConfig\Model\ConfigModel($config, null);
} | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'config'",
")",
";",
"return",
"new",
"\\",
"Reliv",
"\\",
"RcmConfig",
"\\",
"Model",
"\\",
... | Creates Service
@param ServiceLocatorInterface $serviceLocator Zend Service Locator
@return \Reliv\RcmConfig\Model\ConfigModel | [
"Creates",
"Service"
] | train | https://github.com/reliv/rcm-config/blob/3e8cdea57a8688b06997ce1b167b8410bccac09e/src/Factory/ConfigModel.php#L30-L35 |
ScaraMVC/Framework | src/Scara/Http/Groups/Groupable.php | Groupable.finalize | public function finalize()
{
$gen = new UrlGenerator();
if (!empty($this->redirect)) {
$gen->redirect($this->redirect);
}
} | php | public function finalize()
{
$gen = new UrlGenerator();
if (!empty($this->redirect)) {
$gen->redirect($this->redirect);
}
} | [
"public",
"function",
"finalize",
"(",
")",
"{",
"$",
"gen",
"=",
"new",
"UrlGenerator",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"redirect",
")",
")",
"{",
"$",
"gen",
"->",
"redirect",
"(",
"$",
"this",
"->",
"redirect",
... | Finalize groups that implement the Groupable trait.
@return void | [
"Finalize",
"groups",
"that",
"implement",
"the",
"Groupable",
"trait",
"."
] | train | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Groups/Groupable.php#L24-L30 |
cmsgears/module-community | common/components/Factory.php | Factory.registerEntityAliases | public function registerEntityAliases() {
$factory = Yii::$app->factory->getContainer();
$factory->set( 'chatService', 'cmsgears\community\common\services\entities\ChatService' );
$factory->set( 'groupService', 'cmsgears\community\common\services\entities\GroupService' );
} | php | public function registerEntityAliases() {
$factory = Yii::$app->factory->getContainer();
$factory->set( 'chatService', 'cmsgears\community\common\services\entities\ChatService' );
$factory->set( 'groupService', 'cmsgears\community\common\services\entities\GroupService' );
} | [
"public",
"function",
"registerEntityAliases",
"(",
")",
"{",
"$",
"factory",
"=",
"Yii",
"::",
"$",
"app",
"->",
"factory",
"->",
"getContainer",
"(",
")",
";",
"$",
"factory",
"->",
"set",
"(",
"'chatService'",
",",
"'cmsgears\\community\\common\\services\\ent... | Registers entity aliases. | [
"Registers",
"entity",
"aliases",
"."
] | train | https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/common/components/Factory.php#L150-L157 |
lightwerk/SurfCaptain | Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php | AbstractRestController.initializeController | protected function initializeController(
\TYPO3\Flow\Mvc\RequestInterface $request,
\TYPO3\Flow\Mvc\ResponseInterface $response
) {
$this->parentInitializeController($request, $response);
// override request.format with NegotiatedMediaType aka HTTP-Request
// Content-Type and... | php | protected function initializeController(
\TYPO3\Flow\Mvc\RequestInterface $request,
\TYPO3\Flow\Mvc\ResponseInterface $response
) {
$this->parentInitializeController($request, $response);
// override request.format with NegotiatedMediaType aka HTTP-Request
// Content-Type and... | [
"protected",
"function",
"initializeController",
"(",
"\\",
"TYPO3",
"\\",
"Flow",
"\\",
"Mvc",
"\\",
"RequestInterface",
"$",
"request",
",",
"\\",
"TYPO3",
"\\",
"Flow",
"\\",
"Mvc",
"\\",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"this",
"->",
... | Initializes the controller
This method should be called by the concrete processRequest() method.
@param \TYPO3\Flow\Mvc\RequestInterface $request
@param \TYPO3\Flow\Mvc\ResponseInterface $response
@throws \TYPO3\Flow\Mvc\Exception\UnsupportedRequestTypeException
@return void | [
"Initializes",
"the",
"controller"
] | train | https://github.com/lightwerk/SurfCaptain/blob/2865e963fd634504d8923902cf422873749a0940/Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php#L53-L69 |
lightwerk/SurfCaptain | Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php | AbstractRestController.errorAction | protected function errorAction()
{
// we like to have a 400 status
$this->response->setStatus(400);
if ($this->mediaType === 'application/json') {
$this->addErrorFlashMessage();
} else {
parent::errorAction();
}
} | php | protected function errorAction()
{
// we like to have a 400 status
$this->response->setStatus(400);
if ($this->mediaType === 'application/json') {
$this->addErrorFlashMessage();
} else {
parent::errorAction();
}
} | [
"protected",
"function",
"errorAction",
"(",
")",
"{",
"// we like to have a 400 status",
"$",
"this",
"->",
"response",
"->",
"setStatus",
"(",
"400",
")",
";",
"if",
"(",
"$",
"this",
"->",
"mediaType",
"===",
"'application/json'",
")",
"{",
"$",
"this",
"... | Error Action
@return void | [
"Error",
"Action"
] | train | https://github.com/lightwerk/SurfCaptain/blob/2865e963fd634504d8923902cf422873749a0940/Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php#L89-L98 |
lightwerk/SurfCaptain | Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php | AbstractRestController.handleException | protected function handleException(\Exception $exception)
{
$this->response->setStatus(500);
// may be we want also an exceptionHandler e.g. to notify somebody, ...
$this->addFlashMessage(
$exception->getMessage(),
get_class($exception),
Message::SEVERITY_... | php | protected function handleException(\Exception $exception)
{
$this->response->setStatus(500);
// may be we want also an exceptionHandler e.g. to notify somebody, ...
$this->addFlashMessage(
$exception->getMessage(),
get_class($exception),
Message::SEVERITY_... | [
"protected",
"function",
"handleException",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"response",
"->",
"setStatus",
"(",
"500",
")",
";",
"// may be we want also an exceptionHandler e.g. to notify somebody, ...",
"$",
"this",
"->",
"addFl... | Handle Exception
@param \Exception $exception
@return void | [
"Handle",
"Exception"
] | train | https://github.com/lightwerk/SurfCaptain/blob/2865e963fd634504d8923902cf422873749a0940/Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php#L106-L117 |
lightwerk/SurfCaptain | Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php | AbstractRestController.redirect | protected function redirect(
$actionName,
$controllerName = null,
$packageKey = null,
array $arguments = null,
$delay = 0,
$statusCode = 303,
$format = null
) {
if ($this->mediaType === 'application/json') {
// render all arguments
... | php | protected function redirect(
$actionName,
$controllerName = null,
$packageKey = null,
array $arguments = null,
$delay = 0,
$statusCode = 303,
$format = null
) {
if ($this->mediaType === 'application/json') {
// render all arguments
... | [
"protected",
"function",
"redirect",
"(",
"$",
"actionName",
",",
"$",
"controllerName",
"=",
"null",
",",
"$",
"packageKey",
"=",
"null",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"$",
"delay",
"=",
"0",
",",
"$",
"statusCode",
"=",
"303",
","... | Redirects the request to another action and / or controller.
@param string $actionName Name of the action to forward to
@param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
@param string $packageKey Key of the package containing the co... | [
"Redirects",
"the",
"request",
"to",
"another",
"action",
"and",
"/",
"or",
"controller",
"."
] | train | https://github.com/lightwerk/SurfCaptain/blob/2865e963fd634504d8923902cf422873749a0940/Classes/Lightwerk/SurfCaptain/Controller/AbstractRestController.php#L134-L171 |
haggertypat/DirectoryBundle | Helper/Geocoder.php | Geocoder.distanceBetween | public function distanceBetween($latA, $lngA, $latB, $lngB)
{
$R = 6371; // earth's mean radius in km
$dLat = $this->rad($latB - $latA);
$dLong = $this->rad($lngB - $lngA);
$a = \sin($dLat/2) * \sin($dLat/2) +
\cos($this->rad($latA)) * \cos($this->rad($latB)) * \sin($... | php | public function distanceBetween($latA, $lngA, $latB, $lngB)
{
$R = 6371; // earth's mean radius in km
$dLat = $this->rad($latB - $latA);
$dLong = $this->rad($lngB - $lngA);
$a = \sin($dLat/2) * \sin($dLat/2) +
\cos($this->rad($latA)) * \cos($this->rad($latB)) * \sin($... | [
"public",
"function",
"distanceBetween",
"(",
"$",
"latA",
",",
"$",
"lngA",
",",
"$",
"latB",
",",
"$",
"lngB",
")",
"{",
"$",
"R",
"=",
"6371",
";",
"// earth's mean radius in km",
"$",
"dLat",
"=",
"$",
"this",
"->",
"rad",
"(",
"$",
"latB",
"-",
... | /*
From http://stackoverflow.com/q/1502590 | [
"/",
"*",
"From",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"q",
"/",
"1502590"
] | train | https://github.com/haggertypat/DirectoryBundle/blob/ed2ee4a1a00d39df81d88eca7ef98dcf958da618/Helper/Geocoder.php#L46-L58 |
congraphcms/core | Helpers/StringHelper.php | StringHelper.createSlug | public static function createSlug($string)
{
// remove all accent characters
$string = self::remove_accents($string);
// lowercase
$string = strtolower($string);
// replace all characters except letters and numbers to dashes
$slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
// deep replace doubl... | php | public static function createSlug($string)
{
// remove all accent characters
$string = self::remove_accents($string);
// lowercase
$string = strtolower($string);
// replace all characters except letters and numbers to dashes
$slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
// deep replace doubl... | [
"public",
"static",
"function",
"createSlug",
"(",
"$",
"string",
")",
"{",
"// remove all accent characters",
"$",
"string",
"=",
"self",
"::",
"remove_accents",
"(",
"$",
"string",
")",
";",
"// lowercase",
"$",
"string",
"=",
"strtolower",
"(",
"$",
"string... | Creates slug from any string
@param string $string
@return string | [
"Creates",
"slug",
"from",
"any",
"string"
] | train | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/StringHelper.php#L38-L59 |
congraphcms/core | Helpers/StringHelper.php | StringHelper.remove_accents | public static function remove_accents( $string ) {
if ( !preg_match('/[\x80-\xff]/', $string) )
return $string;
if (self::seems_utf8($string)) {
$chars = array(
// Decompositions for Latin-1 Supplement
chr(194).chr(170) => 'a', chr(194).chr(186) => 'o',
chr(195).chr(128) => 'A', chr(195).chr(129) => ... | php | public static function remove_accents( $string ) {
if ( !preg_match('/[\x80-\xff]/', $string) )
return $string;
if (self::seems_utf8($string)) {
$chars = array(
// Decompositions for Latin-1 Supplement
chr(194).chr(170) => 'a', chr(194).chr(186) => 'o',
chr(195).chr(128) => 'A', chr(195).chr(129) => ... | [
"public",
"static",
"function",
"remove_accents",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/[\\x80-\\xff]/'",
",",
"$",
"string",
")",
")",
"return",
"$",
"string",
";",
"if",
"(",
"self",
"::",
"seems_utf8",
"(",
"$",
"string",... | Converts all accent characters to ASCII characters. (Wordpress function)
If there are no accent characters, then the string given is just returned.
@param string $string Text that might have accent characters
@return string Filtered string with replaced "nice" characters. | [
"Converts",
"all",
"accent",
"characters",
"to",
"ASCII",
"characters",
".",
"(",
"Wordpress",
"function",
")"
] | train | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/StringHelper.php#L70-L272 |
congraphcms/core | Helpers/StringHelper.php | StringHelper.seems_utf8 | protected static function seems_utf8($str)
{
mbstring_binary_safe_encoding();
$length = strlen($str);
reset_mbstring_encoding();
for ($i = 0; $i < $length; $i++) {
$c = ord($str[$i]);
if ($c < 0x80) $n = 0; // 0bbbbbbb
elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
elseif (($c & 0xF0) == 0xE0) $n... | php | protected static function seems_utf8($str)
{
mbstring_binary_safe_encoding();
$length = strlen($str);
reset_mbstring_encoding();
for ($i = 0; $i < $length; $i++) {
$c = ord($str[$i]);
if ($c < 0x80) $n = 0; // 0bbbbbbb
elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
elseif (($c & 0xF0) == 0xE0) $n... | [
"protected",
"static",
"function",
"seems_utf8",
"(",
"$",
"str",
")",
"{",
"mbstring_binary_safe_encoding",
"(",
")",
";",
"$",
"length",
"=",
"strlen",
"(",
"$",
"str",
")",
";",
"reset_mbstring_encoding",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",... | Checks to see if a string is utf8 encoded.
NOTE: This function checks for 5-Byte sequences, UTF8
has Bytes Sequences with a maximum length of 4.
@author bmorel at ssi dot fr (modified)
@since 1.2.1
@param string $str The string to be checked
@return bool True if $str fits a UTF-8 model, false otherwise. | [
"Checks",
"to",
"see",
"if",
"a",
"string",
"is",
"utf8",
"encoded",
"."
] | train | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/StringHelper.php#L286-L306 |
WellCommerce/CategoryBundle | Form/Admin/CategoryFormBuilder.php | CategoryFormBuilder.buildForm | public function buildForm(FormInterface $form)
{
$requiredData = $form->addChild($this->getElement('nested_fieldset', [
'name' => 'required_data',
'label' => $this->trans('common.fieldset.general')
]));
$languageData = $requiredData->addChild($this->getElement('lang... | php | public function buildForm(FormInterface $form)
{
$requiredData = $form->addChild($this->getElement('nested_fieldset', [
'name' => 'required_data',
'label' => $this->trans('common.fieldset.general')
]));
$languageData = $requiredData->addChild($this->getElement('lang... | [
"public",
"function",
"buildForm",
"(",
"FormInterface",
"$",
"form",
")",
"{",
"$",
"requiredData",
"=",
"$",
"form",
"->",
"addChild",
"(",
"$",
"this",
"->",
"getElement",
"(",
"'nested_fieldset'",
",",
"[",
"'name'",
"=>",
"'required_data'",
",",
"'label... | {@inheritdoc} | [
"{"
] | train | https://github.com/WellCommerce/CategoryBundle/blob/7a23ac678f91d15e86bdff624c4799be7b076e1a/Form/Admin/CategoryFormBuilder.php#L27-L117 |
phossa/phossa-route | src/Phossa/Route/Regex/ParserStd.php | ParserStd.match | public function match(/*# string */ $url)
{
$matches = [];
foreach ($this->getRegexData() as $regex) {
if (preg_match($regex, $url, $matches)) {
return $this->fixMatches($matches);
}
}
return false;
} | php | public function match(/*# string */ $url)
{
$matches = [];
foreach ($this->getRegexData() as $regex) {
if (preg_match($regex, $url, $matches)) {
return $this->fixMatches($matches);
}
}
return false;
} | [
"public",
"function",
"match",
"(",
"/*# string */",
"$",
"url",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRegexData",
"(",
")",
"as",
"$",
"regex",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"regex",
",... | {@inheritDoc} | [
"{"
] | train | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Regex/ParserStd.php#L86-L95 |
phossa/phossa-route | src/Phossa/Route/Regex/ParserStd.php | ParserStd.convert | protected function convert(
/*# string */ $name,
/*# string */ $pattern
)/*# : string */ {
// regex
$groupname = "\s*([a-zA-Z][a-zA-Z0-9_]*)\s*";
$grouptype = ":\s*([^{}]*(?:\{(?-1)\}[^{}]*)*)";
$placeholder = sprintf("\{%s(?:%s)?\}", $groupname, $grouptype);
... | php | protected function convert(
/*# string */ $name,
/*# string */ $pattern
)/*# : string */ {
// regex
$groupname = "\s*([a-zA-Z][a-zA-Z0-9_]*)\s*";
$grouptype = ":\s*([^{}]*(?:\{(?-1)\}[^{}]*)*)";
$placeholder = sprintf("\{%s(?:%s)?\}", $groupname, $grouptype);
... | [
"protected",
"function",
"convert",
"(",
"/*# string */",
"$",
"name",
",",
"/*# string */",
"$",
"pattern",
")",
"/*# : string */",
"{",
"// regex",
"$",
"groupname",
"=",
"\"\\s*([a-zA-Z][a-zA-Z0-9_]*)\\s*\"",
";",
"$",
"grouptype",
"=",
"\":\\s*([^{}]*(?:\\{(?-1)\\}[... | Convert to regex
@param string $name regex name
@param string $pattern pattern to parse
@return self
@access protected | [
"Convert",
"to",
"regex"
] | train | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Regex/ParserStd.php#L105-L129 |
phossa/phossa-route | src/Phossa/Route/Regex/ParserStd.php | ParserStd.getRegexData | protected function getRegexData()/*# : array */
{
// load from cache
if (empty($this->regex) || !$this->modified) {
return $this->data;
}
// chunk size
$this->data = array_chunk($this->regex, $this->chunk);
// join in chunks
foreach ($this->data ... | php | protected function getRegexData()/*# : array */
{
// load from cache
if (empty($this->regex) || !$this->modified) {
return $this->data;
}
// chunk size
$this->data = array_chunk($this->regex, $this->chunk);
// join in chunks
foreach ($this->data ... | [
"protected",
"function",
"getRegexData",
"(",
")",
"/*# : array */",
"{",
"// load from cache",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"regex",
")",
"||",
"!",
"$",
"this",
"->",
"modified",
")",
"{",
"return",
"$",
"this",
"->",
"data",
";",
"}",
... | Merge several (chunk size) regex into one
@return array
@access protected | [
"Merge",
"several",
"(",
"chunk",
"size",
")",
"regex",
"into",
"one"
] | train | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Regex/ParserStd.php#L137-L156 |
phossa/phossa-route | src/Phossa/Route/Regex/ParserStd.php | ParserStd.fixMatches | protected function fixMatches($matches)/*# : array */
{
// remove numeric keys and empty group match
foreach ($matches as $idx => $val) {
if (is_int($idx) || '' === $val) {
unset($matches[$idx]);
}
}
// get route key/name
$routeKey = a... | php | protected function fixMatches($matches)/*# : array */
{
// remove numeric keys and empty group match
foreach ($matches as $idx => $val) {
if (is_int($idx) || '' === $val) {
unset($matches[$idx]);
}
}
// get route key/name
$routeKey = a... | [
"protected",
"function",
"fixMatches",
"(",
"$",
"matches",
")",
"/*# : array */",
"{",
"// remove numeric keys and empty group match",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"idx",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"idx",
")",
"... | Fix matched placeholders, return with unique route key
@param array $matches desc
@return array [ $name, $matches ]
@access protected | [
"Fix",
"matched",
"placeholders",
"return",
"with",
"unique",
"route",
"key"
] | train | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Regex/ParserStd.php#L165-L193 |
nemundo/core | src/Date/DateTimeDifference.php | DateTimeDifference.getDifferenceInMinute | public function getDifferenceInMinute()
{
$difference = $this->getDifference();
$differenceInMinute = 0;
if ($difference !== 0) {
$differenceInMinute = ($difference->d * 1440) + ($difference->h * 60) + $difference->i;
}
//if ($difference->invert = 1) {
... | php | public function getDifferenceInMinute()
{
$difference = $this->getDifference();
$differenceInMinute = 0;
if ($difference !== 0) {
$differenceInMinute = ($difference->d * 1440) + ($difference->h * 60) + $difference->i;
}
//if ($difference->invert = 1) {
... | [
"public",
"function",
"getDifferenceInMinute",
"(",
")",
"{",
"$",
"difference",
"=",
"$",
"this",
"->",
"getDifference",
"(",
")",
";",
"$",
"differenceInMinute",
"=",
"0",
";",
"if",
"(",
"$",
"difference",
"!==",
"0",
")",
"{",
"$",
"differenceInMinute"... | dateTill | [
"dateTill"
] | train | https://github.com/nemundo/core/blob/5ca14889fdfb9155b52fedb364b34502d14e21ed/src/Date/DateTimeDifference.php#L26-L43 |
vainproject/vain-site | src/Site/Http/Requests/PageFormRequest.php | PageFormRequest.rules | public function rules()
{
$attributes = [
'title' => 'required',
'text' => 'required',
];
$rules = $this->buildLocalizedRules($attributes);
return array_merge($rules, [
'id' => 'exists:site_pages,id',
'slug' => 'req... | php | public function rules()
{
$attributes = [
'title' => 'required',
'text' => 'required',
];
$rules = $this->buildLocalizedRules($attributes);
return array_merge($rules, [
'id' => 'exists:site_pages,id',
'slug' => 'req... | [
"public",
"function",
"rules",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"'title'",
"=>",
"'required'",
",",
"'text'",
"=>",
"'required'",
",",
"]",
";",
"$",
"rules",
"=",
"$",
"this",
"->",
"buildLocalizedRules",
"(",
"$",
"attributes",
")",
";",
"... | validation that has to pass.
@return array | [
"validation",
"that",
"has",
"to",
"pass",
"."
] | train | https://github.com/vainproject/vain-site/blob/d5560df68264f7ac1692c3dcfebc40500148dd56/src/Site/Http/Requests/PageFormRequest.php#L16-L31 |
vainproject/vain-site | src/Site/Http/Requests/PageFormRequest.php | PageFormRequest.buildLocalizedRules | protected function buildLocalizedRules($attributes)
{
$rules = [];
$locales = config('app.locales');
foreach ($locales as $locale => $name) {
foreach ($attributes as $attribute => $rule) {
$rules[$attribute.'_'.$locale] = $rule;
}
}
r... | php | protected function buildLocalizedRules($attributes)
{
$rules = [];
$locales = config('app.locales');
foreach ($locales as $locale => $name) {
foreach ($attributes as $attribute => $rule) {
$rules[$attribute.'_'.$locale] = $rule;
}
}
r... | [
"protected",
"function",
"buildLocalizedRules",
"(",
"$",
"attributes",
")",
"{",
"$",
"rules",
"=",
"[",
"]",
";",
"$",
"locales",
"=",
"config",
"(",
"'app.locales'",
")",
";",
"foreach",
"(",
"$",
"locales",
"as",
"$",
"locale",
"=>",
"$",
"name",
"... | builds localized suffixed rules for validation.
@param $attributes
@return array | [
"builds",
"localized",
"suffixed",
"rules",
"for",
"validation",
"."
] | train | https://github.com/vainproject/vain-site/blob/d5560df68264f7ac1692c3dcfebc40500148dd56/src/Site/Http/Requests/PageFormRequest.php#L48-L60 |
nochso/ORM2 | src/Model.php | Model.getPrimaryKeyValue | public function getPrimaryKeyValue()
{
$primaryKey = $this->getPrimaryKey();
if (isset($this->$primaryKey)) {
return $this->$primaryKey;
} else {
return null;
}
} | php | public function getPrimaryKeyValue()
{
$primaryKey = $this->getPrimaryKey();
if (isset($this->$primaryKey)) {
return $this->$primaryKey;
} else {
return null;
}
} | [
"public",
"function",
"getPrimaryKeyValue",
"(",
")",
"{",
"$",
"primaryKey",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"primaryKey",
")",
")",
"{",
"return",
"$",
"this",
"->",
"$",
"pri... | Returns the value of the primary key
@return null | [
"Returns",
"the",
"value",
"of",
"the",
"primary",
"key"
] | train | https://github.com/nochso/ORM2/blob/89f9a5c61ad5f575fbdd52990171b52d54f8bfbc/src/Model.php#L105-L113 |
nochso/ORM2 | src/Model.php | Model.toAssoc | public function toAssoc()
{
$params = [];
foreach (Extract::getObjectVars($this) as $key => $value) {
if (!$value instanceof Relation) {
$params[$key] = $value;
}
}
if ($this->getPrimaryKeyValue() === null) {
unset($params[$this->ge... | php | public function toAssoc()
{
$params = [];
foreach (Extract::getObjectVars($this) as $key => $value) {
if (!$value instanceof Relation) {
$params[$key] = $value;
}
}
if ($this->getPrimaryKeyValue() === null) {
unset($params[$this->ge... | [
"public",
"function",
"toAssoc",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"Extract",
"::",
"getObjectVars",
"(",
"$",
"this",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
... | Returns an associative array from this object excluding private variables and Relation objects
@return array | [
"Returns",
"an",
"associative",
"array",
"from",
"this",
"object",
"excluding",
"private",
"variables",
"and",
"Relation",
"objects"
] | train | https://github.com/nochso/ORM2/blob/89f9a5c61ad5f575fbdd52990171b52d54f8bfbc/src/Model.php#L268-L280 |
nochso/ORM2 | src/Model.php | Model.hydrate | public function hydrate($data, $removePrimaryKey = false)
{
foreach ($data as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
} else {
$this->extra[$key] = $value;
}
}
if ($removePrimaryKey) {
... | php | public function hydrate($data, $removePrimaryKey = false)
{
foreach ($data as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
} else {
$this->extra[$key] = $value;
}
}
if ($removePrimaryKey) {
... | [
"public",
"function",
"hydrate",
"(",
"$",
"data",
",",
"$",
"removePrimaryKey",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"key",
"... | Sets the properties of this object using an associative array,
where key is the property name and value is the property value.
Properties that do not exist in the current context are ignored.
@param array $data Associative array
@param bool $removePrimaryKey Optional: If true, the primary key of the
mode... | [
"Sets",
"the",
"properties",
"of",
"this",
"object",
"using",
"an",
"associative",
"array",
"where",
"key",
"is",
"the",
"property",
"name",
"and",
"value",
"is",
"the",
"property",
"value",
"."
] | train | https://github.com/nochso/ORM2/blob/89f9a5c61ad5f575fbdd52990171b52d54f8bfbc/src/Model.php#L296-L310 |
nochso/ORM2 | src/Model.php | Model.createFromData | private function createFromData($data)
{
$model = $this->dispense()->hydrate($data);
$model->isNew = false;
return $model;
} | php | private function createFromData($data)
{
$model = $this->dispense()->hydrate($data);
$model->isNew = false;
return $model;
} | [
"private",
"function",
"createFromData",
"(",
"$",
"data",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"dispense",
"(",
")",
"->",
"hydrate",
"(",
"$",
"data",
")",
";",
"$",
"model",
"->",
"isNew",
"=",
"false",
";",
"return",
"$",
"model",
";... | Dispenses a hydrated model that is known to exist in a database (i.e. is not new)
@param array $data
@return static | [
"Dispenses",
"a",
"hydrated",
"model",
"that",
"is",
"known",
"to",
"exist",
"in",
"a",
"database",
"(",
"i",
".",
"e",
".",
"is",
"not",
"new",
")"
] | train | https://github.com/nochso/ORM2/blob/89f9a5c61ad5f575fbdd52990171b52d54f8bfbc/src/Model.php#L318-L323 |
nochso/ORM2 | src/Model.php | Model.limit | public function limit($limit, $offset = null)
{
$this->queryBuilder->setLimit($limit, $offset);
return $this;
} | php | public function limit($limit, $offset = null)
{
$this->queryBuilder->setLimit($limit, $offset);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"queryBuilder",
"->",
"setLimit",
"(",
"$",
"limit",
",",
"$",
"offset",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Limit the amount of maximum rows returned
@param int $limit
@param int $offset
@return static | [
"Limit",
"the",
"amount",
"of",
"maximum",
"rows",
"returned"
] | train | https://github.com/nochso/ORM2/blob/89f9a5c61ad5f575fbdd52990171b52d54f8bfbc/src/Model.php#L503-L507 |
Wedeto/Auth | src/ACL/DBRuleLoader.php | DBRuleLoader.loadRules | public function loadRules(string $entity_id)
{
$records = ACLRule::get(["entity_id" => $entity_id]);
$rules = array();
foreach ($records as $record)
{
$rule = new Rule($record->entity_id, $record->role_id, $record->action, $record->policy);
$rule->setRecord($r... | php | public function loadRules(string $entity_id)
{
$records = ACLRule::get(["entity_id" => $entity_id]);
$rules = array();
foreach ($records as $record)
{
$rule = new Rule($record->entity_id, $record->role_id, $record->action, $record->policy);
$rule->setRecord($r... | [
"public",
"function",
"loadRules",
"(",
"string",
"$",
"entity_id",
")",
"{",
"$",
"records",
"=",
"ACLRule",
"::",
"get",
"(",
"[",
"\"entity_id\"",
"=>",
"$",
"entity_id",
"]",
")",
";",
"$",
"rules",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$... | Loads the rules for the specified entity from the database. | [
"Loads",
"the",
"rules",
"for",
"the",
"specified",
"entity",
"from",
"the",
"database",
"."
] | train | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/DBRuleLoader.php#L38-L50 |
randomhost/image | src/php/Text/Generic.php | Generic.setTextFont | public function setTextFont($path)
{
if (!is_file($path) || !is_readable($path)) {
throw new \InvalidArgumentException(
'Unable to load font file at ' . $path
);
}
$this->textFontPath = realpath($path);
return $this;
} | php | public function setTextFont($path)
{
if (!is_file($path) || !is_readable($path)) {
throw new \InvalidArgumentException(
'Unable to load font file at ' . $path
);
}
$this->textFontPath = realpath($path);
return $this;
} | [
"public",
"function",
"setTextFont",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
"||",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Unable to load font file ... | Sets the path to the font file used for rendering text overlays onto the
image.
@param string $path File system path to TTF font file to be used.
@return $this
@throws \InvalidArgumentException Thrown if the font file could not be loaded. | [
"Sets",
"the",
"path",
"to",
"the",
"font",
"file",
"used",
"for",
"rendering",
"text",
"overlays",
"onto",
"the",
"image",
"."
] | train | https://github.com/randomhost/image/blob/bd669ba6b50fd2bbbe50c4ef06235b111a8a30b0/src/php/Text/Generic.php#L121-L132 |
randomhost/image | src/php/Text/Generic.php | Generic.insertText | public function insertText($xPosition, $yPosition, $text)
{
if (!$this->getImage() instanceof Image\Image
|| !is_resource($this->getImage()->image)
) {
throw new \RuntimeException(
'Attempt to render text onto invalid image resource'
);
}
... | php | public function insertText($xPosition, $yPosition, $text)
{
if (!$this->getImage() instanceof Image\Image
|| !is_resource($this->getImage()->image)
) {
throw new \RuntimeException(
'Attempt to render text onto invalid image resource'
);
}
... | [
"public",
"function",
"insertText",
"(",
"$",
"xPosition",
",",
"$",
"yPosition",
",",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getImage",
"(",
")",
"instanceof",
"Image",
"\\",
"Image",
"||",
"!",
"is_resource",
"(",
"$",
"this",
"... | Renders the given text onto the image resource, using the given coordinates.
@param int $xPosition The x-ordinate.
@param int $yPosition The y-ordinate position of the fonts baseline.
@param string $text The text string in UTF-8 encoding.
@return $this;
@throws \RuntimeException Thrown if $this->image is ... | [
"Renders",
"the",
"given",
"text",
"onto",
"the",
"image",
"resource",
"using",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/randomhost/image/blob/bd669ba6b50fd2bbbe50c4ef06235b111a8a30b0/src/php/Text/Generic.php#L181-L236 |
bearframework/localization-addon | classes/Localization.php | Localization.addDictionary | public function addDictionary(string $locale, $callbackOrArray): \BearFramework\Localization
{
if (!isset($this->dictionaries[$locale])) {
$this->dictionaries[$locale] = [];
}
$this->dictionaries[$locale][] = $callbackOrArray;
return $this;
} | php | public function addDictionary(string $locale, $callbackOrArray): \BearFramework\Localization
{
if (!isset($this->dictionaries[$locale])) {
$this->dictionaries[$locale] = [];
}
$this->dictionaries[$locale][] = $callbackOrArray;
return $this;
} | [
"public",
"function",
"addDictionary",
"(",
"string",
"$",
"locale",
",",
"$",
"callbackOrArray",
")",
":",
"\\",
"BearFramework",
"\\",
"Localization",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dictionaries",
"[",
"$",
"locale",
"]",
")",
"... | Adds a new dictionary.
@param string $locale A locale code.
@param type $callbackOrArray An array containing dictionary data (in key=>value format) or a callback that returns such array.
@return \BearFramework\Localization Returns a instance to itself. | [
"Adds",
"a",
"new",
"dictionary",
"."
] | train | https://github.com/bearframework/localization-addon/blob/7feb1b85bf5b808a1883f98bbfb40c4eb83bb139/classes/Localization.php#L86-L93 |
bearframework/localization-addon | classes/Localization.php | Localization.getText | public function getText(string $id): ?string
{
$getText = function(string $id, string $locale) {
if (isset($this->defaultLocales[$locale]) && $this->defaultLocales[$locale] === 0) {
$app = App::get();
$context = $app->contexts->get(__FILE__);
$this... | php | public function getText(string $id): ?string
{
$getText = function(string $id, string $locale) {
if (isset($this->defaultLocales[$locale]) && $this->defaultLocales[$locale] === 0) {
$app = App::get();
$context = $app->contexts->get(__FILE__);
$this... | [
"public",
"function",
"getText",
"(",
"string",
"$",
"id",
")",
":",
"?",
"string",
"{",
"$",
"getText",
"=",
"function",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"locale",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"defaultLocales",
... | Returns a text from the dictionary for the current locale.
@param string $id The ID of the text.
@return string A text from the dictionary for the current locale. Returns null if no text is found. | [
"Returns",
"a",
"text",
"from",
"the",
"dictionary",
"for",
"the",
"current",
"locale",
"."
] | train | https://github.com/bearframework/localization-addon/blob/7feb1b85bf5b808a1883f98bbfb40c4eb83bb139/classes/Localization.php#L100-L137 |
bearframework/localization-addon | classes/Localization.php | Localization.formatDate | public function formatDate($date, array $options = []): string
{
if (is_int($date) || is_numeric($date)) {
$timestamp = (int) $date;
} elseif ($date instanceof \DateTime) {
$timestamp = $date->getTimestamp();
} else {
$timestamp = (new \DateTime($date))->g... | php | public function formatDate($date, array $options = []): string
{
if (is_int($date) || is_numeric($date)) {
$timestamp = (int) $date;
} elseif ($date instanceof \DateTime) {
$timestamp = $date->getTimestamp();
} else {
$timestamp = (new \DateTime($date))->g... | [
"public",
"function",
"formatDate",
"(",
"$",
"date",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"is_int",
"(",
"$",
"date",
")",
"||",
"is_numeric",
"(",
"$",
"date",
")",
")",
"{",
"$",
"timestamp",
"=",
"(... | Returns a text representation of the date provided that contains the elements listed.
@param int|DateTime $date The date to format.
@param array $options The elements that the text representation of the date must contain. Available values: date, dateAutoYear, time, timeAgo.
@todo Additional options: timeAutoDate, day, ... | [
"Returns",
"a",
"text",
"representation",
"of",
"the",
"date",
"provided",
"that",
"contains",
"the",
"elements",
"listed",
"."
] | train | https://github.com/bearframework/localization-addon/blob/7feb1b85bf5b808a1883f98bbfb40c4eb83bb139/classes/Localization.php#L145-L200 |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/AbstractMySQLDataSource.php | AbstractMySQLDataSource.getNewConnection | protected function getNewConnection($connections)
{
$connection = $this->ApplicationContext->object($this->DatabaseServiceName);
$connection->setConnectionInfo($connections);
return $connection;
} | php | protected function getNewConnection($connections)
{
$connection = $this->ApplicationContext->object($this->DatabaseServiceName);
$connection->setConnectionInfo($connections);
return $connection;
} | [
"protected",
"function",
"getNewConnection",
"(",
"$",
"connections",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"ApplicationContext",
"->",
"object",
"(",
"$",
"this",
"->",
"DatabaseServiceName",
")",
";",
"$",
"connection",
"->",
"setConnectionInfo"... | Gets a new connection using the connection info given
@param array $connectionInfo An array of connection info
@return DatabaseInterface | [
"Gets",
"a",
"new",
"connection",
"using",
"the",
"connection",
"info",
"given"
] | train | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/AbstractMySQLDataSource.php#L52-L57 |
SlaxWeb/Config | src/XmlHandler.php | XmlHandler.load | public function load(string $config, bool $prependResourceName = false): int
{
// obtain absolute path to configuration resource
if (($config = $this->_getAbsPath($config)) === "") {
return static::CONFIG_RESOURCE_NOT_FOUND;
}
$configContents = file_get_contents($config)... | php | public function load(string $config, bool $prependResourceName = false): int
{
// obtain absolute path to configuration resource
if (($config = $this->_getAbsPath($config)) === "") {
return static::CONFIG_RESOURCE_NOT_FOUND;
}
$configContents = file_get_contents($config)... | [
"public",
"function",
"load",
"(",
"string",
"$",
"config",
",",
"bool",
"$",
"prependResourceName",
"=",
"false",
")",
":",
"int",
"{",
"// obtain absolute path to configuration resource",
"if",
"(",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"_getAbsPath",
... | Load the Config File
Check if the file exists, load it, and parse the containing array into
the the internal container array. Return 'CONFIG_LOADED' constant on
success. If the file is not found, return 'CONFIG_RESOURCE_NOT_FOUND'
constant, and 'CONFIG_PARSE_ERROR' if the contants could not have been
parsed.
@param s... | [
"Load",
"the",
"Config",
"File"
] | train | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/XmlHandler.php#L55-L82 |
LpFactory/NestedSetRoutingBundle | Configuration/AbstractPageRouteConfiguration.php | AbstractPageRouteConfiguration.isMatching | public function isMatching($url)
{
if ($this->getRegex() === null) {
return true;
}
if (preg_match($this->getRegex(), $url)) {
return true;
}
return false;
} | php | public function isMatching($url)
{
if ($this->getRegex() === null) {
return true;
}
if (preg_match($this->getRegex(), $url)) {
return true;
}
return false;
} | [
"public",
"function",
"isMatching",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRegex",
"(",
")",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"preg_match",
"(",
"$",
"this",
"->",
"getRegex",
"(",
")",
",",
"$... | Check if route configuration matches url
@param string $url
@return null|string | [
"Check",
"if",
"route",
"configuration",
"matches",
"url"
] | train | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Configuration/AbstractPageRouteConfiguration.php#L29-L40 |
LpFactory/NestedSetRoutingBundle | Configuration/AbstractPageRouteConfiguration.php | AbstractPageRouteConfiguration.extractPathInfo | public function extractPathInfo($pathInfo)
{
if ($this->getRegex() === null) {
return $pathInfo;
}
preg_match($this->getRegex(), $pathInfo, $matches);
if (isset($matches[1])) {
return $matches[1];
} else {
// Empty then root node ("/"... | php | public function extractPathInfo($pathInfo)
{
if ($this->getRegex() === null) {
return $pathInfo;
}
preg_match($this->getRegex(), $pathInfo, $matches);
if (isset($matches[1])) {
return $matches[1];
} else {
// Empty then root node ("/"... | [
"public",
"function",
"extractPathInfo",
"(",
"$",
"pathInfo",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRegex",
"(",
")",
"===",
"null",
")",
"{",
"return",
"$",
"pathInfo",
";",
"}",
"preg_match",
"(",
"$",
"this",
"->",
"getRegex",
"(",
")",
","... | Extract page pathinfo
Call isMatching before to be sure regex matches
@param $pathInfo
@return string | [
"Extract",
"page",
"pathinfo",
"Call",
"isMatching",
"before",
"to",
"be",
"sure",
"regex",
"matches"
] | train | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Configuration/AbstractPageRouteConfiguration.php#L50-L64 |
LpFactory/NestedSetRoutingBundle | Configuration/AbstractPageRouteConfiguration.php | AbstractPageRouteConfiguration.extractId | public function extractId($routeName)
{
if (!$this->supports($routeName)) {
return null;
}
return (int) str_replace($this->getPrefix(), '', $routeName);
} | php | public function extractId($routeName)
{
if (!$this->supports($routeName)) {
return null;
}
return (int) str_replace($this->getPrefix(), '', $routeName);
} | [
"public",
"function",
"extractId",
"(",
"$",
"routeName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"supports",
"(",
"$",
"routeName",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"int",
")",
"str_replace",
"(",
"$",
"this",
"->",
"... | Extract a page id from the route name
@param string $routeName
@return int|null | [
"Extract",
"a",
"page",
"id",
"from",
"the",
"route",
"name"
] | train | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Configuration/AbstractPageRouteConfiguration.php#L85-L92 |
LpFactory/NestedSetRoutingBundle | Configuration/AbstractPageRouteConfiguration.php | AbstractPageRouteConfiguration.buildPath | public function buildPath($pathInfo)
{
if (null === $this->getPath()) {
return $pathInfo;
}
return sprintf($this->getPath(), rtrim($pathInfo, '/'));
} | php | public function buildPath($pathInfo)
{
if (null === $this->getPath()) {
return $pathInfo;
}
return sprintf($this->getPath(), rtrim($pathInfo, '/'));
} | [
"public",
"function",
"buildPath",
"(",
"$",
"pathInfo",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getPath",
"(",
")",
")",
"{",
"return",
"$",
"pathInfo",
";",
"}",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",... | Build a path
@param string $pathInfo
@return string | [
"Build",
"a",
"path"
] | train | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Configuration/AbstractPageRouteConfiguration.php#L101-L108 |
openWorkers/RedObject | src/RedObject/HashSet.php | HashSet.offsetGet | public function offsetGet($offset)
{
$output = $this->redis->hGet($this->key, $offset);
return $this->ioHandler->handleOutput($output);
} | php | public function offsetGet($offset)
{
$output = $this->redis->hGet($this->key, $offset);
return $this->ioHandler->handleOutput($output);
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"redis",
"->",
"hGet",
"(",
"$",
"this",
"->",
"key",
",",
"$",
"offset",
")",
";",
"return",
"$",
"this",
"->",
"ioHandler",
"->",
"handleOutput"... | (PHP 5 >= 5.0.0)<br/>
Offset to retrieve
@link http://php.net/manual/en/arrayaccess.offsetget.php
@param mixed $offset <p>
The offset to retrieve.
</p>
@return mixed Can return all value types. | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"0",
".",
"0",
")",
"<br",
"/",
">",
"Offset",
"to",
"retrieve"
] | train | https://github.com/openWorkers/RedObject/blob/ce60d782352f97154294d7d200e7c87df80aa41a/src/RedObject/HashSet.php#L54-L58 |
openWorkers/RedObject | src/RedObject/HashSet.php | HashSet.offsetSet | public function offsetSet($offset, $value)
{
if ($offset === null) {
$offset = uniqid('uid');
}
if (is_string($value)) {
$this->redis->hSet($this->key, $offset, "!".$value);
} else {
$this->redis->hSet($this->key, $offset, serialize($value));
... | php | public function offsetSet($offset, $value)
{
if ($offset === null) {
$offset = uniqid('uid');
}
if (is_string($value)) {
$this->redis->hSet($this->key, $offset, "!".$value);
} else {
$this->redis->hSet($this->key, $offset, serialize($value));
... | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"offset",
"===",
"null",
")",
"{",
"$",
"offset",
"=",
"uniqid",
"(",
"'uid'",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",... | (PHP 5 >= 5.0.0)<br/>
Offset to set
@link http://php.net/manual/en/arrayaccess.offsetset.php
@param mixed $offset <p>
The offset to assign the value to.
</p>
@param mixed $value <p>
The value to set.
</p>
@return void | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"0",
".",
"0",
")",
"<br",
"/",
">",
"Offset",
"to",
"set"
] | train | https://github.com/openWorkers/RedObject/blob/ce60d782352f97154294d7d200e7c87df80aa41a/src/RedObject/HashSet.php#L72-L82 |
openWorkers/RedObject | src/RedObject/HashSet.php | HashSet.toArray | public function toArray()
{
$keys = $this->redis->hKeys($this->key);
$result = array();
foreach ($keys as $key) {
$result[$key] = $this->offsetGet($key);
}
return $result;
} | php | public function toArray()
{
$keys = $this->redis->hKeys($this->key);
$result = array();
foreach ($keys as $key) {
$result[$key] = $this->offsetGet($key);
}
return $result;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"redis",
"->",
"hKeys",
"(",
"$",
"this",
"->",
"key",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")"... | Converts the hashset to an php-array
@return array | [
"Converts",
"the",
"hashset",
"to",
"an",
"php",
"-",
"array"
] | train | https://github.com/openWorkers/RedObject/blob/ce60d782352f97154294d7d200e7c87df80aa41a/src/RedObject/HashSet.php#L114-L122 |
fond-of/spryker-companies-rest-api | src/FondOfSpryker/Glue/CompaniesRestApi/Controller/CompaniesResourceController.php | CompaniesResourceController.postAction | public function postAction(
RestRequestInterface $restRequest,
RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
): RestResponseInterface {
return $this->getFactory()->createCompaniesWriter()
->createCompany($restRequest, $restCompaniesRequestAttribut... | php | public function postAction(
RestRequestInterface $restRequest,
RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
): RestResponseInterface {
return $this->getFactory()->createCompaniesWriter()
->createCompany($restRequest, $restCompaniesRequestAttribut... | [
"public",
"function",
"postAction",
"(",
"RestRequestInterface",
"$",
"restRequest",
",",
"RestCompaniesRequestAttributesTransfer",
"$",
"restCompaniesRequestAttributesTransfer",
")",
":",
"RestResponseInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
... | @param \Spryker\Glue\GlueApplication\Rest\Request\Data\RestRequestInterface $restRequest
@param \Generated\Shared\Transfer\RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
@return \Spryker\Glue\GlueApplication\Rest\JsonApi\RestResponseInterface | [
"@param",
"\\",
"Spryker",
"\\",
"Glue",
"\\",
"GlueApplication",
"\\",
"Rest",
"\\",
"Request",
"\\",
"Data",
"\\",
"RestRequestInterface",
"$restRequest",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"RestCompaniesRequestAttributesTransfer",
... | train | https://github.com/fond-of/spryker-companies-rest-api/blob/0df688aa37cd6d18f90ac2af0a1cbc39357d94d7/src/FondOfSpryker/Glue/CompaniesRestApi/Controller/CompaniesResourceController.php#L32-L38 |
fond-of/spryker-companies-rest-api | src/FondOfSpryker/Glue/CompaniesRestApi/Controller/CompaniesResourceController.php | CompaniesResourceController.patchAction | public function patchAction(
RestRequestInterface $restRequest,
RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
): RestResponseInterface {
return $this->getFactory()->createCompaniesWriter()
->updateCompany($restRequest, $restCompaniesRequestAttribu... | php | public function patchAction(
RestRequestInterface $restRequest,
RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
): RestResponseInterface {
return $this->getFactory()->createCompaniesWriter()
->updateCompany($restRequest, $restCompaniesRequestAttribu... | [
"public",
"function",
"patchAction",
"(",
"RestRequestInterface",
"$",
"restRequest",
",",
"RestCompaniesRequestAttributesTransfer",
"$",
"restCompaniesRequestAttributesTransfer",
")",
":",
"RestResponseInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
... | @param \Spryker\Glue\GlueApplication\Rest\Request\Data\RestRequestInterface $restRequest
@param \Generated\Shared\Transfer\RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
@return \Spryker\Glue\GlueApplication\Rest\JsonApi\RestResponseInterface | [
"@param",
"\\",
"Spryker",
"\\",
"Glue",
"\\",
"GlueApplication",
"\\",
"Rest",
"\\",
"Request",
"\\",
"Data",
"\\",
"RestRequestInterface",
"$restRequest",
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"RestCompaniesRequestAttributesTransfer",
... | train | https://github.com/fond-of/spryker-companies-rest-api/blob/0df688aa37cd6d18f90ac2af0a1cbc39357d94d7/src/FondOfSpryker/Glue/CompaniesRestApi/Controller/CompaniesResourceController.php#L46-L52 |
Vectrex/vxPHP | src/Http/Response.php | Response.sendHeaders | public function sendHeaders() {
// headers have already been sent by the developer
if (headers_sent()) {
return $this;
}
if (!$this->headers->has('Date')) {
$this->setDate(\DateTime::createFromFormat('U', time()));
}
// headers
foreach ($this->headers->allPreserveCase() as $name => $values) {... | php | public function sendHeaders() {
// headers have already been sent by the developer
if (headers_sent()) {
return $this;
}
if (!$this->headers->has('Date')) {
$this->setDate(\DateTime::createFromFormat('U', time()));
}
// headers
foreach ($this->headers->allPreserveCase() as $name => $values) {... | [
"public",
"function",
"sendHeaders",
"(",
")",
"{",
"// headers have already been sent by the developer",
"if",
"(",
"headers_sent",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"headers",
"->",
"has",
"(",
"'Date'"... | Sends HTTP headers.
@return Response | [
"Sends",
"HTTP",
"headers",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L347-L378 |
Vectrex/vxPHP | src/Http/Response.php | Response.isCacheable | public function isCacheable() {
if (!in_array(
$this->statusCode,
[
self::HTTP_OK,
self::HTTP_NON_AUTHORITATIVE_INFORMATION,
self::HTTP_MULTIPLE_CHOICES,
self::HTTP_MOVED_PERMANENTLY,
self::HTTP_FOUND,
self::HTTP_NOT_FOUND,
self::HTTP_GONE
]
)) {
return FALSE;
}
... | php | public function isCacheable() {
if (!in_array(
$this->statusCode,
[
self::HTTP_OK,
self::HTTP_NON_AUTHORITATIVE_INFORMATION,
self::HTTP_MULTIPLE_CHOICES,
self::HTTP_MOVED_PERMANENTLY,
self::HTTP_FOUND,
self::HTTP_NOT_FOUND,
self::HTTP_GONE
]
)) {
return FALSE;
}
... | [
"public",
"function",
"isCacheable",
"(",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"statusCode",
",",
"[",
"self",
"::",
"HTTP_OK",
",",
"self",
"::",
"HTTP_NON_AUTHORITATIVE_INFORMATION",
",",
"self",
"::",
"HTTP_MULTIPLE_CHOICES",
",",
... | Returns true if the response is worth caching under any circumstance.
Responses marked "private" with an explicit Cache-Control directive are
considered uncacheable.
Responses with neither a freshness lifetime (Expires, max-age) nor cache
validator (Last-Modified, ETag) are considered uncacheable.
@return Boolean tr... | [
"Returns",
"true",
"if",
"the",
"response",
"is",
"worth",
"caching",
"under",
"any",
"circumstance",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L552-L575 |
Vectrex/vxPHP | src/Http/Response.php | Response.getMaxAge | public function getMaxAge() {
if ($this->headers->hasCacheControlDirective('s-maxage')) {
return (int) $this->headers->getCacheControlDirective('s-maxage');
}
if ($this->headers->hasCacheControlDirective('max-age')) {
return (int) $this->headers->getCacheControlDirective('max-age');
}
if (NULL !== $t... | php | public function getMaxAge() {
if ($this->headers->hasCacheControlDirective('s-maxage')) {
return (int) $this->headers->getCacheControlDirective('s-maxage');
}
if ($this->headers->hasCacheControlDirective('max-age')) {
return (int) $this->headers->getCacheControlDirective('max-age');
}
if (NULL !== $t... | [
"public",
"function",
"getMaxAge",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"hasCacheControlDirective",
"(",
"'s-maxage'",
")",
")",
"{",
"return",
"(",
"int",
")",
"$",
"this",
"->",
"headers",
"->",
"getCacheControlDirective",
"(",
"... | Returns the number of seconds after the time specified in the response's Date
header when the response should no longer be considered fresh.
First, it checks for a s-maxage directive, then a max-age directive, and then it falls
back on an expires header. It returns null when no maximum age can be established.
@return ... | [
"Returns",
"the",
"number",
"of",
"seconds",
"after",
"the",
"time",
"specified",
"in",
"the",
"response",
"s",
"Date",
"header",
"when",
"the",
"response",
"should",
"no",
"longer",
"be",
"considered",
"fresh",
".",
"First",
"it",
"checks",
"for",
"a",
"s... | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L758-L774 |
Vectrex/vxPHP | src/Http/Response.php | Response.setEtag | public function setEtag($etag = NULL, $weak = FALSE) {
if (NULL === $etag) {
$this->headers->remove('Etag');
}
else {
if (0 !== strpos($etag, '"')) {
$etag = '"' . $etag . '"';
}
$this->headers->set('ETag', (TRUE === $weak ? 'W/' : '') . $etag);
}
return $this;
} | php | public function setEtag($etag = NULL, $weak = FALSE) {
if (NULL === $etag) {
$this->headers->remove('Etag');
}
else {
if (0 !== strpos($etag, '"')) {
$etag = '"' . $etag . '"';
}
$this->headers->set('ETag', (TRUE === $weak ? 'W/' : '') . $etag);
}
return $this;
} | [
"public",
"function",
"setEtag",
"(",
"$",
"etag",
"=",
"NULL",
",",
"$",
"weak",
"=",
"FALSE",
")",
"{",
"if",
"(",
"NULL",
"===",
"$",
"etag",
")",
"{",
"$",
"this",
"->",
"headers",
"->",
"remove",
"(",
"'Etag'",
")",
";",
"}",
"else",
"{",
... | Sets the ETag value.
@param string|null $etag The ETag unique identifier or null to remove the header
@param Boolean $weak Whether you want a weak ETag or not
@return Response | [
"Sets",
"the",
"ETag",
"value",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L901-L917 |
Vectrex/vxPHP | src/Http/Response.php | Response.setCache | public function setCache(array $options) {
if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'])) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff))));
}
if ... | php | public function setCache(array $options) {
if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'])) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff))));
}
if ... | [
"public",
"function",
"setCache",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"diff",
"=",
"array_diff",
"(",
"array_keys",
"(",
"$",
"options",
")",
",",
"[",
"'etag'",
",",
"'last_modified'",
",",
"'max_age'",
",",
"'s_maxage'",
",",
"'priv... | Sets the response's cache headers (validation and/or expiration).
Available options are: etag, last_modified, max_age, s_maxage, private, and public.
@param array $options An array of cache options
@return Response
@throws \InvalidArgumentException | [
"Sets",
"the",
"response",
"s",
"cache",
"headers",
"(",
"validation",
"and",
"/",
"or",
"expiration",
")",
".",
"Available",
"options",
"are",
":",
"etag",
"last_modified",
"max_age",
"s_maxage",
"private",
"and",
"public",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L928-L966 |
Vectrex/vxPHP | src/Http/Response.php | Response.setNotModified | public function setNotModified() {
$this->setStatusCode(self::HTTP_NOT_MODIFIED);
$this->setContent(NULL);
// remove headers that MUST NOT be included with 304 Not Modified responses
foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] a... | php | public function setNotModified() {
$this->setStatusCode(self::HTTP_NOT_MODIFIED);
$this->setContent(NULL);
// remove headers that MUST NOT be included with 304 Not Modified responses
foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] a... | [
"public",
"function",
"setNotModified",
"(",
")",
"{",
"$",
"this",
"->",
"setStatusCode",
"(",
"self",
"::",
"HTTP_NOT_MODIFIED",
")",
";",
"$",
"this",
"->",
"setContent",
"(",
"NULL",
")",
";",
"// remove headers that MUST NOT be included with 304 Not Modified resp... | Modifies the response so that it conforms to the rules defined for a 304 status code.
This sets the status, removes the body, and discards any headers
that MUST NOT be included in 304 responses.
@return Response
@see http://tools.ietf.org/html/rfc2616#section-10.3.5 | [
"Modifies",
"the",
"response",
"so",
"that",
"it",
"conforms",
"to",
"the",
"rules",
"defined",
"for",
"a",
"304",
"status",
"code",
".",
"This",
"sets",
"the",
"status",
"removes",
"the",
"body",
"and",
"discards",
"any",
"headers",
"that",
"MUST",
"NOT",... | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L977-L990 |
Vectrex/vxPHP | src/Http/Response.php | Response.getVary | public function getVary() {
if (!$vary = $this->headers->get('Vary', NULL, FALSE)) {
return [];
}
$ret = [];
foreach ($vary as $item) {
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
}
return $ret;
} | php | public function getVary() {
if (!$vary = $this->headers->get('Vary', NULL, FALSE)) {
return [];
}
$ret = [];
foreach ($vary as $item) {
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
}
return $ret;
} | [
"public",
"function",
"getVary",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"vary",
"=",
"$",
"this",
"->",
"headers",
"->",
"get",
"(",
"'Vary'",
",",
"NULL",
",",
"FALSE",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"ret",
"=",
"[",
"]",
";"... | Returns an array of header names given in the Vary header.
@return array An array of Vary names | [
"Returns",
"an",
"array",
"of",
"header",
"names",
"given",
"in",
"the",
"Vary",
"header",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L1008-L1021 |
Vectrex/vxPHP | src/Http/Response.php | Response.setVary | public function setVary($headers, $replace = TRUE) {
$this->headers->set('Vary', $headers, $replace);
return $this;
} | php | public function setVary($headers, $replace = TRUE) {
$this->headers->set('Vary', $headers, $replace);
return $this;
} | [
"public",
"function",
"setVary",
"(",
"$",
"headers",
",",
"$",
"replace",
"=",
"TRUE",
")",
"{",
"$",
"this",
"->",
"headers",
"->",
"set",
"(",
"'Vary'",
",",
"$",
"headers",
",",
"$",
"replace",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the Vary header.
@param string|array $headers
@param Boolean $replace Whether to replace the actual value of not (true by default)
@return Response | [
"Sets",
"the",
"Vary",
"header",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L1030-L1035 |
Vectrex/vxPHP | src/Http/Response.php | Response.isNotModified | public function isNotModified(Request $request) {
if (!$request->isMethodSafe()) {
return FALSE;
}
$lastModified = $request->headers->get('If-Modified-Since');
$modifiedSince = $request->headers->get('If-Modified-Since');
$notModified = FALSE;
if ($etags = $request->getETags()) {
$notModified = in_... | php | public function isNotModified(Request $request) {
if (!$request->isMethodSafe()) {
return FALSE;
}
$lastModified = $request->headers->get('If-Modified-Since');
$modifiedSince = $request->headers->get('If-Modified-Since');
$notModified = FALSE;
if ($etags = $request->getETags()) {
$notModified = in_... | [
"public",
"function",
"isNotModified",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"isMethodSafe",
"(",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"lastModified",
"=",
"$",
"request",
"->",
"headers",
"->",
"ge... | Determines if the Response validators (ETag, Last-Modified) match
a conditional value specified in the Request.
If the Response is not modified, it sets the status code to 304 and
removes the actual content by calling the setNotModified() method.
@param Request $request A Request instance
@return Boolean true if the R... | [
"Determines",
"if",
"the",
"Response",
"validators",
"(",
"ETag",
"Last",
"-",
"Modified",
")",
"match",
"a",
"conditional",
"value",
"specified",
"in",
"the",
"Request",
".",
"If",
"the",
"Response",
"is",
"not",
"modified",
"it",
"sets",
"the",
"status",
... | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L1046-L1068 |
Vectrex/vxPHP | src/Http/Response.php | Response.isRedirect | public function isRedirect($location = NULL) {
return in_array(
$this->statusCode,
[
self::HTTP_CREATED,
self::HTTP_MOVED_PERMANENTLY,
self::HTTP_FOUND,
self::HTTP_SEE_OTHER,
self::HTTP_TEMPORARY_REDIRECT,
self::HTTP_PERMANENTLY_REDIRECT
]
) && (NULL === $location ?: $loca... | php | public function isRedirect($location = NULL) {
return in_array(
$this->statusCode,
[
self::HTTP_CREATED,
self::HTTP_MOVED_PERMANENTLY,
self::HTTP_FOUND,
self::HTTP_SEE_OTHER,
self::HTTP_TEMPORARY_REDIRECT,
self::HTTP_PERMANENTLY_REDIRECT
]
) && (NULL === $location ?: $loca... | [
"public",
"function",
"isRedirect",
"(",
"$",
"location",
"=",
"NULL",
")",
"{",
"return",
"in_array",
"(",
"$",
"this",
"->",
"statusCode",
",",
"[",
"self",
"::",
"HTTP_CREATED",
",",
"self",
"::",
"HTTP_MOVED_PERMANENTLY",
",",
"self",
"::",
"HTTP_FOUND",... | Is the response a redirect of some form?
@param string $location
@return Boolean | [
"Is",
"the",
"response",
"a",
"redirect",
"of",
"some",
"form?"
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L1176-L1190 |
Vectrex/vxPHP | src/Http/Response.php | Response.ensureIEOverSSLCompatibility | protected function ensureIEOverSSLCompatibility(Request $request) {
if (
FALSE !== stripos($this->headers->get('Content-Disposition'), 'attachment') &&
preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 &&
TRUE === $request->isSecure()
) {
if (intval(preg_replace('/(MSI... | php | protected function ensureIEOverSSLCompatibility(Request $request) {
if (
FALSE !== stripos($this->headers->get('Content-Disposition'), 'attachment') &&
preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 &&
TRUE === $request->isSecure()
) {
if (intval(preg_replace('/(MSI... | [
"protected",
"function",
"ensureIEOverSSLCompatibility",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"FALSE",
"!==",
"stripos",
"(",
"$",
"this",
"->",
"headers",
"->",
"get",
"(",
"'Content-Disposition'",
")",
",",
"'attachment'",
")",
"&&",
"preg_ma... | Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9
@link http://support.microsoft.com/kb/323308 | [
"Check",
"if",
"we",
"need",
"to",
"remove",
"Cache",
"-",
"Control",
"for",
"ssl",
"encrypted",
"downloads",
"when",
"using",
"IE",
"<",
"9"
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/Response.php#L1235-L1247 |
netbull/CoreBundle | Utils/PDFLabelFormat.php | PDFLabelFormat.setOptions | public function setOptions( array $options )
{
foreach ( $this->defaults as $option => $defaults ) {
$this->values[$option] = ( array_key_exists($defaults['name'], $options) ) ? $options[$option] : $defaults['default'];
}
} | php | public function setOptions( array $options )
{
foreach ( $this->defaults as $option => $defaults ) {
$this->values[$option] = ( array_key_exists($defaults['name'], $options) ) ? $options[$option] : $defaults['default'];
}
} | [
"public",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"defaults",
"as",
"$",
"option",
"=>",
"$",
"defaults",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"$",
"option",
"]",
"=",
"(",
"array_ke... | Set options
@param array $options | [
"Set",
"options"
] | train | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PDFLabelFormat.php#L145-L150 |
netbull/CoreBundle | Utils/PDFLabelFormat.php | PDFLabelFormat.getValue | public function getValue( $field, $default = null ) {
if ( array_key_exists($field, $this->defaults) ){
switch ($this->defaults[$field]['type']) {
case self::TYPE_INT:
return (int) $this->values[$field];
case self::TYPE_FLOAT:
/... | php | public function getValue( $field, $default = null ) {
if ( array_key_exists($field, $this->defaults) ){
switch ($this->defaults[$field]['type']) {
case self::TYPE_INT:
return (int) $this->values[$field];
case self::TYPE_FLOAT:
/... | [
"public",
"function",
"getValue",
"(",
"$",
"field",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"defaults",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"defaults",
"[",
... | Get Label Format field from associative array.
@param string $field Name of a label format field.
@param null|string $default
@return float|int|mixed|null | [
"Get",
"Label",
"Format",
"field",
"from",
"associative",
"array",
"."
] | train | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PDFLabelFormat.php#L159-L176 |
netbull/CoreBundle | Utils/PDFLabelFormat.php | PDFLabelFormat.isMetric | public function isMetric( $field )
{
if ( array_key_exists($field, $this->defaults) ){
return ( isset($this->defaults[$field]['metric']) ) ? $this->defaults[$field]['metric'] : false;
}
return false;
} | php | public function isMetric( $field )
{
if ( array_key_exists($field, $this->defaults) ){
return ( isset($this->defaults[$field]['metric']) ) ? $this->defaults[$field]['metric'] : false;
}
return false;
} | [
"public",
"function",
"isMetric",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"defaults",
")",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"defaults",
"[",
"$",
"field",
"]",
... | Check if field is metric
@param $field
@return bool | [
"Check",
"if",
"field",
"is",
"metric"
] | train | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PDFLabelFormat.php#L183-L189 |
geega/php-simple-orm | src/Config.php | Config.init | public function init()
{
$host =getenv('PDO_HOST');
if($host) {
$this->setHost(trim($host));
}
$database = getenv('PDO_DATABASE');
if($database) {
$this->setDatabase(trim($database));
}
$user = getenv('PDO_USER');
if($user) {
... | php | public function init()
{
$host =getenv('PDO_HOST');
if($host) {
$this->setHost(trim($host));
}
$database = getenv('PDO_DATABASE');
if($database) {
$this->setDatabase(trim($database));
}
$user = getenv('PDO_USER');
if($user) {
... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"host",
"=",
"getenv",
"(",
"'PDO_HOST'",
")",
";",
"if",
"(",
"$",
"host",
")",
"{",
"$",
"this",
"->",
"setHost",
"(",
"trim",
"(",
"$",
"host",
")",
")",
";",
"}",
"$",
"database",
"=",
"gete... | Main init method | [
"Main",
"init",
"method"
] | train | https://github.com/geega/php-simple-orm/blob/8ef636fd181c16ee3936d630d99e232c53883447/src/Config.php#L47-L67 |
PaladinDigital/blog | database/migrations/2018_02_20_165840_create_media_table.php | CreateMediaTable.up | public function up()
{
Schema::create('media', function (Blueprint $table) {
$table->increments('id');
$table->morphs('model');
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('mime... | php | public function up()
{
Schema::create('media', function (Blueprint $table) {
$table->increments('id');
$table->morphs('model');
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('mime... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'media'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
";",
"$",
"table",
"->",
"morphs",
"(",
"'model'",
")"... | Run the migrations. | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/PaladinDigital/blog/blob/87f713f14e955b615d3f735e84773caff40750dc/database/migrations/2018_02_20_165840_create_media_table.php#L12-L28 |
fond-of/spryker-conditional-availability | src/FondOfSpryker/Client/ConditionalAvailability/Plugin/Elasticsearch/Query/ConditionalAvailabilityPingSearchQueryPlugin.php | ConditionalAvailabilityPingSearchQueryPlugin.setSearchDateTimeRange | public function setSearchDateTimeRange(DateTimeInterface $dateTimeFrom, DateTimeInterface $dateTimeUntil): void
{
$this->dateTimeFrom = $dateTimeFrom;
$this->dateTimeUntil = $dateTimeUntil;
$this->query = $this->createSearchQuery();
} | php | public function setSearchDateTimeRange(DateTimeInterface $dateTimeFrom, DateTimeInterface $dateTimeUntil): void
{
$this->dateTimeFrom = $dateTimeFrom;
$this->dateTimeUntil = $dateTimeUntil;
$this->query = $this->createSearchQuery();
} | [
"public",
"function",
"setSearchDateTimeRange",
"(",
"DateTimeInterface",
"$",
"dateTimeFrom",
",",
"DateTimeInterface",
"$",
"dateTimeUntil",
")",
":",
"void",
"{",
"$",
"this",
"->",
"dateTimeFrom",
"=",
"$",
"dateTimeFrom",
";",
"$",
"this",
"->",
"dateTimeUnti... | @param \DateTimeInterface $dateTimeFrom
@param \DateTimeInterface $dateTimeUntil
@return void | [
"@param",
"\\",
"DateTimeInterface",
"$dateTimeFrom",
"@param",
"\\",
"DateTimeInterface",
"$dateTimeUntil"
] | train | https://github.com/fond-of/spryker-conditional-availability/blob/79820697e1f310a3488cfe26b5e1af21be7c3b27/src/FondOfSpryker/Client/ConditionalAvailability/Plugin/Elasticsearch/Query/ConditionalAvailabilityPingSearchQueryPlugin.php#L72-L77 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/UsermanagementServiceProvider.php | UsermanagementServiceProvider.boot | public function boot() {
$this->setupConfiguration();
$this->setupMigrations();
$this->setupSeeds();
$this->setupRoutes($this->app->router);
$this->setupTranslations();
$this->setupViews();
$this->setupAssets();
} | php | public function boot() {
$this->setupConfiguration();
$this->setupMigrations();
$this->setupSeeds();
$this->setupRoutes($this->app->router);
$this->setupTranslations();
$this->setupViews();
$this->setupAssets();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"setupConfiguration",
"(",
")",
";",
"$",
"this",
"->",
"setupMigrations",
"(",
")",
";",
"$",
"this",
"->",
"setupSeeds",
"(",
")",
";",
"$",
"this",
"->",
"setupRoutes",
"(",
"$",
"thi... | Boot the service provider.
@return void | [
"Boot",
"the",
"service",
"provider",
"."
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/UsermanagementServiceProvider.php#L58-L72 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/UsermanagementServiceProvider.php | UsermanagementServiceProvider.registerUsermanagement | private function registerUsermanagement() {
$this->app->bind('usermanagement', function($app) {
return new Usermanagement($app);
});
$this->app->bind(
'Illuminate\Contracts\Auth\Registrar',
'Lasallecms\Usermanagement\Services\Registrar'
);
} | php | private function registerUsermanagement() {
$this->app->bind('usermanagement', function($app) {
return new Usermanagement($app);
});
$this->app->bind(
'Illuminate\Contracts\Auth\Registrar',
'Lasallecms\Usermanagement\Services\Registrar'
);
} | [
"private",
"function",
"registerUsermanagement",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'usermanagement'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Usermanagement",
"(",
"$",
"app",
")",
";",
"}",
")",
";",
"$... | Register the application bindings.
@return void | [
"Register",
"the",
"application",
"bindings",
"."
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/UsermanagementServiceProvider.php#L131-L141 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getConfig | public static function getConfig() {
$args = func_get_args();
if (count($args) === 0) {
return static::$config;
}
$except = true;
if (gettype($args[count($args) - 1]) === 'boolean') {
$except = $args[count($args) - 1];
unset($args[count($args) ... | php | public static function getConfig() {
$args = func_get_args();
if (count($args) === 0) {
return static::$config;
}
$except = true;
if (gettype($args[count($args) - 1]) === 'boolean') {
$except = $args[count($args) - 1];
unset($args[count($args) ... | [
"public",
"static",
"function",
"getConfig",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"===",
"0",
")",
"{",
"return",
"static",
"::",
"$",
"config",
";",
"}",
"$",
"except",
"=",
... | Gets (settings from) the config file
@param $_ Pass in as many params to indicate the array path to required config.
If last parameter is boolean, that will indicate whether to throw exception if required config
is not found. Defaults to TRUE.
@return mixed
@throws Exception | [
"Gets",
"(",
"settings",
"from",
")",
"the",
"config",
"file"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L31-L77 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getInject | public static function getInject($type = null) {
if ($type === null)
return static::$inject;
elseif (isset(static::$inject[$type]))
return static::$inject[$type];
return array();
} | php | public static function getInject($type = null) {
if ($type === null)
return static::$inject;
elseif (isset(static::$inject[$type]))
return static::$inject[$type];
return array();
} | [
"public",
"static",
"function",
"getInject",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"return",
"static",
"::",
"$",
"inject",
";",
"elseif",
"(",
"isset",
"(",
"static",
"::",
"$",
"inject",
"[",
"$",
"t... | Fetches classes to inject from the config
@param string $type all|controllers|services|views
@return array | [
"Fetches",
"classes",
"to",
"inject",
"from",
"the",
"config"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L84-L91 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.initDB | protected static function initDB() {
$dbConfig = static::getConfig('db', static::getServer());
static::$db = new Connection($dbConfig['dsn'], $dbConfig['user'], $dbConfig['password'], $dbConfig['options']);
static::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (!empty... | php | protected static function initDB() {
$dbConfig = static::getConfig('db', static::getServer());
static::$db = new Connection($dbConfig['dsn'], $dbConfig['user'], $dbConfig['password'], $dbConfig['options']);
static::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (!empty... | [
"protected",
"static",
"function",
"initDB",
"(",
")",
"{",
"$",
"dbConfig",
"=",
"static",
"::",
"getConfig",
"(",
"'db'",
",",
"static",
"::",
"getServer",
"(",
")",
")",
";",
"static",
"::",
"$",
"db",
"=",
"new",
"Connection",
"(",
"$",
"dbConfig",... | Creates a database connection using \DBScribe\Connection | [
"Creates",
"a",
"database",
"connection",
"using",
"\\",
"DBScribe",
"\\",
"Connection"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L108-L115 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getUrls | public static function getUrls() {
if (static::$urls !== null)
return static::$urls;
$uri = $_SERVER['REQUEST_URI'];
static::$isVirtual = true;
if (substr($uri, 0, strlen($_SERVER['SCRIPT_NAME'])) === $_SERVER['SCRIPT_NAME']) {
$uri = str_replace('/index.php', '... | php | public static function getUrls() {
if (static::$urls !== null)
return static::$urls;
$uri = $_SERVER['REQUEST_URI'];
static::$isVirtual = true;
if (substr($uri, 0, strlen($_SERVER['SCRIPT_NAME'])) === $_SERVER['SCRIPT_NAME']) {
$uri = str_replace('/index.php', '... | [
"public",
"static",
"function",
"getUrls",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"urls",
"!==",
"null",
")",
"return",
"static",
"::",
"$",
"urls",
";",
"$",
"uri",
"=",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
";",
"static",
"::",
"$",
... | Fetches the urls from the server request uri
@return array | [
"Fetches",
"the",
"urls",
"from",
"the",
"server",
"request",
"uri"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L132-L152 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.checkAlias | protected static function checkAlias($module) {
// $module alias not called
if (array_key_exists($module, static::getConfig('modules')))
return $module;
// check module alias
foreach (static::getConfig('modules') as $cModule => $moduleOptions) {
if (!array_key_ex... | php | protected static function checkAlias($module) {
// $module alias not called
if (array_key_exists($module, static::getConfig('modules')))
return $module;
// check module alias
foreach (static::getConfig('modules') as $cModule => $moduleOptions) {
if (!array_key_ex... | [
"protected",
"static",
"function",
"checkAlias",
"(",
"$",
"module",
")",
"{",
"// $module alias not called",
"if",
"(",
"array_key_exists",
"(",
"$",
"module",
",",
"static",
"::",
"getConfig",
"(",
"'modules'",
")",
")",
")",
"return",
"$",
"module",
";",
... | Checks if the module is an alias and returns the ModuleName
@param string $module
@return string | [
"Checks",
"if",
"the",
"module",
"is",
"an",
"alias",
"and",
"returns",
"the",
"ModuleName"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L177-L193 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getModuleAlias | public static function getModuleAlias($module) {
if (NULL !== $alias = static::getConfig('modules', $module, 'alias', false)) {
return $alias;
}
return Util::camelToHyphen($module);
} | php | public static function getModuleAlias($module) {
if (NULL !== $alias = static::getConfig('modules', $module, 'alias', false)) {
return $alias;
}
return Util::camelToHyphen($module);
} | [
"public",
"static",
"function",
"getModuleAlias",
"(",
"$",
"module",
")",
"{",
"if",
"(",
"NULL",
"!==",
"$",
"alias",
"=",
"static",
"::",
"getConfig",
"(",
"'modules'",
",",
"$",
"module",
",",
"'alias'",
",",
"false",
")",
")",
"{",
"return",
"$",
... | Fetches the alias for the given module
@param string $module
@return string | [
"Fetches",
"the",
"alias",
"for",
"the",
"given",
"module"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L200-L206 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getDefaultModule | public static function getDefaultModule($getAlias = false) {
if (!$module = static::getConfig('defaults', 'module', false)) {
$modules = static::getConfig('modules');
$moduleNames = array_keys($modules);
$module = $moduleNames[0];
}
return $getAlias ? static:... | php | public static function getDefaultModule($getAlias = false) {
if (!$module = static::getConfig('defaults', 'module', false)) {
$modules = static::getConfig('modules');
$moduleNames = array_keys($modules);
$module = $moduleNames[0];
}
return $getAlias ? static:... | [
"public",
"static",
"function",
"getDefaultModule",
"(",
"$",
"getAlias",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"module",
"=",
"static",
"::",
"getConfig",
"(",
"'defaults'",
",",
"'module'",
",",
"false",
")",
")",
"{",
"$",
"modules",
"=",
"st... | Fetches the default module from the config
@param boolean $getAlias Indicates whether to return the alias if available or not
@return string | [
"Fetches",
"the",
"default",
"module",
"from",
"the",
"config"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L229-L237 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getDefaultController | public static function getDefaultController($module = null, $exception = false) {
$module = ($module === null) ? static::getDefaultModule() : $module;
return static::getConfig('modules', $module, 'defaults', 'controller', $exception);
} | php | public static function getDefaultController($module = null, $exception = false) {
$module = ($module === null) ? static::getDefaultModule() : $module;
return static::getConfig('modules', $module, 'defaults', 'controller', $exception);
} | [
"public",
"static",
"function",
"getDefaultController",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"exception",
"=",
"false",
")",
"{",
"$",
"module",
"=",
"(",
"$",
"module",
"===",
"null",
")",
"?",
"static",
"::",
"getDefaultModule",
"(",
")",
":",
... | Fetches the default controller from the config
@param string $module
@param boolean $exception Indicates whether to throw an exception if not found
@return string | [
"Fetches",
"the",
"default",
"controller",
"from",
"the",
"config"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L268-L272 |
ezra-obiwale/dSCore | src/Core/Engine.php | Engine.getAction | public static function getAction($exception = true) {
$urls = static::getUrls();
if (!empty($urls) && count($urls) >= 3) {
$return = strtolower($urls[2]);
}
else {
if (!$return = static::getDefaultAction(static::getModule(), false)) {
if ($exceptio... | php | public static function getAction($exception = true) {
$urls = static::getUrls();
if (!empty($urls) && count($urls) >= 3) {
$return = strtolower($urls[2]);
}
else {
if (!$return = static::getDefaultAction(static::getModule(), false)) {
if ($exceptio... | [
"public",
"static",
"function",
"getAction",
"(",
"$",
"exception",
"=",
"true",
")",
"{",
"$",
"urls",
"=",
"static",
"::",
"getUrls",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"urls",
")",
"&&",
"count",
"(",
"$",
"urls",
")",
">=",
"3"... | Fetches the current action
@param boolean $exception Indicates whether to thrown an exception or not if not found
@return string | [
"Fetches",
"the",
"current",
"action"
] | train | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/Engine.php#L279-L293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.