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
vivait/ScrutinizerFormatter
src/Vivait/ScrutinizerFormatterExtension/Extension.php
Extension.addFormatter
protected function addFormatter(ServiceContainer $container, $name, $class) { $container->set( 'formatter.formatters.' . $name, function (ServiceContainer $c) use ($class) { $c->set('formatter.presenter', new StringPresenter($c->get('formatter.presenter.differ'))); /** @var ServiceContainer $c */ return new $class( $c->get('formatter.presenter'), $c->get('console.io'), $c->get('event_dispatcher.listeners.stats') ); } ); }
php
protected function addFormatter(ServiceContainer $container, $name, $class) { $container->set( 'formatter.formatters.' . $name, function (ServiceContainer $c) use ($class) { $c->set('formatter.presenter', new StringPresenter($c->get('formatter.presenter.differ'))); /** @var ServiceContainer $c */ return new $class( $c->get('formatter.presenter'), $c->get('console.io'), $c->get('event_dispatcher.listeners.stats') ); } ); }
[ "protected", "function", "addFormatter", "(", "ServiceContainer", "$", "container", ",", "$", "name", ",", "$", "class", ")", "{", "$", "container", "->", "set", "(", "'formatter.formatters.'", ".", "$", "name", ",", "function", "(", "ServiceContainer", "$", ...
Add a formatter to the service container @param ServiceContainer $container @param string $name @param string $class
[ "Add", "a", "formatter", "to", "the", "service", "container" ]
6e6de9c4351c350cc31938b43cc5efd512cef4b7
https://github.com/vivait/ScrutinizerFormatter/blob/6e6de9c4351c350cc31938b43cc5efd512cef4b7/src/Vivait/ScrutinizerFormatterExtension/Extension.php#L43-L58
train
NamelessCoder/gizzle-git-plugins
src/GizzlePlugins/PluginList.php
PluginList.getPluginClassNames
public function getPluginClassNames() { $plugins = array(); if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin'; } return $plugins; }
php
public function getPluginClassNames() { $plugins = array(); if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin'; } if (TRUE === $this->isEnabled('NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin')) { $plugins[] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin'; } return $plugins; }
[ "public", "function", "getPluginClassNames", "(", ")", "{", "$", "plugins", "=", "array", "(", ")", ";", "if", "(", "TRUE", "===", "$", "this", "->", "isEnabled", "(", "'NamelessCoder\\\\GizzleGitPlugins\\\\GizzlePlugins\\\\ClonePlugin'", ")", ")", "{", "$", "pl...
Get all class names of plugins delivered from implementer package. @return string[]
[ "Get", "all", "class", "names", "of", "plugins", "delivered", "from", "implementer", "package", "." ]
7c476db81b58bed7dc769866491b2adb6ddb19bb
https://github.com/NamelessCoder/gizzle-git-plugins/blob/7c476db81b58bed7dc769866491b2adb6ddb19bb/src/GizzlePlugins/PluginList.php#L41-L59
train
ushios/elasticsearch-bundle
DependencyInjection/UshiosElasticSearchExtension.php
UshiosElasticSearchExtension.clientSettings
protected function clientSettings(array $configs, ContainerBuilder $container) { foreach($configs as $key => $infos){ $clientDefinition = new Definition(); $clientDefinition->setClass($infos['class']); $hostsSettings = $this->hostSettings($infos); $logPathSettings = $this->logPathSettings($infos); $logLevelSettings = $this->logLevelSettings($infos); $options = array( 'hosts' => $hostsSettings, 'logPath' => $logPathSettings, 'logLevel' => $logLevelSettings ); $clientDefinition->setArguments(array($options)); $clientServiceId = 'ushios_elastic_search_client'; if ($key == 'default'){ $container->setDefinition($clientServiceId, $clientDefinition); $clientServiceId = $clientServiceId.'.default'; }else{ $clientServiceId = $clientServiceId.'.'.$key; } $container->setDefinition($clientServiceId, $clientDefinition); } }
php
protected function clientSettings(array $configs, ContainerBuilder $container) { foreach($configs as $key => $infos){ $clientDefinition = new Definition(); $clientDefinition->setClass($infos['class']); $hostsSettings = $this->hostSettings($infos); $logPathSettings = $this->logPathSettings($infos); $logLevelSettings = $this->logLevelSettings($infos); $options = array( 'hosts' => $hostsSettings, 'logPath' => $logPathSettings, 'logLevel' => $logLevelSettings ); $clientDefinition->setArguments(array($options)); $clientServiceId = 'ushios_elastic_search_client'; if ($key == 'default'){ $container->setDefinition($clientServiceId, $clientDefinition); $clientServiceId = $clientServiceId.'.default'; }else{ $clientServiceId = $clientServiceId.'.'.$key; } $container->setDefinition($clientServiceId, $clientDefinition); } }
[ "protected", "function", "clientSettings", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "foreach", "(", "$", "configs", "as", "$", "key", "=>", "$", "infos", ")", "{", "$", "clientDefinition", "=", "new", "Definition", ...
Reading the config.yml for aws-sdk client. @param array $configs @param ContainerBuilder $container
[ "Reading", "the", "config", ".", "yml", "for", "aws", "-", "sdk", "client", "." ]
4524370dc59c24b53636ca57f39f66ecdb93e89c
https://github.com/ushios/elasticsearch-bundle/blob/4524370dc59c24b53636ca57f39f66ecdb93e89c/DependencyInjection/UshiosElasticSearchExtension.php#L40-L68
train
marando/phpSOFA
src/Marando/IAU/iauApcg.php
iauApcg.Apcg
public static function Apcg($date1, $date2, array $ebpv, array $ehp, iauASTROM &$astrom) { /* Geocentric observer */ $pv = [ [ 0.0, 0.0, 0.0], [ 0.0, 0.0, 0.0]]; /* Compute the star-independent astrometry parameters. */ IAU::Apcs($date1, $date2, $pv, $ebpv, $ehp, $astrom); /* Finished. */ }
php
public static function Apcg($date1, $date2, array $ebpv, array $ehp, iauASTROM &$astrom) { /* Geocentric observer */ $pv = [ [ 0.0, 0.0, 0.0], [ 0.0, 0.0, 0.0]]; /* Compute the star-independent astrometry parameters. */ IAU::Apcs($date1, $date2, $pv, $ebpv, $ehp, $astrom); /* Finished. */ }
[ "public", "static", "function", "Apcg", "(", "$", "date1", ",", "$", "date2", ",", "array", "$", "ebpv", ",", "array", "$", "ehp", ",", "iauASTROM", "&", "$", "astrom", ")", "{", "/* Geocentric observer */", "$", "pv", "=", "[", "[", "0.0", ",", "0.0...
- - - - - - - - i a u A p c g - - - - - - - - For a geocentric observer, prepare star-independent astrometry parameters for transformations between ICRS and GCRS coordinates. The Earth ephemeris is supplied by the caller. The parameters produced by this function are required in the parallax, light deflection and aberration parts of the astrometric transformation chain. This function is part of the International Astronomical Union's SOFA (Standards of Fundamental Astronomy) software collection. Status: support function. Given: date1 double TDB as a 2-part... date2 double ...Julian Date (Note 1) ebpv double[2][3] Earth barycentric pos/vel (au, au/day) ehp double[3] Earth heliocentric position (au) Returned: astrom iauASTROM* star-independent astrometry parameters: pmt double PM time interval (SSB, Julian years) eb double[3] SSB to observer (vector, au) eh double[3] Sun to observer (unit vector) em double distance from Sun to observer (au) v double[3] barycentric observer velocity (vector, c) bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor bpn double[3][3] bias-precession-nutation matrix along double unchanged xpl double unchanged ypl double unchanged sphi double unchanged cphi double unchanged diurab double unchanged eral double unchanged refa double unchanged refb double unchanged Notes: 1) The TDB date date1+date2 is a Julian Date, apportioned in any convenient way between the two arguments. For example, JD(TDB)=2450123.7 could be expressed in any of these ways, among others: date1 date2 2450123.7 0.0 (JD method) 2451545.0 -1421.3 (J2000 method) 2400000.5 50123.2 (MJD method) 2450123.5 0.2 (date & time method) The JD method is the most natural and convenient to use in cases where the loss of several decimal digits of resolution is acceptable. The J2000 method is best matched to the way the argument is handled internally and will deliver the optimum resolution. The MJD method and the date & time methods are both good compromises between resolution and convenience. For most applications of this function the choice will not be at all critical. TT can be used instead of TDB without any significant impact on accuracy. 2) All the vectors are with respect to BCRS axes. 3) This is one of several functions that inserts into the astrom structure star-independent parameters needed for the chain of astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed. The various functions support different classes of observer and portions of the transformation chain: functions observer transformation iauApcg iauApcg13 geocentric ICRS <-> GCRS iauApci iauApci13 terrestrial ICRS <-> CIRS iauApco iauApco13 terrestrial ICRS <-> observed iauApcs iauApcs13 space ICRS <-> GCRS iauAper iauAper13 terrestrial update Earth rotation iauApio iauApio13 terrestrial CIRS <-> observed Those with names ending in "13" use contemporary SOFA models to compute the various ephemerides. The others accept ephemerides supplied by the caller. The transformation from ICRS to GCRS covers space motion, parallax, light deflection, and aberration. From GCRS to CIRS comprises frame bias and precession-nutation. From CIRS to observed takes account of Earth rotation, polar motion, diurnal aberration and parallax (unless subsumed into the ICRS <-> GCRS transformation), and atmospheric refraction. 4) The context structure astrom produced by this function is used by iauAtciq* and iauAticq*. Called: iauApcs astrometry parameters, ICRS-GCRS, space observer This revision: 2013 October 9 SOFA release 2015-02-09 Copyright (C) 2015 IAU SOFA Board. See notes at end.
[ "-", "-", "-", "-", "-", "-", "-", "-", "i", "a", "u", "A", "p", "c", "g", "-", "-", "-", "-", "-", "-", "-", "-" ]
757fa49fe335ae1210eaa7735473fd4388b13f07
https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauApcg.php#L117-L128
train
gossi/trixionary
src/domain/base/GroupDomainTrait.php
GroupDomainTrait.doRemoveSkills
protected function doRemoveSkills(Group $model, $data) { $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Skill'; } else { $related = SkillQuery::create()->findOneById($entry['id']); $model->removeSkill($related); } } if (count($errors) > 0) { return new ErrorsException($errors); } }
php
protected function doRemoveSkills(Group $model, $data) { $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Skill'; } else { $related = SkillQuery::create()->findOneById($entry['id']); $model->removeSkill($related); } } if (count($errors) > 0) { return new ErrorsException($errors); } }
[ "protected", "function", "doRemoveSkills", "(", "Group", "$", "model", ",", "$", "data", ")", "{", "$", "errors", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "entry", ")", "{", "if", "(", "!", "isset", "(", "$", "entry", "[", "'id...
Interal mechanism to remove Skills from Group @param Group $model @param mixed $data
[ "Interal", "mechanism", "to", "remove", "Skills", "from", "Group" ]
221a6c5322473d7d7f8e322958a3ee46d87da150
https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/GroupDomainTrait.php#L430-L444
train
gossi/trixionary
src/domain/base/GroupDomainTrait.php
GroupDomainTrait.doUpdateSkills
protected function doUpdateSkills(Group $model, $data) { // remove all relationships before SkillGroupQuery::create()->filterByGroup($model)->delete(); // add them $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Skill'; } else { $related = SkillQuery::create()->findOneById($entry['id']); $model->addSkill($related); } } if (count($errors) > 0) { throw new ErrorsException($errors); } }
php
protected function doUpdateSkills(Group $model, $data) { // remove all relationships before SkillGroupQuery::create()->filterByGroup($model)->delete(); // add them $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Skill'; } else { $related = SkillQuery::create()->findOneById($entry['id']); $model->addSkill($related); } } if (count($errors) > 0) { throw new ErrorsException($errors); } }
[ "protected", "function", "doUpdateSkills", "(", "Group", "$", "model", ",", "$", "data", ")", "{", "// remove all relationships before", "SkillGroupQuery", "::", "create", "(", ")", "->", "filterByGroup", "(", "$", "model", ")", "->", "delete", "(", ")", ";", ...
Internal update mechanism of Skills on Group @param Group $model @param mixed $data
[ "Internal", "update", "mechanism", "of", "Skills", "on", "Group" ]
221a6c5322473d7d7f8e322958a3ee46d87da150
https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/GroupDomainTrait.php#L468-L486
train
crayner/symfony-form
Util/FormErrorsParser.php
FormErrorsParser.realParseErrors
private function realParseErrors(FormInterface $form, array &$results) { $errors = $form->getErrors(); if (count($errors) > 0) { $config = $form->getConfig(); $name = $form->getName(); $label = $config->getOption('label'); $translation = $this->getTranslationDomain($form); if (empty($label)) { $label = ucfirst(trim(strtolower(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $name)))); } $results[] = array( 'name' => $name, 'label' => $label, 'errors' => $errors, 'translation' => $translation, ); } $children = $form->all(); if (count($children) > 0) { foreach ($children as $child) { if ($child instanceof FormInterface) { $this->realParseErrors($child, $results); } } } return $results; }
php
private function realParseErrors(FormInterface $form, array &$results) { $errors = $form->getErrors(); if (count($errors) > 0) { $config = $form->getConfig(); $name = $form->getName(); $label = $config->getOption('label'); $translation = $this->getTranslationDomain($form); if (empty($label)) { $label = ucfirst(trim(strtolower(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $name)))); } $results[] = array( 'name' => $name, 'label' => $label, 'errors' => $errors, 'translation' => $translation, ); } $children = $form->all(); if (count($children) > 0) { foreach ($children as $child) { if ($child instanceof FormInterface) { $this->realParseErrors($child, $results); } } } return $results; }
[ "private", "function", "realParseErrors", "(", "FormInterface", "$", "form", ",", "array", "&", "$", "results", ")", "{", "$", "errors", "=", "$", "form", "->", "getErrors", "(", ")", ";", "if", "(", "count", "(", "$", "errors", ")", ">", "0", ")", ...
This does the actual job. Method travels through all levels of form recursively and gathers errors. @param FormInterface $form @param array &$results @return array
[ "This", "does", "the", "actual", "job", ".", "Method", "travels", "through", "all", "levels", "of", "form", "recursively", "and", "gathers", "errors", "." ]
d9fb4f01265ffbcbc74cf4e2adebf99da359c8c2
https://github.com/crayner/symfony-form/blob/d9fb4f01265ffbcbc74cf4e2adebf99da359c8c2/Util/FormErrorsParser.php#L51-L87
train
crayner/symfony-form
Util/FormErrorsParser.php
FormErrorsParser.getTranslationDomain
private function getTranslationDomain(FormInterface $form) { $translation = $form->getConfig()->getOption('translation_domain'); if (empty($translation)) { $parent = $form->getParent(); if (empty($parent)) $translation = 'messages'; while (empty($translation)) { $translation = $parent->getConfig()->getOption('translation_domain'); $parent = $parent->getParent(); if (! $parent instanceof FormInterface && empty($translation)) $translation = 'messages'; } } return $translation = $translation === 'messages' ? null : $translation; // Allow the Symfony Default setting to be used by returning null. }
php
private function getTranslationDomain(FormInterface $form) { $translation = $form->getConfig()->getOption('translation_domain'); if (empty($translation)) { $parent = $form->getParent(); if (empty($parent)) $translation = 'messages'; while (empty($translation)) { $translation = $parent->getConfig()->getOption('translation_domain'); $parent = $parent->getParent(); if (! $parent instanceof FormInterface && empty($translation)) $translation = 'messages'; } } return $translation = $translation === 'messages' ? null : $translation; // Allow the Symfony Default setting to be used by returning null. }
[ "private", "function", "getTranslationDomain", "(", "FormInterface", "$", "form", ")", "{", "$", "translation", "=", "$", "form", "->", "getConfig", "(", ")", "->", "getOption", "(", "'translation_domain'", ")", ";", "if", "(", "empty", "(", "$", "translatio...
Find the Translation Domain. Needs to be done for each element as sub forms or elements could have different translation domains. @param FormInterface $form @return string
[ "Find", "the", "Translation", "Domain", "." ]
d9fb4f01265ffbcbc74cf4e2adebf99da359c8c2
https://github.com/crayner/symfony-form/blob/d9fb4f01265ffbcbc74cf4e2adebf99da359c8c2/Util/FormErrorsParser.php#L98-L118
train
eix/core
src/php/main/Eix/Services/Data/Entity.php
Entity.addFieldValidators
public function addFieldValidators(array $fieldValidators) { foreach ($fieldValidators as $fieldName => $validators) { $this->fieldValidators[$fieldName] = $validators; } }
php
public function addFieldValidators(array $fieldValidators) { foreach ($fieldValidators as $fieldName => $validators) { $this->fieldValidators[$fieldName] = $validators; } }
[ "public", "function", "addFieldValidators", "(", "array", "$", "fieldValidators", ")", "{", "foreach", "(", "$", "fieldValidators", "as", "$", "fieldName", "=>", "$", "validators", ")", "{", "$", "this", "->", "fieldValidators", "[", "$", "fieldName", "]", "...
Adds field validators to the existing ones. @param array $fieldValidators the field validators as an array in the form: array(fieldName => array(validatorType1[, validatorType2]...))
[ "Adds", "field", "validators", "to", "the", "existing", "ones", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Entity.php#L178-L183
train
eix/core
src/php/main/Eix/Services/Data/Entity.php
Entity.getFieldsData
public function getFieldsData() { $fieldsData = array(); foreach ($this->getFields() as $field) { $fieldData = $this->$field; // If the field is an Entity, decode it. if ($fieldData instanceof self) { $fieldData = $fieldData->getFieldsData(); } elseif (@reset($fieldData) instanceof Entity) { // If the field is an array of Entity, decode them all. $newFieldData = array(); foreach ($fieldData as $key => $entity) { $newFieldData[$key] = $entity->getFieldsData(); } $fieldData = $newFieldData; } $fieldsData[$field] = $fieldData; } return $fieldsData; }
php
public function getFieldsData() { $fieldsData = array(); foreach ($this->getFields() as $field) { $fieldData = $this->$field; // If the field is an Entity, decode it. if ($fieldData instanceof self) { $fieldData = $fieldData->getFieldsData(); } elseif (@reset($fieldData) instanceof Entity) { // If the field is an array of Entity, decode them all. $newFieldData = array(); foreach ($fieldData as $key => $entity) { $newFieldData[$key] = $entity->getFieldsData(); } $fieldData = $newFieldData; } $fieldsData[$field] = $fieldData; } return $fieldsData; }
[ "public", "function", "getFieldsData", "(", ")", "{", "$", "fieldsData", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getFields", "(", ")", "as", "$", "field", ")", "{", "$", "fieldData", "=", "$", "this", "->", "$", "field", ";...
Returns an array composed of all the persistable fields. @return array
[ "Returns", "an", "array", "composed", "of", "all", "the", "persistable", "fields", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Entity.php#L190-L211
train
eix/core
src/php/main/Eix/Services/Data/Entity.php
Entity.store
public function store() { // Check whether the object has ever been stored. if ($this->isNew) { Logger::get()->debug('Storing new entity ' . get_class($this) . '...'); // Create the record. Get an ID back. $this->id = $this->getDataSource()->create($this->getFieldsData()); // Store this object in the appropriate factory for further use. $this->getFactory()->registerEntity($this); } else { Logger::get()->debug('Updating entity ' . get_class($this) . ":{$this->id}..."); $this->getDataSource()->update($this->id, $this->getFieldsData()); } // Once stored, the entity is no longer new. $this->isNew = false; }
php
public function store() { // Check whether the object has ever been stored. if ($this->isNew) { Logger::get()->debug('Storing new entity ' . get_class($this) . '...'); // Create the record. Get an ID back. $this->id = $this->getDataSource()->create($this->getFieldsData()); // Store this object in the appropriate factory for further use. $this->getFactory()->registerEntity($this); } else { Logger::get()->debug('Updating entity ' . get_class($this) . ":{$this->id}..."); $this->getDataSource()->update($this->id, $this->getFieldsData()); } // Once stored, the entity is no longer new. $this->isNew = false; }
[ "public", "function", "store", "(", ")", "{", "// Check whether the object has ever been stored.", "if", "(", "$", "this", "->", "isNew", ")", "{", "Logger", "::", "get", "(", ")", "->", "debug", "(", "'Storing new entity '", ".", "get_class", "(", "$", "this"...
Stores the object in the persistence layer.
[ "Stores", "the", "object", "in", "the", "persistence", "layer", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Entity.php#L231-L247
train
eix/core
src/php/main/Eix/Services/Data/Entity.php
Entity.destroy
public function destroy() { // Delete from the persistence layer. $this->getDataSource()->destroy($this->id); // Remove from the registry. $this->getFactory()->unregisterEntity($this); // Done, garbage collection should do the rest. }
php
public function destroy() { // Delete from the persistence layer. $this->getDataSource()->destroy($this->id); // Remove from the registry. $this->getFactory()->unregisterEntity($this); // Done, garbage collection should do the rest. }
[ "public", "function", "destroy", "(", ")", "{", "// Delete from the persistence layer.", "$", "this", "->", "getDataSource", "(", ")", "->", "destroy", "(", "$", "this", "->", "id", ")", ";", "// Remove from the registry.", "$", "this", "->", "getFactory", "(", ...
Destroys all copies of the object, even the persisted ones.
[ "Destroys", "all", "copies", "of", "the", "object", "even", "the", "persisted", "ones", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Entity.php#L252-L259
train
anklimsk/cakephp-basic-functions
Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php
Compress.setOptions
public function setOptions($options) { if (!is_array($options) && !$options instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( '"%s" expects an array or Traversable; received "%s"', __METHOD__, (is_object($options) ? get_class($options) : gettype($options)) )); } foreach ($options as $key => $value) { if ($key == 'options') { $key = 'adapterOptions'; } $method = 'set' . ucfirst($key); if (method_exists($this, $method)) { $this->$method($value); } } return $this; }
php
public function setOptions($options) { if (!is_array($options) && !$options instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( '"%s" expects an array or Traversable; received "%s"', __METHOD__, (is_object($options) ? get_class($options) : gettype($options)) )); } foreach ($options as $key => $value) { if ($key == 'options') { $key = 'adapterOptions'; } $method = 'set' . ucfirst($key); if (method_exists($this, $method)) { $this->$method($value); } } return $this; }
[ "public", "function", "setOptions", "(", "$", "options", ")", "{", "if", "(", "!", "is_array", "(", "$", "options", ")", "&&", "!", "$", "options", "instanceof", "Traversable", ")", "{", "throw", "new", "Exception", "\\", "InvalidArgumentException", "(", "...
Set filter setate @param array $options @throws Exception\InvalidArgumentException if options is not an array or Traversable @return self
[ "Set", "filter", "setate" ]
7554e8b0b420fd3155593af7bf76b7ccbdc8701e
https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php#L56-L76
train
anklimsk/cakephp-basic-functions
Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php
Compress.getAdapter
public function getAdapter() { if ($this->adapter instanceof Compress\CompressionAlgorithmInterface) { return $this->adapter; } $adapter = $this->adapter; $options = $this->getAdapterOptions(); if (!class_exists($adapter)) { $adapter = 'Zend\\Filter\\Compress\\' . ucfirst($adapter); if (!class_exists($adapter)) { throw new Exception\RuntimeException(sprintf( '%s unable to load adapter; class "%s" not found', __METHOD__, $this->adapter )); } } $this->adapter = new $adapter($options); if (!$this->adapter instanceof Compress\CompressionAlgorithmInterface) { throw new Exception\InvalidArgumentException("Compression adapter '" . $adapter . "' does not implement Zend\\Filter\\Compress\\CompressionAlgorithmInterface"); } return $this->adapter; }
php
public function getAdapter() { if ($this->adapter instanceof Compress\CompressionAlgorithmInterface) { return $this->adapter; } $adapter = $this->adapter; $options = $this->getAdapterOptions(); if (!class_exists($adapter)) { $adapter = 'Zend\\Filter\\Compress\\' . ucfirst($adapter); if (!class_exists($adapter)) { throw new Exception\RuntimeException(sprintf( '%s unable to load adapter; class "%s" not found', __METHOD__, $this->adapter )); } } $this->adapter = new $adapter($options); if (!$this->adapter instanceof Compress\CompressionAlgorithmInterface) { throw new Exception\InvalidArgumentException("Compression adapter '" . $adapter . "' does not implement Zend\\Filter\\Compress\\CompressionAlgorithmInterface"); } return $this->adapter; }
[ "public", "function", "getAdapter", "(", ")", "{", "if", "(", "$", "this", "->", "adapter", "instanceof", "Compress", "\\", "CompressionAlgorithmInterface", ")", "{", "return", "$", "this", "->", "adapter", ";", "}", "$", "adapter", "=", "$", "this", "->",...
Returns the current adapter, instantiating it if necessary @throws Exception\RuntimeException @throws Exception\InvalidArgumentException @return Compress\CompressionAlgorithmInterface
[ "Returns", "the", "current", "adapter", "instantiating", "it", "if", "necessary" ]
7554e8b0b420fd3155593af7bf76b7ccbdc8701e
https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php#L85-L109
train
anklimsk/cakephp-basic-functions
Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php
Compress.setAdapter
public function setAdapter($adapter) { if ($adapter instanceof Compress\CompressionAlgorithmInterface) { $this->adapter = $adapter; return $this; } if (!is_string($adapter)) { throw new Exception\InvalidArgumentException('Invalid adapter provided; must be string or instance of Zend\\Filter\\Compress\\CompressionAlgorithmInterface'); } $this->adapter = $adapter; return $this; }
php
public function setAdapter($adapter) { if ($adapter instanceof Compress\CompressionAlgorithmInterface) { $this->adapter = $adapter; return $this; } if (!is_string($adapter)) { throw new Exception\InvalidArgumentException('Invalid adapter provided; must be string or instance of Zend\\Filter\\Compress\\CompressionAlgorithmInterface'); } $this->adapter = $adapter; return $this; }
[ "public", "function", "setAdapter", "(", "$", "adapter", ")", "{", "if", "(", "$", "adapter", "instanceof", "Compress", "\\", "CompressionAlgorithmInterface", ")", "{", "$", "this", "->", "adapter", "=", "$", "adapter", ";", "return", "$", "this", ";", "}"...
Sets compression adapter @param string|Compress\CompressionAlgorithmInterface $adapter Adapter to use @return self @throws Exception\InvalidArgumentException
[ "Sets", "compression", "adapter" ]
7554e8b0b420fd3155593af7bf76b7ccbdc8701e
https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/Compress.php#L128-L140
train
netis-pl/yii2-relauth
AuthManagerTrait.php
AuthManagerTrait.getPath
public function getPath($userId, $permissionName, $params = [], $allowCaching = true) { if ($allowCaching && empty($params) && isset($this->paths[$userId][$permissionName])) { return $this->paths[$userId][$permissionName]; } $this->checkAccess($userId, $permissionName, $params); if ($allowCaching && empty($params)) { $this->paths[$userId][$permissionName] = $this->currentPath; } return $this->currentPath; }
php
public function getPath($userId, $permissionName, $params = [], $allowCaching = true) { if ($allowCaching && empty($params) && isset($this->paths[$userId][$permissionName])) { return $this->paths[$userId][$permissionName]; } $this->checkAccess($userId, $permissionName, $params); if ($allowCaching && empty($params)) { $this->paths[$userId][$permissionName] = $this->currentPath; } return $this->currentPath; }
[ "public", "function", "getPath", "(", "$", "userId", ",", "$", "permissionName", ",", "$", "params", "=", "[", "]", ",", "$", "allowCaching", "=", "true", ")", "{", "if", "(", "$", "allowCaching", "&&", "empty", "(", "$", "params", ")", "&&", "isset"...
Returns a list of auth items between the one checked and the one assigned to the user. @param string|integer $userId the user ID. This should be either an integer or a string representing the unique identifier of a user. See [[\yii\web\User::id]]. @param string $permissionName the name of the permission to be checked against @param array $params name-value pairs that will be passed to the rules associated with the roles and permissions assigned to the user. @param boolean $allowCaching whether to allow caching the accessed path. When this parameter is true (default), if the access check of an operation was performed before, traversed path will be directly returned when calling this method to check the same operation. If this parameter is false, this method will always call [[\yii\rbac\ManagerInterface::checkAccess()]] to obtain the up-to-date traversed path. Note that this caching is effective only within the same request and only works when `$params = []`. @return array
[ "Returns", "a", "list", "of", "auth", "items", "between", "the", "one", "checked", "and", "the", "one", "assigned", "to", "the", "user", "." ]
d4561e2be2d6014071a2e8104b2f7920e55bf20e
https://github.com/netis-pl/yii2-relauth/blob/d4561e2be2d6014071a2e8104b2f7920e55bf20e/AuthManagerTrait.php#L36-L46
train
eix/core
src/php/main/Eix/Core/Settings.php
Settings.loadFromLocation
private function loadFromLocation($location) { Logger::get()->debug('Loading settings...'); // Add the trailing slash to the folder if it is missing. if (substr($location, -1) != DIRECTORY_SEPARATOR) { $location .= DIRECTORY_SEPARATOR; } $settingsLocation = $location . 'settings.json'; if (!is_readable($settingsLocation)) { Logger::get()->error( 'Settings file %s cannot be read.', $settingsLocation ); throw new Settings\Exception("Settings file $settingsLocation is unavailable."); } // Load the settings. $settings = json_decode(file_get_contents($settingsLocation), true); if (empty($settings)) { throw new Settings\Exception('Settings file cannot be parsed.'); } // Load settings customised for the current environment. $environmentSettings = null; $environment = self::getEnvironment(); if ($environment) { $environmentSettingsLocation = sprintf( '%ssettings-%s.json', $location, strtolower($environment) ); if (is_readable($environmentSettingsLocation)) { $environmentSettings = json_decode(file_get_contents($environmentSettingsLocation), true); if (!empty($environmentSettings)) { $settings = self::mergeSettings($settings, $environmentSettings); } } } $this->settings = self::objectify($settings); }
php
private function loadFromLocation($location) { Logger::get()->debug('Loading settings...'); // Add the trailing slash to the folder if it is missing. if (substr($location, -1) != DIRECTORY_SEPARATOR) { $location .= DIRECTORY_SEPARATOR; } $settingsLocation = $location . 'settings.json'; if (!is_readable($settingsLocation)) { Logger::get()->error( 'Settings file %s cannot be read.', $settingsLocation ); throw new Settings\Exception("Settings file $settingsLocation is unavailable."); } // Load the settings. $settings = json_decode(file_get_contents($settingsLocation), true); if (empty($settings)) { throw new Settings\Exception('Settings file cannot be parsed.'); } // Load settings customised for the current environment. $environmentSettings = null; $environment = self::getEnvironment(); if ($environment) { $environmentSettingsLocation = sprintf( '%ssettings-%s.json', $location, strtolower($environment) ); if (is_readable($environmentSettingsLocation)) { $environmentSettings = json_decode(file_get_contents($environmentSettingsLocation), true); if (!empty($environmentSettings)) { $settings = self::mergeSettings($settings, $environmentSettings); } } } $this->settings = self::objectify($settings); }
[ "private", "function", "loadFromLocation", "(", "$", "location", ")", "{", "Logger", "::", "get", "(", ")", "->", "debug", "(", "'Loading settings...'", ")", ";", "// Add the trailing slash to the folder if it is missing.", "if", "(", "substr", "(", "$", "location",...
Load settings from a file. @param string $location The location of the settings file. @throws Settings\Exception
[ "Load", "settings", "from", "a", "file", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Core/Settings.php#L53-L96
train
eix/core
src/php/main/Eix/Core/Settings.php
Settings.objectify
private static function objectify( array $array ) { foreach ($array as &$item) { if (is_array($item)) { $item = self::objectify($item); } } return (object)$array; }
php
private static function objectify( array $array ) { foreach ($array as &$item) { if (is_array($item)) { $item = self::objectify($item); } } return (object)$array; }
[ "private", "static", "function", "objectify", "(", "array", "$", "array", ")", "{", "foreach", "(", "$", "array", "as", "&", "$", "item", ")", "{", "if", "(", "is_array", "(", "$", "item", ")", ")", "{", "$", "item", "=", "self", "::", "objectify",...
Converts an array to an object recursively. @param array $array the array to convert @return object the converted array
[ "Converts", "an", "array", "to", "an", "object", "recursively", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Core/Settings.php#L152-L162
train
eix/core
src/php/main/Eix/Core/Settings.php
Settings.getEnvironment
public static function getEnvironment() { if (empty(self::$environment)) { self::$environment = getenv(self::ENV) ?: @$_SERVER[self::ENV] ?: @$_ENV[self::ENV]; // If the environment cannot be inferred, assume production. if (empty(self::$environment)) { self::$environment = self::ENV_PRODUCTION; } } return self::$environment; }
php
public static function getEnvironment() { if (empty(self::$environment)) { self::$environment = getenv(self::ENV) ?: @$_SERVER[self::ENV] ?: @$_ENV[self::ENV]; // If the environment cannot be inferred, assume production. if (empty(self::$environment)) { self::$environment = self::ENV_PRODUCTION; } } return self::$environment; }
[ "public", "static", "function", "getEnvironment", "(", ")", "{", "if", "(", "empty", "(", "self", "::", "$", "environment", ")", ")", "{", "self", "::", "$", "environment", "=", "getenv", "(", "self", "::", "ENV", ")", "?", ":", "@", "$", "_SERVER", ...
Find out the current environment. @return string the current environment.
[ "Find", "out", "the", "current", "environment", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Core/Settings.php#L182-L196
train
eix/core
src/php/main/Eix/Core/Settings.php
Settings.mergeSettings
public static function mergeSettings( $generalSettings, $environmentSettings ) { $mergedSettings = $generalSettings; foreach ($environmentSettings as $key => &$value) { if ( is_array($value) && isset($mergedSettings[$key]) && is_array($mergedSettings [$key]) ) { $mergedSettings[$key] = self::mergeSettings($mergedSettings[$key], $value); } else { $mergedSettings[$key] = $value; } } return $mergedSettings; }
php
public static function mergeSettings( $generalSettings, $environmentSettings ) { $mergedSettings = $generalSettings; foreach ($environmentSettings as $key => &$value) { if ( is_array($value) && isset($mergedSettings[$key]) && is_array($mergedSettings [$key]) ) { $mergedSettings[$key] = self::mergeSettings($mergedSettings[$key], $value); } else { $mergedSettings[$key] = $value; } } return $mergedSettings; }
[ "public", "static", "function", "mergeSettings", "(", "$", "generalSettings", ",", "$", "environmentSettings", ")", "{", "$", "mergedSettings", "=", "$", "generalSettings", ";", "foreach", "(", "$", "environmentSettings", "as", "$", "key", "=>", "&", "$", "val...
Merges two arrays, just like array_merge_recursive, but the second array overwrites the first one's values if there is a match. @param array $generalSettings the base array @param array $environmentSettings the overwriting array @return array the merged settings.
[ "Merges", "two", "arrays", "just", "like", "array_merge_recursive", "but", "the", "second", "array", "overwrites", "the", "first", "one", "s", "values", "if", "there", "is", "a", "match", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Core/Settings.php#L207-L226
train
FlorianWolters/PHP-Component-Core-Equality
src/main/php/EqualityUtils.php
EqualityUtils.isEqual
public static function isEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { $result = false; if (null === $first) { $result = (null === $second) ? true : false; } else { $result = $first->equals($second); } return $result; }
php
public static function isEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { $result = false; if (null === $first) { $result = (null === $second) ? true : false; } else { $result = $first->equals($second); } return $result; }
[ "public", "static", "function", "isEqual", "(", "EqualityInterface", "$", "first", "=", "null", ",", "EqualityInterface", "$", "second", "=", "null", ")", "{", "$", "result", "=", "false", ";", "if", "(", "null", "===", "$", "first", ")", "{", "$", "re...
Indicates whether the two specified objects are "equal". @param EqualityInterface|null $first The first reference object with which to compare. @param EqualityInterface|null $second The second reference object with which to compare. @return bool `true` if the two specified objects are the same; `false` otherwise.
[ "Indicates", "whether", "the", "two", "specified", "objects", "are", "equal", "." ]
6c152ce6032674c7103a456e5e3ff7f622aa8e03
https://github.com/FlorianWolters/PHP-Component-Core-Equality/blob/6c152ce6032674c7103a456e5e3ff7f622aa8e03/src/main/php/EqualityUtils.php#L51-L64
train
FlorianWolters/PHP-Component-Core-Equality
src/main/php/EqualityUtils.php
EqualityUtils.isNotEqual
public static function isNotEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { return false === self::isEqual($first, $second); }
php
public static function isNotEqual( EqualityInterface $first = null, EqualityInterface $second = null ) { return false === self::isEqual($first, $second); }
[ "public", "static", "function", "isNotEqual", "(", "EqualityInterface", "$", "first", "=", "null", ",", "EqualityInterface", "$", "second", "=", "null", ")", "{", "return", "false", "===", "self", "::", "isEqual", "(", "$", "first", ",", "$", "second", ")"...
Indicates whether the two specified objects are not "equal". @param EqualityInterface|null $first The first reference object with which to compare. @param EqualityInterface|null $second The second reference object with which to compare. @return bool `true` if the two specified objects are not the same; `false` otherwise.
[ "Indicates", "whether", "the", "two", "specified", "objects", "are", "not", "equal", "." ]
6c152ce6032674c7103a456e5e3ff7f622aa8e03
https://github.com/FlorianWolters/PHP-Component-Core-Equality/blob/6c152ce6032674c7103a456e5e3ff7f622aa8e03/src/main/php/EqualityUtils.php#L77-L82
train
phlexible/phlexible
src/Phlexible/Bundle/MediaTemplateBundle/Controller/FormController.php
FormController.loadAction
public function loadAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $template = $repository->find($templateKey); $parameters = $template->getParameters(); if (isset($parameters['method'])) { $parameters['xmethod'] = $parameters['method']; unset($parameters['method']); } return new JsonResponse(['success' => true, 'data' => $parameters]); }
php
public function loadAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $template = $repository->find($templateKey); $parameters = $template->getParameters(); if (isset($parameters['method'])) { $parameters['xmethod'] = $parameters['method']; unset($parameters['method']); } return new JsonResponse(['success' => true, 'data' => $parameters]); }
[ "public", "function", "loadAction", "(", "Request", "$", "request", ")", "{", "$", "repository", "=", "$", "this", "->", "get", "(", "'phlexible_media_template.template_manager'", ")", ";", "$", "templateKey", "=", "$", "request", "->", "get", "(", "'template_...
List variables. @param Request $request @return JsonResponse @Route("/load", name="mediatemplates_form_load")
[ "List", "variables", "." ]
132f24924c9bb0dbb6c1ea84db0a463f97fa3893
https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/MediaTemplateBundle/Controller/FormController.php#L38-L53
train
phlexible/phlexible
src/Phlexible/Bundle/MediaTemplateBundle/Controller/FormController.php
FormController.saveAction
public function saveAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $params = $request->request->all(); unset($params['template_key'], $params['module'], $params['controller'], $params['action']); $template = $repository->find($templateKey); $params = $this->fixParams($params); foreach ($params as $key => $value) { $template->setParameter($key, $value); } $repository->updateTemplate($template); return new ResultResponse(true, 'Media template "'.$template->getKey().'" saved.'); }
php
public function saveAction(Request $request) { $repository = $this->get('phlexible_media_template.template_manager'); $templateKey = $request->get('template_key'); $params = $request->request->all(); unset($params['template_key'], $params['module'], $params['controller'], $params['action']); $template = $repository->find($templateKey); $params = $this->fixParams($params); foreach ($params as $key => $value) { $template->setParameter($key, $value); } $repository->updateTemplate($template); return new ResultResponse(true, 'Media template "'.$template->getKey().'" saved.'); }
[ "public", "function", "saveAction", "(", "Request", "$", "request", ")", "{", "$", "repository", "=", "$", "this", "->", "get", "(", "'phlexible_media_template.template_manager'", ")", ";", "$", "templateKey", "=", "$", "request", "->", "get", "(", "'template_...
Save variables. @param Request $request @return ResultResponse @Route("/save", name="mediatemplates_form_save")
[ "Save", "variables", "." ]
132f24924c9bb0dbb6c1ea84db0a463f97fa3893
https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/MediaTemplateBundle/Controller/FormController.php#L63-L86
train
matryoshka-model/mongo-wrapper
library/Hydrator/Strategy/MongoIdStrategy.php
MongoIdStrategy.hydrate
public function hydrate($value) { if ($value instanceof MongoId) { return (string)$value; } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: must be an instance of MongoId, "%s" given.', is_object($value) ? get_class($value) : gettype($value) )); }
php
public function hydrate($value) { if ($value instanceof MongoId) { return (string)$value; } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: must be an instance of MongoId, "%s" given.', is_object($value) ? get_class($value) : gettype($value) )); }
[ "public", "function", "hydrate", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "MongoId", ")", "{", "return", "(", "string", ")", "$", "value", ";", "}", "if", "(", "$", "this", "->", "nullable", "&&", "$", "value", "===", "nu...
Ensure the value extracted is typed as string or null @param mixed $value The original value. @return null|string Returns the value that should be hydrated.
[ "Ensure", "the", "value", "extracted", "is", "typed", "as", "string", "or", "null" ]
d69511d7f7fc58e708c771ea0cd3c8ba7e8a155a
https://github.com/matryoshka-model/mongo-wrapper/blob/d69511d7f7fc58e708c771ea0cd3c8ba7e8a155a/library/Hydrator/Strategy/MongoIdStrategy.php#L30-L44
train
matryoshka-model/mongo-wrapper
library/Hydrator/Strategy/MongoIdStrategy.php
MongoIdStrategy.extract
public function extract($value) { if (is_string($value)) { return new MongoId($value); } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: must be a string containing a valid mongo ID, "%s" given.', is_object($value) ? get_class($value) : gettype($value) )); }
php
public function extract($value) { if (is_string($value)) { return new MongoId($value); } if ($this->nullable && $value === null) { return null; } throw new Exception\InvalidArgumentException(sprintf( 'Invalid value: must be a string containing a valid mongo ID, "%s" given.', is_object($value) ? get_class($value) : gettype($value) )); }
[ "public", "function", "extract", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "return", "new", "MongoId", "(", "$", "value", ")", ";", "}", "if", "(", "$", "this", "->", "nullable", "&&", "$", "value", "=...
Ensure the value extracted is typed as MongoId or null @param mixed $value The original value. @return null|MongoId Returns the value that should be extracted.
[ "Ensure", "the", "value", "extracted", "is", "typed", "as", "MongoId", "or", "null" ]
d69511d7f7fc58e708c771ea0cd3c8ba7e8a155a
https://github.com/matryoshka-model/mongo-wrapper/blob/d69511d7f7fc58e708c771ea0cd3c8ba7e8a155a/library/Hydrator/Strategy/MongoIdStrategy.php#L53-L67
train
FuturaSoft/Pabana
src/Mvc/Layout.php
Layout.element
public function element($elementName) { if (Configuration::read('mvc.autoload_shared_var') === true && empty($this->variableList) === false) { foreach ($this->variableList as $varName => $varValue) { ${$varName} = $varValue; } } $layoutDirectory = $this->getDirectory() . '/' . $this->getName(); $elementPath = $layoutDirectory . '/' . $elementName . '.' . $this->getExtension(); if (!file_exists($elementPath)) { trigger_error('Element file "' . $elementPath . '" doesn\'t exist.', E_USER_ERROR); return false; } ob_start(); require($elementPath); echo PHP_EOL; $bodyContent = ob_get_clean(); return $bodyContent; }
php
public function element($elementName) { if (Configuration::read('mvc.autoload_shared_var') === true && empty($this->variableList) === false) { foreach ($this->variableList as $varName => $varValue) { ${$varName} = $varValue; } } $layoutDirectory = $this->getDirectory() . '/' . $this->getName(); $elementPath = $layoutDirectory . '/' . $elementName . '.' . $this->getExtension(); if (!file_exists($elementPath)) { trigger_error('Element file "' . $elementPath . '" doesn\'t exist.', E_USER_ERROR); return false; } ob_start(); require($elementPath); echo PHP_EOL; $bodyContent = ob_get_clean(); return $bodyContent; }
[ "public", "function", "element", "(", "$", "elementName", ")", "{", "if", "(", "Configuration", "::", "read", "(", "'mvc.autoload_shared_var'", ")", "===", "true", "&&", "empty", "(", "$", "this", "->", "variableList", ")", "===", "false", ")", "{", "forea...
Load part of Layout Load Html code of part @since 1.0 @param string $elementName Element or part name @return string|bool Return Element content if success or false if error
[ "Load", "part", "of", "Layout" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Mvc/Layout.php#L147-L165
train
FuturaSoft/Pabana
src/Mvc/Layout.php
Layout.setVar
public function setVar($varName, $varValue, $force = false) { if (isset($this->variableList[$varName]) && $force === false) { trigger_error('Variable "' . $varName . '" is already defined in Layout.', E_USER_WARNING); return false; } $this->variableList[$varName] = $varValue; return true; }
php
public function setVar($varName, $varValue, $force = false) { if (isset($this->variableList[$varName]) && $force === false) { trigger_error('Variable "' . $varName . '" is already defined in Layout.', E_USER_WARNING); return false; } $this->variableList[$varName] = $varValue; return true; }
[ "public", "function", "setVar", "(", "$", "varName", ",", "$", "varValue", ",", "$", "force", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "variableList", "[", "$", "varName", "]", ")", "&&", "$", "force", "===", "false", ")"...
Set var to Layout @since 1.0 @param string $varName Name of var send to View @param string $varValue Value of var send to View @param bool $force Force change of var value if var already exist @return bool Return true
[ "Set", "var", "to", "Layout" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Mvc/Layout.php#L295-L303
train
shizhice/support
src/Arr.php
Arr.except
static public function except(array $input, $keys) { $keys = is_array($keys) ? $keys : array_slice(func_get_args(),1); foreach ($keys as $key) { unset($input[$key]); } return $input; }
php
static public function except(array $input, $keys) { $keys = is_array($keys) ? $keys : array_slice(func_get_args(),1); foreach ($keys as $key) { unset($input[$key]); } return $input; }
[ "static", "public", "function", "except", "(", "array", "$", "input", ",", "$", "keys", ")", "{", "$", "keys", "=", "is_array", "(", "$", "keys", ")", "?", "$", "keys", ":", "array_slice", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "foreac...
return except key data from array @param array $input @param $keys @return array
[ "return", "except", "key", "data", "from", "array" ]
75b05fb28840767979396d6693120a8d5c22bdbc
https://github.com/shizhice/support/blob/75b05fb28840767979396d6693120a8d5c22bdbc/src/Arr.php#L31-L40
train
shizhice/support
src/Arr.php
Arr.extend
static public function extend(array $to, array $from) { foreach ($from as $key => $value) { if (is_array($value)) { $to[$key] = self::extend((array) (isset($to[$key]) ? $to[$key] : []),$value); }else{ $to[$key] = $value; } } return $to; }
php
static public function extend(array $to, array $from) { foreach ($from as $key => $value) { if (is_array($value)) { $to[$key] = self::extend((array) (isset($to[$key]) ? $to[$key] : []),$value); }else{ $to[$key] = $value; } } return $to; }
[ "static", "public", "function", "extend", "(", "array", "$", "to", ",", "array", "$", "from", ")", "{", "foreach", "(", "$", "from", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "...
extend a array @param array $to @param array $from @return array
[ "extend", "a", "array" ]
75b05fb28840767979396d6693120a8d5c22bdbc
https://github.com/shizhice/support/blob/75b05fb28840767979396d6693120a8d5c22bdbc/src/Arr.php#L48-L58
train
shizhice/support
src/Arr.php
Arr.xmlToArray
static public function xmlToArray($xml) { //禁止引用外部xml实体 libxml_disable_entity_loader(true); $values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $values; }
php
static public function xmlToArray($xml) { //禁止引用外部xml实体 libxml_disable_entity_loader(true); $values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $values; }
[ "static", "public", "function", "xmlToArray", "(", "$", "xml", ")", "{", "//禁止引用外部xml实体", "libxml_disable_entity_loader", "(", "true", ")", ";", "$", "values", "=", "json_decode", "(", "json_encode", "(", "simplexml_load_string", "(", "$", "xml", ",", "'SimpleXM...
xml to array @param $xml @return mixed
[ "xml", "to", "array" ]
75b05fb28840767979396d6693120a8d5c22bdbc
https://github.com/shizhice/support/blob/75b05fb28840767979396d6693120a8d5c22bdbc/src/Arr.php#L85-L91
train
shizhice/support
src/Arr.php
Arr.replaceArrayKey
static public function replaceArrayKey($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]] = $value; } } return $newArr; }
php
static public function replaceArrayKey($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]] = $value; } } return $newArr; }
[ "static", "public", "function", "replaceArrayKey", "(", "$", "arr", "=", "[", "]", ",", "$", "field", "=", "''", ")", "{", "$", "newArr", "=", "[", "]", ";", "if", "(", "$", "arr", ")", "{", "foreach", "(", "$", "arr", "as", "$", "value", ")", ...
replace array key @param array $arr @param string $field @return array
[ "replace", "array", "key" ]
75b05fb28840767979396d6693120a8d5c22bdbc
https://github.com/shizhice/support/blob/75b05fb28840767979396d6693120a8d5c22bdbc/src/Arr.php#L146-L155
train
shizhice/support
src/Arr.php
Arr.replaceArrayKeyWithArray
static public function replaceArrayKeyWithArray($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]][] = $value; } } return $newArr; }
php
static public function replaceArrayKeyWithArray($arr = [],$field = '') { $newArr = []; if($arr){ foreach ($arr as $value) { $newArr[$value[$field]][] = $value; } } return $newArr; }
[ "static", "public", "function", "replaceArrayKeyWithArray", "(", "$", "arr", "=", "[", "]", ",", "$", "field", "=", "''", ")", "{", "$", "newArr", "=", "[", "]", ";", "if", "(", "$", "arr", ")", "{", "foreach", "(", "$", "arr", "as", "$", "value"...
replace array key with array @param array $arr @param string $field @return array
[ "replace", "array", "key", "with", "array" ]
75b05fb28840767979396d6693120a8d5c22bdbc
https://github.com/shizhice/support/blob/75b05fb28840767979396d6693120a8d5c22bdbc/src/Arr.php#L163-L172
train
monolyth-php/formulaic
src/JsonSerialize.php
JsonSerialize.jsonSerialize
public function jsonSerialize() { $copy = []; foreach ((array)$this as $key => $value) { if (!is_string($value)) { $element = $value->getElement(); if (is_object($element) and method_exists($element, 'name') and $name = $element->name() ) { $copy[$name] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value; } $copy[$key] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value; } else { $copy[$key] = $value; } } return $copy; }
php
public function jsonSerialize() { $copy = []; foreach ((array)$this as $key => $value) { if (!is_string($value)) { $element = $value->getElement(); if (is_object($element) and method_exists($element, 'name') and $name = $element->name() ) { $copy[$name] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value; } $copy[$key] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value; } else { $copy[$key] = $value; } } return $copy; }
[ "public", "function", "jsonSerialize", "(", ")", "{", "$", "copy", "=", "[", "]", ";", "foreach", "(", "(", "array", ")", "$", "this", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{"...
Returns a `json_encode`able hash. @return array
[ "Returns", "a", "json_encode", "able", "hash", "." ]
4bf7853a0c29cc17957f1b26c79f633867742c14
https://github.com/monolyth-php/formulaic/blob/4bf7853a0c29cc17957f1b26c79f633867742c14/src/JsonSerialize.php#L14-L32
train
AnonymPHP/Anonym-Library
src/Anonym/Constructors/RequestConstructor.php
RequestConstructor.register
public function register() { $this->singleton( 'validation', function () { return new Validation(); } ); $app = &$this->app; // register the request $this->singleton( 'http.request', function () use (&$app) { $request = new Request($app['validation']); $request->header('X-FRAMEWORK-NAME', $app->getName()); $request->header('X-FRAMEWORK-VERSION', $app->getVersion()); return $request; }, true ); // register the response $this->bind( 'http.response', function () use (&$app) { return $app->make('http.request')->getResponse(); }, true ); }
php
public function register() { $this->singleton( 'validation', function () { return new Validation(); } ); $app = &$this->app; // register the request $this->singleton( 'http.request', function () use (&$app) { $request = new Request($app['validation']); $request->header('X-FRAMEWORK-NAME', $app->getName()); $request->header('X-FRAMEWORK-VERSION', $app->getVersion()); return $request; }, true ); // register the response $this->bind( 'http.response', function () use (&$app) { return $app->make('http.request')->getResponse(); }, true ); }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "singleton", "(", "'validation'", ",", "function", "(", ")", "{", "return", "new", "Validation", "(", ")", ";", "}", ")", ";", "$", "app", "=", "&", "$", "this", "->", "app", ";", ...
add the request and response to container
[ "add", "the", "request", "and", "response", "to", "container" ]
c967ad804f84e8fb204593a0959cda2fed5ae075
https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Constructors/RequestConstructor.php#L30-L65
train
xinc-develop/xinc-core
src/Plugin/Property/SetTask.php
SetTask.setName
public function setName($name, $build) { $this->_name = (string) $name; if (isset($this->_name) && isset($this->_value)) { $build->getProperties()->set($this->_name, $this->_value); } }
php
public function setName($name, $build) { $this->_name = (string) $name; if (isset($this->_name) && isset($this->_value)) { $build->getProperties()->set($this->_name, $this->_value); } }
[ "public", "function", "setName", "(", "$", "name", ",", "$", "build", ")", "{", "$", "this", "->", "_name", "=", "(", "string", ")", "$", "name", ";", "if", "(", "isset", "(", "$", "this", "->", "_name", ")", "&&", "isset", "(", "$", "this", "-...
sets the name of the property. @param string $name
[ "sets", "the", "name", "of", "the", "property", "." ]
4bb69a6afe19e1186950a3122cbfe0989823e0d6
https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Plugin/Property/SetTask.php#L64-L70
train
xinc-develop/xinc-core
src/Plugin/Property/SetTask.php
SetTask.setValue
public function setValue($value, $build) { $this->_value = (string) $value; if (isset($this->_name) && isset($this->_value)) { $build->setProperty($this->_name, $this->_value); } }
php
public function setValue($value, $build) { $this->_value = (string) $value; if (isset($this->_name) && isset($this->_value)) { $build->setProperty($this->_name, $this->_value); } }
[ "public", "function", "setValue", "(", "$", "value", ",", "$", "build", ")", "{", "$", "this", "->", "_value", "=", "(", "string", ")", "$", "value", ";", "if", "(", "isset", "(", "$", "this", "->", "_name", ")", "&&", "isset", "(", "$", "this", ...
sets the value of the property. @param string $value
[ "sets", "the", "value", "of", "the", "property", "." ]
4bb69a6afe19e1186950a3122cbfe0989823e0d6
https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Plugin/Property/SetTask.php#L77-L83
train
xinc-develop/xinc-core
src/Plugin/Property/SetTask.php
SetTask.validate
public function validate(&$msg = null) { if (!isset($this->_name) && !isset($this->_value) && !isset($this->_file)) { return false; } elseif (isset($this->_file) && (isset($this->_name) || isset($this->_value))) { return false; } elseif ((isset($this->_name) && !isset($this->_value)) || (!isset($this->_name) && isset($this->_value))) { return false; } else { return true; } }
php
public function validate(&$msg = null) { if (!isset($this->_name) && !isset($this->_value) && !isset($this->_file)) { return false; } elseif (isset($this->_file) && (isset($this->_name) || isset($this->_value))) { return false; } elseif ((isset($this->_name) && !isset($this->_value)) || (!isset($this->_name) && isset($this->_value))) { return false; } else { return true; } }
[ "public", "function", "validate", "(", "&", "$", "msg", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_name", ")", "&&", "!", "isset", "(", "$", "this", "->", "_value", ")", "&&", "!", "isset", "(", "$", "this", "->",...
Validates if a task can run by checking configs, directries and so on. @return bool Is true if task can run
[ "Validates", "if", "a", "task", "can", "run", "by", "checking", "configs", "directries", "and", "so", "on", "." ]
4bb69a6afe19e1186950a3122cbfe0989823e0d6
https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Plugin/Property/SetTask.php#L100-L111
train
unimatrix/cake
src/Model/Behavior/UploadableBehavior.php
UploadableBehavior.beforeMarshal
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { // configuration set? $this->check(); // load validator and add our custom upload validator $validator = $this->_table->getValidator(); $validator->setProvider('upload', UploadValidation::class); // go through each field foreach($this->_config['fields'] as $field => $path) { // add validators $validator->add($field, [ 'isUnderPhpSizeLimit' => ['rule' => 'isUnderPhpSizeLimit', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file is too large')], 'isUnderFormSizeLimit' => ['rule' => 'isUnderFormSizeLimit', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file is too large')], 'isCompletedUpload' => ['rule' => 'isCompletedUpload', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file was only partially uploaded')], 'isTemporaryDirectory' => ['rule' => 'isTemporaryDirectory', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Missing a temporary folder')], 'isSuccessfulWrite' => ['rule' => 'isSuccessfulWrite', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Failed to write file to disk')], 'isNotStoppedByExtension' => ['rule' => 'isNotStoppedByExtension', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Upload was stopped by extension')], ]); // empty allowed? && no file uploaded? unset field if($validator->isEmptyAllowed($field, false) && isset($data[$field]['error']) && $data[$field]['error'] === UPLOAD_ERR_NO_FILE) unset($data[$field]); } }
php
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { // configuration set? $this->check(); // load validator and add our custom upload validator $validator = $this->_table->getValidator(); $validator->setProvider('upload', UploadValidation::class); // go through each field foreach($this->_config['fields'] as $field => $path) { // add validators $validator->add($field, [ 'isUnderPhpSizeLimit' => ['rule' => 'isUnderPhpSizeLimit', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file is too large')], 'isUnderFormSizeLimit' => ['rule' => 'isUnderFormSizeLimit', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file is too large')], 'isCompletedUpload' => ['rule' => 'isCompletedUpload', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'This file was only partially uploaded')], 'isTemporaryDirectory' => ['rule' => 'isTemporaryDirectory', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Missing a temporary folder')], 'isSuccessfulWrite' => ['rule' => 'isSuccessfulWrite', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Failed to write file to disk')], 'isNotStoppedByExtension' => ['rule' => 'isNotStoppedByExtension', 'provider' => 'upload', 'message' => __d('Unimatrix/cake', 'Upload was stopped by extension')], ]); // empty allowed? && no file uploaded? unset field if($validator->isEmptyAllowed($field, false) && isset($data[$field]['error']) && $data[$field]['error'] === UPLOAD_ERR_NO_FILE) unset($data[$field]); } }
[ "public", "function", "beforeMarshal", "(", "Event", "$", "event", ",", "ArrayObject", "$", "data", ",", "ArrayObject", "$", "options", ")", "{", "// configuration set?", "$", "this", "->", "check", "(", ")", ";", "// load validator and add our custom upload validat...
If a field is allowed to be empty as defined in the validation it should be unset to prevent processing @param \Cake\Event\Event $event Event instance @param ArrayObject $data Data to process @return void
[ "If", "a", "field", "is", "allowed", "to", "be", "empty", "as", "defined", "in", "the", "validation", "it", "should", "be", "unset", "to", "prevent", "processing" ]
23003aba497822bd473fdbf60514052dda1874fc
https://github.com/unimatrix/cake/blob/23003aba497822bd473fdbf60514052dda1874fc/src/Model/Behavior/UploadableBehavior.php#L92-L117
train
sebardo/ecommerce
EcommerceBundle/Controller/PlanController.php
PlanController.newAction
public function newAction(Request $request) { $entity = new Plan(); $form = $this->createForm('EcommerceBundle\Form\PlanType', $entity); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $checkoutManager = $this->get('checkout_manager'); $checkoutManager->createPaypalPlan($entity); $checkoutManager->activePaypalPlan($entity); //if come from popup if ($request->isXMLHttpRequest()) { return new JsonResponse(array( 'id' => $entity->getId(), 'name' => $entity->getName() )); } $this->get('session')->getFlashBag()->add('success', 'plan.created'); return $this->redirectToRoute('ecommerce_plan_show', array('id' => $entity->getId())); } return array( 'entity' => $entity, 'form' => $form->createView(), ); }
php
public function newAction(Request $request) { $entity = new Plan(); $form = $this->createForm('EcommerceBundle\Form\PlanType', $entity); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $checkoutManager = $this->get('checkout_manager'); $checkoutManager->createPaypalPlan($entity); $checkoutManager->activePaypalPlan($entity); //if come from popup if ($request->isXMLHttpRequest()) { return new JsonResponse(array( 'id' => $entity->getId(), 'name' => $entity->getName() )); } $this->get('session')->getFlashBag()->add('success', 'plan.created'); return $this->redirectToRoute('ecommerce_plan_show', array('id' => $entity->getId())); } return array( 'entity' => $entity, 'form' => $form->createView(), ); }
[ "public", "function", "newAction", "(", "Request", "$", "request", ")", "{", "$", "entity", "=", "new", "Plan", "(", ")", ";", "$", "form", "=", "$", "this", "->", "createForm", "(", "'EcommerceBundle\\Form\\PlanType'", ",", "$", "entity", ")", ";", "$",...
Creates a new Plan entity. @Route("/new") @Method({"GET", "POST"}) @Template()
[ "Creates", "a", "new", "Plan", "entity", "." ]
3e17545e69993f10a1df17f9887810c7378fc7f9
https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/PlanController.php#L68-L99
train
sebardo/ecommerce
EcommerceBundle/Controller/PlanController.php
PlanController.showAction
public function showAction(Plan $plan) { $deleteForm = $this->createDeleteForm($plan); //get plan $paypalPlan = $this->get('checkout_manager')->getPaypalPlan($plan); return array( 'entity' => $plan, 'delete_form' => $deleteForm->createView(), 'paypalPlan' => $paypalPlan ); }
php
public function showAction(Plan $plan) { $deleteForm = $this->createDeleteForm($plan); //get plan $paypalPlan = $this->get('checkout_manager')->getPaypalPlan($plan); return array( 'entity' => $plan, 'delete_form' => $deleteForm->createView(), 'paypalPlan' => $paypalPlan ); }
[ "public", "function", "showAction", "(", "Plan", "$", "plan", ")", "{", "$", "deleteForm", "=", "$", "this", "->", "createDeleteForm", "(", "$", "plan", ")", ";", "//get plan", "$", "paypalPlan", "=", "$", "this", "->", "get", "(", "'checkout_manager'", ...
Finds and displays a Plan entity. @Route("/{id}") @Method("GET") @Template()
[ "Finds", "and", "displays", "a", "Plan", "entity", "." ]
3e17545e69993f10a1df17f9887810c7378fc7f9
https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/PlanController.php#L108-L119
train
sebardo/ecommerce
EcommerceBundle/Controller/PlanController.php
PlanController.createDeleteForm
private function createDeleteForm(Plan $plan) { return $this->createFormBuilder() ->setAction($this->generateUrl('ecommerce_plan_delete', array('id' => $plan->getId()))) ->setMethod('DELETE') ->getForm() ; }
php
private function createDeleteForm(Plan $plan) { return $this->createFormBuilder() ->setAction($this->generateUrl('ecommerce_plan_delete', array('id' => $plan->getId()))) ->setMethod('DELETE') ->getForm() ; }
[ "private", "function", "createDeleteForm", "(", "Plan", "$", "plan", ")", "{", "return", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'ecommerce_plan_delete'", ",", "array", "(", "'id'", "=...
Creates a form to delete a Plan entity. @param Plan $plan The Plan entity @return \Symfony\Component\Form\Form The form
[ "Creates", "a", "form", "to", "delete", "a", "Plan", "entity", "." ]
3e17545e69993f10a1df17f9887810c7378fc7f9
https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/PlanController.php#L182-L189
train
dbtlr/php-env-builder
src/ComposerScriptRunner.php
ComposerScriptRunner.getEnvFile
public function getEnvFile() { $basePath = $this->getBasePath(); $envFile = $this->get('envFile'); $startsWith = substr($envFile, 0, 1); if (!$startsWith !== '/' && $startsWith !== '~' && $startsWith !== '\\') { $envFile = $basePath . DIRECTORY_SEPARATOR . $envFile; } return $envFile; }
php
public function getEnvFile() { $basePath = $this->getBasePath(); $envFile = $this->get('envFile'); $startsWith = substr($envFile, 0, 1); if (!$startsWith !== '/' && $startsWith !== '~' && $startsWith !== '\\') { $envFile = $basePath . DIRECTORY_SEPARATOR . $envFile; } return $envFile; }
[ "public", "function", "getEnvFile", "(", ")", "{", "$", "basePath", "=", "$", "this", "->", "getBasePath", "(", ")", ";", "$", "envFile", "=", "$", "this", "->", "get", "(", "'envFile'", ")", ";", "$", "startsWith", "=", "substr", "(", "$", "envFile"...
Get the full path to the env file. @return mixed|null|string
[ "Get", "the", "full", "path", "to", "the", "env", "file", "." ]
94b78bcd308d58dc7994164a87e80fe39ed871c7
https://github.com/dbtlr/php-env-builder/blob/94b78bcd308d58dc7994164a87e80fe39ed871c7/src/ComposerScriptRunner.php#L91-L101
train
dbtlr/php-env-builder
src/ComposerScriptRunner.php
ComposerScriptRunner.verifyExtras
protected function verifyExtras(array $extras) { if (!isset($extras['php-env-builder'])) { throw new \InvalidArgumentException( 'The parameter handler needs to be configured through the ' . 'extra.php-env-builder setting.' ); } if (!is_array($extras['php-env-builder'])) { throw new \InvalidArgumentException( 'The extra.php-env-builder setting must be an array or a configuration object.' ); } if (!isset($extras['php-env-builder']['questions']) || !is_array($extras['php-env-builder']['questions'])) { throw new \InvalidArgumentException( 'The extra.php-env-builder.questions setting must be an array of questions.' ); } }
php
protected function verifyExtras(array $extras) { if (!isset($extras['php-env-builder'])) { throw new \InvalidArgumentException( 'The parameter handler needs to be configured through the ' . 'extra.php-env-builder setting.' ); } if (!is_array($extras['php-env-builder'])) { throw new \InvalidArgumentException( 'The extra.php-env-builder setting must be an array or a configuration object.' ); } if (!isset($extras['php-env-builder']['questions']) || !is_array($extras['php-env-builder']['questions'])) { throw new \InvalidArgumentException( 'The extra.php-env-builder.questions setting must be an array of questions.' ); } }
[ "protected", "function", "verifyExtras", "(", "array", "$", "extras", ")", "{", "if", "(", "!", "isset", "(", "$", "extras", "[", "'php-env-builder'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The parameter handler needs to be ...
Verify that the extras a formatted properly and throw an exception if not. @throws \InvalidArgumentException @param array $extras
[ "Verify", "that", "the", "extras", "a", "formatted", "properly", "and", "throw", "an", "exception", "if", "not", "." ]
94b78bcd308d58dc7994164a87e80fe39ed871c7
https://github.com/dbtlr/php-env-builder/blob/94b78bcd308d58dc7994164a87e80fe39ed871c7/src/ComposerScriptRunner.php#L127-L147
train
dbtlr/php-env-builder
src/ComposerScriptRunner.php
ComposerScriptRunner.build
public static function build(Event $event, Builder $builder = null) { $runner = new ComposerScriptRunner($event, $builder); $runner->run(); }
php
public static function build(Event $event, Builder $builder = null) { $runner = new ComposerScriptRunner($event, $builder); $runner->run(); }
[ "public", "static", "function", "build", "(", "Event", "$", "event", ",", "Builder", "$", "builder", "=", "null", ")", "{", "$", "runner", "=", "new", "ComposerScriptRunner", "(", "$", "event", ",", "$", "builder", ")", ";", "$", "runner", "->", "run",...
Build the config based on a composer's package.json file. @throws ConfigurationException @throws AskException @param Event $event @param Builder $builder
[ "Build", "the", "config", "based", "on", "a", "composer", "s", "package", ".", "json", "file", "." ]
94b78bcd308d58dc7994164a87e80fe39ed871c7
https://github.com/dbtlr/php-env-builder/blob/94b78bcd308d58dc7994164a87e80fe39ed871c7/src/ComposerScriptRunner.php#L183-L187
train
dbtlr/php-env-builder
src/ComposerScriptRunner.php
ComposerScriptRunner.askQuestions
protected function askQuestions(array $questons) { foreach ($questons as $question) { $this->verifyQuestion($question); $name = $question['name']; $prompt = $question['prompt']; $default = isset($question['default']) ? $question['default'] : ''; $required = isset($question['required']) ? (bool) $question['required'] : false; $this->builder->ask($name, $prompt, $default, $required); } }
php
protected function askQuestions(array $questons) { foreach ($questons as $question) { $this->verifyQuestion($question); $name = $question['name']; $prompt = $question['prompt']; $default = isset($question['default']) ? $question['default'] : ''; $required = isset($question['required']) ? (bool) $question['required'] : false; $this->builder->ask($name, $prompt, $default, $required); } }
[ "protected", "function", "askQuestions", "(", "array", "$", "questons", ")", "{", "foreach", "(", "$", "questons", "as", "$", "question", ")", "{", "$", "this", "->", "verifyQuestion", "(", "$", "question", ")", ";", "$", "name", "=", "$", "question", ...
Run through each of the questions and ask each one. @param array $questons
[ "Run", "through", "each", "of", "the", "questions", "and", "ask", "each", "one", "." ]
94b78bcd308d58dc7994164a87e80fe39ed871c7
https://github.com/dbtlr/php-env-builder/blob/94b78bcd308d58dc7994164a87e80fe39ed871c7/src/ComposerScriptRunner.php#L211-L223
train
dbtlr/php-env-builder
src/ComposerScriptRunner.php
ComposerScriptRunner.shouldCancelOnClobber
protected function shouldCancelOnClobber() { $fullPath = $this->getEnvFile(); if (!$this->get('clobber') && file_exists($fullPath)) { $this->event->getIO()->write(sprintf('Env file `%s` already exists, skipping...', $fullPath)); return true; } return false; }
php
protected function shouldCancelOnClobber() { $fullPath = $this->getEnvFile(); if (!$this->get('clobber') && file_exists($fullPath)) { $this->event->getIO()->write(sprintf('Env file `%s` already exists, skipping...', $fullPath)); return true; } return false; }
[ "protected", "function", "shouldCancelOnClobber", "(", ")", "{", "$", "fullPath", "=", "$", "this", "->", "getEnvFile", "(", ")", ";", "if", "(", "!", "$", "this", "->", "get", "(", "'clobber'", ")", "&&", "file_exists", "(", "$", "fullPath", ")", ")",...
If we're clobbering and we're not supposed to, should we cancel? @return bool
[ "If", "we", "re", "clobbering", "and", "we", "re", "not", "supposed", "to", "should", "we", "cancel?" ]
94b78bcd308d58dc7994164a87e80fe39ed871c7
https://github.com/dbtlr/php-env-builder/blob/94b78bcd308d58dc7994164a87e80fe39ed871c7/src/ComposerScriptRunner.php#L251-L260
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.disconnect
public function disconnect(): void { if ($this->connected() === true) { fclose($this->connection); $this->connection = false; } }
php
public function disconnect(): void { if ($this->connected() === true) { fclose($this->connection); $this->connection = false; } }
[ "public", "function", "disconnect", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "connected", "(", ")", "===", "true", ")", "{", "fclose", "(", "$", "this", "->", "connection", ")", ";", "$", "this", "->", "connection", "=", "false", "...
Disconnect from the server. @return void
[ "Disconnect", "from", "the", "server", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L77-L84
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.setBlocking
public function setBlocking(int $mode): bool { if ($this->connected() === false) { throw new \Exception('Not connected'); } return stream_set_blocking($this->connection, $mode); }
php
public function setBlocking(int $mode): bool { if ($this->connected() === false) { throw new \Exception('Not connected'); } return stream_set_blocking($this->connection, $mode); }
[ "public", "function", "setBlocking", "(", "int", "$", "mode", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "connected", "(", ")", "===", "false", ")", "{", "throw", "new", "\\", "Exception", "(", "'Not connected'", ")", ";", "}", "return", "s...
Set the mode of stream-blocking. @param int $mode @return bool @throws \Exception
[ "Set", "the", "mode", "of", "stream", "-", "blocking", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L118-L126
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.read
public function read(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = ''; $continue = true; while ($continue == true) { $data = null; try { $data = $this->readLine(); } catch (\Exception $e) { $continue = false; } if (!is_null($data)) { $response .= $data; } } return $response; }
php
public function read(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = ''; $continue = true; while ($continue == true) { $data = null; try { $data = $this->readLine(); } catch (\Exception $e) { $continue = false; } if (!is_null($data)) { $response .= $data; } } return $response; }
[ "public", "function", "read", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "connected", "(", ")", "===", "false", ")", "{", "throw", "new", "\\", "Exception", "(", "'Not connected'", ")", ";", "}", "$", "response", "=", "''", ";", "$...
Read all data from the stream. @return string @throws \Exception
[ "Read", "all", "data", "from", "the", "stream", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L133-L163
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.readLine
public function readLine(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fgets($this->connection); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
php
public function readLine(): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fgets($this->connection); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
[ "public", "function", "readLine", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "connected", "(", ")", "===", "false", ")", "{", "throw", "new", "\\", "Exception", "(", "'Not connected'", ")", ";", "}", "$", "response", "=", "fgets", "(...
Read a line of data from the stream. @return string @throws \Exception
[ "Read", "a", "line", "of", "data", "from", "the", "stream", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L170-L185
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.readBytes
public function readBytes(int $bytes): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fread($this->connection, $bytes); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
php
public function readBytes(int $bytes): string { if ($this->connected() === false) { throw new \Exception('Not connected'); } $response = fread($this->connection, $bytes); if ($response === false) { throw new \Exception('Nothing to read'); } return $response; }
[ "public", "function", "readBytes", "(", "int", "$", "bytes", ")", ":", "string", "{", "if", "(", "$", "this", "->", "connected", "(", ")", "===", "false", ")", "{", "throw", "new", "\\", "Exception", "(", "'Not connected'", ")", ";", "}", "$", "respo...
Read a number of bytes from the stream. @param int $bytes @return string @throws \Exception
[ "Read", "a", "number", "of", "bytes", "from", "the", "stream", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L193-L208
train
unrealization/php-tcpconnection
src/TCPConnection.php
TCPConnection.writeLine
public function writeLine(string $data): void { try { $this->write($data."\r\n"); } catch (\Exception $e) { throw $e; } }
php
public function writeLine(string $data): void { try { $this->write($data."\r\n"); } catch (\Exception $e) { throw $e; } }
[ "public", "function", "writeLine", "(", "string", "$", "data", ")", ":", "void", "{", "try", "{", "$", "this", "->", "write", "(", "$", "data", ".", "\"\\r\\n\"", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "$", "...
Write a line of data to the stream. @param string $data @return void @throws \Exception
[ "Write", "a", "line", "of", "data", "to", "the", "stream", "." ]
6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283
https://github.com/unrealization/php-tcpconnection/blob/6ebb0cbfdee9b4bc0c3738faed317b35e7fe1283/src/TCPConnection.php#L232-L242
train
fabsgc/framework
Core/Http/Request/Auth.php
Auth.role
public function role($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $role = explode('.', $this->_config->config['firewall']['' . $src . '']['roles']['name']); return $this->_getSession($role); } else { $role = explode('.', $this->_config->config['firewall']['' . $src . '']['roles']['name']); $this->_setSession($role, $value); } } else { throw new MissingConfigException('the module ' . $src . ' doesn\'t exist'); } return false; }
php
public function role($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $role = explode('.', $this->_config->config['firewall']['' . $src . '']['roles']['name']); return $this->_getSession($role); } else { $role = explode('.', $this->_config->config['firewall']['' . $src . '']['roles']['name']); $this->_setSession($role, $value); } } else { throw new MissingConfigException('the module ' . $src . ' doesn\'t exist'); } return false; }
[ "public", "function", "role", "(", "$", "src", ",", "$", "value", "=", "''", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_config", "->", "config", "[", "'firewall'", "]", "[", "''", ".", "$", "src", ".", "''", "]", ")", ")", "{", "...
Get and Set the value of any role attribute @access public @param $src string @param $value string : new value @return mixed @throws \Gcs\Framework\Core\Exception\MissingConfigException @since 3.0 @package Gcs\Framework\Core\Http\Request
[ "Get", "and", "Set", "the", "value", "of", "any", "role", "attribute" ]
45e58182aba6a3c6381970a1fd3c17662cff2168
https://github.com/fabsgc/framework/blob/45e58182aba6a3c6381970a1fd3c17662cff2168/Core/Http/Request/Auth.php#L127-L144
train
fabsgc/framework
Core/Http/Request/Auth.php
Auth.logged
public function logged($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $logged = explode('.', $this->_config->config['firewall']['' . $src . '']['logged']['name']); $data = $this->_getSession($logged); if ($data != '') { return $data; } else { return false; } } else { $logged = explode('.', $this->_config->config['firewall']['' . $src . '']['logged']['name']); $this->_setSession($logged, $value); } } else { throw new MissingConfigException('the module ' . $src . ' doesn\'t exist'); } return false; }
php
public function logged($src, $value = '') { if (isset($this->_config->config['firewall']['' . $src . ''])) { if ($value == '') { $logged = explode('.', $this->_config->config['firewall']['' . $src . '']['logged']['name']); $data = $this->_getSession($logged); if ($data != '') { return $data; } else { return false; } } else { $logged = explode('.', $this->_config->config['firewall']['' . $src . '']['logged']['name']); $this->_setSession($logged, $value); } } else { throw new MissingConfigException('the module ' . $src . ' doesn\'t exist'); } return false; }
[ "public", "function", "logged", "(", "$", "src", ",", "$", "value", "=", "''", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_config", "->", "config", "[", "'firewall'", "]", "[", "''", ".", "$", "src", ".", "''", "]", ")", ")", "{", ...
Get and Set the value of any logged attribute @access public @param $src string @param $value string : new value @throws \Gcs\Framework\Core\Exception\MissingConfigException @return mixed @since 3.0 @package Gcs\Framework\Core\Http\Request
[ "Get", "and", "Set", "the", "value", "of", "any", "logged", "attribute" ]
45e58182aba6a3c6381970a1fd3c17662cff2168
https://github.com/fabsgc/framework/blob/45e58182aba6a3c6381970a1fd3c17662cff2168/Core/Http/Request/Auth.php#L157-L181
train
ARCANESOFT/Tracker
src/ViewComposers/Dashboard/DevicesRatioComposer.php
DevicesRatioComposer.getDevicesFromSessions
protected function getDevicesFromSessions(Carbon $start, Carbon $end) { return $this->getVisitorsFilteredByDateRange($start, $end) ->filter(function (Visitor $session) { return $session->hasDevice(); }) ->transform(function (Visitor $session) { return $session->device; }) ->groupBy('kind') ->transform(function (Collection $items, $key) { return [ 'kind' => trans("tracker::devices.kinds.$key"), 'count' => $items->count(), ]; }); }
php
protected function getDevicesFromSessions(Carbon $start, Carbon $end) { return $this->getVisitorsFilteredByDateRange($start, $end) ->filter(function (Visitor $session) { return $session->hasDevice(); }) ->transform(function (Visitor $session) { return $session->device; }) ->groupBy('kind') ->transform(function (Collection $items, $key) { return [ 'kind' => trans("tracker::devices.kinds.$key"), 'count' => $items->count(), ]; }); }
[ "protected", "function", "getDevicesFromSessions", "(", "Carbon", "$", "start", ",", "Carbon", "$", "end", ")", "{", "return", "$", "this", "->", "getVisitorsFilteredByDateRange", "(", "$", "start", ",", "$", "end", ")", "->", "filter", "(", "function", "(",...
Get the devices from sessions. @param \Carbon\Carbon $start @param \Carbon\Carbon $end @return \Illuminate\Support\Collection
[ "Get", "the", "devices", "from", "sessions", "." ]
d106209b32ddbb192066715f0ef99afccfc22dcb
https://github.com/ARCANESOFT/Tracker/blob/d106209b32ddbb192066715f0ef99afccfc22dcb/src/ViewComposers/Dashboard/DevicesRatioComposer.php#L60-L76
train
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/tcpdf_adapter.cls.php
TCPDF_Adapter._set_stroke_colour
protected function _set_stroke_colour($colour) { $colour[0] = round(255 * $colour[0]); $colour[1] = round(255 * $colour[1]); $colour[2] = round(255 * $colour[2]); if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) { $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]); $this->_last_stroke_color = $color; } }
php
protected function _set_stroke_colour($colour) { $colour[0] = round(255 * $colour[0]); $colour[1] = round(255 * $colour[1]); $colour[2] = round(255 * $colour[2]); if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) { $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]); $this->_last_stroke_color = $color; } }
[ "protected", "function", "_set_stroke_colour", "(", "$", "colour", ")", "{", "$", "colour", "[", "0", "]", "=", "round", "(", "255", "*", "$", "colour", "[", "0", "]", ")", ";", "$", "colour", "[", "1", "]", "=", "round", "(", "255", "*", "$", ...
Sets the stroke colour @param array $color
[ "Sets", "the", "stroke", "colour" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/tcpdf_adapter.cls.php#L150-L160
train
Worldpay/worldpay-lib-php
lib/Connection.php
Connection.getInstance
public static function getInstance() { if (!function_exists("curl_init")) { Error::throwError("cine"); } static $inst = null; if ($inst === null) { $inst = new Connection(); $inst->client_user_agent = $inst->getBaseClientUserAgent(); } return $inst; }
php
public static function getInstance() { if (!function_exists("curl_init")) { Error::throwError("cine"); } static $inst = null; if ($inst === null) { $inst = new Connection(); $inst->client_user_agent = $inst->getBaseClientUserAgent(); } return $inst; }
[ "public", "static", "function", "getInstance", "(", ")", "{", "if", "(", "!", "function_exists", "(", "\"curl_init\"", ")", ")", "{", "Error", "::", "throwError", "(", "\"cine\"", ")", ";", "}", "static", "$", "inst", "=", "null", ";", "if", "(", "$", ...
Call this method to get singleton @return Connection
[ "Call", "this", "method", "to", "get", "singleton" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Connection.php#L22-L34
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.createApmOrder
public function createApmOrder($order = array()) { $myOrder = new APMOrder($order); $response = OrderService::createOrder($myOrder); if (isset($response["orderCode"])) { //success return $response; } else { Error::throwError("apierror"); } }
php
public function createApmOrder($order = array()) { $myOrder = new APMOrder($order); $response = OrderService::createOrder($myOrder); if (isset($response["orderCode"])) { //success return $response; } else { Error::throwError("apierror"); } }
[ "public", "function", "createApmOrder", "(", "$", "order", "=", "array", "(", ")", ")", "{", "$", "myOrder", "=", "new", "APMOrder", "(", "$", "order", ")", ";", "$", "response", "=", "OrderService", "::", "createOrder", "(", "$", "myOrder", ")", ";", ...
Create Worldpay APM order @param array $order @return array Worldpay order response
[ "Create", "Worldpay", "APM", "order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L88-L99
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.createOrder
public function createOrder($order = array()) { $myOrder = new Order($order); $response = OrderService::createOrder($myOrder); if (isset($response["orderCode"])) { //success return $response; } else { Error::throwError("apierror"); } }
php
public function createOrder($order = array()) { $myOrder = new Order($order); $response = OrderService::createOrder($myOrder); if (isset($response["orderCode"])) { //success return $response; } else { Error::throwError("apierror"); } }
[ "public", "function", "createOrder", "(", "$", "order", "=", "array", "(", ")", ")", "{", "$", "myOrder", "=", "new", "Order", "(", "$", "order", ")", ";", "$", "response", "=", "OrderService", "::", "createOrder", "(", "$", "myOrder", ")", ";", "if"...
Create Worldpay order @param array $order @return array Worldpay order response
[ "Create", "Worldpay", "order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L107-L118
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.authorize3DSOrder
public function authorize3DSOrder($orderCode, $responseCode) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['3ds']['ordercode']); } return OrderService::authorize3DSOrder($orderCode, $responseCode); }
php
public function authorize3DSOrder($orderCode, $responseCode) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['3ds']['ordercode']); } return OrderService::authorize3DSOrder($orderCode, $responseCode); }
[ "public", "function", "authorize3DSOrder", "(", "$", "orderCode", ",", "$", "responseCode", ")", "{", "if", "(", "empty", "(", "$", "orderCode", ")", "||", "!", "is_string", "(", "$", "orderCode", ")", ")", "{", "Error", "::", "throwError", "(", "'ip'", ...
Authorize Worldpay 3DS Order @param string $orderCode @param string $responseCode
[ "Authorize", "Worldpay", "3DS", "Order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L125-L132
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.cancelAuthorizedOrder
public function cancelAuthorizedOrder($orderCode = false) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['capture']['ordercode']); } OrderService::cancelAuthorizedOrder($orderCode); }
php
public function cancelAuthorizedOrder($orderCode = false) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['capture']['ordercode']); } OrderService::cancelAuthorizedOrder($orderCode); }
[ "public", "function", "cancelAuthorizedOrder", "(", "$", "orderCode", "=", "false", ")", "{", "if", "(", "empty", "(", "$", "orderCode", ")", "||", "!", "is_string", "(", "$", "orderCode", ")", ")", "{", "Error", "::", "throwError", "(", "'ip'", ",", "...
Cancel Authorized Worldpay Order @param string $orderCode
[ "Cancel", "Authorized", "Worldpay", "Order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L152-L158
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.refundOrder
public function refundOrder($orderCode = false, $amount = null) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['refund']['ordercode']); } OrderService::refundOrder($orderCode, $amount); }
php
public function refundOrder($orderCode = false, $amount = null) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['refund']['ordercode']); } OrderService::refundOrder($orderCode, $amount); }
[ "public", "function", "refundOrder", "(", "$", "orderCode", "=", "false", ",", "$", "amount", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "orderCode", ")", "||", "!", "is_string", "(", "$", "orderCode", ")", ")", "{", "Error", "::", "throwEr...
Refund Worldpay order @param bool $orderCode @param null $amount
[ "Refund", "Worldpay", "order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L165-L171
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.getOrder
public function getOrder($orderCode = false) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['orderInput']['orderCode']); } $response = OrderService::getOrder($orderCode); if (!isset($response["orderCode"])) { Error::throwError("apierror"); } return $response; }
php
public function getOrder($orderCode = false) { if (empty($orderCode) || !is_string($orderCode)) { Error::throwError('ip', Error::$errors['orderInput']['orderCode']); } $response = OrderService::getOrder($orderCode); if (!isset($response["orderCode"])) { Error::throwError("apierror"); } return $response; }
[ "public", "function", "getOrder", "(", "$", "orderCode", "=", "false", ")", "{", "if", "(", "empty", "(", "$", "orderCode", ")", "||", "!", "is_string", "(", "$", "orderCode", ")", ")", "{", "Error", "::", "throwError", "(", "'ip'", ",", "Error", "::...
Get a Worldpay order @param string $orderCode @return array Worldpay order response
[ "Get", "a", "Worldpay", "order" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L178-L189
train
Worldpay/worldpay-lib-php
lib/Worldpay.php
Worldpay.getStoredCardDetails
public function getStoredCardDetails($token = false) { if (empty($token) || !is_string($token)) { Error::throwError('ip', Error::$errors['orderInput']['token']); } $response = TokenService::getStoredCardDetails($token); if (!isset($response['paymentMethod'])) { Error::throwError("apierror"); } return $response['paymentMethod']; }
php
public function getStoredCardDetails($token = false) { if (empty($token) || !is_string($token)) { Error::throwError('ip', Error::$errors['orderInput']['token']); } $response = TokenService::getStoredCardDetails($token); if (!isset($response['paymentMethod'])) { Error::throwError("apierror"); } return $response['paymentMethod']; }
[ "public", "function", "getStoredCardDetails", "(", "$", "token", "=", "false", ")", "{", "if", "(", "empty", "(", "$", "token", ")", "||", "!", "is_string", "(", "$", "token", ")", ")", "{", "Error", "::", "throwError", "(", "'ip'", ",", "Error", "::...
Get card details from Worldpay token @param string $token @return array card details
[ "Get", "card", "details", "from", "Worldpay", "token" ]
df4c9fede9be9c4931784c90d21ee52274052174
https://github.com/Worldpay/worldpay-lib-php/blob/df4c9fede9be9c4931784c90d21ee52274052174/lib/Worldpay.php#L196-L209
train
mitulgolakiya/laravel-api-generator
src/Mitul/Generator/FormFieldsGenerator.php
FormFieldsGenerator.generateLabel
public static function generateLabel($field) { $label = Str::title(str_replace('_', ' ', $field['fieldName'])); $template = "{!! Form::label('\$FIELD_NAME\$', '\$FIELD_NAME_TITLE\$:', ['class' => 'form-control-label $FIELD_NAME_TITLE$']) !!}"; $template = str_replace('$FIELD_NAME_TITLE$', $label, $template); $template = str_replace('$FIELD_NAME$', $field['fieldName'], $template); return $template; }
php
public static function generateLabel($field) { $label = Str::title(str_replace('_', ' ', $field['fieldName'])); $template = "{!! Form::label('\$FIELD_NAME\$', '\$FIELD_NAME_TITLE\$:', ['class' => 'form-control-label $FIELD_NAME_TITLE$']) !!}"; $template = str_replace('$FIELD_NAME_TITLE$', $label, $template); $template = str_replace('$FIELD_NAME$', $field['fieldName'], $template); return $template; }
[ "public", "static", "function", "generateLabel", "(", "$", "field", ")", "{", "$", "label", "=", "Str", "::", "title", "(", "str_replace", "(", "'_'", ",", "' '", ",", "$", "field", "[", "'fieldName'", "]", ")", ")", ";", "$", "template", "=", "\"{!!...
added bootstrap default class to the label
[ "added", "bootstrap", "default", "class", "to", "the", "label" ]
0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab
https://github.com/mitulgolakiya/laravel-api-generator/blob/0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab/src/Mitul/Generator/FormFieldsGenerator.php#L10-L17
train
mitulgolakiya/laravel-api-generator
src/Mitul/Generator/Errors.php
Errors.throwHttpExceptionWithCode
public static function throwHttpExceptionWithCode($error_code = null, $payload = [], $hateoas = [], $replacements = []) { $errors = static::getErrors([$error_code], [$error_code => $payload]); $error = current($errors); $replacements = self::getReplacements($error['system_message'], $error['payload'], $error['help'], $hateoas, $replacements); app('api.exception')->setReplacements($replacements); $exception = self::getExceptionObject(static::$errors[$error['error_code']]['exception'], $error); throw $exception; }
php
public static function throwHttpExceptionWithCode($error_code = null, $payload = [], $hateoas = [], $replacements = []) { $errors = static::getErrors([$error_code], [$error_code => $payload]); $error = current($errors); $replacements = self::getReplacements($error['system_message'], $error['payload'], $error['help'], $hateoas, $replacements); app('api.exception')->setReplacements($replacements); $exception = self::getExceptionObject(static::$errors[$error['error_code']]['exception'], $error); throw $exception; }
[ "public", "static", "function", "throwHttpExceptionWithCode", "(", "$", "error_code", "=", "null", ",", "$", "payload", "=", "[", "]", ",", "$", "hateoas", "=", "[", "]", ",", "$", "replacements", "=", "[", "]", ")", "{", "$", "errors", "=", "static", ...
Throw HttpException with specified or unknown error. @param mixed $error_code send exception for error with code @param [] $payload error description [error code => useful info] @param array $hateoas Send here static::getHATEOAS(['%id' => $id, '%placeholder' => 'value']) from generated controller @param array $replacements additional info inside response
[ "Throw", "HttpException", "with", "specified", "or", "unknown", "error", "." ]
0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab
https://github.com/mitulgolakiya/laravel-api-generator/blob/0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab/src/Mitul/Generator/Errors.php#L116-L124
train
mitulgolakiya/laravel-api-generator
src/Mitul/Generator/Errors.php
Errors.getReplacements
public static function getReplacements($system_message = '', $payload = [], $help_link = '', $hateoas = [], $replacements = []) { if ($system_message) { $replacements[':system_message'] = $system_message; } if (!empty($payload)) { $replacements[':payload'] = $payload; } if ($help_link) { $replacements[':help'] = $help_link; } if (!empty($hateoas)) { $replacements[':links'] = $hateoas; } return $replacements; }
php
public static function getReplacements($system_message = '', $payload = [], $help_link = '', $hateoas = [], $replacements = []) { if ($system_message) { $replacements[':system_message'] = $system_message; } if (!empty($payload)) { $replacements[':payload'] = $payload; } if ($help_link) { $replacements[':help'] = $help_link; } if (!empty($hateoas)) { $replacements[':links'] = $hateoas; } return $replacements; }
[ "public", "static", "function", "getReplacements", "(", "$", "system_message", "=", "''", ",", "$", "payload", "=", "[", "]", ",", "$", "help_link", "=", "''", ",", "$", "hateoas", "=", "[", "]", ",", "$", "replacements", "=", "[", "]", ")", "{", "...
Get array of replacements for mixing to Exception. <code> <?php app('api.exception')->setReplacements(Errors::getReplacements('Not found', ['id' => 1111], 'help/article_not_found')); throw new HttpException(404, 'Sorry, article is not found'); ?> </code> @param $system_message @param $payload @param $help_link @param array $hateoas Send here static::getHATEOAS(['%id' => $id, '%placeholder' => 'value']) from generated controller @param array $replacements @return array
[ "Get", "array", "of", "replacements", "for", "mixing", "to", "Exception", "." ]
0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab
https://github.com/mitulgolakiya/laravel-api-generator/blob/0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab/src/Mitul/Generator/Errors.php#L170-L186
train
mitulgolakiya/laravel-api-generator
src/Mitul/Controller/AppBaseController.php
AppBaseController.validateRequestOrFail
public function validateRequestOrFail($request, array $rules, $messages = [], $customAttributes = []) { $validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes); if ($validator->fails()) { throw new HttpException(400, json_encode($validator->errors()->getMessages())); } }
php
public function validateRequestOrFail($request, array $rules, $messages = [], $customAttributes = []) { $validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes); if ($validator->fails()) { throw new HttpException(400, json_encode($validator->errors()->getMessages())); } }
[ "public", "function", "validateRequestOrFail", "(", "$", "request", ",", "array", "$", "rules", ",", "$", "messages", "=", "[", "]", ",", "$", "customAttributes", "=", "[", "]", ")", "{", "$", "validator", "=", "$", "this", "->", "getValidationFactory", ...
Validate request for current resource. @param Request $request @param array $rules @param array $messages @param array $customAttributes
[ "Validate", "request", "for", "current", "resource", "." ]
0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab
https://github.com/mitulgolakiya/laravel-api-generator/blob/0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab/src/Mitul/Controller/AppBaseController.php#L20-L27
train
mitulgolakiya/laravel-api-generator
src/Mitul/Generator/Commands/PublisherCommand.php
PublisherCommand.publishAppBaseController
private function publishAppBaseController() { $templateHelper = new TemplatesHelper(); $templateData = $templateHelper->getTemplate('AppBaseController', 'controller'); $templateData = GeneratorUtils::fillTemplate(CommandData::getConfigDynamicVariables(), $templateData); $fileName = 'AppBaseController.php'; $filePath = Config::get('generator.path_controller', app_path('Http/Controllers/')); $fileHelper = new FileHelper(); $fileHelper->writeFile($filePath.$fileName, $templateData); $this->comment('AppBaseController generated'); $this->info($fileName); }
php
private function publishAppBaseController() { $templateHelper = new TemplatesHelper(); $templateData = $templateHelper->getTemplate('AppBaseController', 'controller'); $templateData = GeneratorUtils::fillTemplate(CommandData::getConfigDynamicVariables(), $templateData); $fileName = 'AppBaseController.php'; $filePath = Config::get('generator.path_controller', app_path('Http/Controllers/')); $fileHelper = new FileHelper(); $fileHelper->writeFile($filePath.$fileName, $templateData); $this->comment('AppBaseController generated'); $this->info($fileName); }
[ "private", "function", "publishAppBaseController", "(", ")", "{", "$", "templateHelper", "=", "new", "TemplatesHelper", "(", ")", ";", "$", "templateData", "=", "$", "templateHelper", "->", "getTemplate", "(", "'AppBaseController'", ",", "'controller'", ")", ";", ...
Publishes base controller.
[ "Publishes", "base", "controller", "." ]
0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab
https://github.com/mitulgolakiya/laravel-api-generator/blob/0c5d5c3deccceaf09f62d4ac9c8d742b91f8beab/src/Mitul/Generator/Commands/PublisherCommand.php#L105-L120
train
RhubarbPHP/Module.Leaf
src/LayoutProviders/LayoutProvider.php
LayoutProvider.printItems
public function printItems(...$items) { $args = func_get_args(); if (count($args) == 0) { $args = $this->items; } for ($i = 0; $i < sizeof($args); $i++) { $data = $args[$i]; if (is_array($data)) { $this->printLabelValuePairs($data); } elseif (is_object($data)) { print $data; } else { $value = $this->generateValue($data); if ($value !== false && $value !== null) { print $value; } else { print $this->parseStringAsTemplate($data); } } } }
php
public function printItems(...$items) { $args = func_get_args(); if (count($args) == 0) { $args = $this->items; } for ($i = 0; $i < sizeof($args); $i++) { $data = $args[$i]; if (is_array($data)) { $this->printLabelValuePairs($data); } elseif (is_object($data)) { print $data; } else { $value = $this->generateValue($data); if ($value !== false && $value !== null) { print $value; } else { print $this->parseStringAsTemplate($data); } } } }
[ "public", "function", "printItems", "(", "...", "$", "items", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "if", "(", "count", "(", "$", "args", ")", "==", "0", ")", "{", "$", "args", "=", "$", "this", "->", "items", ";", "}", "f...
Prints the items in a layout. @param $items
[ "Prints", "the", "items", "in", "a", "layout", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/LayoutProviders/LayoutProvider.php#L89-L114
train
mineur/twitter-stream-api
src/PublicStream.php
PublicStream.setStreamClient
private function setStreamClient() { $language = $this->language ?? ''; $keywords = $this->keywords ?? []; $users = $this->users ?? []; if (empty($keywords) && empty($users)) { throw new EmptyRequiredParamsException( 'The keywords to listen or the Users to track it mustn\'t be empty.' ); } $this->streamClient->post(self::FILTER_METHOD, [ 'form_params' => [ 'language' => $language, 'track' => implode(',', $keywords), 'follow' => implode(',', $users), ], ]); }
php
private function setStreamClient() { $language = $this->language ?? ''; $keywords = $this->keywords ?? []; $users = $this->users ?? []; if (empty($keywords) && empty($users)) { throw new EmptyRequiredParamsException( 'The keywords to listen or the Users to track it mustn\'t be empty.' ); } $this->streamClient->post(self::FILTER_METHOD, [ 'form_params' => [ 'language' => $language, 'track' => implode(',', $keywords), 'follow' => implode(',', $users), ], ]); }
[ "private", "function", "setStreamClient", "(", ")", "{", "$", "language", "=", "$", "this", "->", "language", "??", "''", ";", "$", "keywords", "=", "$", "this", "->", "keywords", "??", "[", "]", ";", "$", "users", "=", "$", "this", "->", "users", ...
Set the stream connection plus set all filter params @return void @throws EmptyRequiredParamsException
[ "Set", "the", "stream", "connection", "plus", "set", "all", "filter", "params" ]
c1af9fbbcca49078098f636ae3e9a0f54452de85
https://github.com/mineur/twitter-stream-api/blob/c1af9fbbcca49078098f636ae3e9a0f54452de85/src/PublicStream.php#L70-L89
train
mineur/twitter-stream-api
src/Http/GuzzleStreamClient.php
GuzzleStreamClient.post
public function post( string $endpoint, array $options ) { $this->streamBody = $this->client ->post($endpoint, $options) ->getBody(); }
php
public function post( string $endpoint, array $options ) { $this->streamBody = $this->client ->post($endpoint, $options) ->getBody(); }
[ "public", "function", "post", "(", "string", "$", "endpoint", ",", "array", "$", "options", ")", "{", "$", "this", "->", "streamBody", "=", "$", "this", "->", "client", "->", "post", "(", "$", "endpoint", ",", "$", "options", ")", "->", "getBody", "(...
API Post request @param string $endpoint @param array $options @return mixed|\Psr\Http\Message\StreamInterface
[ "API", "Post", "request" ]
c1af9fbbcca49078098f636ae3e9a0f54452de85
https://github.com/mineur/twitter-stream-api/blob/c1af9fbbcca49078098f636ae3e9a0f54452de85/src/Http/GuzzleStreamClient.php#L76-L84
train
mineur/twitter-stream-api
src/Http/GuzzleStreamClient.php
GuzzleStreamClient.read
public function read(): array { while (!$this->streamBody->eof()) { $tweet = json_decode( $this->readStreamLine($this->streamBody), true ); if (null !== $tweet) { return $tweet; } } }
php
public function read(): array { while (!$this->streamBody->eof()) { $tweet = json_decode( $this->readStreamLine($this->streamBody), true ); if (null !== $tweet) { return $tweet; } } }
[ "public", "function", "read", "(", ")", ":", "array", "{", "while", "(", "!", "$", "this", "->", "streamBody", "->", "eof", "(", ")", ")", "{", "$", "tweet", "=", "json_decode", "(", "$", "this", "->", "readStreamLine", "(", "$", "this", "->", "str...
Start reading the stream @return array
[ "Start", "reading", "the", "stream" ]
c1af9fbbcca49078098f636ae3e9a0f54452de85
https://github.com/mineur/twitter-stream-api/blob/c1af9fbbcca49078098f636ae3e9a0f54452de85/src/Http/GuzzleStreamClient.php#L91-L103
train
RhubarbPHP/Module.Leaf
src/Leaves/Controls/Control.php
Control.getLabel
public function getLabel() { if ($this->model->label != "") { return $this->model->label; } return StringTools::wordifyStringByUpperCase($this->getName()); }
php
public function getLabel() { if ($this->model->label != "") { return $this->model->label; } return StringTools::wordifyStringByUpperCase($this->getName()); }
[ "public", "function", "getLabel", "(", ")", "{", "if", "(", "$", "this", "->", "model", "->", "label", "!=", "\"\"", ")", "{", "return", "$", "this", "->", "model", "->", "label", ";", "}", "return", "StringTools", "::", "wordifyStringByUpperCase", "(", ...
Returns a label that the hosting view can use in the HTML output. @return string
[ "Returns", "a", "label", "that", "the", "hosting", "view", "can", "use", "in", "the", "HTML", "output", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Controls/Control.php#L82-L89
train
RhubarbPHP/Module.Leaf
src/Views/View.php
View.setIndex
final protected function setIndex($index) { $this->model->leafIndex = $index; $this->model->updatePath(); // Signal to all or any sub leaves that need to recompute their own path now. $this->leafPathChanged(); }
php
final protected function setIndex($index) { $this->model->leafIndex = $index; $this->model->updatePath(); // Signal to all or any sub leaves that need to recompute their own path now. $this->leafPathChanged(); }
[ "final", "protected", "function", "setIndex", "(", "$", "index", ")", "{", "$", "this", "->", "model", "->", "leafIndex", "=", "$", "index", ";", "$", "this", "->", "model", "->", "updatePath", "(", ")", ";", "// Signal to all or any sub leaves that need to re...
Sets a view index for subsequent renders. @param $index
[ "Sets", "a", "view", "index", "for", "subsequent", "renders", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Views/View.php#L142-L148
train
RhubarbPHP/Module.Leaf
src/Views/View.php
View.leafPathChanged
final public function leafPathChanged() { foreach ($this->leaves as $leaf) { $leaf->setName($leaf->getName(), $this->model->leafPath); } }
php
final public function leafPathChanged() { foreach ($this->leaves as $leaf) { $leaf->setName($leaf->getName(), $this->model->leafPath); } }
[ "final", "public", "function", "leafPathChanged", "(", ")", "{", "foreach", "(", "$", "this", "->", "leaves", "as", "$", "leaf", ")", "{", "$", "leaf", "->", "setName", "(", "$", "leaf", "->", "getName", "(", ")", ",", "$", "this", "->", "model", "...
Called by the view's leaf class when it's leaf path is changed. This cascades down all sub view and leaves.
[ "Called", "by", "the", "view", "s", "leaf", "class", "when", "it", "s", "leaf", "path", "is", "changed", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Views/View.php#L229-L234
train
RhubarbPHP/Module.Leaf
src/Views/View.php
View.getLayoutProvider
final protected function getLayoutProvider() { $layout = LayoutProvider::getProvider(); $layout->generateValueEvent->attachHandler(function ($elementName) { if (isset($this->leaves[$elementName])) { return $this->leaves[$elementName]; } return null; }); return $layout; }
php
final protected function getLayoutProvider() { $layout = LayoutProvider::getProvider(); $layout->generateValueEvent->attachHandler(function ($elementName) { if (isset($this->leaves[$elementName])) { return $this->leaves[$elementName]; } return null; }); return $layout; }
[ "final", "protected", "function", "getLayoutProvider", "(", ")", "{", "$", "layout", "=", "LayoutProvider", "::", "getProvider", "(", ")", ";", "$", "layout", "->", "generateValueEvent", "->", "attachHandler", "(", "function", "(", "$", "elementName", ")", "{"...
Gets the default layout provider and binds to the generateValueEvent event @return LayoutProvider
[ "Gets", "the", "default", "layout", "provider", "and", "binds", "to", "the", "generateValueEvent", "event" ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Views/View.php#L520-L532
train
RhubarbPHP/Module.Leaf
src/Leaves/LeafModel.php
LeafModel.restoreFromState
public function restoreFromState($stateData) { $publicProperties = $this->getExposableModelProperties(); foreach ($publicProperties as $key) { if (isset($stateData[$key])) { $this->$key = $stateData[$key]; } } }
php
public function restoreFromState($stateData) { $publicProperties = $this->getExposableModelProperties(); foreach ($publicProperties as $key) { if (isset($stateData[$key])) { $this->$key = $stateData[$key]; } } }
[ "public", "function", "restoreFromState", "(", "$", "stateData", ")", "{", "$", "publicProperties", "=", "$", "this", "->", "getExposableModelProperties", "(", ")", ";", "foreach", "(", "$", "publicProperties", "as", "$", "key", ")", "{", "if", "(", "isset",...
Restores the model from the passed state data. @param string[] $stateData An associative array of state key value pair strings.
[ "Restores", "the", "model", "from", "the", "passed", "state", "data", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/LeafModel.php#L159-L168
train
mineur/twitter-stream-api
src/Model/RetweetedStatus.php
RetweetedStatus.toArray
public function toArray(): array { return [ 'id' => $this->id, 'text' => $this->text, 'lang' => $this->lang, 'created_at' => $this->createdAt, 'geo' => $this->geo, 'coordinates' => $this->coordinates, 'places' => $this->places, 'retweet_count' => $this->retweetCount, 'favorite_count' => $this->favoriteCount, 'entities' => $this->entities, 'extended_entities' => $this->extendedEntities, 'user' => $this->user ]; }
php
public function toArray(): array { return [ 'id' => $this->id, 'text' => $this->text, 'lang' => $this->lang, 'created_at' => $this->createdAt, 'geo' => $this->geo, 'coordinates' => $this->coordinates, 'places' => $this->places, 'retweet_count' => $this->retweetCount, 'favorite_count' => $this->favoriteCount, 'entities' => $this->entities, 'extended_entities' => $this->extendedEntities, 'user' => $this->user ]; }
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "return", "[", "'id'", "=>", "$", "this", "->", "id", ",", "'text'", "=>", "$", "this", "->", "text", ",", "'lang'", "=>", "$", "this", "->", "lang", ",", "'created_at'", "=>", "$", "thi...
Return Tweet object to Array @return array
[ "Return", "Tweet", "object", "to", "Array" ]
c1af9fbbcca49078098f636ae3e9a0f54452de85
https://github.com/mineur/twitter-stream-api/blob/c1af9fbbcca49078098f636ae3e9a0f54452de85/src/Model/RetweetedStatus.php#L136-L152
train
RhubarbPHP/Module.Leaf
src/Leaves/Leaf.php
Leaf.setName
final public function setName($name, $parentPath = "") { $this->model->leafName = $name; if ($parentPath != "") { $this->model->parentPath = $parentPath; $this->model->isRootLeaf = false; } else { $this->model->parentPath = ""; } $this->model->updatePath(); if ($this->view) { $this->view->leafPathChanged(); } }
php
final public function setName($name, $parentPath = "") { $this->model->leafName = $name; if ($parentPath != "") { $this->model->parentPath = $parentPath; $this->model->isRootLeaf = false; } else { $this->model->parentPath = ""; } $this->model->updatePath(); if ($this->view) { $this->view->leafPathChanged(); } }
[ "final", "public", "function", "setName", "(", "$", "name", ",", "$", "parentPath", "=", "\"\"", ")", "{", "$", "this", "->", "model", "->", "leafName", "=", "$", "name", ";", "if", "(", "$", "parentPath", "!=", "\"\"", ")", "{", "$", "this", "->",...
Sets the name of the leaf. @param $name string The new name for the leaf @param $parentPath string The leaf path for the containing leaf
[ "Sets", "the", "name", "of", "the", "leaf", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Leaf.php#L164-L180
train
RhubarbPHP/Module.Leaf
src/Leaves/Leaf.php
Leaf.setWebRequest
final public function setWebRequest(WebRequest $request) { if (self::$csrfValidation && $request->server('REQUEST_METHOD') == 'POST'){ CsrfProtection::singleton()->validateHeaders($request); CsrfProtection::singleton()->validateCookie($request); } $this->request = $request; $this->parseRequest($request); $this->view->setWebRequest($request); $this->model->onAfterRequestSet(); $this->onStateRestored(); }
php
final public function setWebRequest(WebRequest $request) { if (self::$csrfValidation && $request->server('REQUEST_METHOD') == 'POST'){ CsrfProtection::singleton()->validateHeaders($request); CsrfProtection::singleton()->validateCookie($request); } $this->request = $request; $this->parseRequest($request); $this->view->setWebRequest($request); $this->model->onAfterRequestSet(); $this->onStateRestored(); }
[ "final", "public", "function", "setWebRequest", "(", "WebRequest", "$", "request", ")", "{", "if", "(", "self", "::", "$", "csrfValidation", "&&", "$", "request", "->", "server", "(", "'REQUEST_METHOD'", ")", "==", "'POST'", ")", "{", "CsrfProtection", "::",...
Sets the web request being used to render the tree of leaves. @param WebRequest $request
[ "Sets", "the", "web", "request", "being", "used", "to", "render", "the", "tree", "of", "leaves", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Leaf.php#L212-L226
train
RhubarbPHP/Module.Leaf
src/Leaves/Leaf.php
Leaf.parseRequest
protected function parseRequest(WebRequest $request) { if ($this->model->isRootLeaf) { $eventState = $request->post("_leafEventState"); if ($eventState !== null) { $eventState = json_decode($eventState, true); if ($eventState) { $this->model->restoreFromState($eventState); } } } $targetWithoutIndexes = preg_replace('/\([^)]+\)/', "", $request->post("_leafEventTarget")); if ($targetWithoutIndexes == $this->model->leafPath) { $requestTargetParts = explode("_", $request->post("_leafEventTarget")); $pathParts = explode("_", $this->model->leafPath); if (preg_match('/\(([^)]+)\)/', $requestTargetParts[count($pathParts) - 1], $match)) { $this->model->leafIndex = $match[1]; $this->model->updatePath(); } $eventName = $request->post("_leafEventName"); $eventTarget = $request->post("_leafEventTarget"); $eventArguments = []; if ($request->post("_leafEventArguments")) { $args = $request->post("_leafEventArguments"); foreach ($args as $argument) { $eventArguments[] = json_decode($argument, $this->objectsToAssocArrays); } } if ($request->post("_leafEventArgumentsJson")) { $jsonArguments = json_decode($request->post("_leafEventArgumentsJson"), true); if (count($jsonArguments)) { array_push($eventArguments, ...$jsonArguments); } } // Provide a callback for the event processing. $eventArguments[] = function ($response) use ($eventName, $eventTarget) { if ($response === null) { return; } $type = ""; if (is_object($response) || is_array($response)) { $response = json_encode($response); $type = ' type="json"'; } print '<eventresponse event="' . $eventName . '" sender="' . $eventTarget . '"' . $type . '> <![CDATA[' . $response . ']]> </eventresponse>'; }; // First raise the event on the presenter itself $this->runBeforeRender(function () use ($eventName, $eventArguments) { $eventProperty = $eventName . "Event"; if (property_exists($this->model, $eventProperty)) { /** @var Event $event */ $event = $this->model->$eventProperty; return $event->raise(...$eventArguments); } return null; }); } }
php
protected function parseRequest(WebRequest $request) { if ($this->model->isRootLeaf) { $eventState = $request->post("_leafEventState"); if ($eventState !== null) { $eventState = json_decode($eventState, true); if ($eventState) { $this->model->restoreFromState($eventState); } } } $targetWithoutIndexes = preg_replace('/\([^)]+\)/', "", $request->post("_leafEventTarget")); if ($targetWithoutIndexes == $this->model->leafPath) { $requestTargetParts = explode("_", $request->post("_leafEventTarget")); $pathParts = explode("_", $this->model->leafPath); if (preg_match('/\(([^)]+)\)/', $requestTargetParts[count($pathParts) - 1], $match)) { $this->model->leafIndex = $match[1]; $this->model->updatePath(); } $eventName = $request->post("_leafEventName"); $eventTarget = $request->post("_leafEventTarget"); $eventArguments = []; if ($request->post("_leafEventArguments")) { $args = $request->post("_leafEventArguments"); foreach ($args as $argument) { $eventArguments[] = json_decode($argument, $this->objectsToAssocArrays); } } if ($request->post("_leafEventArgumentsJson")) { $jsonArguments = json_decode($request->post("_leafEventArgumentsJson"), true); if (count($jsonArguments)) { array_push($eventArguments, ...$jsonArguments); } } // Provide a callback for the event processing. $eventArguments[] = function ($response) use ($eventName, $eventTarget) { if ($response === null) { return; } $type = ""; if (is_object($response) || is_array($response)) { $response = json_encode($response); $type = ' type="json"'; } print '<eventresponse event="' . $eventName . '" sender="' . $eventTarget . '"' . $type . '> <![CDATA[' . $response . ']]> </eventresponse>'; }; // First raise the event on the presenter itself $this->runBeforeRender(function () use ($eventName, $eventArguments) { $eventProperty = $eventName . "Event"; if (property_exists($this->model, $eventProperty)) { /** @var Event $event */ $event = $this->model->$eventProperty; return $event->raise(...$eventArguments); } return null; }); } }
[ "protected", "function", "parseRequest", "(", "WebRequest", "$", "request", ")", "{", "if", "(", "$", "this", "->", "model", "->", "isRootLeaf", ")", "{", "$", "eventState", "=", "$", "request", "->", "post", "(", "\"_leafEventState\"", ")", ";", "if", "...
Parses the request looking for client side events. @param WebRequest $request
[ "Parses", "the", "request", "looking", "for", "client", "side", "events", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Leaf.php#L252-L327
train
RhubarbPHP/Module.Leaf
src/Leaves/Leaf.php
Leaf.generateResponse
final public function generateResponse($request = null) { while (true) { $this->setWebRequest($request); try { if ($request->header("Accept") == "application/leaf") { $response = new XmlResponse($this); $response->setContent($this->renderXhr()); } else { $response = new HtmlResponse($this); $response->setContent($this->render()); } return $response; } catch (RequiresViewReconfigurationException $er) { $this->initialiseView(); } } return null; }
php
final public function generateResponse($request = null) { while (true) { $this->setWebRequest($request); try { if ($request->header("Accept") == "application/leaf") { $response = new XmlResponse($this); $response->setContent($this->renderXhr()); } else { $response = new HtmlResponse($this); $response->setContent($this->render()); } return $response; } catch (RequiresViewReconfigurationException $er) { $this->initialiseView(); } } return null; }
[ "final", "public", "function", "generateResponse", "(", "$", "request", "=", "null", ")", "{", "while", "(", "true", ")", "{", "$", "this", "->", "setWebRequest", "(", "$", "request", ")", ";", "try", "{", "if", "(", "$", "request", "->", "header", "...
Renders the Leaf and returns an HtmlResponse to Rhubarb @param WebRequest|null $request @return HtmlResponse|null
[ "Renders", "the", "Leaf", "and", "returns", "an", "HtmlResponse", "to", "Rhubarb" ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Leaf.php#L425-L446
train
RhubarbPHP/Module.Leaf
src/Leaves/Leaf.php
Leaf.runBeforeRenderCallbacks
public function runBeforeRenderCallbacks() { $this->runningEventsBeforeRender = true; foreach ($this->runBeforeRenderCallbacks as $callback) { $callback(); } $this->runBeforeRenderCallbacks = []; // Ask the view to notify sub leaves $this->view->runBeforeRenderCallbacks(); $this->runningEventsBeforeRender = false; }
php
public function runBeforeRenderCallbacks() { $this->runningEventsBeforeRender = true; foreach ($this->runBeforeRenderCallbacks as $callback) { $callback(); } $this->runBeforeRenderCallbacks = []; // Ask the view to notify sub leaves $this->view->runBeforeRenderCallbacks(); $this->runningEventsBeforeRender = false; }
[ "public", "function", "runBeforeRenderCallbacks", "(", ")", "{", "$", "this", "->", "runningEventsBeforeRender", "=", "true", ";", "foreach", "(", "$", "this", "->", "runBeforeRenderCallbacks", "as", "$", "callback", ")", "{", "$", "callback", "(", ")", ";", ...
Run the before render callbacks.
[ "Run", "the", "before", "render", "callbacks", "." ]
0de7447b87ccbe483ead967d3efa02c362f8a9a7
https://github.com/RhubarbPHP/Module.Leaf/blob/0de7447b87ccbe483ead967d3efa02c362f8a9a7/src/Leaves/Leaf.php#L482-L496
train
mineur/twitter-stream-api
src/Model/Tweet.php
Tweet.serialized
public function serialized(): string { return serialize( new self( $this->id, $this->text, $this->lang, $this->createdAt, $this->timestampMs, $this->geo, $this->coordinates, $this->places, $this->retweetCount, $this->favoriteCount, $this->entities, $this->extendedEntities, $this->user, $this->retweetedStatus ) ); }
php
public function serialized(): string { return serialize( new self( $this->id, $this->text, $this->lang, $this->createdAt, $this->timestampMs, $this->geo, $this->coordinates, $this->places, $this->retweetCount, $this->favoriteCount, $this->entities, $this->extendedEntities, $this->user, $this->retweetedStatus ) ); }
[ "public", "function", "serialized", "(", ")", ":", "string", "{", "return", "serialize", "(", "new", "self", "(", "$", "this", "->", "id", ",", "$", "this", "->", "text", ",", "$", "this", "->", "lang", ",", "$", "this", "->", "createdAt", ",", "$"...
Return serialized Tweet object @return string
[ "Return", "serialized", "Tweet", "object" ]
c1af9fbbcca49078098f636ae3e9a0f54452de85
https://github.com/mineur/twitter-stream-api/blob/c1af9fbbcca49078098f636ae3e9a0f54452de85/src/Model/Tweet.php#L177-L197
train
laravel-doctrine/fluent
src/Extensions/Gedmo/Uploadable.php
Uploadable.enable
public static function enable() { Builder::macro(self::MACRO_METHOD, function (Builder $builder) { return new static($builder->getClassMetadata()); }); UploadableFile::enable(); }
php
public static function enable() { Builder::macro(self::MACRO_METHOD, function (Builder $builder) { return new static($builder->getClassMetadata()); }); UploadableFile::enable(); }
[ "public", "static", "function", "enable", "(", ")", "{", "Builder", "::", "macro", "(", "self", "::", "MACRO_METHOD", ",", "function", "(", "Builder", "$", "builder", ")", "{", "return", "new", "static", "(", "$", "builder", "->", "getClassMetadata", "(", ...
Enable the Uploadable extension. @return void
[ "Enable", "the", "Uploadable", "extension", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/Uploadable.php#L80-L87
train
laravel-doctrine/fluent
src/Extensions/Gedmo/Uploadable.php
Uploadable.allow
public function allow($type) { if (!is_array($type)) { $type = func_get_args(); } $this->allowedTypes = implode(',', $type); return $this; }
php
public function allow($type) { if (!is_array($type)) { $type = func_get_args(); } $this->allowedTypes = implode(',', $type); return $this; }
[ "public", "function", "allow", "(", "$", "type", ")", "{", "if", "(", "!", "is_array", "(", "$", "type", ")", ")", "{", "$", "type", "=", "func_get_args", "(", ")", ";", "}", "$", "this", "->", "allowedTypes", "=", "implode", "(", "','", ",", "$"...
Allow only specific types. @param array|string ...$type can be an array or multiple string parameters @return Uploadable
[ "Allow", "only", "specific", "types", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/Uploadable.php#L254-L262
train
laravel-doctrine/fluent
src/Extensions/Gedmo/Uploadable.php
Uploadable.disallow
public function disallow($type) { if (!is_array($type)) { $type = func_get_args(); } $this->disallowedTypes = implode(',', $type); return $this; }
php
public function disallow($type) { if (!is_array($type)) { $type = func_get_args(); } $this->disallowedTypes = implode(',', $type); return $this; }
[ "public", "function", "disallow", "(", "$", "type", ")", "{", "if", "(", "!", "is_array", "(", "$", "type", ")", ")", "{", "$", "type", "=", "func_get_args", "(", ")", ";", "}", "$", "this", "->", "disallowedTypes", "=", "implode", "(", "','", ",",...
Disallow specific types. @param array|string ...$type can be an array or multiple string parameters @return Uploadable
[ "Disallow", "specific", "types", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/Uploadable.php#L271-L279
train
laravel-doctrine/fluent
src/Extensions/Gedmo/Uploadable.php
Uploadable.getConfiguration
private function getConfiguration() { return array_merge( [ 'fileMimeTypeField' => false, 'fileNameField' => false, 'filePathField' => false, 'fileSizeField' => false, ], $this->classMetadata->getExtension(UploadableDriver::EXTENSION_NAME), [ 'uploadable' => true, 'allowOverwrite' => $this->allowOverwrite, 'appendNumber' => $this->appendNumber, 'path' => $this->path, 'pathMethod' => $this->pathMethod, 'callback' => $this->callback, 'filenameGenerator' => $this->filenameGenerator, 'maxSize' => (float) $this->maxSize, 'allowedTypes' => $this->allowedTypes, 'disallowedTypes' => $this->disallowedTypes, ] ); }
php
private function getConfiguration() { return array_merge( [ 'fileMimeTypeField' => false, 'fileNameField' => false, 'filePathField' => false, 'fileSizeField' => false, ], $this->classMetadata->getExtension(UploadableDriver::EXTENSION_NAME), [ 'uploadable' => true, 'allowOverwrite' => $this->allowOverwrite, 'appendNumber' => $this->appendNumber, 'path' => $this->path, 'pathMethod' => $this->pathMethod, 'callback' => $this->callback, 'filenameGenerator' => $this->filenameGenerator, 'maxSize' => (float) $this->maxSize, 'allowedTypes' => $this->allowedTypes, 'disallowedTypes' => $this->disallowedTypes, ] ); }
[ "private", "function", "getConfiguration", "(", ")", "{", "return", "array_merge", "(", "[", "'fileMimeTypeField'", "=>", "false", ",", "'fileNameField'", "=>", "false", ",", "'filePathField'", "=>", "false", ",", "'fileSizeField'", "=>", "false", ",", "]", ",",...
Build the configuration, based on defaults, current extension configuration and accumulated parameters. @return array
[ "Build", "the", "configuration", "based", "on", "defaults", "current", "extension", "configuration", "and", "accumulated", "parameters", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/Uploadable.php#L298-L321
train
laravel-doctrine/fluent
src/Extensions/Gedmo/TreePathSource.php
TreePathSource.enable
public static function enable() { Field::macro(self::MACRO_METHOD, function (Field $field) { return new static($field->getClassMetadata(), $field->getName()); }); }
php
public static function enable() { Field::macro(self::MACRO_METHOD, function (Field $field) { return new static($field->getClassMetadata(), $field->getName()); }); }
[ "public", "static", "function", "enable", "(", ")", "{", "Field", "::", "macro", "(", "self", "::", "MACRO_METHOD", ",", "function", "(", "Field", "$", "field", ")", "{", "return", "new", "static", "(", "$", "field", "->", "getClassMetadata", "(", ")", ...
Enable TreePathSource.
[ "Enable", "TreePathSource", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/TreePathSource.php#L39-L44
train
laravel-doctrine/fluent
src/Builders/Inheritance/AbstractInheritance.php
AbstractInheritance.column
public function column($column, $type = 'string', $length = 255) { $this->builder->setDiscriminatorColumn($column, $type, $length); return $this; }
php
public function column($column, $type = 'string', $length = 255) { $this->builder->setDiscriminatorColumn($column, $type, $length); return $this; }
[ "public", "function", "column", "(", "$", "column", ",", "$", "type", "=", "'string'", ",", "$", "length", "=", "255", ")", "{", "$", "this", "->", "builder", "->", "setDiscriminatorColumn", "(", "$", "column", ",", "$", "type", ",", "$", "length", "...
Add the discriminator column. @param string $column @param string $type @param int $length @return Inheritance
[ "Add", "the", "discriminator", "column", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Builders/Inheritance/AbstractInheritance.php#L41-L46
train
laravel-doctrine/fluent
src/Extensions/Gedmo/TreeStrategy.php
TreeStrategy.alreadyConfigured
protected function alreadyConfigured($key) { $config = $this->getClassMetadata()->getExtension($this->getExtensionName()); return isset($config[$key]); }
php
protected function alreadyConfigured($key) { $config = $this->getClassMetadata()->getExtension($this->getExtensionName()); return isset($config[$key]); }
[ "protected", "function", "alreadyConfigured", "(", "$", "key", ")", "{", "$", "config", "=", "$", "this", "->", "getClassMetadata", "(", ")", "->", "getExtension", "(", "$", "this", "->", "getExtensionName", "(", ")", ")", ";", "return", "isset", "(", "$...
Check if a given key is already configured for this extension. @param string $key @return bool
[ "Check", "if", "a", "given", "key", "is", "already", "configured", "for", "this", "extension", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/TreeStrategy.php#L177-L182
train
laravel-doctrine/fluent
src/Relations/Traits/ManyTo.php
ManyTo.build
public function build() { foreach ($this->getJoinColumns() as $column) { $this->getAssociation()->addJoinColumn( $column->getJoinColumn(), $column->getReferenceColumn(), $column->isNullable(), $column->isUnique(), $column->getOnDelete(), $column->getColumnDefinition() ); } parent::build(); }
php
public function build() { foreach ($this->getJoinColumns() as $column) { $this->getAssociation()->addJoinColumn( $column->getJoinColumn(), $column->getReferenceColumn(), $column->isNullable(), $column->isUnique(), $column->getOnDelete(), $column->getColumnDefinition() ); } parent::build(); }
[ "public", "function", "build", "(", ")", "{", "foreach", "(", "$", "this", "->", "getJoinColumns", "(", ")", "as", "$", "column", ")", "{", "$", "this", "->", "getAssociation", "(", ")", "->", "addJoinColumn", "(", "$", "column", "->", "getJoinColumn", ...
Build the association.
[ "Build", "the", "association", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Relations/Traits/ManyTo.php#L17-L31
train
laravel-doctrine/fluent
src/Extensions/GedmoExtensions.php
GedmoExtensions.registerAll
public static function registerAll(MappingDriverChain $driverChain) { self::register($driverChain, array_merge(self::$abstract, self::$concrete)); }
php
public static function registerAll(MappingDriverChain $driverChain) { self::register($driverChain, array_merge(self::$abstract, self::$concrete)); }
[ "public", "static", "function", "registerAll", "(", "MappingDriverChain", "$", "driverChain", ")", "{", "self", "::", "register", "(", "$", "driverChain", ",", "array_merge", "(", "self", "::", "$", "abstract", ",", "self", "::", "$", "concrete", ")", ")", ...
Register all Gedmo classes on Fluent. @param MappingDriverChain $driverChain @return void @see \Gedmo\DoctrineExtensions::registerMappingIntoDriverChainORM
[ "Register", "all", "Gedmo", "classes", "on", "Fluent", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/GedmoExtensions.php#L57-L60
train
laravel-doctrine/fluent
src/Extensions/GedmoExtensions.php
GedmoExtensions.register
protected static function register(MappingDriverChain $driverChain, array $mappings) { $driverChain->addDriver( new FluentDriver($mappings), 'Gedmo' ); foreach (self::$extensions as $extension) { $extension::enable(); } }
php
protected static function register(MappingDriverChain $driverChain, array $mappings) { $driverChain->addDriver( new FluentDriver($mappings), 'Gedmo' ); foreach (self::$extensions as $extension) { $extension::enable(); } }
[ "protected", "static", "function", "register", "(", "MappingDriverChain", "$", "driverChain", ",", "array", "$", "mappings", ")", "{", "$", "driverChain", "->", "addDriver", "(", "new", "FluentDriver", "(", "$", "mappings", ")", ",", "'Gedmo'", ")", ";", "fo...
Register a new FluentDriver for the Gedmo namespace on the given chain. Adds all extensions as macros. @param MappingDriverChain $driverChain @param string[] $mappings @return void
[ "Register", "a", "new", "FluentDriver", "for", "the", "Gedmo", "namespace", "on", "the", "given", "chain", ".", "Adds", "all", "extensions", "as", "macros", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/GedmoExtensions.php#L85-L95
train
laravel-doctrine/fluent
src/Builders/Traits/QueuesMacros.php
QueuesMacros.queueMacro
protected function queueMacro($method, $args) { $result = $this->callMacro($method, $args); if ($result instanceof Buildable) { $this->queue($result); } return $result; }
php
protected function queueMacro($method, $args) { $result = $this->callMacro($method, $args); if ($result instanceof Buildable) { $this->queue($result); } return $result; }
[ "protected", "function", "queueMacro", "(", "$", "method", ",", "$", "args", ")", "{", "$", "result", "=", "$", "this", "->", "callMacro", "(", "$", "method", ",", "$", "args", ")", ";", "if", "(", "$", "result", "instanceof", "Buildable", ")", "{", ...
Intercept the Macro call and queue the result if it's a Buildable object. @param string $method @param array $args @return mixed
[ "Intercept", "the", "Macro", "call", "and", "queue", "the", "result", "if", "it", "s", "a", "Buildable", "object", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Builders/Traits/QueuesMacros.php#L30-L39
train
laravel-doctrine/fluent
src/Extensions/Gedmo/UploadableFile.php
UploadableFile.enable
public static function enable() { foreach (self::$validTypes as $type) { Field::macro("asFile$type", function (Field $builder) use ($type) { return new static($builder->getClassMetadata(), $builder->getName(), $type); }); } }
php
public static function enable() { foreach (self::$validTypes as $type) { Field::macro("asFile$type", function (Field $builder) use ($type) { return new static($builder->getClassMetadata(), $builder->getName(), $type); }); } }
[ "public", "static", "function", "enable", "(", ")", "{", "foreach", "(", "self", "::", "$", "validTypes", "as", "$", "type", ")", "{", "Field", "::", "macro", "(", "\"asFile$type\"", ",", "function", "(", "Field", "$", "builder", ")", "use", "(", "$", ...
Enable the UploadableFile extension. @return void
[ "Enable", "the", "UploadableFile", "extension", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/UploadableFile.php#L54-L61
train
laravel-doctrine/fluent
src/Extensions/Gedmo/UploadableFile.php
UploadableFile.validateType
private function validateType($type) { if (!in_array($type, self::$validTypes)) { throw new InvalidMappingException( 'Invalid uploadable field type reference. Must be one of: '.implode(', ', self::$validTypes) ); } }
php
private function validateType($type) { if (!in_array($type, self::$validTypes)) { throw new InvalidMappingException( 'Invalid uploadable field type reference. Must be one of: '.implode(', ', self::$validTypes) ); } }
[ "private", "function", "validateType", "(", "$", "type", ")", "{", "if", "(", "!", "in_array", "(", "$", "type", ",", "self", "::", "$", "validTypes", ")", ")", "{", "throw", "new", "InvalidMappingException", "(", "'Invalid uploadable field type reference. Must ...
Validate the given type of file field. @param string $type @return void
[ "Validate", "the", "given", "type", "of", "file", "field", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/UploadableFile.php#L80-L87
train
laravel-doctrine/fluent
src/Extensions/Gedmo/AbstractTrackingExtension.php
AbstractTrackingExtension.makeConfiguration
protected function makeConfiguration() { if ($this->on == 'create' || $this->on == 'update') { return $this->fieldName; } return [ 'field' => $this->fieldName, 'trackedField' => $this->trackedFields, 'value' => $this->value, ]; }
php
protected function makeConfiguration() { if ($this->on == 'create' || $this->on == 'update') { return $this->fieldName; } return [ 'field' => $this->fieldName, 'trackedField' => $this->trackedFields, 'value' => $this->value, ]; }
[ "protected", "function", "makeConfiguration", "(", ")", "{", "if", "(", "$", "this", "->", "on", "==", "'create'", "||", "$", "this", "->", "on", "==", "'update'", ")", "{", "return", "$", "this", "->", "fieldName", ";", "}", "return", "[", "'field'", ...
Returns either the field name on "create" and "update", or the array configuration on "change". @return array|string
[ "Returns", "either", "the", "field", "name", "on", "create", "and", "update", "or", "the", "array", "configuration", "on", "change", "." ]
337b82d49d83370bf51afa12004d3c082bd9c462
https://github.com/laravel-doctrine/fluent/blob/337b82d49d83370bf51afa12004d3c082bd9c462/src/Extensions/Gedmo/AbstractTrackingExtension.php#L121-L132
train