repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Doctrine/DoctrineEventProxy.php | DoctrineEventProxy.registerDoctrineLazyLoader | public function registerDoctrineLazyLoader($entityClass, LazyLoaderInterface $loader)
{
if (!is_a($entityClass, LazyPropertiesInterface::class, true)) {
throw new \InvalidArgumentException(sprintf(
'Class %s has to implement %s to be able to lazy load her properties.',
... | php | public function registerDoctrineLazyLoader($entityClass, LazyLoaderInterface $loader)
{
if (!is_a($entityClass, LazyPropertiesInterface::class, true)) {
throw new \InvalidArgumentException(sprintf(
'Class %s has to implement %s to be able to lazy load her properties.',
... | [
"public",
"function",
"registerDoctrineLazyLoader",
"(",
"$",
"entityClass",
",",
"LazyLoaderInterface",
"$",
"loader",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"entityClass",
",",
"LazyPropertiesInterface",
"::",
"class",
",",
"true",
")",
")",
"{",
"throw... | Register a loader for given entity class.
@param string $entityClass
@param string $loader | [
"Register",
"a",
"loader",
"for",
"given",
"entity",
"class",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Doctrine/DoctrineEventProxy.php#L41-L52 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Doctrine/DoctrineEventProxy.php | DoctrineEventProxy.postLoad | public function postLoad(LifecycleEventArgs $event)
{
if (!$loader = $this->getLoader($entity = $event->getEntity())) {
return;
}
// global handler (deprecated)
if (isset($proxies[$loaderClass = static::class])) {
@trigger_error(
sprintf('Glob... | php | public function postLoad(LifecycleEventArgs $event)
{
if (!$loader = $this->getLoader($entity = $event->getEntity())) {
return;
}
// global handler (deprecated)
if (isset($proxies[$loaderClass = static::class])) {
@trigger_error(
sprintf('Glob... | [
"public",
"function",
"postLoad",
"(",
"LifecycleEventArgs",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"loader",
"=",
"$",
"this",
"->",
"getLoader",
"(",
"$",
"entity",
"=",
"$",
"event",
"->",
"getEntity",
"(",
")",
")",
")",
"{",
"return",
";",... | "postLoad" Doctrine event handler, notify loaders if define for given event related entity.
@param LifecycleEventArgs $event | [
"postLoad",
"Doctrine",
"event",
"handler",
"notify",
"loaders",
"if",
"define",
"for",
"given",
"event",
"related",
"entity",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Doctrine/DoctrineEventProxy.php#L87-L114 | train |
as3io/As3ModlrBundle | DependencyInjection/ServiceLoader/Persisters.php | Persisters.createConnection | private function createConnection(array $persisterConfig, $configName)
{
$options = isset($persisterConfig['parameters']['options']) && is_array($persisterConfig['parameters']['options']) ? $persisterConfig['parameters']['options'] : [];
$definition = new Definition(
'Doctrine\MongoDB\Co... | php | private function createConnection(array $persisterConfig, $configName)
{
$options = isset($persisterConfig['parameters']['options']) && is_array($persisterConfig['parameters']['options']) ? $persisterConfig['parameters']['options'] : [];
$definition = new Definition(
'Doctrine\MongoDB\Co... | [
"private",
"function",
"createConnection",
"(",
"array",
"$",
"persisterConfig",
",",
"$",
"configName",
")",
"{",
"$",
"options",
"=",
"isset",
"(",
"$",
"persisterConfig",
"[",
"'parameters'",
"]",
"[",
"'options'",
"]",
")",
"&&",
"is_array",
"(",
"$",
... | Creates the connection service definition.
@param array $persisterConfig
@param string $configName The name of the connection configuration service
@return Definition | [
"Creates",
"the",
"connection",
"service",
"definition",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoader/Persisters.php#L52-L61 | train |
as3io/As3ModlrBundle | DependencyInjection/ServiceLoader/Persisters.php | Persisters.createDataCollector | private function createDataCollector()
{
$definition = new Definition(
Utility::getBundleClass('DataCollector\MongoDb\PrettyDataCollector')
);
$definition->addTag('data_collector', ['id' => 'as3persistermongodb', 'template' => 'As3ModlrBundle:Collector:mongodb']);
$defini... | php | private function createDataCollector()
{
$definition = new Definition(
Utility::getBundleClass('DataCollector\MongoDb\PrettyDataCollector')
);
$definition->addTag('data_collector', ['id' => 'as3persistermongodb', 'template' => 'As3ModlrBundle:Collector:mongodb']);
$defini... | [
"private",
"function",
"createDataCollector",
"(",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"Utility",
"::",
"getBundleClass",
"(",
"'DataCollector\\MongoDb\\PrettyDataCollector'",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"'data_coll... | Creates the persistence data collector service definition.
@return Definition | [
"Creates",
"the",
"persistence",
"data",
"collector",
"service",
"definition",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoader/Persisters.php#L100-L108 | train |
as3io/As3ModlrBundle | DependencyInjection/ServiceLoader/Persisters.php | Persisters.createMongoDbPersister | private function createMongoDbPersister($persisterName, array $persisterConfig, ContainerBuilder $container)
{
// Storage metadata
$smfName = sprintf('%s.metadata', $persisterName);
$definition = $this->createSmf();
$container->setDefinition($smfName, $definition);
// Config... | php | private function createMongoDbPersister($persisterName, array $persisterConfig, ContainerBuilder $container)
{
// Storage metadata
$smfName = sprintf('%s.metadata', $persisterName);
$definition = $this->createSmf();
$container->setDefinition($smfName, $definition);
// Config... | [
"private",
"function",
"createMongoDbPersister",
"(",
"$",
"persisterName",
",",
"array",
"$",
"persisterConfig",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// Storage metadata",
"$",
"smfName",
"=",
"sprintf",
"(",
"'%s.metadata'",
",",
"$",
"persisterNa... | Creates the MongoDB persister service definition.
Will also load support services.
@param string $persisterName
@param array $persisterConfig
@param ContainerBuilder $container
@return Definition | [
"Creates",
"the",
"MongoDB",
"persister",
"service",
"definition",
".",
"Will",
"also",
"load",
"support",
"services",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoader/Persisters.php#L147-L189 | train |
as3io/As3ModlrBundle | DependencyInjection/ServiceLoader/Persisters.php | Persisters.createSmf | private function createSmf()
{
$definition = new Definition(
Utility::getLibraryClass('Persister\MongoDb\StorageMetadataFactory'),
[new Reference(Utility::getAliasedName('util.entity'))]
);
$definition->setPublic(false);
return $definition;
} | php | private function createSmf()
{
$definition = new Definition(
Utility::getLibraryClass('Persister\MongoDb\StorageMetadataFactory'),
[new Reference(Utility::getAliasedName('util.entity'))]
);
$definition->setPublic(false);
return $definition;
} | [
"private",
"function",
"createSmf",
"(",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"Utility",
"::",
"getLibraryClass",
"(",
"'Persister\\MongoDb\\StorageMetadataFactory'",
")",
",",
"[",
"new",
"Reference",
"(",
"Utility",
"::",
"getAliasedName",
... | Creates the storage metadata factory service definition.
@return Definition | [
"Creates",
"the",
"storage",
"metadata",
"factory",
"service",
"definition",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoader/Persisters.php#L210-L218 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.indexAction | public function indexAction()
{
$em = $this->getDoctrineManager();
$sakonninTemplates = $em->getRepository('BisonLabSakonninBundle:SakonninTemplate')->findAll();
return $this->render('BisonLabSakonninBundle:SakonninTemplate:index.html.twig',
array( 'sakonninTemplates' => $sakon... | php | public function indexAction()
{
$em = $this->getDoctrineManager();
$sakonninTemplates = $em->getRepository('BisonLabSakonninBundle:SakonninTemplate')->findAll();
return $this->render('BisonLabSakonninBundle:SakonninTemplate:index.html.twig',
array( 'sakonninTemplates' => $sakon... | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrineManager",
"(",
")",
";",
"$",
"sakonninTemplates",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'BisonLabSakonninBundle:SakonninTemplate'",
")",
"->",
"findAll",
... | Lists all sakonninTemplate entities.
@Route("/", name="sakonnintemplate_index", methods={"GET"}) | [
"Lists",
"all",
"sakonninTemplate",
"entities",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L24-L32 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.newAction | public function newAction(Request $request)
{
$sakonninTemplate = new Sakonnintemplate();
$default_lang_code = $this->container->get('translator')->getLocale();
$sakonninTemplate->setLangCode($default_lang_code);
$form = $this->createForm('BisonLab\SakonninBundle\Form\SakonninTemplat... | php | public function newAction(Request $request)
{
$sakonninTemplate = new Sakonnintemplate();
$default_lang_code = $this->container->get('translator')->getLocale();
$sakonninTemplate->setLangCode($default_lang_code);
$form = $this->createForm('BisonLab\SakonninBundle\Form\SakonninTemplat... | [
"public",
"function",
"newAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"sakonninTemplate",
"=",
"new",
"Sakonnintemplate",
"(",
")",
";",
"$",
"default_lang_code",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'translator'",
")",
"->",
... | Creates a new sakonninTemplate entity.
@Route("/new", name="sakonnintemplate_new", methods={"GET", "POST"}) | [
"Creates",
"a",
"new",
"sakonninTemplate",
"entity",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L39-L60 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.showAction | public function showAction(SakonninTemplate $sakonninTemplate)
{
$deleteForm = $this->createDeleteForm($sakonninTemplate);
return $this->render('BisonLabSakonninBundle:SakonninTemplate:show.html.twig',
array(
'sakonninTemplate' => $sakonninTemplate,
'delete_form'... | php | public function showAction(SakonninTemplate $sakonninTemplate)
{
$deleteForm = $this->createDeleteForm($sakonninTemplate);
return $this->render('BisonLabSakonninBundle:SakonninTemplate:show.html.twig',
array(
'sakonninTemplate' => $sakonninTemplate,
'delete_form'... | [
"public",
"function",
"showAction",
"(",
"SakonninTemplate",
"$",
"sakonninTemplate",
")",
"{",
"$",
"deleteForm",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"sakonninTemplate",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'BisonLabSakonninB... | Finds and displays a sakonninTemplate entity.
@Route("/{id}", name="sakonnintemplate_show", methods={"GET"}) | [
"Finds",
"and",
"displays",
"a",
"sakonninTemplate",
"entity",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L67-L76 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.editAction | public function editAction(Request $request, SakonninTemplate $sakonninTemplate)
{
$deleteForm = $this->createDeleteForm($sakonninTemplate);
$editForm = $this->createForm('BisonLab\SakonninBundle\Form\SakonninTemplateType', $sakonninTemplate);
$editForm->handleRequest($request);
if ... | php | public function editAction(Request $request, SakonninTemplate $sakonninTemplate)
{
$deleteForm = $this->createDeleteForm($sakonninTemplate);
$editForm = $this->createForm('BisonLab\SakonninBundle\Form\SakonninTemplateType', $sakonninTemplate);
$editForm->handleRequest($request);
if ... | [
"public",
"function",
"editAction",
"(",
"Request",
"$",
"request",
",",
"SakonninTemplate",
"$",
"sakonninTemplate",
")",
"{",
"$",
"deleteForm",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"sakonninTemplate",
")",
";",
"$",
"editForm",
"=",
"$",
... | Displays a form to edit an existing sakonninTemplate entity.
@Route("/{id}/edit", name="sakonnintemplate_edit", methods={"GET", "POST"}) | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"sakonninTemplate",
"entity",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L83-L101 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.deleteAction | public function deleteAction(Request $request, SakonninTemplate $sakonninTemplate)
{
$form = $this->createDeleteForm($sakonninTemplate);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrineManager();
$em->remove($sa... | php | public function deleteAction(Request $request, SakonninTemplate $sakonninTemplate)
{
$form = $this->createDeleteForm($sakonninTemplate);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrineManager();
$em->remove($sa... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"SakonninTemplate",
"$",
"sakonninTemplate",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"sakonninTemplate",
")",
";",
"$",
"form",
"->",
"handleRequest... | Deletes a sakonninTemplate entity.
@Route("/{id}", name="sakonnintemplate_delete", methods={"DELETE"}) | [
"Deletes",
"a",
"sakonninTemplate",
"entity",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L108-L120 | train |
thomasez/BisonLabSakonninBundle | Controller/SakonninTemplateController.php | SakonninTemplateController.createDeleteForm | private function createDeleteForm(SakonninTemplate $sakonninTemplate)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('sakonnintemplate_delete', array('id' => $sakonninTemplate->getId())))
->setMethod('DELETE')
->getForm()
;
} | php | private function createDeleteForm(SakonninTemplate $sakonninTemplate)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('sakonnintemplate_delete', array('id' => $sakonninTemplate->getId())))
->setMethod('DELETE')
->getForm()
;
} | [
"private",
"function",
"createDeleteForm",
"(",
"SakonninTemplate",
"$",
"sakonninTemplate",
")",
"{",
"return",
"$",
"this",
"->",
"createFormBuilder",
"(",
")",
"->",
"setAction",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'sakonnintemplate_delete'",
",",
"arr... | Creates a form to delete a sakonninTemplate entity.
@param SakonninTemplate $sakonninTemplate The sakonninTemplate entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"delete",
"a",
"sakonninTemplate",
"entity",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/Controller/SakonninTemplateController.php#L129-L136 | train |
Wedeto/DB | src/Query/JoinClause.php | JoinClause.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
$table = $drv->toSQL($params, $this->getTable());
$condition = $drv->toSQL($params, $this->getCondition());
return $this->getType() . " JOIN " . $table . " ON " . $condition;
} | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
$table = $drv->toSQL($params, $this->getTable());
$condition = $drv->toSQL($params, $this->getCondition());
return $this->getType() . " JOIN " . $table . " ON " . $condition;
} | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"drv",
"=",
"$",
"params",
"->",
"getDriver",
"(",
")",
";",
"$",
"table",
"=",
"$",
"drv",
"->",
"toSQL",
"(",
"$",
"params",
",",
"$... | Write a JOIN clause to SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param bool $inner_clause
@return string The generated SQL | [
"Write",
"a",
"JOIN",
"clause",
"to",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/JoinClause.php#L92-L98 | train |
dann95/ts3-php | TeamSpeak3/Adapter/FileTransfer.php | FileTransfer.download | public function download($ftkey, $size, $passthru = false)
{
$this->init($ftkey);
if ($passthru) {
return $this->passthru($size);
}
$buff = new String("");
$size = intval($size);
$pack = 4096;
Signal::getInstance()->emit("filetransferDownloadSta... | php | public function download($ftkey, $size, $passthru = false)
{
$this->init($ftkey);
if ($passthru) {
return $this->passthru($size);
}
$buff = new String("");
$size = intval($size);
$pack = 4096;
Signal::getInstance()->emit("filetransferDownloadSta... | [
"public",
"function",
"download",
"(",
"$",
"ftkey",
",",
"$",
"size",
",",
"$",
"passthru",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"init",
"(",
"$",
"ftkey",
")",
";",
"if",
"(",
"$",
"passthru",
")",
"{",
"return",
"$",
"this",
"->",
"passt... | Returns the content of a downloaded file as a String object.
@param string $ftkey
@param integer $size
@param boolean $passthru
@throws Ts3Exception
@return String | [
"Returns",
"the",
"content",
"of",
"a",
"downloaded",
"file",
"as",
"a",
"String",
"object",
"."
] | d4693d78b54be0177a2b5fab316c0ff9d036238d | https://github.com/dann95/ts3-php/blob/d4693d78b54be0177a2b5fab316c0ff9d036238d/TeamSpeak3/Adapter/FileTransfer.php#L141-L177 | train |
ekyna/Table | Util/ColumnSort.php | ColumnSort.isValid | static public function isValid($direction, $throw = false)
{
$valid = in_array($direction, [
static::NONE,
static::ASC,
static::DESC,
], true);
if (!$valid && $throw) {
throw new InvalidArgumentException(sprintf("The direction '%s' is not vali... | php | static public function isValid($direction, $throw = false)
{
$valid = in_array($direction, [
static::NONE,
static::ASC,
static::DESC,
], true);
if (!$valid && $throw) {
throw new InvalidArgumentException(sprintf("The direction '%s' is not vali... | [
"static",
"public",
"function",
"isValid",
"(",
"$",
"direction",
",",
"$",
"throw",
"=",
"false",
")",
"{",
"$",
"valid",
"=",
"in_array",
"(",
"$",
"direction",
",",
"[",
"static",
"::",
"NONE",
",",
"static",
"::",
"ASC",
",",
"static",
"::",
"DES... | Returns whether the given direction is valid.
@param string $direction
@param bool $throw
@return bool | [
"Returns",
"whether",
"the",
"given",
"direction",
"is",
"valid",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Util/ColumnSort.php#L27-L40 | train |
t-kanstantsin/fileupload | src/model/Container.php | Container.configure | public static function configure($object, $properties)
{
foreach ($properties as $name => $value) {
if (!property_exists($object, $name)) {
throw new InvalidConfigException(sprintf('Property %s in class %s not found.', $name, \get_class($object)));
}
$obje... | php | public static function configure($object, $properties)
{
foreach ($properties as $name => $value) {
if (!property_exists($object, $name)) {
throw new InvalidConfigException(sprintf('Property %s in class %s not found.', $name, \get_class($object)));
}
$obje... | [
"public",
"static",
"function",
"configure",
"(",
"$",
"object",
",",
"$",
"properties",
")",
"{",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"object",
",",
"$",
"n... | Configures an object with the initial property values. Inspired by Yii2.
@see \yii\BaseYii::configure
@param object $object the object to be configured
@param array $properties the property initial values given in terms of
name-value pairs.
@return object the object itself
@throws InvalidConfigException | [
"Configures",
"an",
"object",
"with",
"the",
"initial",
"property",
"values",
".",
"Inspired",
"by",
"Yii2",
"."
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/model/Container.php#L22-L32 | train |
t-kanstantsin/fileupload | src/model/Container.php | Container.createObject | public static function createObject($type)
{
if (\is_string($type)) {
return static::get($type);
} elseif (\is_array($type)) {
if (!isset($type['class'])) {
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.')... | php | public static function createObject($type)
{
if (\is_string($type)) {
return static::get($type);
} elseif (\is_array($type)) {
if (!isset($type['class'])) {
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.')... | [
"public",
"static",
"function",
"createObject",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"return",
"static",
"::",
"get",
"(",
"$",
"type",
")",
";",
"}",
"elseif",
"(",
"\\",
"is_array",
"(",
"$",
... | Creates a new object using the given configuration. Inspired by Yii2.
@see \yii\BaseYii::createObject
@param string|array $type
@return mixed
@throws InvalidConfigException
@throws \ReflectionException | [
"Creates",
"a",
"new",
"object",
"using",
"the",
"given",
"configuration",
".",
"Inspired",
"by",
"Yii2",
"."
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/model/Container.php#L42-L58 | train |
t-kanstantsin/fileupload | src/model/Container.php | Container.get | public static function get(string $class, array $config = [])
{
$reflection = new \ReflectionClass($class);
if (!$reflection->isInstantiable()) {
throw new \ReflectionException(sprintf('`%s` is not instantiable.', $reflection->name));
}
if ($reflection->implementsInterfa... | php | public static function get(string $class, array $config = [])
{
$reflection = new \ReflectionClass($class);
if (!$reflection->isInstantiable()) {
throw new \ReflectionException(sprintf('`%s` is not instantiable.', $reflection->name));
}
if ($reflection->implementsInterfa... | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"class",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"$",
"reflection",
"->",
... | Creates an instance of the specified class. Inspired by Yii2 di.
@see \yii\di\Container::build
@param string $class the class name
@param array $config configurations to be applied to the new instance
@return mixed
@throws \ReflectionException
@throws InvalidConfigException | [
"Creates",
"an",
"instance",
"of",
"the",
"specified",
"class",
".",
"Inspired",
"by",
"Yii2",
"di",
"."
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/model/Container.php#L69-L85 | train |
eureka-framework/component-password | src/Password/Password.php | Password.generate | public function generate($length = 16, $alpha = 0.6, $numeric = 0.2, $other = 0.2)
{
$chars = array();
//~ Alphabetic characters
for ($index = 0, $max = ceil($alpha * $length); $index < $max; $index++) {
if ((bool) rand(0, 1)) {
$char = rand(65, 90); // Upper
... | php | public function generate($length = 16, $alpha = 0.6, $numeric = 0.2, $other = 0.2)
{
$chars = array();
//~ Alphabetic characters
for ($index = 0, $max = ceil($alpha * $length); $index < $max; $index++) {
if ((bool) rand(0, 1)) {
$char = rand(65, 90); // Upper
... | [
"public",
"function",
"generate",
"(",
"$",
"length",
"=",
"16",
",",
"$",
"alpha",
"=",
"0.6",
",",
"$",
"numeric",
"=",
"0.2",
",",
"$",
"other",
"=",
"0.2",
")",
"{",
"$",
"chars",
"=",
"array",
"(",
")",
";",
"//~ Alphabetic characters",
"for",
... | Generate password of given length.
@param int $length
@param float $alpha % alphabetic chars.
@param float $numeric % of numeric chars
@param float $other % of other chars
@return self | [
"Generate",
"password",
"of",
"given",
"length",
"."
] | 1eed8c97531e64a7bd6f7f58625a684b1dce34c5 | https://github.com/eureka-framework/component-password/blob/1eed8c97531e64a7bd6f7f58625a684b1dce34c5/src/Password/Password.php#L48-L96 | train |
itkg/core | src/Itkg/Core/Command/DatabaseListCommand.php | DatabaseListCommand.configureOptions | protected function configureOptions(InputInterface $input)
{
if ($input->getOption('path')) {
$this->finder->setPath($input->getOption('path'));
$this->locator->setParams(array('path' => $input->getOption('path')));
}
} | php | protected function configureOptions(InputInterface $input)
{
if ($input->getOption('path')) {
$this->finder->setPath($input->getOption('path'));
$this->locator->setParams(array('path' => $input->getOption('path')));
}
} | [
"protected",
"function",
"configureOptions",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'path'",
")",
")",
"{",
"$",
"this",
"->",
"finder",
"->",
"setPath",
"(",
"$",
"input",
"->",
"getOption",
"(",... | Configure input options
@param InputInterface $input | [
"Configure",
"input",
"options"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseListCommand.php#L119-L125 | train |
itkg/core | src/Itkg/Core/Command/DatabaseListCommand.php | DatabaseListCommand.display | protected function display(OutputInterface $output, array $rows = array(), array $failed = array())
{
$this->getApplication()->getHelperSet()->get('table')
->setHeaders(array('Name', 'Scripts', 'Rollbacks', 'Status'))
->setRows($rows)
->render($output);
if (!empt... | php | protected function display(OutputInterface $output, array $rows = array(), array $failed = array())
{
$this->getApplication()->getHelperSet()->get('table')
->setHeaders(array('Name', 'Scripts', 'Rollbacks', 'Status'))
->setRows($rows)
->render($output);
if (!empt... | [
"protected",
"function",
"display",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"rows",
"=",
"array",
"(",
")",
",",
"array",
"$",
"failed",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"getApplication",
"(",
")",
"->",
"getHelper... | Display result as a table
@param OutputInterface $output
@param array $rows | [
"Display",
"result",
"as",
"a",
"table"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseListCommand.php#L133-L143 | train |
hiqdev/minii-helpers | src/BaseUrl.php | BaseUrl.toRoute | public static function toRoute($route, $scheme = false)
{
$route = (array) $route;
$route[0] = static::normalizeRoute($route[0]);
if ($scheme) {
return Yii::$app->getUrlManager()->createAbsoluteUrl($route, is_string($scheme) ? $scheme : null);
} else {
return... | php | public static function toRoute($route, $scheme = false)
{
$route = (array) $route;
$route[0] = static::normalizeRoute($route[0]);
if ($scheme) {
return Yii::$app->getUrlManager()->createAbsoluteUrl($route, is_string($scheme) ? $scheme : null);
} else {
return... | [
"public",
"static",
"function",
"toRoute",
"(",
"$",
"route",
",",
"$",
"scheme",
"=",
"false",
")",
"{",
"$",
"route",
"=",
"(",
"array",
")",
"$",
"route",
";",
"$",
"route",
"[",
"0",
"]",
"=",
"static",
"::",
"normalizeRoute",
"(",
"$",
"route"... | Creates a URL for the given route.
This method will use [[\yii\web\UrlManager]] to create a URL.
You may specify the route as a string, e.g., `site/index`. You may also use an array
if you want to specify additional query parameters for the URL being created. The
array format must be:
```php
// generates: /index.php... | [
"Creates",
"a",
"URL",
"for",
"the",
"given",
"route",
"."
] | 001b7a56a6ebdc432c4683fe47c00a913f8e57d7 | https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseUrl.php#L88-L98 | train |
hiqdev/minii-helpers | src/BaseUrl.php | BaseUrl.to | public static function to($url = '', $scheme = false)
{
if (is_array($url)) {
return static::toRoute($url, $scheme);
}
$url = Yii::getAlias($url);
if ($url === '') {
$url = Yii::$app->getRequest()->getUrl();
}
if (!$scheme) {
retu... | php | public static function to($url = '', $scheme = false)
{
if (is_array($url)) {
return static::toRoute($url, $scheme);
}
$url = Yii::getAlias($url);
if ($url === '') {
$url = Yii::$app->getRequest()->getUrl();
}
if (!$scheme) {
retu... | [
"public",
"static",
"function",
"to",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"scheme",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"url",
")",
")",
"{",
"return",
"static",
"::",
"toRoute",
"(",
"$",
"url",
",",
"$",
"scheme",
")",
... | Creates a URL based on the given parameters.
This method is very similar to [[toRoute()]]. The only difference is that this method
requires a route to be specified as an array only. If a string is given, it will be treated as a URL.
In particular, if `$url` is
- an array: [[toRoute()]] will be called to generate the ... | [
"Creates",
"a",
"URL",
"based",
"on",
"the",
"given",
"parameters",
"."
] | 001b7a56a6ebdc432c4683fe47c00a913f8e57d7 | https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseUrl.php#L199-L230 | train |
Hnto/nuki | src/Handlers/Repository/RepositoryHandler.php | RepositoryHandler.buildRepository | public function buildRepository(string $key) {
$repositoryInfo = $this->get($key);
if (is_null($repositoryInfo)) {
throw new \Nuki\Exceptions\Base(vsprintf('%1$s is not a registered repository', [$key]));
}
$this->validate($repositoryInfo, $key);
$repository = new $repositoryInfo['Locatio... | php | public function buildRepository(string $key) {
$repositoryInfo = $this->get($key);
if (is_null($repositoryInfo)) {
throw new \Nuki\Exceptions\Base(vsprintf('%1$s is not a registered repository', [$key]));
}
$this->validate($repositoryInfo, $key);
$repository = new $repositoryInfo['Locatio... | [
"public",
"function",
"buildRepository",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"repositoryInfo",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"repositoryInfo",
")",
")",
"{",
"throw",
"new",
"\\",
"Nuk... | Build a repository by its key and additional options
@param string $key
@return \Nuki\Skeletons\Providers\Repository
@throws Base | [
"Build",
"a",
"repository",
"by",
"its",
"key",
"and",
"additional",
"options"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Repository/RepositoryHandler.php#L57-L69 | train |
Hnto/nuki | src/Handlers/Repository/RepositoryHandler.php | RepositoryHandler.validate | private function validate(array $repository = [], $key) {
if (!isset($repository['Providers']) || empty($repository['Providers'])) {
throw new \Nuki\Exceptions\Base(vsprintf('%1$s does not have any providers', [$key]));
}
if (!class_exists($repository['Location'])) {
throw new \Nuki\Excepti... | php | private function validate(array $repository = [], $key) {
if (!isset($repository['Providers']) || empty($repository['Providers'])) {
throw new \Nuki\Exceptions\Base(vsprintf('%1$s does not have any providers', [$key]));
}
if (!class_exists($repository['Location'])) {
throw new \Nuki\Excepti... | [
"private",
"function",
"validate",
"(",
"array",
"$",
"repository",
"=",
"[",
"]",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"repository",
"[",
"'Providers'",
"]",
")",
"||",
"empty",
"(",
"$",
"repository",
"[",
"'Providers'",
"]... | Validate repository info
@param array $repository
@throws \Nuki\Exceptions\Base | [
"Validate",
"repository",
"info"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Repository/RepositoryHandler.php#L77-L85 | train |
eureka-framework/component-database | src/Database/Database.php | Database.getConnection | public function getConnection($name = null)
{
if ($name === null) {
reset($this->config);
$name = key($this->config);
}
if (!isset($this->config[$name])) {
throw new \Exception('Configuration name does not exists !');
}
if (!isset($this->... | php | public function getConnection($name = null)
{
if ($name === null) {
reset($this->config);
$name = key($this->config);
}
if (!isset($this->config[$name])) {
throw new \Exception('Configuration name does not exists !');
}
if (!isset($this->... | [
"public",
"function",
"getConnection",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"config",
")",
";",
"$",
"name",
"=",
"key",
"(",
"$",
"this",
"->",
"config",
")",
... | Create or get existing connection.
@param string $name
@return \PDO
@throws \Exception | [
"Create",
"or",
"get",
"existing",
"connection",
"."
] | a8a44d8ecff5f692be968205cf2c520643344b5d | https://github.com/eureka-framework/component-database/blob/a8a44d8ecff5f692be968205cf2c520643344b5d/src/Database/Database.php#L95-L122 | train |
eureka-framework/component-database | src/Database/Database.php | Database.getPDO | protected function getPDO($name)
{
if (!isset($this->config[$name]) || !is_array($this->config[$name])) {
throw new \Exception('Config not found ! (config: ' . $name . ')');
}
$config = $this->config[$name];
if (!isset($config['dsn'])) {
throw new \Exception... | php | protected function getPDO($name)
{
if (!isset($this->config[$name]) || !is_array($this->config[$name])) {
throw new \Exception('Config not found ! (config: ' . $name . ')');
}
$config = $this->config[$name];
if (!isset($config['dsn'])) {
throw new \Exception... | [
"protected",
"function",
"getPDO",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"name",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"name",
"]",
")",
")",
"{",... | Create new PDO connection
@param string $name Config name
@return \PDO
@throws \Exception | [
"Create",
"new",
"PDO",
"connection"
] | a8a44d8ecff5f692be968205cf2c520643344b5d | https://github.com/eureka-framework/component-database/blob/a8a44d8ecff5f692be968205cf2c520643344b5d/src/Database/Database.php#L131-L164 | train |
MBHFramework/mbh-rest | Mbh/Container.php | Container.registerDefaultServices | private function registerDefaultServices($userSettings)
{
$defaultSettings = $this->defaultSettings;
/**
* This service MUST return an array or an
* instance of ArrayAccess.
*
* @return array|ArrayAccess
*/
$this['settings'] = function () use ($u... | php | private function registerDefaultServices($userSettings)
{
$defaultSettings = $this->defaultSettings;
/**
* This service MUST return an array or an
* instance of ArrayAccess.
*
* @return array|ArrayAccess
*/
$this['settings'] = function () use ($u... | [
"private",
"function",
"registerDefaultServices",
"(",
"$",
"userSettings",
")",
"{",
"$",
"defaultSettings",
"=",
"$",
"this",
"->",
"defaultSettings",
";",
"/**\n * This service MUST return an array or an\n * instance of ArrayAccess.\n *\n * @return ... | This function registers the default services that Mbh needs to work.
All services are shared - that is, they are registered such that the
same instance is returned on subsequent calls.
@param array $userSettings Associative array of application settings
@return void | [
"This",
"function",
"registers",
"the",
"default",
"services",
"that",
"Mbh",
"needs",
"to",
"work",
"."
] | e23b4e66dc2b8da35e06312dcfdba41c4cfc2c83 | https://github.com/MBHFramework/mbh-rest/blob/e23b4e66dc2b8da35e06312dcfdba41c4cfc2c83/Mbh/Container.php#L69-L85 | train |
imsamurai/CakePHP-AdvancedShell | Console/Command/Task/Scheduled/ScheduleSplitter.php | ScheduleSplitter.splitInner | public function splitInner(array $arguments = array()) {
if (is_null($this->_InnerSplitter)) {
return new ArrayIterator(array($arguments));
}
return $this->_InnerSplitter->split($arguments);
} | php | public function splitInner(array $arguments = array()) {
if (is_null($this->_InnerSplitter)) {
return new ArrayIterator(array($arguments));
}
return $this->_InnerSplitter->split($arguments);
} | [
"public",
"function",
"splitInner",
"(",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_InnerSplitter",
")",
")",
"{",
"return",
"new",
"ArrayIterator",
"(",
"array",
"(",
"$",
"arguments",
... | Returns iterator over arguments splitted by inner splitter
@param array $arguments Script arguments
@return Iterator | [
"Returns",
"iterator",
"over",
"arguments",
"splitted",
"by",
"inner",
"splitter"
] | 087d483742e2a76bee45e35b8d94957b0d20f857 | https://github.com/imsamurai/CakePHP-AdvancedShell/blob/087d483742e2a76bee45e35b8d94957b0d20f857/Console/Command/Task/Scheduled/ScheduleSplitter.php#L49-L54 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/mysqlstorage.class.php | MySQLStorage.connect | public function connect()
{
$this->link = mysql_connect($this->addr, $this->user, $this->passwd);
if ($this->link === false) {
throw new Klarna_DatabaseException(
'Failed to connect to database! ('.mysql_error().')'
);
}
} | php | public function connect()
{
$this->link = mysql_connect($this->addr, $this->user, $this->passwd);
if ($this->link === false) {
throw new Klarna_DatabaseException(
'Failed to connect to database! ('.mysql_error().')'
);
}
} | [
"public",
"function",
"connect",
"(",
")",
"{",
"$",
"this",
"->",
"link",
"=",
"mysql_connect",
"(",
"$",
"this",
"->",
"addr",
",",
"$",
"this",
"->",
"user",
",",
"$",
"this",
"->",
"passwd",
")",
";",
"if",
"(",
"$",
"this",
"->",
"link",
"==... | Establish a connection to the DB
@throws Klarna_DatabaseException If a connection could not be made
@return void | [
"Establish",
"a",
"connection",
"to",
"the",
"DB"
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/mysqlstorage.class.php#L118-L126 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/mysqlstorage.class.php | MySQLStorage.create | public function create()
{
if (!mysql_query(
"CREATE DATABASE IF NOT EXISTS `{$this->dbName}`",
$this->link
)
) {
throw new Klarna_DatabaseException(
'Failed to create! ('.mysql_error().')'
);
}
$create = mysql_... | php | public function create()
{
if (!mysql_query(
"CREATE DATABASE IF NOT EXISTS `{$this->dbName}`",
$this->link
)
) {
throw new Klarna_DatabaseException(
'Failed to create! ('.mysql_error().')'
);
}
$create = mysql_... | [
"public",
"function",
"create",
"(",
")",
"{",
"if",
"(",
"!",
"mysql_query",
"(",
"\"CREATE DATABASE IF NOT EXISTS `{$this->dbName}`\"",
",",
"$",
"this",
"->",
"link",
")",
")",
"{",
"throw",
"new",
"Klarna_DatabaseException",
"(",
"'Failed to create! ('",
".",
... | Initialize the DB by creating the necessary database tables.
@throws Klarna_DatabaseException If tables could not be created
@return void | [
"Initialize",
"the",
"DB",
"by",
"creating",
"the",
"necessary",
"database",
"tables",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/mysqlstorage.class.php#L135-L169 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/mysqlstorage.class.php | MySQLStorage.save | public function save($uri)
{
$this->splitURI($uri);
$this->connect();
if (!is_array($this->pclasses) || count($this->pclasses) == 0) {
return;
}
foreach ($this->pclasses as $pclasses) {
foreach ($pclasses as $pclass) {
//Remove the pc... | php | public function save($uri)
{
$this->splitURI($uri);
$this->connect();
if (!is_array($this->pclasses) || count($this->pclasses) == 0) {
return;
}
foreach ($this->pclasses as $pclasses) {
foreach ($pclasses as $pclass) {
//Remove the pc... | [
"public",
"function",
"save",
"(",
"$",
"uri",
")",
"{",
"$",
"this",
"->",
"splitURI",
"(",
"$",
"uri",
")",
";",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"pclasses",
")",
"||",
"count",
... | Save pclasses to database
@param string $uri pclass uri
@throws KlarnaException
@return void | [
"Save",
"pclasses",
"to",
"database"
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/mysqlstorage.class.php#L266-L319 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/mysqlstorage.class.php | MySQLStorage.clear | public function clear($uri)
{
try {
$this->splitURI($uri);
unset($this->pclasses);
$this->connect();
mysql_query(
"DELETE FROM `{$this->dbName}`.`{$this->dbTable}`",
$this->link
);
} catch(Exception $e) {
... | php | public function clear($uri)
{
try {
$this->splitURI($uri);
unset($this->pclasses);
$this->connect();
mysql_query(
"DELETE FROM `{$this->dbName}`.`{$this->dbTable}`",
$this->link
);
} catch(Exception $e) {
... | [
"public",
"function",
"clear",
"(",
"$",
"uri",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"splitURI",
"(",
"$",
"uri",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"pclasses",
")",
";",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"mysql_query",
"("... | Clear the pclasses
@param string $uri pclass uri
@throws KlarnaException
@return void | [
"Clear",
"the",
"pclasses"
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/mysqlstorage.class.php#L329-L345 | train |
eureka-framework/component-orm | src/Orm/Console/Generator.php | Generator.help | public function help()
{
$style = new Eurekon\Style(' *** RUN - HELP ***');
Eurekon\Out::std($style->color('fg', Eurekon\Style::COLOR_GREEN)->get());
Eurekon\Out::std('');
$help = new Eurekon\Help('...', true);
$help->addArgument('', 'directory', 'Config directory to inspect... | php | public function help()
{
$style = new Eurekon\Style(' *** RUN - HELP ***');
Eurekon\Out::std($style->color('fg', Eurekon\Style::COLOR_GREEN)->get());
Eurekon\Out::std('');
$help = new Eurekon\Help('...', true);
$help->addArgument('', 'directory', 'Config directory to inspect... | [
"public",
"function",
"help",
"(",
")",
"{",
"$",
"style",
"=",
"new",
"Eurekon",
"\\",
"Style",
"(",
"' *** RUN - HELP ***'",
")",
";",
"Eurekon",
"\\",
"Out",
"::",
"std",
"(",
"$",
"style",
"->",
"color",
"(",
"'fg'",
",",
"Eurekon",
"\\",
"Style",
... | Help method.
@return void | [
"Help",
"method",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Console/Generator.php#L43-L56 | train |
eureka-framework/component-orm | src/Orm/Console/Generator.php | Generator.run | public function run()
{
$argument = Eurekon\Argument::getInstance();
$directory = (string) $argument->get('directory');
$configName = (string) $argument->get('item');
$configNamespace = (string) $argument->get('namespace', null, 'global.database');
$dbName ... | php | public function run()
{
$argument = Eurekon\Argument::getInstance();
$directory = (string) $argument->get('directory');
$configName = (string) $argument->get('item');
$configNamespace = (string) $argument->get('namespace', null, 'global.database');
$dbName ... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"argument",
"=",
"Eurekon",
"\\",
"Argument",
"::",
"getInstance",
"(",
")",
";",
"$",
"directory",
"=",
"(",
"string",
")",
"$",
"argument",
"->",
"get",
"(",
"'directory'",
")",
";",
"$",
"configName",... | Run method.
@return void | [
"Run",
"method",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Console/Generator.php#L63-L100 | train |
eureka-framework/component-orm | src/Orm/Console/Generator.php | Generator.findConfigs | protected function findConfigs($currentFile, array $data, $configName = '', $doLoadJoins = false)
{
$configs = array();
$data = $this->replace($currentFile, $data);
foreach ($data['configs'] as $name => $config) {
if (!empty($configName) && $name !== $configName) {
... | php | protected function findConfigs($currentFile, array $data, $configName = '', $doLoadJoins = false)
{
$configs = array();
$data = $this->replace($currentFile, $data);
foreach ($data['configs'] as $name => $config) {
if (!empty($configName) && $name !== $configName) {
... | [
"protected",
"function",
"findConfigs",
"(",
"$",
"currentFile",
",",
"array",
"$",
"data",
",",
"$",
"configName",
"=",
"''",
",",
"$",
"doLoadJoins",
"=",
"false",
")",
"{",
"$",
"configs",
"=",
"array",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this"... | Find configs.
@param string $currentFile
@param array $data
@param string $configName Filter on name
@param bool $doLoadJoins
@return array|Config | [
"Find",
"configs",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Console/Generator.php#L111-L137 | train |
eureka-framework/component-orm | src/Orm/Console/Generator.php | Generator.loadJoins | protected function loadJoins($currentFile, &$config, $data)
{
if (empty($config['joins']) || !is_array($config['joins'])) {
$config['joins'] = array();
return $this;
}
foreach ($config['joins'] as $joinName => &$joinConfig) {
$filename = $currentFile;
... | php | protected function loadJoins($currentFile, &$config, $data)
{
if (empty($config['joins']) || !is_array($config['joins'])) {
$config['joins'] = array();
return $this;
}
foreach ($config['joins'] as $joinName => &$joinConfig) {
$filename = $currentFile;
... | [
"protected",
"function",
"loadJoins",
"(",
"$",
"currentFile",
",",
"&",
"$",
"config",
",",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"config",
"[",
"'joins'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"config",
"[",
"'joins'",
"]",
")... | Load joined configs.
@param string $currentFile
@param array $config Current config
@param array $data Global current config data
@return self | [
"Load",
"joined",
"configs",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Console/Generator.php#L147-L168 | train |
asaokamei/ScoreSql | src/Builder/BuildWhere.php | BuildWhere.buildColRelVal | protected function buildColRelVal( $where )
{
$rel = $where[ 'rel' ];
$col = $where[ 'col' ];
$val = $where[ 'val' ];
if ( $rel == 'EQ' ) {
// EQ: equal to another column (i.e. val is an identifier.)
$val = $this->quote( $val );
$rel = '=';
... | php | protected function buildColRelVal( $where )
{
$rel = $where[ 'rel' ];
$col = $where[ 'col' ];
$val = $where[ 'val' ];
if ( $rel == 'EQ' ) {
// EQ: equal to another column (i.e. val is an identifier.)
$val = $this->quote( $val );
$rel = '=';
... | [
"protected",
"function",
"buildColRelVal",
"(",
"$",
"where",
")",
"{",
"$",
"rel",
"=",
"$",
"where",
"[",
"'rel'",
"]",
";",
"$",
"col",
"=",
"$",
"where",
"[",
"'col'",
"]",
";",
"$",
"val",
"=",
"$",
"where",
"[",
"'val'",
"]",
";",
"if",
"... | for normal case where condition, like col = val
@param array $where
@return string | [
"for",
"normal",
"case",
"where",
"condition",
"like",
"col",
"=",
"val"
] | f1fce28476629e98b3c4c1216859c7f5309de7a1 | https://github.com/asaokamei/ScoreSql/blob/f1fce28476629e98b3c4c1216859c7f5309de7a1/src/Builder/BuildWhere.php#L150-L167 | train |
kkthek/diqa-util | src/Util/Configuration/ConfigLoader.php | ConfigLoader.loadEnv | public function loadEnv() {
$ed = $this->loadEnvDefault();
$ej = $this->loadEnvJson();
if(!$ed && !$ej ) {
$msg = "No configuration files found.";
$this->error($msg);
die($msg);
}
} | php | public function loadEnv() {
$ed = $this->loadEnvDefault();
$ej = $this->loadEnvJson();
if(!$ed && !$ej ) {
$msg = "No configuration files found.";
$this->error($msg);
die($msg);
}
} | [
"public",
"function",
"loadEnv",
"(",
")",
"{",
"$",
"ed",
"=",
"$",
"this",
"->",
"loadEnvDefault",
"(",
")",
";",
"$",
"ej",
"=",
"$",
"this",
"->",
"loadEnvJson",
"(",
")",
";",
"if",
"(",
"!",
"$",
"ed",
"&&",
"!",
"$",
"ej",
")",
"{",
"$... | loads env-default.json and then env.json | [
"loads",
"env",
"-",
"default",
".",
"json",
"and",
"then",
"env",
".",
"json"
] | df35d16403b5dbf0f7570daded6cfa26814ae7e0 | https://github.com/kkthek/diqa-util/blob/df35d16403b5dbf0f7570daded6cfa26814ae7e0/src/Util/Configuration/ConfigLoader.php#L80-L89 | train |
heiglandreas/OrgHeiglFileFinder | src/FileFinder.php | FileFinder.find | public function find()
{
$this->getFileList()->clear();
foreach ($this->searchLocations as $location) {
if (! is_dir($location)) {
continue;
}
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($location));
forea... | php | public function find()
{
$this->getFileList()->clear();
foreach ($this->searchLocations as $location) {
if (! is_dir($location)) {
continue;
}
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($location));
forea... | [
"public",
"function",
"find",
"(",
")",
"{",
"$",
"this",
"->",
"getFileList",
"(",
")",
"->",
"clear",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"searchLocations",
"as",
"$",
"location",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"locat... | Do the actual searching
@return FileListInterface[] | [
"Do",
"the",
"actual",
"searching"
] | 189d15b95bec7dc186ef73681463c104831234d8 | https://github.com/heiglandreas/OrgHeiglFileFinder/blob/189d15b95bec7dc186ef73681463c104831234d8/src/FileFinder.php#L113-L130 | train |
heiglandreas/OrgHeiglFileFinder | src/FileFinder.php | FileFinder.filter | public function filter(\SPLFileInfo $file)
{
foreach ($this->filterlist as $filter) {
if (! $filter->filter($file)) {
return false;
}
}
return true;
} | php | public function filter(\SPLFileInfo $file)
{
foreach ($this->filterlist as $filter) {
if (! $filter->filter($file)) {
return false;
}
}
return true;
} | [
"public",
"function",
"filter",
"(",
"\\",
"SPLFileInfo",
"$",
"file",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filterlist",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"$",
"filter",
"->",
"filter",
"(",
"$",
"file",
")",
")",
"{",
"return... | Filter the file
@param SPLFileInfo $file
@return bool | [
"Filter",
"the",
"file"
] | 189d15b95bec7dc186ef73681463c104831234d8 | https://github.com/heiglandreas/OrgHeiglFileFinder/blob/189d15b95bec7dc186ef73681463c104831234d8/src/FileFinder.php#L139-L147 | train |
AnonymPHP/Anonym-HttpFoundation | Request.php | Request.file | public function file($name = '', $uploadDir = UPLOAD)
{
if (isset($_FILES[$name])) {
$file = new FileUpload($_FILES[$name], $uploadDir);
return $file;
} else {
throw new FileNotUploadedException(sprintf('Your %s file is not uploaded yet', $name));
}
} | php | public function file($name = '', $uploadDir = UPLOAD)
{
if (isset($_FILES[$name])) {
$file = new FileUpload($_FILES[$name], $uploadDir);
return $file;
} else {
throw new FileNotUploadedException(sprintf('Your %s file is not uploaded yet', $name));
}
} | [
"public",
"function",
"file",
"(",
"$",
"name",
"=",
"''",
",",
"$",
"uploadDir",
"=",
"UPLOAD",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_FILES",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"file",
"=",
"new",
"FileUpload",
"(",
"$",
"_FILES",
... | upload a file with input name and uplaod dir,
////////////////
$name parameter must be a string and it is has to be exists
$uploadDir must be an instance of string and it's must be a dir.
@param string $name the name of upload input
@param string $uploadDir the dir to upload file
@throws FileNotUplo... | [
"upload",
"a",
"file",
"with",
"input",
"name",
"and",
"uplaod",
"dir"
] | 943e5f40f45bc2e11a4b9e1d22c6583c31dc4317 | https://github.com/AnonymPHP/Anonym-HttpFoundation/blob/943e5f40f45bc2e11a4b9e1d22c6583c31dc4317/Request.php#L164-L172 | train |
AnonymPHP/Anonym-HttpFoundation | Request.php | Request.findDocumentRootInScriptFileName | private function findDocumentRootInScriptFileName()
{
$filename = $this->server->get('SCRIPT_FILENAME') ?: false;
if (false === $filename) {
return false;
}
$parse = explode('/', $filename);
$count = count($parse);
if ($count && $count > 1) {
... | php | private function findDocumentRootInScriptFileName()
{
$filename = $this->server->get('SCRIPT_FILENAME') ?: false;
if (false === $filename) {
return false;
}
$parse = explode('/', $filename);
$count = count($parse);
if ($count && $count > 1) {
... | [
"private",
"function",
"findDocumentRootInScriptFileName",
"(",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"server",
"->",
"get",
"(",
"'SCRIPT_FILENAME'",
")",
"?",
":",
"false",
";",
"if",
"(",
"false",
"===",
"$",
"filename",
")",
"{",
"return",... | find document root in server script filename
@return bool|string | [
"find",
"document",
"root",
"in",
"server",
"script",
"filename"
] | 943e5f40f45bc2e11a4b9e1d22c6583c31dc4317 | https://github.com/AnonymPHP/Anonym-HttpFoundation/blob/943e5f40f45bc2e11a4b9e1d22c6583c31dc4317/Request.php#L267-L283 | train |
AnonymPHP/Anonym-HttpFoundation | Request.php | Request.getBaseUri | public function getBaseUri()
{
if ('' !== $qs = $this->getQueryString()) {
$qs = '?' . $qs;
}
return $this->getSchemeAndHost() . $this->getRequestUri() . $qs;
} | php | public function getBaseUri()
{
if ('' !== $qs = $this->getQueryString()) {
$qs = '?' . $qs;
}
return $this->getSchemeAndHost() . $this->getRequestUri() . $qs;
} | [
"public",
"function",
"getBaseUri",
"(",
")",
"{",
"if",
"(",
"''",
"!==",
"$",
"qs",
"=",
"$",
"this",
"->",
"getQueryString",
"(",
")",
")",
"{",
"$",
"qs",
"=",
"'?'",
".",
"$",
"qs",
";",
"}",
"return",
"$",
"this",
"->",
"getSchemeAndHost",
... | find the scheme and request uri
@return string | [
"find",
"the",
"scheme",
"and",
"request",
"uri"
] | 943e5f40f45bc2e11a4b9e1d22c6583c31dc4317 | https://github.com/AnonymPHP/Anonym-HttpFoundation/blob/943e5f40f45bc2e11a4b9e1d22c6583c31dc4317/Request.php#L373-L380 | train |
AnonymPHP/Anonym-HttpFoundation | Request.php | Request.segment | public function segment($segment)
{
$segments = $this->segments;
return isset($segments[$segment - 1]) ? $segments[$segment - 1] : false;
} | php | public function segment($segment)
{
$segments = $this->segments;
return isset($segments[$segment - 1]) ? $segments[$segment - 1] : false;
} | [
"public",
"function",
"segment",
"(",
"$",
"segment",
")",
"{",
"$",
"segments",
"=",
"$",
"this",
"->",
"segments",
";",
"return",
"isset",
"(",
"$",
"segments",
"[",
"$",
"segment",
"-",
"1",
"]",
")",
"?",
"$",
"segments",
"[",
"$",
"segment",
"... | get url segment
@param int $segment
@return string|bool | [
"get",
"url",
"segment"
] | 943e5f40f45bc2e11a4b9e1d22c6583c31dc4317 | https://github.com/AnonymPHP/Anonym-HttpFoundation/blob/943e5f40f45bc2e11a4b9e1d22c6583c31dc4317/Request.php#L455-L460 | train |
dms-org/common.structure | src/DateTime/DateTime.php | DateTime.inTimezone | public function inTimezone(string $timeZoneId) : TimezonedDateTime
{
return new TimezonedDateTime(
\DateTimeImmutable::createFromFormat(
self::DISPLAY_FORMAT,
$this->format(self::DISPLAY_FORMAT),
new \DateTimeZone($timeZ... | php | public function inTimezone(string $timeZoneId) : TimezonedDateTime
{
return new TimezonedDateTime(
\DateTimeImmutable::createFromFormat(
self::DISPLAY_FORMAT,
$this->format(self::DISPLAY_FORMAT),
new \DateTimeZone($timeZ... | [
"public",
"function",
"inTimezone",
"(",
"string",
"$",
"timeZoneId",
")",
":",
"TimezonedDateTime",
"{",
"return",
"new",
"TimezonedDateTime",
"(",
"\\",
"DateTimeImmutable",
"::",
"createFromFormat",
"(",
"self",
"::",
"DISPLAY_FORMAT",
",",
"$",
"this",
"->",
... | Returns the current date time as if it were in the supplied timezone
@param string $timeZoneId
@return TimezonedDateTime | [
"Returns",
"the",
"current",
"date",
"time",
"as",
"if",
"it",
"were",
"in",
"the",
"supplied",
"timezone"
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/DateTime.php#L153-L162 | train |
enikeishik/ufoframework | src/Ufo/Modules/View.php | View.render | public function render(): string
{
$obLevel = ob_get_level();
ob_start();
extract($this->data);
$templatesPath = $this->config->projectPath . $this->config->templatesPath;
$package = '';
$template = $this->template;
if (!empty($this->section-... | php | public function render(): string
{
$obLevel = ob_get_level();
ob_start();
extract($this->data);
$templatesPath = $this->config->projectPath . $this->config->templatesPath;
$package = '';
$template = $this->template;
if (!empty($this->section-... | [
"public",
"function",
"render",
"(",
")",
":",
"string",
"{",
"$",
"obLevel",
"=",
"ob_get_level",
"(",
")",
";",
"ob_start",
"(",
")",
";",
"extract",
"(",
"$",
"this",
"->",
"data",
")",
";",
"$",
"templatesPath",
"=",
"$",
"this",
"->",
"config",
... | Generate output.
@return string | [
"Generate",
"output",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/View.php#L129-L163 | train |
enikeishik/ufoframework | src/Ufo/Modules/View.php | View.findTemplate | protected function findTemplate(string $templatesPath, string $package, string $templateName): string
{
if (!empty($package)) {
// /templates/default/vendor/module/template.php
$templatePath =
$templatesPath .
$this->config->templatesDefault .
... | php | protected function findTemplate(string $templatesPath, string $package, string $templateName): string
{
if (!empty($package)) {
// /templates/default/vendor/module/template.php
$templatePath =
$templatesPath .
$this->config->templatesDefault .
... | [
"protected",
"function",
"findTemplate",
"(",
"string",
"$",
"templatesPath",
",",
"string",
"$",
"package",
",",
"string",
"$",
"templateName",
")",
":",
"string",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"package",
")",
")",
"{",
"// /templates/default/vend... | Find full path for requested template. Returned path may not exists.
@param string $templatesPath
@param string $package
@param string $templateName
@return string | [
"Find",
"full",
"path",
"for",
"requested",
"template",
".",
"Returned",
"path",
"may",
"not",
"exists",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/View.php#L194-L214 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Builder.php | Builder.withGlobalScope | public function withGlobalScope( $identifier, $scope )
{
$this->scopes[$identifier] = $scope;
if ( method_exists( $scope, 'extend' ) )
$scope->extend( $this );
return $this;
} | php | public function withGlobalScope( $identifier, $scope )
{
$this->scopes[$identifier] = $scope;
if ( method_exists( $scope, 'extend' ) )
$scope->extend( $this );
return $this;
} | [
"public",
"function",
"withGlobalScope",
"(",
"$",
"identifier",
",",
"$",
"scope",
")",
"{",
"$",
"this",
"->",
"scopes",
"[",
"$",
"identifier",
"]",
"=",
"$",
"scope",
";",
"if",
"(",
"method_exists",
"(",
"$",
"scope",
",",
"'extend'",
")",
")",
... | Register a new global scope.
@param string $identifier
@param Closure $scope
@return $this | [
"Register",
"a",
"new",
"global",
"scope",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Builder.php#L100-L108 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Builder.php | Builder.whereCountQuery | protected function whereCountQuery( QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and' )
{
if ( is_numeric( $count ) )
{
$count = new Expression( $count );
}
$this->query->addBinding( $query->getBindings(), 'where' );
return $this->where( new Expression( '(' . $query->toSql() . ')' ), $... | php | protected function whereCountQuery( QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and' )
{
if ( is_numeric( $count ) )
{
$count = new Expression( $count );
}
$this->query->addBinding( $query->getBindings(), 'where' );
return $this->where( new Expression( '(' . $query->toSql() . ')' ), $... | [
"protected",
"function",
"whereCountQuery",
"(",
"QueryBuilder",
"$",
"query",
",",
"$",
"operator",
"=",
"'>='",
",",
"$",
"count",
"=",
"1",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"count",
")",
")",
"{",
"$"... | Add a sub query count clause to the query.
@param Builder $query
@param string $operator
@param int $count
@param string $boolean
@return $this | [
"Add",
"a",
"sub",
"query",
"count",
"clause",
"to",
"the",
"query",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Builder.php#L1000-L1010 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Builder.php | Builder.mergeModelDefinedRelationConstraints | public function mergeModelDefinedRelationConstraints( Builder $relation )
{
$removedScopes = $relation->removedScopes();
$relationQuery = $relation->getQuery();
// Here we have some relation query and the original relation. We need to copy over any
// where clauses that the developer may have put in the rela... | php | public function mergeModelDefinedRelationConstraints( Builder $relation )
{
$removedScopes = $relation->removedScopes();
$relationQuery = $relation->getQuery();
// Here we have some relation query and the original relation. We need to copy over any
// where clauses that the developer may have put in the rela... | [
"public",
"function",
"mergeModelDefinedRelationConstraints",
"(",
"Builder",
"$",
"relation",
")",
"{",
"$",
"removedScopes",
"=",
"$",
"relation",
"->",
"removedScopes",
"(",
")",
";",
"$",
"relationQuery",
"=",
"$",
"relation",
"->",
"getQuery",
"(",
")",
"... | Merge the constraints from a relation query to the current query.
@param Builder $relation
@return Builder|static | [
"Merge",
"the",
"constraints",
"from",
"a",
"relation",
"query",
"to",
"the",
"current",
"query",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Builder.php#L1018-L1028 | train |
bkstg/schedule-bundle | EventListener/InvitationAutoAcceptListener.php | InvitationAutoAcceptListener.prePersist | public function prePersist(LifecycleEventArgs $args): void
{
// Only act on invitation objects.
$invitation = $args->getObject();
if (!$invitation instanceof Invitation) {
return;
}
// If the event author is the invitee accept the invitation.
$event = $in... | php | public function prePersist(LifecycleEventArgs $args): void
{
// Only act on invitation objects.
$invitation = $args->getObject();
if (!$invitation instanceof Invitation) {
return;
}
// If the event author is the invitee accept the invitation.
$event = $in... | [
"public",
"function",
"prePersist",
"(",
"LifecycleEventArgs",
"$",
"args",
")",
":",
"void",
"{",
"// Only act on invitation objects.",
"$",
"invitation",
"=",
"$",
"args",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"!",
"$",
"invitation",
"instanceof",
"In... | Checks the invitation author and accepts if they match.
@param LifecycleEventArgs $args The lifecycle arguments.
@return void | [
"Checks",
"the",
"invitation",
"author",
"and",
"accepts",
"if",
"they",
"match",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/EventListener/InvitationAutoAcceptListener.php#L26-L39 | train |
mossphp/moss-storage | Moss/Storage/Query/WriteQuery.php | WriteQuery.checkIfEntityExists | protected function checkIfEntityExists()
{
$query = new ReadQuery($this->connection, $this->model, $this->factory, $this->accessor, $this->dispatcher);
foreach ($this->model->primaryFields() as $field) {
$value = $this->accessor->getPropertyValue($this->instance, $field->name());
... | php | protected function checkIfEntityExists()
{
$query = new ReadQuery($this->connection, $this->model, $this->factory, $this->accessor, $this->dispatcher);
foreach ($this->model->primaryFields() as $field) {
$value = $this->accessor->getPropertyValue($this->instance, $field->name());
... | [
"protected",
"function",
"checkIfEntityExists",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"ReadQuery",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"model",
",",
"$",
"this",
"->",
"factory",
",",
"$",
"this",
"->",
"accessor",
",",
"$"... | Returns true if entity exists database
@return int | [
"Returns",
"true",
"if",
"entity",
"exists",
"database"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/WriteQuery.php#L138-L153 | train |
joegreen88/zf1-component-validate | src/Zend/Validate/File/Size.php | Zend_Validate_File_Size.setMax | public function setMax($max)
{
if (!is_string($max) && !is_numeric($max)) {
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
$max = (integer) $this->_fromByteString($max);
$min = $this->getMin(true);
if (($min !== null) && ($max < $... | php | public function setMax($max)
{
if (!is_string($max) && !is_numeric($max)) {
throw new Zend_Validate_Exception ('Invalid options to validator provided');
}
$max = (integer) $this->_fromByteString($max);
$min = $this->getMin(true);
if (($min !== null) && ($max < $... | [
"public",
"function",
"setMax",
"(",
"$",
"max",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"max",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"max",
")",
")",
"{",
"throw",
"new",
"Zend_Validate_Exception",
"(",
"'Invalid options to validator provided'",
... | Sets the maximum filesize
@param integer $max The maximum filesize
@throws Zend_Validate_Exception When max is smaller than min
@return Zend_Validate_StringLength Provides a fluent interface | [
"Sets",
"the",
"maximum",
"filesize"
] | 88d9ea016f73d48ff0ba7d06ecbbf28951fd279e | https://github.com/joegreen88/zf1-component-validate/blob/88d9ea016f73d48ff0ba7d06ecbbf28951fd279e/src/Zend/Validate/File/Size.php#L223-L240 | train |
squareproton/Bond | src/Bond/Normality/Php.php | Php.isValid | public function isValid( &$errors = null, $throwException = false )
{
// open pipe
$descriptorSpec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
$process = proc_open('php -l', $descriptorSpec, $pipes);
... | php | public function isValid( &$errors = null, $throwException = false )
{
// open pipe
$descriptorSpec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
$process = proc_open('php -l', $descriptorSpec, $pipes);
... | [
"public",
"function",
"isValid",
"(",
"&",
"$",
"errors",
"=",
"null",
",",
"$",
"throwException",
"=",
"false",
")",
"{",
"// open pipe",
"$",
"descriptorSpec",
"=",
"array",
"(",
"0",
"=>",
"array",
"(",
"'pipe'",
",",
"'r'",
")",
",",
"1",
"=>",
"... | Run Php through lint checker
@retrun bool Is the passed php valid | [
"Run",
"Php",
"through",
"lint",
"checker"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Normality/Php.php#L42-L71 | train |
squareproton/Bond | src/Bond/Normality/Php.php | Php.varExport | public static function varExport( $var, $indent = 0, $dontIndentFirstLine = true )
{
$export = var_export( $var, true );
// array ( => array (
$export = preg_replace( '/^array \\(/', 'array(', $export );
// UPPERCASE null(s) seem to bother me for some reason. I've no idea why.
... | php | public static function varExport( $var, $indent = 0, $dontIndentFirstLine = true )
{
$export = var_export( $var, true );
// array ( => array (
$export = preg_replace( '/^array \\(/', 'array(', $export );
// UPPERCASE null(s) seem to bother me for some reason. I've no idea why.
... | [
"public",
"static",
"function",
"varExport",
"(",
"$",
"var",
",",
"$",
"indent",
"=",
"0",
",",
"$",
"dontIndentFirstLine",
"=",
"true",
")",
"{",
"$",
"export",
"=",
"var_export",
"(",
"$",
"var",
",",
"true",
")",
";",
"// array ( => array (",
"$",
... | Return a string which is a php-parsable representation of a variable
@param mixed $var
@param int $indent
@param bool $dontIndentFirstLine
@return string | [
"Return",
"a",
"string",
"which",
"is",
"a",
"php",
"-",
"parsable",
"representation",
"of",
"a",
"variable"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Normality/Php.php#L80-L107 | train |
hiqsol-attic/composer-extension-plugin | src/Helper.php | Helper.exportVar | public static function exportVar($value)
{
$closures = self::collectClosures($value);
$res = var_export($value, true);
if (!empty($closures)) {
$subs = [];
foreach ($closures as $key => $closure) {
$subs["'" . $key . "'"] = self::dumpClosure($closure);... | php | public static function exportVar($value)
{
$closures = self::collectClosures($value);
$res = var_export($value, true);
if (!empty($closures)) {
$subs = [];
foreach ($closures as $key => $closure) {
$subs["'" . $key . "'"] = self::dumpClosure($closure);... | [
"public",
"static",
"function",
"exportVar",
"(",
"$",
"value",
")",
"{",
"$",
"closures",
"=",
"self",
"::",
"collectClosures",
"(",
"$",
"value",
")",
";",
"$",
"res",
"=",
"var_export",
"(",
"$",
"value",
",",
"true",
")",
";",
"if",
"(",
"!",
"... | Returns a parsable string representation of given value.
In contrast to var_dump outputs Closures as PHP code.
@param mixed $value
@return string | [
"Returns",
"a",
"parsable",
"string",
"representation",
"of",
"given",
"value",
".",
"In",
"contrast",
"to",
"var_dump",
"outputs",
"Closures",
"as",
"PHP",
"code",
"."
] | 3e4a5384ca368f43debe277c606846e4299d2bf4 | https://github.com/hiqsol-attic/composer-extension-plugin/blob/3e4a5384ca368f43debe277c606846e4299d2bf4/src/Helper.php#L90-L103 | train |
hiqsol-attic/composer-extension-plugin | src/Helper.php | Helper.collectClosures | private static function collectClosures(&$input) {
static $closureNo = 1;
$closures = [];
if (is_array($input)) {
foreach ($input as &$value) {
if (is_array($value) || $value instanceof Closure) {
$closures = array_merge($closures, self::collectClo... | php | private static function collectClosures(&$input) {
static $closureNo = 1;
$closures = [];
if (is_array($input)) {
foreach ($input as &$value) {
if (is_array($value) || $value instanceof Closure) {
$closures = array_merge($closures, self::collectClo... | [
"private",
"static",
"function",
"collectClosures",
"(",
"&",
"$",
"input",
")",
"{",
"static",
"$",
"closureNo",
"=",
"1",
";",
"$",
"closures",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"input",
")",
")",
"{",
"foreach",
"(",
"$",
"inp... | Collects closures from given input.
Substitutes closures with a tag.
@param mixed $input will be changed
@return array array of found closures | [
"Collects",
"closures",
"from",
"given",
"input",
".",
"Substitutes",
"closures",
"with",
"a",
"tag",
"."
] | 3e4a5384ca368f43debe277c606846e4299d2bf4 | https://github.com/hiqsol-attic/composer-extension-plugin/blob/3e4a5384ca368f43debe277c606846e4299d2bf4/src/Helper.php#L111-L128 | train |
WideFocus/Feed-Writer | src/ExtractFieldLabelsTrait.php | ExtractFieldLabelsTrait.extractFieldLabels | protected function extractFieldLabels(
WriterFieldInterface ...$fields
): array {
return array_map(
function (WriterFieldInterface $field) : string {
return $field->getLabel();
},
$fields
);
} | php | protected function extractFieldLabels(
WriterFieldInterface ...$fields
): array {
return array_map(
function (WriterFieldInterface $field) : string {
return $field->getLabel();
},
$fields
);
} | [
"protected",
"function",
"extractFieldLabels",
"(",
"WriterFieldInterface",
"...",
"$",
"fields",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"WriterFieldInterface",
"$",
"field",
")",
":",
"string",
"{",
"return",
"$",
"field",
"->",
... | Extract labels from fields.
@param WriterFieldInterface[] ...$fields
@return string[] | [
"Extract",
"labels",
"from",
"fields",
"."
] | c2698394645c75db06962e5e9d638f0cabe69fe3 | https://github.com/WideFocus/Feed-Writer/blob/c2698394645c75db06962e5e9d638f0cabe69fe3/src/ExtractFieldLabelsTrait.php#L18-L27 | train |
phospr/DoubleEntryBundle | Model/VendorHandler.php | VendorHandler.createVendor | public function createVendor($name = null)
{
$vendor = new $this->vendorFqcn($name);
$vendor->setOrganization($this->oh->getOrganization());
return $vendor;
} | php | public function createVendor($name = null)
{
$vendor = new $this->vendorFqcn($name);
$vendor->setOrganization($this->oh->getOrganization());
return $vendor;
} | [
"public",
"function",
"createVendor",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"vendor",
"=",
"new",
"$",
"this",
"->",
"vendorFqcn",
"(",
"$",
"name",
")",
";",
"$",
"vendor",
"->",
"setOrganization",
"(",
"$",
"this",
"->",
"oh",
"->",
"getOrg... | Create new Vendor
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param string $name
@return Vendor | [
"Create",
"new",
"Vendor"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/VendorHandler.php#L72-L78 | train |
phospr/DoubleEntryBundle | Model/VendorHandler.php | VendorHandler.findVendorForName | public function findVendorForName($name)
{
return $this->em
->getRepository($this->vendorFqcn)
->findOneBy(array(
'name' => $name,
'organization' => $this->oh->getOrganization()
))
;
} | php | public function findVendorForName($name)
{
return $this->em
->getRepository($this->vendorFqcn)
->findOneBy(array(
'name' => $name,
'organization' => $this->oh->getOrganization()
))
;
} | [
"public",
"function",
"findVendorForName",
"(",
"$",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"$",
"this",
"->",
"vendorFqcn",
")",
"->",
"findOneBy",
"(",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'organiza... | Find Vendor for name
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param string $name
@return Vendor | [
"Find",
"Vendor",
"for",
"name"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/VendorHandler.php#L90-L99 | train |
phospr/DoubleEntryBundle | Model/VendorHandler.php | VendorHandler.findVendorForSlug | public function findVendorForSlug($slug)
{
return $this->em
->getRepository($this->vendorFqcn)
->findOneBy(array(
'slug' => $slug,
'organization' => $this->oh->getOrganization()
))
;
} | php | public function findVendorForSlug($slug)
{
return $this->em
->getRepository($this->vendorFqcn)
->findOneBy(array(
'slug' => $slug,
'organization' => $this->oh->getOrganization()
))
;
} | [
"public",
"function",
"findVendorForSlug",
"(",
"$",
"slug",
")",
"{",
"return",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"$",
"this",
"->",
"vendorFqcn",
")",
"->",
"findOneBy",
"(",
"array",
"(",
"'slug'",
"=>",
"$",
"slug",
",",
"'organiza... | Find Vendor for slug
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param string $slug
@return Vendor | [
"Find",
"Vendor",
"for",
"slug"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/VendorHandler.php#L111-L120 | train |
johnkrovitch/Sam | Filter/Compass/CompassFilter.php | CompassFilter.run | public function run(array $sources, array $destinations)
{
$updatedSources = [];
foreach ($sources as $source) {
// remove .scss extension and add .css extension
$css = $this->getCacheDir().$source->getBasename('.scss').'.css';
$this->addNotification('compiling '... | php | public function run(array $sources, array $destinations)
{
$updatedSources = [];
foreach ($sources as $source) {
// remove .scss extension and add .css extension
$css = $this->getCacheDir().$source->getBasename('.scss').'.css';
$this->addNotification('compiling '... | [
"public",
"function",
"run",
"(",
"array",
"$",
"sources",
",",
"array",
"$",
"destinations",
")",
"{",
"$",
"updatedSources",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sources",
"as",
"$",
"source",
")",
"{",
"// remove .scss extension and add .css extension"... | Compile scss file into css file via compass.
@param SplFileInfo[] $sources
@param SplFileInfo[] $destinations
@return SplFileInfo[]
@throws Exception | [
"Compile",
"scss",
"file",
"into",
"css",
"file",
"via",
"compass",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Compass/CompassFilter.php#L20-L49 | train |
johnkrovitch/Sam | Filter/Compass/CompassFilter.php | CompassFilter.checkRequirements | public function checkRequirements()
{
$process = new Process($this->getBin().' version');
$process->run();
if (!$process->isSuccessful()) {
throw new Exception('compass is not found at '.$this->getBin().'. '.$process->getErrorOutput());
}
} | php | public function checkRequirements()
{
$process = new Process($this->getBin().' version');
$process->run();
if (!$process->isSuccessful()) {
throw new Exception('compass is not found at '.$this->getBin().'. '.$process->getErrorOutput());
}
} | [
"public",
"function",
"checkRequirements",
"(",
")",
"{",
"$",
"process",
"=",
"new",
"Process",
"(",
"$",
"this",
"->",
"getBin",
"(",
")",
".",
"' version'",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"process",
"-... | Check that compass is installed and available.
@throws Exception | [
"Check",
"that",
"compass",
"is",
"installed",
"and",
"available",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Compass/CompassFilter.php#L56-L64 | train |
johnkrovitch/Sam | Filter/Compass/CompassFilter.php | CompassFilter.buildCommandString | protected function buildCommandString($source)
{
$commandPattern = '%s %s %s %s %s';
$command = sprintf(
// pattern
$commandPattern,
// compass binary path
$this->getBin(),
// compass command
'compile',
// sources
... | php | protected function buildCommandString($source)
{
$commandPattern = '%s %s %s %s %s';
$command = sprintf(
// pattern
$commandPattern,
// compass binary path
$this->getBin(),
// compass command
'compile',
// sources
... | [
"protected",
"function",
"buildCommandString",
"(",
"$",
"source",
")",
"{",
"$",
"commandPattern",
"=",
"'%s %s %s %s %s'",
";",
"$",
"command",
"=",
"sprintf",
"(",
"// pattern",
"$",
"commandPattern",
",",
"// compass binary path",
"$",
"this",
"->",
"getBin",
... | Build the compass compile command line.
@param SplFileInfo $source
@return string | [
"Build",
"the",
"compass",
"compile",
"command",
"line",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Compass/CompassFilter.php#L96-L115 | train |
aztech-labs/skwal | src/Table.php | Table.getColumn | public function getColumn($name, $alias = '')
{
$column = new DerivedColumn($name, $alias);
return $column->setTable($this);
} | php | public function getColumn($name, $alias = '')
{
$column = new DerivedColumn($name, $alias);
return $column->setTable($this);
} | [
"public",
"function",
"getColumn",
"(",
"$",
"name",
",",
"$",
"alias",
"=",
"''",
")",
"{",
"$",
"column",
"=",
"new",
"DerivedColumn",
"(",
"$",
"name",
",",
"$",
"alias",
")",
";",
"return",
"$",
"column",
"->",
"setTable",
"(",
"$",
"this",
")"... | Returns a column object correlated to the current table.
@param string $name
Name of the column to return.
@param string $alias
Alias to use on the column.
@return DerivedColumn | [
"Returns",
"a",
"column",
"object",
"correlated",
"to",
"the",
"current",
"table",
"."
] | cf637c5ddb69f6579ba28a61af9c39639081dc16 | https://github.com/aztech-labs/skwal/blob/cf637c5ddb69f6579ba28a61af9c39639081dc16/src/Table.php#L94-L99 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.getAllRecords | public function getAllRecords()
{
/* @var DataObject $recordType */
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canView();
});
return new PaginatedList($all, $this->request);
} | php | public function getAllRecords()
{
/* @var DataObject $recordType */
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canView();
});
return new PaginatedList($all, $this->request);
} | [
"public",
"function",
"getAllRecords",
"(",
")",
"{",
"/* @var DataObject $recordType */",
"$",
"recordType",
"=",
"$",
"this",
"->",
"getRecordType",
"(",
")",
";",
"$",
"all",
"=",
"$",
"recordType",
"::",
"get",
"(",
")",
"->",
"filterByCallBack",
"(",
"f... | Gets all the records and returns them, paginated
@return PaginatedList
@throws \Exception | [
"Gets",
"all",
"the",
"records",
"and",
"returns",
"them",
"paginated"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L163-L172 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.getEditableRecords | public function getEditableRecords()
{
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canEdit();
});
return new PaginatedList($all, $this->request);
} | php | public function getEditableRecords()
{
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canEdit();
});
return new PaginatedList($all, $this->request);
} | [
"public",
"function",
"getEditableRecords",
"(",
")",
"{",
"$",
"recordType",
"=",
"$",
"this",
"->",
"getRecordType",
"(",
")",
";",
"$",
"all",
"=",
"$",
"recordType",
"::",
"get",
"(",
")",
"->",
"filterByCallBack",
"(",
"function",
"(",
"DataObject",
... | Gets all editable records and returns them, paginated
@return PaginatedList
@throws \Exception | [
"Gets",
"all",
"editable",
"records",
"and",
"returns",
"them",
"paginated"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L180-L188 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.create_new | public function create_new($request)
{
if (!$this->canCreate()) {
return $this->httpError(403, "You do not have permission to create new " . $this->getPluralName());
}
$this->addCrumb('Create new ' . $this->getSingularName());
return $this->customise(['Form' => $this->Cre... | php | public function create_new($request)
{
if (!$this->canCreate()) {
return $this->httpError(403, "You do not have permission to create new " . $this->getPluralName());
}
$this->addCrumb('Create new ' . $this->getSingularName());
return $this->customise(['Form' => $this->Cre... | [
"public",
"function",
"create_new",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"canCreate",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"403",
",",
"\"You do not have permission to create new \"",
".",
"$",
"th... | URL method to create a new record
@param HTTPRequest $request
@return \SilverStripe\View\ViewableData_Customised|void
@throws HTTPResponse_Exception | [
"URL",
"method",
"to",
"create",
"a",
"new",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L241-L248 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.CreationForm | public function CreationForm()
{
/** @var FieldList $fields */
$fields = singleton($this->getRecordType())->getFrontEndFields();
$fields->push(new HiddenField('ID'));
$form = new Form(
$this,
'CreationForm',
$fields,
new FieldList(
... | php | public function CreationForm()
{
/** @var FieldList $fields */
$fields = singleton($this->getRecordType())->getFrontEndFields();
$fields->push(new HiddenField('ID'));
$form = new Form(
$this,
'CreationForm',
$fields,
new FieldList(
... | [
"public",
"function",
"CreationForm",
"(",
")",
"{",
"/** @var FieldList $fields */",
"$",
"fields",
"=",
"singleton",
"(",
"$",
"this",
"->",
"getRecordType",
"(",
")",
")",
"->",
"getFrontEndFields",
"(",
")",
";",
"$",
"fields",
"->",
"push",
"(",
"new",
... | Scaffolds a form for creating managed data types
@return Form | [
"Scaffolds",
"a",
"form",
"for",
"creating",
"managed",
"data",
"types"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L295-L309 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.doSave | public function doSave($data, $form)
{
$recordType = $this->getRecordType();
$record = $recordType::create();
$form->saveInto($record);
$record->write();
$this->redirect($this->Link());
} | php | public function doSave($data, $form)
{
$recordType = $this->getRecordType();
$record = $recordType::create();
$form->saveInto($record);
$record->write();
$this->redirect($this->Link());
} | [
"public",
"function",
"doSave",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"recordType",
"=",
"$",
"this",
"->",
"getRecordType",
"(",
")",
";",
"$",
"record",
"=",
"$",
"recordType",
"::",
"create",
"(",
")",
";",
"$",
"form",
"->",
"saveI... | Function for saving the form | [
"Function",
"for",
"saving",
"the",
"form"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L314-L321 | train |
twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.AlphabetPages | public function AlphabetPages()
{
$query = new SQLSelect();
$pages = new ArrayList();
$sortOn = $this->config()->sort_on;
//Build an SQL query to get all the letters that people start with
$query->select(array("Left($sortOn, 1) AS Letter"));
$query->from($this->getRe... | php | public function AlphabetPages()
{
$query = new SQLSelect();
$pages = new ArrayList();
$sortOn = $this->config()->sort_on;
//Build an SQL query to get all the letters that people start with
$query->select(array("Left($sortOn, 1) AS Letter"));
$query->from($this->getRe... | [
"public",
"function",
"AlphabetPages",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"SQLSelect",
"(",
")",
";",
"$",
"pages",
"=",
"new",
"ArrayList",
"(",
")",
";",
"$",
"sortOn",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"sort_on",
";",
"//Bu... | Generates a ArrayList of anonymous objects that can be used
to create an alphabet menu for all the items, linking only
when there are items begining with the letter, and providing
an indication of whether it is currently selected or not
@return ArrayList | [
"Generates",
"a",
"ArrayList",
"of",
"anonymous",
"objects",
"that",
"can",
"be",
"used",
"to",
"create",
"an",
"alphabet",
"menu",
"for",
"all",
"the",
"items",
"linking",
"only",
"when",
"there",
"are",
"items",
"begining",
"with",
"the",
"letter",
"and",
... | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L390-L457 | train |
rawphp/RawSession | src/RawPHP/RawSession/Session.php | Session.removeHandler | public function removeHandler( IHandler $handler = NULL )
{
if ( NULL !== $handler && $this->handler == $handler )
{
$this->handler = NULL;
}
else
{
$this->handler = NULL;
}
} | php | public function removeHandler( IHandler $handler = NULL )
{
if ( NULL !== $handler && $this->handler == $handler )
{
$this->handler = NULL;
}
else
{
$this->handler = NULL;
}
} | [
"public",
"function",
"removeHandler",
"(",
"IHandler",
"$",
"handler",
"=",
"NULL",
")",
"{",
"if",
"(",
"NULL",
"!==",
"$",
"handler",
"&&",
"$",
"this",
"->",
"handler",
"==",
"$",
"handler",
")",
"{",
"$",
"this",
"->",
"handler",
"=",
"NULL",
";... | Remove a handler from the session.
@param IHandler $handler | [
"Remove",
"a",
"handler",
"from",
"the",
"session",
"."
] | 1e410e1def1d6d61acfade3bd31478464c70aea3 | https://github.com/rawphp/RawSession/blob/1e410e1def1d6d61acfade3bd31478464c70aea3/src/RawPHP/RawSession/Session.php#L281-L291 | train |
praxigento/mobi_mod_pv | Service/Batch/Transfer/Save.php | Save.readCsv | private function readCsv($fullPath)
{
$result = [];
$entries = $this->hlpCsv->read($fullPath);
foreach ($entries as $one) {
$i=0;
$fromId = $one[$i++];
$fromName = $one[$i++];
$toId = $one[$i++];
$toName = $one[$i++];
$v... | php | private function readCsv($fullPath)
{
$result = [];
$entries = $this->hlpCsv->read($fullPath);
foreach ($entries as $one) {
$i=0;
$fromId = $one[$i++];
$fromName = $one[$i++];
$toId = $one[$i++];
$toName = $one[$i++];
$v... | [
"private",
"function",
"readCsv",
"(",
"$",
"fullPath",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"entries",
"=",
"$",
"this",
"->",
"hlpCsv",
"->",
"read",
"(",
"$",
"fullPath",
")",
";",
"foreach",
"(",
"$",
"entries",
"as",
"$",
"one",
... | Read & parse CSV file.
@param string $fullPath
@return DItem[] | [
"Read",
"&",
"parse",
"CSV",
"file",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save.php#L54-L73 | train |
cubicmushroom/valueobjects | src/Money/Money.php | Money.fromNative | public static function fromNative()
{
$args = func_get_args();
$amount = new Integer($args[0]);
$currency = Currency::fromNative($args[1]);
return new static($amount, $currency);
} | php | public static function fromNative()
{
$args = func_get_args();
$amount = new Integer($args[0]);
$currency = Currency::fromNative($args[1]);
return new static($amount, $currency);
} | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"amount",
"=",
"new",
"Integer",
"(",
"$",
"args",
"[",
"0",
"]",
")",
";",
"$",
"currency",
"=",
"Currency",
"::",
"fromNative",
"(",... | Returns a Money object from native int amount and string currency code
@param int $amount Amount expressed in the smallest units of $currency (e.g. cents)
@param string $currency Currency code of the money object
@return static | [
"Returns",
"a",
"Money",
"object",
"from",
"native",
"int",
"amount",
"and",
"string",
"currency",
"code"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L28-L36 | train |
cubicmushroom/valueobjects | src/Money/Money.php | Money.sameValueAs | public function sameValueAs(ValueObjectInterface $money)
{
if (false === Util::classEquals($this, $money)) {
return false;
}
return $this->getAmount()->sameValueAs($money->getAmount()) && $this->getCurrency()->sameValueAs($money->getCurrency());
} | php | public function sameValueAs(ValueObjectInterface $money)
{
if (false === Util::classEquals($this, $money)) {
return false;
}
return $this->getAmount()->sameValueAs($money->getAmount()) && $this->getCurrency()->sameValueAs($money->getCurrency());
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"money",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"money",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"-... | Tells whether two Currency are equal by comparing their amount and currency
@param ValueObjectInterface $money
@return bool | [
"Tells",
"whether",
"two",
"Currency",
"are",
"equal",
"by",
"comparing",
"their",
"amount",
"and",
"currency"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L57-L64 | train |
cubicmushroom/valueobjects | src/Money/Money.php | Money.add | public function add(Integer $quantity)
{
$amount = new Integer($this->getAmount()->toNative() + $quantity->toNative());
$result = new self($amount, $this->getCurrency());
return $result;
} | php | public function add(Integer $quantity)
{
$amount = new Integer($this->getAmount()->toNative() + $quantity->toNative());
$result = new self($amount, $this->getCurrency());
return $result;
} | [
"public",
"function",
"add",
"(",
"Integer",
"$",
"quantity",
")",
"{",
"$",
"amount",
"=",
"new",
"Integer",
"(",
"$",
"this",
"->",
"getAmount",
"(",
")",
"->",
"toNative",
"(",
")",
"+",
"$",
"quantity",
"->",
"toNative",
"(",
")",
")",
";",
"$"... | Add an integer quantity to the amount and returns a new Money object.
Use a negative quantity for subtraction.
@param Integer $quantity Quantity to add
@return Money | [
"Add",
"an",
"integer",
"quantity",
"to",
"the",
"amount",
"and",
"returns",
"a",
"new",
"Money",
"object",
".",
"Use",
"a",
"negative",
"quantity",
"for",
"subtraction",
"."
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L95-L101 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2PQuery.php | M2PQuery.filterByPageId | public function filterByPageId($pageId = null, $comparison = null)
{
if (is_array($pageId)) {
$useMinMax = false;
if (isset($pageId['min'])) {
$this->addUsingAlias(M2PTableMap::COL_PAGE_ID, $pageId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | php | public function filterByPageId($pageId = null, $comparison = null)
{
if (is_array($pageId)) {
$useMinMax = false;
if (isset($pageId['min'])) {
$this->addUsingAlias(M2PTableMap::COL_PAGE_ID, $pageId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | [
"public",
"function",
"filterByPageId",
"(",
"$",
"pageId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pageId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"pa... | Filter the query on the page_id column
Example usage:
<code>
$query->filterByPageId(1234); // WHERE page_id = 1234
$query->filterByPageId(array(12, 34)); // WHERE page_id IN (12, 34)
$query->filterByPageId(array('min' => 12)); // WHERE page_id > 12
</code>
@see filterByPage()
@param mixed $pageId The value... | [
"Filter",
"the",
"query",
"on",
"the",
"page_id",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2PQuery.php#L337-L358 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2PQuery.php | M2PQuery.usePageQuery | public function usePageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Page', '\Attogram\SharedMedia\Orm\PageQuery');
} | php | public function usePageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Page', '\Attogram\SharedMedia\Orm\PageQuery');
} | [
"public",
"function",
"usePageQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinPage",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuer... | Use the Page relation Page object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Attogram\SharedMedia\Orm\PageQuery A secondary que... | [
"Use",
"the",
"Page",
"relation",
"Page",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2PQuery.php#L507-L512 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.getInstance | public static function getInstance($name)
{
$key = self::_instanceKey($name);
if (!isset(self::$_instances[$key])) {
$dataSource = self::getDataAdapter();
if (is_null($dataSource)) {
$data = array();
} else {
$data = $dataSource->load($key);
}
$config = ne... | php | public static function getInstance($name)
{
$key = self::_instanceKey($name);
if (!isset(self::$_instances[$key])) {
$dataSource = self::getDataAdapter();
if (is_null($dataSource)) {
$data = array();
} else {
$data = $dataSource->load($key);
}
$config = ne... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instanceKey",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"key",
"]",
")",
")",
"... | Returns config instance
@param string $name Config name
@return Config | [
"Returns",
"config",
"instance"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L53-L73 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.newInstance | public static function newInstance($name, $data = null)
{
if (!is_array($data)) {
$data = array();
}
$config = self::getInstance($name);
$config->_data = $data;
return $config;
} | php | public static function newInstance($name, $data = null)
{
if (!is_array($data)) {
$data = array();
}
$config = self::getInstance($name);
$config->_data = $data;
return $config;
} | [
"public",
"static",
"function",
"newInstance",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"}",
"$",
"config",
"=",
"self",
":... | Shortcut for instance creation.
@param string $name Config name
@param array $data Config data
@return Config | [
"Shortcut",
"for",
"instance",
"creation",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L83-L93 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.clearInstance | public static function clearInstance($name)
{
$key = self::_instanceKey($name);
if (isset(self::$_instances[$key])) {
unset(self::$_instances[$key]);
}
} | php | public static function clearInstance($name)
{
$key = self::_instanceKey($name);
if (isset(self::$_instances[$key])) {
unset(self::$_instances[$key]);
}
} | [
"public",
"static",
"function",
"clearInstance",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instanceKey",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Unloads config instance.
@param string $name Config name
@return null | [
"Unloads",
"config",
"instance",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L102-L109 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.clearAll | public static function clearAll()
{
$names = array_keys(self::$_instances);
foreach ($names as $name) {
self::clearInstance($name);
}
} | php | public static function clearAll()
{
$names = array_keys(self::$_instances);
foreach ($names as $name) {
self::clearInstance($name);
}
} | [
"public",
"static",
"function",
"clearAll",
"(",
")",
"{",
"$",
"names",
"=",
"array_keys",
"(",
"self",
"::",
"$",
"_instances",
")",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"self",
"::",
"clearInstance",
"(",
"$",
"name",
")... | Upload all configs data
@return null | [
"Upload",
"all",
"configs",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L116-L122 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.saveInstance | public static function saveInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$config = self::getInstance($name);
$key = self::_instanceKey($name);
$result = $adapter->save($key, $config);
} else {
$result = false;
}
return $result;
... | php | public static function saveInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$config = self::getInstance($name);
$key = self::_instanceKey($name);
$result = $adapter->save($key, $config);
} else {
$result = false;
}
return $result;
... | [
"public",
"static",
"function",
"saveInstance",
"(",
"$",
"name",
")",
"{",
"$",
"adapter",
"=",
"self",
"::",
"getDataAdapter",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"adapter",
")",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"getInsta... | Save config instance data
@param string $name Config name
@return boolean | [
"Save",
"config",
"instance",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L131-L144 | train |
covex-nn/JooS | src/JooS/Config/Config.php | Config.deleteInstance | public static function deleteInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$key = self::_instanceKey($name);
$result = $adapter->delete($key);
} else {
$result = false;
}
self::clearInstance($name);
return $result;
} | php | public static function deleteInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$key = self::_instanceKey($name);
$result = $adapter->delete($key);
} else {
$result = false;
}
self::clearInstance($name);
return $result;
} | [
"public",
"static",
"function",
"deleteInstance",
"(",
"$",
"name",
")",
"{",
"$",
"adapter",
"=",
"self",
"::",
"getDataAdapter",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"adapter",
")",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instance... | Delete config instance data
@param string $name Config name
@return boolean | [
"Delete",
"config",
"instance",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L153-L166 | train |
freialib/freia.autoloader | src/Configs.php | Configs.instance | static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
$i = new static;
$i->fs = $fs;
$i->filemaps = $filemaps;
return $i;
} | php | static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
$i = new static;
$i->fs = $fs;
$i->filemaps = $filemaps;
return $i;
} | [
"static",
"function",
"instance",
"(",
"\\",
"hlin",
"\\",
"archetype",
"\\",
"Filesystem",
"$",
"fs",
",",
"array",
"$",
"filemaps",
")",
"{",
"$",
"i",
"=",
"new",
"static",
";",
"$",
"i",
"->",
"fs",
"=",
"$",
"fs",
";",
"$",
"i",
"->",
"filem... | Default filemaps will be used if none are specified.
@return static | [
"Default",
"filemaps",
"will",
"be",
"used",
"if",
"none",
"are",
"specified",
"."
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/Configs.php#L25-L30 | train |
PascalKleindienst/simple-api-client | src/Client.php | Client.get | public function get($endpoint, $params = [])
{
// build url
$url = $this->domain . '/' . $endpoint;
if (!empty($params)) {
$url = $url . '?' . http_build_query($params);
}
$request = new Request($url);
// Add client secret header
if (iss... | php | public function get($endpoint, $params = [])
{
// build url
$url = $this->domain . '/' . $endpoint;
if (!empty($params)) {
$url = $url . '?' . http_build_query($params);
}
$request = new Request($url);
// Add client secret header
if (iss... | [
"public",
"function",
"get",
"(",
"$",
"endpoint",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// build url",
"$",
"url",
"=",
"$",
"this",
"->",
"domain",
".",
"'/'",
".",
"$",
"endpoint",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"params",
")",... | Make a GET Request to an endpoint
@param $endpoint
@param array $params
@return \Jyggen\Curl\Response
@throws \Jyggen\Curl\Exception\CurlErrorException
@throws \Jyggen\Curl\Exception\ProtectedOptionException | [
"Make",
"a",
"GET",
"Request",
"to",
"an",
"endpoint"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Client.php#L84-L110 | train |
PascalKleindienst/simple-api-client | src/Client.php | Client.getEndpoint | public function getEndpoint($endpoint)
{
// Get Endpoint Class name
$endpoint = studly_case($endpoint);
if (!array_key_exists($endpoint, $this->endpoints)) {
throw new InvalidEndpointException("Endpoint {$endpoint} does not exists");
}
$class = $this->endpoints[... | php | public function getEndpoint($endpoint)
{
// Get Endpoint Class name
$endpoint = studly_case($endpoint);
if (!array_key_exists($endpoint, $this->endpoints)) {
throw new InvalidEndpointException("Endpoint {$endpoint} does not exists");
}
$class = $this->endpoints[... | [
"public",
"function",
"getEndpoint",
"(",
"$",
"endpoint",
")",
"{",
"// Get Endpoint Class name",
"$",
"endpoint",
"=",
"studly_case",
"(",
"$",
"endpoint",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"endpoint",
",",
"$",
"this",
"->",
"endpoin... | Get an API endpoint.
@param string $endpoint
@return \Atog\Api\Endpoint
@throws \Atog\Api\Exceptions\InvalidEndpointException | [
"Get",
"an",
"API",
"endpoint",
"."
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Client.php#L129-L160 | train |
ARCANESOFT/Blog | src/Blog.php | Blog.routes | public static function routes()
{
Route::name('public::blog.')
->prefix('blog')
->namespace('\\Arcanesoft\\Blog\\Http\\Controllers\\Front')
->group(function () {
Routes\PostsRoutes::register();
Routes\CategoriesRoutes::register();
... | php | public static function routes()
{
Route::name('public::blog.')
->prefix('blog')
->namespace('\\Arcanesoft\\Blog\\Http\\Controllers\\Front')
->group(function () {
Routes\PostsRoutes::register();
Routes\CategoriesRoutes::register();
... | [
"public",
"static",
"function",
"routes",
"(",
")",
"{",
"Route",
"::",
"name",
"(",
"'public::blog.'",
")",
"->",
"prefix",
"(",
"'blog'",
")",
"->",
"namespace",
"(",
"'\\\\Arcanesoft\\\\Blog\\\\Http\\\\Controllers\\\\Front'",
")",
"->",
"group",
"(",
"function"... | Register the public blog routes. | [
"Register",
"the",
"public",
"blog",
"routes",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Blog.php#L58-L68 | train |
dsv-su/daisy-api-client-php | src/Publication.php | Publication.find | public static function find(array $query)
{
$pubs = Client::get('publication', $query);
return array_map(function ($data) { return new self($data); }, $pubs);
} | php | public static function find(array $query)
{
$pubs = Client::get('publication', $query);
return array_map(function ($data) { return new self($data); }, $pubs);
} | [
"public",
"static",
"function",
"find",
"(",
"array",
"$",
"query",
")",
"{",
"$",
"pubs",
"=",
"Client",
"::",
"get",
"(",
"'publication'",
",",
"$",
"query",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"$",
"data",
")",
"{",
"return",
"n... | Retrieve an array of Publication objects according to a search query.
@param array $query The query.
@return Publication[] | [
"Retrieve",
"an",
"array",
"of",
"Publication",
"objects",
"according",
"to",
"a",
"search",
"query",
"."
] | aa6817ed45fdf3629c9683ea8a8e70a80f59b441 | https://github.com/dsv-su/daisy-api-client-php/blob/aa6817ed45fdf3629c9683ea8a8e70a80f59b441/src/Publication.php#L15-L19 | train |
rutger-speksnijder/restphp | src/RestPHP/Response/Types/HTML.php | HTML.transformToHtml | private function transformToHtml($data, $hypertextRoutes = [])
{
// Generate the html for the hypertext routes
$hypertextHtml = $this->getHypertextHtml($hypertextRoutes);
// Check if the data is not an array
if (!is_array($data)) {
return "<p>{$data}</p>\n{$hypertextHtml... | php | private function transformToHtml($data, $hypertextRoutes = [])
{
// Generate the html for the hypertext routes
$hypertextHtml = $this->getHypertextHtml($hypertextRoutes);
// Check if the data is not an array
if (!is_array($data)) {
return "<p>{$data}</p>\n{$hypertextHtml... | [
"private",
"function",
"transformToHtml",
"(",
"$",
"data",
",",
"$",
"hypertextRoutes",
"=",
"[",
"]",
")",
"{",
"// Generate the html for the hypertext routes",
"$",
"hypertextHtml",
"=",
"$",
"this",
"->",
"getHypertextHtml",
"(",
"$",
"hypertextRoutes",
")",
"... | Recursively converts the response into an html string.
This is an html string with tables and underlying tables.
@param mixed $data The data to transform.
@param optional array $hypertextRoutes An array with hypertext routes.
@return string The response as an html string. | [
"Recursively",
"converts",
"the",
"response",
"into",
"an",
"html",
"string",
".",
"This",
"is",
"an",
"html",
"string",
"with",
"tables",
"and",
"underlying",
"tables",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Response/Types/HTML.php#L49-L74 | train |
rutger-speksnijder/restphp | src/RestPHP/Response/Types/HTML.php | HTML.getHypertextHtml | private function getHypertextHtml($routes = [])
{
// Check if we have routes
if (!$routes) {
return '';
}
// Create the html table
$html = "<table style=\"border: 1px solid black;\">\n";
// Loop through the routes and add them as rows to the table
... | php | private function getHypertextHtml($routes = [])
{
// Check if we have routes
if (!$routes) {
return '';
}
// Create the html table
$html = "<table style=\"border: 1px solid black;\">\n";
// Loop through the routes and add them as rows to the table
... | [
"private",
"function",
"getHypertextHtml",
"(",
"$",
"routes",
"=",
"[",
"]",
")",
"{",
"// Check if we have routes",
"if",
"(",
"!",
"$",
"routes",
")",
"{",
"return",
"''",
";",
"}",
"// Create the html table",
"$",
"html",
"=",
"\"<table style=\\\"border: 1px... | Generates the html for the hypertext routes.
@param optional array $routes The hypertext routes.
@return string The hypertext routes html table. | [
"Generates",
"the",
"html",
"for",
"the",
"hypertext",
"routes",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Response/Types/HTML.php#L83-L103 | train |
timostamm/web-resource | src/FileResource.php | FileResource.fromResource | public static function fromResource(ResourceInterface $resource, $path)
{
if ($resource instanceof FileResourceInterface) {
return $resource;
}
file_put_contents($path, $resource->getStream());
$attr = [
'mimetype' => $resource->getMimetype(),
'lastmodified' => $resource->getLastModified(),
'filena... | php | public static function fromResource(ResourceInterface $resource, $path)
{
if ($resource instanceof FileResourceInterface) {
return $resource;
}
file_put_contents($path, $resource->getStream());
$attr = [
'mimetype' => $resource->getMimetype(),
'lastmodified' => $resource->getLastModified(),
'filena... | [
"public",
"static",
"function",
"fromResource",
"(",
"ResourceInterface",
"$",
"resource",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"resource",
"instanceof",
"FileResourceInterface",
")",
"{",
"return",
"$",
"resource",
";",
"}",
"file_put_contents",
"(",
"... | Converts any resource to a local resource.
@param ResourceInterface $resource
@param string $path
@return FileResource | [
"Converts",
"any",
"resource",
"to",
"a",
"local",
"resource",
"."
] | 4c60e679093990585ee2f0a00029ab0a218573b8 | https://github.com/timostamm/web-resource/blob/4c60e679093990585ee2f0a00029ab0a218573b8/src/FileResource.php#L26-L38 | train |
agentmedia/phine-core | src/Core/Logic/Access/Backend/RightsFinder.php | RightsFinder.FindContentRights | static function FindContentRights(Content $content)
{
$result = null;
$currContent = $content;
do
{
$result = $currContent->GetUserGroupRights();
$currContent = ContentTreeUtil::ParentOf($currContent);
}
while (!$result && $currContent);
... | php | static function FindContentRights(Content $content)
{
$result = null;
$currContent = $content;
do
{
$result = $currContent->GetUserGroupRights();
$currContent = ContentTreeUtil::ParentOf($currContent);
}
while (!$result && $currContent);
... | [
"static",
"function",
"FindContentRights",
"(",
"Content",
"$",
"content",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"currContent",
"=",
"$",
"content",
";",
"do",
"{",
"$",
"result",
"=",
"$",
"currContent",
"->",
"GetUserGroupRights",
"(",
")",
"... | Finds the content rigths by searching in element tree
@param Content $content The content
@return BackendContentRights The rights of the contents | [
"Finds",
"the",
"content",
"rigths",
"by",
"searching",
"in",
"element",
"tree"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/RightsFinder.php#L17-L32 | train |
agentmedia/phine-core | src/Core/Logic/Access/Backend/RightsFinder.php | RightsFinder.FindPageRights | static function FindPageRights(Page $page)
{
$currPage = $page;
$result = null;
do
{
$result = $currPage->GetUserGroupRights();
$currPage = $currPage->GetParent();
}
while (!$result && $currPage);
if (!$result && $page->GetSite())
... | php | static function FindPageRights(Page $page)
{
$currPage = $page;
$result = null;
do
{
$result = $currPage->GetUserGroupRights();
$currPage = $currPage->GetParent();
}
while (!$result && $currPage);
if (!$result && $page->GetSite())
... | [
"static",
"function",
"FindPageRights",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"currPage",
"=",
"$",
"page",
";",
"$",
"result",
"=",
"null",
";",
"do",
"{",
"$",
"result",
"=",
"$",
"currPage",
"->",
"GetUserGroupRights",
"(",
")",
";",
"$",
"curr... | Gets the rights of the page
@param Page $page
@return BackendPageRights | [
"Gets",
"the",
"rights",
"of",
"the",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/RightsFinder.php#L85-L104 | train |
Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.hash | public static function hash($data) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
return hash(se... | php | public static function hash($data) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
return hash(se... | [
"public",
"static",
"function",
"hash",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"data",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"data",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'... | Hashes text and returns it
@param string $data
@return string | [
"Hashes",
"text",
"and",
"returns",
"it"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L67-L74 | train |
Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.validateHash | public static function validateHash($data, $hash) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
if(fals... | php | public static function validateHash($data, $hash) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
if(fals... | [
"public",
"static",
"function",
"validateHash",
"(",
"$",
"data",
",",
"$",
"hash",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"data",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"data",
")",
")",
"{",
"return",
"trigger_error",... | Verifies that data matches a hash
@param string $data
@param string $hash
@return boolean | [
"Verifies",
"that",
"data",
"matches",
"a",
"hash"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L83-L94 | train |
Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.hash_equals | private static function hash_equals($expected, $actual) {
$expected = (string) $expected;
$actual = (string) $actual;
if(true === function_exists('hash_equals')) {
return hash_equals($expected, $actual);
}
$lenExpected = mb_strlen($expected, sel... | php | private static function hash_equals($expected, $actual) {
$expected = (string) $expected;
$actual = (string) $actual;
if(true === function_exists('hash_equals')) {
return hash_equals($expected, $actual);
}
$lenExpected = mb_strlen($expected, sel... | [
"private",
"static",
"function",
"hash_equals",
"(",
"$",
"expected",
",",
"$",
"actual",
")",
"{",
"$",
"expected",
"=",
"(",
"string",
")",
"$",
"expected",
";",
"$",
"actual",
"=",
"(",
"string",
")",
"$",
"actual",
";",
"if",
"(",
"true",
"===",
... | Hash equals function for PHP 5.5+
@param string $expected
@param string $actual
@return bool | [
"Hash",
"equals",
"function",
"for",
"PHP",
"5",
".",
"5",
"+"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L103-L124 | train |
duncan3dc/serial | src/Yaml.php | Yaml.decode | public static function decode($string)
{
if (!$string) {
return new ArrayObject();
}
$array = SymfonyYaml::parse($string);
if (!is_array($array)) {
$array = [];
}
return ArrayObject::make($array);
} | php | public static function decode($string)
{
if (!$string) {
return new ArrayObject();
}
$array = SymfonyYaml::parse($string);
if (!is_array($array)) {
$array = [];
}
return ArrayObject::make($array);
} | [
"public",
"static",
"function",
"decode",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"$",
"string",
")",
"{",
"return",
"new",
"ArrayObject",
"(",
")",
";",
"}",
"$",
"array",
"=",
"SymfonyYaml",
"::",
"parse",
"(",
"$",
"string",
")",
";",
"if"... | Convert a yaml string to an array.
{@inheritDoc} | [
"Convert",
"a",
"yaml",
"string",
"to",
"an",
"array",
"."
] | 2e40127a0a364ee1bd6f655b0f5b5d4a035a5716 | https://github.com/duncan3dc/serial/blob/2e40127a0a364ee1bd6f655b0f5b5d4a035a5716/src/Yaml.php#L33-L46 | train |
pdyn/filesystem | Mimetype.php | Mimetype.mime2ext | public static function mime2ext($mime) {
$ext2mime = static::get_mime_map();
$mime2ext = array_flip($ext2mime);
return (isset($mime2ext[$mime])) ? $mime2ext[$mime] : 'unknown';
} | php | public static function mime2ext($mime) {
$ext2mime = static::get_mime_map();
$mime2ext = array_flip($ext2mime);
return (isset($mime2ext[$mime])) ? $mime2ext[$mime] : 'unknown';
} | [
"public",
"static",
"function",
"mime2ext",
"(",
"$",
"mime",
")",
"{",
"$",
"ext2mime",
"=",
"static",
"::",
"get_mime_map",
"(",
")",
";",
"$",
"mime2ext",
"=",
"array_flip",
"(",
"$",
"ext2mime",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"mime2ext... | Get the file extension associated with a given mime type.
@param string $mime The mime type.
@return string The file extension. | [
"Get",
"the",
"file",
"extension",
"associated",
"with",
"a",
"given",
"mime",
"type",
"."
] | e2f780eac166aa60071e601d600133b860ace594 | https://github.com/pdyn/filesystem/blob/e2f780eac166aa60071e601d600133b860ace594/Mimetype.php#L29-L33 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.