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
shopware/platform
src/Core/Framework/Filesystem/AbstractFilesystem.php
AbstractFilesystem.readAndDelete
public function readAndDelete($path) { $path = $this->preparePath($path); return $this->filesystem->readAndDelete($path); }
php
public function readAndDelete($path) { $path = $this->preparePath($path); return $this->filesystem->readAndDelete($path); }
[ "public", "function", "readAndDelete", "(", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "preparePath", "(", "$", "path", ")", ";", "return", "$", "this", "->", "filesystem", "->", "readAndDelete", "(", "$", "path", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Filesystem/AbstractFilesystem.php#L251-L256
shopware/platform
src/Core/Framework/Filesystem/AbstractFilesystem.php
AbstractFilesystem.get
public function get($path, ?Handler $handler = null): Handler { $path = $this->preparePath($path); return $this->filesystem->get($path, $handler); }
php
public function get($path, ?Handler $handler = null): Handler { $path = $this->preparePath($path); return $this->filesystem->get($path, $handler); }
[ "public", "function", "get", "(", "$", "path", ",", "?", "Handler", "$", "handler", "=", "null", ")", ":", "Handler", "{", "$", "path", "=", "$", "this", "->", "preparePath", "(", "$", "path", ")", ";", "return", "$", "this", "->", "filesystem", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Filesystem/AbstractFilesystem.php#L261-L266
shopware/platform
src/Administration/Command/AdministrationDumpBundlesCommand.php
AdministrationDumpBundlesCommand.getPathRelativeToProjectDir
private function getPathRelativeToProjectDir(string $absolute): string { $projectDir = $this->kernel->getProjectDir(); $relative = str_replace($projectDir, '', $absolute); $relative = ltrim($relative, '/'); return $relative; }
php
private function getPathRelativeToProjectDir(string $absolute): string { $projectDir = $this->kernel->getProjectDir(); $relative = str_replace($projectDir, '', $absolute); $relative = ltrim($relative, '/'); return $relative; }
[ "private", "function", "getPathRelativeToProjectDir", "(", "string", "$", "absolute", ")", ":", "string", "{", "$", "projectDir", "=", "$", "this", "->", "kernel", "->", "getProjectDir", "(", ")", ";", "$", "relative", "=", "str_replace", "(", "$", "projectD...
return a path relative to the project dir
[ "return", "a", "path", "relative", "to", "the", "project", "dir" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Administration/Command/AdministrationDumpBundlesCommand.php#L100-L107
shopware/platform
src/Core/Content/Category/Service/NavigationLoader.php
NavigationLoader.load
public function load(string $activeId, SalesChannelContext $context): ?Tree { /** @var CategoryEntity $active */ $active = $this->loadActive($activeId, $context); $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('visible', true)); /** @var CategoryCollectio...
php
public function load(string $activeId, SalesChannelContext $context): ?Tree { /** @var CategoryEntity $active */ $active = $this->loadActive($activeId, $context); $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('visible', true)); /** @var CategoryCollectio...
[ "public", "function", "load", "(", "string", "$", "activeId", ",", "SalesChannelContext", "$", "context", ")", ":", "?", "Tree", "{", "/** @var CategoryEntity $active */", "$", "active", "=", "$", "this", "->", "loadActive", "(", "$", "activeId", ",", "$", "...
Returns the full category tree. The provided active id will be marked as selected
[ "Returns", "the", "full", "category", "tree", ".", "The", "provided", "active", "id", "will", "be", "marked", "as", "selected" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Category/Service/NavigationLoader.php#L39-L52
shopware/platform
src/Core/Content/Category/Service/NavigationLoader.php
NavigationLoader.loadLevel
public function loadLevel(string $categoryId, SalesChannelContext $context): ?Tree { /** @var CategoryEntity $active */ $active = $this->loadActive($categoryId, $context); $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('visible', true)); $criteria->addFilt...
php
public function loadLevel(string $categoryId, SalesChannelContext $context): ?Tree { /** @var CategoryEntity $active */ $active = $this->loadActive($categoryId, $context); $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('visible', true)); $criteria->addFilt...
[ "public", "function", "loadLevel", "(", "string", "$", "categoryId", ",", "SalesChannelContext", "$", "context", ")", ":", "?", "Tree", "{", "/** @var CategoryEntity $active */", "$", "active", "=", "$", "this", "->", "loadActive", "(", "$", "categoryId", ",", ...
Returns the category tree level for the provided category id. @throws InconsistentCriteriaIdsException
[ "Returns", "the", "category", "tree", "level", "for", "the", "provided", "category", "id", "." ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Category/Service/NavigationLoader.php#L59-L79
shopware/platform
src/Core/Content/Category/Service/NavigationLoader.php
NavigationLoader.buildTree
private function buildTree(?string $parentId, array $categories): array { $mapped = []; foreach ($categories as $key => $category) { if ($category->getParentId() !== $parentId) { continue; } unset($categories[$key]); $item = clone $th...
php
private function buildTree(?string $parentId, array $categories): array { $mapped = []; foreach ($categories as $key => $category) { if ($category->getParentId() !== $parentId) { continue; } unset($categories[$key]); $item = clone $th...
[ "private", "function", "buildTree", "(", "?", "string", "$", "parentId", ",", "array", "$", "categories", ")", ":", "array", "{", "$", "mapped", "=", "[", "]", ";", "foreach", "(", "$", "categories", "as", "$", "key", "=>", "$", "category", ")", "{",...
@param CategoryEntity[] $categories @return TreeItem[]
[ "@param", "CategoryEntity", "[]", "$categories" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Category/Service/NavigationLoader.php#L114-L134
shopware/platform
src/Core/Framework/Translation/Translator.php
Translator.getCatalogue
public function getCatalogue($locale = null): MessageCatalogueInterface { $catalog = $this->translator->getCatalogue($locale); return $this->getCustomizedCatalog($catalog); }
php
public function getCatalogue($locale = null): MessageCatalogueInterface { $catalog = $this->translator->getCatalogue($locale); return $this->getCustomizedCatalog($catalog); }
[ "public", "function", "getCatalogue", "(", "$", "locale", "=", "null", ")", ":", "MessageCatalogueInterface", "{", "$", "catalog", "=", "$", "this", "->", "translator", "->", "getCatalogue", "(", "$", "locale", ")", ";", "return", "$", "this", "->", "getCu...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Translation/Translator.php#L69-L74
shopware/platform
src/Core/Framework/Translation/Translator.php
Translator.trans
public function trans($id, array $parameters = [], $domain = null, $locale = null): string { if ($domain === null) { $domain = 'messages'; } return $this->formatter->format($this->getCatalogue($locale)->get($id, $domain), $locale, $parameters); }
php
public function trans($id, array $parameters = [], $domain = null, $locale = null): string { if ($domain === null) { $domain = 'messages'; } return $this->formatter->format($this->getCatalogue($locale)->get($id, $domain), $locale, $parameters); }
[ "public", "function", "trans", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "domain", "=", "null", ",", "$", "locale", "=", "null", ")", ":", "string", "{", "if", "(", "$", "domain", "===", "null", ")", "{", "$", "d...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Translation/Translator.php#L79-L86
shopware/platform
src/Core/Framework/Translation/Translator.php
Translator.getCustomizedCatalog
private function getCustomizedCatalog(MessageCatalogueInterface $catalog): MessageCatalogueInterface { $request = $this->requestStack->getMasterRequest(); if (!$request) { return $catalog; } $snippetSetId = $request->attributes->get(SalesChannelRequest::ATTRIBUTE_DOMAIN_...
php
private function getCustomizedCatalog(MessageCatalogueInterface $catalog): MessageCatalogueInterface { $request = $this->requestStack->getMasterRequest(); if (!$request) { return $catalog; } $snippetSetId = $request->attributes->get(SalesChannelRequest::ATTRIBUTE_DOMAIN_...
[ "private", "function", "getCustomizedCatalog", "(", "MessageCatalogueInterface", "$", "catalog", ")", ":", "MessageCatalogueInterface", "{", "$", "request", "=", "$", "this", "->", "requestStack", "->", "getMasterRequest", "(", ")", ";", "if", "(", "!", "$", "re...
Add language specific snippets provided by the admin
[ "Add", "language", "specific", "snippets", "provided", "by", "the", "admin" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Translation/Translator.php#L139-L169
shopware/platform
src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php
LineItemCollector.getLineItemsByDiscount
public function getLineItemsByDiscount(PromotionDiscountEntity $discount, Cart $cart, SalesChannelContext $context): array { /** @var array $nonPromotionLineItemsKeys */ $nonPromotionLineItemsKeys = $this->getNonPromotionLineItemsKeys($cart); if (count($nonPromotionLineItemsKeys) === 0) { ...
php
public function getLineItemsByDiscount(PromotionDiscountEntity $discount, Cart $cart, SalesChannelContext $context): array { /** @var array $nonPromotionLineItemsKeys */ $nonPromotionLineItemsKeys = $this->getNonPromotionLineItemsKeys($cart); if (count($nonPromotionLineItemsKeys) === 0) { ...
[ "public", "function", "getLineItemsByDiscount", "(", "PromotionDiscountEntity", "$", "discount", ",", "Cart", "$", "cart", ",", "SalesChannelContext", "$", "context", ")", ":", "array", "{", "/** @var array $nonPromotionLineItemsKeys */", "$", "nonPromotionLineItemsKeys", ...
returns all lineItem keys that match the rules of the promotion
[ "returns", "all", "lineItem", "keys", "that", "match", "the", "rules", "of", "the", "promotion" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php#L29-L65
shopware/platform
src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php
LineItemCollector.getNonPromotionLineItems
private function getNonPromotionLineItems(Cart $cart): array { $lineItems = array_filter( $cart->getLineItems()->getElements(), function (LineItem $lineItem) { return $lineItem->getType() !== $this->promotionLineItemPlaceholder; } ); retur...
php
private function getNonPromotionLineItems(Cart $cart): array { $lineItems = array_filter( $cart->getLineItems()->getElements(), function (LineItem $lineItem) { return $lineItem->getType() !== $this->promotionLineItemPlaceholder; } ); retur...
[ "private", "function", "getNonPromotionLineItems", "(", "Cart", "$", "cart", ")", ":", "array", "{", "$", "lineItems", "=", "array_filter", "(", "$", "cart", "->", "getLineItems", "(", ")", "->", "getElements", "(", ")", ",", "function", "(", "LineItem", "...
Gets all line items that are not of the provided type These can be used to iterate through all "standard" items.
[ "Gets", "all", "line", "items", "that", "are", "not", "of", "the", "provided", "type", "These", "can", "be", "used", "to", "iterate", "through", "all", "standard", "items", "." ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php#L89-L99
shopware/platform
src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php
LineItemCollector.getNonPromotionLineItemsKeys
private function getNonPromotionLineItemsKeys(Cart $cart): array { $lineItems = $this->getNonPromotionLineItems($cart); $lineItemKeys = []; /** @var LineItem $lineItem */ foreach ($lineItems as $lineItem) { $lineItemKeys[] = $lineItem->getKey(); } retur...
php
private function getNonPromotionLineItemsKeys(Cart $cart): array { $lineItems = $this->getNonPromotionLineItems($cart); $lineItemKeys = []; /** @var LineItem $lineItem */ foreach ($lineItems as $lineItem) { $lineItemKeys[] = $lineItem->getKey(); } retur...
[ "private", "function", "getNonPromotionLineItemsKeys", "(", "Cart", "$", "cart", ")", ":", "array", "{", "$", "lineItems", "=", "$", "this", "->", "getNonPromotionLineItems", "(", "$", "cart", ")", ";", "$", "lineItemKeys", "=", "[", "]", ";", "/** @var Line...
return all LineItem Keys that are no promotions
[ "return", "all", "LineItem", "Keys", "that", "are", "no", "promotions" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php#L104-L116
shopware/platform
src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php
LineItemCollector.doesRuleCollectionMatchsLineItem
private function doesRuleCollectionMatchsLineItem(RuleCollection $ruleCollection, LineItemScope $lineItemScope): bool { /** @var RuleEntity $discountRule */ foreach ($ruleCollection as $discountRule) { $ruleCondition = $discountRule->getPayload(); if (!$ruleCondition instanc...
php
private function doesRuleCollectionMatchsLineItem(RuleCollection $ruleCollection, LineItemScope $lineItemScope): bool { /** @var RuleEntity $discountRule */ foreach ($ruleCollection as $discountRule) { $ruleCondition = $discountRule->getPayload(); if (!$ruleCondition instanc...
[ "private", "function", "doesRuleCollectionMatchsLineItem", "(", "RuleCollection", "$", "ruleCollection", ",", "LineItemScope", "$", "lineItemScope", ")", ":", "bool", "{", "/** @var RuleEntity $discountRule */", "foreach", "(", "$", "ruleCollection", "as", "$", "discountR...
checks if a ruleCollection matches a lineItem. This function returns true if ONE rule in collection matches lineItem, otherwise returns false
[ "checks", "if", "a", "ruleCollection", "matches", "a", "lineItem", ".", "This", "function", "returns", "true", "if", "ONE", "rule", "in", "collection", "matches", "lineItem", "otherwise", "returns", "false" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/Cart/Collector/LineItemCollector.php#L122-L138
shopware/platform
src/Core/Framework/Plugin/Command/Lifecycle/PluginUninstallCommand.php
PluginUninstallCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $keepUserData = (bool) $input->getOpti...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $keepUserData = (bool) $input->getOpti...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "context", "=", "Context", "::", "creat...
{@inheritdoc} @throws PluginNotInstalledException
[ "{", "@inheritdoc", "}" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Command/Lifecycle/PluginUninstallCommand.php#L28-L54
shopware/platform
src/Core/Framework/Migration/MigrationStep.php
MigrationStep.addForwardTrigger
protected function addForwardTrigger(Connection $connection, string $name, string $table, string $time, string $event, string $statements): void { $this->addTrigger($connection, $name, $table, $time, $event, $statements, ''); }
php
protected function addForwardTrigger(Connection $connection, string $name, string $table, string $time, string $event, string $statements): void { $this->addTrigger($connection, $name, $table, $time, $event, $statements, ''); }
[ "protected", "function", "addForwardTrigger", "(", "Connection", "$", "connection", ",", "string", "$", "name", ",", "string", "$", "table", ",", "string", "$", "time", ",", "string", "$", "event", ",", "string", "$", "statements", ")", ":", "void", "{", ...
FORWARD triggers are executed when an old application has to work with a newer Database and has to keep it update-safe
[ "FORWARD", "triggers", "are", "executed", "when", "an", "old", "application", "has", "to", "work", "with", "a", "newer", "Database", "and", "has", "to", "keep", "it", "update", "-", "safe" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Migration/MigrationStep.php#L35-L38
shopware/platform
src/Core/Checkout/Promotion/PromotionEntity.php
PromotionEntity.getPreconditionRule
public function getPreconditionRule(): Rule { // we combine each topics with an AND and a OR inside of their rules. // so all topics have to match, and one topic needs at least 1 rule that matches. $requirements = new AndRule( [] ); $personasFound = false; ...
php
public function getPreconditionRule(): Rule { // we combine each topics with an AND and a OR inside of their rules. // so all topics have to match, and one topic needs at least 1 rule that matches. $requirements = new AndRule( [] ); $personasFound = false; ...
[ "public", "function", "getPreconditionRule", "(", ")", ":", "Rule", "{", "// we combine each topics with an AND and a OR inside of their rules.", "// so all topics have to match, and one topic needs at least 1 rule that matches.", "$", "requirements", "=", "new", "AndRule", "(", "[",...
Builds our aggregated precondition rule condition for this promotion. If this rule matches within all its sub conditions, then the whole promotion is allowed to be used.
[ "Builds", "our", "aggregated", "precondition", "rule", "condition", "for", "this", "promotion", ".", "If", "this", "rule", "matches", "within", "all", "its", "sub", "conditions", "then", "the", "whole", "promotion", "is", "allowed", "to", "be", "used", "." ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Promotion/PromotionEntity.php#L305-L383
shopware/platform
src/Core/Checkout/Cart/Order/Api/OrderConverterController.php
OrderConverterController.convertToCart
public function convertToCart(string $orderId, Context $context): JsonResponse { $deliveryCriteria = new Criteria(); $deliveryCriteria->addAssociation('positions'); $criteria = (new Criteria([$orderId])) ->addAssociation('lineItems') ->addAssociation('transactions') ...
php
public function convertToCart(string $orderId, Context $context): JsonResponse { $deliveryCriteria = new Criteria(); $deliveryCriteria->addAssociation('positions'); $criteria = (new Criteria([$orderId])) ->addAssociation('lineItems') ->addAssociation('transactions') ...
[ "public", "function", "convertToCart", "(", "string", "$", "orderId", ",", "Context", "$", "context", ")", ":", "JsonResponse", "{", "$", "deliveryCriteria", "=", "new", "Criteria", "(", ")", ";", "$", "deliveryCriteria", "->", "addAssociation", "(", "'positio...
@Route("/api/v{version}/_action/order/{orderId}/convert-to-cart/", name="api.action.order.convert-to-cart", methods={"POST"}) @throws InvalidPayloadException @throws InvalidQuantityException @throws LineItemNotStackableException @throws MixedLineItemTypeException @throws InvalidOrderException @throws InconsistentCrite...
[ "@Route", "(", "/", "api", "/", "v", "{", "version", "}", "/", "_action", "/", "order", "/", "{", "orderId", "}", "/", "convert", "-", "to", "-", "cart", "/", "name", "=", "api", ".", "action", ".", "order", ".", "convert", "-", "to", "-", "car...
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Cart/Order/Api/OrderConverterController.php#L61-L86
shopware/platform
src/Core/Content/Media/File/FileFetcher.php
FileFetcher.openSourceFromUrl
private function openSourceFromUrl(string $url) { $inputStream = @fopen($url, 'rb'); if ($inputStream === false) { throw new UploadException("Could open source stream from {$url}"); } return $inputStream; }
php
private function openSourceFromUrl(string $url) { $inputStream = @fopen($url, 'rb'); if ($inputStream === false) { throw new UploadException("Could open source stream from {$url}"); } return $inputStream; }
[ "private", "function", "openSourceFromUrl", "(", "string", "$", "url", ")", "{", "$", "inputStream", "=", "@", "fopen", "(", "$", "url", ",", "'rb'", ")", ";", "if", "(", "$", "inputStream", "===", "false", ")", "{", "throw", "new", "UploadException", ...
@throws UploadException @return resource
[ "@throws", "UploadException" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Media/File/FileFetcher.php#L99-L108
shopware/platform
src/Core/Content/Media/File/FileFetcher.php
FileFetcher.openDestinationStream
private function openDestinationStream(string $filename) { $inputStream = @fopen($filename, 'wb'); if ($inputStream === false) { throw new UploadException("Could not open Stream to write upload data: ${filename}"); } return $inputStream; }
php
private function openDestinationStream(string $filename) { $inputStream = @fopen($filename, 'wb'); if ($inputStream === false) { throw new UploadException("Could not open Stream to write upload data: ${filename}"); } return $inputStream; }
[ "private", "function", "openDestinationStream", "(", "string", "$", "filename", ")", "{", "$", "inputStream", "=", "@", "fopen", "(", "$", "filename", ",", "'wb'", ")", ";", "if", "(", "$", "inputStream", "===", "false", ")", "{", "throw", "new", "Upload...
@throws UploadException @return resource
[ "@throws", "UploadException" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Media/File/FileFetcher.php#L115-L124
shopware/platform
src/Core/Content/Media/Thumbnail/ThumbnailService.php
ThumbnailService.getImageResource
private function getImageResource(MediaEntity $media) { $filePath = $this->urlGenerator->getRelativeMediaUrl($media); $file = $this->fileSystem->read($filePath); $image = @imagecreatefromstring($file); if (!$image) { throw new FileTypeNotSupportedException($media->getId()...
php
private function getImageResource(MediaEntity $media) { $filePath = $this->urlGenerator->getRelativeMediaUrl($media); $file = $this->fileSystem->read($filePath); $image = @imagecreatefromstring($file); if (!$image) { throw new FileTypeNotSupportedException($media->getId()...
[ "private", "function", "getImageResource", "(", "MediaEntity", "$", "media", ")", "{", "$", "filePath", "=", "$", "this", "->", "urlGenerator", "->", "getRelativeMediaUrl", "(", "$", "media", ")", ";", "$", "file", "=", "$", "this", "->", "fileSystem", "->...
@throws FileTypeNotSupportedException @return resource
[ "@throws", "FileTypeNotSupportedException" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Media/Thumbnail/ThumbnailService.php#L215-L225
shopware/platform
src/Core/Content/MailTemplate/Service/MailBuilder.php
MailBuilder.buildContents
public function buildContents(Context $context, array $bodies, string $salesChannelId): array { $mailHeaderFooter = $this->findSalesChannel($context, $salesChannelId)->getMailHeaderFooter(); if ($mailHeaderFooter !== null) { return [ 'text/plain' => $mailHeaderFooter->get...
php
public function buildContents(Context $context, array $bodies, string $salesChannelId): array { $mailHeaderFooter = $this->findSalesChannel($context, $salesChannelId)->getMailHeaderFooter(); if ($mailHeaderFooter !== null) { return [ 'text/plain' => $mailHeaderFooter->get...
[ "public", "function", "buildContents", "(", "Context", "$", "context", ",", "array", "$", "bodies", ",", "string", "$", "salesChannelId", ")", ":", "array", "{", "$", "mailHeaderFooter", "=", "$", "this", "->", "findSalesChannel", "(", "$", "context", ",", ...
Attaches header and footer to given email bodies @param array $bodies e.g. ['text/plain' => 'foobar', 'text/html' => '<h1>foobar</h1>'] @return array e.g. ['text/plain' => '{{foobar}}', 'text/html' => '<h1>{{foobar}}</h1>']
[ "Attaches", "header", "and", "footer", "to", "given", "email", "bodies" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/MailTemplate/Service/MailBuilder.php#L30-L41
shopware/platform
src/Core/System/SalesChannel/SalesChannel/SalesChannelContextController.php
SalesChannelContextController.update
public function update(RequestDataBag $data, SalesChannelContext $context): JsonResponse { $this->contextSwitcher->update($data, $context); return new JsonResponse([ PlatformRequest::HEADER_CONTEXT_TOKEN => $context->getToken(), ]); }
php
public function update(RequestDataBag $data, SalesChannelContext $context): JsonResponse { $this->contextSwitcher->update($data, $context); return new JsonResponse([ PlatformRequest::HEADER_CONTEXT_TOKEN => $context->getToken(), ]); }
[ "public", "function", "update", "(", "RequestDataBag", "$", "data", ",", "SalesChannelContext", "$", "context", ")", ":", "JsonResponse", "{", "$", "this", "->", "contextSwitcher", "->", "update", "(", "$", "data", ",", "$", "context", ")", ";", "return", ...
@Route("/sales-channel-api/v{version}/context", name="sales-channel-api.context.update", methods={"PATCH"}) @throws AddressNotFoundException @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "sales", "-", "channel", "-", "api", "/", "v", "{", "version", "}", "/", "context", "name", "=", "sales", "-", "channel", "-", "api", ".", "context", ".", "update", "methods", "=", "{", "PATCH", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/System/SalesChannel/SalesChannel/SalesChannelContextController.php#L32-L39
shopware/platform
src/Core/Framework/Plugin/Requirement/RequirementsValidator.php
RequirementsValidator.validateComposerPackages
private function validateComposerPackages( array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { $shopwareProjectComposer = $this->getComposer($this->projectDir); $pluginRequirements = $this->checkComposerDependencies( $pluginRequirements, ...
php
private function validateComposerPackages( array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { $shopwareProjectComposer = $this->getComposer($this->projectDir); $pluginRequirements = $this->checkComposerDependencies( $pluginRequirements, ...
[ "private", "function", "validateComposerPackages", "(", "array", "$", "pluginRequirements", ",", "RequirementExceptionStack", "$", "exceptionStack", ")", ":", "array", "{", "$", "shopwareProjectComposer", "=", "$", "this", "->", "getComposer", "(", "$", "this", "->"...
@param Link[] $pluginRequirements @return Link[]
[ "@param", "Link", "[]", "$pluginRequirements" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Requirement/RequirementsValidator.php#L77-L89
shopware/platform
src/Core/Framework/Plugin/Requirement/RequirementsValidator.php
RequirementsValidator.checkComposerDependencies
private function checkComposerDependencies( array $pluginRequirements, RequirementExceptionStack $exceptionStack, Composer $pluginComposer ): array { $packages = $pluginComposer->getRepositoryManager()->getLocalRepository()->getPackages(); foreach ($packages as $package) { ...
php
private function checkComposerDependencies( array $pluginRequirements, RequirementExceptionStack $exceptionStack, Composer $pluginComposer ): array { $packages = $pluginComposer->getRepositoryManager()->getLocalRepository()->getPackages(); foreach ($packages as $package) { ...
[ "private", "function", "checkComposerDependencies", "(", "array", "$", "pluginRequirements", ",", "RequirementExceptionStack", "$", "exceptionStack", ",", "Composer", "$", "pluginComposer", ")", ":", "array", "{", "$", "packages", "=", "$", "pluginComposer", "->", "...
@param Link[] $pluginRequirements @return Link[]
[ "@param", "Link", "[]", "$pluginRequirements" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Requirement/RequirementsValidator.php#L101-L117
shopware/platform
src/Core/Framework/Plugin/Requirement/RequirementsValidator.php
RequirementsValidator.validateInstalledPlugins
private function validateInstalledPlugins( Context $context, array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { $parser = new VersionParser(); /** @var PluginEntity $pluginEntity */ foreach ($this->getInstalledPlugins($context) as $pluginE...
php
private function validateInstalledPlugins( Context $context, array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { $parser = new VersionParser(); /** @var PluginEntity $pluginEntity */ foreach ($this->getInstalledPlugins($context) as $pluginE...
[ "private", "function", "validateInstalledPlugins", "(", "Context", "$", "context", ",", "array", "$", "pluginRequirements", ",", "RequirementExceptionStack", "$", "exceptionStack", ")", ":", "array", "{", "$", "parser", "=", "new", "VersionParser", "(", ")", ";", ...
@param Link[] $pluginRequirements @return Link[]
[ "@param", "Link", "[]", "$pluginRequirements" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Requirement/RequirementsValidator.php#L124-L141
shopware/platform
src/Core/Framework/Plugin/Requirement/RequirementsValidator.php
RequirementsValidator.checkRequirement
private function checkRequirement( array $pluginRequirements, string $installedName, string $installedVersion, RequirementExceptionStack $exceptionStack ): array { if (isset($pluginRequirements[$installedName])) { $constraint = $pluginRequirements[$installedName]-...
php
private function checkRequirement( array $pluginRequirements, string $installedName, string $installedVersion, RequirementExceptionStack $exceptionStack ): array { if (isset($pluginRequirements[$installedName])) { $constraint = $pluginRequirements[$installedName]-...
[ "private", "function", "checkRequirement", "(", "array", "$", "pluginRequirements", ",", "string", "$", "installedName", ",", "string", "$", "installedVersion", ",", "RequirementExceptionStack", "$", "exceptionStack", ")", ":", "array", "{", "if", "(", "isset", "(...
@param Link[] $pluginRequirements @return Link[]
[ "@param", "Link", "[]", "$pluginRequirements" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Requirement/RequirementsValidator.php#L159-L181
shopware/platform
src/Core/Framework/Plugin/Requirement/RequirementsValidator.php
RequirementsValidator.validateShippedDependencies
private function validateShippedDependencies( PluginEntity $plugin, array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { if ($plugin->getManagedByComposer()) { return $pluginRequirements; } $vendorDir = $this->pluginComposer->ge...
php
private function validateShippedDependencies( PluginEntity $plugin, array $pluginRequirements, RequirementExceptionStack $exceptionStack ): array { if ($plugin->getManagedByComposer()) { return $pluginRequirements; } $vendorDir = $this->pluginComposer->ge...
[ "private", "function", "validateShippedDependencies", "(", "PluginEntity", "$", "plugin", ",", "array", "$", "pluginRequirements", ",", "RequirementExceptionStack", "$", "exceptionStack", ")", ":", "array", "{", "if", "(", "$", "plugin", "->", "getManagedByComposer", ...
@param Link[] $pluginRequirements @return Link[]
[ "@param", "Link", "[]", "$pluginRequirements" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Requirement/RequirementsValidator.php#L202-L223
shopware/platform
src/Core/Framework/DataAbstractionLayer/CompiledFieldCollection.php
CompiledFieldCollection.remove
public function remove($fieldName): void { if (isset($this->mappedByStorageName[$fieldName])) { unset($this->mappedByStorageName[$fieldName]); } parent::remove($fieldName); }
php
public function remove($fieldName): void { if (isset($this->mappedByStorageName[$fieldName])) { unset($this->mappedByStorageName[$fieldName]); } parent::remove($fieldName); }
[ "public", "function", "remove", "(", "$", "fieldName", ")", ":", "void", "{", "if", "(", "isset", "(", "$", "this", "->", "mappedByStorageName", "[", "$", "fieldName", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "mappedByStorageName", "[", "$"...
@param string $fieldName @internal
[ "@param", "string", "$fieldName" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/CompiledFieldCollection.php#L77-L84
shopware/platform
src/Core/Framework/Api/Controller/CacheController.php
CacheController.deleteCacheItems
public function deleteCacheItems(Request $request): JsonResponse { $tags = $this->serializer->decode($request->getContent(), 'json'); if (!is_array($tags) || empty($tags)) { throw new InvalidRequestParameterException('tags'); } $tags = array_map(function ($tag) { ...
php
public function deleteCacheItems(Request $request): JsonResponse { $tags = $this->serializer->decode($request->getContent(), 'json'); if (!is_array($tags) || empty($tags)) { throw new InvalidRequestParameterException('tags'); } $tags = array_map(function ($tag) { ...
[ "public", "function", "deleteCacheItems", "(", "Request", "$", "request", ")", ":", "JsonResponse", "{", "$", "tags", "=", "$", "this", "->", "serializer", "->", "decode", "(", "$", "request", "->", "getContent", "(", ")", ",", "'json'", ")", ";", "if", ...
@Route("/api/v{version}/_action/cache/item", name="api.action.cache.delete-items", methods={"DELETE"}) @throws InvalidRequestParameterException
[ "@Route", "(", "/", "api", "/", "v", "{", "version", "}", "/", "_action", "/", "cache", "/", "item", "name", "=", "api", ".", "action", ".", "cache", ".", "delete", "-", "items", "methods", "=", "{", "DELETE", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Controller/CacheController.php#L47-L70
shopware/platform
src/Core/Content/Media/Commands/GenerateThumbnailsCommand.php
GenerateThumbnailsCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $this->initializeCommand($input, $context); $mediaIterator = new RepositoryIterator($this->mediaRepository, $conte...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $this->initializeCommand($input, $context); $mediaIterator = new RepositoryIterator($this->mediaRepository, $conte...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "context", "=", "Context"...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Media/Commands/GenerateThumbnailsCommand.php#L110-L124
shopware/platform
src/Core/Framework/Api/Serializer/JsonApiEncoder.php
JsonApiEncoder.encode
public function encode(EntityDefinition $definition, $data, string $baseUrl, array $metaData = []): string { $result = new JsonApiEncodingResult($baseUrl); if (!$data instanceof EntityCollection && !$data instanceof Entity) { throw new UnsupportedEncoderInputException(); } ...
php
public function encode(EntityDefinition $definition, $data, string $baseUrl, array $metaData = []): string { $result = new JsonApiEncodingResult($baseUrl); if (!$data instanceof EntityCollection && !$data instanceof Entity) { throw new UnsupportedEncoderInputException(); } ...
[ "public", "function", "encode", "(", "EntityDefinition", "$", "definition", ",", "$", "data", ",", "string", "$", "baseUrl", ",", "array", "$", "metaData", "=", "[", "]", ")", ":", "string", "{", "$", "result", "=", "new", "JsonApiEncodingResult", "(", "...
@param EntityCollection|Entity|null $data @throws UnsupportedEncoderInputException
[ "@param", "EntityCollection|Entity|null", "$data" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/Serializer/JsonApiEncoder.php#L33-L47
shopware/platform
src/Core/Framework/Plugin/Command/Lifecycle/PluginDeactivateCommand.php
PluginDeactivateCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $deactivatedPluginCount = 0; /...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $deactivatedPluginCount = 0; /...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "context", "=", "Context", "::", "creat...
{@inheritdoc} @throws PluginNotInstalledException @throws PluginNotActivatedException
[ "{", "@inheritdoc", "}" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Command/Lifecycle/PluginDeactivateCommand.php#L28-L58
shopware/platform
src/Core/Framework/DataAbstractionLayer/Search/Criteria.php
Criteria.addAssociationPath
public function addAssociationPath(string $path): self { $parts = explode('.', $path); $criteria = $this; foreach ($parts as $part) { if (!$criteria->hasAssociation($part)) { $criteria->addAssociation($part); } $criteria = $criteria->getA...
php
public function addAssociationPath(string $path): self { $parts = explode('.', $path); $criteria = $this; foreach ($parts as $part) { if (!$criteria->hasAssociation($part)) { $criteria->addAssociation($part); } $criteria = $criteria->getA...
[ "public", "function", "addAssociationPath", "(", "string", "$", "path", ")", ":", "self", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "path", ")", ";", "$", "criteria", "=", "$", "this", ";", "foreach", "(", "$", "parts", "as", "$", "p...
Allows to add a nested association
[ "Allows", "to", "add", "a", "nested", "association" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/DataAbstractionLayer/Search/Criteria.php#L240-L254
shopware/platform
src/Core/Content/Product/Api/ProductActionController.php
ProductActionController.getCombinations
public function getCombinations(string $productId, Context $context) { return new JsonResponse( $this->combinationLoader->load($productId, $context) ); }
php
public function getCombinations(string $productId, Context $context) { return new JsonResponse( $this->combinationLoader->load($productId, $context) ); }
[ "public", "function", "getCombinations", "(", "string", "$", "productId", ",", "Context", "$", "context", ")", "{", "return", "new", "JsonResponse", "(", "$", "this", "->", "combinationLoader", "->", "load", "(", "$", "productId", ",", "$", "context", ")", ...
@Route("/api/v{version}/_action/product/{productId}/combinations", name="api.action.product.combinations", methods={"GET"}) @return JsonResponse
[ "@Route", "(", "/", "api", "/", "v", "{", "version", "}", "/", "_action", "/", "product", "/", "{", "productId", "}", "/", "combinations", "name", "=", "api", ".", "action", ".", "product", ".", "combinations", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Content/Product/Api/ProductActionController.php#L28-L33
shopware/platform
src/Core/Checkout/Checkout.php
Checkout.build
public function build(ContainerBuilder $container): void { parent::build($container); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection/')); $loader->load('cart.xml'); $loader->load('customer.xml'); $loader->load('discount_surcharge.xml'...
php
public function build(ContainerBuilder $container): void { parent::build($container); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection/')); $loader->load('cart.xml'); $loader->load('customer.xml'); $loader->load('discount_surcharge.xml'...
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "parent", "::", "build", "(", "$", "container", ")", ";", "$", "loader", "=", "new", "XmlFileLoader", "(", "$", "container", ",", "new", "FileLocator", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Checkout.php#L17-L31
shopware/platform
src/Storefront/DependencyInjection/DisableTemplateCachePass.php
DisableTemplateCachePass.process
public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('twig.cache_warmer') || !$container->hasDefinition('twig.template_cache_warmer')) { return; } // disable cache warm-up as it breaks the inheritance $container->getDefinition('twig....
php
public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('twig.cache_warmer') || !$container->hasDefinition('twig.template_cache_warmer')) { return; } // disable cache warm-up as it breaks the inheritance $container->getDefinition('twig....
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "if", "(", "!", "$", "container", "->", "hasDefinition", "(", "'twig.cache_warmer'", ")", "||", "!", "$", "container", "->", "hasDefinition", "(", "'twig.templat...
You can modify the container here before it is dumped to PHP code.
[ "You", "can", "modify", "the", "container", "here", "before", "it", "is", "dumped", "to", "PHP", "code", "." ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/DependencyInjection/DisableTemplateCachePass.php#L13-L21
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.index
public function index(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->overviewPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/index.html.twig', ['page' => $page]); }
php
public function index(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->overviewPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/index.html.twig', ['page' => $page]); }
[ "public", "function", "index", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "page", "=", "$", "this", "->", "overviewPageLoader", "->...
@Route("/account", name="frontend.account.home.page", methods={"GET"}) @throws CustomerNotLoggedInExceptionAlias
[ "@Route", "(", "/", "account", "name", "=", "frontend", ".", "account", ".", "home", ".", "page", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L132-L139
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.paymentOverview
public function paymentOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->paymentMethodPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/payment/index.html.twig', ['page' => $pa...
php
public function paymentOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->paymentMethodPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/payment/index.html.twig', ['page' => $pa...
[ "public", "function", "paymentOverview", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "page", "=", "$", "this", "->", "paymentMethodPag...
@Route("/account/payment", name="frontend.account.payment.page", options={"seo"="false"}, methods={"GET"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "payment", "name", "=", "frontend", ".", "account", ".", "payment", ".", "page", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L266-L273
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.savePayment
public function savePayment(RequestDataBag $requestDataBag, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $paymentMethodId = $requestDataBag->getAlnum('paymentMethodId'); $this->accountService->changeDefaultPaymentMethod( ...
php
public function savePayment(RequestDataBag $requestDataBag, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $paymentMethodId = $requestDataBag->getAlnum('paymentMethodId'); $this->accountService->changeDefaultPaymentMethod( ...
[ "public", "function", "savePayment", "(", "RequestDataBag", "$", "requestDataBag", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "try", "{", "$", "paymentMethodId", "=", "$", ...
@Route("/account/payment", name="frontend.account.payment.save", methods={"POST"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "payment", "name", "=", "frontend", ".", "account", ".", "payment", ".", "save", "methods", "=", "{", "POST", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L280-L308
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.orderOverview
public function orderOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->orderPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/order-history/index.html.twig', ['page' => $page])...
php
public function orderOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->orderPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/order-history/index.html.twig', ['page' => $page])...
[ "public", "function", "orderOverview", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "page", "=", "$", "this", "->", "orderPageLoader", ...
@Route("/account/order", name="frontend.account.order.page", options={"seo"="false"}, methods={"GET"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "order", "name", "=", "frontend", ".", "account", ".", "order", ".", "page", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L315-L322
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.profileOverview
public function profileOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->profilePageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/profile/index.html.twig', ['page' => $page]); ...
php
public function profileOverview(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->profilePageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/profile/index.html.twig', ['page' => $page]); ...
[ "public", "function", "profileOverview", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "page", "=", "$", "this", "->", "profilePageLoade...
@Route("/account/profile", name="frontend.account.profile.page", methods={"GET"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "profile", "name", "=", "frontend", ".", "account", ".", "profile", ".", "page", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L329-L336
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.saveProfile
public function saveProfile(RequestDataBag $data, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $this->accountService->saveProfile($data, $context); $this->salesChannelContextService->refresh( $context->getSalesChannel()->...
php
public function saveProfile(RequestDataBag $data, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $this->accountService->saveProfile($data, $context); $this->salesChannelContextService->refresh( $context->getSalesChannel()->...
[ "public", "function", "saveProfile", "(", "RequestDataBag", "$", "data", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "try", "{", "$", "this", "->", "accountService", "->",...
@Route("/account/profile", name="frontend.account.profile.save", methods={"POST"}) @throws CustomerNotLoggedInExceptionAlias
[ "@Route", "(", "/", "account", "/", "profile", "name", "=", "frontend", ".", "account", ".", "profile", ".", "save", "methods", "=", "{", "POST", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L343-L362
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.savePassword
public function savePassword(RequestDataBag $data, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $this->accountService->savePassword($data, $context); $this->salesChannelContextService->refresh( $context->getSalesChannel()...
php
public function savePassword(RequestDataBag $data, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); try { $this->accountService->savePassword($data, $context); $this->salesChannelContextService->refresh( $context->getSalesChannel()...
[ "public", "function", "savePassword", "(", "RequestDataBag", "$", "data", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "try", "{", "$", "this", "->", "accountService", "->"...
@Route("/account/profile/password", name="frontend.account.profile.password.save", methods={"POST"}) @throws CustomerNotLoggedInExceptionAlias
[ "@Route", "(", "/", "account", "/", "profile", "/", "password", "name", "=", "frontend", ".", "account", ".", "profile", ".", "password", ".", "save", "methods", "=", "{", "POST", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L395-L411
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.createAddress
public function createAddress(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->addressPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/addressbook/create.html.twig', ['page' => $page]...
php
public function createAddress(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $page = $this->addressPageLoader->load($request, $context); return $this->renderStorefront('@Storefront/page/account/addressbook/create.html.twig', ['page' => $page]...
[ "public", "function", "createAddress", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "page", "=", "$", "this", "->", "addressPageLoader"...
@Route("/account/address/create", name="frontend.account.address.create.page", options={"seo"="false"}, methods={"GET"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "address", "/", "create", "name", "=", "frontend", ".", "account", ".", "address", ".", "create", ".", "page", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L432-L439
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.password
public function password(Request $request): Response { $this->denyAccessUnlessLoggedIn(); if ($request->isMethod(Request::METHOD_POST)) { // @todo : send recovery email return $this->renderStorefront('@Storefront/page/account/password-reset/hash-sent.html.twig', ['page' => [...
php
public function password(Request $request): Response { $this->denyAccessUnlessLoggedIn(); if ($request->isMethod(Request::METHOD_POST)) { // @todo : send recovery email return $this->renderStorefront('@Storefront/page/account/password-reset/hash-sent.html.twig', ['page' => [...
[ "public", "function", "password", "(", "Request", "$", "request", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "if", "(", "$", "request", "->", "isMethod", "(", "Request", "::", "METHOD_POST", ")", ")", "{", "/...
@Route("/account/password", name="frontend.account.password.page", options={"seo"="false"}, methods={"GET","POST"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "password", "name", "=", "frontend", ".", "account", ".", "password", ".", "page", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "GET", "POST", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L460-L470
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.resetPassword
public function resetPassword(Request $request): Response { $this->denyAccessUnlessLoggedIn(); // @todo verify hash and if not valid show error page with message if ($request->isMethod(Request::METHOD_POST)) { // @todo: update password, login customer and redirect to account an...
php
public function resetPassword(Request $request): Response { $this->denyAccessUnlessLoggedIn(); // @todo verify hash and if not valid show error page with message if ($request->isMethod(Request::METHOD_POST)) { // @todo: update password, login customer and redirect to account an...
[ "public", "function", "resetPassword", "(", "Request", "$", "request", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "// @todo verify hash and if not valid show error page with message", "if", "(", "$", "request", "->", "isMe...
@Route("/account/resetPassword/{hash}", name="frontend.account.password.reset.page", options={"seo"="false"}, methods={"GET","POST"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "resetPassword", "/", "{", "hash", "}", "name", "=", "frontend", ".", "account", ".", "password", ".", "reset", ".", "page", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "GET", "POST", "}", ...
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L477-L489
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.setDefaultShippingAddress
public function setDefaultShippingAddress(string $type, string $addressId, SalesChannelContext $context): RedirectResponse { $this->denyAccessUnlessLoggedIn(); if (!Uuid::isValid($addressId)) { throw new InvalidUuidException($addressId); } $success = true; try {...
php
public function setDefaultShippingAddress(string $type, string $addressId, SalesChannelContext $context): RedirectResponse { $this->denyAccessUnlessLoggedIn(); if (!Uuid::isValid($addressId)) { throw new InvalidUuidException($addressId); } $success = true; try {...
[ "public", "function", "setDefaultShippingAddress", "(", "string", "$", "type", ",", "string", "$", "addressId", ",", "SalesChannelContext", "$", "context", ")", ":", "RedirectResponse", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "if", "("...
@Route("/account/address/default-{type}/{addressId}", name="frontend.account.address.set-default-address", methods={"POST"}) @throws CustomerNotLoggedInException @throws InvalidUuidException
[ "@Route", "(", "/", "account", "/", "address", "/", "default", "-", "{", "type", "}", "/", "{", "addressId", "}", "name", "=", "frontend", ".", "account", ".", "address", ".", "set", "-", "default", "-", "address", "methods", "=", "{", "POST", "}", ...
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L511-L541
shopware/platform
src/Storefront/PageController/AccountPageController.php
AccountPageController.deleteAddress
public function deleteAddress(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $success = true; $addressId = $request->request->get('addressId'); if (!$addressId) { throw new MissingRequestParameterException('addressId'); ...
php
public function deleteAddress(Request $request, SalesChannelContext $context): Response { $this->denyAccessUnlessLoggedIn(); $success = true; $addressId = $request->request->get('addressId'); if (!$addressId) { throw new MissingRequestParameterException('addressId'); ...
[ "public", "function", "deleteAddress", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "context", ")", ":", "Response", "{", "$", "this", "->", "denyAccessUnlessLoggedIn", "(", ")", ";", "$", "success", "=", "true", ";", "$", "addressId", "=...
@Route("/account/address/delete/{addressId}", name="frontend.account.address.delete", options={"seo"="false"}, methods={"POST"}) @throws CustomerNotLoggedInException
[ "@Route", "(", "/", "account", "/", "address", "/", "delete", "/", "{", "addressId", "}", "name", "=", "frontend", ".", "account", ".", "address", ".", "delete", "options", "=", "{", "seo", "=", "false", "}", "methods", "=", "{", "POST", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Storefront/PageController/AccountPageController.php#L548-L566
shopware/platform
src/Core/Framework/Plugin/Command/Lifecycle/PluginInstallCommand.php
PluginInstallCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $installedPluginCount = 0; /**...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $installedPluginCount = 0; /**...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "context", "=", "Context", "::", "creat...
{@inheritdoc} @throws PluginNotInstalledException
[ "{", "@inheritdoc", "}" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Command/Lifecycle/PluginInstallCommand.php#L29-L72
shopware/platform
src/Core/Framework/Api/OAuth/AccessTokenRepository.php
AccessTokenRepository.getNewToken
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null): AccessTokenEntityInterface { $token = new AccessToken($clientEntity, $scopes, $userIdentifier); if ($clientEntity instanceof ApiClient && $clientEntity->getIdentifier() === 'administration') { ...
php
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null): AccessTokenEntityInterface { $token = new AccessToken($clientEntity, $scopes, $userIdentifier); if ($clientEntity instanceof ApiClient && $clientEntity->getIdentifier() === 'administration') { ...
[ "public", "function", "getNewToken", "(", "ClientEntityInterface", "$", "clientEntity", ",", "array", "$", "scopes", ",", "$", "userIdentifier", "=", "null", ")", ":", "AccessTokenEntityInterface", "{", "$", "token", "=", "new", "AccessToken", "(", "$", "clientE...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Api/OAuth/AccessTokenRepository.php#L15-L24
shopware/platform
src/Core/Checkout/Payment/Controller/PaymentController.php
PaymentController.finalizeTransaction
public function finalizeTransaction(Request $request, SalesChannelContext $salesChannelContext): Response { $paymentToken = $request->get('_sw_payment_token'); $paymentTokenStruct = $this->paymentService->finalizeTransaction($paymentToken, $request, $salesChannelContext); if ($paymentToken...
php
public function finalizeTransaction(Request $request, SalesChannelContext $salesChannelContext): Response { $paymentToken = $request->get('_sw_payment_token'); $paymentTokenStruct = $this->paymentService->finalizeTransaction($paymentToken, $request, $salesChannelContext); if ($paymentToken...
[ "public", "function", "finalizeTransaction", "(", "Request", "$", "request", ",", "SalesChannelContext", "$", "salesChannelContext", ")", ":", "Response", "{", "$", "paymentToken", "=", "$", "request", "->", "get", "(", "'_sw_payment_token'", ")", ";", "$", "pay...
@Route("/payment/finalize-transaction", defaults={"auth_required"=false}, name="payment.finalize.transaction", methods={"GET"}) @throws AsyncPaymentFinalizeException @throws CustomerCanceledAsyncPaymentException @throws InvalidTransactionException @throws TokenExpiredException @throws UnknownPaymentMethodException
[ "@Route", "(", "/", "payment", "/", "finalize", "-", "transaction", "defaults", "=", "{", "auth_required", "=", "false", "}", "name", "=", "payment", ".", "finalize", ".", "transaction", "methods", "=", "{", "GET", "}", ")" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Checkout/Payment/Controller/PaymentController.php#L40-L51
shopware/platform
src/Core/Framework/Struct/ExtendableTrait.php
ExtendableTrait.addExtension
public function addExtension(string $name, ?Struct $extension): void { $this->extensions[$name] = $extension; }
php
public function addExtension(string $name, ?Struct $extension): void { $this->extensions[$name] = $extension; }
[ "public", "function", "addExtension", "(", "string", "$", "name", ",", "?", "Struct", "$", "extension", ")", ":", "void", "{", "$", "this", "->", "extensions", "[", "$", "name", "]", "=", "$", "extension", ";", "}" ]
Adds a new extension struct into the class storage. The passed name is used as unique identifier and has to be stored too.
[ "Adds", "a", "new", "extension", "struct", "into", "the", "class", "storage", ".", "The", "passed", "name", "is", "used", "as", "unique", "identifier", "and", "has", "to", "be", "stored", "too", "." ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Struct/ExtendableTrait.php#L23-L26
shopware/platform
src/Core/Framework/Snippet/Filter/NamespaceFilter.php
NamespaceFilter.filter
public function filter(array $snippets, $requestFilterValue): array { if (empty($requestFilterValue) || !is_array($requestFilterValue)) { return $snippets; } $result = []; foreach ($requestFilterValue as $term) { foreach ($snippets as $setId => $set) { ...
php
public function filter(array $snippets, $requestFilterValue): array { if (empty($requestFilterValue) || !is_array($requestFilterValue)) { return $snippets; } $result = []; foreach ($requestFilterValue as $term) { foreach ($snippets as $setId => $set) { ...
[ "public", "function", "filter", "(", "array", "$", "snippets", ",", "$", "requestFilterValue", ")", ":", "array", "{", "if", "(", "empty", "(", "$", "requestFilterValue", ")", "||", "!", "is_array", "(", "$", "requestFilterValue", ")", ")", "{", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Snippet/Filter/NamespaceFilter.php#L18-L37
shopware/platform
src/Core/Framework/Plugin/Command/Lifecycle/PluginUpdateCommand.php
PluginUpdateCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $updatedPluginCount = 0; /** @...
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $context = Context::createDefaultContext(); $plugins = $this->prepareExecution(self::LIFECYCLE_METHOD, $io, $input, $context); $updatedPluginCount = 0; /** @...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "context", "=", "Context", "::", "creat...
{@inheritdoc}
[ "{" ]
train
https://github.com/shopware/platform/blob/d8668dda2bd6c830012805ba9c3772349c7debce/src/Core/Framework/Plugin/Command/Lifecycle/PluginUpdateCommand.php#L23-L41
php-mime-mail-parser/php-mime-mail-parser
src/Attachment.php
Attachment.suffixFileName
protected function suffixFileName(string $fileName): string { $pathInfo = pathinfo($fileName); $dirname = $pathInfo['dirname'].DIRECTORY_SEPARATOR; $filename = $pathInfo['filename']; $extension = empty($pathInfo['extension']) ? '' : '.'.$pathInfo['extension']; $i = 0; ...
php
protected function suffixFileName(string $fileName): string { $pathInfo = pathinfo($fileName); $dirname = $pathInfo['dirname'].DIRECTORY_SEPARATOR; $filename = $pathInfo['filename']; $extension = empty($pathInfo['extension']) ? '' : '.'.$pathInfo['extension']; $i = 0; ...
[ "protected", "function", "suffixFileName", "(", "string", "$", "fileName", ")", ":", "string", "{", "$", "pathInfo", "=", "pathinfo", "(", "$", "fileName", ")", ";", "$", "dirname", "=", "$", "pathInfo", "[", "'dirname'", "]", ".", "DIRECTORY_SEPARATOR", "...
Rename a file if it already exists at its destination. Renaming is done by adding a duplicate number to the file name. E.g. existingFileName_1.ext. After a max duplicate number, renaming the file will switch over to generating a random suffix. @param string $fileName Complete path to the file. @return string ...
[ "Rename", "a", "file", "if", "it", "already", "exists", "at", "its", "destination", ".", "Renaming", "is", "done", "by", "adding", "a", "duplicate", "number", "to", "the", "file", "name", ".", "E", ".", "g", ".", "existingFileName_1", ".", "ext", ".", ...
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Attachment.php#L156-L177
php-mime-mail-parser/php-mime-mail-parser
src/Attachment.php
Attachment.read
public function read($bytes = 2082) { return feof($this->stream) ? false : fread($this->stream, $bytes); }
php
public function read($bytes = 2082) { return feof($this->stream) ? false : fread($this->stream, $bytes); }
[ "public", "function", "read", "(", "$", "bytes", "=", "2082", ")", "{", "return", "feof", "(", "$", "this", "->", "stream", ")", "?", "false", ":", "fread", "(", "$", "this", "->", "stream", ",", "$", "bytes", ")", ";", "}" ]
Read the contents a few bytes at a time until completed Once read to completion, it always returns false @param int $bytes (default: 2082) @return string|bool
[ "Read", "the", "contents", "a", "few", "bytes", "at", "a", "time", "until", "completed", "Once", "read", "to", "completion", "it", "always", "returns", "false" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Attachment.php#L187-L190
php-mime-mail-parser/php-mime-mail-parser
src/Attachment.php
Attachment.getContent
public function getContent() { if ($this->content === null) { fseek($this->stream, 0); while (($buf = $this->read()) !== false) { $this->content .= $buf; } } return $this->content; }
php
public function getContent() { if ($this->content === null) { fseek($this->stream, 0); while (($buf = $this->read()) !== false) { $this->content .= $buf; } } return $this->content; }
[ "public", "function", "getContent", "(", ")", "{", "if", "(", "$", "this", "->", "content", "===", "null", ")", "{", "fseek", "(", "$", "this", "->", "stream", ",", "0", ")", ";", "while", "(", "(", "$", "buf", "=", "$", "this", "->", "read", "...
Retrieve the file content in one go Once you retrieve the content you cannot use MimeMailParser_attachment::read() @return string
[ "Retrieve", "the", "file", "content", "in", "one", "go", "Once", "you", "retrieve", "the", "content", "you", "cannot", "use", "MimeMailParser_attachment", "::", "read", "()" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Attachment.php#L198-L208
php-mime-mail-parser/php-mime-mail-parser
src/Attachment.php
Attachment.save
public function save( $attach_dir, $filenameStrategy = Parser::ATTACHMENT_DUPLICATE_SUFFIX ) { $attach_dir = rtrim($attach_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; if (!is_dir($attach_dir)) { mkdir($attach_dir); } // Determine filename switc...
php
public function save( $attach_dir, $filenameStrategy = Parser::ATTACHMENT_DUPLICATE_SUFFIX ) { $attach_dir = rtrim($attach_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; if (!is_dir($attach_dir)) { mkdir($attach_dir); } // Determine filename switc...
[ "public", "function", "save", "(", "$", "attach_dir", ",", "$", "filenameStrategy", "=", "Parser", "::", "ATTACHMENT_DUPLICATE_SUFFIX", ")", "{", "$", "attach_dir", "=", "rtrim", "(", "$", "attach_dir", ",", "DIRECTORY_SEPARATOR", ")", ".", "DIRECTORY_SEPARATOR", ...
Save the attachment individually @param string $attach_dir @param string $filenameStrategy @return string
[ "Save", "the", "attachment", "individually" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Attachment.php#L228-L271
php-mime-mail-parser/php-mime-mail-parser
src/Middleware.php
Middleware.parse
public function parse(MimePart $part, MiddlewareStack $next) { return call_user_func($this->parser, $part, $next); }
php
public function parse(MimePart $part, MiddlewareStack $next) { return call_user_func($this->parser, $part, $next); }
[ "public", "function", "parse", "(", "MimePart", "$", "part", ",", "MiddlewareStack", "$", "next", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "parser", ",", "$", "part", ",", "$", "next", ")", ";", "}" ]
Process a mime part, optionally delegating parsing to the $next MiddlewareStack
[ "Process", "a", "mime", "part", "optionally", "delegating", "parsing", "to", "the", "$next", "MiddlewareStack" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Middleware.php#L25-L28
php-mime-mail-parser/php-mime-mail-parser
src/MimePart.php
MimePart.offsetGet
public function offsetGet($offset) { return isset($this->part[$offset]) ? $this->part[$offset] : null; }
php
public function offsetGet($offset) { return isset($this->part[$offset]) ? $this->part[$offset] : null; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "return", "isset", "(", "$", "this", "->", "part", "[", "$", "offset", "]", ")", "?", "$", "this", "->", "part", "[", "$", "offset", "]", ":", "null", ";", "}" ]
ArrayAccess
[ "ArrayAccess" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/MimePart.php#L111-L114
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.setPath
public function setPath($path) { if (is_writable($path)) { $file = fopen($path, 'a+'); fseek($file, -1, SEEK_END); if (fread($file, 1) != "\n") { fwrite($file, PHP_EOL); } fclose($file); } // should parse message in...
php
public function setPath($path) { if (is_writable($path)) { $file = fopen($path, 'a+'); fseek($file, -1, SEEK_END); if (fread($file, 1) != "\n") { fwrite($file, PHP_EOL); } fclose($file); } // should parse message in...
[ "public", "function", "setPath", "(", "$", "path", ")", "{", "if", "(", "is_writable", "(", "$", "path", ")", ")", "{", "$", "file", "=", "fopen", "(", "$", "path", ",", "'a+'", ")", ";", "fseek", "(", "$", "file", ",", "-", "1", ",", "SEEK_END...
Set the file path we use to get the email text @param string $path File path to the MIME mail @return Parser MimeMailParser Instance
[ "Set", "the", "file", "path", "we", "use", "to", "get", "the", "email", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L111-L128
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.setStream
public function setStream($stream) { // streams have to be cached to file first $meta = @stream_get_meta_data($stream); if (!$meta || !$meta['mode'] || !in_array($meta['mode'], self::$readableModes, true) || $meta['eof']) { throw new Exception( 'setStream() expect...
php
public function setStream($stream) { // streams have to be cached to file first $meta = @stream_get_meta_data($stream); if (!$meta || !$meta['mode'] || !in_array($meta['mode'], self::$readableModes, true) || $meta['eof']) { throw new Exception( 'setStream() expect...
[ "public", "function", "setStream", "(", "$", "stream", ")", "{", "// streams have to be cached to file first", "$", "meta", "=", "@", "stream_get_meta_data", "(", "$", "stream", ")", ";", "if", "(", "!", "$", "meta", "||", "!", "$", "meta", "[", "'mode'", ...
Set the Stream resource we use to get the email text @param resource $stream @return Parser MimeMailParser Instance @throws Exception
[ "Set", "the", "Stream", "resource", "we", "use", "to", "get", "the", "email", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L138-L176
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.setText
public function setText($data) { if (empty($data)) { throw new Exception('You must not call MimeMailParser::setText with an empty string parameter'); } if (substr($data, -1) != "\n") { $data = $data.PHP_EOL; } $this->resource = mailparse_msg_create()...
php
public function setText($data) { if (empty($data)) { throw new Exception('You must not call MimeMailParser::setText with an empty string parameter'); } if (substr($data, -1) != "\n") { $data = $data.PHP_EOL; } $this->resource = mailparse_msg_create()...
[ "public", "function", "setText", "(", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "data", ")", ")", "{", "throw", "new", "Exception", "(", "'You must not call MimeMailParser::setText with an empty string parameter'", ")", ";", "}", "if", "(", "substr", ...
Set the email text @param string $data @return Parser MimeMailParser Instance
[ "Set", "the", "email", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L185-L202
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.parse
protected function parse() { $structure = mailparse_msg_get_structure($this->resource); $this->parts = []; foreach ($structure as $part_id) { $part = mailparse_msg_get_part($this->resource, $part_id); $part_data = mailparse_msg_get_part_data($part); $mimeP...
php
protected function parse() { $structure = mailparse_msg_get_structure($this->resource); $this->parts = []; foreach ($structure as $part_id) { $part = mailparse_msg_get_part($this->resource, $part_id); $part_data = mailparse_msg_get_part_data($part); $mimeP...
[ "protected", "function", "parse", "(", ")", "{", "$", "structure", "=", "mailparse_msg_get_structure", "(", "$", "this", "->", "resource", ")", ";", "$", "this", "->", "parts", "=", "[", "]", ";", "foreach", "(", "$", "structure", "as", "$", "part_id", ...
Parse the Message into parts @return void
[ "Parse", "the", "Message", "into", "parts" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L209-L220
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getRawHeader
public function getRawHeader($name) { $name = strtolower($name); if (isset($this->parts[1])) { $headers = $this->getPart('headers', $this->parts[1]); return isset($headers[$name]) ? $headers[$name] : false; } else { throw new Exception( 's...
php
public function getRawHeader($name) { $name = strtolower($name); if (isset($this->parts[1])) { $headers = $this->getPart('headers', $this->parts[1]); return isset($headers[$name]) ? $headers[$name] : false; } else { throw new Exception( 's...
[ "public", "function", "getRawHeader", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "parts", "[", "1", "]", ")", ")", "{", "$", "headers", "=", "$", "this", "...
Retrieve a specific Email Header, without charset conversion. @param string $name Header name (case-insensitive) @return string|bool @throws Exception
[ "Retrieve", "a", "specific", "Email", "Header", "without", "charset", "conversion", "." ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L230-L242
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getHeader
public function getHeader($name) { $rawHeader = $this->getRawHeader($name); if ($rawHeader === false) { return false; } return $this->decodeHeader($rawHeader); }
php
public function getHeader($name) { $rawHeader = $this->getRawHeader($name); if ($rawHeader === false) { return false; } return $this->decodeHeader($rawHeader); }
[ "public", "function", "getHeader", "(", "$", "name", ")", "{", "$", "rawHeader", "=", "$", "this", "->", "getRawHeader", "(", "$", "name", ")", ";", "if", "(", "$", "rawHeader", "===", "false", ")", "{", "return", "false", ";", "}", "return", "$", ...
Retrieve a specific Email Header @param string $name Header name (case-insensitive) @return string|bool
[ "Retrieve", "a", "specific", "Email", "Header" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L251-L259
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getHeaders
public function getHeaders() { if (isset($this->parts[1])) { $headers = $this->getPart('headers', $this->parts[1]); foreach ($headers as $name => &$value) { if (is_array($value)) { foreach ($value as &$v) { $v = $this->decod...
php
public function getHeaders() { if (isset($this->parts[1])) { $headers = $this->getPart('headers', $this->parts[1]); foreach ($headers as $name => &$value) { if (is_array($value)) { foreach ($value as &$v) { $v = $this->decod...
[ "public", "function", "getHeaders", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "parts", "[", "1", "]", ")", ")", "{", "$", "headers", "=", "$", "this", "->", "getPart", "(", "'headers'", ",", "$", "this", "->", "parts", "[", "1", ...
Retrieve all mail headers @return array @throws Exception
[ "Retrieve", "all", "mail", "headers" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L267-L287
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartHeader
protected function getPartHeader(&$part) { $header = ''; if ($this->stream) { $header = $this->getPartHeaderFromFile($part); } elseif ($this->data) { $header = $this->getPartHeaderFromText($part); } return $header; }
php
protected function getPartHeader(&$part) { $header = ''; if ($this->stream) { $header = $this->getPartHeaderFromFile($part); } elseif ($this->data) { $header = $this->getPartHeaderFromText($part); } return $header; }
[ "protected", "function", "getPartHeader", "(", "&", "$", "part", ")", "{", "$", "header", "=", "''", ";", "if", "(", "$", "this", "->", "stream", ")", "{", "$", "header", "=", "$", "this", "->", "getPartHeaderFromFile", "(", "$", "part", ")", ";", ...
Retrieve the raw Header of a MIME part @return String @param $part Object @throws Exception
[ "Retrieve", "the", "raw", "Header", "of", "a", "MIME", "part" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L313-L322
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartHeaderFromFile
protected function getPartHeaderFromFile(&$part) { $start = $part['starting-pos']; $end = $part['starting-pos-body']; fseek($this->stream, $start, SEEK_SET); $header = fread($this->stream, $end - $start); return $header; }
php
protected function getPartHeaderFromFile(&$part) { $start = $part['starting-pos']; $end = $part['starting-pos-body']; fseek($this->stream, $start, SEEK_SET); $header = fread($this->stream, $end - $start); return $header; }
[ "protected", "function", "getPartHeaderFromFile", "(", "&", "$", "part", ")", "{", "$", "start", "=", "$", "part", "[", "'starting-pos'", "]", ";", "$", "end", "=", "$", "part", "[", "'starting-pos-body'", "]", ";", "fseek", "(", "$", "this", "->", "st...
Retrieve the Header from a MIME part from file @return String Mime Header Part @param $part Array
[ "Retrieve", "the", "Header", "from", "a", "MIME", "part", "from", "file" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L330-L337
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartHeaderFromText
protected function getPartHeaderFromText(&$part) { $start = $part['starting-pos']; $end = $part['starting-pos-body']; $header = substr($this->data, $start, $end - $start); return $header; }
php
protected function getPartHeaderFromText(&$part) { $start = $part['starting-pos']; $end = $part['starting-pos-body']; $header = substr($this->data, $start, $end - $start); return $header; }
[ "protected", "function", "getPartHeaderFromText", "(", "&", "$", "part", ")", "{", "$", "start", "=", "$", "part", "[", "'starting-pos'", "]", ";", "$", "end", "=", "$", "part", "[", "'starting-pos-body'", "]", ";", "$", "header", "=", "substr", "(", "...
Retrieve the Header from a MIME part from text @return String Mime Header Part @param $part Array
[ "Retrieve", "the", "Header", "from", "a", "MIME", "part", "from", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L345-L351
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.partIdIsChildOfPart
protected function partIdIsChildOfPart($partId, $parentPartId) { $parentPartId = $parentPartId.'.'; return substr($partId, 0, strlen($parentPartId)) == $parentPartId; }
php
protected function partIdIsChildOfPart($partId, $parentPartId) { $parentPartId = $parentPartId.'.'; return substr($partId, 0, strlen($parentPartId)) == $parentPartId; }
[ "protected", "function", "partIdIsChildOfPart", "(", "$", "partId", ",", "$", "parentPartId", ")", "{", "$", "parentPartId", "=", "$", "parentPartId", ".", "'.'", ";", "return", "substr", "(", "$", "partId", ",", "0", ",", "strlen", "(", "$", "parentPartId...
Checks whether a given part ID is a child of another part eg. an RFC822 attachment may have one or more text parts @param string $partId @param string $parentPartId @return bool
[ "Checks", "whether", "a", "given", "part", "ID", "is", "a", "child", "of", "another", "part", "eg", ".", "an", "RFC822", "attachment", "may", "have", "one", "or", "more", "text", "parts" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L361-L365
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.partIdIsChildOfAnAttachment
protected function partIdIsChildOfAnAttachment($checkPartId) { foreach ($this->parts as $partId => $part) { if ($this->getPart('content-disposition', $part) == 'attachment') { if ($this->partIdIsChildOfPart($checkPartId, $partId)) { return true; ...
php
protected function partIdIsChildOfAnAttachment($checkPartId) { foreach ($this->parts as $partId => $part) { if ($this->getPart('content-disposition', $part) == 'attachment') { if ($this->partIdIsChildOfPart($checkPartId, $partId)) { return true; ...
[ "protected", "function", "partIdIsChildOfAnAttachment", "(", "$", "checkPartId", ")", "{", "foreach", "(", "$", "this", "->", "parts", "as", "$", "partId", "=>", "$", "part", ")", "{", "if", "(", "$", "this", "->", "getPart", "(", "'content-disposition'", ...
Whether the given part ID is a child of any attachment part in the message. @param string $checkPartId @return bool
[ "Whether", "the", "given", "part", "ID", "is", "a", "child", "of", "any", "attachment", "part", "in", "the", "message", "." ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L373-L383
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getMessageBody
public function getMessageBody($type = 'text') { $mime_types = [ 'text' => 'text/plain', 'html' => 'text/html', 'htmlEmbedded' => 'text/html', ]; if (in_array($type, array_keys($mime_types))) { $part_type = $type === 'htmlEmbed...
php
public function getMessageBody($type = 'text') { $mime_types = [ 'text' => 'text/plain', 'html' => 'text/html', 'htmlEmbedded' => 'text/html', ]; if (in_array($type, array_keys($mime_types))) { $part_type = $type === 'htmlEmbed...
[ "public", "function", "getMessageBody", "(", "$", "type", "=", "'text'", ")", "{", "$", "mime_types", "=", "[", "'text'", "=>", "'text/plain'", ",", "'html'", "=>", "'text/html'", ",", "'htmlEmbedded'", "=>", "'text/html'", ",", "]", ";", "if", "(", "in_ar...
Returns the email message body in the specified format @param string $type text, html or htmlEmbedded @return string Body @throws Exception
[ "Returns", "the", "email", "message", "body", "in", "the", "specified", "format" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L393-L425
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getEmbeddedData
protected function getEmbeddedData($contentId) { foreach ($this->parts as $part) { if ($this->getPart('content-id', $part) == $contentId) { $embeddedData = 'data:'; $embeddedData .= $this->getPart('content-type', $part); $embeddedData .= ';'.$this-...
php
protected function getEmbeddedData($contentId) { foreach ($this->parts as $part) { if ($this->getPart('content-id', $part) == $contentId) { $embeddedData = 'data:'; $embeddedData .= $this->getPart('content-type', $part); $embeddedData .= ';'.$this-...
[ "protected", "function", "getEmbeddedData", "(", "$", "contentId", ")", "{", "foreach", "(", "$", "this", "->", "parts", "as", "$", "part", ")", "{", "if", "(", "$", "this", "->", "getPart", "(", "'content-id'", ",", "$", "part", ")", "==", "$", "con...
Returns the embedded data structure @param string $contentId Content-Id @return string
[ "Returns", "the", "embedded", "data", "structure" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L434-L446
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getAddresses
public function getAddresses($name) { $value = $this->getRawHeader($name); $value = (is_array($value)) ? $value[0] : $value; $addresses = mailparse_rfc822_parse_addresses($value); foreach ($addresses as $i => $item) { $addresses[$i]['display'] = $this->decodeHeader($item[...
php
public function getAddresses($name) { $value = $this->getRawHeader($name); $value = (is_array($value)) ? $value[0] : $value; $addresses = mailparse_rfc822_parse_addresses($value); foreach ($addresses as $i => $item) { $addresses[$i]['display'] = $this->decodeHeader($item[...
[ "public", "function", "getAddresses", "(", "$", "name", ")", "{", "$", "value", "=", "$", "this", "->", "getRawHeader", "(", "$", "name", ")", ";", "$", "value", "=", "(", "is_array", "(", "$", "value", ")", ")", "?", "$", "value", "[", "0", "]",...
Return an array with the following keys display, address, is_group @param string $name Header name (case-insensitive) @return array
[ "Return", "an", "array", "with", "the", "following", "keys", "display", "address", "is_group" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L455-L464
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getInlineParts
public function getInlineParts($type = 'text') { $inline_parts = []; $mime_types = [ 'text' => 'text/plain', 'html' => 'text/html', ]; if (!in_array($type, array_keys($mime_types))) { throw new Exception('Invalid type specified for...
php
public function getInlineParts($type = 'text') { $inline_parts = []; $mime_types = [ 'text' => 'text/plain', 'html' => 'text/html', ]; if (!in_array($type, array_keys($mime_types))) { throw new Exception('Invalid type specified for...
[ "public", "function", "getInlineParts", "(", "$", "type", "=", "'text'", ")", "{", "$", "inline_parts", "=", "[", "]", ";", "$", "mime_types", "=", "[", "'text'", "=>", "'text/plain'", ",", "'html'", "=>", "'text/html'", ",", "]", ";", "if", "(", "!", ...
Returns the attachments contents in order of appearance @return Attachment[]
[ "Returns", "the", "attachments", "contents", "in", "order", "of", "appearance" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L471-L497
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.saveAttachments
public function saveAttachments( $attach_dir, $include_inline = true, $filenameStrategy = self::ATTACHMENT_DUPLICATE_SUFFIX ) { $attachments = $this->getAttachments($include_inline); $attachments_paths = []; foreach ($attachments as $attachment) { $attach...
php
public function saveAttachments( $attach_dir, $include_inline = true, $filenameStrategy = self::ATTACHMENT_DUPLICATE_SUFFIX ) { $attachments = $this->getAttachments($include_inline); $attachments_paths = []; foreach ($attachments as $attachment) { $attach...
[ "public", "function", "saveAttachments", "(", "$", "attach_dir", ",", "$", "include_inline", "=", "true", ",", "$", "filenameStrategy", "=", "self", "::", "ATTACHMENT_DUPLICATE_SUFFIX", ")", "{", "$", "attachments", "=", "$", "this", "->", "getAttachments", "(",...
Save attachments in a folder @param string $attach_dir directory @param bool $include_inline @param string $filenameStrategy How to generate attachment filenames @return array Saved attachments paths @throws Exception
[ "Save", "attachments", "in", "a", "folder" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L575-L588
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getAttachmentStream
protected function getAttachmentStream(&$part) { /** @var resource $temp_fp */ $temp_fp = tmpfile(); $headers = $this->getPart('headers', $part); $encodingType = array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : ''; ...
php
protected function getAttachmentStream(&$part) { /** @var resource $temp_fp */ $temp_fp = tmpfile(); $headers = $this->getPart('headers', $part); $encodingType = array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : ''; ...
[ "protected", "function", "getAttachmentStream", "(", "&", "$", "part", ")", "{", "/** @var resource $temp_fp */", "$", "temp_fp", "=", "tmpfile", "(", ")", ";", "$", "headers", "=", "$", "this", "->", "getPart", "(", "'headers'", ",", "$", "part", ")", ";"...
Read the attachment Body and save temporary file resource @param array $part @return resource Mime Body Part @throws Exception
[ "Read", "the", "attachment", "Body", "and", "save", "temporary", "file", "resource" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L598-L632
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.decodeContentTransfer
protected function decodeContentTransfer($encodedString, $encodingType) { if (is_array($encodingType)) { $encodingType = $encodingType[0]; } $encodingType = strtolower($encodingType); if ($encodingType == 'base64') { return base64_decode($encodedString); ...
php
protected function decodeContentTransfer($encodedString, $encodingType) { if (is_array($encodingType)) { $encodingType = $encodingType[0]; } $encodingType = strtolower($encodingType); if ($encodingType == 'base64') { return base64_decode($encodedString); ...
[ "protected", "function", "decodeContentTransfer", "(", "$", "encodedString", ",", "$", "encodingType", ")", "{", "if", "(", "is_array", "(", "$", "encodingType", ")", ")", "{", "$", "encodingType", "=", "$", "encodingType", "[", "0", "]", ";", "}", "$", ...
Decode the string from Content-Transfer-Encoding @param string $encodedString The string in its original encoded state @param string $encodingType The encoding type from the Content-Transfer-Encoding header of the part. @return string The decoded string
[ "Decode", "the", "string", "from", "Content", "-", "Transfer", "-", "Encoding" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L642-L656
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.decodeHeader
protected function decodeHeader($input) { //Sometimes we have 2 label From so we take only the first if (is_array($input)) { return $this->decodeSingleHeader($input[0]); } return $this->decodeSingleHeader($input); }
php
protected function decodeHeader($input) { //Sometimes we have 2 label From so we take only the first if (is_array($input)) { return $this->decodeSingleHeader($input[0]); } return $this->decodeSingleHeader($input); }
[ "protected", "function", "decodeHeader", "(", "$", "input", ")", "{", "//Sometimes we have 2 label From so we take only the first", "if", "(", "is_array", "(", "$", "input", ")", ")", "{", "return", "$", "this", "->", "decodeSingleHeader", "(", "$", "input", "[", ...
$input can be a string or array @param string|array $input @return string
[ "$input", "can", "be", "a", "string", "or", "array" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L665-L673
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.decodeSingleHeader
protected function decodeSingleHeader($input) { // For each encoded-word... while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)((\s+)=\?)?/i', $input, $matches)) { $encoded = $matches[1]; $charset = $matches[2]; $encoding = $matches[3]; $text = $matche...
php
protected function decodeSingleHeader($input) { // For each encoded-word... while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)((\s+)=\?)?/i', $input, $matches)) { $encoded = $matches[1]; $charset = $matches[2]; $encoding = $matches[3]; $text = $matche...
[ "protected", "function", "decodeSingleHeader", "(", "$", "input", ")", "{", "// For each encoded-word...", "while", "(", "preg_match", "(", "'/(=\\?([^?]+)\\?(q|b)\\?([^?]*)\\?=)((\\s+)=\\?)?/i'", ",", "$", "input", ",", "$", "matches", ")", ")", "{", "$", "encoded", ...
Decodes a single header (= string) @param string $input @return string
[ "Decodes", "a", "single", "header", "(", "=", "string", ")" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L682-L711
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartBody
protected function getPartBody(&$part) { $body = ''; if ($this->stream) { $body = $this->getPartBodyFromFile($part); } elseif ($this->data) { $body = $this->getPartBodyFromText($part); } return $body; }
php
protected function getPartBody(&$part) { $body = ''; if ($this->stream) { $body = $this->getPartBodyFromFile($part); } elseif ($this->data) { $body = $this->getPartBodyFromText($part); } return $body; }
[ "protected", "function", "getPartBody", "(", "&", "$", "part", ")", "{", "$", "body", "=", "''", ";", "if", "(", "$", "this", "->", "stream", ")", "{", "$", "body", "=", "$", "this", "->", "getPartBodyFromFile", "(", "$", "part", ")", ";", "}", "...
Retrieve the Body of a MIME part @param array $part @return string
[ "Retrieve", "the", "Body", "of", "a", "MIME", "part" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L749-L759
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartBodyFromFile
protected function getPartBodyFromFile(&$part) { $start = $part['starting-pos-body']; $end = $part['ending-pos-body']; $body = ''; if ($end - $start > 0) { fseek($this->stream, $start, SEEK_SET); $body = fread($this->stream, $end - $start); } ...
php
protected function getPartBodyFromFile(&$part) { $start = $part['starting-pos-body']; $end = $part['ending-pos-body']; $body = ''; if ($end - $start > 0) { fseek($this->stream, $start, SEEK_SET); $body = fread($this->stream, $end - $start); } ...
[ "protected", "function", "getPartBodyFromFile", "(", "&", "$", "part", ")", "{", "$", "start", "=", "$", "part", "[", "'starting-pos-body'", "]", ";", "$", "end", "=", "$", "part", "[", "'ending-pos-body'", "]", ";", "$", "body", "=", "''", ";", "if", ...
Retrieve the Body from a MIME part from file @param array $part @return string Mime Body Part
[ "Retrieve", "the", "Body", "from", "a", "MIME", "part", "from", "file" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L768-L779
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartBodyFromText
protected function getPartBodyFromText(&$part) { $start = $part['starting-pos-body']; $end = $part['ending-pos-body']; return substr($this->data, $start, $end - $start); }
php
protected function getPartBodyFromText(&$part) { $start = $part['starting-pos-body']; $end = $part['ending-pos-body']; return substr($this->data, $start, $end - $start); }
[ "protected", "function", "getPartBodyFromText", "(", "&", "$", "part", ")", "{", "$", "start", "=", "$", "part", "[", "'starting-pos-body'", "]", ";", "$", "end", "=", "$", "part", "[", "'ending-pos-body'", "]", ";", "return", "substr", "(", "$", "this",...
Retrieve the Body from a MIME part from text @param array $part @return string Mime Body Part
[ "Retrieve", "the", "Body", "from", "a", "MIME", "part", "from", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L788-L794
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartComplete
protected function getPartComplete(&$part) { $body = ''; if ($this->stream) { $body = $this->getPartFromFile($part); } elseif ($this->data) { $body = $this->getPartFromText($part); } return $body; }
php
protected function getPartComplete(&$part) { $body = ''; if ($this->stream) { $body = $this->getPartFromFile($part); } elseif ($this->data) { $body = $this->getPartFromText($part); } return $body; }
[ "protected", "function", "getPartComplete", "(", "&", "$", "part", ")", "{", "$", "body", "=", "''", ";", "if", "(", "$", "this", "->", "stream", ")", "{", "$", "body", "=", "$", "this", "->", "getPartFromFile", "(", "$", "part", ")", ";", "}", "...
Retrieve the content of a MIME part @param array $part @return string
[ "Retrieve", "the", "content", "of", "a", "MIME", "part" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L803-L813
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.getPartFromText
protected function getPartFromText(&$part) { $start = $part['starting-pos']; $end = $part['ending-pos']; return substr($this->data, $start, $end - $start); }
php
protected function getPartFromText(&$part) { $start = $part['starting-pos']; $end = $part['ending-pos']; return substr($this->data, $start, $end - $start); }
[ "protected", "function", "getPartFromText", "(", "&", "$", "part", ")", "{", "$", "start", "=", "$", "part", "[", "'starting-pos'", "]", ";", "$", "end", "=", "$", "part", "[", "'ending-pos'", "]", ";", "return", "substr", "(", "$", "this", "->", "da...
Retrieve the content from a MIME part from text @param array $part @return string Mime Content
[ "Retrieve", "the", "content", "from", "a", "MIME", "part", "from", "text" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L842-L848
php-mime-mail-parser/php-mime-mail-parser
src/Parser.php
Parser.addMiddleware
public function addMiddleware(callable $middleware) { if (!$middleware instanceof Middleware) { $middleware = new Middleware($middleware); } $this->middlewareStack = $this->middlewareStack->add($middleware); }
php
public function addMiddleware(callable $middleware) { if (!$middleware instanceof Middleware) { $middleware = new Middleware($middleware); } $this->middlewareStack = $this->middlewareStack->add($middleware); }
[ "public", "function", "addMiddleware", "(", "callable", "$", "middleware", ")", "{", "if", "(", "!", "$", "middleware", "instanceof", "Middleware", ")", "{", "$", "middleware", "=", "new", "Middleware", "(", "$", "middleware", ")", ";", "}", "$", "this", ...
Add a middleware to the parser MiddlewareStack Each middleware is invoked when: a MimePart is retrieved by mailparse_msg_get_part_data() during $this->parse() The middleware will receive MimePart $part and the next MiddlewareStack $next Eg: $Parser->addMiddleware(function(MimePart $part, MiddlewareStack $next) { // d...
[ "Add", "a", "middleware", "to", "the", "parser", "MiddlewareStack", "Each", "middleware", "is", "invoked", "when", ":", "a", "MimePart", "is", "retrieved", "by", "mailparse_msg_get_part_data", "()", "during", "$this", "-", ">", "parse", "()", "The", "middleware"...
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Parser.php#L916-L922
php-mime-mail-parser/php-mime-mail-parser
src/MiddlewareStack.php
MiddlewareStack.parse
public function parse(MimePart $part) { if (!$this->middleware) { return $part; } $part = call_user_func(array($this->middleware, 'parse'), $part, $this->next); return $part; }
php
public function parse(MimePart $part) { if (!$this->middleware) { return $part; } $part = call_user_func(array($this->middleware, 'parse'), $part, $this->next); return $part; }
[ "public", "function", "parse", "(", "MimePart", "$", "part", ")", "{", "if", "(", "!", "$", "this", "->", "middleware", ")", "{", "return", "$", "part", ";", "}", "$", "part", "=", "call_user_func", "(", "array", "(", "$", "this", "->", "middleware",...
Parses the MimePart by passing it through the Middleware @param MimePart $part @return MimePart
[ "Parses", "the", "MimePart", "by", "passing", "it", "through", "the", "Middleware" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/MiddlewareStack.php#L55-L62
php-mime-mail-parser/php-mime-mail-parser
src/MiddlewareStack.php
MiddlewareStack.factory
public static function factory(array $middlewares = array()) { $stack = new static; foreach ($middlewares as $middleware) { $stack = $stack->add($middleware); } return $stack; }
php
public static function factory(array $middlewares = array()) { $stack = new static; foreach ($middlewares as $middleware) { $stack = $stack->add($middleware); } return $stack; }
[ "public", "static", "function", "factory", "(", "array", "$", "middlewares", "=", "array", "(", ")", ")", "{", "$", "stack", "=", "new", "static", ";", "foreach", "(", "$", "middlewares", "as", "$", "middleware", ")", "{", "$", "stack", "=", "$", "st...
Creates a MiddlewareStack based on an array of middleware @param Middleware[] $middlewares @return MiddlewareStack
[ "Creates", "a", "MiddlewareStack", "based", "on", "an", "array", "of", "middleware" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/MiddlewareStack.php#L70-L77
php-mime-mail-parser/php-mime-mail-parser
src/Charset.php
Charset.decodeCharset
public function decodeCharset($encodedString, $charset) { $charset = $this->getCharsetAlias($charset); if ($charset == 'utf-8' || $charset == 'us-ascii') { return $encodedString; } if (function_exists('mb_convert_encoding')) { if ($charset == 'iso-2022-jp') ...
php
public function decodeCharset($encodedString, $charset) { $charset = $this->getCharsetAlias($charset); if ($charset == 'utf-8' || $charset == 'us-ascii') { return $encodedString; } if (function_exists('mb_convert_encoding')) { if ($charset == 'iso-2022-jp') ...
[ "public", "function", "decodeCharset", "(", "$", "encodedString", ",", "$", "charset", ")", "{", "$", "charset", "=", "$", "this", "->", "getCharsetAlias", "(", "$", "charset", ")", ";", "if", "(", "$", "charset", "==", "'utf-8'", "||", "$", "charset", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Charset.php#L316-L335
php-mime-mail-parser/php-mime-mail-parser
src/Charset.php
Charset.getCharsetAlias
public function getCharsetAlias($charset) { $charset = strtolower($charset); if (array_key_exists($charset, $this->charsetAlias)) { return $this->charsetAlias[$charset]; } return 'us-ascii'; }
php
public function getCharsetAlias($charset) { $charset = strtolower($charset); if (array_key_exists($charset, $this->charsetAlias)) { return $this->charsetAlias[$charset]; } return 'us-ascii'; }
[ "public", "function", "getCharsetAlias", "(", "$", "charset", ")", "{", "$", "charset", "=", "strtolower", "(", "$", "charset", ")", ";", "if", "(", "array_key_exists", "(", "$", "charset", ",", "$", "this", "->", "charsetAlias", ")", ")", "{", "return",...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-mime-mail-parser/php-mime-mail-parser/blob/c28096ea39a23041d17092cc64cb032291592eb1/src/Charset.php#L340-L349
silexphp/Pimple
src/Pimple/Psr11/ServiceLocator.php
ServiceLocator.get
public function get($id) { if (!isset($this->aliases[$id])) { throw new UnknownIdentifierException($id); } return $this->container[$this->aliases[$id]]; }
php
public function get($id) { if (!isset($this->aliases[$id])) { throw new UnknownIdentifierException($id); } return $this->container[$this->aliases[$id]]; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "aliases", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "UnknownIdentifierException", "(", "$", "id", ")", ";", "}", "return", "$", "th...
{@inheritdoc}
[ "{" ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Psr11/ServiceLocator.php#L59-L66
silexphp/Pimple
src/Pimple/Psr11/ServiceLocator.php
ServiceLocator.has
public function has($id) { return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); }
php
public function has($id) { return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); }
[ "public", "function", "has", "(", "$", "id", ")", "{", "return", "isset", "(", "$", "this", "->", "aliases", "[", "$", "id", "]", ")", "&&", "isset", "(", "$", "this", "->", "container", "[", "$", "this", "->", "aliases", "[", "$", "id", "]", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Psr11/ServiceLocator.php#L71-L74
silexphp/Pimple
src/Pimple/Container.php
Container.offsetSet
public function offsetSet($id, $value) { if (isset($this->frozen[$id])) { throw new FrozenServiceException($id); } $this->values[$id] = $value; $this->keys[$id] = true; }
php
public function offsetSet($id, $value) { if (isset($this->frozen[$id])) { throw new FrozenServiceException($id); } $this->values[$id] = $value; $this->keys[$id] = true; }
[ "public", "function", "offsetSet", "(", "$", "id", ",", "$", "value", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "frozen", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "FrozenServiceException", "(", "$", "id", ")", ";", "}", "$"...
Sets a parameter or an object. Objects must be defined as Closures. Allowing any PHP callable leads to difficult to debug problems as function names (strings) are callable (creating a function with the same name as an existing parameter would break your container). @param string $id The unique identifier for the ...
[ "Sets", "a", "parameter", "or", "an", "object", "." ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Container.php#L79-L87
silexphp/Pimple
src/Pimple/Container.php
Container.offsetGet
public function offsetGet($id) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if ( isset($this->raw[$id]) || !\is_object($this->values[$id]) || isset($this->protected[$this->values[$id]]) || !\method...
php
public function offsetGet($id) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if ( isset($this->raw[$id]) || !\is_object($this->values[$id]) || isset($this->protected[$this->values[$id]]) || !\method...
[ "public", "function", "offsetGet", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "UnknownIdentifierException", "(", "$", "id", ")", ";", "}", "if", "(", "iss...
Gets a parameter or an object. @param string $id The unique identifier for the parameter or object @return mixed The value of the parameter or an object @throws UnknownIdentifierException If the identifier is not defined
[ "Gets", "a", "parameter", "or", "an", "object", "." ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Container.php#L98-L124
silexphp/Pimple
src/Pimple/Container.php
Container.raw
public function raw($id) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if (isset($this->raw[$id])) { return $this->raw[$id]; } return $this->values[$id]; }
php
public function raw($id) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if (isset($this->raw[$id])) { return $this->raw[$id]; } return $this->values[$id]; }
[ "public", "function", "raw", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "UnknownIdentifierException", "(", "$", "id", ")", ";", "}", "if", "(", "isset", ...
Gets a parameter or the closure defining an object. @param string $id The unique identifier for the parameter or object @return mixed The value of the parameter or the closure defining an object @throws UnknownIdentifierException If the identifier is not defined
[ "Gets", "a", "parameter", "or", "the", "closure", "defining", "an", "object", "." ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Container.php#L205-L216
silexphp/Pimple
src/Pimple/Container.php
Container.extend
public function extend($id, $callable) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if (isset($this->frozen[$id])) { throw new FrozenServiceException($id); } if (!\is_object($this->values[$id]) || !\method_exists($th...
php
public function extend($id, $callable) { if (!isset($this->keys[$id])) { throw new UnknownIdentifierException($id); } if (isset($this->frozen[$id])) { throw new FrozenServiceException($id); } if (!\is_object($this->values[$id]) || !\method_exists($th...
[ "public", "function", "extend", "(", "$", "id", ",", "$", "callable", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "UnknownIdentifierException", "(", "$", "id", ")", ";", "...
Extends an object definition. Useful when you want to extend an existing object definition, without necessarily loading that object. @param string $id The unique identifier for the object @param callable $callable A service definition to extend the original @return callable The wrapped callable @throws Unkn...
[ "Extends", "an", "object", "definition", "." ]
train
https://github.com/silexphp/Pimple/blob/21e3e0dc89183c96fad7f12e09e1d345558e9a56/src/Pimple/Container.php#L234-L268
scheb/two-factor-bundle
Model/Persister/DoctrinePersister.php
DoctrinePersister.persist
public function persist($user): void { $this->om->persist($user); $this->om->flush(); }
php
public function persist($user): void { $this->om->persist($user); $this->om->flush(); }
[ "public", "function", "persist", "(", "$", "user", ")", ":", "void", "{", "$", "this", "->", "om", "->", "persist", "(", "$", "user", ")", ";", "$", "this", "->", "om", "->", "flush", "(", ")", ";", "}" ]
Persist the user entity. @param object $user
[ "Persist", "the", "user", "entity", "." ]
train
https://github.com/scheb/two-factor-bundle/blob/1c980ec1ac71cbdd0d0dc93e0888747774a43786/Model/Persister/DoctrinePersister.php#L32-L36
la-haute-societe/yii2-save-relations-behavior
src/SaveRelationsBehavior.php
SaveRelationsBehavior.canSetProperty
public function canSetProperty($name, $checkVars = true) { /** @var BaseActiveRecord $owner */ $owner = $this->owner; $relation = $owner->getRelation($name, false); if (in_array($name, $this->_relations) && !is_null($relation)) { return true; } return pare...
php
public function canSetProperty($name, $checkVars = true) { /** @var BaseActiveRecord $owner */ $owner = $this->owner; $relation = $owner->getRelation($name, false); if (in_array($name, $this->_relations) && !is_null($relation)) { return true; } return pare...
[ "public", "function", "canSetProperty", "(", "$", "name", ",", "$", "checkVars", "=", "true", ")", "{", "/** @var BaseActiveRecord $owner */", "$", "owner", "=", "$", "this", "->", "owner", ";", "$", "relation", "=", "$", "owner", "->", "getRelation", "(", ...
Override canSetProperty method to be able to detect if a relation setter is allowed. Setter is allowed if the relation is declared in the `relations` parameter @param string $name @param boolean $checkVars @return boolean
[ "Override", "canSetProperty", "method", "to", "be", "able", "to", "detect", "if", "a", "relation", "setter", "is", "allowed", ".", "Setter", "is", "allowed", "if", "the", "relation", "is", "declared", "in", "the", "relations", "parameter" ]
train
https://github.com/la-haute-societe/yii2-save-relations-behavior/blob/1afd088dbf20fa110389b14986c7ac777fcbbd60/src/SaveRelationsBehavior.php#L107-L116
la-haute-societe/yii2-save-relations-behavior
src/SaveRelationsBehavior.php
SaveRelationsBehavior.setSingleRelation
protected function setSingleRelation($relationName, $value) { /** @var BaseActiveRecord $owner */ $owner = $this->owner; /** @var ActiveQuery $relation */ $relation = $owner->getRelation($relationName); if (!($value instanceof $relation->modelClass)) { $value = $t...
php
protected function setSingleRelation($relationName, $value) { /** @var BaseActiveRecord $owner */ $owner = $this->owner; /** @var ActiveQuery $relation */ $relation = $owner->getRelation($relationName); if (!($value instanceof $relation->modelClass)) { $value = $t...
[ "protected", "function", "setSingleRelation", "(", "$", "relationName", ",", "$", "value", ")", "{", "/** @var BaseActiveRecord $owner */", "$", "owner", "=", "$", "this", "->", "owner", ";", "/** @var ActiveQuery $relation */", "$", "relation", "=", "$", "owner", ...
Set the named single relation with the given value @param string $relationName @param $value @throws \yii\base\InvalidArgumentException
[ "Set", "the", "named", "single", "relation", "with", "the", "given", "value" ]
train
https://github.com/la-haute-societe/yii2-save-relations-behavior/blob/1afd088dbf20fa110389b14986c7ac777fcbbd60/src/SaveRelationsBehavior.php#L158-L169