repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.fetchSubscriptions
public function fetchSubscriptions(array $conditions = null) { $cursor = new DrupalSubscriptionCursor($this); if (!empty($conditions)) { $cursor->setConditions($conditions); } return $cursor; }
php
public function fetchSubscriptions(array $conditions = null) { $cursor = new DrupalSubscriptionCursor($this); if (!empty($conditions)) { $cursor->setConditions($conditions); } return $cursor; }
[ "public", "function", "fetchSubscriptions", "(", "array", "$", "conditions", "=", "null", ")", "{", "$", "cursor", "=", "new", "DrupalSubscriptionCursor", "(", "$", "this", ")", ";", "if", "(", "!", "empty", "(", "$", "conditions", ")", ")", "{", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L233-L242
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.getSubscriber
public function getSubscriber($id) { if (isset($this->subscribersCache[$id])) { return $this->subscribersCache[$id]; } $idList = $this ->db // This query will also remove non existing stalling subscriptions // from the subscriber map thanks to...
php
public function getSubscriber($id) { if (isset($this->subscribersCache[$id])) { return $this->subscribersCache[$id]; } $idList = $this ->db // This query will also remove non existing stalling subscriptions // from the subscriber map thanks to...
[ "public", "function", "getSubscriber", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "subscribersCache", "[", "$", "id", "]", ")", ")", "{", "return", "$", "this", "->", "subscribersCache", "[", "$", "id", "]", ";", "}", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L247-L269
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.deleteSubscriber
public function deleteSubscriber($id) { $cx = $this->db; $tx = null; $subscriber = $this->getSubscriber($id); try { $tx = $cx->startTransaction(); // FIXME: SELECT FOR UPDATE here in all tables // Start by deleting all subscrip...
php
public function deleteSubscriber($id) { $cx = $this->db; $tx = null; $subscriber = $this->getSubscriber($id); try { $tx = $cx->startTransaction(); // FIXME: SELECT FOR UPDATE here in all tables // Start by deleting all subscrip...
[ "public", "function", "deleteSubscriber", "(", "$", "id", ")", "{", "$", "cx", "=", "$", "this", "->", "db", ";", "$", "tx", "=", "null", ";", "$", "subscriber", "=", "$", "this", "->", "getSubscriber", "(", "$", "id", ")", ";", "try", "{", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L274-L313
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.subscribe
public function subscribe($chanId, $subscriberId = null) { $deactivated = new \DateTime(); $created = $deactivated; $cx = $this->db; $tx = null; $chan = $this->getChannel($chanId); $subscriber = null; $subscription = null; ...
php
public function subscribe($chanId, $subscriberId = null) { $deactivated = new \DateTime(); $created = $deactivated; $cx = $this->db; $tx = null; $chan = $this->getChannel($chanId); $subscriber = null; $subscription = null; ...
[ "public", "function", "subscribe", "(", "$", "chanId", ",", "$", "subscriberId", "=", "null", ")", "{", "$", "deactivated", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "created", "=", "$", "deactivated", ";", "$", "cx", "=", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L329-L389
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.fetchSubscribers
public function fetchSubscribers(array $conditions = null) { $cursor = new DrupalSubscriberCursor($this); if (!empty($conditions)) { $cursor->setConditions($conditions); } return $cursor; }
php
public function fetchSubscribers(array $conditions = null) { $cursor = new DrupalSubscriberCursor($this); if (!empty($conditions)) { $cursor->setConditions($conditions); } return $cursor; }
[ "public", "function", "fetchSubscribers", "(", "array", "$", "conditions", "=", "null", ")", "{", "$", "cursor", "=", "new", "DrupalSubscriberCursor", "(", "$", "this", ")", ";", "if", "(", "!", "empty", "(", "$", "conditions", ")", ")", "{", "$", "cur...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L394-L403
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.send
public function send( $chanId, $contents, $type = null, $origin = null, $level = 0, array $excluded = null, \DateTime $sentAt = null) { if (!is_array($chanId)) { // Ensure this is a list $chanId ...
php
public function send( $chanId, $contents, $type = null, $origin = null, $level = 0, array $excluded = null, \DateTime $sentAt = null) { if (!is_array($chanId)) { // Ensure this is a list $chanId ...
[ "public", "function", "send", "(", "$", "chanId", ",", "$", "contents", ",", "$", "type", "=", "null", ",", "$", "origin", "=", "null", ",", "$", "level", "=", "0", ",", "array", "$", "excluded", "=", "null", ",", "\\", "DateTime", "$", "sentAt", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L408-L536
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.copyQueue
public function copyQueue($chanId, $subIdList, $isUnread = true) { if (!is_array($subIdList)) { $subIdList = [$subIdList]; } if (!$channel = $this->getChannel($chanId)) { throw new ChannelDoesNotExistException(); } // FIXME: Could do better than fore...
php
public function copyQueue($chanId, $subIdList, $isUnread = true) { if (!is_array($subIdList)) { $subIdList = [$subIdList]; } if (!$channel = $this->getChannel($chanId)) { throw new ChannelDoesNotExistException(); } // FIXME: Could do better than fore...
[ "public", "function", "copyQueue", "(", "$", "chanId", ",", "$", "subIdList", ",", "$", "isUnread", "=", "true", ")", "{", "if", "(", "!", "is_array", "(", "$", "subIdList", ")", ")", "{", "$", "subIdList", "=", "[", "$", "subIdList", "]", ";", "}"...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L541-L574
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.garbageCollection
public function garbageCollection() { // Drop all messages for inactive subscriptions // FIXME: When volatile only $this ->db ->query(" DELETE FROM {apb_queue} WHERE sub_id IN ( SELECT...
php
public function garbageCollection() { // Drop all messages for inactive subscriptions // FIXME: When volatile only $this ->db ->query(" DELETE FROM {apb_queue} WHERE sub_id IN ( SELECT...
[ "public", "function", "garbageCollection", "(", ")", "{", "// Drop all messages for inactive subscriptions", "// FIXME: When volatile only", "$", "this", "->", "db", "->", "query", "(", "\"\n DELETE\n FROM {apb_queue}\n WHERE sub...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L586-L649
makinacorpus/drupal-apubsub
src/Backend/DrupalBackend.php
DrupalBackend.getAnalysis
public function getAnalysis() { $cx = $this->db; $chanCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_chan}")->fetchField(); $msgCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_msg}")->fetchField(); $subCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_sub...
php
public function getAnalysis() { $cx = $this->db; $chanCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_chan}")->fetchField(); $msgCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_msg}")->fetchField(); $subCount = (int)$cx->query("SELECT COUNT(*) FROM {apb_sub...
[ "public", "function", "getAnalysis", "(", ")", "{", "$", "cx", "=", "$", "this", "->", "db", ";", "$", "chanCount", "=", "(", "int", ")", "$", "cx", "->", "query", "(", "\"SELECT COUNT(*) FROM {apb_chan}\"", ")", "->", "fetchField", "(", ")", ";", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/DrupalBackend.php#L654-L671
opis-colibri/core
src/ComposerPlugin.php
ComposerPlugin.activate
public function activate(Composer $composer, IOInterface $io) { $this->io = $io; $this->composer = $composer; $rootDir = realpath($this->composer->getConfig()->get('vendor-dir') . '/../'); $settings = $this->composer->getPackage()->getExtra()['application'] ?? []; $this->appI...
php
public function activate(Composer $composer, IOInterface $io) { $this->io = $io; $this->composer = $composer; $rootDir = realpath($this->composer->getConfig()->get('vendor-dir') . '/../'); $settings = $this->composer->getPackage()->getExtra()['application'] ?? []; $this->appI...
[ "public", "function", "activate", "(", "Composer", "$", "composer", ",", "IOInterface", "$", "io", ")", "{", "$", "this", "->", "io", "=", "$", "io", ";", "$", "this", "->", "composer", "=", "$", "composer", ";", "$", "rootDir", "=", "realpath", "(",...
Apply plugin modifications to Composer @param Composer $composer @param IOInterface $io
[ "Apply", "plugin", "modifications", "to", "Composer" ]
train
https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/ComposerPlugin.php#L49-L64
leogitpro/php-zf3-base-module
module/src/Controller/BaseController.php
BaseController.setData
protected function setData($data = []) { if (!isset($data[self::RS_KEY_CODE])) { $data[self::RS_KEY_CODE] = 0; } if (!isset($data[self::RS_KEY_MSG])) { $data[self::RS_KEY_MSG] = 'Success'; } if (!isset($data[self::RS_KEY_TYPE])) { $data[sel...
php
protected function setData($data = []) { if (!isset($data[self::RS_KEY_CODE])) { $data[self::RS_KEY_CODE] = 0; } if (!isset($data[self::RS_KEY_MSG])) { $data[self::RS_KEY_MSG] = 'Success'; } if (!isset($data[self::RS_KEY_TYPE])) { $data[sel...
[ "protected", "function", "setData", "(", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "self", "::", "RS_KEY_CODE", "]", ")", ")", "{", "$", "data", "[", "self", "::", "RS_KEY_CODE", "]", "=", "0", ";", "...
Set data @param array $data
[ "Set", "data" ]
train
https://github.com/leogitpro/php-zf3-base-module/blob/596fc89c25033eaef8f796418a4a3399c47a9638/module/src/Controller/BaseController.php#L50-L70
leogitpro/php-zf3-base-module
module/src/Controller/BaseController.php
BaseController.addData
protected function addData($key, $data = null) { $this->data[self::RS_KEY_DATA]->{$key} = $data; }
php
protected function addData($key, $data = null) { $this->data[self::RS_KEY_DATA]->{$key} = $data; }
[ "protected", "function", "addData", "(", "$", "key", ",", "$", "data", "=", "null", ")", "{", "$", "this", "->", "data", "[", "self", "::", "RS_KEY_DATA", "]", "->", "{", "$", "key", "}", "=", "$", "data", ";", "}" ]
Add data to result object @param string $key @param null|string|array|\stdClass $data
[ "Add", "data", "to", "result", "object" ]
train
https://github.com/leogitpro/php-zf3-base-module/blob/596fc89c25033eaef8f796418a4a3399c47a9638/module/src/Controller/BaseController.php#L87-L90
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.addDisabledVariant
public function addDisabledVariant(VariantInterface $variant): ProductInterface { if (!$this->disabledVariants->contains($variant)) { $this->disabledVariants->add($variant); } return $this; }
php
public function addDisabledVariant(VariantInterface $variant): ProductInterface { if (!$this->disabledVariants->contains($variant)) { $this->disabledVariants->add($variant); } return $this; }
[ "public", "function", "addDisabledVariant", "(", "VariantInterface", "$", "variant", ")", ":", "ProductInterface", "{", "if", "(", "!", "$", "this", "->", "disabledVariants", "->", "contains", "(", "$", "variant", ")", ")", "{", "$", "this", "->", "disabledV...
/* Collection/relation methods
[ "/", "*", "Collection", "/", "relation", "methods" ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L452-L459
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.findCategory
public function findCategory(CategoryInterface $searchCategory): ?CategoryInterface { foreach ($this->categories as $category) { if($category->getNumber() === $searchCategory->getNumber()) { return $category; } } return null; }
php
public function findCategory(CategoryInterface $searchCategory): ?CategoryInterface { foreach ($this->categories as $category) { if($category->getNumber() === $searchCategory->getNumber()) { return $category; } } return null; }
[ "public", "function", "findCategory", "(", "CategoryInterface", "$", "searchCategory", ")", ":", "?", "CategoryInterface", "{", "foreach", "(", "$", "this", "->", "categories", "as", "$", "category", ")", "{", "if", "(", "$", "category", "->", "getNumber", "...
This method will try to find a category based on the number (which is unique) Returns null if it does not exist @param CategoryInterface $searchCategory @return CategoryInterface|null
[ "This", "method", "will", "try", "to", "find", "a", "category", "based", "on", "the", "number", "(", "which", "is", "unique", ")", "Returns", "null", "if", "it", "does", "not", "exist" ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L531-L540
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.addManufacturer
public function addManufacturer(ManufacturerInterface $manufacturer): ProductInterface { if (!$this->hasManufacturer($manufacturer)) { $this->manufacturers->add($manufacturer); } return $this; }
php
public function addManufacturer(ManufacturerInterface $manufacturer): ProductInterface { if (!$this->hasManufacturer($manufacturer)) { $this->manufacturers->add($manufacturer); } return $this; }
[ "public", "function", "addManufacturer", "(", "ManufacturerInterface", "$", "manufacturer", ")", ":", "ProductInterface", "{", "if", "(", "!", "$", "this", "->", "hasManufacturer", "(", "$", "manufacturer", ")", ")", "{", "$", "this", "->", "manufacturers", "-...
/* Manufacturer collection methods
[ "/", "*", "Manufacturer", "collection", "methods" ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L545-L552
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.addVariantGroup
public function addVariantGroup(VariantGroupInterface $variantGroup): ProductInterface { if (!$this->hasVariantGroup($variantGroup)) { $this->variantGroups->add($variantGroup); } return $this; }
php
public function addVariantGroup(VariantGroupInterface $variantGroup): ProductInterface { if (!$this->hasVariantGroup($variantGroup)) { $this->variantGroups->add($variantGroup); } return $this; }
[ "public", "function", "addVariantGroup", "(", "VariantGroupInterface", "$", "variantGroup", ")", ":", "ProductInterface", "{", "if", "(", "!", "$", "this", "->", "hasVariantGroup", "(", "$", "variantGroup", ")", ")", "{", "$", "this", "->", "variantGroups", "-...
/* Variant group collection methods
[ "/", "*", "Variant", "group", "collection", "methods" ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L574-L581
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.addPrice
public function addPrice(PriceInterface $price): ProductInterface { if (!$this->prices->contains($price)) { $this->prices->add($price); $price->setProduct($this); } return $this; }
php
public function addPrice(PriceInterface $price): ProductInterface { if (!$this->prices->contains($price)) { $this->prices->add($price); $price->setProduct($this); } return $this; }
[ "public", "function", "addPrice", "(", "PriceInterface", "$", "price", ")", ":", "ProductInterface", "{", "if", "(", "!", "$", "this", "->", "prices", "->", "contains", "(", "$", "price", ")", ")", "{", "$", "this", "->", "prices", "->", "add", "(", ...
/* Price collection methods
[ "/", "*", "Price", "collection", "methods" ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L607-L615
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.findPriceByCurrency
public function findPriceByCurrency($currency): ?PriceInterface { if ($currency instanceof \Money\Currency) { $currency = $currency->getCode(); } elseif ($currency instanceof CurrencyInterface) { $currency = $currency->getIsoCodeAlpha(); } if (!is_string($cur...
php
public function findPriceByCurrency($currency): ?PriceInterface { if ($currency instanceof \Money\Currency) { $currency = $currency->getCode(); } elseif ($currency instanceof CurrencyInterface) { $currency = $currency->getIsoCodeAlpha(); } if (!is_string($cur...
[ "public", "function", "findPriceByCurrency", "(", "$", "currency", ")", ":", "?", "PriceInterface", "{", "if", "(", "$", "currency", "instanceof", "\\", "Money", "\\", "Currency", ")", "{", "$", "currency", "=", "$", "currency", "->", "getCode", "(", ")", ...
Will try to find a price based on currency. @param string|\Money\Currency|CurrencyInterface $currency @return PriceInterface|null
[ "Will", "try", "to", "find", "a", "price", "based", "on", "currency", "." ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L669-L688
loevgaard/dandomain-foundation-entities
src/Entity/Product.php
Product.findPrice
protected function findPrice(PriceInterface $searchPrice): ?PriceInterface { foreach ($this->prices as $price) { if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getI...
php
protected function findPrice(PriceInterface $searchPrice): ?PriceInterface { foreach ($this->prices as $price) { if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getI...
[ "protected", "function", "findPrice", "(", "PriceInterface", "$", "searchPrice", ")", ":", "?", "PriceInterface", "{", "foreach", "(", "$", "this", "->", "prices", "as", "$", "price", ")", "{", "if", "(", "$", "price", "->", "getAmount", "(", ")", "==", ...
This method will try to find a price based on the unique constraint defined in price. @param PriceInterface $searchPrice @return PriceInterface|null
[ "This", "method", "will", "try", "to", "find", "a", "price", "based", "on", "the", "unique", "constraint", "defined", "in", "price", "." ]
train
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L1756-L1765
helikopterspark/FlashMsg
src/FlashMsg/FlashMsg.php
FlashMsg.setMessage
public function setMessage($type, $message) { if (!$this->session->has('flashmsgs')) { $this->session->set('flashmsgs', array()); } $temp = $this->session->get('flashmsgs'); $temp[] = array('type' => $type, 'content' => $message); $this->session->set('flashmsgs', $temp); }
php
public function setMessage($type, $message) { if (!$this->session->has('flashmsgs')) { $this->session->set('flashmsgs', array()); } $temp = $this->session->get('flashmsgs'); $temp[] = array('type' => $type, 'content' => $message); $this->session->set('flashmsgs', $temp); }
[ "public", "function", "setMessage", "(", "$", "type", ",", "$", "message", ")", "{", "if", "(", "!", "$", "this", "->", "session", "->", "has", "(", "'flashmsgs'", ")", ")", "{", "$", "this", "->", "session", "->", "set", "(", "'flashmsgs'", ",", "...
Add message to session array @param $type string with message type @param $message string with message text @return void
[ "Add", "message", "to", "session", "array" ]
train
https://github.com/helikopterspark/FlashMsg/blob/85c2f16ca94db6dd800ed292d84f2e7422b3e7f5/src/FlashMsg/FlashMsg.php#L20-L27
helikopterspark/FlashMsg
src/FlashMsg/FlashMsg.php
FlashMsg.outputMsgs
public function outputMsgs() { $messages = $this->session->get('flashmsgs'); $output = null; if ($messages) { foreach ($messages as $key => $message) { $output .= '<div class="' . $message['type'] . '"><p>' . $message['content'] . '</p></div>'; } } return $output; }
php
public function outputMsgs() { $messages = $this->session->get('flashmsgs'); $output = null; if ($messages) { foreach ($messages as $key => $message) { $output .= '<div class="' . $message['type'] . '"><p>' . $message['content'] . '</p></div>'; } } return $output; }
[ "public", "function", "outputMsgs", "(", ")", "{", "$", "messages", "=", "$", "this", "->", "session", "->", "get", "(", "'flashmsgs'", ")", ";", "$", "output", "=", "null", ";", "if", "(", "$", "messages", ")", "{", "foreach", "(", "$", "messages", ...
Build HTML of messages in session array @return $output HTML string with messages
[ "Build", "HTML", "of", "messages", "in", "session", "array" ]
train
https://github.com/helikopterspark/FlashMsg/blob/85c2f16ca94db6dd800ed292d84f2e7422b3e7f5/src/FlashMsg/FlashMsg.php#L100-L111
TiMESPLiNTER/tsfw-i18n
src/timesplinter/tsfw/i18n/common/AbstractTranslator.php
AbstractTranslator.dGetText
public function dGetText($domain, $message, $pluralMessage = null, $n = 0) { $oldTextDomain = $this->currentTextDomain; $this->setTextDomain($domain); $message = $this->getText($message, $pluralMessage, $n); $this->setTextDomain($oldTextDomain); return $message; }
php
public function dGetText($domain, $message, $pluralMessage = null, $n = 0) { $oldTextDomain = $this->currentTextDomain; $this->setTextDomain($domain); $message = $this->getText($message, $pluralMessage, $n); $this->setTextDomain($oldTextDomain); return $message; }
[ "public", "function", "dGetText", "(", "$", "domain", ",", "$", "message", ",", "$", "pluralMessage", "=", "null", ",", "$", "n", "=", "0", ")", "{", "$", "oldTextDomain", "=", "$", "this", "->", "currentTextDomain", ";", "$", "this", "->", "setTextDom...
Lookup a message in the specified domain @param string $domain @param string $message @param string|null $pluralMessage @param int $n @return string Returns a translated string if one is found in the translation table, or the submitted message if not found.
[ "Lookup", "a", "message", "in", "the", "specified", "domain" ]
train
https://github.com/TiMESPLiNTER/tsfw-i18n/blob/31769efe75ecab2757911a296ad4c5a9c6158b6d/src/timesplinter/tsfw/i18n/common/AbstractTranslator.php#L63-L74
TiMESPLiNTER/tsfw-i18n
src/timesplinter/tsfw/i18n/common/AbstractTranslator.php
AbstractTranslator._
public final function _($message, $pluralMessage = null, $n = 0) { return $this->getText($message, $pluralMessage, $n); }
php
public final function _($message, $pluralMessage = null, $n = 0) { return $this->getText($message, $pluralMessage, $n); }
[ "public", "final", "function", "_", "(", "$", "message", ",", "$", "pluralMessage", "=", "null", ",", "$", "n", "=", "0", ")", "{", "return", "$", "this", "->", "getText", "(", "$", "message", ",", "$", "pluralMessage", ",", "$", "n", ")", ";", "...
Lookup a message in the current domain @param string $message The message being translated. @param string|null $pluralMessage @param int $n @return string Returns a translated string if one is found in the translation table, or the submitted message if not found.
[ "Lookup", "a", "message", "in", "the", "current", "domain" ]
train
https://github.com/TiMESPLiNTER/tsfw-i18n/blob/31769efe75ecab2757911a296ad4c5a9c6158b6d/src/timesplinter/tsfw/i18n/common/AbstractTranslator.php#L85-L88
TiMESPLiNTER/tsfw-i18n
src/timesplinter/tsfw/i18n/common/AbstractTranslator.php
AbstractTranslator._d
public final function _d($domain, $message, $pluralMessage = null, $n = 0) { return $this->dGetText($domain, $message, $pluralMessage, $n); }
php
public final function _d($domain, $message, $pluralMessage = null, $n = 0) { return $this->dGetText($domain, $message, $pluralMessage, $n); }
[ "public", "final", "function", "_d", "(", "$", "domain", ",", "$", "message", ",", "$", "pluralMessage", "=", "null", ",", "$", "n", "=", "0", ")", "{", "return", "$", "this", "->", "dGetText", "(", "$", "domain", ",", "$", "message", ",", "$", "...
Lookup a message in the specified domain @param string $domain @param string $message @param string|null $pluralMessage @param int $n @return string Returns a translated string if one is found in the translation table, or the submitted message if not found.
[ "Lookup", "a", "message", "in", "the", "specified", "domain" ]
train
https://github.com/TiMESPLiNTER/tsfw-i18n/blob/31769efe75ecab2757911a296ad4c5a9c6158b6d/src/timesplinter/tsfw/i18n/common/AbstractTranslator.php#L100-L103
anime-db/item-folder-filler-bundle
src/Controller/FillerController.php
FillerController.fillAction
public function fillAction(Item $item) { // do fill $this->get('anime_db.item_folder_filler.filler_folder')->fillFolder($item); return $this->render('AnimeDbItemFolderFillerBundle:Filler:fill.html.twig', [ 'item' => $item ]); }
php
public function fillAction(Item $item) { // do fill $this->get('anime_db.item_folder_filler.filler_folder')->fillFolder($item); return $this->render('AnimeDbItemFolderFillerBundle:Filler:fill.html.twig', [ 'item' => $item ]); }
[ "public", "function", "fillAction", "(", "Item", "$", "item", ")", "{", "// do fill", "$", "this", "->", "get", "(", "'anime_db.item_folder_filler.filler_folder'", ")", "->", "fillFolder", "(", "$", "item", ")", ";", "return", "$", "this", "->", "render", "(...
Fill item folder @param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item @return \Symfony\Component\HttpFoundation\Response
[ "Fill", "item", "folder" ]
train
https://github.com/anime-db/item-folder-filler-bundle/blob/9b5d02628fa235171a42123aaa9b54ddab5d94d1/src/Controller/FillerController.php#L31-L39
vpg/titon.utility
src/Titon/Utility/Sanitize.php
Sanitize.escape
public static function escape($value, array $options = array()) { $options = $options + array( 'encoding' => 'UTF-8', 'flags' => ENT_QUOTES, 'double' => false ); return htmlentities($value, $options['flags'], $options['encoding'], $options['double']); }
php
public static function escape($value, array $options = array()) { $options = $options + array( 'encoding' => 'UTF-8', 'flags' => ENT_QUOTES, 'double' => false ); return htmlentities($value, $options['flags'], $options['encoding'], $options['double']); }
[ "public", "static", "function", "escape", "(", "$", "value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'encoding'", "=>", "'UTF-8'", ",", "'flags'", "=>", "ENT_QUOTES", ",",...
Escape a string using the apps encoding. @param string $value @param array $options { @type string $encoding Character encoding set; defaults to UTF-8 @type int $flags Encoding flags; defaults to ENT_QUOTES @type bool $double Will double escape existing entities } @return string
[ "Escape", "a", "string", "using", "the", "apps", "encoding", "." ]
train
https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L39-L47
vpg/titon.utility
src/Titon/Utility/Sanitize.php
Sanitize.html
public static function html($value, array $options = array()) { $options = $options + array( 'strip' => true, 'whitelist' => '' ); if ($options['strip']) { $value = strip_tags($value, $options['whitelist']); } return static::escape($value, $o...
php
public static function html($value, array $options = array()) { $options = $options + array( 'strip' => true, 'whitelist' => '' ); if ($options['strip']) { $value = strip_tags($value, $options['whitelist']); } return static::escape($value, $o...
[ "public", "static", "function", "html", "(", "$", "value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'strip'", "=>", "true", ",", "'whitelist'", "=>", "''", ")", ";", "i...
Sanitize a string by removing xor escaping HTML characters and entities. @param string $value @param array $options { @type bool $strip Will remove HTML tags @type string $whitelist List of tags to not strip } @return string
[ "Sanitize", "a", "string", "by", "removing", "xor", "escaping", "HTML", "characters", "and", "entities", "." ]
train
https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L69-L80
vpg/titon.utility
src/Titon/Utility/Sanitize.php
Sanitize.newlines
public static function newlines($value, array $options = array()) { $options = $options + array( 'cr' => true, 'lf' => true, 'crlf' => true, 'limit' => 2, 'trim' => true ); if ($options['limit']) { $pattern = '/(?:%s){' . $...
php
public static function newlines($value, array $options = array()) { $options = $options + array( 'cr' => true, 'lf' => true, 'crlf' => true, 'limit' => 2, 'trim' => true ); if ($options['limit']) { $pattern = '/(?:%s){' . $...
[ "public", "static", "function", "newlines", "(", "$", "value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'cr'", "=>", "true", ",", "'lf'", "=>", "true", ",", "'crlf'", "...
Sanitize a string by removing excess CRLF characters. @param string $value @param array $options { @type bool $cr Will remove carriage returns \r @type bool $lf Will remove line feeds \n @type bool $crlf Will remove CRLF \r\n @type bool $trim Will remove whitespace and newlines around the edges @type i...
[ "Sanitize", "a", "string", "by", "removing", "excess", "CRLF", "characters", "." ]
train
https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L106-L140
vpg/titon.utility
src/Titon/Utility/Sanitize.php
Sanitize.whitespace
public static function whitespace($value, array $options = array()) { $options = $options + array( 'space' => true, 'tab' => true, 'limit' => 2, 'strip' => true, 'trim' => true ); if ($options['limit']) { $pattern = '/%s{' ...
php
public static function whitespace($value, array $options = array()) { $options = $options + array( 'space' => true, 'tab' => true, 'limit' => 2, 'strip' => true, 'trim' => true ); if ($options['limit']) { $pattern = '/%s{' ...
[ "public", "static", "function", "whitespace", "(", "$", "value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'space'", "=>", "true", ",", "'tab'", "=>", "true", ",", "'limit...
Sanitize a string by removing excess whitespace and tab characters. @param string $value @param array $options { @type bool $space Will remove white space @type bool $tab Will remove tabs @type bool $strip Will remove non-standard white space character @type bool $trim Will remove whitespace and newlines ar...
[ "Sanitize", "a", "string", "by", "removing", "excess", "whitespace", "and", "tab", "characters", "." ]
train
https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L166-L200
vpg/titon.utility
src/Titon/Utility/Sanitize.php
Sanitize.xss
public static function xss($value, array $options = array()) { $options = $options + array('strip' => true); $value = str_replace("\0", '', $value); if (!$options['strip']) { // Remove any attribute starting with on or xmlns $value = preg_replace('/\s?(?:on[a-z]+|xmlns...
php
public static function xss($value, array $options = array()) { $options = $options + array('strip' => true); $value = str_replace("\0", '', $value); if (!$options['strip']) { // Remove any attribute starting with on or xmlns $value = preg_replace('/\s?(?:on[a-z]+|xmlns...
[ "public", "static", "function", "xss", "(", "$", "value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options", "=", "$", "options", "+", "array", "(", "'strip'", "=>", "true", ")", ";", "$", "value", "=", "str_replace", "...
Sanitize a string by removing any XSS attack vectors. Will bubble up to html() and escape(). @param string $value @param array $options { @type bool $strip Remove HTML tags } @return string
[ "Sanitize", "a", "string", "by", "removing", "any", "XSS", "attack", "vectors", ".", "Will", "bubble", "up", "to", "html", "()", "and", "escape", "()", "." ]
train
https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L212-L233
Fenzland/php-http-client
libs/FormData.php
FormData.setFile
public function setFile( string$key, string$fileName ):self { if( !file_exists($fileName) || is_dir($fileName) || is_link($fileName) ){ throw new Exception("$fileName is not a regular file."); } $this->files[$key]= [ 'fileName'=> $fileName, 'contentType'=> mime_content_type($fileName), 'content'=> fi...
php
public function setFile( string$key, string$fileName ):self { if( !file_exists($fileName) || is_dir($fileName) || is_link($fileName) ){ throw new Exception("$fileName is not a regular file."); } $this->files[$key]= [ 'fileName'=> $fileName, 'contentType'=> mime_content_type($fileName), 'content'=> fi...
[ "public", "function", "setFile", "(", "string", "$", "key", ",", "string", "$", "fileName", ")", ":", "self", "{", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", "||", "is_dir", "(", "$", "fileName", ")", "||", "is_link", "(", "$", "fileNa...
Method setFile @access public @param string $key @param string $fileName @return self
[ "Method", "setFile" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/FormData.php#L90-L102
Fenzland/php-http-client
libs/FormData.php
FormData.setFileRaw
public function setFileRaw( string$key, string$contentType, string$content, string$fileName=null ):self { $this->files[$key]= [ 'fileName'=> $fileName??md5($content), 'contentType'=> $contentType, 'content'=> $content, ]; return $this; }
php
public function setFileRaw( string$key, string$contentType, string$content, string$fileName=null ):self { $this->files[$key]= [ 'fileName'=> $fileName??md5($content), 'contentType'=> $contentType, 'content'=> $content, ]; return $this; }
[ "public", "function", "setFileRaw", "(", "string", "$", "key", ",", "string", "$", "contentType", ",", "string", "$", "content", ",", "string", "$", "fileName", "=", "null", ")", ":", "self", "{", "$", "this", "->", "files", "[", "$", "key", "]", "="...
Method setFileRaw @access public @param string $key @param string $contentType @param string $content @param string $fileName @return self
[ "Method", "setFileRaw" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/FormData.php#L116-L125
ezra-obiwale/dSCore
src/Core/AService.php
AService.setModel
public function setModel(IModel $model, $initRepo = true) { $this->model = $model; if ($initRepo) $this->initRepository(); return $this; }
php
public function setModel(IModel $model, $initRepo = true) { $this->model = $model; if ($initRepo) $this->initRepository(); return $this; }
[ "public", "function", "setModel", "(", "IModel", "$", "model", ",", "$", "initRepo", "=", "true", ")", "{", "$", "this", "->", "model", "=", "$", "model", ";", "if", "(", "$", "initRepo", ")", "$", "this", "->", "initRepository", "(", ")", ";", "re...
Sets the model to class @param IModel $model
[ "Sets", "the", "model", "to", "class" ]
train
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L43-L48
ezra-obiwale/dSCore
src/Core/AService.php
AService.initRepository
protected function initRepository() { if ($this->model === null || ($this->model !== null && !in_array('DScribe\Core\IModel', class_implements($this->model)))) return false; if ($this->repository !== null && $this->model->getTableName() === $this->repository->getTableName())...
php
protected function initRepository() { if ($this->model === null || ($this->model !== null && !in_array('DScribe\Core\IModel', class_implements($this->model)))) return false; if ($this->repository !== null && $this->model->getTableName() === $this->repository->getTableName())...
[ "protected", "function", "initRepository", "(", ")", "{", "if", "(", "$", "this", "->", "model", "===", "null", "||", "(", "$", "this", "->", "model", "!==", "null", "&&", "!", "in_array", "(", "'DScribe\\Core\\IModel'", ",", "class_implements", "(", "$", ...
Initializes the repository @return boolean
[ "Initializes", "the", "repository" ]
train
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L72-L82
ezra-obiwale/dSCore
src/Core/AService.php
AService.prepareInject
protected function prepareInject() { $model = ($this->model) ? $this->model : $this->getModule() . '\Models\\' . $this->getClassName(); if (is_object($model)) $model = get_class($model); if (!class_exists($model)) return array_merge(parent::prepareInject(), $this->getCo...
php
protected function prepareInject() { $model = ($this->model) ? $this->model : $this->getModule() . '\Models\\' . $this->getClassName(); if (is_object($model)) $model = get_class($model); if (!class_exists($model)) return array_merge(parent::prepareInject(), $this->getCo...
[ "protected", "function", "prepareInject", "(", ")", "{", "$", "model", "=", "(", "$", "this", "->", "model", ")", "?", "$", "this", "->", "model", ":", "$", "this", "->", "getModule", "(", ")", ".", "'\\Models\\\\'", ".", "$", "this", "->", "getClass...
prepares injection of classes @return array
[ "prepares", "injection", "of", "classes" ]
train
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L103-L117
davedevelopment/pimple-aware-event-dispatcher
src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php
PimpleAwareEventDispatcher.addListenerService
public function addListenerService($eventName, $callback, $priority = 0) { if (!is_array($callback) || 2 !== count($callback)) { throw new \InvalidArgumentException('Expected an array("service", "method") argument'); } $serviceId = $callback[0]; $method = $callback[1]; ...
php
public function addListenerService($eventName, $callback, $priority = 0) { if (!is_array($callback) || 2 !== count($callback)) { throw new \InvalidArgumentException('Expected an array("service", "method") argument'); } $serviceId = $callback[0]; $method = $callback[1]; ...
[ "public", "function", "addListenerService", "(", "$", "eventName", ",", "$", "callback", ",", "$", "priority", "=", "0", ")", "{", "if", "(", "!", "is_array", "(", "$", "callback", ")", "||", "2", "!==", "count", "(", "$", "callback", ")", ")", "{", ...
Adds a service as event listener @param string $eventName Event for which the listener is added @param array $callback The service ID of the listener service & the method name that has to be called @param integer $priority The higher this value, the earlier an event listener will be triggered in the chain. Defaults to...
[ "Adds", "a", "service", "as", "event", "listener" ]
train
https://github.com/davedevelopment/pimple-aware-event-dispatcher/blob/e0864988219da254c46690379634bce3f22a0eba/src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php#L64-L79
davedevelopment/pimple-aware-event-dispatcher
src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php
PimpleAwareEventDispatcher.addSubscriberService
public function addSubscriberService($serviceId, $class) { $rfc = new \ReflectionClass($class); if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) { throw new \InvalidArgumentException( "$class must implement Symfony\Component\Ev...
php
public function addSubscriberService($serviceId, $class) { $rfc = new \ReflectionClass($class); if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) { throw new \InvalidArgumentException( "$class must implement Symfony\Component\Ev...
[ "public", "function", "addSubscriberService", "(", "$", "serviceId", ",", "$", "class", ")", "{", "$", "rfc", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "if", "(", "!", "$", "rfc", "->", "implementsInterface", "(", "'Symfony\\Compone...
Adds a service as event subscriber @param string $serviceId The service ID of the subscriber service @param string $class The service's class name (which must implement EventSubscriberInterface)
[ "Adds", "a", "service", "as", "event", "subscriber" ]
train
https://github.com/davedevelopment/pimple-aware-event-dispatcher/blob/e0864988219da254c46690379634bce3f22a0eba/src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php#L102-L122
davedevelopment/pimple-aware-event-dispatcher
src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php
PimpleAwareEventDispatcher.dispatch
public function dispatch($eventName, Event $event = null) { return $this->eventDispatcher->dispatch($eventName, $event); }
php
public function dispatch($eventName, Event $event = null) { return $this->eventDispatcher->dispatch($eventName, $event); }
[ "public", "function", "dispatch", "(", "$", "eventName", ",", "Event", "$", "event", "=", "null", ")", "{", "return", "$", "this", "->", "eventDispatcher", "->", "dispatch", "(", "$", "eventName", ",", "$", "event", ")", ";", "}" ]
{@inheritdocs}
[ "{" ]
train
https://github.com/davedevelopment/pimple-aware-event-dispatcher/blob/e0864988219da254c46690379634bce3f22a0eba/src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php#L149-L152
brain-diminished/schema-version-control
src/Utils/SchemaNormalizer.php
SchemaNormalizer.normalize
public function normalize(Schema $schema): array { $this->schema = $schema; $schemaDesc = []; $schemaDesc['tables'] = []; foreach ($schema->getTables() as $table) { $schemaDesc['tables'][$table->getName()] = $this->normalizeTable($table); } return $schemaD...
php
public function normalize(Schema $schema): array { $this->schema = $schema; $schemaDesc = []; $schemaDesc['tables'] = []; foreach ($schema->getTables() as $table) { $schemaDesc['tables'][$table->getName()] = $this->normalizeTable($table); } return $schemaD...
[ "public", "function", "normalize", "(", "Schema", "$", "schema", ")", ":", "array", "{", "$", "this", "->", "schema", "=", "$", "schema", ";", "$", "schemaDesc", "=", "[", "]", ";", "$", "schemaDesc", "[", "'tables'", "]", "=", "[", "]", ";", "fore...
Normalize a Schema object into an array descriptor @param Schema $schema @return array
[ "Normalize", "a", "Schema", "object", "into", "an", "array", "descriptor" ]
train
https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/Utils/SchemaNormalizer.php#L26-L35
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.getQty
public function getQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
php
public function getQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
[ "public", "function", "getQty", "(", "StockItemInterface", "$", "item", ")", ":", "UomQty", "{", "$", "units", "=", "$", "this", "->", "stockUnitRepository", "->", "findByStockItem", "(", "$", "item", ")", ";", "return", "$", "this", "->", "computeQtyForUnit...
@param StockItemInterface $item @return UomQty
[ "@param", "StockItemInterface", "$item" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L47-L53
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.getReservedQty
public function getReservedQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findReservedByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
php
public function getReservedQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findReservedByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
[ "public", "function", "getReservedQty", "(", "StockItemInterface", "$", "item", ")", ":", "UomQty", "{", "$", "units", "=", "$", "this", "->", "stockUnitRepository", "->", "findReservedByStockItem", "(", "$", "item", ")", ";", "return", "$", "this", "->", "c...
@param StockItemInterface $item @return UomQty
[ "@param", "StockItemInterface", "$item" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L60-L66
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.getAvailableQty
public function getAvailableQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findAvailableByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
php
public function getAvailableQty(StockItemInterface $item): UomQty { $units = $this->stockUnitRepository ->findAvailableByStockItem($item); return $this->computeQtyForUnits($item->getUom(), $units); }
[ "public", "function", "getAvailableQty", "(", "StockItemInterface", "$", "item", ")", ":", "UomQty", "{", "$", "units", "=", "$", "this", "->", "stockUnitRepository", "->", "findAvailableByStockItem", "(", "$", "item", ")", ";", "return", "$", "this", "->", ...
@param StockItemInterface $item @return UomQty
[ "@param", "StockItemInterface", "$item" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L73-L79
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.getReservedQtyByMovement
public function getReservedQtyByMovement(StockItemInterface $item, Movement $mvt): UomQty { $units = $this->stockUnitRepository ->findBy(['stockItem' => $item, 'reservationMovement' => $mvt]); return $this->computeQtyForUnits($item->getUom(), $units); }
php
public function getReservedQtyByMovement(StockItemInterface $item, Movement $mvt): UomQty { $units = $this->stockUnitRepository ->findBy(['stockItem' => $item, 'reservationMovement' => $mvt]); return $this->computeQtyForUnits($item->getUom(), $units); }
[ "public", "function", "getReservedQtyByMovement", "(", "StockItemInterface", "$", "item", ",", "Movement", "$", "mvt", ")", ":", "UomQty", "{", "$", "units", "=", "$", "this", "->", "stockUnitRepository", "->", "findBy", "(", "[", "'stockItem'", "=>", "$", "...
@param StockItemInterface $item @return UomQty
[ "@param", "StockItemInterface", "$item" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L86-L93
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.getQtyByLocation
public function getQtyByLocation(StockItemInterface $item, Location $location): UomQty { $units = $this->stockUnitRepository ->findByStockItemAndLocation($item, $location); return $this->computeQtyForUnits($item->getUom(), $units); }
php
public function getQtyByLocation(StockItemInterface $item, Location $location): UomQty { $units = $this->stockUnitRepository ->findByStockItemAndLocation($item, $location); return $this->computeQtyForUnits($item->getUom(), $units); }
[ "public", "function", "getQtyByLocation", "(", "StockItemInterface", "$", "item", ",", "Location", "$", "location", ")", ":", "UomQty", "{", "$", "units", "=", "$", "this", "->", "stockUnitRepository", "->", "findByStockItemAndLocation", "(", "$", "item", ",", ...
@param StockItemInterface $item @param Location $location @return UomQty
[ "@param", "StockItemInterface", "$item", "@param", "Location", "$location" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L101-L108
sil-project/StockBundle
src/Domain/Query/StockItemQueries.php
StockItemQueries.computeQtyForUnits
protected function computeQtyForUnits(Uom $uom, array $stockUnits): UomQty { $unitQties = array_map(function ($q) { return $q->getQty()->getValue(); }, $stockUnits); $sumQty = array_sum($unitQties); return new UomQty($uom, $sumQty); }
php
protected function computeQtyForUnits(Uom $uom, array $stockUnits): UomQty { $unitQties = array_map(function ($q) { return $q->getQty()->getValue(); }, $stockUnits); $sumQty = array_sum($unitQties); return new UomQty($uom, $sumQty); }
[ "protected", "function", "computeQtyForUnits", "(", "Uom", "$", "uom", ",", "array", "$", "stockUnits", ")", ":", "UomQty", "{", "$", "unitQties", "=", "array_map", "(", "function", "(", "$", "q", ")", "{", "return", "$", "q", "->", "getQty", "(", ")",...
@param Uom $uom @param array|StockUnit[] $stockUnits @return UomQty
[ "@param", "Uom", "$uom", "@param", "array|StockUnit", "[]", "$stockUnits" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Query/StockItemQueries.php#L116-L124
ekyna/MediaBundle
Model/Import/MediaUpload.php
MediaUpload.addMedia
public function addMedia(MediaInterface $media) { if (!$this->medias->contains($media)) { $this->medias->add($media); } return $this; }
php
public function addMedia(MediaInterface $media) { if (!$this->medias->contains($media)) { $this->medias->add($media); } return $this; }
[ "public", "function", "addMedia", "(", "MediaInterface", "$", "media", ")", "{", "if", "(", "!", "$", "this", "->", "medias", "->", "contains", "(", "$", "media", ")", ")", "{", "$", "this", "->", "medias", "->", "add", "(", "$", "media", ")", ";",...
Adds the media. @param MediaInterface $media @return MediaUpload
[ "Adds", "the", "media", "." ]
train
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Model/Import/MediaUpload.php#L35-L41
ekyna/MediaBundle
Model/Import/MediaUpload.php
MediaUpload.removeMedia
public function removeMedia(MediaInterface $media) { if ($this->medias->contains($media)) { $this->medias->removeElement($media); } return $this; }
php
public function removeMedia(MediaInterface $media) { if ($this->medias->contains($media)) { $this->medias->removeElement($media); } return $this; }
[ "public", "function", "removeMedia", "(", "MediaInterface", "$", "media", ")", "{", "if", "(", "$", "this", "->", "medias", "->", "contains", "(", "$", "media", ")", ")", "{", "$", "this", "->", "medias", "->", "removeElement", "(", "$", "media", ")", ...
Removes the media. @param MediaInterface $media @return MediaUpload
[ "Removes", "the", "media", "." ]
train
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Model/Import/MediaUpload.php#L49-L55
DarvinStudio/fileman
src/Darvin/Fileman/Command/PullCommand.php
PullCommand.configure
protected function configure() { parent::configure(); if (null === $this->getName()) { $this->setName('pull'); } $this->setDescription('Pulls remote files to local directory'); }
php
protected function configure() { parent::configure(); if (null === $this->getName()) { $this->setName('pull'); } $this->setDescription('Pulls remote files to local directory'); }
[ "protected", "function", "configure", "(", ")", "{", "parent", "::", "configure", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "getName", "(", ")", ")", "{", "$", "this", "->", "setName", "(", "'pull'", ")", ";", "}", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/DarvinStudio/fileman/blob/940055874d2b094e082aabfa6ad7fc0fc17c8396/src/Darvin/Fileman/Command/PullCommand.php#L25-L34
DarvinStudio/fileman
src/Darvin/Fileman/Command/PullCommand.php
PullCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $callback = [$io, 'success']; $dirFetcher = $this->createDirectoryFetcher($input); $localManager = $this->createLocalManager($input, $dirFetcher); $remote...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $callback = [$io, 'success']; $dirFetcher = $this->createDirectoryFetcher($input); $localManager = $this->createLocalManager($input, $dirFetcher); $remote...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "callback", "=", "[", "$", "io", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/DarvinStudio/fileman/blob/940055874d2b094e082aabfa6ad7fc0fc17c8396/src/Darvin/Fileman/Command/PullCommand.php#L39-L61
cmsgears/module-sns-connect
frontend/controllers/GoogleController.php
GoogleController.actionAuthorise
public function actionAuthorise( $code, $state ) { // Get Token $accessToken = $this->googleService->getAccessToken( $code, $state ); $snsUser = $this->googleService->getUser( $accessToken ); if( isset( $snsUser ) ) { // Get User $user = $this->modelService->getUser( $snsUser, $accessToken ); // L...
php
public function actionAuthorise( $code, $state ) { // Get Token $accessToken = $this->googleService->getAccessToken( $code, $state ); $snsUser = $this->googleService->getUser( $accessToken ); if( isset( $snsUser ) ) { // Get User $user = $this->modelService->getUser( $snsUser, $accessToken ); // L...
[ "public", "function", "actionAuthorise", "(", "$", "code", ",", "$", "state", ")", "{", "// Get Token", "$", "accessToken", "=", "$", "this", "->", "googleService", "->", "getAccessToken", "(", "$", "code", ",", "$", "state", ")", ";", "$", "snsUser", "=...
GoogleController ----------------------
[ "GoogleController", "----------------------" ]
train
https://github.com/cmsgears/module-sns-connect/blob/753ee4157d41c81a701689624f4c44760a6cada3/frontend/controllers/GoogleController.php#L82-L104
Subscribo/klarna-invoice-sdk-wrapped
src/klarnapclass.php
KlarnaPClass.toArray
public function toArray() { return array( 'eid' => $this->eid, 'id' => $this->id, 'description' => $this->description, 'months' => $this->months, 'startfee' => $this->startFee, 'invo...
php
public function toArray() { return array( 'eid' => $this->eid, 'id' => $this->id, 'description' => $this->description, 'months' => $this->months, 'startfee' => $this->startFee, 'invo...
[ "public", "function", "toArray", "(", ")", "{", "return", "array", "(", "'eid'", "=>", "$", "this", "->", "eid", ",", "'id'", "=>", "$", "this", "->", "id", ",", "'description'", "=>", "$", "this", "->", "description", ",", "'months'", "=>", "$", "th...
Returns an associative array mirroring this PClass. @return array
[ "Returns", "an", "associative", "array", "mirroring", "this", "PClass", "." ]
train
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnapclass.php#L268-L283
Subscribo/klarna-invoice-sdk-wrapped
src/klarnapclass.php
KlarnaPClass.isValid
public function isValid($now = null) { if ($this->expire == null || $this->expire == '-' || $this->expire <= 0 ) { //No expire, or unset? assume valid. return true; } if ($now === null || !is_numeric($now)) { $now = time();...
php
public function isValid($now = null) { if ($this->expire == null || $this->expire == '-' || $this->expire <= 0 ) { //No expire, or unset? assume valid. return true; } if ($now === null || !is_numeric($now)) { $now = time();...
[ "public", "function", "isValid", "(", "$", "now", "=", "null", ")", "{", "if", "(", "$", "this", "->", "expire", "==", "null", "||", "$", "this", "->", "expire", "==", "'-'", "||", "$", "this", "->", "expire", "<=", "0", ")", "{", "//No expire, or ...
Checks whether this PClass is valid. @param int $now Unix timestamp @return bool
[ "Checks", "whether", "this", "PClass", "is", "valid", "." ]
train
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnapclass.php#L459-L475
Kris-Kuiper/sFire-Framework
src/MVC/MVCTrait.php
MVCTrait.helper
protected function helper($classname) { $directories = explode('.', $classname); //Convert dots to directory seperators $amount = count($directories) - 1; $namespace = Router :: getRoute() -> getModule() . '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', Application :: get(['directory', 'helper'])); f...
php
protected function helper($classname) { $directories = explode('.', $classname); //Convert dots to directory seperators $amount = count($directories) - 1; $namespace = Router :: getRoute() -> getModule() . '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', Application :: get(['directory', 'helper'])); f...
[ "protected", "function", "helper", "(", "$", "classname", ")", "{", "$", "directories", "=", "explode", "(", "'.'", ",", "$", "classname", ")", ";", "//Convert dots to directory seperators\r", "$", "amount", "=", "count", "(", "$", "directories", ")", "-", "...
Loads a helper class in current module directory @param string $classname @return Object
[ "Loads", "a", "helper", "class", "in", "current", "module", "directory" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L26-L44
Kris-Kuiper/sFire-Framework
src/MVC/MVCTrait.php
MVCTrait.fails
protected function fails($fieldname = null) { $helper = new StringToArray(); return $helper -> execute($fieldname, null, Message :: getErrors(true)); }
php
protected function fails($fieldname = null) { $helper = new StringToArray(); return $helper -> execute($fieldname, null, Message :: getErrors(true)); }
[ "protected", "function", "fails", "(", "$", "fieldname", "=", "null", ")", "{", "$", "helper", "=", "new", "StringToArray", "(", ")", ";", "return", "$", "helper", "->", "execute", "(", "$", "fieldname", ",", "null", ",", "Message", "::", "getErrors", ...
Get the error message from the validator by fieldname @param string $fieldname @return string
[ "Get", "the", "error", "message", "from", "the", "validator", "by", "fieldname" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L52-L56
Kris-Kuiper/sFire-Framework
src/MVC/MVCTrait.php
MVCTrait.passes
protected function passes($fieldname = null) { $helper = new StringToArray(); return true === Request :: isPost() && null === $helper -> execute($fieldname, null, Message :: getErrors(true)); }
php
protected function passes($fieldname = null) { $helper = new StringToArray(); return true === Request :: isPost() && null === $helper -> execute($fieldname, null, Message :: getErrors(true)); }
[ "protected", "function", "passes", "(", "$", "fieldname", "=", "null", ")", "{", "$", "helper", "=", "new", "StringToArray", "(", ")", ";", "return", "true", "===", "Request", "::", "isPost", "(", ")", "&&", "null", "===", "$", "helper", "->", "execute...
Returns if there is no validation error for the given fieldname when request method is equal to POST @param string $fieldname @return boolean
[ "Returns", "if", "there", "is", "no", "validation", "error", "for", "the", "given", "fieldname", "when", "request", "method", "is", "equal", "to", "POST" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L64-L68
tonis-io-legacy/tonis
src/Router/Group.php
Group.group
public function group($prefix, callable $func) { $group = new self($this->router, $this->prefix . $prefix); $func($group); return $group; }
php
public function group($prefix, callable $func) { $group = new self($this->router, $this->prefix . $prefix); $func($group); return $group; }
[ "public", "function", "group", "(", "$", "prefix", ",", "callable", "$", "func", ")", "{", "$", "group", "=", "new", "self", "(", "$", "this", "->", "router", ",", "$", "this", "->", "prefix", ".", "$", "prefix", ")", ";", "$", "func", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L24-L30
tonis-io-legacy/tonis
src/Router/Group.php
Group.get
public function get($path, $handler) { return $this->router->get($this->prefix . $path, $handler); }
php
public function get($path, $handler) { return $this->router->get($this->prefix . $path, $handler); }
[ "public", "function", "get", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "get", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L35-L38
tonis-io-legacy/tonis
src/Router/Group.php
Group.post
public function post($path, $handler) { return $this->router->post($this->prefix . $path, $handler); }
php
public function post($path, $handler) { return $this->router->post($this->prefix . $path, $handler); }
[ "public", "function", "post", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "post", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L43-L46
tonis-io-legacy/tonis
src/Router/Group.php
Group.patch
public function patch($path, $handler) { return $this->router->patch($this->prefix . $path, $handler); }
php
public function patch($path, $handler) { return $this->router->patch($this->prefix . $path, $handler); }
[ "public", "function", "patch", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "patch", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L51-L54
tonis-io-legacy/tonis
src/Router/Group.php
Group.put
public function put($path, $handler) { return $this->router->put($this->prefix . $path, $handler); }
php
public function put($path, $handler) { return $this->router->put($this->prefix . $path, $handler); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "put", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L59-L62
tonis-io-legacy/tonis
src/Router/Group.php
Group.delete
public function delete($path, $handler) { return $this->router->delete($this->prefix . $path, $handler); }
php
public function delete($path, $handler) { return $this->router->delete($this->prefix . $path, $handler); }
[ "public", "function", "delete", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "delete", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L67-L70
tonis-io-legacy/tonis
src/Router/Group.php
Group.head
public function head($path, $handler) { return $this->router->head($this->prefix . $path, $handler); }
php
public function head($path, $handler) { return $this->router->head($this->prefix . $path, $handler); }
[ "public", "function", "head", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "head", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L75-L78
tonis-io-legacy/tonis
src/Router/Group.php
Group.options
public function options($path, $handler) { return $this->router->options($this->prefix . $path, $handler); }
php
public function options($path, $handler) { return $this->router->options($this->prefix . $path, $handler); }
[ "public", "function", "options", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "options", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L83-L86
tonis-io-legacy/tonis
src/Router/Group.php
Group.any
public function any($path, $handler) { return $this->router->any($this->prefix . $path, $handler); }
php
public function any($path, $handler) { return $this->router->any($this->prefix . $path, $handler); }
[ "public", "function", "any", "(", "$", "path", ",", "$", "handler", ")", "{", "return", "$", "this", "->", "router", "->", "any", "(", "$", "this", "->", "prefix", ".", "$", "path", ",", "$", "handler", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/Group.php#L91-L94
goncalomb/asbestos
src/classes/Html/Document.php
Document.ogTags
public function ogTags($data, $merge=true, $prefix='og') { $this->_headElement->ogTags($data, $merge, $prefix); }
php
public function ogTags($data, $merge=true, $prefix='og') { $this->_headElement->ogTags($data, $merge, $prefix); }
[ "public", "function", "ogTags", "(", "$", "data", ",", "$", "merge", "=", "true", ",", "$", "prefix", "=", "'og'", ")", "{", "$", "this", "->", "_headElement", "->", "ogTags", "(", "$", "data", ",", "$", "merge", ",", "$", "prefix", ")", ";", "}"...
Set Open Graph tags. @param array $data Tag names and values. @param bool $merge Merge with current tags. @param string $prefix Tag name prefix.
[ "Set", "Open", "Graph", "tags", "." ]
train
https://github.com/goncalomb/asbestos/blob/14a875b6c125cfeefe4eb1c3c524500eb8a51d04/src/classes/Html/Document.php#L92-L95
goncalomb/asbestos
src/classes/Html/Document.php
Document.scriptFile
public function scriptFile($src, $end=false) { if ($end) { $this->_bodyElement->scriptFile($src); } else { $this->_headElement->scriptFile($src); } }
php
public function scriptFile($src, $end=false) { if ($end) { $this->_bodyElement->scriptFile($src); } else { $this->_headElement->scriptFile($src); } }
[ "public", "function", "scriptFile", "(", "$", "src", ",", "$", "end", "=", "false", ")", "{", "if", "(", "$", "end", ")", "{", "$", "this", "->", "_bodyElement", "->", "scriptFile", "(", "$", "src", ")", ";", "}", "else", "{", "$", "this", "->", ...
Add script file. @param string $src The script location. @param bool $end Add script to end of body instead of head.
[ "Add", "script", "file", "." ]
train
https://github.com/goncalomb/asbestos/blob/14a875b6c125cfeefe4eb1c3c524500eb8a51d04/src/classes/Html/Document.php#L113-L120
ekyna/MediaBundle
Form/Type/Step/MediaImportSelectionType.php
MediaImportSelectionType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $type = $this; $builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) use ($type) { /** @var \Ekyna\Bundle\MediaBundle\Model\Import\MediaImport $import */ if (null === $import...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $type = $this; $builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) use ($type) { /** @var \Ekyna\Bundle\MediaBundle\Model\Import\MediaImport $import */ if (null === $import...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "type", "=", "$", "this", ";", "$", "builder", "->", "addEventListener", "(", "FormEvents", "::", "POST_SET_DATA", ",", "function", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Form/Type/Step/MediaImportSelectionType.php#L38-L56
ekyna/MediaBundle
Form/Type/Step/MediaImportSelectionType.php
MediaImportSelectionType.buildKeysChoices
public function buildKeysChoices(MediaImport $import) { $prefix = $import->getFilesystem(); $fs = $this->mountManager->getFilesystem($prefix); $contents = $fs->listContents('', true); $choices = []; foreach ($contents as $object) { if (!($object['type'] == 'dir' |...
php
public function buildKeysChoices(MediaImport $import) { $prefix = $import->getFilesystem(); $fs = $this->mountManager->getFilesystem($prefix); $contents = $fs->listContents('', true); $choices = []; foreach ($contents as $object) { if (!($object['type'] == 'dir' |...
[ "public", "function", "buildKeysChoices", "(", "MediaImport", "$", "import", ")", "{", "$", "prefix", "=", "$", "import", "->", "getFilesystem", "(", ")", ";", "$", "fs", "=", "$", "this", "->", "mountManager", "->", "getFilesystem", "(", "$", "prefix", ...
Builds the keys choices. @param MediaImport $import @return array
[ "Builds", "the", "keys", "choices", "." ]
train
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Form/Type/Step/MediaImportSelectionType.php#L64-L77
shrink0r/monatic
src/Eventually.php
Eventually.get
public function get(callable $codeBlock = null) { if ($this->result === null) { $this->run(function ($value) use ($codeBlock) { $this->result = $value; if (is_callable($codeBlock)) { $codeBlock($this->result); } }); ...
php
public function get(callable $codeBlock = null) { if ($this->result === null) { $this->run(function ($value) use ($codeBlock) { $this->result = $value; if (is_callable($codeBlock)) { $codeBlock($this->result); } }); ...
[ "public", "function", "get", "(", "callable", "$", "codeBlock", "=", "null", ")", "{", "if", "(", "$", "this", "->", "result", "===", "null", ")", "{", "$", "this", "->", "run", "(", "function", "(", "$", "value", ")", "use", "(", "$", "codeBlock",...
Eventually provides the a value resulting from running the monad's code-block. If the value can not be provided at the moment, a pointer to self is returned and the $codeBlock is executed when the value becomes available. @param callable $codeBlock @return mixed Returns an instance of Eventually, if the value wasn't ...
[ "Eventually", "provides", "the", "a", "value", "resulting", "from", "running", "the", "monad", "s", "code", "-", "block", ".", "If", "the", "value", "can", "not", "be", "provided", "at", "the", "moment", "a", "pointer", "to", "self", "is", "returned", "a...
train
https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Eventually.php#L44-L61
shrink0r/monatic
src/Eventually.php
Eventually.bind
public function bind(callable $codeBlock) { assert($this->result === null, "'Eventually' instance may not be mutated after code-block execution."); return static::unit(function ($success) use ($codeBlock) { $this->run(function ($value) use ($codeBlock, $success) { return...
php
public function bind(callable $codeBlock) { assert($this->result === null, "'Eventually' instance may not be mutated after code-block execution."); return static::unit(function ($success) use ($codeBlock) { $this->run(function ($value) use ($codeBlock, $success) { return...
[ "public", "function", "bind", "(", "callable", "$", "codeBlock", ")", "{", "assert", "(", "$", "this", "->", "result", "===", "null", ",", "\"'Eventually' instance may not be mutated after code-block execution.\"", ")", ";", "return", "static", "::", "unit", "(", ...
Binds the given callable to the monad's managed code-block's successful execution. @param callable $codeBlock Is expected to return an instance of Eventually. @return Eventually
[ "Binds", "the", "given", "callable", "to", "the", "monad", "s", "managed", "code", "-", "block", "s", "successful", "execution", "." ]
train
https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Eventually.php#L70-L79
dms-org/common.structure
src/Geo/Persistence/StreetAddressWithLatLngMapper.php
StreetAddressWithLatLngMapper.define
protected function define(MapperDefinition $map) { $map->type(StreetAddressWithLatLng::class); $map->property(StreetAddressWithLatLng::ADDRESS) ->to($this->addressColumnName)->asVarchar(StreetAddress::MAX_LENGTH); $map->embedded(StreetAddressWithLatLng::LAT_LNG) ...
php
protected function define(MapperDefinition $map) { $map->type(StreetAddressWithLatLng::class); $map->property(StreetAddressWithLatLng::ADDRESS) ->to($this->addressColumnName)->asVarchar(StreetAddress::MAX_LENGTH); $map->embedded(StreetAddressWithLatLng::LAT_LNG) ...
[ "protected", "function", "define", "(", "MapperDefinition", "$", "map", ")", "{", "$", "map", "->", "type", "(", "StreetAddressWithLatLng", "::", "class", ")", ";", "$", "map", "->", "property", "(", "StreetAddressWithLatLng", "::", "ADDRESS", ")", "->", "to...
Defines the value object mapper @param MapperDefinition $map @return void
[ "Defines", "the", "value", "object", "mapper" ]
train
https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Geo/Persistence/StreetAddressWithLatLngMapper.php#L55-L64
SteeinRu/steein-sdk-php
src/Steein/SDK/Core/SteeinUserAgent.php
SteeinUserAgent.getValue
public static function getValue($sdkName, $sdkVersion) { $featureList = array( 'platform-ver=' . PHP_VERSION, 'bit=' . self::_getPHPBit(), 'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')), 'machine=' . php_uname('m') ); if (...
php
public static function getValue($sdkName, $sdkVersion) { $featureList = array( 'platform-ver=' . PHP_VERSION, 'bit=' . self::_getPHPBit(), 'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')), 'machine=' . php_uname('m') ); if (...
[ "public", "static", "function", "getValue", "(", "$", "sdkName", ",", "$", "sdkVersion", ")", "{", "$", "featureList", "=", "array", "(", "'platform-ver='", ".", "PHP_VERSION", ",", "'bit='", ".", "self", "::", "_getPHPBit", "(", ")", ",", "'os='", ".", ...
Returns the value of the User-Agent header Add environment values and php version numbers @param string $sdkName @param string $sdkVersion @return string
[ "Returns", "the", "value", "of", "the", "User", "-", "Agent", "header", "Add", "environment", "values", "and", "php", "version", "numbers" ]
train
https://github.com/SteeinRu/steein-sdk-php/blob/27113624a6582d27bb55d7c9724e8306739ef167/src/Steein/SDK/Core/SteeinUserAgent.php#L27-L44
waiter-coders/core
src/DB/Database.php
Database.transaction
public static function transaction(callable $method, $name = null) { try { self::connection($name)->beginTransaction(); $result = $method(); self::connection($name)->commit(); return $result; } catch (\Exception $exception) { self::connecti...
php
public static function transaction(callable $method, $name = null) { try { self::connection($name)->beginTransaction(); $result = $method(); self::connection($name)->commit(); return $result; } catch (\Exception $exception) { self::connecti...
[ "public", "static", "function", "transaction", "(", "callable", "$", "method", ",", "$", "name", "=", "null", ")", "{", "try", "{", "self", "::", "connection", "(", "$", "name", ")", "->", "beginTransaction", "(", ")", ";", "$", "result", "=", "$", "...
绑定事务区域
[ "绑定事务区域" ]
train
https://github.com/waiter-coders/core/blob/6850fe73edede9564f29c42d78fa49c6866368ae/src/DB/Database.php#L74-L85
azhai/code-refactor
src/CodeRefactor/Visitor/LoadModelVisitor.php
LoadModelVisitor.checkModelName
public function checkModelName(array $args) { $arg1 = self::getExprAttr($args[0], 'value', 'value'); if ($arg1 && is_string($arg1)) { $model = ['path' => null, 'name' => $arg1]; if ($pos = strrpos($arg1, '/')) { $model['path'] = substr($arg1, 0, $pos); ...
php
public function checkModelName(array $args) { $arg1 = self::getExprAttr($args[0], 'value', 'value'); if ($arg1 && is_string($arg1)) { $model = ['path' => null, 'name' => $arg1]; if ($pos = strrpos($arg1, '/')) { $model['path'] = substr($arg1, 0, $pos); ...
[ "public", "function", "checkModelName", "(", "array", "$", "args", ")", "{", "$", "arg1", "=", "self", "::", "getExprAttr", "(", "$", "args", "[", "0", "]", ",", "'value'", ",", "'value'", ")", ";", "if", "(", "$", "arg1", "&&", "is_string", "(", "...
检查第一个参数是否字符串,并记录它
[ "检查第一个参数是否字符串,并记录它" ]
train
https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/Visitor/LoadModelVisitor.php#L36-L48
azhai/code-refactor
src/CodeRefactor/Visitor/LoadModelVisitor.php
LoadModelVisitor.checkMethodArgs
public function checkMethodArgs(array $args) { $values = []; foreach ($args as $arg) { $value = $arg->value; $type = $value->getType(); if ('Expr_ConstFetch' === $type) { $value->summary = $value->name; } elseif ('Expr_PropertyFetch' ==...
php
public function checkMethodArgs(array $args) { $values = []; foreach ($args as $arg) { $value = $arg->value; $type = $value->getType(); if ('Expr_ConstFetch' === $type) { $value->summary = $value->name; } elseif ('Expr_PropertyFetch' ==...
[ "public", "function", "checkMethodArgs", "(", "array", "$", "args", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "$", "value", "=", "$", "arg", "->", "value", ";", "$", "type", "=", "$", ...
收集方法的参数
[ "收集方法的参数" ]
train
https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/Visitor/LoadModelVisitor.php#L53-L76
azhai/code-refactor
src/CodeRefactor/Visitor/LoadModelVisitor.php
LoadModelVisitor.ftExprLoadModel
public function ftExprLoadModel($node) { $name = self::getExprAttr($node, 'name'); $var_name = self::getExprAttr($node, 'var', 'name'); if ('model' === $name && 'load' === $var_name) { if (count($node->args) >= 1) { return $this->checkModelName($node->args); ...
php
public function ftExprLoadModel($node) { $name = self::getExprAttr($node, 'name'); $var_name = self::getExprAttr($node, 'var', 'name'); if ('model' === $name && 'load' === $var_name) { if (count($node->args) >= 1) { return $this->checkModelName($node->args); ...
[ "public", "function", "ftExprLoadModel", "(", "$", "node", ")", "{", "$", "name", "=", "self", "::", "getExprAttr", "(", "$", "node", ",", "'name'", ")", ";", "$", "var_name", "=", "self", "::", "getExprAttr", "(", "$", "node", ",", "'var'", ",", "'n...
MethodCall是否符合条件
[ "MethodCall是否符合条件" ]
train
https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/Visitor/LoadModelVisitor.php#L81-L90
azhai/code-refactor
src/CodeRefactor/Visitor/LoadModelVisitor.php
LoadModelVisitor.cbExprLoadModel
public function cbExprLoadModel($node, $ft_result) { //修改Model类名首字母大写 $file = ucfirst($ft_result['name']); if (isset($ft_result['path']) && $ft_result['path']) { $file = $ft_result['path'] . '/' . $file; } $node->args[0]->value->value = $file; //如果没有别名,使用全...
php
public function cbExprLoadModel($node, $ft_result) { //修改Model类名首字母大写 $file = ucfirst($ft_result['name']); if (isset($ft_result['path']) && $ft_result['path']) { $file = $ft_result['path'] . '/' . $file; } $node->args[0]->value->value = $file; //如果没有别名,使用全...
[ "public", "function", "cbExprLoadModel", "(", "$", "node", ",", "$", "ft_result", ")", "{", "//修改Model类名首字母大写", "$", "file", "=", "ucfirst", "(", "$", "ft_result", "[", "'name'", "]", ")", ";", "if", "(", "isset", "(", "$", "ft_result", "[", "'path'", ...
Model类名首字母大写,没有别名的使用全小写作为别名
[ "Model类名首字母大写,没有别名的使用全小写作为别名" ]
train
https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/Visitor/LoadModelVisitor.php#L95-L109
kaiohken1982/NeobazaarDocumentModule
src/Document/Utils/AbstractImage.php
AbstractImage.isYearMonthStrategy
public function isYearMonthStrategy(Document $doc = null, $prefix = '150_') { $datePart = $doc->getDateInsert()->format('\up\s/Y/m/'); return file_exists($this->cdnPath . $datePart . $prefix . $doc->getTitle()); }
php
public function isYearMonthStrategy(Document $doc = null, $prefix = '150_') { $datePart = $doc->getDateInsert()->format('\up\s/Y/m/'); return file_exists($this->cdnPath . $datePart . $prefix . $doc->getTitle()); }
[ "public", "function", "isYearMonthStrategy", "(", "Document", "$", "doc", "=", "null", ",", "$", "prefix", "=", "'150_'", ")", "{", "$", "datePart", "=", "$", "doc", "->", "getDateInsert", "(", ")", "->", "format", "(", "'\\up\\s/Y/m/'", ")", ";", "retur...
Check using Year/Month strategy
[ "Check", "using", "Year", "/", "Month", "strategy" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Utils/AbstractImage.php#L21-L25
kaiohken1982/NeobazaarDocumentModule
src/Document/Utils/AbstractImage.php
AbstractImage.isNoDateStrategy
public function isNoDateStrategy(Document $doc = null, $prefix = '150_') { $prefix = 'ups/'; return file_exists($this->cdnPath . $prefix . $doc->getTitle()); }
php
public function isNoDateStrategy(Document $doc = null, $prefix = '150_') { $prefix = 'ups/'; return file_exists($this->cdnPath . $prefix . $doc->getTitle()); }
[ "public", "function", "isNoDateStrategy", "(", "Document", "$", "doc", "=", "null", ",", "$", "prefix", "=", "'150_'", ")", "{", "$", "prefix", "=", "'ups/'", ";", "return", "file_exists", "(", "$", "this", "->", "cdnPath", ".", "$", "prefix", ".", "$"...
Check using no date strategy
[ "Check", "using", "no", "date", "strategy" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Utils/AbstractImage.php#L39-L43
TeknooSoftware/east-foundation
src/symfony/Router/Router.php
Router.matchRequest
private function matchRequest(ServerRequestInterface $request): ?callable { try { $parameters = $this->matcher->match( $this->cleanSymfonyHandler($request->getUri()->getPath()) ); } catch (ResourceNotFoundException $e) { /* Do nothing, keep the fra...
php
private function matchRequest(ServerRequestInterface $request): ?callable { try { $parameters = $this->matcher->match( $this->cleanSymfonyHandler($request->getUri()->getPath()) ); } catch (ResourceNotFoundException $e) { /* Do nothing, keep the fra...
[ "private", "function", "matchRequest", "(", "ServerRequestInterface", "$", "request", ")", ":", "?", "callable", "{", "try", "{", "$", "parameters", "=", "$", "this", "->", "matcher", "->", "match", "(", "$", "this", "->", "cleanSymfonyHandler", "(", "$", ...
Method to find the controller to call for this method via the Symfony Matcher. Return only controller as service (callable provided by the Symfony matcher), ignore other. @param ServerRequestInterface $request @return callable
[ "Method", "to", "find", "the", "controller", "to", "call", "for", "this", "method", "via", "the", "Symfony", "Matcher", ".", "Return", "only", "controller", "as", "service", "(", "callable", "provided", "by", "the", "Symfony", "matcher", ")", "ignore", "othe...
train
https://github.com/TeknooSoftware/east-foundation/blob/45ca97c83ba08b973877a472c731f27ca1e82cdf/src/symfony/Router/Router.php#L104-L140
TeknooSoftware/east-foundation
src/symfony/Router/Router.php
Router.execute
public function execute( ClientInterface $client, ServerRequestInterface $request, ManagerInterface $manager ): MiddlewareInterface { $controller = $this->matchRequest($request); if (\is_callable($controller)) { $result = new Result($controller); $ma...
php
public function execute( ClientInterface $client, ServerRequestInterface $request, ManagerInterface $manager ): MiddlewareInterface { $controller = $this->matchRequest($request); if (\is_callable($controller)) { $result = new Result($controller); $ma...
[ "public", "function", "execute", "(", "ClientInterface", "$", "client", ",", "ServerRequestInterface", "$", "request", ",", "ManagerInterface", "$", "manager", ")", ":", "MiddlewareInterface", "{", "$", "controller", "=", "$", "this", "->", "matchRequest", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/TeknooSoftware/east-foundation/blob/45ca97c83ba08b973877a472c731f27ca1e82cdf/src/symfony/Router/Router.php#L145-L160
scaleplan/event
src/EventDispatcher.php
EventDispatcher.eventClassCheck
protected static function eventClassCheck(string $className) : void { if (!class_exists($className) || !is_subclass_of($className, EventInterface::class)) { throw new ClassNotImplementsEventInterfaceException($className); } }
php
protected static function eventClassCheck(string $className) : void { if (!class_exists($className) || !is_subclass_of($className, EventInterface::class)) { throw new ClassNotImplementsEventInterfaceException($className); } }
[ "protected", "static", "function", "eventClassCheck", "(", "string", "$", "className", ")", ":", "void", "{", "if", "(", "!", "class_exists", "(", "$", "className", ")", "||", "!", "is_subclass_of", "(", "$", "className", ",", "EventInterface", "::", "class"...
@param string $className @throws ClassNotImplementsEventInterfaceException
[ "@param", "string", "$className" ]
train
https://github.com/scaleplan/event/blob/248aa456e41c8a7949dd3b6be9bfe3dc108f5915/src/EventDispatcher.php#L33-L38
scaleplan/event
src/EventDispatcher.php
EventDispatcher.dispatch
public static function dispatch(string $className, object $object = null) : void { /** @var EventInterface $className */ static::eventClassCheck($className); $className::dispatch($object); }
php
public static function dispatch(string $className, object $object = null) : void { /** @var EventInterface $className */ static::eventClassCheck($className); $className::dispatch($object); }
[ "public", "static", "function", "dispatch", "(", "string", "$", "className", ",", "object", "$", "object", "=", "null", ")", ":", "void", "{", "/** @var EventInterface $className */", "static", "::", "eventClassCheck", "(", "$", "className", ")", ";", "$", "cl...
@param string $className @param object|null $object @throws ClassNotImplementsEventInterfaceException
[ "@param", "string", "$className", "@param", "object|null", "$object" ]
train
https://github.com/scaleplan/event/blob/248aa456e41c8a7949dd3b6be9bfe3dc108f5915/src/EventDispatcher.php#L46-L51
FuzeWorks/Core
src/FuzeWorks/Config.php
Config.getConfig
public function getConfig($configName, array $configPaths = array()): ConfigORM { // First determine what directories to use $directories = (empty($configPaths) ? $this->configPaths : $configPaths); // Determine the config name $configName = strtolower($configName); ...
php
public function getConfig($configName, array $configPaths = array()): ConfigORM { // First determine what directories to use $directories = (empty($configPaths) ? $this->configPaths : $configPaths); // Determine the config name $configName = strtolower($configName); ...
[ "public", "function", "getConfig", "(", "$", "configName", ",", "array", "$", "configPaths", "=", "array", "(", ")", ")", ":", "ConfigORM", "{", "// First determine what directories to use", "$", "directories", "=", "(", "empty", "(", "$", "configPaths", ")", ...
Retrieve a config file object @param string $configName Name of the config file. Eg. 'main' @param array $configPaths Optional array of where to look for the config files @return ConfigORM of the config file. Allows for easy reading and editing of the file @throws ConfigException
[ "Retrieve", "a", "config", "file", "object" ]
train
https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L78-L95
FuzeWorks/Core
src/FuzeWorks/Config.php
Config.loadConfigFile
protected function loadConfigFile($configName, array $configPaths): ConfigORM { // Cycle through all directories foreach ($configPaths as $directory) { // If file exists, load it and break the loop $file = $directory . DS . 'config.'.$configName.'.php'; i...
php
protected function loadConfigFile($configName, array $configPaths): ConfigORM { // Cycle through all directories foreach ($configPaths as $directory) { // If file exists, load it and break the loop $file = $directory . DS . 'config.'.$configName.'.php'; i...
[ "protected", "function", "loadConfigFile", "(", "$", "configName", ",", "array", "$", "configPaths", ")", ":", "ConfigORM", "{", "// Cycle through all directories", "foreach", "(", "$", "configPaths", "as", "$", "directory", ")", "{", "// If file exists, load it and b...
Determine whether the file exists and, if so, load the ConfigORM @param string $configName Name of the config file. Eg. 'main' @param array $configPaths Required array of where to look for the config files @return ConfigORM of the config file. Allows for easy reading and editing of the file @throws ConfigException
[ "Determine", "whether", "the", "file", "exists", "and", "if", "so", "load", "the", "ConfigORM" ]
train
https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L123-L147
FuzeWorks/Core
src/FuzeWorks/Config.php
Config.removeConfigPath
public function removeConfigPath($directory) { if (($key = array_search($directory, $this->configPaths)) !== false) { unset($this->configPaths[$key]); } }
php
public function removeConfigPath($directory) { if (($key = array_search($directory, $this->configPaths)) !== false) { unset($this->configPaths[$key]); } }
[ "public", "function", "removeConfigPath", "(", "$", "directory", ")", "{", "if", "(", "(", "$", "key", "=", "array_search", "(", "$", "directory", ",", "$", "this", "->", "configPaths", ")", ")", "!==", "false", ")", "{", "unset", "(", "$", "this", "...
Remove a path where config files can be found @param string $directory The directory @return void
[ "Remove", "a", "path", "where", "config", "files", "can", "be", "found" ]
train
https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L169-L175
nguyenanhung/requests
src/GetContents.php
GetContents.getContent
public function getContent() { try { if ($this->response) { if (isset($this->response['content'])) { return $this->response['content']; } else { return $this->response; } } } catch...
php
public function getContent() { try { if ($this->response) { if (isset($this->response['content'])) { return $this->response['content']; } else { return $this->response; } } } catch...
[ "public", "function", "getContent", "(", ")", "{", "try", "{", "if", "(", "$", "this", "->", "response", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "response", "[", "'content'", "]", ")", ")", "{", "return", "$", "this", "->", "response"...
Function getContent - Get Body Content from Request @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:08 @return array|mixed|string Return Response content if exists Full Response content if $this->response['content'] not exists Exception Error Message if Exception Error Null if Not
[ "Function", "getContent", "-", "Get", "Body", "Content", "from", "Request" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L249-L268
nguyenanhung/requests
src/GetContents.php
GetContents.sendRequest
public function sendRequest() { try { if (mb_strlen($this->url) >= 9) { $response = $this->useFileGetContents(); $this->response = $response; return $response; } } catch (Exception $e) { $message = "Er...
php
public function sendRequest() { try { if (mb_strlen($this->url) >= 9) { $response = $this->useFileGetContents(); $this->response = $response; return $response; } } catch (Exception $e) { $message = "Er...
[ "public", "function", "sendRequest", "(", ")", "{", "try", "{", "if", "(", "mb_strlen", "(", "$", "this", "->", "url", ")", ">=", "9", ")", "{", "$", "response", "=", "$", "this", "->", "useFileGetContents", "(", ")", ";", "$", "this", "->", "respo...
Let's go to Request @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:12 @return array|null|string Response from Request if Exists Exception Error Message if Exception Error Null if Not
[ "Let", "s", "go", "to", "Request" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L329-L347
nguyenanhung/requests
src/GetContents.php
GetContents.useFileGetContents
public function useFileGetContents() { $return = []; $options = [ 'http' => [ 'method' => $this->method, 'timeout' => $this->timeout ] ]; if ($this->isSSL) { // use SSL $options['ssl'] = [ ...
php
public function useFileGetContents() { $return = []; $options = [ 'http' => [ 'method' => $this->method, 'timeout' => $this->timeout ] ]; if ($this->isSSL) { // use SSL $options['ssl'] = [ ...
[ "public", "function", "useFileGetContents", "(", ")", "{", "$", "return", "=", "[", "]", ";", "$", "options", "=", "[", "'http'", "=>", "[", "'method'", "=>", "$", "this", "->", "method", ",", "'timeout'", "=>", "$", "this", "->", "timeout", "]", "]"...
Function useFileGetContents Use file_get_contents to perform the request @return array The server response array @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:19
[ "Function", "useFileGetContents", "Use", "file_get_contents", "to", "perform", "the", "request" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L358-L447
nguyenanhung/requests
src/GetContents.php
GetContents.getHeaderArray
public function getHeaderArray() { $headerArray = (count($this->headers) > 0 ? $this->headers : []); if ($this->isJson) { $headerArray[] = 'Accept: application/json'; } if ($this->isXML) { $headerArray[] = 'Accept: text/xml'; } if ($this->metho...
php
public function getHeaderArray() { $headerArray = (count($this->headers) > 0 ? $this->headers : []); if ($this->isJson) { $headerArray[] = 'Accept: application/json'; } if ($this->isXML) { $headerArray[] = 'Accept: text/xml'; } if ($this->metho...
[ "public", "function", "getHeaderArray", "(", ")", "{", "$", "headerArray", "=", "(", "count", "(", "$", "this", "->", "headers", ")", ">", "0", "?", "$", "this", "->", "headers", ":", "[", "]", ")", ";", "if", "(", "$", "this", "->", "isJson", ")...
Generate the complete header array Merges the supplied (if any) headers with those needed by the request. @return array An array of headers @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:19
[ "Generate", "the", "complete", "header", "array", "Merges", "the", "supplied", "(", "if", "any", ")", "headers", "with", "those", "needed", "by", "the", "request", "." ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L459-L487
nguyenanhung/requests
src/GetContents.php
GetContents.getPostBody
public function getPostBody() { $output = ''; if ($this->isJson) { $jsonPretty = ($this->isJsonPretty ? JSON_PRETTY_PRINT : NULL); if (count($this->data) > 0) { $output = json_encode($this->data, $jsonPretty); } } elseif ($this->isXML) { ...
php
public function getPostBody() { $output = ''; if ($this->isJson) { $jsonPretty = ($this->isJsonPretty ? JSON_PRETTY_PRINT : NULL); if (count($this->data) > 0) { $output = json_encode($this->data, $jsonPretty); } } elseif ($this->isXML) { ...
[ "public", "function", "getPostBody", "(", ")", "{", "$", "output", "=", "''", ";", "if", "(", "$", "this", "->", "isJson", ")", "{", "$", "jsonPretty", "=", "(", "$", "this", "->", "isJsonPretty", "?", "JSON_PRETTY_PRINT", ":", "NULL", ")", ";", "if"...
Get the post body - either JSON encoded or ready to be sent as a form post @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:19 @return array|false|string Data to be sent Request
[ "Get", "the", "post", "body", "-", "either", "JSON", "encoded", "or", "ready", "to", "be", "sent", "as", "a", "form", "post" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L497-L512
nguyenanhung/requests
src/GetContents.php
GetContents.getQueryString
public function getQueryString() { $query_string = ''; if (count($this->query_string) > 0) { $query_string .= http_build_query($this->query_string); } if ($this->method != 'POST') { if (count($this->data) > 0) { $query_string .= http_build_quer...
php
public function getQueryString() { $query_string = ''; if (count($this->query_string) > 0) { $query_string .= http_build_query($this->query_string); } if ($this->method != 'POST') { if (count($this->data) > 0) { $query_string .= http_build_quer...
[ "public", "function", "getQueryString", "(", ")", "{", "$", "query_string", "=", "''", ";", "if", "(", "count", "(", "$", "this", "->", "query_string", ")", ">", "0", ")", "{", "$", "query_string", ".=", "http_build_query", "(", "$", "this", "->", "que...
Get the query string by merging any supplied string with that of the generated components. @return string The query string @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:19
[ "Get", "the", "query", "string", "by", "merging", "any", "supplied", "string", "with", "that", "of", "the", "generated", "components", "." ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L523-L539
nguyenanhung/requests
src/GetContents.php
GetContents.setURL
public function setURL($url = '') { try { if (mb_strlen($url) > 0) { if (substr($url, 0, 8) == 'https://') { $this->isSSL = TRUE; $this->debug->debug(__FUNCTION__, 'Set SSL: ' . $this->isSSL); } elseif (substr($url, 0, 7) ==...
php
public function setURL($url = '') { try { if (mb_strlen($url) > 0) { if (substr($url, 0, 8) == 'https://') { $this->isSSL = TRUE; $this->debug->debug(__FUNCTION__, 'Set SSL: ' . $this->isSSL); } elseif (substr($url, 0, 7) ==...
[ "public", "function", "setURL", "(", "$", "url", "=", "''", ")", "{", "try", "{", "if", "(", "mb_strlen", "(", "$", "url", ")", ">", "0", ")", "{", "if", "(", "substr", "(", "$", "url", ",", "0", ",", "8", ")", "==", "'https://'", ")", "{", ...
Set the target URL Must include http:// or https:// @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:10 @param string $url @return string
[ "Set", "the", "target", "URL", "Must", "include", "http", ":", "//", "or", "https", ":", "//" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L552-L576
nguyenanhung/requests
src/GetContents.php
GetContents.setMethod
public function setMethod($method = '') { if (mb_strlen($method) == 0) { $this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist'); $method = 'GET'; } else { $method = strtoupper($method); $validMethods = [ ...
php
public function setMethod($method = '') { if (mb_strlen($method) == 0) { $this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist'); $method = 'GET'; } else { $method = strtoupper($method); $validMethods = [ ...
[ "public", "function", "setMethod", "(", "$", "method", "=", "''", ")", "{", "if", "(", "mb_strlen", "(", "$", "method", ")", "==", "0", ")", "{", "$", "this", "->", "debug", "->", "debug", "(", "__FUNCTION__", ",", "'Set Default Method = GET if $method is ...
Set the HTTP method GET, HEAD, PUT, POST are valid @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:15 @param string $method Method to Request GET, HEAD, PUT, POST are valid @return $this|string Method
[ "Set", "the", "HTTP", "method", "GET", "HEAD", "PUT", "POST", "are", "valid" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L589-L613
nguyenanhung/requests
src/GetContents.php
GetContents.setData
public function setData($data = []) { if (!is_array($data) && is_string($data)) { $data = parse_str($data); } if (count($data) == 0) { $this->data = []; } else { $this->data = $data; } $this->debug->debug(__FUNCTION__, 'Data into Re...
php
public function setData($data = []) { if (!is_array($data) && is_string($data)) { $data = parse_str($data); } if (count($data) == 0) { $this->data = []; } else { $this->data = $data; } $this->debug->debug(__FUNCTION__, 'Data into Re...
[ "public", "function", "setData", "(", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "data", ")", "&&", "is_string", "(", "$", "data", ")", ")", "{", "$", "data", "=", "parse_str", "(", "$", "data", ")", ";", "}", ...
Set Data contents Must be supplied as an array @param array $data The contents to be sent to the target URL @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:18
[ "Set", "Data", "contents", "Must", "be", "supplied", "as", "an", "array" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L624-L635
nguyenanhung/requests
src/GetContents.php
GetContents.setQueryString
public function setQueryString($query_string = []) { if (!is_array($query_string) && is_string($query_string)) { $query_string = parse_str($query_string); } if (count($query_string) == 0) { $this->query_string = []; } else { $this->query_string = $...
php
public function setQueryString($query_string = []) { if (!is_array($query_string) && is_string($query_string)) { $query_string = parse_str($query_string); } if (count($query_string) == 0) { $this->query_string = []; } else { $this->query_string = $...
[ "public", "function", "setQueryString", "(", "$", "query_string", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "query_string", ")", "&&", "is_string", "(", "$", "query_string", ")", ")", "{", "$", "query_string", "=", "parse_str", "(", ...
Set query string data Must be supplied as an array @param array $query_string The query string to be sent to the target URL @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 01:36
[ "Set", "query", "string", "data", "Must", "be", "supplied", "as", "an", "array" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L646-L656
nguyenanhung/requests
src/GetContents.php
GetContents.setCookies
public function setCookies($cookies = []) { if (!is_array($cookies)) { $this->cookies = []; } else { $this->cookies = $cookies; $this->trackCookies = TRUE; } }
php
public function setCookies($cookies = []) { if (!is_array($cookies)) { $this->cookies = []; } else { $this->cookies = $cookies; $this->trackCookies = TRUE; } }
[ "public", "function", "setCookies", "(", "$", "cookies", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "cookies", ")", ")", "{", "$", "this", "->", "cookies", "=", "[", "]", ";", "}", "else", "{", "$", "this", "->", "cookies", ...
Set any cookies to be included in the headers Must be supplied as an array @param array $cookies The array of cookies to be sent @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:18
[ "Set", "any", "cookies", "to", "be", "included", "in", "the", "headers", "Must", "be", "supplied", "as", "an", "array" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L685-L693
nguyenanhung/requests
src/GetContents.php
GetContents.setTrackCookies
public function setTrackCookies($value = FALSE) { if (!$value) { $this->trackCookies = FALSE; } else { $this->trackCookies = TRUE; } }
php
public function setTrackCookies($value = FALSE) { if (!$value) { $this->trackCookies = FALSE; } else { $this->trackCookies = TRUE; } }
[ "public", "function", "setTrackCookies", "(", "$", "value", "=", "FALSE", ")", "{", "if", "(", "!", "$", "value", ")", "{", "$", "this", "->", "trackCookies", "=", "FALSE", ";", "}", "else", "{", "$", "this", "->", "trackCookies", "=", "TRUE", ";", ...
Should cookies be tracked? @param boolean $value true to track cookies @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:18
[ "Should", "cookies", "be", "tracked?" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L703-L710
nguyenanhung/requests
src/GetContents.php
GetContents.setXML
public function setXML($value = FALSE) { if (!$value) { $this->isXML = FALSE; } else { $this->isXML = TRUE; } }
php
public function setXML($value = FALSE) { if (!$value) { $this->isXML = FALSE; } else { $this->isXML = TRUE; } }
[ "public", "function", "setXML", "(", "$", "value", "=", "FALSE", ")", "{", "if", "(", "!", "$", "value", ")", "{", "$", "this", "->", "isXML", "=", "FALSE", ";", "}", "else", "{", "$", "this", "->", "isXML", "=", "TRUE", ";", "}", "}" ]
Function setXML - Is this transaction sending / expecting XML @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 01:38 @param bool $value true if XML is being used and is expected
[ "Function", "setXML", "-", "Is", "this", "transaction", "sending", "/", "expecting", "XML" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L720-L727
nguyenanhung/requests
src/GetContents.php
GetContents.setJson
public function setJson($value = FALSE) { if (!$value) { $this->isJson = FALSE; } else { $this->isJson = TRUE; } }
php
public function setJson($value = FALSE) { if (!$value) { $this->isJson = FALSE; } else { $this->isJson = TRUE; } }
[ "public", "function", "setJson", "(", "$", "value", "=", "FALSE", ")", "{", "if", "(", "!", "$", "value", ")", "{", "$", "this", "->", "isJson", "=", "FALSE", ";", "}", "else", "{", "$", "this", "->", "isJson", "=", "TRUE", ";", "}", "}" ]
Is this transaction sending / expecting JSON @param boolean $value true if JSON is being used and is expected @author: 713uk13m <dev@nguyenanhung.com> @time : 10/7/18 02:17
[ "Is", "this", "transaction", "sending", "/", "expecting", "JSON" ]
train
https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L737-L744