repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.getListItems | protected function getListItems( \Aimeos\MShop\Context\Item\Iface $context, array $custIds )
{
$listManager = \Aimeos\MShop::create( $context, 'customer/lists' );
$search = $listManager->createSearch();
$expr = array(
$search->compare( '==', 'customer.lists.domain', 'product' ),
$search->compare( '==', 'customer.lists.parentid', $custIds ),
$search->compare( '==', 'customer.lists.type', 'watch' ),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, 0x7fffffff );
return $listManager->searchItems( $search );
} | php | protected function getListItems( \Aimeos\MShop\Context\Item\Iface $context, array $custIds )
{
$listManager = \Aimeos\MShop::create( $context, 'customer/lists' );
$search = $listManager->createSearch();
$expr = array(
$search->compare( '==', 'customer.lists.domain', 'product' ),
$search->compare( '==', 'customer.lists.parentid', $custIds ),
$search->compare( '==', 'customer.lists.type', 'watch' ),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, 0x7fffffff );
return $listManager->searchItems( $search );
} | [
"protected",
"function",
"getListItems",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"array",
"$",
"custIds",
")",
"{",
"$",
"listManager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"("... | Returns the list items for the given customer IDs and list type ID
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param array $custIds List of customer IDs
@return array List of customer list items implementing \Aimeos\MShop\Common\Item\Lists\Iface | [
"Returns",
"the",
"list",
"items",
"for",
"the",
"given",
"customer",
"IDs",
"and",
"list",
"type",
"ID"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L191-L205 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.getProductList | protected function getProductList( array $products, array $listItems )
{
$result = [];
$priceManager = \Aimeos\MShop::create( $this->getContext(), 'price' );
foreach( $listItems as $id => $listItem )
{
try
{
$refId = $listItem->getRefId();
$config = $listItem->getConfig();
if( isset( $products[$refId] ) )
{
$prices = $products[$refId]->getRefItems( 'price', 'default', 'default' );
$currencyId = ( isset( $config['currency'] ) ? $config['currency'] : null );
$price = $priceManager->getLowestPrice( $prices, 1, $currencyId );
if( isset( $config['stock'] ) && $config['stock'] == 1 ||
isset( $config['price'] ) && $config['price'] == 1 &&
isset( $config['pricevalue'] ) && $config['pricevalue'] > $price->getValue()
) {
$result[$id]['item'] = $products[$refId];
$result[$id]['currencyId'] = $currencyId;
$result[$id]['price'] = $price;
}
}
}
catch( \Exception $e ) { ; } // no price available
}
return $result;
} | php | protected function getProductList( array $products, array $listItems )
{
$result = [];
$priceManager = \Aimeos\MShop::create( $this->getContext(), 'price' );
foreach( $listItems as $id => $listItem )
{
try
{
$refId = $listItem->getRefId();
$config = $listItem->getConfig();
if( isset( $products[$refId] ) )
{
$prices = $products[$refId]->getRefItems( 'price', 'default', 'default' );
$currencyId = ( isset( $config['currency'] ) ? $config['currency'] : null );
$price = $priceManager->getLowestPrice( $prices, 1, $currencyId );
if( isset( $config['stock'] ) && $config['stock'] == 1 ||
isset( $config['price'] ) && $config['price'] == 1 &&
isset( $config['pricevalue'] ) && $config['pricevalue'] > $price->getValue()
) {
$result[$id]['item'] = $products[$refId];
$result[$id]['currencyId'] = $currencyId;
$result[$id]['price'] = $price;
}
}
}
catch( \Exception $e ) { ; } // no price available
}
return $result;
} | [
"protected",
"function",
"getProductList",
"(",
"array",
"$",
"products",
",",
"array",
"$",
"listItems",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"priceManager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"(",
"$",
"this",
"->",
"get... | Returns a filtered list of products for which a notification should be sent
@param \Aimeos\MShop\Product\Item\Iface[] $products List of product items
@param \Aimeos\MShop\Common\Item\Lists\Iface[] $listItems List of customer list items
@return array Multi-dimensional associative list of list IDs as key and product / price item maps as values | [
"Returns",
"a",
"filtered",
"list",
"of",
"products",
"for",
"which",
"a",
"notification",
"should",
"be",
"sent"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L215-L248 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.getProducts | protected function getProducts( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $stockType )
{
$productCodes = $stockMap = [];
$productItems = $this->getProductItems( $context, $prodIds );
foreach( $productItems as $productItem ) {
$productCodes[] = $productItem->getCode();
}
foreach( $this->getStockItems( $context, $productCodes, $stockType ) as $stockItem ) {
$stockMap[ $stockItem->getProductCode() ] = true;
}
foreach( $productItems as $productId => $productItem )
{
if( !isset( $stockMap[ $productItem->getCode() ] ) ) {
unset( $productItems[$productId] );
}
}
return $productItems;
} | php | protected function getProducts( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $stockType )
{
$productCodes = $stockMap = [];
$productItems = $this->getProductItems( $context, $prodIds );
foreach( $productItems as $productItem ) {
$productCodes[] = $productItem->getCode();
}
foreach( $this->getStockItems( $context, $productCodes, $stockType ) as $stockItem ) {
$stockMap[ $stockItem->getProductCode() ] = true;
}
foreach( $productItems as $productId => $productItem )
{
if( !isset( $stockMap[ $productItem->getCode() ] ) ) {
unset( $productItems[$productId] );
}
}
return $productItems;
} | [
"protected",
"function",
"getProducts",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"array",
"$",
"prodIds",
",",
"$",
"stockType",
")",
"{",
"$",
"productCodes",
"=",
"$",
"stockMap",
"=",
"[",
... | Returns the products for the given IDs which are in stock
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param array $prodIds List of product IDs
@param string $stockType Stock type code | [
"Returns",
"the",
"products",
"for",
"the",
"given",
"IDs",
"which",
"are",
"in",
"stock"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L258-L279 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.getProductItems | protected function getProductItems( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds )
{
$productManager = \Aimeos\MShop::create( $context, 'product' );
$search = $productManager->createSearch( true );
$expr = array(
$search->compare( '==', 'product.id', $prodIds ),
$search->getConditions(),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, count( $prodIds ) );
return $productManager->searchItems( $search, array( 'text', 'price', 'media' ) );
} | php | protected function getProductItems( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds )
{
$productManager = \Aimeos\MShop::create( $context, 'product' );
$search = $productManager->createSearch( true );
$expr = array(
$search->compare( '==', 'product.id', $prodIds ),
$search->getConditions(),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, count( $prodIds ) );
return $productManager->searchItems( $search, array( 'text', 'price', 'media' ) );
} | [
"protected",
"function",
"getProductItems",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"array",
"$",
"prodIds",
")",
"{",
"$",
"productManager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",... | Returns the product items for the given product IDs
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param array $prodIds List of product IDs | [
"Returns",
"the",
"product",
"items",
"for",
"the",
"given",
"product",
"IDs"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L288-L301 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.getStockItems | protected function getStockItems( \Aimeos\MShop\Context\Item\Iface $context, array $prodCodes, $stockType )
{
$stockManager = \Aimeos\MShop::create( $context, 'stock' );
$search = $stockManager->createSearch( true );
$expr = array(
$search->compare( '==', 'stock.productcode', $prodCodes ),
$search->compare( '==', 'stock.type', $stockType ),
$search->combine( '||', array(
$search->compare( '==', 'stock.stocklevel', null ),
$search->compare( '>', 'stock.stocklevel', 0 ),
)),
$search->getConditions(),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, 100000 ); // performance speedup
return $stockManager->searchItems( $search );
} | php | protected function getStockItems( \Aimeos\MShop\Context\Item\Iface $context, array $prodCodes, $stockType )
{
$stockManager = \Aimeos\MShop::create( $context, 'stock' );
$search = $stockManager->createSearch( true );
$expr = array(
$search->compare( '==', 'stock.productcode', $prodCodes ),
$search->compare( '==', 'stock.type', $stockType ),
$search->combine( '||', array(
$search->compare( '==', 'stock.stocklevel', null ),
$search->compare( '>', 'stock.stocklevel', 0 ),
)),
$search->getConditions(),
);
$search->setConditions( $search->combine( '&&', $expr ) );
$search->setSlice( 0, 100000 ); // performance speedup
return $stockManager->searchItems( $search );
} | [
"protected",
"function",
"getStockItems",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"array",
"$",
"prodCodes",
",",
"$",
"stockType",
")",
"{",
"$",
"stockManager",
"=",
"\\",
"Aimeos",
"\\",
"... | Returns the stock items for the given product codes
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param array $prodCodes List of product codes
@param string $stockType Stock type code | [
"Returns",
"the",
"stock",
"items",
"for",
"the",
"given",
"product",
"codes"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L311-L329 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php | Standard.sendMail | protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context,
\Aimeos\MShop\Common\Item\Address\Iface $address, array $products )
{
$view = $context->getView();
$view->extProducts = $products;
$view->extAddressItem = $address;
$params = [
'locale' => $context->getLocale()->getLanguageId(),
'site' => $context->getLocale()->getSite()->getCode(),
];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | php | protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context,
\Aimeos\MShop\Common\Item\Address\Iface $address, array $products )
{
$view = $context->getView();
$view->extProducts = $products;
$view->extAddressItem = $address;
$params = [
'locale' => $context->getLocale()->getLanguageId(),
'site' => $context->getLocale()->getSite()->getCode(),
];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | [
"protected",
"function",
"sendMail",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Common",
"\\",
"Item",
"\\",
"Address",
"\\",
"Iface",
"$",
"address",
",",
... | Sends the notification e-mail for the given customer address and products
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address of the customer
@param array $products List of products a notification should be sent for | [
"Sends",
"the",
"notification",
"e",
"-",
"mail",
"for",
"the",
"given",
"customer",
"address",
"and",
"products"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Watch/Standard.php#L339-L369 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Payment/Standard.php | Standard.process | protected function process( \Aimeos\Client\Html\Iface $client, array $items, $status )
{
$context = $this->getContext();
$orderBaseManager = \Aimeos\MShop::create( $context, 'order/base' );
foreach( $items as $id => $item )
{
try
{
$orderBaseItem = $orderBaseManager->load( $item->getBaseId() );
$addr = $this->getAddressItem( $orderBaseItem );
$this->processItem( $client, $item, $orderBaseItem, $addr );
$this->addOrderStatus( $id, $status );
$str = sprintf( 'Sent order payment e-mail for status "%1$s" to "%2$s"', $status, $addr->getEmail() );
$context->getLogger()->log( $str, \Aimeos\MW\Logger\Base::INFO );
}
catch( \Exception $e )
{
$str = 'Error while trying to send payment e-mail for order ID "%1$s" and status "%2$s": %3$s';
$msg = sprintf( $str, $item->getId(), $item->getPaymentStatus(), $e->getMessage() );
$context->getLogger()->log( $msg );
}
}
} | php | protected function process( \Aimeos\Client\Html\Iface $client, array $items, $status )
{
$context = $this->getContext();
$orderBaseManager = \Aimeos\MShop::create( $context, 'order/base' );
foreach( $items as $id => $item )
{
try
{
$orderBaseItem = $orderBaseManager->load( $item->getBaseId() );
$addr = $this->getAddressItem( $orderBaseItem );
$this->processItem( $client, $item, $orderBaseItem, $addr );
$this->addOrderStatus( $id, $status );
$str = sprintf( 'Sent order payment e-mail for status "%1$s" to "%2$s"', $status, $addr->getEmail() );
$context->getLogger()->log( $str, \Aimeos\MW\Logger\Base::INFO );
}
catch( \Exception $e )
{
$str = 'Error while trying to send payment e-mail for order ID "%1$s" and status "%2$s": %3$s';
$msg = sprintf( $str, $item->getId(), $item->getPaymentStatus(), $e->getMessage() );
$context->getLogger()->log( $msg );
}
}
} | [
"protected",
"function",
"process",
"(",
"\\",
"Aimeos",
"\\",
"Client",
"\\",
"Html",
"\\",
"Iface",
"$",
"client",
",",
"array",
"$",
"items",
",",
"$",
"status",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
... | Sends the payment e-mail for the given orders
@param \Aimeos\Client\Html\Iface $client HTML client object for rendering the payment e-mails
@param \Aimeos\MShop\Order\Item\Iface[] $items Associative list of order items with their IDs as keys
@param integer $status Delivery status value | [
"Sends",
"the",
"payment",
"e",
"-",
"mail",
"for",
"the",
"given",
"orders"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Payment/Standard.php#L213-L238 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Payment/Standard.php | Standard.processItem | protected function processItem( \Aimeos\Client\Html\Iface $client, \Aimeos\MShop\Order\Item\Iface $orderItem,
\Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem, \Aimeos\MShop\Order\Item\Base\Address\Iface $addrItem )
{
$context = $this->getContext();
$langId = ( $addrItem->getLanguageId() ?: $orderBaseItem->getLocale()->getLanguageId() );
$view = $this->getView( $context, $orderBaseItem, $langId );
$view->extAddressItem = $addrItem;
$view->extOrderBaseItem = $orderBaseItem;
$view->extOrderItem = $orderItem;
$client->setView( $view );
$client->getHeader();
$client->getBody();
$context->getMail()->send( $view->mail() );
} | php | protected function processItem( \Aimeos\Client\Html\Iface $client, \Aimeos\MShop\Order\Item\Iface $orderItem,
\Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem, \Aimeos\MShop\Order\Item\Base\Address\Iface $addrItem )
{
$context = $this->getContext();
$langId = ( $addrItem->getLanguageId() ?: $orderBaseItem->getLocale()->getLanguageId() );
$view = $this->getView( $context, $orderBaseItem, $langId );
$view->extAddressItem = $addrItem;
$view->extOrderBaseItem = $orderBaseItem;
$view->extOrderItem = $orderItem;
$client->setView( $view );
$client->getHeader();
$client->getBody();
$context->getMail()->send( $view->mail() );
} | [
"protected",
"function",
"processItem",
"(",
"\\",
"Aimeos",
"\\",
"Client",
"\\",
"Html",
"\\",
"Iface",
"$",
"client",
",",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Order",
"\\",
"Item",
"\\",
"Iface",
"$",
"orderItem",
",",
"\\",
"Aimeos",
"\\",
"MShop",... | Sends the payment related e-mail for a single order
@param \Aimeos\Client\Html\Iface $client HTML client object for rendering the payment e-mails
@param \Aimeos\MShop\Order\Item\Iface $orderItem Order item the payment related e-mail should be sent for
@param \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem Complete order including addresses, products, services
@param \Aimeos\MShop\Order\Item\Base\Address\Iface $addrItem Address item to send the e-mail to | [
"Sends",
"the",
"payment",
"related",
"e",
"-",
"mail",
"for",
"a",
"single",
"order"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Payment/Standard.php#L249-L265 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Customer/Email/Account/Standard.php | Standard.sendEmail | protected function sendEmail( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $item, $password )
{
$address = $item->getPaymentAddress();
$view = $context->getView();
$view->extAddressItem = $address;
$view->extAccountCode = $item->getCode();
$view->extAccountPassword = $password;
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | php | protected function sendEmail( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $item, $password )
{
$address = $item->getPaymentAddress();
$view = $context->getView();
$view->extAddressItem = $address;
$view->extAccountCode = $item->getCode();
$view->extAccountPassword = $password;
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | [
"protected",
"function",
"sendEmail",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Customer",
"\\",
"Item",
"\\",
"Iface",
"$",
"item",
",",
"$",
"password",
... | Sends the account creation e-mail to the e-mail address of the customer
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
@param string $password Customer clear text password | [
"Sends",
"the",
"account",
"creation",
"e",
"-",
"mail",
"to",
"the",
"e",
"-",
"mail",
"address",
"of",
"the",
"customer"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Customer/Email/Account/Standard.php#L112-L136 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Catalog/Count/Tree/Standard.php | Standard.counts | protected function counts( \Aimeos\MShop\Catalog\Item\Iface $node )
{
$list = [$node->getId() => $node->count];
foreach( $node->getChildren() as $child ) {
$list += $this->counts( $child );
}
return $list;
} | php | protected function counts( \Aimeos\MShop\Catalog\Item\Iface $node )
{
$list = [$node->getId() => $node->count];
foreach( $node->getChildren() as $child ) {
$list += $this->counts( $child );
}
return $list;
} | [
"protected",
"function",
"counts",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Catalog",
"\\",
"Item",
"\\",
"Iface",
"$",
"node",
")",
"{",
"$",
"list",
"=",
"[",
"$",
"node",
"->",
"getId",
"(",
")",
"=>",
"$",
"node",
"->",
"count",
"]",
";",
"... | Returns the product counts per node
@param \Aimeos\MShop\Catalog\Item\Iface $node Tree node, maybe with children
@return array Associative list of catalog IDs as keys and product counts as values | [
"Returns",
"the",
"product",
"counts",
"per",
"node"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php#L262-L271 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Catalog/Count/Tree/Standard.php | Standard.traverse | protected function traverse( \Aimeos\MShop\Catalog\Item\Iface $node, array $counts )
{
$count = ( isset( $counts[$node->getId()] ) ? $counts[$node->getId()] : 0 );
foreach( $node->getChildren() as $child ) {
$count += $this->traverse( $child, $counts )->count;
}
$node->count = $count;
return $node;
} | php | protected function traverse( \Aimeos\MShop\Catalog\Item\Iface $node, array $counts )
{
$count = ( isset( $counts[$node->getId()] ) ? $counts[$node->getId()] : 0 );
foreach( $node->getChildren() as $child ) {
$count += $this->traverse( $child, $counts )->count;
}
$node->count = $count;
return $node;
} | [
"protected",
"function",
"traverse",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Catalog",
"\\",
"Item",
"\\",
"Iface",
"$",
"node",
",",
"array",
"$",
"counts",
")",
"{",
"$",
"count",
"=",
"(",
"isset",
"(",
"$",
"counts",
"[",
"$",
"node",
"->",
... | Traverses the tree and adds the aggregated product counts to each node
@param \Aimeos\MShop\Catalog\Item\Iface $node Tree node, maybe with children
@param array $counts Associative list of catalog IDs as keys and product counts as values
@return \Aimeos\MShop\Catalog\Item\Iface Updated tree node | [
"Traverses",
"the",
"tree",
"and",
"adds",
"the",
"aggregated",
"product",
"counts",
"to",
"each",
"node"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php#L281-L291 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Catalog/Attribute/Factory.php | Factory.create | public static function create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
{
/** client/html/catalog/attribute/name
* Class name of the used catalog attribute client implementation
*
* Each default HTML client can be replace by an alternative imlementation.
* To use this implementation, you have to set the last part of the class
* name as configuration value so the client factory knows which class it
* has to instantiate.
*
* For example, if the name of the default class is
*
* \Aimeos\Client\Html\Catalog\Attribute\Standard
*
* and you want to replace it with your own version named
*
* \Aimeos\Client\Html\Catalog\Attribute\Myattribute
*
* then you have to set the this configuration option:
*
* client/html/catalog/attribute/name = Myattribute
*
* The value is the last part of your own class name and it's case sensitive,
* so take care that the configuration value is exactly named like the last
* part of the class name.
*
* The allowed characters of the class name are A-Z, a-z and 0-9. No other
* characters are possible! You should always start the last part of the class
* name with an upper case character and continue only with lower case characters
* or numbers. Avoid chamel case names like "MyAttribute"!
*
* @param string Last part of the class name
* @since 2018.04
* @category Developer
*/
if( $name === null ) {
$name = $context->getConfig()->get( 'client/html/catalog/attribute/name', 'Standard' );
}
if( ctype_alnum( $name ) === false )
{
$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Attribute\\' . $name : '<not a string>';
throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
}
$iface = '\\Aimeos\\Client\\Html\\Iface';
$classname = '\\Aimeos\\Client\\Html\\Catalog\\Attribute\\' . $name;
$client = self::createClient( $context, $classname, $iface );
$client = self::addClientDecorators( $context, $client, 'catalog/attribute' );
return $client->setObject( $client );
} | php | public static function create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
{
/** client/html/catalog/attribute/name
* Class name of the used catalog attribute client implementation
*
* Each default HTML client can be replace by an alternative imlementation.
* To use this implementation, you have to set the last part of the class
* name as configuration value so the client factory knows which class it
* has to instantiate.
*
* For example, if the name of the default class is
*
* \Aimeos\Client\Html\Catalog\Attribute\Standard
*
* and you want to replace it with your own version named
*
* \Aimeos\Client\Html\Catalog\Attribute\Myattribute
*
* then you have to set the this configuration option:
*
* client/html/catalog/attribute/name = Myattribute
*
* The value is the last part of your own class name and it's case sensitive,
* so take care that the configuration value is exactly named like the last
* part of the class name.
*
* The allowed characters of the class name are A-Z, a-z and 0-9. No other
* characters are possible! You should always start the last part of the class
* name with an upper case character and continue only with lower case characters
* or numbers. Avoid chamel case names like "MyAttribute"!
*
* @param string Last part of the class name
* @since 2018.04
* @category Developer
*/
if( $name === null ) {
$name = $context->getConfig()->get( 'client/html/catalog/attribute/name', 'Standard' );
}
if( ctype_alnum( $name ) === false )
{
$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Attribute\\' . $name : '<not a string>';
throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
}
$iface = '\\Aimeos\\Client\\Html\\Iface';
$classname = '\\Aimeos\\Client\\Html\\Catalog\\Attribute\\' . $name;
$client = self::createClient( $context, $classname, $iface );
$client = self::addClientDecorators( $context, $client, 'catalog/attribute' );
return $client->setObject( $client );
} | [
"public",
"static",
"function",
"create",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"$",
"name",
"=",
"null",
")",
"{",
"/** client/html/catalog/attribute/name\n\t\t * Class name of the used catalog attribut... | Creates a attribute client object.
@param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
@param string|null $name Client name (default: "Standard")
@return \Aimeos\Client\Html\Iface Attribute part implementing \Aimeos\Client\Html\Iface
@throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails | [
"Creates",
"a",
"attribute",
"client",
"object",
"."
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Catalog/Attribute/Factory.php#L32-L84 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Basket/Standard/Standard.php | Standard.addCoupon | protected function addCoupon( \Aimeos\MW\View\Iface $view )
{
if( ( $coupon = $view->param( 'b_coupon' ) ) != '' )
{
\Aimeos\Controller\Frontend::create( $this->getContext(), 'basket' )->addCoupon( $coupon );
$this->clearCached();
}
} | php | protected function addCoupon( \Aimeos\MW\View\Iface $view )
{
if( ( $coupon = $view->param( 'b_coupon' ) ) != '' )
{
\Aimeos\Controller\Frontend::create( $this->getContext(), 'basket' )->addCoupon( $coupon );
$this->clearCached();
}
} | [
"protected",
"function",
"addCoupon",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"if",
"(",
"(",
"$",
"coupon",
"=",
"$",
"view",
"->",
"param",
"(",
"'b_coupon'",
")",
")",
"!=",
"''",
")",
"{",
"\\",
"A... | Adds the coupon specified by the view parameters from the basket.
@param \Aimeos\MW\View\Iface $view View object | [
"Adds",
"the",
"coupon",
"specified",
"by",
"the",
"view",
"parameters",
"from",
"the",
"basket",
"."
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Basket/Standard/Standard.php#L434-L441 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Catalog/Base.php | Base.getStockUrl | protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $products )
{
/** client/html/catalog/stock/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$target = $view->config( 'client/html/catalog/stock/url/target' );
/** client/html/catalog/stock/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$cntl = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' );
/** client/html/catalog/stock/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$action = $view->config( 'client/html/catalog/stock/url/action', 'stock' );
/** client/html/catalog/stock/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/max-items
*/
$config = $view->config( 'client/html/catalog/stock/url/config', [] );
/** client/html/catalog/stock/url/max-items
* Maximum number of product stock levels per request
*
* To avoid URLs that exceed the maximum amount of characters (usually 8190),
* each request contains only up to the configured amount of product codes.
* If more product codes are available, several requests will be sent to the
* server.
*
* @param integer Maximum number of product codes per request
* @since 2018.10
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
*/
$max = $view->config( 'client/html/catalog/stock/url/max-items', 100 );
$codes = [];
foreach( $products as $product ) {
$codes[] = $product->getCode();
}
sort( $codes );
$urls = [];
while( ( $list = array_splice( $codes, -$max ) ) !== [] ) {
$urls[] = $view->url( $target, $cntl, $action, array( "s_prodcode" => $list ), [], $config );
}
return array_reverse( $urls );
} | php | protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $products )
{
/** client/html/catalog/stock/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$target = $view->config( 'client/html/catalog/stock/url/target' );
/** client/html/catalog/stock/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$cntl = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' );
/** client/html/catalog/stock/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/config
* @see client/html/catalog/stock/url/max-items
*/
$action = $view->config( 'client/html/catalog/stock/url/action', 'stock' );
/** client/html/catalog/stock/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/max-items
*/
$config = $view->config( 'client/html/catalog/stock/url/config', [] );
/** client/html/catalog/stock/url/max-items
* Maximum number of product stock levels per request
*
* To avoid URLs that exceed the maximum amount of characters (usually 8190),
* each request contains only up to the configured amount of product codes.
* If more product codes are available, several requests will be sent to the
* server.
*
* @param integer Maximum number of product codes per request
* @since 2018.10
* @category Developer
* @see client/html/catalog/stock/url/target
* @see client/html/catalog/stock/url/controller
* @see client/html/catalog/stock/url/action
* @see client/html/catalog/stock/url/config
*/
$max = $view->config( 'client/html/catalog/stock/url/max-items', 100 );
$codes = [];
foreach( $products as $product ) {
$codes[] = $product->getCode();
}
sort( $codes );
$urls = [];
while( ( $list = array_splice( $codes, -$max ) ) !== [] ) {
$urls[] = $view->url( $target, $cntl, $action, array( "s_prodcode" => $list ), [], $config );
}
return array_reverse( $urls );
} | [
"protected",
"function",
"getStockUrl",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"array",
"$",
"products",
")",
"{",
"/** client/html/catalog/stock/url/target\n\t\t * Destination of the URL where the controller specified in the URL is kn... | Returns the URL for retrieving the stock levels
@param \Aimeos\MW\View\Iface $view View instance with helper
@param \Aimeos\MShop\Product\Item\Iface[] List of products with their IDs as keys
@return string URL to retrieve the stock levels for the given products | [
"Returns",
"the",
"URL",
"for",
"retrieving",
"the",
"stock",
"levels"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Catalog/Base.php#L31-L140 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Checkout/Standard/Standard.php | Standard.addNavigationUrls | protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep )
{
/** client/html/checkout/standard/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/action
* @see client/html/checkout/standard/url/config
*/
$cTarget = $view->config( 'client/html/checkout/standard/url/target' );
/** client/html/checkout/standard/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/action
* @see client/html/checkout/standard/url/config
*/
$cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' );
/** client/html/checkout/standard/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/config
*/
$cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' );
/** client/html/checkout/standard/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/action
* @see client/html/url/config
*/
$cConfig = $view->config( 'client/html/checkout/standard/url/config', [] );
$bTarget = $view->config( 'client/html/basket/standard/url/target' );
$bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' );
$bAction = $view->config( 'client/html/basket/standard/url/action', 'index' );
$bConfig = $view->config( 'client/html/basket/standard/url/config', [] );
$step = null;
do {
$lastStep = $step;
}
while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep );
if( $lastStep !== null ) {
$param = array( 'c_step' => $lastStep );
$view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, [], $cConfig );
} else {
$view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, [], [], $bConfig );
}
if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) {
$param = array( 'c_step' => $nextStep );
$view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, [], $cConfig );
}
// don't overwrite $view->standardUrlNext so process step URL is used
return $view;
} | php | protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep )
{
/** client/html/checkout/standard/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/action
* @see client/html/checkout/standard/url/config
*/
$cTarget = $view->config( 'client/html/checkout/standard/url/target' );
/** client/html/checkout/standard/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/action
* @see client/html/checkout/standard/url/config
*/
$cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' );
/** client/html/checkout/standard/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/config
*/
$cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' );
/** client/html/checkout/standard/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/url/target
* @see client/html/checkout/standard/url/controller
* @see client/html/checkout/standard/url/action
* @see client/html/url/config
*/
$cConfig = $view->config( 'client/html/checkout/standard/url/config', [] );
$bTarget = $view->config( 'client/html/basket/standard/url/target' );
$bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' );
$bAction = $view->config( 'client/html/basket/standard/url/action', 'index' );
$bConfig = $view->config( 'client/html/basket/standard/url/config', [] );
$step = null;
do {
$lastStep = $step;
}
while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep );
if( $lastStep !== null ) {
$param = array( 'c_step' => $lastStep );
$view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, [], $cConfig );
} else {
$view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, [], [], $bConfig );
}
if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) {
$param = array( 'c_step' => $nextStep );
$view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, [], $cConfig );
}
// don't overwrite $view->standardUrlNext so process step URL is used
return $view;
} | [
"protected",
"function",
"addNavigationUrls",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"array",
"$",
"steps",
",",
"$",
"activeStep",
")",
"{",
"/** client/html/checkout/standard/url/target\n\t\t * Destination of the URL where the ... | Adds the "back" and "next" URLs to the view
@param \Aimeos\MW\View\Iface $view View object
@param array $steps List of checkout step names
@param unknown $activeStep Name of the active step
@return \Aimeos\MW\View\Iface Enhanced view object
@since 2016.05 | [
"Adds",
"the",
"back",
"and",
"next",
"URLs",
"to",
"the",
"view"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Checkout/Standard/Standard.php#L505-L606 | train |
aimeos/ai-client-html | controller/common/src/Controller/Common/Subscription/Process/Processor/Email/Standard.php | Standard.end | public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
{
$context = $this->getContext();
$manager = \Aimeos\MShop::create( $context, 'order/base' );
$baseItem = $manager->getItem( $subscription->getOrderBaseId(), ['order/base/address', 'order/base/product'] );
$addrItem = $baseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 0 );
foreach( $baseItem->getProducts() as $orderProduct )
{
if( $orderProduct->getId() == $subscription->getOrderProductId() ) {
$this->sendMail( $context, $subscription, $addrItem, $orderProduct );
}
}
} | php | public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
{
$context = $this->getContext();
$manager = \Aimeos\MShop::create( $context, 'order/base' );
$baseItem = $manager->getItem( $subscription->getOrderBaseId(), ['order/base/address', 'order/base/product'] );
$addrItem = $baseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 0 );
foreach( $baseItem->getProducts() as $orderProduct )
{
if( $orderProduct->getId() == $subscription->getOrderProductId() ) {
$this->sendMail( $context, $subscription, $addrItem, $orderProduct );
}
}
} | [
"public",
"function",
"end",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Subscription",
"\\",
"Item",
"\\",
"Iface",
"$",
"subscription",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"manager",
"=",
"\\",
"Aimeos",... | Processes the end of the subscription
@param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item | [
"Processes",
"the",
"end",
"of",
"the",
"subscription"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/common/src/Controller/Common/Subscription/Process/Processor/Email/Standard.php#L41-L56 | train |
aimeos/ai-client-html | controller/common/src/Controller/Common/Subscription/Process/Processor/Email/Standard.php | Standard.sendMail | protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription,
\Aimeos\MShop\Common\Item\Address\Iface $address, \Aimeos\MShop\Order\Item\Base\Product\Iface $product )
{
$view = $context->getView();
$view->extAddressItem = $address;
$view->extOrderProductItem = $product;
$view->extSubscriptionItem = $subscription;
$params = [
'locale' => $context->getLocale()->getLanguageId(),
'site' => $context->getLocale()->getSite()->getCode(),
];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | php | protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription,
\Aimeos\MShop\Common\Item\Address\Iface $address, \Aimeos\MShop\Order\Item\Base\Product\Iface $product )
{
$view = $context->getView();
$view->extAddressItem = $address;
$view->extOrderProductItem = $product;
$view->extSubscriptionItem = $subscription;
$params = [
'locale' => $context->getLocale()->getLanguageId(),
'site' => $context->getLocale()->getSite()->getCode(),
];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) );
$view->addHelper( 'translate', $helper );
$mailer = $context->getMail();
$message = $mailer->createMessage();
$helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message );
$view->addHelper( 'mail', $helper );
$client = $this->getClient( $context );
$client->setView( $view );
$client->getHeader();
$client->getBody();
$mailer->send( $message );
} | [
"protected",
"function",
"sendMail",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Context",
"\\",
"Item",
"\\",
"Iface",
"$",
"context",
",",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Subscription",
"\\",
"Item",
"\\",
"Iface",
"$",
"subscription",
",",
"\\",
... | Sends the subscription e-mail for the given customer address and products
@param \Aimeos\MShop\Context\Item\Iface $context Context item object
@param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
@param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address of the customer
@param \Aimeos\MShop\Order\Item\Base\Product\Iface $product Subscription product the notification should be sent for | [
"Sends",
"the",
"subscription",
"e",
"-",
"mail",
"for",
"the",
"given",
"customer",
"address",
"and",
"products"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/common/src/Controller/Common/Subscription/Process/Processor/Email/Standard.php#L83-L114 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.addCouponCodes | protected function addCouponCodes( array $map )
{
$couponId = $this->getCouponId();
$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' );
foreach( $map as $code => $ref )
{
$item = $manager->createItem()->setParentId( $couponId )
->setCode( $code )->setRef( $ref )->setCount( null ); // unlimited
$manager->saveItem( $item );
}
} | php | protected function addCouponCodes( array $map )
{
$couponId = $this->getCouponId();
$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' );
foreach( $map as $code => $ref )
{
$item = $manager->createItem()->setParentId( $couponId )
->setCode( $code )->setRef( $ref )->setCount( null ); // unlimited
$manager->saveItem( $item );
}
} | [
"protected",
"function",
"addCouponCodes",
"(",
"array",
"$",
"map",
")",
"{",
"$",
"couponId",
"=",
"$",
"this",
"->",
"getCouponId",
"(",
")",
";",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"(",
"$",
"this",
"->",
"getContex... | Saves the given coupon codes
@param array $map Associative list of coupon codes as keys and reference Ids as values | [
"Saves",
"the",
"given",
"coupon",
"codes"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L139-L151 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.addOrderStatus | protected function addOrderStatus( $orderId, $value )
{
$orderStatusManager = \Aimeos\MShop::create( $this->getContext(), 'order/status' );
$statusItem = $orderStatusManager->createItem()->setParentId( $orderId )->setValue( $value )
->setType( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_VOUCHER );
$orderStatusManager->saveItem( $statusItem );
} | php | protected function addOrderStatus( $orderId, $value )
{
$orderStatusManager = \Aimeos\MShop::create( $this->getContext(), 'order/status' );
$statusItem = $orderStatusManager->createItem()->setParentId( $orderId )->setValue( $value )
->setType( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_VOUCHER );
$orderStatusManager->saveItem( $statusItem );
} | [
"protected",
"function",
"addOrderStatus",
"(",
"$",
"orderId",
",",
"$",
"value",
")",
"{",
"$",
"orderStatusManager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"(",
"$",
"this",
"->",
"getContext",
"(",
")",
",",
"'order/status'",
")",
";",
"... | Adds the status of the delivered e-mail for the given order ID
@param string $orderId Unique order ID
@param integer $value Status value | [
"Adds",
"the",
"status",
"of",
"the",
"delivered",
"e",
"-",
"mail",
"for",
"the",
"given",
"order",
"ID"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L160-L168 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.getCouponId | protected function getCouponId()
{
if( !isset( $this->couponId ) )
{
$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );
$search = $manager->createSearch()->setSlice( 0, 1 );
$search->setConditions( $search->compare( '=~', 'coupon.provider', 'Voucher' ) );
$items = $manager->searchItems( $search );
if( ( $item = reset( $items ) ) === false ) {
throw new \Aimeos\Controller\Jobs\Exception( 'No coupon provider "Voucher" available' );
}
$this->couponId = $item->getId();
}
return $this->couponId;
} | php | protected function getCouponId()
{
if( !isset( $this->couponId ) )
{
$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );
$search = $manager->createSearch()->setSlice( 0, 1 );
$search->setConditions( $search->compare( '=~', 'coupon.provider', 'Voucher' ) );
$items = $manager->searchItems( $search );
if( ( $item = reset( $items ) ) === false ) {
throw new \Aimeos\Controller\Jobs\Exception( 'No coupon provider "Voucher" available' );
}
$this->couponId = $item->getId();
}
return $this->couponId;
} | [
"protected",
"function",
"getCouponId",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"couponId",
")",
")",
"{",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
"::",
"create",
"(",
"$",
"this",
"->",
"getContext",
"(",
")",
"... | Returns the coupon ID for the voucher coupon
@return string Unique ID of the coupon item | [
"Returns",
"the",
"coupon",
"ID",
"for",
"the",
"voucher",
"coupon"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L204-L223 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.process | protected function process( \Aimeos\Client\Html\Iface $client, array $items, $status )
{
$context = $this->getContext();
$orderBaseManager = \Aimeos\MShop::create( $context, 'order/base' );
foreach( $items as $id => $item )
{
try
{
$orderBaseItem = $orderBaseManager->load( $item->getBaseId() )->off();
$orderBaseItem = $this->createCoupons( $orderBaseItem );
$orderBaseManager->store( $orderBaseItem );
$this->sendEmails( $orderBaseItem, $client );
$this->addOrderStatus( $id, $status );
$str = sprintf( 'Sent voucher e-mails for order ID "%1$s"', $item->getId() );
$context->getLogger()->log( $str, \Aimeos\MW\Logger\Base::INFO );
}
catch( \Exception $e )
{
$str = 'Error while trying to send voucher e-mails for order ID "%1$s": %2$s';
$msg = sprintf( $str, $item->getId(), $e->getMessage() );
$context->getLogger()->log( $msg );
}
}
} | php | protected function process( \Aimeos\Client\Html\Iface $client, array $items, $status )
{
$context = $this->getContext();
$orderBaseManager = \Aimeos\MShop::create( $context, 'order/base' );
foreach( $items as $id => $item )
{
try
{
$orderBaseItem = $orderBaseManager->load( $item->getBaseId() )->off();
$orderBaseItem = $this->createCoupons( $orderBaseItem );
$orderBaseManager->store( $orderBaseItem );
$this->sendEmails( $orderBaseItem, $client );
$this->addOrderStatus( $id, $status );
$str = sprintf( 'Sent voucher e-mails for order ID "%1$s"', $item->getId() );
$context->getLogger()->log( $str, \Aimeos\MW\Logger\Base::INFO );
}
catch( \Exception $e )
{
$str = 'Error while trying to send voucher e-mails for order ID "%1$s": %2$s';
$msg = sprintf( $str, $item->getId(), $e->getMessage() );
$context->getLogger()->log( $msg );
}
}
} | [
"protected",
"function",
"process",
"(",
"\\",
"Aimeos",
"\\",
"Client",
"\\",
"Html",
"\\",
"Iface",
"$",
"client",
",",
"array",
"$",
"items",
",",
"$",
"status",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
... | Sends the voucher e-mail for the given orders
@param \Aimeos\Client\Html\Iface $client HTML client object for rendering the voucher e-mails
@param \Aimeos\MShop\Order\Item\Iface[] $items Associative list of order items with their IDs as keys
@param integer $status Delivery status value | [
"Sends",
"the",
"voucher",
"e",
"-",
"mail",
"for",
"the",
"given",
"orders"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L260-L287 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.createCoupons | protected function createCoupons( \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem )
{
$map = [];
$manager = \Aimeos\MShop::create( $this->getContext(), 'order/base/product/attribute' );
foreach( $orderBaseItem->getProducts() as $pos => $orderProductItem )
{
if( $orderProductItem->getType() === 'voucher'
&& $orderProductItem->getAttribute( 'coupon-code', 'coupon' ) === null
) {
$codes = [];
for( $i = 0; $i < $orderProductItem->getQuantity(); $i++ )
{
$str = $i . getmypid() . microtime( true ) . $orderProductItem->getId();
$code = substr( strtoupper( sha1( $str ) ), -8 );
$map[$code] = $orderProductItem->getId();
$codes[] = $code;
}
$item = $manager->createItem()->setCode( 'coupon-code' )->setType( 'coupon' )->setValue( $codes );
$orderBaseItem->addProduct( $orderProductItem->setAttributeItem( $item ), $pos );
}
}
$this->addCouponCodes( $map );
return $orderBaseItem;
} | php | protected function createCoupons( \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem )
{
$map = [];
$manager = \Aimeos\MShop::create( $this->getContext(), 'order/base/product/attribute' );
foreach( $orderBaseItem->getProducts() as $pos => $orderProductItem )
{
if( $orderProductItem->getType() === 'voucher'
&& $orderProductItem->getAttribute( 'coupon-code', 'coupon' ) === null
) {
$codes = [];
for( $i = 0; $i < $orderProductItem->getQuantity(); $i++ )
{
$str = $i . getmypid() . microtime( true ) . $orderProductItem->getId();
$code = substr( strtoupper( sha1( $str ) ), -8 );
$map[$code] = $orderProductItem->getId();
$codes[] = $code;
}
$item = $manager->createItem()->setCode( 'coupon-code' )->setType( 'coupon' )->setValue( $codes );
$orderBaseItem->addProduct( $orderProductItem->setAttributeItem( $item ), $pos );
}
}
$this->addCouponCodes( $map );
return $orderBaseItem;
} | [
"protected",
"function",
"createCoupons",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Order",
"\\",
"Item",
"\\",
"Base",
"\\",
"Iface",
"$",
"orderBaseItem",
")",
"{",
"$",
"map",
"=",
"[",
"]",
";",
"$",
"manager",
"=",
"\\",
"Aimeos",
"\\",
"MShop",
... | Creates coupon codes for the bought vouchers
@param \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem Complete order including addresses, products, services | [
"Creates",
"coupon",
"codes",
"for",
"the",
"bought",
"vouchers"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L295-L322 | train |
aimeos/ai-client-html | controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php | Standard.sendEmails | protected function sendEmails( \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem, \Aimeos\Client\Html\Iface $client )
{
$context = $this->getContext();
$addrItem = $this->getAddressItem( $orderBaseItem );
$currencyId = $orderBaseItem->getPrice()->getCurrencyId();
$langId = ( $addrItem->getLanguageId() ?: $orderBaseItem->getLocale()->getLanguageId() );
$view = $this->getView( $context, $orderBaseItem->getSiteCode(), $currencyId, $langId );
foreach( $orderBaseItem->getProducts() as $orderProductItem )
{
if( $orderProductItem->getType() === 'voucher'
&& ( $codes = $orderProductItem->getAttribute( 'coupon-code', 'coupon' ) ) !== null
) {
foreach( (array) $codes as $code )
{
$message = $context->getMail()->createMessage();
$view->addHelper( 'mail', new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ) );
$view->extOrderProductItem = $orderProductItem;
$view->extAddressItem = $addrItem;
$view->extVoucherCode = $code;
$client->setView( $view );
$client->getHeader();
$client->getBody();
$context->getMail()->send( $view->mail() );
}
}
}
} | php | protected function sendEmails( \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem, \Aimeos\Client\Html\Iface $client )
{
$context = $this->getContext();
$addrItem = $this->getAddressItem( $orderBaseItem );
$currencyId = $orderBaseItem->getPrice()->getCurrencyId();
$langId = ( $addrItem->getLanguageId() ?: $orderBaseItem->getLocale()->getLanguageId() );
$view = $this->getView( $context, $orderBaseItem->getSiteCode(), $currencyId, $langId );
foreach( $orderBaseItem->getProducts() as $orderProductItem )
{
if( $orderProductItem->getType() === 'voucher'
&& ( $codes = $orderProductItem->getAttribute( 'coupon-code', 'coupon' ) ) !== null
) {
foreach( (array) $codes as $code )
{
$message = $context->getMail()->createMessage();
$view->addHelper( 'mail', new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ) );
$view->extOrderProductItem = $orderProductItem;
$view->extAddressItem = $addrItem;
$view->extVoucherCode = $code;
$client->setView( $view );
$client->getHeader();
$client->getBody();
$context->getMail()->send( $view->mail() );
}
}
}
} | [
"protected",
"function",
"sendEmails",
"(",
"\\",
"Aimeos",
"\\",
"MShop",
"\\",
"Order",
"\\",
"Item",
"\\",
"Base",
"\\",
"Iface",
"$",
"orderBaseItem",
",",
"\\",
"Aimeos",
"\\",
"Client",
"\\",
"Html",
"\\",
"Iface",
"$",
"client",
")",
"{",
"$",
"... | Sends the voucher related e-mail for a single order
@param \Aimeos\MShop\Order\Item\Base\Iface $orderBaseItem Complete order including addresses, products, services
@param \Aimeos\Client\Html\Iface $client HTML client object for rendering the voucher e-mails | [
"Sends",
"the",
"voucher",
"related",
"e",
"-",
"mail",
"for",
"a",
"single",
"order"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/controller/jobs/src/Controller/Jobs/Order/Email/Voucher/Standard.php#L331-L362 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Account/Watch/Standard.php | Standard.deleteItems | protected function deleteItems( \Aimeos\MW\View\Iface $view, array $ids )
{
$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' );
$item = $cntl->uses( ['product' => ['watch']] )->get();
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'watch', $id ) ) !== null ) {
$cntl->deleteListItem( 'product', $listItem );
}
}
$cntl->store();
} | php | protected function deleteItems( \Aimeos\MW\View\Iface $view, array $ids )
{
$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' );
$item = $cntl->uses( ['product' => ['watch']] )->get();
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'watch', $id ) ) !== null ) {
$cntl->deleteListItem( 'product', $listItem );
}
}
$cntl->store();
} | [
"protected",
"function",
"deleteItems",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"array",
"$",
"ids",
")",
"{",
"$",
"cntl",
"=",
"\\",
"Aimeos",
"\\",
"Controller",
"\\",
"Frontend",
"::",
"create",
"(",
"$",
"... | Removes the referencing list items from the given item
@param \Aimeos\MW\View\Iface $view View object
@param array $ids List of referenced IDs | [
"Removes",
"the",
"referencing",
"list",
"items",
"from",
"the",
"given",
"item"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Account/Watch/Standard.php#L386-L399 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Account/Watch/Standard.php | Standard.editItems | protected function editItems( \Aimeos\MW\View\Iface $view, array $ids )
{
$context = $this->getContext();
$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
$item = $cntl->uses( ['product' => ['watch']] )->get();
$config = [
'timeframe' => $view->param( 'wat_timeframe', 7 ),
'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
'price' => $view->param( 'wat_price', 0 ),
'stock' => $view->param( 'wat_stock', 0 ),
'currency' => $context->getLocale()->getCurrencyId(),
];
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'watch', $id ) ) !== null )
{
$time = time() + ( $config['timeframe'] + 1 ) * 86400;
$listItem = $listItem->setDateEnd( date( 'Y-m-d 00:00:00', $time ) )->setConfig( $config );
$cntl->addListItem( 'product', $listItem );
}
}
$cntl->store();
} | php | protected function editItems( \Aimeos\MW\View\Iface $view, array $ids )
{
$context = $this->getContext();
$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
$item = $cntl->uses( ['product' => ['watch']] )->get();
$config = [
'timeframe' => $view->param( 'wat_timeframe', 7 ),
'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
'price' => $view->param( 'wat_price', 0 ),
'stock' => $view->param( 'wat_stock', 0 ),
'currency' => $context->getLocale()->getCurrencyId(),
];
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'watch', $id ) ) !== null )
{
$time = time() + ( $config['timeframe'] + 1 ) * 86400;
$listItem = $listItem->setDateEnd( date( 'Y-m-d 00:00:00', $time ) )->setConfig( $config );
$cntl->addListItem( 'product', $listItem );
}
}
$cntl->store();
} | [
"protected",
"function",
"editItems",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"array",
"$",
"ids",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"cntl",
"=",
"\\",
"Aimeo... | Updates the item using the given reference IDs
@param \Aimeos\MW\View\Iface $view View object
@param array $ids List of referenced IDs | [
"Updates",
"the",
"item",
"using",
"the",
"given",
"reference",
"IDs"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Account/Watch/Standard.php#L408-L434 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Account/Favorite/Standard.php | Standard.addFavorites | protected function addFavorites( array $ids )
{
$context = $this->getContext();
/** client/html/account/favorite/standard/maxitems
* Maximum number of products that can be favorites
*
* This option limits the number of products users can add to their
* favorite list. It must be a positive integer value greater than 0.
*
* @param integer Number of products
* @since 2019.04
* @category User
* @category Developer
*/
$max = $context->getConfig()->get( 'client/html/account/favorite/standard/maxitems', 100 );
$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
$item = $cntl->uses( ['product' => ['favorite']] )->get();
if( count( $item->getRefItems( 'product', null, 'favorite' ) ) + count( $ids ) > $max )
{
$msg = sprintf( $context->getI18n()->dt( 'client', 'You can only save up to %1$s products as favorites' ), $max );
throw new \Aimeos\Client\Html\Exception( $msg );
}
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'favorite', $id ) ) === null ) {
$listItem = $cntl->createListItem();
}
$cntl->addListItem( 'product', $listItem->setType( 'favorite' )->setRefId( $id ) );
}
$cntl->store();
} | php | protected function addFavorites( array $ids )
{
$context = $this->getContext();
/** client/html/account/favorite/standard/maxitems
* Maximum number of products that can be favorites
*
* This option limits the number of products users can add to their
* favorite list. It must be a positive integer value greater than 0.
*
* @param integer Number of products
* @since 2019.04
* @category User
* @category Developer
*/
$max = $context->getConfig()->get( 'client/html/account/favorite/standard/maxitems', 100 );
$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
$item = $cntl->uses( ['product' => ['favorite']] )->get();
if( count( $item->getRefItems( 'product', null, 'favorite' ) ) + count( $ids ) > $max )
{
$msg = sprintf( $context->getI18n()->dt( 'client', 'You can only save up to %1$s products as favorites' ), $max );
throw new \Aimeos\Client\Html\Exception( $msg );
}
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'favorite', $id ) ) === null ) {
$listItem = $cntl->createListItem();
}
$cntl->addListItem( 'product', $listItem->setType( 'favorite' )->setRefId( $id ) );
}
$cntl->store();
} | [
"protected",
"function",
"addFavorites",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"/** client/html/account/favorite/standard/maxitems\n\t\t * Maximum number of products that can be favorites\n\t\t *\n\t\t * This op... | Adds new product favorite references to the given customer
@param array $ids List of product IDs | [
"Adds",
"new",
"product",
"favorite",
"references",
"to",
"the",
"given",
"customer"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Account/Favorite/Standard.php#L331-L366 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Account/Favorite/Standard.php | Standard.deleteFavorites | protected function deleteFavorites( array $ids )
{
$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' );
$item = $cntl->uses( ['product' => ['favorite']] )->get();
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'favorite', $id ) ) !== null ) {
$cntl->deleteListItem( 'product', $listItem );
}
}
$cntl->store();
} | php | protected function deleteFavorites( array $ids )
{
$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' );
$item = $cntl->uses( ['product' => ['favorite']] )->get();
foreach( $ids as $id )
{
if( ( $listItem = $item->getListItem( 'product', 'favorite', $id ) ) !== null ) {
$cntl->deleteListItem( 'product', $listItem );
}
}
$cntl->store();
} | [
"protected",
"function",
"deleteFavorites",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"cntl",
"=",
"\\",
"Aimeos",
"\\",
"Controller",
"\\",
"Frontend",
"::",
"create",
"(",
"$",
"this",
"->",
"getContext",
"(",
")",
",",
"'customer'",
")",
";",
"$",
"i... | Removes product favorite references from the customer
@param array $ids List of product IDs | [
"Removes",
"product",
"favorite",
"references",
"from",
"the",
"customer"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Account/Favorite/Standard.php#L374-L387 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Account/Favorite/Standard.php | Standard.getProductListPage | protected function getProductListPage( \Aimeos\MW\View\Iface $view )
{
$page = (int) $view->param( 'fav_page', 1 );
return ( $page < 1 ? 1 : $page );
} | php | protected function getProductListPage( \Aimeos\MW\View\Iface $view )
{
$page = (int) $view->param( 'fav_page', 1 );
return ( $page < 1 ? 1 : $page );
} | [
"protected",
"function",
"getProductListPage",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
")",
"{",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"view",
"->",
"param",
"(",
"'fav_page'",
",",
"1",
")",
";",
"return",
"(",
... | Returns the sanitized page from the parameters for the product list.
@param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
@return integer Page number starting from 1 | [
"Returns",
"the",
"sanitized",
"page",
"from",
"the",
"parameters",
"for",
"the",
"product",
"list",
"."
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Account/Favorite/Standard.php#L407-L411 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Catalog/Stock/Standard.php | Standard.getStockItems | protected function getStockItems( array $productCodes )
{
$context = $this->getContext();
/** client/html/catalog/stock/sort
* Sortation key if stock levels for different types exist
*
* Products can be shipped from several warehouses with a different
* stock level for each one. The stock levels for each warehouse will
* be shown in the product detail page. To get a consistent sortation
* of this list, the configured key will be used by the stock manager.
*
* Possible keys for sorting are ("-stock.type" for descending order):
* * stock.productcode
* * stock.stocklevel
* * stock.type
* * stock.dateback
*
* @param array List of key/value pairs for sorting
* @since 2017.01
* @category Developer
* @see client/html/catalog/stock/level/low
*/
$sort = $context->getConfig()->get( 'client/html/catalog/stock/sort', 'stock.type' );
$type = $context->getLocale()->getSite()->getConfigValue( 'stocktype' );
return \Aimeos\Controller\Frontend::create( $context, 'stock' )
->code( $productCodes )->type( $type )->sort( $sort )
->slice( 0, count( $productCodes ) )
->search();
} | php | protected function getStockItems( array $productCodes )
{
$context = $this->getContext();
/** client/html/catalog/stock/sort
* Sortation key if stock levels for different types exist
*
* Products can be shipped from several warehouses with a different
* stock level for each one. The stock levels for each warehouse will
* be shown in the product detail page. To get a consistent sortation
* of this list, the configured key will be used by the stock manager.
*
* Possible keys for sorting are ("-stock.type" for descending order):
* * stock.productcode
* * stock.stocklevel
* * stock.type
* * stock.dateback
*
* @param array List of key/value pairs for sorting
* @since 2017.01
* @category Developer
* @see client/html/catalog/stock/level/low
*/
$sort = $context->getConfig()->get( 'client/html/catalog/stock/sort', 'stock.type' );
$type = $context->getLocale()->getSite()->getConfigValue( 'stocktype' );
return \Aimeos\Controller\Frontend::create( $context, 'stock' )
->code( $productCodes )->type( $type )->sort( $sort )
->slice( 0, count( $productCodes ) )
->search();
} | [
"protected",
"function",
"getStockItems",
"(",
"array",
"$",
"productCodes",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"/** client/html/catalog/stock/sort\n\t\t * Sortation key if stock levels for different types exist\n\t\t *\n\t\t * Produc... | Returns the list of stock items for the given product codes and the stock type
@param array $productCodes List of product codes
@return \Aimeos\MShop\Stock\Item\Iface[] Associative list stock IDs as keys and stock items as values | [
"Returns",
"the",
"list",
"of",
"stock",
"items",
"for",
"the",
"given",
"product",
"codes",
"and",
"the",
"stock",
"type"
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Catalog/Stock/Standard.php#L318-L348 | train |
aimeos/ai-client-html | client/html/src/Client/Html/Checkout/Standard/Process/Standard.php | Standard.getUrlConfirm | protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config )
{
/** client/html/checkout/confirm/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/action
* @see client/html/checkout/confirm/url/config
*/
$target = $view->config( 'client/html/checkout/confirm/url/target' );
/** client/html/checkout/confirm/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/action
* @see client/html/checkout/confirm/url/config
*/
$cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' );
/** client/html/checkout/confirm/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/config
*/
$action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' );
/** client/html/checkout/confirm/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/action
* @see client/html/url/config
*/
$config = $view->config( 'client/html/checkout/confirm/url/config', $config );
return $view->url( $target, $cntl, $action, $params, [], $config );
} | php | protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config )
{
/** client/html/checkout/confirm/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/action
* @see client/html/checkout/confirm/url/config
*/
$target = $view->config( 'client/html/checkout/confirm/url/target' );
/** client/html/checkout/confirm/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/action
* @see client/html/checkout/confirm/url/config
*/
$cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' );
/** client/html/checkout/confirm/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/config
*/
$action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' );
/** client/html/checkout/confirm/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/checkout/confirm/url/target
* @see client/html/checkout/confirm/url/controller
* @see client/html/checkout/confirm/url/action
* @see client/html/url/config
*/
$config = $view->config( 'client/html/checkout/confirm/url/config', $config );
return $view->url( $target, $cntl, $action, $params, [], $config );
} | [
"protected",
"function",
"getUrlConfirm",
"(",
"\\",
"Aimeos",
"\\",
"MW",
"\\",
"View",
"\\",
"Iface",
"$",
"view",
",",
"array",
"$",
"params",
",",
"array",
"$",
"config",
")",
"{",
"/** client/html/checkout/confirm/url/target\n\t\t * Destination of the URL where t... | Returns the URL to the confirm page.
@param \Aimeos\MW\View\Iface $view View object
@param array $params Parameters that should be part of the URL
@param array $config Default URL configuration
@return string URL string | [
"Returns",
"the",
"URL",
"to",
"the",
"confirm",
"page",
"."
] | 06738c091041e959f7ddc4674acdb1f1b18474c3 | https://github.com/aimeos/ai-client-html/blob/06738c091041e959f7ddc4674acdb1f1b18474c3/client/html/src/Client/Html/Checkout/Standard/Process/Standard.php#L380-L454 | train |
vmelnik-ukraine/DoctrineEncryptBundle | Subscribers/DoctrineEncryptSubscriber.php | DoctrineEncryptSubscriber.preUpdate | public function preUpdate(PreUpdateEventArgs $args) {
$reflectionClass = new ReflectionClass($args->getEntity());
$properties = $reflectionClass->getProperties();
foreach ($properties as $refProperty) {
if ($this->annReader->getPropertyAnnotation($refProperty, self::ENCRYPTED_ANN_NAME)) {
$propName = $refProperty->getName();
$args->setNewValue($propName, $this->encryptor->encrypt($args->getNewValue($propName)));
}
}
} | php | public function preUpdate(PreUpdateEventArgs $args) {
$reflectionClass = new ReflectionClass($args->getEntity());
$properties = $reflectionClass->getProperties();
foreach ($properties as $refProperty) {
if ($this->annReader->getPropertyAnnotation($refProperty, self::ENCRYPTED_ANN_NAME)) {
$propName = $refProperty->getName();
$args->setNewValue($propName, $this->encryptor->encrypt($args->getNewValue($propName)));
}
}
} | [
"public",
"function",
"preUpdate",
"(",
"PreUpdateEventArgs",
"$",
"args",
")",
"{",
"$",
"reflectionClass",
"=",
"new",
"ReflectionClass",
"(",
"$",
"args",
"->",
"getEntity",
"(",
")",
")",
";",
"$",
"properties",
"=",
"$",
"reflectionClass",
"->",
"getPro... | Listen a preUpdate lifecycle event. Checking and encrypt entities fields
which have @Encrypted annotation. Using changesets to avoid preUpdate event
restrictions
@param PreUpdateEventArgs $args | [
"Listen",
"a",
"preUpdate",
"lifecycle",
"event",
".",
"Checking",
"and",
"encrypt",
"entities",
"fields",
"which",
"have"
] | a209d3669fe092c9801b71e35e82dec6bcce1225 | https://github.com/vmelnik-ukraine/DoctrineEncryptBundle/blob/a209d3669fe092c9801b71e35e82dec6bcce1225/Subscribers/DoctrineEncryptSubscriber.php#L80-L89 | train |
vmelnik-ukraine/DoctrineEncryptBundle | Subscribers/DoctrineEncryptSubscriber.php | DoctrineEncryptSubscriber.postLoad | public function postLoad(LifecycleEventArgs $args) {
$entity = $args->getEntity();
if (!$this->hasInDecodedRegistry($entity, $args->getEntityManager())) {
if ($this->processFields($entity, false)) {
$this->addToDecodedRegistry($entity, $args->getEntityManager());
}
}
} | php | public function postLoad(LifecycleEventArgs $args) {
$entity = $args->getEntity();
if (!$this->hasInDecodedRegistry($entity, $args->getEntityManager())) {
if ($this->processFields($entity, false)) {
$this->addToDecodedRegistry($entity, $args->getEntityManager());
}
}
} | [
"public",
"function",
"postLoad",
"(",
"LifecycleEventArgs",
"$",
"args",
")",
"{",
"$",
"entity",
"=",
"$",
"args",
"->",
"getEntity",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasInDecodedRegistry",
"(",
"$",
"entity",
",",
"$",
"args",
"->"... | Listen a postLoad lifecycle event. Checking and decrypt entities
which have @Encrypted annotations
@param LifecycleEventArgs $args | [
"Listen",
"a",
"postLoad",
"lifecycle",
"event",
".",
"Checking",
"and",
"decrypt",
"entities",
"which",
"have"
] | a209d3669fe092c9801b71e35e82dec6bcce1225 | https://github.com/vmelnik-ukraine/DoctrineEncryptBundle/blob/a209d3669fe092c9801b71e35e82dec6bcce1225/Subscribers/DoctrineEncryptSubscriber.php#L96-L103 | train |
vmelnik-ukraine/DoctrineEncryptBundle | Subscribers/DoctrineEncryptSubscriber.php | DoctrineEncryptSubscriber.encryptorFactory | private function encryptorFactory($classFullName, $secretKey) {
$refClass = new \ReflectionClass($classFullName);
if ($refClass->implementsInterface(self::ENCRYPTOR_INTERFACE_NS)) {
return new $classFullName($secretKey);
} else {
throw new \RuntimeException('Encryptor must implements interface EncryptorInterface');
}
} | php | private function encryptorFactory($classFullName, $secretKey) {
$refClass = new \ReflectionClass($classFullName);
if ($refClass->implementsInterface(self::ENCRYPTOR_INTERFACE_NS)) {
return new $classFullName($secretKey);
} else {
throw new \RuntimeException('Encryptor must implements interface EncryptorInterface');
}
} | [
"private",
"function",
"encryptorFactory",
"(",
"$",
"classFullName",
",",
"$",
"secretKey",
")",
"{",
"$",
"refClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"classFullName",
")",
";",
"if",
"(",
"$",
"refClass",
"->",
"implementsInterface",
"(",
"s... | Encryptor factory. Checks and create needed encryptor
@param string $classFullName Encryptor namespace and name
@param string $secretKey Secret key for encryptor
@return EncryptorInterface
@throws \RuntimeException | [
"Encryptor",
"factory",
".",
"Checks",
"and",
"create",
"needed",
"encryptor"
] | a209d3669fe092c9801b71e35e82dec6bcce1225 | https://github.com/vmelnik-ukraine/DoctrineEncryptBundle/blob/a209d3669fe092c9801b71e35e82dec6bcce1225/Subscribers/DoctrineEncryptSubscriber.php#L169-L176 | train |
vmelnik-ukraine/DoctrineEncryptBundle | Subscribers/DoctrineEncryptSubscriber.php | DoctrineEncryptSubscriber.hasInDecodedRegistry | private function hasInDecodedRegistry($entity, EntityManager $em) {
$className = get_class($entity);
$metadata = $em->getClassMetadata($className);
$getter = 'get' . self::capitalize($metadata->getIdentifier());
return isset($this->decodedRegistry[$className][$entity->$getter()]);
} | php | private function hasInDecodedRegistry($entity, EntityManager $em) {
$className = get_class($entity);
$metadata = $em->getClassMetadata($className);
$getter = 'get' . self::capitalize($metadata->getIdentifier());
return isset($this->decodedRegistry[$className][$entity->$getter()]);
} | [
"private",
"function",
"hasInDecodedRegistry",
"(",
"$",
"entity",
",",
"EntityManager",
"$",
"em",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"entity",
")",
";",
"$",
"metadata",
"=",
"$",
"em",
"->",
"getClassMetadata",
"(",
"$",
"className"... | Check if we have entity in decoded registry
@param Object $entity Some doctrine entity
@param \Doctrine\ORM\EntityManager $em
@return boolean | [
"Check",
"if",
"we",
"have",
"entity",
"in",
"decoded",
"registry"
] | a209d3669fe092c9801b71e35e82dec6bcce1225 | https://github.com/vmelnik-ukraine/DoctrineEncryptBundle/blob/a209d3669fe092c9801b71e35e82dec6bcce1225/Subscribers/DoctrineEncryptSubscriber.php#L184-L190 | train |
vmelnik-ukraine/DoctrineEncryptBundle | Subscribers/DoctrineEncryptSubscriber.php | DoctrineEncryptSubscriber.addToDecodedRegistry | private function addToDecodedRegistry($entity, EntityManager $em) {
$className = get_class($entity);
$metadata = $em->getClassMetadata($className);
$getter = 'get' . self::capitalize($metadata->getIdentifier());
$this->decodedRegistry[$className][$entity->$getter()] = true;
} | php | private function addToDecodedRegistry($entity, EntityManager $em) {
$className = get_class($entity);
$metadata = $em->getClassMetadata($className);
$getter = 'get' . self::capitalize($metadata->getIdentifier());
$this->decodedRegistry[$className][$entity->$getter()] = true;
} | [
"private",
"function",
"addToDecodedRegistry",
"(",
"$",
"entity",
",",
"EntityManager",
"$",
"em",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"entity",
")",
";",
"$",
"metadata",
"=",
"$",
"em",
"->",
"getClassMetadata",
"(",
"$",
"className"... | Adds entity to decoded registry
@param object $entity Some doctrine entity
@param \Doctrine\ORM\EntityManager $em | [
"Adds",
"entity",
"to",
"decoded",
"registry"
] | a209d3669fe092c9801b71e35e82dec6bcce1225 | https://github.com/vmelnik-ukraine/DoctrineEncryptBundle/blob/a209d3669fe092c9801b71e35e82dec6bcce1225/Subscribers/DoctrineEncryptSubscriber.php#L197-L202 | train |
salaros/vtwsclib-php | src/Session.php | Session.login | public function login($username, $accessKey)
{
// Do the challenge before loggin in
if ($this->passChallenge($username) === false) {
return false;
}
$postdata = [
'operation' => 'login',
'username' => $username,
'accessKey' => md5($this->serviceToken.$accessKey)
];
$result = $this->sendHttpRequest($postdata);
if (!is_array($result) || empty($result)) {
return false;
}
// Backuping logged in user credentials
$this->userName = $username;
$this->accessKey = $accessKey;
// Session data
$this->sessionName = $result[ 'sessionName' ];
$this->userID = $result[ 'userId' ];
// Vtiger CRM and WebServices API version
$this->vtigerApiVersion = $result[ 'version' ];
$this->vtigerVersion = $result[ 'vtigerVersion' ];
return true;
} | php | public function login($username, $accessKey)
{
// Do the challenge before loggin in
if ($this->passChallenge($username) === false) {
return false;
}
$postdata = [
'operation' => 'login',
'username' => $username,
'accessKey' => md5($this->serviceToken.$accessKey)
];
$result = $this->sendHttpRequest($postdata);
if (!is_array($result) || empty($result)) {
return false;
}
// Backuping logged in user credentials
$this->userName = $username;
$this->accessKey = $accessKey;
// Session data
$this->sessionName = $result[ 'sessionName' ];
$this->userID = $result[ 'userId' ];
// Vtiger CRM and WebServices API version
$this->vtigerApiVersion = $result[ 'version' ];
$this->vtigerVersion = $result[ 'vtigerVersion' ];
return true;
} | [
"public",
"function",
"login",
"(",
"$",
"username",
",",
"$",
"accessKey",
")",
"{",
"// Do the challenge before loggin in",
"if",
"(",
"$",
"this",
"->",
"passChallenge",
"(",
"$",
"username",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"... | Login to the server using username and VTiger access key token
@access public
@param string $username VTiger user name
@param string $accessKey VTiger access key token (visible on user profile/settings page)
@return boolean Returns true if login operation has been successful | [
"Login",
"to",
"the",
"server",
"using",
"username",
"and",
"VTiger",
"access",
"key",
"token"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Session.php#L97-L128 | train |
salaros/vtwsclib-php | src/Session.php | Session.passChallenge | private function passChallenge($username)
{
$getdata = [
'operation' => 'getchallenge',
'username' => $username
];
$result = $this->sendHttpRequest($getdata, 'GET');
if (!is_array($result) || !isset($result[ 'token' ])) {
return false;
}
$this->serviceExpireTime = $result[ 'expireTime' ];
$this->serviceToken = $result[ 'token' ];
return true;
} | php | private function passChallenge($username)
{
$getdata = [
'operation' => 'getchallenge',
'username' => $username
];
$result = $this->sendHttpRequest($getdata, 'GET');
if (!is_array($result) || !isset($result[ 'token' ])) {
return false;
}
$this->serviceExpireTime = $result[ 'expireTime' ];
$this->serviceToken = $result[ 'token' ];
return true;
} | [
"private",
"function",
"passChallenge",
"(",
"$",
"username",
")",
"{",
"$",
"getdata",
"=",
"[",
"'operation'",
"=>",
"'getchallenge'",
",",
"'username'",
"=>",
"$",
"username",
"]",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"sendHttpRequest",
"(",
"$",... | Gets a challenge token from the server and stores for future requests
@access private
@param string $username VTiger user name
@return boolean Returns false in case of failure | [
"Gets",
"a",
"challenge",
"token",
"from",
"the",
"server",
"and",
"stores",
"for",
"future",
"requests"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Session.php#L169-L185 | train |
salaros/vtwsclib-php | src/Session.php | Session.sendHttpRequest | public function sendHttpRequest(array $requestData, $method = 'POST')
{
// Perform re-login if required.
if ('getchallenge' !== $requestData[ 'operation' ] && time() > $this->serviceExpireTime) {
$this->login($this->userName, $this->accessKey);
}
$requestData[ 'sessionName' ] = $this->sessionName;
try {
switch ($method) {
case 'GET':
$response = $this->httpClient->get($this->wsBaseURL, [ 'query' => $requestData, 'timeout' => $this->requestTimeout ]);
break;
case 'POST':
$response = $this->httpClient->post($this->wsBaseURL, [ 'form_params' => $requestData, 'timeout' => $this->requestTimeout ]);
break;
default:
throw new WSException("Unsupported request type {$method}");
}
} catch (RequestException $ex) {
$urlFailed = $this->httpClient->getConfig('base_uri').$this->wsBaseURL;
throw new WSException(
sprintf('Failed to execute %s call on "%s" URL', $method, $urlFailed),
'FAILED_SENDING_REQUEST',
$ex
);
}
$jsonRaw = $response->getBody();
$jsonObj = json_decode($jsonRaw, true);
$result = (is_array($jsonObj) && !self::checkForError($jsonObj))
? $jsonObj[ 'result' ]
: null;
return $result;
} | php | public function sendHttpRequest(array $requestData, $method = 'POST')
{
// Perform re-login if required.
if ('getchallenge' !== $requestData[ 'operation' ] && time() > $this->serviceExpireTime) {
$this->login($this->userName, $this->accessKey);
}
$requestData[ 'sessionName' ] = $this->sessionName;
try {
switch ($method) {
case 'GET':
$response = $this->httpClient->get($this->wsBaseURL, [ 'query' => $requestData, 'timeout' => $this->requestTimeout ]);
break;
case 'POST':
$response = $this->httpClient->post($this->wsBaseURL, [ 'form_params' => $requestData, 'timeout' => $this->requestTimeout ]);
break;
default:
throw new WSException("Unsupported request type {$method}");
}
} catch (RequestException $ex) {
$urlFailed = $this->httpClient->getConfig('base_uri').$this->wsBaseURL;
throw new WSException(
sprintf('Failed to execute %s call on "%s" URL', $method, $urlFailed),
'FAILED_SENDING_REQUEST',
$ex
);
}
$jsonRaw = $response->getBody();
$jsonObj = json_decode($jsonRaw, true);
$result = (is_array($jsonObj) && !self::checkForError($jsonObj))
? $jsonObj[ 'result' ]
: null;
return $result;
} | [
"public",
"function",
"sendHttpRequest",
"(",
"array",
"$",
"requestData",
",",
"$",
"method",
"=",
"'POST'",
")",
"{",
"// Perform re-login if required.",
"if",
"(",
"'getchallenge'",
"!==",
"$",
"requestData",
"[",
"'operation'",
"]",
"&&",
"time",
"(",
")",
... | Sends HTTP request to VTiger web service API endpoint
@access private
@param array $requestData HTTP request data
@param string $method HTTP request method (GET, POST etc)
@return array Returns request result object (null in case of failure) | [
"Sends",
"HTTP",
"request",
"to",
"VTiger",
"web",
"service",
"API",
"endpoint"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Session.php#L228-L264 | train |
salaros/vtwsclib-php | src/Session.php | Session.fixVtigerBaseUrl | private static function fixVtigerBaseUrl($baseUrl)
{
if (!preg_match('/^https?:\/\//i', $baseUrl)) {
$baseUrl = sprintf('http://%s', $baseUrl);
}
if (strripos($baseUrl, '/') !== strlen($baseUrl) - 1) {
$baseUrl .= '/';
}
return $baseUrl;
} | php | private static function fixVtigerBaseUrl($baseUrl)
{
if (!preg_match('/^https?:\/\//i', $baseUrl)) {
$baseUrl = sprintf('http://%s', $baseUrl);
}
if (strripos($baseUrl, '/') !== strlen($baseUrl) - 1) {
$baseUrl .= '/';
}
return $baseUrl;
} | [
"private",
"static",
"function",
"fixVtigerBaseUrl",
"(",
"$",
"baseUrl",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^https?:\\/\\//i'",
",",
"$",
"baseUrl",
")",
")",
"{",
"$",
"baseUrl",
"=",
"sprintf",
"(",
"'http://%s'",
",",
"$",
"baseUrl",
")",
... | Cleans and fixes vTiger URL
@access private
@static
@param string Base URL of vTiger CRM
@param string $baseUrl
@return string Returns cleaned and fixed vTiger URL | [
"Cleans",
"and",
"fixes",
"vTiger",
"URL"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Session.php#L274-L283 | train |
salaros/vtwsclib-php | src/Session.php | Session.checkForError | private static function checkForError(array $jsonResult)
{
if (isset($jsonResult[ 'success' ]) && true === (bool) $jsonResult[ 'success' ]) {
return false;
}
if (isset($jsonResult[ 'error' ])) {
$error = $jsonResult[ 'error' ];
throw new WSException(
$error[ 'message' ],
$error[ 'code' ]
);
}
// This should never happen
throw new WSException('Unknown error');
} | php | private static function checkForError(array $jsonResult)
{
if (isset($jsonResult[ 'success' ]) && true === (bool) $jsonResult[ 'success' ]) {
return false;
}
if (isset($jsonResult[ 'error' ])) {
$error = $jsonResult[ 'error' ];
throw new WSException(
$error[ 'message' ],
$error[ 'code' ]
);
}
// This should never happen
throw new WSException('Unknown error');
} | [
"private",
"static",
"function",
"checkForError",
"(",
"array",
"$",
"jsonResult",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"jsonResult",
"[",
"'success'",
"]",
")",
"&&",
"true",
"===",
"(",
"bool",
")",
"$",
"jsonResult",
"[",
"'success'",
"]",
")",
"... | Check if server response contains an error, therefore the requested operation has failed
@access private
@static
@param array $jsonResult Server response object to check for errors
@return boolean True if response object contains an error | [
"Check",
"if",
"server",
"response",
"contains",
"an",
"error",
"therefore",
"the",
"requested",
"operation",
"has",
"failed"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Session.php#L292-L308 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.findOneByID | public function findOneByID($moduleName, $entityID, array $select = [ ])
{
$entityID = $this->wsClient->modules->getTypedID($moduleName, $entityID);
$record = $this->wsClient->invokeOperation('retrieve', [ 'id' => $entityID ], 'GET');
if (!is_array($record)) {
return null;
}
return (empty($select))
? $record
: array_intersect_key($record, array_flip($select));
} | php | public function findOneByID($moduleName, $entityID, array $select = [ ])
{
$entityID = $this->wsClient->modules->getTypedID($moduleName, $entityID);
$record = $this->wsClient->invokeOperation('retrieve', [ 'id' => $entityID ], 'GET');
if (!is_array($record)) {
return null;
}
return (empty($select))
? $record
: array_intersect_key($record, array_flip($select));
} | [
"public",
"function",
"findOneByID",
"(",
"$",
"moduleName",
",",
"$",
"entityID",
",",
"array",
"$",
"select",
"=",
"[",
"]",
")",
"{",
"$",
"entityID",
"=",
"$",
"this",
"->",
"wsClient",
"->",
"modules",
"->",
"getTypedID",
"(",
"$",
"moduleName",
"... | Retrieves an entity by ID
@param string $moduleName The name of the module / entity type
@param string $entityID The ID of the entity to retrieve
@return array $select The list of fields to select (defaults to SQL-like '*' - all the fields)
@return array Entity data | [
"Retrieves",
"an",
"entity",
"by",
"ID"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L62-L73 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.findOne | public function findOne($moduleName, array $params, array $select = [ ])
{
$entityID = $this->getID($moduleName, $params);
return (empty($entityID))
? null
: $this->findOneByID($moduleName, $entityID, $select);
} | php | public function findOne($moduleName, array $params, array $select = [ ])
{
$entityID = $this->getID($moduleName, $params);
return (empty($entityID))
? null
: $this->findOneByID($moduleName, $entityID, $select);
} | [
"public",
"function",
"findOne",
"(",
"$",
"moduleName",
",",
"array",
"$",
"params",
",",
"array",
"$",
"select",
"=",
"[",
"]",
")",
"{",
"$",
"entityID",
"=",
"$",
"this",
"->",
"getID",
"(",
"$",
"moduleName",
",",
"$",
"params",
")",
";",
"ret... | Retrieve the entity matching a list of constraints
@param string $moduleName The name of the module / entity type
@param array $params Data used to find a matching entry
@return array $select The list of fields to select (defaults to SQL-like '*' - all the fields)
@return array The matching record | [
"Retrieve",
"the",
"entity",
"matching",
"a",
"list",
"of",
"constraints"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L82-L88 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.getNumericID | public function getNumericID($moduleName, array $params)
{
$entityID = $this->getID($moduleName, $params);
$entityIDParts = explode('x', $entityID, 2);
return (is_array($entityIDParts) && count($entityIDParts) === 2)
? intval($entityIDParts[ 1 ])
: -1;
} | php | public function getNumericID($moduleName, array $params)
{
$entityID = $this->getID($moduleName, $params);
$entityIDParts = explode('x', $entityID, 2);
return (is_array($entityIDParts) && count($entityIDParts) === 2)
? intval($entityIDParts[ 1 ])
: -1;
} | [
"public",
"function",
"getNumericID",
"(",
"$",
"moduleName",
",",
"array",
"$",
"params",
")",
"{",
"$",
"entityID",
"=",
"$",
"this",
"->",
"getID",
"(",
"$",
"moduleName",
",",
"$",
"params",
")",
";",
"$",
"entityIDParts",
"=",
"explode",
"(",
"'x'... | Retrieve a numeric ID of the entity matching a list of constraints
@param string $moduleName The name of the module / entity type
@param array $params Data used to find a matching entry
@return integer Numeric ID | [
"Retrieve",
"a",
"numeric",
"ID",
"of",
"the",
"entity",
"matching",
"a",
"list",
"of",
"constraints"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L116-L123 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.createOne | public function createOne($moduleName, array $params)
{
if (!is_assoc_array($params)) {
throw new WSException(
"You have to specify at least one search parameter (prop => value)
in order to be able to create an entity"
);
}
// Assign record to logged in user if not specified
if (!isset($params[ 'assigned_user_id' ])) {
$currentUser = $this->wsClient->getCurrentUser();
$params[ 'assigned_user_id' ] = $currentUser[ 'id' ];
}
$requestData = [
'elementType' => $moduleName,
'element' => json_encode($params)
];
return $this->wsClient->invokeOperation('create', $requestData);
} | php | public function createOne($moduleName, array $params)
{
if (!is_assoc_array($params)) {
throw new WSException(
"You have to specify at least one search parameter (prop => value)
in order to be able to create an entity"
);
}
// Assign record to logged in user if not specified
if (!isset($params[ 'assigned_user_id' ])) {
$currentUser = $this->wsClient->getCurrentUser();
$params[ 'assigned_user_id' ] = $currentUser[ 'id' ];
}
$requestData = [
'elementType' => $moduleName,
'element' => json_encode($params)
];
return $this->wsClient->invokeOperation('create', $requestData);
} | [
"public",
"function",
"createOne",
"(",
"$",
"moduleName",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_assoc_array",
"(",
"$",
"params",
")",
")",
"{",
"throw",
"new",
"WSException",
"(",
"\"You have to specify at least one search parameter (prop =>... | Creates an entity for the giving module
@param string $moduleName Name of the module / entity type for which the entry has to be created
@param array $params Entity data
@return array Entity creation results | [
"Creates",
"an",
"entity",
"for",
"the",
"giving",
"module"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L131-L152 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.deleteOne | public function deleteOne($moduleName, $entityID)
{
// Preprend so-called moduleid if needed
$entityID = $this->wsClient->modules->getTypedID($moduleName, $entityID);
return $this->wsClient->invokeOperation('delete', [ 'id' => $entityID ]);
} | php | public function deleteOne($moduleName, $entityID)
{
// Preprend so-called moduleid if needed
$entityID = $this->wsClient->modules->getTypedID($moduleName, $entityID);
return $this->wsClient->invokeOperation('delete', [ 'id' => $entityID ]);
} | [
"public",
"function",
"deleteOne",
"(",
"$",
"moduleName",
",",
"$",
"entityID",
")",
"{",
"// Preprend so-called moduleid if needed",
"$",
"entityID",
"=",
"$",
"this",
"->",
"wsClient",
"->",
"modules",
"->",
"getTypedID",
"(",
"$",
"moduleName",
",",
"$",
"... | Provides entity removal functionality
@param string $moduleName The name of the module / entity type
@param string $entityID The ID of the entity to delete
@return array Removal status object | [
"Provides",
"entity",
"removal",
"functionality"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L204-L209 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.findMany | public function findMany($moduleName, array $params, array $select = [ ], $limit = 0, $offset = 0)
{
if (!is_array($params) || (!empty($params) && !is_assoc_array($params))) {
throw new WSException(
"You have to specify at least one search parameter (prop => value)
in order to be able to retrieve entity(ies)"
);
}
// Builds the query
$query = self::getQueryString($moduleName, $params, $select, $limit, $offset);
// Run the query
$records = $this->wsClient->runQuery($query);
if (false === $records || !is_array($records) || empty($records)) {
return null;
}
return $records;
} | php | public function findMany($moduleName, array $params, array $select = [ ], $limit = 0, $offset = 0)
{
if (!is_array($params) || (!empty($params) && !is_assoc_array($params))) {
throw new WSException(
"You have to specify at least one search parameter (prop => value)
in order to be able to retrieve entity(ies)"
);
}
// Builds the query
$query = self::getQueryString($moduleName, $params, $select, $limit, $offset);
// Run the query
$records = $this->wsClient->runQuery($query);
if (false === $records || !is_array($records) || empty($records)) {
return null;
}
return $records;
} | [
"public",
"function",
"findMany",
"(",
"$",
"moduleName",
",",
"array",
"$",
"params",
",",
"array",
"$",
"select",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params"... | Retrieves multiple records using module name and a set of constraints
@param string $moduleName The name of the module / entity type
@param array $params Data used to find matching entries
@return array $select The list of fields to select (defaults to SQL-like '*' - all the fields)
@return integer $limit Limit the list of entries to N records (acts like LIMIT in SQL)
@return integer $offset Integer values to specify the offset of the query
@return array The array containing matching entries or false if nothing was found | [
"Retrieves",
"multiple",
"records",
"using",
"module",
"name",
"and",
"a",
"set",
"of",
"constraints"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L220-L239 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.sync | public function sync($modifiedTime = null, $moduleName = null, $syncType = null)
{
$modifiedTime = (empty($modifiedTime))
? strtotime('today midnight')
: intval($modifiedTime);
$requestData = [
'modifiedTime' => $modifiedTime
];
if (!empty($moduleName)) {
$requestData[ 'elementType' ] = $moduleName;
}
if ($syncType) {
$requestData[ 'syncType' ] = $syncType;
}
return $this->wsClient->invokeOperation('sync', $requestData, 'GET');
} | php | public function sync($modifiedTime = null, $moduleName = null, $syncType = null)
{
$modifiedTime = (empty($modifiedTime))
? strtotime('today midnight')
: intval($modifiedTime);
$requestData = [
'modifiedTime' => $modifiedTime
];
if (!empty($moduleName)) {
$requestData[ 'elementType' ] = $moduleName;
}
if ($syncType) {
$requestData[ 'syncType' ] = $syncType;
}
return $this->wsClient->invokeOperation('sync', $requestData, 'GET');
} | [
"public",
"function",
"sync",
"(",
"$",
"modifiedTime",
"=",
"null",
",",
"$",
"moduleName",
"=",
"null",
",",
"$",
"syncType",
"=",
"null",
")",
"{",
"$",
"modifiedTime",
"=",
"(",
"empty",
"(",
"$",
"modifiedTime",
")",
")",
"?",
"strtotime",
"(",
... | Sync will return a sync result object containing details of changes after modifiedTime
@param integer [$modifiedTime = null] The date of the first change
@param string [$moduleName = null] The name of the module / entity type
@param string [$syncType = null] Sync type determines the scope of the query
@return array Sync result object | [
"Sync",
"will",
"return",
"a",
"sync",
"result",
"object",
"containing",
"details",
"of",
"changes",
"after",
"modifiedTime"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L248-L267 | train |
salaros/vtwsclib-php | src/Entities.php | Entities.getQueryString | public static function getQueryString($moduleName, array $params, array $select = [ ], $limit = 0, $offset = 0)
{
$criteria = array();
$select = (empty($select)) ? '*' : implode(',', $select);
$query = sprintf("SELECT %s FROM $moduleName", $select);
if (!empty($params)) {
foreach ($params as $param => $value) {
$criteria[ ] = "{$param} LIKE '{$value}'";
}
$query .= sprintf(' WHERE %s', implode(" AND ", $criteria));
}
if (intval($limit) > 0) {
$query .= (intval($offset) > 0)
? sprintf(" LIMIT %s, %s", intval($offset), intval($limit))
: sprintf(" LIMIT %s", intval($limit));
}
return $query;
} | php | public static function getQueryString($moduleName, array $params, array $select = [ ], $limit = 0, $offset = 0)
{
$criteria = array();
$select = (empty($select)) ? '*' : implode(',', $select);
$query = sprintf("SELECT %s FROM $moduleName", $select);
if (!empty($params)) {
foreach ($params as $param => $value) {
$criteria[ ] = "{$param} LIKE '{$value}'";
}
$query .= sprintf(' WHERE %s', implode(" AND ", $criteria));
}
if (intval($limit) > 0) {
$query .= (intval($offset) > 0)
? sprintf(" LIMIT %s, %s", intval($offset), intval($limit))
: sprintf(" LIMIT %s", intval($limit));
}
return $query;
} | [
"public",
"static",
"function",
"getQueryString",
"(",
"$",
"moduleName",
",",
"array",
"$",
"params",
",",
"array",
"$",
"select",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"criteria",
"=",
"array",
"... | Builds the query using the supplied parameters
@access public
@static
@param string $moduleName The name of the module / entity type
@param array $params Data used to find matching entries
@return string $select The list of fields to select (defaults to SQL-like '*' - all the fields)
@return integer $limit Limit the list of entries to N records (acts like LIMIT in SQL)
@return integer $offset Integer values to specify the offset of the query
@return string The query build out of the supplied parameters | [
"Builds",
"the",
"query",
"using",
"the",
"supplied",
"parameters"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Entities.php#L280-L301 | train |
salaros/vtwsclib-php | src/WSClient.php | WSClient.runQuery | public function runQuery($query)
{
// Make sure the query ends with ;
$query = (strripos($query, ';') != strlen($query) - 1)
? trim($query .= ';')
: trim($query);
return $this->invokeOperation('query', [ 'query' => $query ], 'GET');
} | php | public function runQuery($query)
{
// Make sure the query ends with ;
$query = (strripos($query, ';') != strlen($query) - 1)
? trim($query .= ';')
: trim($query);
return $this->invokeOperation('query', [ 'query' => $query ], 'GET');
} | [
"public",
"function",
"runQuery",
"(",
"$",
"query",
")",
"{",
"// Make sure the query ends with ;",
"$",
"query",
"=",
"(",
"strripos",
"(",
"$",
"query",
",",
"';'",
")",
"!=",
"strlen",
"(",
"$",
"query",
")",
"-",
"1",
")",
"?",
"trim",
"(",
"$",
... | VTiger provides a simple query language for fetching data.
This language is quite similar to select queries in SQL.
There are limitations, the queries work on a single Module,
embedded queries are not supported, and does not support joins.
But this is still a powerful way of getting data from Vtiger.
Query always limits its output to 100 records,
Client application can use limit operator to get different records.
@access public
@param string $query SQL-like expression
@return array Query results | [
"VTiger",
"provides",
"a",
"simple",
"query",
"language",
"for",
"fetching",
"data",
".",
"This",
"language",
"is",
"quite",
"similar",
"to",
"select",
"queries",
"in",
"SQL",
".",
"There",
"are",
"limitations",
"the",
"queries",
"work",
"on",
"a",
"single",... | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/WSClient.php#L127-L135 | train |
salaros/vtwsclib-php | src/Modules.php | Modules.getAll | public function getAll()
{
$result = $this->wsClient->invokeOperation('listtypes', [ ], 'GET');
$modules = $result[ 'types' ];
$result = array();
foreach ($modules as $moduleName) {
$result[ $moduleName ] = [ 'name' => $moduleName ];
}
return $result;
} | php | public function getAll()
{
$result = $this->wsClient->invokeOperation('listtypes', [ ], 'GET');
$modules = $result[ 'types' ];
$result = array();
foreach ($modules as $moduleName) {
$result[ $moduleName ] = [ 'name' => $moduleName ];
}
return $result;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"wsClient",
"->",
"invokeOperation",
"(",
"'listtypes'",
",",
"[",
"]",
",",
"'GET'",
")",
";",
"$",
"modules",
"=",
"$",
"result",
"[",
"'types'",
"]",
";",
"$",
... | Lists all the Vtiger entity types available through the API
@access public
@return array List of entity types | [
"Lists",
"all",
"the",
"Vtiger",
"entity",
"types",
"available",
"through",
"the",
"API"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/Modules.php#L60-L70 | train |
salaros/vtwsclib-php | src/WSException.php | WSException.getAllProperties | private function getAllProperties()
{
$allProperties = get_object_vars($this);
$properties = array();
foreach ($allProperties as $fullName => $value) {
$fullNameComponents = explode("\0", $fullName);
$propertyName = array_pop($fullNameComponents);
if ($propertyName && isset($value)) {
$properties[ $propertyName ] = $value;
}
}
return $properties;
} | php | private function getAllProperties()
{
$allProperties = get_object_vars($this);
$properties = array();
foreach ($allProperties as $fullName => $value) {
$fullNameComponents = explode("\0", $fullName);
$propertyName = array_pop($fullNameComponents);
if ($propertyName && isset($value)) {
$properties[ $propertyName ] = $value;
}
}
return $properties;
} | [
"private",
"function",
"getAllProperties",
"(",
")",
"{",
"$",
"allProperties",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"$",
"properties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"allProperties",
"as",
"$",
"fullName",
"=>",
"$",
"v... | Gets all the properties of the object
@access public
@return array Array of properties | [
"Gets",
"all",
"the",
"properties",
"of",
"the",
"object"
] | 97f09949b98f894c98612817e58c9ad8c3a2c815 | https://github.com/salaros/vtwsclib-php/blob/97f09949b98f894c98612817e58c9ad8c3a2c815/src/WSException.php#L90-L103 | train |
Webklex/laravel-imap | src/IMAP/Providers/LaravelServiceProvider.php | LaravelServiceProvider.setVendorConfig | private function setVendorConfig(){
$config_key = 'imap';
$path = __DIR__.'/../../config/'.$config_key.'.php';
$vendor_config = require $path;
$config = $this->app['config']->get($config_key, []);
$this->app['config']->set($config_key, $this->array_merge_recursive_distinct($vendor_config, $config));
$config = $this->app['config']->get($config_key);
if(is_array($config)){
if(isset($config['default'])){
if(isset($config['accounts']) && $config['default'] != false){
$default_config = $vendor_config['accounts']['default'];
if(isset($config['accounts'][$config['default']])){
$default_config = array_merge($default_config, $config['accounts'][$config['default']]);
}
if(is_array($config['accounts'])){
foreach($config['accounts'] as $account_key => $account){
$config['accounts'][$account_key] = array_merge($default_config, $account);
}
}
}
}
}
$this->app['config']->set($config_key, $config);
} | php | private function setVendorConfig(){
$config_key = 'imap';
$path = __DIR__.'/../../config/'.$config_key.'.php';
$vendor_config = require $path;
$config = $this->app['config']->get($config_key, []);
$this->app['config']->set($config_key, $this->array_merge_recursive_distinct($vendor_config, $config));
$config = $this->app['config']->get($config_key);
if(is_array($config)){
if(isset($config['default'])){
if(isset($config['accounts']) && $config['default'] != false){
$default_config = $vendor_config['accounts']['default'];
if(isset($config['accounts'][$config['default']])){
$default_config = array_merge($default_config, $config['accounts'][$config['default']]);
}
if(is_array($config['accounts'])){
foreach($config['accounts'] as $account_key => $account){
$config['accounts'][$account_key] = array_merge($default_config, $account);
}
}
}
}
}
$this->app['config']->set($config_key, $config);
} | [
"private",
"function",
"setVendorConfig",
"(",
")",
"{",
"$",
"config_key",
"=",
"'imap'",
";",
"$",
"path",
"=",
"__DIR__",
".",
"'/../../config/'",
".",
"$",
"config_key",
".",
"'.php'",
";",
"$",
"vendor_config",
"=",
"require",
"$",
"path",
";",
"$",
... | Merge the vendor settings with the local config
The default account identifier will be used as default for any missing account parameters.
If however the default account is missing a parameter the package default account parameter will be used.
This can be disabled by setting imap.default in your config file to 'false' | [
"Merge",
"the",
"vendor",
"settings",
"with",
"the",
"local",
"config"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Providers/LaravelServiceProvider.php#L61-L92 | train |
Webklex/laravel-imap | src/IMAP/Providers/LaravelServiceProvider.php | LaravelServiceProvider.array_merge_recursive_distinct | private function array_merge_recursive_distinct() {
$arrays = func_get_args();
$base = array_shift($arrays);
if(!is_array($base)) $base = empty($base) ? array() : array($base);
foreach($arrays as $append) {
if(!is_array($append)) $append = array($append);
foreach($append as $key => $value) {
if(!array_key_exists($key, $base) and !is_numeric($key)) {
$base[$key] = $append[$key];
continue;
}
if(is_array($value) or is_array($base[$key])) {
$base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
} else if(is_numeric($key)) {
if(!in_array($value, $base)) $base[] = $value;
} else {
$base[$key] = $value;
}
}
}
return $base;
} | php | private function array_merge_recursive_distinct() {
$arrays = func_get_args();
$base = array_shift($arrays);
if(!is_array($base)) $base = empty($base) ? array() : array($base);
foreach($arrays as $append) {
if(!is_array($append)) $append = array($append);
foreach($append as $key => $value) {
if(!array_key_exists($key, $base) and !is_numeric($key)) {
$base[$key] = $append[$key];
continue;
}
if(is_array($value) or is_array($base[$key])) {
$base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
} else if(is_numeric($key)) {
if(!in_array($value, $base)) $base[] = $value;
} else {
$base[$key] = $value;
}
}
}
return $base;
} | [
"private",
"function",
"array_merge_recursive_distinct",
"(",
")",
"{",
"$",
"arrays",
"=",
"func_get_args",
"(",
")",
";",
"$",
"base",
"=",
"array_shift",
"(",
"$",
"arrays",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"base",
")",
")",
"$",
"bas... | Marge arrays recursively and distinct
Merges any number of arrays / parameters recursively, replacing
entries with string keys with values from latter arrays.
If the entry or the next value to be assigned is an array, then it
automatically treats both arguments as an array.
Numeric entries are appended, not replaced, but only if they are
unique
@param array $array1 Initial array to merge.
@param array ... Variable list of arrays to recursively merge.
@return array|mixed
@link http://www.php.net/manual/en/function.array-merge-recursive.php#96201
@author Mark Roduner <mark.roduner@gmail.com> | [
"Marge",
"arrays",
"recursively",
"and",
"distinct"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Providers/LaravelServiceProvider.php#L112-L143 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.setConfig | public function setConfig(array $config) {
$default_account = config('imap.default');
$default_config = config("imap.accounts.$default_account");
foreach ($this->valid_config_keys as $key) {
$this->$key = isset($config[$key]) ? $config[$key] : $default_config[$key];
}
return $this;
} | php | public function setConfig(array $config) {
$default_account = config('imap.default');
$default_config = config("imap.accounts.$default_account");
foreach ($this->valid_config_keys as $key) {
$this->$key = isset($config[$key]) ? $config[$key] : $default_config[$key];
}
return $this;
} | [
"public",
"function",
"setConfig",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"default_account",
"=",
"config",
"(",
"'imap.default'",
")",
";",
"$",
"default_config",
"=",
"config",
"(",
"\"imap.accounts.$default_account\"",
")",
";",
"foreach",
"(",
"$",
"t... | Set the Client configuration
@param array $config
@return self | [
"Set",
"the",
"Client",
"configuration"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L158-L167 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.disconnect | public function disconnect() {
if ($this->isConnected() && $this->connection !== false && is_integer($this->connection) === false) {
$this->errors = array_merge($this->errors, imap_errors() ?: []);
$this->connected = !imap_close($this->connection, IMAP::CL_EXPUNGE);
}
return $this;
} | php | public function disconnect() {
if ($this->isConnected() && $this->connection !== false && is_integer($this->connection) === false) {
$this->errors = array_merge($this->errors, imap_errors() ?: []);
$this->connected = !imap_close($this->connection, IMAP::CL_EXPUNGE);
}
return $this;
} | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isConnected",
"(",
")",
"&&",
"$",
"this",
"->",
"connection",
"!==",
"false",
"&&",
"is_integer",
"(",
"$",
"this",
"->",
"connection",
")",
"===",
"false",
")",
"{",
... | Disconnect from server.
@return $this | [
"Disconnect",
"from",
"server",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L310-L317 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.getFolders | public function getFolders($hierarchical = true, $parent_folder = null) {
$this->checkConnection();
$folders = FolderCollection::make([]);
$pattern = $parent_folder.($hierarchical ? '%' : '*');
$items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern);
if(is_array($items)){
foreach ($items as $item) {
$folder = new Folder($this, $item);
if ($hierarchical && $folder->hasChildren()) {
$pattern = $folder->full_name.$folder->delimiter.'%';
$children = $this->getFolders(true, $pattern);
$folder->setChildren($children);
}
$folders->push($folder);
}
return $folders;
}else{
throw new MailboxFetchingException($this->getLastError());
}
} | php | public function getFolders($hierarchical = true, $parent_folder = null) {
$this->checkConnection();
$folders = FolderCollection::make([]);
$pattern = $parent_folder.($hierarchical ? '%' : '*');
$items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern);
if(is_array($items)){
foreach ($items as $item) {
$folder = new Folder($this, $item);
if ($hierarchical && $folder->hasChildren()) {
$pattern = $folder->full_name.$folder->delimiter.'%';
$children = $this->getFolders(true, $pattern);
$folder->setChildren($children);
}
$folders->push($folder);
}
return $folders;
}else{
throw new MailboxFetchingException($this->getLastError());
}
} | [
"public",
"function",
"getFolders",
"(",
"$",
"hierarchical",
"=",
"true",
",",
"$",
"parent_folder",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"$",
"folders",
"=",
"FolderCollection",
"::",
"make",
"(",
"[",
"]",
")",
... | Get folders list.
If hierarchical order is set to true, it will make a tree of folders, otherwise it will return flat array.
@param boolean $hierarchical
@param string|null $parent_folder
@return FolderCollection
@throws ConnectionFailedException
@throws MailboxFetchingException | [
"Get",
"folders",
"list",
".",
"If",
"hierarchical",
"order",
"is",
"set",
"to",
"true",
"it",
"will",
"make",
"a",
"tree",
"of",
"folders",
"otherwise",
"it",
"will",
"return",
"flat",
"array",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L354-L379 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.openFolder | public function openFolder($folder_path, $attempts = 3) {
$this->checkConnection();
if(property_exists($folder_path, 'path')) {
$folder_path = $folder_path->path;
}
if ($this->active_folder !== $folder_path) {
$this->active_folder = $folder_path;
imap_reopen($this->getConnection(), $folder_path, $this->getOptions(), $attempts);
}
} | php | public function openFolder($folder_path, $attempts = 3) {
$this->checkConnection();
if(property_exists($folder_path, 'path')) {
$folder_path = $folder_path->path;
}
if ($this->active_folder !== $folder_path) {
$this->active_folder = $folder_path;
imap_reopen($this->getConnection(), $folder_path, $this->getOptions(), $attempts);
}
} | [
"public",
"function",
"openFolder",
"(",
"$",
"folder_path",
",",
"$",
"attempts",
"=",
"3",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"folder_path",
",",
"'path'",
")",
")",
"{",
"$",
"folde... | Open folder.
@param string|Folder $folder_path
@param int $attempts
@throws ConnectionFailedException | [
"Open",
"folder",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L389-L401 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.getMessages | public function getMessages(Folder $folder, $criteria = 'ALL', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = false) {
return $folder->getMessages($criteria, $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
} | php | public function getMessages(Folder $folder, $criteria = 'ALL', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = false) {
return $folder->getMessages($criteria, $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
} | [
"public",
"function",
"getMessages",
"(",
"Folder",
"$",
"folder",
",",
"$",
"criteria",
"=",
"'ALL'",
",",
"$",
"fetch_options",
"=",
"null",
",",
"$",
"fetch_body",
"=",
"true",
",",
"$",
"fetch_attachment",
"=",
"true",
",",
"$",
"fetch_flags",
"=",
"... | Get messages from folder.
@param Folder $folder
@param string $criteria
@param int|null $fetch_options
@param boolean $fetch_body
@param boolean $fetch_attachment
@param boolean $fetch_flags
@return MessageCollection
@throws ConnectionFailedException
@throws Exceptions\InvalidWhereQueryCriteriaException
@throws GetMessagesFailedException
@deprecated 1.0.5.2:2.0.0 No longer needed. Use Folder::getMessages() instead
@see Folder::getMessages() | [
"Get",
"messages",
"from",
"folder",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L470-L472 | train |
Webklex/laravel-imap | src/IMAP/Client.php | Client.getAddress | protected function getAddress() {
$address = "{".$this->host.":".$this->port."/".($this->protocol ? $this->protocol : 'imap');
if (!$this->validate_cert) {
$address .= '/novalidate-cert';
}
if (in_array($this->encryption,['tls','ssl'])) {
$address .= '/'.$this->encryption;
}
$address .= '}';
return $address;
} | php | protected function getAddress() {
$address = "{".$this->host.":".$this->port."/".($this->protocol ? $this->protocol : 'imap');
if (!$this->validate_cert) {
$address .= '/novalidate-cert';
}
if (in_array($this->encryption,['tls','ssl'])) {
$address .= '/'.$this->encryption;
}
$address .= '}';
return $address;
} | [
"protected",
"function",
"getAddress",
"(",
")",
"{",
"$",
"address",
"=",
"\"{\"",
".",
"$",
"this",
"->",
"host",
".",
"\":\"",
".",
"$",
"this",
"->",
"port",
".",
"\"/\"",
".",
"(",
"$",
"this",
"->",
"protocol",
"?",
"$",
"this",
"->",
"protoc... | Get full address of mailbox.
@return string | [
"Get",
"full",
"address",
"of",
"mailbox",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Client.php#L536-L548 | train |
Webklex/laravel-imap | src/IMAP/Folder.php | Folder.getMessage | public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = true) {
$this->client->openFolder($this->path);
if (imap_msgno($this->getClient()->getConnection(), $uid) > 0) {
return new Message($uid, $msglist, $this->getClient(), $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
}
return null;
} | php | public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = true) {
$this->client->openFolder($this->path);
if (imap_msgno($this->getClient()->getConnection(), $uid) > 0) {
return new Message($uid, $msglist, $this->getClient(), $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
}
return null;
} | [
"public",
"function",
"getMessage",
"(",
"$",
"uid",
",",
"$",
"msglist",
"=",
"null",
",",
"$",
"fetch_options",
"=",
"null",
",",
"$",
"fetch_body",
"=",
"false",
",",
"$",
"fetch_attachment",
"=",
"false",
",",
"$",
"fetch_flags",
"=",
"true",
")",
... | Get a specific message by UID
@param integer $uid Please note that the uid is not unique and can change
@param integer|null $msglist
@param integer|null $fetch_options
@param boolean $fetch_body
@param boolean $fetch_attachment
@param boolean $fetch_flags
@return Message|null
@throws Exceptions\ConnectionFailedException
@throws Exceptions\InvalidMessageDateException | [
"Get",
"a",
"specific",
"message",
"by",
"UID"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Folder.php#L193-L200 | train |
Webklex/laravel-imap | src/IMAP/Folder.php | Folder.getUnseenMessages | public function getUnseenMessages($criteria = 'UNSEEN', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
return $this->getMessages($criteria, $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags, $limit, $page, $charset);
} | php | public function getUnseenMessages($criteria = 'UNSEEN', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
return $this->getMessages($criteria, $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags, $limit, $page, $charset);
} | [
"public",
"function",
"getUnseenMessages",
"(",
"$",
"criteria",
"=",
"'UNSEEN'",
",",
"$",
"fetch_options",
"=",
"null",
",",
"$",
"fetch_body",
"=",
"true",
",",
"$",
"fetch_attachment",
"=",
"true",
",",
"$",
"fetch_flags",
"=",
"true",
",",
"$",
"limit... | Get all unseen messages
@param string $criteria
@param int|null $fetch_options
@param boolean $fetch_body
@param boolean $fetch_attachment
@param boolean $fetch_flags
@param int|null $limit
@param int $page
@param string $charset
@return MessageCollection
@throws Exceptions\ConnectionFailedException
@throws Exceptions\InvalidWhereQueryCriteriaException
@throws GetMessagesFailedException
@throws MessageSearchValidationException
@deprecated 1.0.5:2.0.0 No longer needed. Use Folder::getMessages('UNSEEN') instead
@see Folder::getMessages() | [
"Get",
"all",
"unseen",
"messages"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Folder.php#L247-L249 | train |
Webklex/laravel-imap | src/IMAP/Folder.php | Folder.parseAttributes | protected function parseAttributes($attributes) {
$this->no_inferiors = ($attributes & LATT_NOINFERIORS) ? true : false;
$this->no_select = ($attributes & LATT_NOSELECT) ? true : false;
$this->marked = ($attributes & LATT_MARKED) ? true : false;
$this->referal = ($attributes & LATT_REFERRAL) ? true : false;
$this->has_children = ($attributes & LATT_HASCHILDREN) ? true : false;
} | php | protected function parseAttributes($attributes) {
$this->no_inferiors = ($attributes & LATT_NOINFERIORS) ? true : false;
$this->no_select = ($attributes & LATT_NOSELECT) ? true : false;
$this->marked = ($attributes & LATT_MARKED) ? true : false;
$this->referal = ($attributes & LATT_REFERRAL) ? true : false;
$this->has_children = ($attributes & LATT_HASCHILDREN) ? true : false;
} | [
"protected",
"function",
"parseAttributes",
"(",
"$",
"attributes",
")",
"{",
"$",
"this",
"->",
"no_inferiors",
"=",
"(",
"$",
"attributes",
"&",
"LATT_NOINFERIORS",
")",
"?",
"true",
":",
"false",
";",
"$",
"this",
"->",
"no_select",
"=",
"(",
"$",
"at... | Parse attributes and set it to object properties.
@param $attributes | [
"Parse",
"attributes",
"and",
"set",
"it",
"to",
"object",
"properties",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Folder.php#L359-L365 | train |
Webklex/laravel-imap | src/IMAP/Folder.php | Folder.move | public function move($target_mailbox, $expunge = true) {
$status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
if($expunge) $this->client->expunge();
return $status;
} | php | public function move($target_mailbox, $expunge = true) {
$status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
if($expunge) $this->client->expunge();
return $status;
} | [
"public",
"function",
"move",
"(",
"$",
"target_mailbox",
",",
"$",
"expunge",
"=",
"true",
")",
"{",
"$",
"status",
"=",
"imap_renamemailbox",
"(",
"$",
"this",
"->",
"client",
"->",
"getConnection",
"(",
")",
",",
"$",
"this",
"->",
"path",
",",
"$",... | Move or Rename the current Mailbox
@param string $target_mailbox
@param boolean $expunge
@return bool
@throws Exceptions\ConnectionFailedException | [
"Move",
"or",
"Rename",
"the",
"current",
"Mailbox"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Folder.php#L392-L397 | train |
Webklex/laravel-imap | src/IMAP/Folder.php | Folder.appendMessage | public function appendMessage($message, $options = null, $internal_date = null) {
return imap_append($this->client->getConnection(), $this->path, $message, $options, $internal_date);
} | php | public function appendMessage($message, $options = null, $internal_date = null) {
return imap_append($this->client->getConnection(), $this->path, $message, $options, $internal_date);
} | [
"public",
"function",
"appendMessage",
"(",
"$",
"message",
",",
"$",
"options",
"=",
"null",
",",
"$",
"internal_date",
"=",
"null",
")",
"{",
"return",
"imap_append",
"(",
"$",
"this",
"->",
"client",
"->",
"getConnection",
"(",
")",
",",
"$",
"this",
... | Append a string message to the current mailbox
@param string $message
@param string $options
@param string $internal_date
@return bool
@throws Exceptions\ConnectionFailedException | [
"Append",
"a",
"string",
"message",
"to",
"the",
"current",
"mailbox"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Folder.php#L427-L429 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.copy | public function copy($mailbox, $options = 0) {
$this->client->openFolder($this->folder_path);
return imap_mail_copy($this->client->getConnection(), $this->msglist, $mailbox, $options);
} | php | public function copy($mailbox, $options = 0) {
$this->client->openFolder($this->folder_path);
return imap_mail_copy($this->client->getConnection(), $this->msglist, $mailbox, $options);
} | [
"public",
"function",
"copy",
"(",
"$",
"mailbox",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"return",
"imap_mail_copy",
"(",
"$",
"this",
"->",
"client",
... | Copy the current Messages to a mailbox
@param $mailbox
@param int $options
@return bool
@throws Exceptions\ConnectionFailedException | [
"Copy",
"the",
"current",
"Messages",
"to",
"a",
"mailbox"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L296-L299 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.move | public function move($mailbox, $options = 0) {
$this->client->openFolder($this->folder_path);
return imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox, $options);
} | php | public function move($mailbox, $options = 0) {
$this->client->openFolder($this->folder_path);
return imap_mail_move($this->client->getConnection(), $this->msglist, $mailbox, $options);
} | [
"public",
"function",
"move",
"(",
"$",
"mailbox",
",",
"$",
"options",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"return",
"imap_mail_move",
"(",
"$",
"this",
"->",
"client",
... | Move the current Messages to a mailbox
@param $mailbox
@param int $options
@return bool
@throws Exceptions\ConnectionFailedException | [
"Move",
"the",
"current",
"Messages",
"to",
"a",
"mailbox"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L310-L313 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.parseHeader | private function parseHeader() {
$this->client->openFolder($this->folder_path);
$this->header = $header = imap_fetchheader($this->client->getConnection(), $this->uid, IMAP::FT_UID);
$this->priority = $this->extractPriority($this->header);
if ($this->header) {
$header = imap_rfc822_parse_headers($this->header);
}
if (property_exists($header, 'subject')) {
if($this->config['decoder']['message']['subject'] === 'utf-8') {
$this->subject = imap_utf8($header->subject);
}else{
$this->subject = mb_decode_mimeheader($header->subject);
}
}
foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){
$this->extractHeaderAddressPart($header, $part);
}
if (property_exists($header, 'references')) {
$this->references = $header->references;
}
if (property_exists($header, 'in_reply_to')) {
$this->in_reply_to = str_replace(['<', '>'], '', $header->in_reply_to);
}
if (property_exists($header, 'message_id')) {
$this->message_id = str_replace(['<', '>'], '', $header->message_id);
}
if (property_exists($header, 'Msgno')) {
$messageNo = (int) trim($header->Msgno);
$this->message_no = ($this->fetch_options == IMAP::FT_UID) ? $messageNo : imap_msgno($this->client->getConnection(), $messageNo);
} else {
$this->message_no = imap_msgno($this->client->getConnection(), $this->getUid());
}
$this->date = $this->parseDate($header);
} | php | private function parseHeader() {
$this->client->openFolder($this->folder_path);
$this->header = $header = imap_fetchheader($this->client->getConnection(), $this->uid, IMAP::FT_UID);
$this->priority = $this->extractPriority($this->header);
if ($this->header) {
$header = imap_rfc822_parse_headers($this->header);
}
if (property_exists($header, 'subject')) {
if($this->config['decoder']['message']['subject'] === 'utf-8') {
$this->subject = imap_utf8($header->subject);
}else{
$this->subject = mb_decode_mimeheader($header->subject);
}
}
foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){
$this->extractHeaderAddressPart($header, $part);
}
if (property_exists($header, 'references')) {
$this->references = $header->references;
}
if (property_exists($header, 'in_reply_to')) {
$this->in_reply_to = str_replace(['<', '>'], '', $header->in_reply_to);
}
if (property_exists($header, 'message_id')) {
$this->message_id = str_replace(['<', '>'], '', $header->message_id);
}
if (property_exists($header, 'Msgno')) {
$messageNo = (int) trim($header->Msgno);
$this->message_no = ($this->fetch_options == IMAP::FT_UID) ? $messageNo : imap_msgno($this->client->getConnection(), $messageNo);
} else {
$this->message_no = imap_msgno($this->client->getConnection(), $this->getUid());
}
$this->date = $this->parseDate($header);
} | [
"private",
"function",
"parseHeader",
"(",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"$",
"this",
"->",
"header",
"=",
"$",
"header",
"=",
"imap_fetchheader",
"(",
"$",
"this",
"->",
"cl... | Parse all defined headers
@return void
@throws Exceptions\ConnectionFailedException
@throws InvalidMessageDateException | [
"Parse",
"all",
"defined",
"headers"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L388-L427 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.parseDate | private function parseDate($header) {
$parsed_date = null;
if (property_exists($header, 'date')) {
$date = $header->date;
if(preg_match('/\+0580/', $date)) {
$date = str_replace('+0580', '+0530', $date);
}
$date = trim(rtrim($date));
try {
$parsed_date = Carbon::parse($date);
} catch (\Exception $e) {
switch (true) {
case preg_match('/([A-Z]{2,3}[\,|\ \,]\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}.*)+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}\, \ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{2,4}\ [0-9]{2}\:[0-9]{2}\:[0-9]{2}\ [A-Z]{2}\ \-[0-9]{2}\:[0-9]{2}\ \([A-Z]{2,3}\ \-[0-9]{2}:[0-9]{2}\))+$/i', $date) > 0:
$array = explode('(', $date);
$array = array_reverse($array);
$date = trim(array_pop($array));
break;
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ UT)+$/i', $date) > 0:
$date .= 'C';
break;
}
try{
$parsed_date = Carbon::parse($date);
} catch (\Exception $_e) {
throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
}
}
}
return $parsed_date;
} | php | private function parseDate($header) {
$parsed_date = null;
if (property_exists($header, 'date')) {
$date = $header->date;
if(preg_match('/\+0580/', $date)) {
$date = str_replace('+0580', '+0530', $date);
}
$date = trim(rtrim($date));
try {
$parsed_date = Carbon::parse($date);
} catch (\Exception $e) {
switch (true) {
case preg_match('/([A-Z]{2,3}[\,|\ \,]\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}.*)+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}\, \ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{2,4}\ [0-9]{2}\:[0-9]{2}\:[0-9]{2}\ [A-Z]{2}\ \-[0-9]{2}\:[0-9]{2}\ \([A-Z]{2,3}\ \-[0-9]{2}:[0-9]{2}\))+$/i', $date) > 0:
$array = explode('(', $date);
$array = array_reverse($array);
$date = trim(array_pop($array));
break;
case preg_match('/([0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ UT)+$/i', $date) > 0:
$date .= 'C';
break;
}
try{
$parsed_date = Carbon::parse($date);
} catch (\Exception $_e) {
throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
}
}
}
return $parsed_date;
} | [
"private",
"function",
"parseDate",
"(",
"$",
"header",
")",
"{",
"$",
"parsed_date",
"=",
"null",
";",
"if",
"(",
"property_exists",
"(",
"$",
"header",
",",
"'date'",
")",
")",
"{",
"$",
"date",
"=",
"$",
"header",
"->",
"date",
";",
"if",
"(",
"... | Exception handling for invalid dates
Currently known invalid formats:
^ Datetime ^ Problem ^ Cause
| Mon, 20 Nov 2017 20:31:31 +0800 (GMT+8:00) | Double timezone specification | A Windows feature
| Thu, 8 Nov 2018 08:54:58 -0200 (-02) |
| | and invalid timezone (max 6 char) |
| 04 Jan 2018 10:12:47 UT | Missing letter "C" | Unknown
| Thu, 31 May 2018 18:15:00 +0800 (added by) | Non-standard details added by the | Unknown
| | mail server |
| Sat, 31 Aug 2013 20:08:23 +0580 | Invalid timezone | PHPMailer bug https://sourceforge.net/p/phpmailer/mailman/message/6132703/
Please report any new invalid timestamps to [#45](https://github.com/Webklex/laravel-imap/issues/45)
@param object $header
@return Carbon|null
@throws InvalidMessageDateException | [
"Exception",
"handling",
"for",
"invalid",
"dates"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L483-L519 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.parseFlags | private function parseFlags() {
$this->flags = FlagCollection::make([]);
$this->client->openFolder($this->folder_path);
$flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID);
if (is_array($flags) && isset($flags[0])) {
foreach($this->available_flags as $flag) {
$this->parseFlag($flags, $flag);
}
}
} | php | private function parseFlags() {
$this->flags = FlagCollection::make([]);
$this->client->openFolder($this->folder_path);
$flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID);
if (is_array($flags) && isset($flags[0])) {
foreach($this->available_flags as $flag) {
$this->parseFlag($flags, $flag);
}
}
} | [
"private",
"function",
"parseFlags",
"(",
")",
"{",
"$",
"this",
"->",
"flags",
"=",
"FlagCollection",
"::",
"make",
"(",
"[",
"]",
")",
";",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"$",
"flag... | Parse additional flags
@return void
@throws Exceptions\ConnectionFailedException | [
"Parse",
"additional",
"flags"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L527-L537 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.parseFlag | private function parseFlag($flags, $flag) {
$flag = strtolower($flag);
if (property_exists($flags[0], strtoupper($flag))) {
$this->flags->put($flag, $flags[0]->{strtoupper($flag)});
} elseif (property_exists($flags[0], ucfirst($flag))) {
$this->flags->put($flag, $flags[0]->{ucfirst($flag)});
} elseif (property_exists($flags[0], $flag)) {
$this->flags->put($flag, $flags[0]->$flag);
}
} | php | private function parseFlag($flags, $flag) {
$flag = strtolower($flag);
if (property_exists($flags[0], strtoupper($flag))) {
$this->flags->put($flag, $flags[0]->{strtoupper($flag)});
} elseif (property_exists($flags[0], ucfirst($flag))) {
$this->flags->put($flag, $flags[0]->{ucfirst($flag)});
} elseif (property_exists($flags[0], $flag)) {
$this->flags->put($flag, $flags[0]->$flag);
}
} | [
"private",
"function",
"parseFlag",
"(",
"$",
"flags",
",",
"$",
"flag",
")",
"{",
"$",
"flag",
"=",
"strtolower",
"(",
"$",
"flag",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"flags",
"[",
"0",
"]",
",",
"strtoupper",
"(",
"$",
"flag",
")",... | Extract a possible flag information from a given array
@param array $flags
@param string $flag | [
"Extract",
"a",
"possible",
"flag",
"information",
"from",
"a",
"given",
"array"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L544-L554 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.getHeaderInfo | public function getHeaderInfo() {
if ($this->header_info == null) {
$this->client->openFolder($this->folder_path);
$this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo());
}
return $this->header_info;
} | php | public function getHeaderInfo() {
if ($this->header_info == null) {
$this->client->openFolder($this->folder_path);
$this->header_info = imap_headerinfo($this->client->getConnection(), $this->getMessageNo());
}
return $this->header_info;
} | [
"public",
"function",
"getHeaderInfo",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"header_info",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"$",
"this",
"->",
"header_info... | Get the current Message header info
@return object
@throws Exceptions\ConnectionFailedException | [
"Get",
"the",
"current",
"Message",
"header",
"info"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L562-L569 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.extractHeaderAddressPart | private function extractHeaderAddressPart($header, $part) {
if (property_exists($header, $part)) {
$this->$part = $this->parseAddresses($header->$part);
}
} | php | private function extractHeaderAddressPart($header, $part) {
if (property_exists($header, $part)) {
$this->$part = $this->parseAddresses($header->$part);
}
} | [
"private",
"function",
"extractHeaderAddressPart",
"(",
"$",
"header",
",",
"$",
"part",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"header",
",",
"$",
"part",
")",
")",
"{",
"$",
"this",
"->",
"$",
"part",
"=",
"$",
"this",
"->",
"parseAddresse... | Extract a given part as address array from a given header
@param object $header
@param string $part | [
"Extract",
"a",
"given",
"part",
"as",
"address",
"array",
"from",
"a",
"given",
"header"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L576-L580 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.parseBody | public function parseBody() {
$this->client->openFolder($this->folder_path);
$this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID);
if(property_exists($this->structure, 'parts')){
$parts = $this->structure->parts;
foreach ($parts as $part) {
foreach ($part->parameters as $parameter) {
if($parameter->attribute == "charset") {
$encoding = $parameter->value;
$encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
$encoding = preg_replace('/iso-8859-8-i/', 'iso-8859-8', $encoding);
$parameter->value = $encoding;
}
}
}
}
$this->fetchStructure($this->structure);
return $this;
} | php | public function parseBody() {
$this->client->openFolder($this->folder_path);
$this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID);
if(property_exists($this->structure, 'parts')){
$parts = $this->structure->parts;
foreach ($parts as $part) {
foreach ($part->parameters as $parameter) {
if($parameter->attribute == "charset") {
$encoding = $parameter->value;
$encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
$encoding = preg_replace('/iso-8859-8-i/', 'iso-8859-8', $encoding);
$parameter->value = $encoding;
}
}
}
}
$this->fetchStructure($this->structure);
return $this;
} | [
"public",
"function",
"parseBody",
"(",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"$",
"this",
"->",
"structure",
"=",
"imap_fetchstructure",
"(",
"$",
"this",
"->",
"client",
"->",
"getCo... | Parse the Message body
@return $this
@throws Exceptions\ConnectionFailedException | [
"Parse",
"the",
"Message",
"body"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L626-L650 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.fetchStructure | private function fetchStructure($structure, $partNumber = null) {
$this->client->openFolder($this->folder_path);
if ($structure->type == IMAP::MESSAGE_TYPE_TEXT &&
($structure->ifdisposition == 0 ||
($structure->ifdisposition == 1 && !isset($structure->parts) && $partNumber == null)
)
) {
if ($structure->subtype == "PLAIN") {
if (!$partNumber) {
$partNumber = 1;
}
$encoding = $this->getEncoding($structure);
$content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
$content = $this->decodeString($content, $structure->encoding);
// We don't need to do convertEncoding() if charset is ASCII (us-ascii):
// ASCII is a subset of UTF-8, so all ASCII files are already UTF-8 encoded
// https://stackoverflow.com/a/11303410
//
// us-ascii is the same as ASCII:
// ASCII is the traditional name for the encoding system; the Internet Assigned Numbers Authority (IANA)
// prefers the updated name US-ASCII, which clarifies that this system was developed in the US and
// based on the typographical symbols predominantly in use there.
// https://en.wikipedia.org/wiki/ASCII
//
// convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken.
if ($encoding != 'us-ascii') {
$content = $this->convertEncoding($content, $encoding);
}
$body = new \stdClass;
$body->type = "text";
$body->content = $content;
$this->bodies['text'] = $body;
$this->fetchAttachment($structure, $partNumber);
} elseif ($structure->subtype == "HTML") {
if (!$partNumber) {
$partNumber = 1;
}
$encoding = $this->getEncoding($structure);
$content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
$content = $this->decodeString($content, $structure->encoding);
if ($encoding != 'us-ascii') {
$content = $this->convertEncoding($content, $encoding);
}
$body = new \stdClass;
$body->type = "html";
$body->content = $content;
$this->bodies['html'] = $body;
}
} elseif ($structure->type == IMAP::MESSAGE_TYPE_MULTIPART) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber.".";
}
$this->fetchStructure($subStruct, $prefix.($index + 1));
}
} else {
if ($this->getFetchAttachmentOption() === true) {
$this->fetchAttachment($structure, $partNumber);
}
}
} | php | private function fetchStructure($structure, $partNumber = null) {
$this->client->openFolder($this->folder_path);
if ($structure->type == IMAP::MESSAGE_TYPE_TEXT &&
($structure->ifdisposition == 0 ||
($structure->ifdisposition == 1 && !isset($structure->parts) && $partNumber == null)
)
) {
if ($structure->subtype == "PLAIN") {
if (!$partNumber) {
$partNumber = 1;
}
$encoding = $this->getEncoding($structure);
$content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
$content = $this->decodeString($content, $structure->encoding);
// We don't need to do convertEncoding() if charset is ASCII (us-ascii):
// ASCII is a subset of UTF-8, so all ASCII files are already UTF-8 encoded
// https://stackoverflow.com/a/11303410
//
// us-ascii is the same as ASCII:
// ASCII is the traditional name for the encoding system; the Internet Assigned Numbers Authority (IANA)
// prefers the updated name US-ASCII, which clarifies that this system was developed in the US and
// based on the typographical symbols predominantly in use there.
// https://en.wikipedia.org/wiki/ASCII
//
// convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken.
if ($encoding != 'us-ascii') {
$content = $this->convertEncoding($content, $encoding);
}
$body = new \stdClass;
$body->type = "text";
$body->content = $content;
$this->bodies['text'] = $body;
$this->fetchAttachment($structure, $partNumber);
} elseif ($structure->subtype == "HTML") {
if (!$partNumber) {
$partNumber = 1;
}
$encoding = $this->getEncoding($structure);
$content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
$content = $this->decodeString($content, $structure->encoding);
if ($encoding != 'us-ascii') {
$content = $this->convertEncoding($content, $encoding);
}
$body = new \stdClass;
$body->type = "html";
$body->content = $content;
$this->bodies['html'] = $body;
}
} elseif ($structure->type == IMAP::MESSAGE_TYPE_MULTIPART) {
foreach ($structure->parts as $index => $subStruct) {
$prefix = "";
if ($partNumber) {
$prefix = $partNumber.".";
}
$this->fetchStructure($subStruct, $prefix.($index + 1));
}
} else {
if ($this->getFetchAttachmentOption() === true) {
$this->fetchAttachment($structure, $partNumber);
}
}
} | [
"private",
"function",
"fetchStructure",
"(",
"$",
"structure",
",",
"$",
"partNumber",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"openFolder",
"(",
"$",
"this",
"->",
"folder_path",
")",
";",
"if",
"(",
"$",
"structure",
"->",
"type",
... | Fetch the Message structure
@param $structure
@param mixed $partNumber
@throws Exceptions\ConnectionFailedException | [
"Fetch",
"the",
"Message",
"structure"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L660-L733 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.fetchAttachment | protected function fetchAttachment($structure, $partNumber) {
$oAttachment = new Attachment($this, $structure, $partNumber);
if ($oAttachment->getName() !== null) {
if ($oAttachment->getId() !== null) {
$this->attachments->put($oAttachment->getId(), $oAttachment);
} else {
$this->attachments->push($oAttachment);
}
}
} | php | protected function fetchAttachment($structure, $partNumber) {
$oAttachment = new Attachment($this, $structure, $partNumber);
if ($oAttachment->getName() !== null) {
if ($oAttachment->getId() !== null) {
$this->attachments->put($oAttachment->getId(), $oAttachment);
} else {
$this->attachments->push($oAttachment);
}
}
} | [
"protected",
"function",
"fetchAttachment",
"(",
"$",
"structure",
",",
"$",
"partNumber",
")",
"{",
"$",
"oAttachment",
"=",
"new",
"Attachment",
"(",
"$",
"this",
",",
"$",
"structure",
",",
"$",
"partNumber",
")",
";",
"if",
"(",
"$",
"oAttachment",
"... | Fetch the Message attachment
@param object $structure
@param mixed $partNumber
@throws Exceptions\ConnectionFailedException | [
"Fetch",
"the",
"Message",
"attachment"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L743-L754 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.decodeString | public function decodeString($string, $encoding) {
switch ($encoding) {
case IMAP::MESSAGE_ENC_7BIT:
return $string;
case IMAP::MESSAGE_ENC_8BIT:
return quoted_printable_decode(imap_8bit($string));
case IMAP::MESSAGE_ENC_BINARY:
return imap_binary($string);
case IMAP::MESSAGE_ENC_BASE64:
return imap_base64($string);
case IMAP::MESSAGE_ENC_QUOTED_PRINTABLE:
return quoted_printable_decode($string);
case IMAP::MESSAGE_ENC_OTHER:
return $string;
default:
return $string;
}
} | php | public function decodeString($string, $encoding) {
switch ($encoding) {
case IMAP::MESSAGE_ENC_7BIT:
return $string;
case IMAP::MESSAGE_ENC_8BIT:
return quoted_printable_decode(imap_8bit($string));
case IMAP::MESSAGE_ENC_BINARY:
return imap_binary($string);
case IMAP::MESSAGE_ENC_BASE64:
return imap_base64($string);
case IMAP::MESSAGE_ENC_QUOTED_PRINTABLE:
return quoted_printable_decode($string);
case IMAP::MESSAGE_ENC_OTHER:
return $string;
default:
return $string;
}
} | [
"public",
"function",
"decodeString",
"(",
"$",
"string",
",",
"$",
"encoding",
")",
"{",
"switch",
"(",
"$",
"encoding",
")",
"{",
"case",
"IMAP",
"::",
"MESSAGE_ENC_7BIT",
":",
"return",
"$",
"string",
";",
"case",
"IMAP",
"::",
"MESSAGE_ENC_8BIT",
":",
... | Decode a given string
@param $string
@param $encoding
@return string | [
"Decode",
"a",
"given",
"string"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L836-L853 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.convertEncoding | public function convertEncoding($str, $from = "ISO-8859-2", $to = "UTF-8") {
$from = EncodingAliases::get($from);
$to = EncodingAliases::get($to);
if ($from === $to) {
return $str;
}
// We don't need to do convertEncoding() if charset is ASCII (us-ascii):
// ASCII is a subset of UTF-8, so all ASCII files are already UTF-8 encoded
// https://stackoverflow.com/a/11303410
//
// us-ascii is the same as ASCII:
// ASCII is the traditional name for the encoding system; the Internet Assigned Numbers Authority (IANA)
// prefers the updated name US-ASCII, which clarifies that this system was developed in the US and
// based on the typographical symbols predominantly in use there.
// https://en.wikipedia.org/wiki/ASCII
//
// convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken.
if (strtolower($from) == 'us-ascii' && $to == 'UTF-8') {
return $str;
}
if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
return @iconv($from, $to.'//IGNORE', $str);
} else {
if (!$from) {
return mb_convert_encoding($str, $to);
}
return mb_convert_encoding($str, $to, $from);
}
} | php | public function convertEncoding($str, $from = "ISO-8859-2", $to = "UTF-8") {
$from = EncodingAliases::get($from);
$to = EncodingAliases::get($to);
if ($from === $to) {
return $str;
}
// We don't need to do convertEncoding() if charset is ASCII (us-ascii):
// ASCII is a subset of UTF-8, so all ASCII files are already UTF-8 encoded
// https://stackoverflow.com/a/11303410
//
// us-ascii is the same as ASCII:
// ASCII is the traditional name for the encoding system; the Internet Assigned Numbers Authority (IANA)
// prefers the updated name US-ASCII, which clarifies that this system was developed in the US and
// based on the typographical symbols predominantly in use there.
// https://en.wikipedia.org/wiki/ASCII
//
// convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken.
if (strtolower($from) == 'us-ascii' && $to == 'UTF-8') {
return $str;
}
if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
return @iconv($from, $to.'//IGNORE', $str);
} else {
if (!$from) {
return mb_convert_encoding($str, $to);
}
return mb_convert_encoding($str, $to, $from);
}
} | [
"public",
"function",
"convertEncoding",
"(",
"$",
"str",
",",
"$",
"from",
"=",
"\"ISO-8859-2\"",
",",
"$",
"to",
"=",
"\"UTF-8\"",
")",
"{",
"$",
"from",
"=",
"EncodingAliases",
"::",
"get",
"(",
"$",
"from",
")",
";",
"$",
"to",
"=",
"EncodingAliase... | Convert the encoding
@param $str
@param string $from
@param string $to
@return mixed|string | [
"Convert",
"the",
"encoding"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L864-L896 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.getEncoding | public function getEncoding($structure) {
if (property_exists($structure, 'parameters')) {
foreach ($structure->parameters as $parameter) {
if (strtolower($parameter->attribute) == "charset") {
return EncodingAliases::get($parameter->value);
}
}
}elseif (is_string($structure) === true){
return mb_detect_encoding($structure);
}
return 'UTF-8';
} | php | public function getEncoding($structure) {
if (property_exists($structure, 'parameters')) {
foreach ($structure->parameters as $parameter) {
if (strtolower($parameter->attribute) == "charset") {
return EncodingAliases::get($parameter->value);
}
}
}elseif (is_string($structure) === true){
return mb_detect_encoding($structure);
}
return 'UTF-8';
} | [
"public",
"function",
"getEncoding",
"(",
"$",
"structure",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"structure",
",",
"'parameters'",
")",
")",
"{",
"foreach",
"(",
"$",
"structure",
"->",
"parameters",
"as",
"$",
"parameter",
")",
"{",
"if",
"... | Get the encoding of a given abject
@param object|string $structure
@return string | [
"Get",
"the",
"encoding",
"of",
"a",
"given",
"abject"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L905-L917 | train |
Webklex/laravel-imap | src/IMAP/Message.php | Message.is | public function is(Message $message = null) {
if (is_null($message)) {
return false;
}
return $this->uid == $message->uid
&& $this->message_id == $message->message_id
&& $this->subject == $message->subject
&& $this->date->eq($message->date);
} | php | public function is(Message $message = null) {
if (is_null($message)) {
return false;
}
return $this->uid == $message->uid
&& $this->message_id == $message->message_id
&& $this->subject == $message->subject
&& $this->date->eq($message->date);
} | [
"public",
"function",
"is",
"(",
"Message",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"message",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"uid",
"==",
"$",
"message",
"->",
"uid",
"&&",
... | Does this message match another one?
A match means same uid, message id, subject and date/time.
@param null|Message $message
@return boolean | [
"Does",
"this",
"message",
"match",
"another",
"one?"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Message.php#L1161-L1170 | train |
Webklex/laravel-imap | src/IMAP/Support/PaginatedCollection.php | PaginatedCollection.paginate | public function paginate($per_page = 15, $page = null, $page_name = 'page') {
$page = $page ?: Paginator::resolveCurrentPage($page_name);
$results = ($total = $this->count()) ? $this->forPage($page, $per_page) : $this->all();
return $this->paginator($results, $total, $per_page, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $page_name,
]);
} | php | public function paginate($per_page = 15, $page = null, $page_name = 'page') {
$page = $page ?: Paginator::resolveCurrentPage($page_name);
$results = ($total = $this->count()) ? $this->forPage($page, $per_page) : $this->all();
return $this->paginator($results, $total, $per_page, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $page_name,
]);
} | [
"public",
"function",
"paginate",
"(",
"$",
"per_page",
"=",
"15",
",",
"$",
"page",
"=",
"null",
",",
"$",
"page_name",
"=",
"'page'",
")",
"{",
"$",
"page",
"=",
"$",
"page",
"?",
":",
"Paginator",
"::",
"resolveCurrentPage",
"(",
"$",
"page_name",
... | Paginate the current collection.
@param int $per_page
@param int|null $page
@param string $page_name
@return LengthAwarePaginator | [
"Paginate",
"the",
"current",
"collection",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Support/PaginatedCollection.php#L35-L44 | train |
Webklex/laravel-imap | src/IMAP/Query/Query.php | Query.get | public function get() {
$messages = MessageCollection::make([]);
try {
$this->generate_query();
/**
* Don't set the charset if it isn't used - prevent strange outlook mail server errors
* @see https://github.com/Webklex/laravel-imap/issues/100
*/
if($this->getCharset() === null){
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
}else{
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
}
if ($available_messages !== false) {
$available_messages = collect($available_messages);
$options = config('imap.options');
if(strtolower($options['fetch_order']) === 'desc'){
$available_messages = $available_messages->reverse();
}
$query =& $this;
$available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
$oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags());
switch ($options['message_key']){
case 'number':
$message_key = $oMessage->getMessageNo();
break;
case 'list':
$message_key = $msglist;
break;
default:
$message_key = $oMessage->getMessageId();
break;
}
$messages->put($message_key, $oMessage);
});
}
return $messages;
} catch (\Exception $e) {
throw new GetMessagesFailedException($e->getMessage());
}
} | php | public function get() {
$messages = MessageCollection::make([]);
try {
$this->generate_query();
/**
* Don't set the charset if it isn't used - prevent strange outlook mail server errors
* @see https://github.com/Webklex/laravel-imap/issues/100
*/
if($this->getCharset() === null){
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
}else{
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
}
if ($available_messages !== false) {
$available_messages = collect($available_messages);
$options = config('imap.options');
if(strtolower($options['fetch_order']) === 'desc'){
$available_messages = $available_messages->reverse();
}
$query =& $this;
$available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
$oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags());
switch ($options['message_key']){
case 'number':
$message_key = $oMessage->getMessageNo();
break;
case 'list':
$message_key = $msglist;
break;
default:
$message_key = $oMessage->getMessageId();
break;
}
$messages->put($message_key, $oMessage);
});
}
return $messages;
} catch (\Exception $e) {
throw new GetMessagesFailedException($e->getMessage());
}
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"messages",
"=",
"MessageCollection",
"::",
"make",
"(",
"[",
"]",
")",
";",
"try",
"{",
"$",
"this",
"->",
"generate_query",
"(",
")",
";",
"/**\n * Don't set the charset if it isn't used - prevent stra... | Fetch the current query and return all found messages
@return MessageCollection
@throws GetMessagesFailedException | [
"Fetch",
"the",
"current",
"query",
"and",
"return",
"all",
"found",
"messages"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Query/Query.php#L143-L192 | train |
Webklex/laravel-imap | src/IMAP/Query/Query.php | Query.generate_query | public function generate_query() {
$query = '';
$this->query->each(function($statement) use(&$query) {
if (count($statement) == 1) {
$query .= $statement[0];
} else {
if($statement[1] === null){
$query .= $statement[0];
}else{
$query .= $statement[0].' "'.$statement[1].'"';
}
}
$query .= ' ';
});
$this->raw_query = trim($query);
return $this->raw_query;
} | php | public function generate_query() {
$query = '';
$this->query->each(function($statement) use(&$query) {
if (count($statement) == 1) {
$query .= $statement[0];
} else {
if($statement[1] === null){
$query .= $statement[0];
}else{
$query .= $statement[0].' "'.$statement[1].'"';
}
}
$query .= ' ';
});
$this->raw_query = trim($query);
return $this->raw_query;
} | [
"public",
"function",
"generate_query",
"(",
")",
"{",
"$",
"query",
"=",
"''",
";",
"$",
"this",
"->",
"query",
"->",
"each",
"(",
"function",
"(",
"$",
"statement",
")",
"use",
"(",
"&",
"$",
"query",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"st... | Get the raw IMAP search query
@return string | [
"Get",
"the",
"raw",
"IMAP",
"search",
"query"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Query/Query.php#L215-L234 | train |
Webklex/laravel-imap | src/IMAP/Attachment.php | Attachment.findType | protected function findType() {
switch ($this->structure->type) {
case IMAP::ATTACHMENT_TYPE_MESSAGE:
$this->type = 'message';
break;
case IMAP::ATTACHMENT_TYPE_APPLICATION:
$this->type = 'application';
break;
case IMAP::ATTACHMENT_TYPE_AUDIO:
$this->type = 'audio';
break;
case IMAP::ATTACHMENT_TYPE_IMAGE:
$this->type = 'image';
break;
case IMAP::ATTACHMENT_TYPE_VIDEO:
$this->type = 'video';
break;
case IMAP::ATTACHMENT_TYPE_MODEL:
$this->type = 'model';
break;
case IMAP::ATTACHMENT_TYPE_TEXT:
$this->type = 'text';
break;
case IMAP::ATTACHMENT_TYPE_MULTIPART:
$this->type = 'multipart';
break;
default:
$this->type = 'other';
break;
}
} | php | protected function findType() {
switch ($this->structure->type) {
case IMAP::ATTACHMENT_TYPE_MESSAGE:
$this->type = 'message';
break;
case IMAP::ATTACHMENT_TYPE_APPLICATION:
$this->type = 'application';
break;
case IMAP::ATTACHMENT_TYPE_AUDIO:
$this->type = 'audio';
break;
case IMAP::ATTACHMENT_TYPE_IMAGE:
$this->type = 'image';
break;
case IMAP::ATTACHMENT_TYPE_VIDEO:
$this->type = 'video';
break;
case IMAP::ATTACHMENT_TYPE_MODEL:
$this->type = 'model';
break;
case IMAP::ATTACHMENT_TYPE_TEXT:
$this->type = 'text';
break;
case IMAP::ATTACHMENT_TYPE_MULTIPART:
$this->type = 'multipart';
break;
default:
$this->type = 'other';
break;
}
} | [
"protected",
"function",
"findType",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"structure",
"->",
"type",
")",
"{",
"case",
"IMAP",
"::",
"ATTACHMENT_TYPE_MESSAGE",
":",
"$",
"this",
"->",
"type",
"=",
"'message'",
";",
"break",
";",
"case",
"IMAP... | Determine the structure type | [
"Determine",
"the",
"structure",
"type"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Attachment.php#L160-L190 | train |
Webklex/laravel-imap | src/IMAP/Attachment.php | Attachment.fetch | protected function fetch() {
$content = imap_fetchbody($this->oMessage->getClient()->getConnection(), $this->oMessage->getUid(), $this->part_number, $this->oMessage->getFetchOptions() | FT_UID);
$this->content_type = $this->type.'/'.strtolower($this->structure->subtype);
$this->content = $this->oMessage->decodeString($content, $this->structure->encoding);
if (property_exists($this->structure, 'id')) {
$this->id = str_replace(['<', '>'], '', $this->structure->id);
}
if (property_exists($this->structure, 'dparameters')) {
foreach ($this->structure->dparameters as $parameter) {
if (strtolower($parameter->attribute) == "filename") {
$this->setName($parameter->value);
$this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
break;
}
}
}
if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->structure->type) {
if ($this->structure->ifdescription) {
$this->setName($this->structure->description);
} else {
$this->setName($this->structure->subtype);
}
}
if (!$this->name && property_exists($this->structure, 'parameters')) {
foreach ($this->structure->parameters as $parameter) {
if (strtolower($parameter->attribute) == "name") {
$this->setName($parameter->value);
$this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
break;
}
}
}
} | php | protected function fetch() {
$content = imap_fetchbody($this->oMessage->getClient()->getConnection(), $this->oMessage->getUid(), $this->part_number, $this->oMessage->getFetchOptions() | FT_UID);
$this->content_type = $this->type.'/'.strtolower($this->structure->subtype);
$this->content = $this->oMessage->decodeString($content, $this->structure->encoding);
if (property_exists($this->structure, 'id')) {
$this->id = str_replace(['<', '>'], '', $this->structure->id);
}
if (property_exists($this->structure, 'dparameters')) {
foreach ($this->structure->dparameters as $parameter) {
if (strtolower($parameter->attribute) == "filename") {
$this->setName($parameter->value);
$this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
break;
}
}
}
if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->structure->type) {
if ($this->structure->ifdescription) {
$this->setName($this->structure->description);
} else {
$this->setName($this->structure->subtype);
}
}
if (!$this->name && property_exists($this->structure, 'parameters')) {
foreach ($this->structure->parameters as $parameter) {
if (strtolower($parameter->attribute) == "name") {
$this->setName($parameter->value);
$this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
break;
}
}
}
} | [
"protected",
"function",
"fetch",
"(",
")",
"{",
"$",
"content",
"=",
"imap_fetchbody",
"(",
"$",
"this",
"->",
"oMessage",
"->",
"getClient",
"(",
")",
"->",
"getConnection",
"(",
")",
",",
"$",
"this",
"->",
"oMessage",
"->",
"getUid",
"(",
")",
",",... | Fetch the given attachment
@throws Exceptions\ConnectionFailedException | [
"Fetch",
"the",
"given",
"attachment"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Attachment.php#L197-L235 | train |
Webklex/laravel-imap | src/IMAP/Attachment.php | Attachment.save | public function save($path = null, $filename = null) {
$path = $path ?: storage_path();
$filename = $filename ?: $this->getName();
$path = substr($path, -1) == DIRECTORY_SEPARATOR ? $path : $path.DIRECTORY_SEPARATOR;
return File::put($path.$filename, $this->getContent()) !== false;
} | php | public function save($path = null, $filename = null) {
$path = $path ?: storage_path();
$filename = $filename ?: $this->getName();
$path = substr($path, -1) == DIRECTORY_SEPARATOR ? $path : $path.DIRECTORY_SEPARATOR;
return File::put($path.$filename, $this->getContent()) !== false;
} | [
"public",
"function",
"save",
"(",
"$",
"path",
"=",
"null",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"path",
"?",
":",
"storage_path",
"(",
")",
";",
"$",
"filename",
"=",
"$",
"filename",
"?",
":",
"$",
"this",
"->",
... | Save the attachment content to your filesystem
@param string|null $path
@param string|null $filename
@return boolean | [
"Save",
"the",
"attachment",
"content",
"to",
"your",
"filesystem"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Attachment.php#L245-L252 | train |
Webklex/laravel-imap | src/IMAP/ClientManager.php | ClientManager.account | public function account($name = null) {
$name = $name ?: $this->getDefaultAccount();
// If the connection has not been resolved yet we will resolve it now as all
// of the connections are resolved when they are actually needed so we do
// not make any unnecessary connection to the various queue end-points.
if (!isset($this->accounts[$name])) {
$this->accounts[$name] = $this->resolve($name);
}
return $this->accounts[$name];
} | php | public function account($name = null) {
$name = $name ?: $this->getDefaultAccount();
// If the connection has not been resolved yet we will resolve it now as all
// of the connections are resolved when they are actually needed so we do
// not make any unnecessary connection to the various queue end-points.
if (!isset($this->accounts[$name])) {
$this->accounts[$name] = $this->resolve($name);
}
return $this->accounts[$name];
} | [
"public",
"function",
"account",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"$",
"name",
"?",
":",
"$",
"this",
"->",
"getDefaultAccount",
"(",
")",
";",
"// If the connection has not been resolved yet we will resolve it now as all",
"// of the conne... | Resolve a account instance.
@param string $name
@return Client | [
"Resolve",
"a",
"account",
"instance",
"."
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/ClientManager.php#L52-L63 | train |
Webklex/laravel-imap | src/IMAP/Support/Masks/MessageMask.php | MessageMask.getHtmlBody | public function getHtmlBody(){
$bodies = $this->parent->getBodies();
if (!isset($bodies['html'])) {
return null;
}
return $bodies['html']->content;
} | php | public function getHtmlBody(){
$bodies = $this->parent->getBodies();
if (!isset($bodies['html'])) {
return null;
}
return $bodies['html']->content;
} | [
"public",
"function",
"getHtmlBody",
"(",
")",
"{",
"$",
"bodies",
"=",
"$",
"this",
"->",
"parent",
"->",
"getBodies",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"bodies",
"[",
"'html'",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"re... | Get the message html body
@return null | [
"Get",
"the",
"message",
"html",
"body"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/src/IMAP/Support/Masks/MessageMask.php#L32-L39 | train |
Webklex/laravel-imap | examples/custom_attachment_mask.php | CustomAttachmentMask.custom_save | public function custom_save() {
$path = storage_path('foo');
$filename = $this->token();
$path = substr($path, -1) == DIRECTORY_SEPARATOR ? $path : $path.DIRECTORY_SEPARATOR;
return \Illuminate\Support\Facades\File::put($path.$filename, $this->getContent()) !== false;
} | php | public function custom_save() {
$path = storage_path('foo');
$filename = $this->token();
$path = substr($path, -1) == DIRECTORY_SEPARATOR ? $path : $path.DIRECTORY_SEPARATOR;
return \Illuminate\Support\Facades\File::put($path.$filename, $this->getContent()) !== false;
} | [
"public",
"function",
"custom_save",
"(",
")",
"{",
"$",
"path",
"=",
"storage_path",
"(",
"'foo'",
")",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"token",
"(",
")",
";",
"$",
"path",
"=",
"substr",
"(",
"$",
"path",
",",
"-",
"1",
")",
"==",... | Custom attachment saving method
@return bool | [
"Custom",
"attachment",
"saving",
"method"
] | 4fa8b8fed0029bc491391738658667acbcb3ad2c | https://github.com/Webklex/laravel-imap/blob/4fa8b8fed0029bc491391738658667acbcb3ad2c/examples/custom_attachment_mask.php#L27-L34 | train |
mailjet/laravel-mailjet | src/Services/TemplateService.php | TemplateService.getAll | public function getAll(array $filters = null)
{
$response = $this->mailjet->get(Resources::$Template,
['filters' => $filters]);
if (!$response->success()) {
$this->throwError("TemplateService :getAll() failed", $response);
}
return $response->getData();
} | php | public function getAll(array $filters = null)
{
$response = $this->mailjet->get(Resources::$Template,
['filters' => $filters]);
if (!$response->success()) {
$this->throwError("TemplateService :getAll() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"filters",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Template",
",",
"[",
"'filters'",
"=>",
"$",
"filters",
"]",
")",
";",... | List template resources available for this apikey, use a GET request.
Alternatively, you may want to add one or more filters.
@param array optional $filters
@return templates | [
"List",
"template",
"resources",
"available",
"for",
"this",
"apikey",
"use",
"a",
"GET",
"request",
".",
"Alternatively",
"you",
"may",
"want",
"to",
"add",
"one",
"or",
"more",
"filters",
"."
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/TemplateService.php#L35-L44 | train |
mailjet/laravel-mailjet | src/Services/TemplateService.php | TemplateService.get | public function get($id)
{
$response = $this->mailjet->get(Resources::$Template, ['id' => $id]);
if (!$response->success()) {
$this->throwError("TemplateService:get() failed", $response);
}
return $response->getData();
} | php | public function get($id)
{
$response = $this->mailjet->get(Resources::$Template, ['id' => $id]);
if (!$response->success()) {
$this->throwError("TemplateService:get() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Template",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"if",
"(",
"!",
"$",
"response",
... | Access a given template resource, use a GET request, providing the template's ID value
@param string $id
@return $Template | [
"Access",
"a",
"given",
"template",
"resource",
"use",
"a",
"GET",
"request",
"providing",
"the",
"template",
"s",
"ID",
"value"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/TemplateService.php#L51-L59 | train |
mailjet/laravel-mailjet | src/Services/TemplateService.php | TemplateService.update | public function update($id, Template $Template)
{
$response = $this->mailjet->put(Resources::$Template,
['id' => $id, 'body' => $Template->format()]);
if (!$response->success()) {
$this->throwError("TemplateService:update() failed", $response);
}
return $response->getData();
} | php | public function update($id, Template $Template)
{
$response = $this->mailjet->put(Resources::$Template,
['id' => $id, 'body' => $Template->format()]);
if (!$response->success()) {
$this->throwError("TemplateService:update() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"Template",
"$",
"Template",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"put",
"(",
"Resources",
"::",
"$",
"Template",
",",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'body'",
... | Update one specific template resource with a PUT request, providing the template's ID value
@param int $id
@param Template $Template | [
"Update",
"one",
"specific",
"template",
"resource",
"with",
"a",
"PUT",
"request",
"providing",
"the",
"template",
"s",
"ID",
"value"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/TemplateService.php#L81-L90 | train |
mailjet/laravel-mailjet | src/Services/TemplateService.php | TemplateService.getDetailContent | public function getDetailContent($id)
{
$response = $this->mailjet->get(Resources::$TemplateDetailcontent,
['id' => $id]);
if (!$response->success()) {
$this->throwError("TemplateService:getDetailContent failed",
$response);
}
return $response->getData();
} | php | public function getDetailContent($id)
{
$response = $this->mailjet->get(Resources::$TemplateDetailcontent,
['id' => $id]);
if (!$response->success()) {
$this->throwError("TemplateService:getDetailContent failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"getDetailContent",
"(",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"get",
"(",
"Resources",
"::",
"$",
"TemplateDetailcontent",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"if",
"(",
"!... | Return the text and html contents of the Template
@param string $id
@return array | [
"Return",
"the",
"text",
"and",
"html",
"contents",
"of",
"the",
"Template"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/TemplateService.php#L112-L122 | train |
mailjet/laravel-mailjet | src/Services/TemplateService.php | TemplateService.deleteDetailContent | public function deleteDetailContent($id)
{
$nullContent = null;
$response = $this->mailjet->post(Resources::$TemplateDetailcontent,
['id' => $id, 'body' => $nullContent]);
if (!$response->success()) {
$this->throwError("TemplateService:createDetailContent failed",
$response);
}
return $response->getData();
} | php | public function deleteDetailContent($id)
{
$nullContent = null;
$response = $this->mailjet->post(Resources::$TemplateDetailcontent,
['id' => $id, 'body' => $nullContent]);
if (!$response->success()) {
$this->throwError("TemplateService:createDetailContent failed",
$response);
}
return $response->getData();
} | [
"public",
"function",
"deleteDetailContent",
"(",
"$",
"id",
")",
"{",
"$",
"nullContent",
"=",
"null",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"mailjet",
"->",
"post",
"(",
"Resources",
"::",
"$",
"TemplateDetailcontent",
",",
"[",
"'id'",
"=>",
"... | Deletes the content of a Template
@return array | [
"Deletes",
"the",
"content",
"of",
"a",
"Template"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/TemplateService.php#L144-L155 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.getAllLists | public function getAllLists($filters)
{
$response = $this->client->get(Resources::$Contactslist, ['filters' => $filters]);
if (!$response->success()) {
$this->throwError("MailjetService:getAllLists() failed", $response);
}
return $response;
} | php | public function getAllLists($filters)
{
$response = $this->client->get(Resources::$Contactslist, ['filters' => $filters]);
if (!$response->success()) {
$this->throwError("MailjetService:getAllLists() failed", $response);
}
return $response;
} | [
"public",
"function",
"getAllLists",
"(",
"$",
"filters",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Contactslist",
",",
"[",
"'filters'",
"=>",
"$",
"filters",
"]",
")",
";",
"if",
"(",
"!... | Get all list on your mailjet account
@param array $filters Filters that will be use to filter the request. See mailjet API documentation for all filters available
@return array | [
"Get",
"all",
"list",
"on",
"your",
"mailjet",
"account"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L107-L114 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.createList | public function createList($body)
{
$response = $this->client->post(Resources::$Contactslist, ['body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:createList() failed", $response);
}
return $response;
} | php | public function createList($body)
{
$response = $this->client->post(Resources::$Contactslist, ['body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:createList() failed", $response);
}
return $response;
} | [
"public",
"function",
"createList",
"(",
"$",
"body",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"Resources",
"::",
"$",
"Contactslist",
",",
"[",
"'body'",
"=>",
"$",
"body",
"]",
")",
";",
"if",
"(",
"!",
"$",... | Create a new list
@param array $body array containing the list informations. the 'Name' parameter is mandatory.See mailjet API documentation for all parameters available
@return array | [
"Create",
"a",
"new",
"list"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L121-L128 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.getListRecipients | public function getListRecipients($filters)
{
$response = $this->client->get(Resources::$Listrecipient, ['filters' => $filters]);
if (!$response->success()) {
$this->throwError("MailjetService:getListRecipients() failed", $response);
}
return $response;
} | php | public function getListRecipients($filters)
{
$response = $this->client->get(Resources::$Listrecipient, ['filters' => $filters]);
if (!$response->success()) {
$this->throwError("MailjetService:getListRecipients() failed", $response);
}
return $response;
} | [
"public",
"function",
"getListRecipients",
"(",
"$",
"filters",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Listrecipient",
",",
"[",
"'filters'",
"=>",
"$",
"filters",
"]",
")",
";",
"if",
"(... | Get all list recipient on your mailjet account
@param array $filters Filters that will be use to filter the request. See mailjet API documentation for all filters available
@return array | [
"Get",
"all",
"list",
"recipient",
"on",
"your",
"mailjet",
"account"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L135-L142 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.getSingleContact | public function getSingleContact($id)
{
$response = $this->client->get(Resources::$Contact, ['id' => $id]);
if (!$response->success()) {
$this->throwError("MailjetService:getSingleContact() failed", $response);
}
return $response;
} | php | public function getSingleContact($id)
{
$response = $this->client->get(Resources::$Contact, ['id' => $id]);
if (!$response->success()) {
$this->throwError("MailjetService:getSingleContact() failed", $response);
}
return $response;
} | [
"public",
"function",
"getSingleContact",
"(",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"Resources",
"::",
"$",
"Contact",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"if",
"(",
"!",
"$",
"re... | Get single contact informations.
@param int $id ID of the contact
@return array | [
"Get",
"single",
"contact",
"informations",
"."
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L149-L156 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.createContact | public function createContact($body)
{
$response = $this->client->post(Resources::$Contact, ['body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:createContact() failed", $response);
}
return $response;
} | php | public function createContact($body)
{
$response = $this->client->post(Resources::$Contact, ['body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:createContact() failed", $response);
}
return $response;
} | [
"public",
"function",
"createContact",
"(",
"$",
"body",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"Resources",
"::",
"$",
"Contact",
",",
"[",
"'body'",
"=>",
"$",
"body",
"]",
")",
";",
"if",
"(",
"!",
"$",
... | create a contact
@param array $body array containing the list informations. the 'Email' parameter is mandatory.See mailjet API documentation for all parameters available
@return array | [
"create",
"a",
"contact"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L163-L170 | train |
mailjet/laravel-mailjet | src/Services/MailjetService.php | MailjetService.editListrecipient | public function editListrecipient($id, $body)
{
$response = $this->client->put(Resources::$Listrecipient, ['id'=>$id, 'body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:editListrecipient() failed", $response);
}
return $response;
} | php | public function editListrecipient($id, $body)
{
$response = $this->client->put(Resources::$Listrecipient, ['id'=>$id, 'body' => $body]);
if (!$response->success()) {
$this->throwError("MailjetService:editListrecipient() failed", $response);
}
return $response;
} | [
"public",
"function",
"editListrecipient",
"(",
"$",
"id",
",",
"$",
"body",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"put",
"(",
"Resources",
"::",
"$",
"Listrecipient",
",",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'body'",
"=>... | edit a list recipient
@param int $id id of the list recipient
@param array $body array containing the list informations. the 'ContactID' and 'ListID' parameters are mandatory.See mailjet API documentation for all parameters available
@return array | [
"edit",
"a",
"list",
"recipient"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/MailjetService.php#L192-L199 | train |
mailjet/laravel-mailjet | src/Services/ContactsListService.php | ContactsListService.delete | public function delete($listId, Contact $contact)
{
$contact->setAction(Contact::ACTION_REMOVE);
$response = $this->_exec($listId, $contact);
if (!$response->success()) {
$this->throwError("ContactsListService:delete() failed", $response);
}
return $response->getData();
} | php | public function delete($listId, Contact $contact)
{
$contact->setAction(Contact::ACTION_REMOVE);
$response = $this->_exec($listId, $contact);
if (!$response->success()) {
$this->throwError("ContactsListService:delete() failed", $response);
}
return $response->getData();
} | [
"public",
"function",
"delete",
"(",
"$",
"listId",
",",
"Contact",
"$",
"contact",
")",
"{",
"$",
"contact",
"->",
"setAction",
"(",
"Contact",
"::",
"ACTION_REMOVE",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_exec",
"(",
"$",
"listId",
",",... | Delete a Contact from listId
@param string $listId
@param Contact $contact | [
"Delete",
"a",
"Contact",
"from",
"listId"
] | 8ecafa61ddebedc5e943b825b18359f333df9972 | https://github.com/mailjet/laravel-mailjet/blob/8ecafa61ddebedc5e943b825b18359f333df9972/src/Services/ContactsListService.php#L115-L124 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.