id
int32
0
241k
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
224,100
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.createProductAttribute
public function createProductAttribute( Attribute $attribute, ProductInterface $product, AttributeValue $attributeValue ) { $productAttribute = $this->productAttributeRepository->createNew(); $productAttribute->setAttribute($attribute); $productAttribute->setProduct($...
php
public function createProductAttribute( Attribute $attribute, ProductInterface $product, AttributeValue $attributeValue ) { $productAttribute = $this->productAttributeRepository->createNew(); $productAttribute->setAttribute($attribute); $productAttribute->setProduct($...
[ "public", "function", "createProductAttribute", "(", "Attribute", "$", "attribute", ",", "ProductInterface", "$", "product", ",", "AttributeValue", "$", "attributeValue", ")", "{", "$", "productAttribute", "=", "$", "this", "->", "productAttributeRepository", "->", ...
Creates a new ProductAttribute relation. @param Attribute $attribute @param ProductInterface $product @param AttributeValue $attributeValue @return ProductAttribute
[ "Creates", "a", "new", "ProductAttribute", "relation", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L76-L90
224,101
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.createAttributeValue
public function createAttributeValue(Attribute $attribute, $value, $locale) { $attributeValue = $this->attributeValueRepository->createNew(); $attributeValue->setAttribute($attribute); $this->entityManager->persist($attributeValue); $attribute->addValue($attributeValue); $thi...
php
public function createAttributeValue(Attribute $attribute, $value, $locale) { $attributeValue = $this->attributeValueRepository->createNew(); $attributeValue->setAttribute($attribute); $this->entityManager->persist($attributeValue); $attribute->addValue($attributeValue); $thi...
[ "public", "function", "createAttributeValue", "(", "Attribute", "$", "attribute", ",", "$", "value", ",", "$", "locale", ")", "{", "$", "attributeValue", "=", "$", "this", "->", "attributeValueRepository", "->", "createNew", "(", ")", ";", "$", "attributeValue...
Creates a new attribute value and its translation in the specified locale. @param Attribute $attribute @param string $value @param string $locale @return AttributeValue
[ "Creates", "a", "new", "attribute", "value", "and", "its", "translation", "in", "the", "specified", "locale", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L101-L110
224,102
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.setOrCreateAttributeValueTranslation
public function setOrCreateAttributeValueTranslation(AttributeValue $attributeValue, $value, $locale) { // Check if translation already exists for given locale. $attributeValueTranslation = null; /** @var AttributeValueTranslation $translation */ foreach ($attributeValue->getTranslat...
php
public function setOrCreateAttributeValueTranslation(AttributeValue $attributeValue, $value, $locale) { // Check if translation already exists for given locale. $attributeValueTranslation = null; /** @var AttributeValueTranslation $translation */ foreach ($attributeValue->getTranslat...
[ "public", "function", "setOrCreateAttributeValueTranslation", "(", "AttributeValue", "$", "attributeValue", ",", "$", "value", ",", "$", "locale", ")", "{", "// Check if translation already exists for given locale.", "$", "attributeValueTranslation", "=", "null", ";", "/** ...
Checks if AttributeValue already contains a translation in given locale or creates a new one. @param AttributeValue $attributeValue @param string $value @param string $locale @return AttributeValueTranslation
[ "Checks", "if", "AttributeValue", "already", "contains", "a", "translation", "in", "given", "locale", "or", "creates", "a", "new", "one", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L121-L142
224,103
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.removeAttributeValueTranslation
public function removeAttributeValueTranslation(AttributeValue $attributeValue, $locale) { // Check if translation already exists for given locale. $attributeValueTranslation = $this->retrieveAttributeValueTranslationByLocale($attributeValue, $locale); if ($attributeValueTranslation) { ...
php
public function removeAttributeValueTranslation(AttributeValue $attributeValue, $locale) { // Check if translation already exists for given locale. $attributeValueTranslation = $this->retrieveAttributeValueTranslationByLocale($attributeValue, $locale); if ($attributeValueTranslation) { ...
[ "public", "function", "removeAttributeValueTranslation", "(", "AttributeValue", "$", "attributeValue", ",", "$", "locale", ")", "{", "// Check if translation already exists for given locale.", "$", "attributeValueTranslation", "=", "$", "this", "->", "retrieveAttributeValueTran...
Removes attribute value translation in given locale from given attribute. @param AttributeValue $attributeValue @param string $locale
[ "Removes", "attribute", "value", "translation", "in", "given", "locale", "from", "given", "attribute", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L150-L158
224,104
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.removeAllAttributeValueTranslations
public function removeAllAttributeValueTranslations(AttributeValue $attributeValue) { // Check if translation already exists for given locale. /** @var AttributeValueTranslation $attributeValueTranslation */ foreach ($attributeValue->getTranslations() as $attributeValueTranslation) { ...
php
public function removeAllAttributeValueTranslations(AttributeValue $attributeValue) { // Check if translation already exists for given locale. /** @var AttributeValueTranslation $attributeValueTranslation */ foreach ($attributeValue->getTranslations() as $attributeValueTranslation) { ...
[ "public", "function", "removeAllAttributeValueTranslations", "(", "AttributeValue", "$", "attributeValue", ")", "{", "// Check if translation already exists for given locale.", "/** @var AttributeValueTranslation $attributeValueTranslation */", "foreach", "(", "$", "attributeValue", "-...
Removes all attribute value translations from given attribute. @param AttributeValue $attributeValue
[ "Removes", "all", "attribute", "value", "translations", "from", "given", "attribute", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L165-L173
224,105
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.updateOrCreateProductAttributeForProduct
public function updateOrCreateProductAttributeForProduct( ProductInterface $product, Attribute $attribute, array $attributeData, $locale ) { // Check if ProductAttribute already exists for attribute $existingProductAttribute = $this->retrieveProductAttributeByAttribut...
php
public function updateOrCreateProductAttributeForProduct( ProductInterface $product, Attribute $attribute, array $attributeData, $locale ) { // Check if ProductAttribute already exists for attribute $existingProductAttribute = $this->retrieveProductAttributeByAttribut...
[ "public", "function", "updateOrCreateProductAttributeForProduct", "(", "ProductInterface", "$", "product", ",", "Attribute", "$", "attribute", ",", "array", "$", "attributeData", ",", "$", "locale", ")", "{", "// Check if ProductAttribute already exists for attribute", "$",...
Updates or creates a the product attribute relation for the given product. @param ProductInterface $product @param Attribute $attribute @param array $attributeData @param string $locale
[ "Updates", "or", "creates", "a", "the", "product", "attribute", "relation", "for", "the", "given", "product", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L183-L217
224,106
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.retrieveProductAttributeByAttribute
public function retrieveProductAttributeByAttribute(ProductInterface $product, Attribute $attribute) { foreach ($product->getProductAttributes() as $productAttribute) { if ($productAttribute->getAttribute()->getId() === $attribute->getId()) { return $productAttribute; ...
php
public function retrieveProductAttributeByAttribute(ProductInterface $product, Attribute $attribute) { foreach ($product->getProductAttributes() as $productAttribute) { if ($productAttribute->getAttribute()->getId() === $attribute->getId()) { return $productAttribute; ...
[ "public", "function", "retrieveProductAttributeByAttribute", "(", "ProductInterface", "$", "product", ",", "Attribute", "$", "attribute", ")", "{", "foreach", "(", "$", "product", "->", "getProductAttributes", "(", ")", "as", "$", "productAttribute", ")", "{", "if...
Searches products product-attributes for given attribute. @param ProductInterface $product @param Attribute $attribute @return ProductAttribute|null
[ "Searches", "products", "product", "-", "attributes", "for", "given", "attribute", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L227-L236
224,107
sulu/SuluProductBundle
Product/ProductAttributeManager.php
ProductAttributeManager.retrieveAttributeValueTranslationByLocale
private function retrieveAttributeValueTranslationByLocale(AttributeValue $attributeValue, $locale) { foreach ($attributeValue->getTranslations() as $attributeValueTranslation) { if ($attributeValueTranslation->getLocale() === $locale) { return $attributeValueTranslation; ...
php
private function retrieveAttributeValueTranslationByLocale(AttributeValue $attributeValue, $locale) { foreach ($attributeValue->getTranslations() as $attributeValueTranslation) { if ($attributeValueTranslation->getLocale() === $locale) { return $attributeValueTranslation; ...
[ "private", "function", "retrieveAttributeValueTranslationByLocale", "(", "AttributeValue", "$", "attributeValue", ",", "$", "locale", ")", "{", "foreach", "(", "$", "attributeValue", "->", "getTranslations", "(", ")", "as", "$", "attributeValueTranslation", ")", "{", ...
Returns the translation in given locale for the given AttributeValue. @param AttributeValue $attributeValue @param string $locale @return AttributeValueTranslation|null
[ "Returns", "the", "translation", "in", "given", "locale", "for", "the", "given", "AttributeValue", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductAttributeManager.php#L246-L255
224,108
sulu/SuluProductBundle
Entity/UnitRepository.php
UnitRepository.findByAbbrevation
public function findByAbbrevation($abbrevation, $returnAsEntity = false) { try { $qb = $this->createQueryBuilder('unit') ->select('partial unit.{id}') ->join('unit.mappings', 'mappings', 'WITH', 'mappings.name = :abbrevation') ->setParameter('abbre...
php
public function findByAbbrevation($abbrevation, $returnAsEntity = false) { try { $qb = $this->createQueryBuilder('unit') ->select('partial unit.{id}') ->join('unit.mappings', 'mappings', 'WITH', 'mappings.name = :abbrevation') ->setParameter('abbre...
[ "public", "function", "findByAbbrevation", "(", "$", "abbrevation", ",", "$", "returnAsEntity", "=", "false", ")", "{", "try", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", "'unit'", ")", "->", "select", "(", "'partial unit.{id}'", ")", ...
Find a unit by it's abbrevation. @param $abbrevation @param bool $returnAsEntity @return mixed|null
[ "Find", "a", "unit", "by", "it", "s", "abbrevation", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/UnitRepository.php#L30-L46
224,109
sulu/SuluProductBundle
Entity/UnitRepository.php
UnitRepository.findAllByLocale
public function findAllByLocale($locale) { try { $qb = $this->getUnitQuery($locale) ->orderBy('unitTranslations.name', 'ASC'); return $qb->getQuery()->getResult(); } catch (NoResultException $exc) { return null; } }
php
public function findAllByLocale($locale) { try { $qb = $this->getUnitQuery($locale) ->orderBy('unitTranslations.name', 'ASC'); return $qb->getQuery()->getResult(); } catch (NoResultException $exc) { return null; } }
[ "public", "function", "findAllByLocale", "(", "$", "locale", ")", "{", "try", "{", "$", "qb", "=", "$", "this", "->", "getUnitQuery", "(", "$", "locale", ")", "->", "orderBy", "(", "'unitTranslations.name'", ",", "'ASC'", ")", ";", "return", "$", "qb", ...
Returns the units with the given locale. @param string $locale The locale to load @return Unit[]|null
[ "Returns", "the", "units", "with", "the", "given", "locale", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/UnitRepository.php#L55-L65
224,110
sulu/SuluProductBundle
Entity/CurrencyRepository.php
CurrencyRepository.findByCode
public function findByCode($code) { try { $qb = $this->createQueryBuilder('currency') ->andWhere('currency.code = :currencyCode') ->setParameter('currencyCode', $code); return $qb->getQuery()->getSingleResult(); } catch (NoResultException $exc...
php
public function findByCode($code) { try { $qb = $this->createQueryBuilder('currency') ->andWhere('currency.code = :currencyCode') ->setParameter('currencyCode', $code); return $qb->getQuery()->getSingleResult(); } catch (NoResultException $exc...
[ "public", "function", "findByCode", "(", "$", "code", ")", "{", "try", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", "'currency'", ")", "->", "andWhere", "(", "'currency.code = :currencyCode'", ")", "->", "setParameter", "(", "'currencyCod...
Find a currency by it's code. @param string $code @return mixed|null
[ "Find", "a", "currency", "by", "it", "s", "code", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/CurrencyRepository.php#L49-L60
224,111
sulu/SuluProductBundle
Entity/DeliveryStatus.php
DeliveryStatus.removeProduct
public function removeProduct(\Sulu\Bundle\ProductBundle\Entity\Product $products) { $this->products->removeElement($products); }
php
public function removeProduct(\Sulu\Bundle\ProductBundle\Entity\Product $products) { $this->products->removeElement($products); }
[ "public", "function", "removeProduct", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "Product", "$", "products", ")", "{", "$", "this", "->", "products", "->", "removeElement", "(", "$", "products", ")", ";", "}" ]
Remove products. @param \Sulu\Bundle\ProductBundle\Entity\Product $products
[ "Remove", "products", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/DeliveryStatus.php#L117-L120
224,112
unreal4u/mqtt
src/Protocol/ConnAck.php
ConnAck.throwConnectException
private function throwConnectException(): self { switch ($this->connectReturnCode) { case 1: throw new UnacceptableProtocolVersion( 'The Server does not support the level of the MQTT protocol requested by the Client' ); case 2: ...
php
private function throwConnectException(): self { switch ($this->connectReturnCode) { case 1: throw new UnacceptableProtocolVersion( 'The Server does not support the level of the MQTT protocol requested by the Client' ); case 2: ...
[ "private", "function", "throwConnectException", "(", ")", ":", "self", "{", "switch", "(", "$", "this", "->", "connectReturnCode", ")", "{", "case", "1", ":", "throw", "new", "UnacceptableProtocolVersion", "(", "'The Server does not support the level of the MQTT protoco...
Will throw an exception in case there is something bad with the connection @see http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc385349257 @return ConnAck @throws \unreal4u\MQTT\Exceptions\Connect\GenericError @throws \unreal4u\MQTT\Exceptions\Connect\NotAuthorized @th...
[ "Will", "throw", "an", "exception", "in", "case", "there", "is", "something", "bad", "with", "the", "connection" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/ConnAck.php#L91-L112
224,113
sulu/SuluProductBundle
Product/ProductMediaManager.php
ProductMediaManager.initFieldDescriptors
protected function initFieldDescriptors($locale) { $this->fieldDescriptors = []; $mediaJoin = [ self::$mediaEntityName => new DoctrineJoinDescriptor( self::$mediaEntityName, $this->productEntityName . '.media', null, Doctri...
php
protected function initFieldDescriptors($locale) { $this->fieldDescriptors = []; $mediaJoin = [ self::$mediaEntityName => new DoctrineJoinDescriptor( self::$mediaEntityName, $this->productEntityName . '.media', null, Doctri...
[ "protected", "function", "initFieldDescriptors", "(", "$", "locale", ")", "{", "$", "this", "->", "fieldDescriptors", "=", "[", "]", ";", "$", "mediaJoin", "=", "[", "self", "::", "$", "mediaEntityName", "=>", "new", "DoctrineJoinDescriptor", "(", "self", ":...
Initializes field descriptors for product media. @param string $locale
[ "Initializes", "field", "descriptors", "for", "product", "media", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductMediaManager.php#L127-L257
224,114
unreal4u/mqtt
src/Internals/WritableContent.php
WritableContent.createFixedHeader
final public function createFixedHeader(int $variableHeaderLength): string { $this->logger->debug('Creating fixed header with values', [ 'controlPacketValue' => self::getControlPacketValue(), 'specialFlags' => $this->specialFlags, 'variableHeaderLength' => $variableHeader...
php
final public function createFixedHeader(int $variableHeaderLength): string { $this->logger->debug('Creating fixed header with values', [ 'controlPacketValue' => self::getControlPacketValue(), 'specialFlags' => $this->specialFlags, 'variableHeaderLength' => $variableHeader...
[ "final", "public", "function", "createFixedHeader", "(", "int", "$", "variableHeaderLength", ")", ":", "string", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Creating fixed header with values'", ",", "[", "'controlPacketValue'", "=>", "self", "::", "get...
Returns the fixed header part needed for all methods This takes into account the basic control packet value, any special flags and, in the second byte, the variable header length @param int $variableHeaderLength @return string @throws MessageTooBig
[ "Returns", "the", "fixed", "header", "part", "needed", "for", "all", "methods" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/WritableContent.php#L47-L60
224,115
unreal4u/mqtt
src/Internals/WritableContent.php
WritableContent.createSendableMessage
final public function createSendableMessage(): string { $variableHeader = $this->createVariableHeader(); $this->logger->debug('Created variable header', ['variableHeader' => base64_encode($variableHeader)]); $payload = $this->createPayload(); $this->logger->debug('Created payload', [...
php
final public function createSendableMessage(): string { $variableHeader = $this->createVariableHeader(); $this->logger->debug('Created variable header', ['variableHeader' => base64_encode($variableHeader)]); $payload = $this->createPayload(); $this->logger->debug('Created payload', [...
[ "final", "public", "function", "createSendableMessage", "(", ")", ":", "string", "{", "$", "variableHeader", "=", "$", "this", "->", "createVariableHeader", "(", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Created variable header'", ",", "[", ...
Creates the entire message @return string @throws MessageTooBig
[ "Creates", "the", "entire", "message" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/WritableContent.php#L67-L77
224,116
unreal4u/mqtt
src/Internals/WritableContent.php
WritableContent.createUTF8String
final public function createUTF8String(string $nonFormattedString): string { $returnString = ''; if ($nonFormattedString !== '') { $returnString = Utilities::convertNumberToBinaryString(strlen($nonFormattedString)) . $nonFormattedString; } return $returnString; }
php
final public function createUTF8String(string $nonFormattedString): string { $returnString = ''; if ($nonFormattedString !== '') { $returnString = Utilities::convertNumberToBinaryString(strlen($nonFormattedString)) . $nonFormattedString; } return $returnString; }
[ "final", "public", "function", "createUTF8String", "(", "string", "$", "nonFormattedString", ")", ":", "string", "{", "$", "returnString", "=", "''", ";", "if", "(", "$", "nonFormattedString", "!==", "''", ")", "{", "$", "returnString", "=", "Utilities", "::...
Creates a UTF8 big-endian representation of the given string @param string $nonFormattedString @return string @throws OutOfRangeException
[ "Creates", "a", "UTF8", "big", "-", "endian", "representation", "of", "the", "given", "string" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/WritableContent.php#L100-L108
224,117
unreal4u/mqtt
src/Internals/WritableContent.php
WritableContent.expectAnswer
public function expectAnswer(string $brokerBitStream, ClientInterface $client): ReadableContentInterface { $this->logger->info('String of incoming data confirmed, returning new object', ['callee' => get_class($this)]); $eventManager = new EventManager($this->logger); return $eventManager->a...
php
public function expectAnswer(string $brokerBitStream, ClientInterface $client): ReadableContentInterface { $this->logger->info('String of incoming data confirmed, returning new object', ['callee' => get_class($this)]); $eventManager = new EventManager($this->logger); return $eventManager->a...
[ "public", "function", "expectAnswer", "(", "string", "$", "brokerBitStream", ",", "ClientInterface", "$", "client", ")", ":", "ReadableContentInterface", "{", "$", "this", "->", "logger", "->", "info", "(", "'String of incoming data confirmed, returning new object'", ",...
Will return an object of the type the broker has returned to us @param string $brokerBitStream @param ClientInterface $client @return ReadableContentInterface @throws DomainException
[ "Will", "return", "an", "object", "of", "the", "type", "the", "broker", "has", "returned", "to", "us" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/WritableContent.php#L119-L125
224,118
sulu/SuluProductBundle
Entity/AttributeSetTranslation.php
AttributeSetTranslation.setAttributeSet
public function setAttributeSet(\Sulu\Bundle\ProductBundle\Entity\AttributeSet $template) { $this->attributeSet = $template; return $this; }
php
public function setAttributeSet(\Sulu\Bundle\ProductBundle\Entity\AttributeSet $template) { $this->attributeSet = $template; return $this; }
[ "public", "function", "setAttributeSet", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "AttributeSet", "$", "template", ")", "{", "$", "this", "->", "attributeSet", "=", "$", "template", ";", "return", "$", "this", ";", "}...
Set template. @param \Sulu\Bundle\ProductBundle\Entity\AttributeSet $template @return AttributeSetTranslation
[ "Set", "template", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/AttributeSetTranslation.php#L104-L109
224,119
unreal4u/mqtt
src/Internals/ReadableContent.php
ReadableContent.checkControlPacketValue
private function checkControlPacketValue(int $controlPacketValue): bool { // Check whether the first byte corresponds to the expected control packet value if (static::CONTROL_PACKET_VALUE !== $controlPacketValue) { throw new InvalidResponseType(sprintf( 'Value of received...
php
private function checkControlPacketValue(int $controlPacketValue): bool { // Check whether the first byte corresponds to the expected control packet value if (static::CONTROL_PACKET_VALUE !== $controlPacketValue) { throw new InvalidResponseType(sprintf( 'Value of received...
[ "private", "function", "checkControlPacketValue", "(", "int", "$", "controlPacketValue", ")", ":", "bool", "{", "// Check whether the first byte corresponds to the expected control packet value", "if", "(", "static", "::", "CONTROL_PACKET_VALUE", "!==", "$", "controlPacketValue...
Checks whether the control packet corresponds to this object @param int $controlPacketValue @return bool @throws InvalidResponseType
[ "Checks", "whether", "the", "control", "packet", "corresponds", "to", "this", "object" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/ReadableContent.php#L52-L64
224,120
unreal4u/mqtt
src/Internals/ReadableContent.php
ReadableContent.calculateSizeOfRemainingLengthField
private function calculateSizeOfRemainingLengthField(int $size): int { $blockSize = $iterations = 0; while ($size >= $blockSize) { $iterations++; $blockSize = 128 ** $iterations; } $this->sizeOfRemainingLengthField = $iterations; return $iterations; ...
php
private function calculateSizeOfRemainingLengthField(int $size): int { $blockSize = $iterations = 0; while ($size >= $blockSize) { $iterations++; $blockSize = 128 ** $iterations; } $this->sizeOfRemainingLengthField = $iterations; return $iterations; ...
[ "private", "function", "calculateSizeOfRemainingLengthField", "(", "int", "$", "size", ")", ":", "int", "{", "$", "blockSize", "=", "$", "iterations", "=", "0", ";", "while", "(", "$", "size", ">=", "$", "blockSize", ")", "{", "$", "iterations", "++", ";...
Sets the offset of the remaining length field @param int $size @return int
[ "Sets", "the", "offset", "of", "the", "remaining", "length", "field" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/ReadableContent.php#L101-L111
224,121
sulu/SuluProductBundle
Entity/AttributeValueTranslation.php
AttributeValueTranslation.setAttributeValue
public function setAttributeValue(\Sulu\Bundle\ProductBundle\Entity\AttributeValue $attributeValue) { $this->attributeValue = $attributeValue; return $this; }
php
public function setAttributeValue(\Sulu\Bundle\ProductBundle\Entity\AttributeValue $attributeValue) { $this->attributeValue = $attributeValue; return $this; }
[ "public", "function", "setAttributeValue", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "AttributeValue", "$", "attributeValue", ")", "{", "$", "this", "->", "attributeValue", "=", "$", "attributeValue", ";", "return", "$", "...
Set attributeValue. @param \Sulu\Bundle\ProductBundle\Entity\AttributeValue $attributeValue @return AttributeValueTranslation
[ "Set", "attributeValue", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/AttributeValueTranslation.php#L104-L109
224,122
dave-redfern/laravel-doctrine-behaviours
src/EntityAccessor.php
EntityAccessor.callProtectedMethod
public static function callProtectedMethod($object, $method, ...$args) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getMethod($method); $refProp->setAccessible(true); return $refProp->invokeArgs($object, $args); }
php
public static function callProtectedMethod($object, $method, ...$args) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getMethod($method); $refProp->setAccessible(true); return $refProp->invokeArgs($object, $args); }
[ "public", "static", "function", "callProtectedMethod", "(", "$", "object", ",", "$", "method", ",", "...", "$", "args", ")", "{", "$", "refObject", "=", "new", "\\", "ReflectionObject", "(", "$", "object", ")", ";", "$", "refProp", "=", "$", "refObject",...
Helper to allow calling protected methods with variable arguments @param object $object @param string $method @param mixed ...$args @return mixed
[ "Helper", "to", "allow", "calling", "protected", "methods", "with", "variable", "arguments" ]
c481eea497a0df6fc46bc2cadb08a0ed0ae819a4
https://github.com/dave-redfern/laravel-doctrine-behaviours/blob/c481eea497a0df6fc46bc2cadb08a0ed0ae819a4/src/EntityAccessor.php#L40-L47
224,123
dave-redfern/laravel-doctrine-behaviours
src/EntityAccessor.php
EntityAccessor.getProtectedProperty
public static function getProtectedProperty($object, $property) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getProperty($property); $refProp->setAccessible(true); return $refProp->getValue($object); }
php
public static function getProtectedProperty($object, $property) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getProperty($property); $refProp->setAccessible(true); return $refProp->getValue($object); }
[ "public", "static", "function", "getProtectedProperty", "(", "$", "object", ",", "$", "property", ")", "{", "$", "refObject", "=", "new", "\\", "ReflectionObject", "(", "$", "object", ")", ";", "$", "refProp", "=", "$", "refObject", "->", "getProperty", "(...
Helper to allow accessing protected properties without an accessor @param object $object @param string $property @return mixed
[ "Helper", "to", "allow", "accessing", "protected", "properties", "without", "an", "accessor" ]
c481eea497a0df6fc46bc2cadb08a0ed0ae819a4
https://github.com/dave-redfern/laravel-doctrine-behaviours/blob/c481eea497a0df6fc46bc2cadb08a0ed0ae819a4/src/EntityAccessor.php#L57-L64
224,124
dave-redfern/laravel-doctrine-behaviours
src/EntityAccessor.php
EntityAccessor.setProtectedProperty
public static function setProtectedProperty($object, $property, $value) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getProperty($property); $refProp->setAccessible(true); $refProp->setValue($object, $value); return $object; }
php
public static function setProtectedProperty($object, $property, $value) { $refObject = new \ReflectionObject($object); $refProp = $refObject->getProperty($property); $refProp->setAccessible(true); $refProp->setValue($object, $value); return $object; }
[ "public", "static", "function", "setProtectedProperty", "(", "$", "object", ",", "$", "property", ",", "$", "value", ")", "{", "$", "refObject", "=", "new", "\\", "ReflectionObject", "(", "$", "object", ")", ";", "$", "refProp", "=", "$", "refObject", "-...
Helper to allow setting protected properties, returns the passed object @param object $object @param string $property @param mixed $value @return object
[ "Helper", "to", "allow", "setting", "protected", "properties", "returns", "the", "passed", "object" ]
c481eea497a0df6fc46bc2cadb08a0ed0ae819a4
https://github.com/dave-redfern/laravel-doctrine-behaviours/blob/c481eea497a0df6fc46bc2cadb08a0ed0ae819a4/src/EntityAccessor.php#L75-L83
224,125
ibuildingsnl/qa-tools
installer.php
Installer.initTargets
private function initTargets($installDir, $filename) { if ($installDir === false) { $installDir = getcwd(); } $this->installPath = rtrim($installDir, '/') . '/'. $filename; if (!is_writable($installDir)) { throw new RuntimeException('The installation director...
php
private function initTargets($installDir, $filename) { if ($installDir === false) { $installDir = getcwd(); } $this->installPath = rtrim($installDir, '/') . '/'. $filename; if (!is_writable($installDir)) { throw new RuntimeException('The installation director...
[ "private", "function", "initTargets", "(", "$", "installDir", ",", "$", "filename", ")", "{", "if", "(", "$", "installDir", "===", "false", ")", "{", "$", "installDir", "=", "getcwd", "(", ")", ";", "}", "$", "this", "->", "installPath", "=", "rtrim", ...
Initialization methods to set the required filenames and base url @param mixed $installDir Specific installation directory, or false @param string $filename Specific filename to save to @throws RuntimeException If the installation directory is not writable
[ "Initialization", "methods", "to", "set", "the", "required", "filenames", "and", "base", "url" ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/installer.php#L478-L492
224,126
ibuildingsnl/qa-tools
installer.php
Installer.install
private function install($version) { $retries = 3; $infoMsg = 'Downloading...'; $infoType = 'info'; $success = false; while ($retries--) { try { if (!$this->quiet) { out($infoMsg, $infoType); $infoMsg = 'Ret...
php
private function install($version) { $retries = 3; $infoMsg = 'Downloading...'; $infoType = 'info'; $success = false; while ($retries--) { try { if (!$this->quiet) { out($infoMsg, $infoType); $infoMsg = 'Ret...
[ "private", "function", "install", "(", "$", "version", ")", "{", "$", "retries", "=", "3", ";", "$", "infoMsg", "=", "'Downloading...'", ";", "$", "infoType", "=", "'info'", ";", "$", "success", "=", "false", ";", "while", "(", "$", "retries", "--", ...
The main install function @param mixed $version Specific version to install, or false @return bool If the installation succeeded
[ "The", "main", "install", "function" ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/installer.php#L501-L541
224,127
ibuildingsnl/qa-tools
installer.php
Installer.downloadTemporaryFile
private function downloadTemporaryFile($url, $target) { try { if (($fh = @fopen($target, 'w')) === false) { throw new RuntimeException( sprintf( 'Could not create file "%s": %s', $target, ...
php
private function downloadTemporaryFile($url, $target) { try { if (($fh = @fopen($target, 'w')) === false) { throw new RuntimeException( sprintf( 'Could not create file "%s": %s', $target, ...
[ "private", "function", "downloadTemporaryFile", "(", "$", "url", ",", "$", "target", ")", "{", "try", "{", "if", "(", "(", "$", "fh", "=", "@", "fopen", "(", "$", "target", ",", "'w'", ")", ")", "===", "false", ")", "{", "throw", "new", "RuntimeExc...
A wrapper around the methods needed to download and save the phar @param string $url The versioned download url @param string $target The target location to download to @throws \RuntimeException
[ "A", "wrapper", "around", "the", "methods", "needed", "to", "download", "and", "save", "the", "phar" ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/installer.php#L621-L648
224,128
ibuildingsnl/qa-tools
installer.php
Installer.verifyAndSave
private function verifyAndSave() { $this->pharValidator->assertPharValid($this->tmpPharPath); if (!@rename($this->tmpPharPath, $this->target)) { throw new RuntimeException( sprintf( 'Could not write to file "%s": %s', $this->target...
php
private function verifyAndSave() { $this->pharValidator->assertPharValid($this->tmpPharPath); if (!@rename($this->tmpPharPath, $this->target)) { throw new RuntimeException( sprintf( 'Could not write to file "%s": %s', $this->target...
[ "private", "function", "verifyAndSave", "(", ")", "{", "$", "this", "->", "pharValidator", "->", "assertPharValid", "(", "$", "this", "->", "tmpPharPath", ")", ";", "if", "(", "!", "@", "rename", "(", "$", "this", "->", "tmpPharPath", ",", "$", "this", ...
Verifies the downloaded file and saves it to the target location @throws \RuntimeException
[ "Verifies", "the", "downloaded", "file", "and", "saves", "it", "to", "the", "target", "location" ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/installer.php#L655-L679
224,129
ibuildingsnl/qa-tools
installer.php
Installer.cleanUp
private function cleanUp() { if ($this->quiet) { $errors = explode(PHP_EOL, ob_get_clean()); $shown = []; foreach ($errors as $error) { if ($error && !in_array($error, $shown)) { out($error, 'error'); $shown[] = $er...
php
private function cleanUp() { if ($this->quiet) { $errors = explode(PHP_EOL, ob_get_clean()); $shown = []; foreach ($errors as $error) { if ($error && !in_array($error, $shown)) { out($error, 'error'); $shown[] = $er...
[ "private", "function", "cleanUp", "(", ")", "{", "if", "(", "$", "this", "->", "quiet", ")", "{", "$", "errors", "=", "explode", "(", "PHP_EOL", ",", "ob_get_clean", "(", ")", ")", ";", "$", "shown", "=", "[", "]", ";", "foreach", "(", "$", "erro...
Cleans up resources at the end of a failed installation
[ "Cleans", "up", "resources", "at", "the", "end", "of", "a", "failed", "installation" ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/installer.php#L684-L704
224,130
sulu/SuluProductBundle
Entity/DeliveryStatusTranslation.php
DeliveryStatusTranslation.setDeliveryStatus
public function setDeliveryStatus(\Sulu\Bundle\ProductBundle\Entity\DeliveryStatus $deliveryStatus) { $this->deliveryStatus = $deliveryStatus; return $this; }
php
public function setDeliveryStatus(\Sulu\Bundle\ProductBundle\Entity\DeliveryStatus $deliveryStatus) { $this->deliveryStatus = $deliveryStatus; return $this; }
[ "public", "function", "setDeliveryStatus", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "DeliveryStatus", "$", "deliveryStatus", ")", "{", "$", "this", "->", "deliveryStatus", "=", "$", "deliveryStatus", ";", "return", "$", "...
Set deliveryStatus. @param \Sulu\Bundle\ProductBundle\Entity\DeliveryStatus $deliveryStatus @return DeliveryStatusTranslation
[ "Set", "deliveryStatus", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/DeliveryStatusTranslation.php#L104-L109
224,131
sulu/SuluProductBundle
Entity/AttributeSet.php
AttributeSet.removeAttribute
public function removeAttribute(\Sulu\Bundle\ProductBundle\Entity\Attribute $attributes) { $this->attributes->removeElement($attributes); }
php
public function removeAttribute(\Sulu\Bundle\ProductBundle\Entity\Attribute $attributes) { $this->attributes->removeElement($attributes); }
[ "public", "function", "removeAttribute", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "Attribute", "$", "attributes", ")", "{", "$", "this", "->", "attributes", "->", "removeElement", "(", "$", "attributes", ")", ";", "}" ]
Remove attributes. @param \Sulu\Bundle\ProductBundle\Entity\Attribute $attributes
[ "Remove", "attributes", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/AttributeSet.php#L166-L169
224,132
sulu/SuluProductBundle
Product/ProductLocaleManager.php
ProductLocaleManager.retrieveLocale
public function retrieveLocale(UserInterface $user = null, $requestLocale = null) { $checkedLocale = null; // When request locale is defined, check if we can use it. if ($requestLocale && is_string($requestLocale)) { $checkedLocale = $this->checkLocale($requestLocale); }...
php
public function retrieveLocale(UserInterface $user = null, $requestLocale = null) { $checkedLocale = null; // When request locale is defined, check if we can use it. if ($requestLocale && is_string($requestLocale)) { $checkedLocale = $this->checkLocale($requestLocale); }...
[ "public", "function", "retrieveLocale", "(", "UserInterface", "$", "user", "=", "null", ",", "$", "requestLocale", "=", "null", ")", "{", "$", "checkedLocale", "=", "null", ";", "// When request locale is defined, check if we can use it.", "if", "(", "$", "requestLo...
Function returns the locale that should be used by default. If request-locale is set, then use this one. Else If users locale matches any of the given locales, that one is taken as default. If locale does not match exactly, the users language is compared as well when its provided. If there are no matches at all, the de...
[ "Function", "returns", "the", "locale", "that", "should", "be", "used", "by", "default", ".", "If", "request", "-", "locale", "is", "set", "then", "use", "this", "one", ".", "Else", "If", "users", "locale", "matches", "any", "of", "the", "given", "locale...
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductLocaleManager.php#L65-L83
224,133
sulu/SuluProductBundle
Product/ProductLocaleManager.php
ProductLocaleManager.checkLocale
protected function checkLocale($locale) { $languageFound = null; $language = strstr($locale, '_', true); foreach ($this->configuration['locales'] as $availableLocale) { // If locale matches, the exact matching was found. if ($availableLocale === $locale) { ...
php
protected function checkLocale($locale) { $languageFound = null; $language = strstr($locale, '_', true); foreach ($this->configuration['locales'] as $availableLocale) { // If locale matches, the exact matching was found. if ($availableLocale === $locale) { ...
[ "protected", "function", "checkLocale", "(", "$", "locale", ")", "{", "$", "languageFound", "=", "null", ";", "$", "language", "=", "strstr", "(", "$", "locale", ",", "'_'", ",", "true", ")", ";", "foreach", "(", "$", "this", "->", "configuration", "["...
Check if given locale is available in the configured locales. @param string $locale @return null|string
[ "Check", "if", "given", "locale", "is", "available", "in", "the", "configured", "locales", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductLocaleManager.php#L92-L114
224,134
sulu/SuluProductBundle
Entity/DeliveryStatusRepository.php
DeliveryStatusRepository.findAllByLocale
public function findAllByLocale($locale) { try { $qb = $this->getStatusQuery($locale); return $qb->getQuery()->getResult(); } catch (NoResultException $exc) { return null; } }
php
public function findAllByLocale($locale) { try { $qb = $this->getStatusQuery($locale); return $qb->getQuery()->getResult(); } catch (NoResultException $exc) { return null; } }
[ "public", "function", "findAllByLocale", "(", "$", "locale", ")", "{", "try", "{", "$", "qb", "=", "$", "this", "->", "getStatusQuery", "(", "$", "locale", ")", ";", "return", "$", "qb", "->", "getQuery", "(", ")", "->", "getResult", "(", ")", ";", ...
Returns the statuses with the given locale. @param string $locale The locale to load @return Status[]|null
[ "Returns", "the", "statuses", "with", "the", "given", "locale", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/DeliveryStatusRepository.php#L29-L38
224,135
amsgames/laravel-shop-gateway-paypal
src/GatewayPayPal.php
GatewayPayPal.onCheckout
public function onCheckout($cart) { if (!isset($this->creditCard)) throw new CheckoutException('Credit Card is not set.', 0); if (!in_array($this->creditCard->getType(), $this->validTypes)) throw new CheckoutException('Credit Card is not supported.', 1); if ($this->...
php
public function onCheckout($cart) { if (!isset($this->creditCard)) throw new CheckoutException('Credit Card is not set.', 0); if (!in_array($this->creditCard->getType(), $this->validTypes)) throw new CheckoutException('Credit Card is not supported.', 1); if ($this->...
[ "public", "function", "onCheckout", "(", "$", "cart", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "creditCard", ")", ")", "throw", "new", "CheckoutException", "(", "'Credit Card is not set.'", ",", "0", ")", ";", "if", "(", "!", "in_array"...
Called on cart checkout. @param Cart $cart Cart.
[ "Called", "on", "cart", "checkout", "." ]
c0ba041bda3fdcc696e4a01278647f386e9d8715
https://github.com/amsgames/laravel-shop-gateway-paypal/blob/c0ba041bda3fdcc696e4a01278647f386e9d8715/src/GatewayPayPal.php#L57-L67
224,136
amsgames/laravel-shop-gateway-paypal
src/GatewayPayPal.php
GatewayPayPal.setCreditCard
public function setCreditCard( $type, $number, $expireMonth, $expireYear, $cvv, $firstname, $lastname ) { $this->creditCard = new CreditCard(); $this->creditCard->setType($type) ->setNumber($number) ->setExpireMonth($ex...
php
public function setCreditCard( $type, $number, $expireMonth, $expireYear, $cvv, $firstname, $lastname ) { $this->creditCard = new CreditCard(); $this->creditCard->setType($type) ->setNumber($number) ->setExpireMonth($ex...
[ "public", "function", "setCreditCard", "(", "$", "type", ",", "$", "number", ",", "$", "expireMonth", ",", "$", "expireYear", ",", "$", "cvv", ",", "$", "firstname", ",", "$", "lastname", ")", "{", "$", "this", "->", "creditCard", "=", "new", "CreditCa...
Sets credit card for usage. @param string $type Card type. i.e. visa, mastercard @param int $number Card number. @param mixed $expireMonth Month in which the card expires. @param mixed $expireYear Year in which the card expires. @param int $cvv CVV. @param string $firstname First name pr...
[ "Sets", "credit", "card", "for", "usage", "." ]
c0ba041bda3fdcc696e4a01278647f386e9d8715
https://github.com/amsgames/laravel-shop-gateway-paypal/blob/c0ba041bda3fdcc696e4a01278647f386e9d8715/src/GatewayPayPal.php#L183-L203
224,137
amsgames/laravel-shop-gateway-paypal
src/GatewayPayPal.php
GatewayPayPal.getPatternType
private function getPatternType($cardNumber) { if (empty($cardNumber)) return; $types = [ 'visa' => '(4\d{12}(?:\d{3})?)', 'amex' => '(3[47]\d{13})', 'jcb' => '(35[2-8][89]\d\d\d{10})', 'maestro' => '((?:5020|5038|630...
php
private function getPatternType($cardNumber) { if (empty($cardNumber)) return; $types = [ 'visa' => '(4\d{12}(?:\d{3})?)', 'amex' => '(3[47]\d{13})', 'jcb' => '(35[2-8][89]\d\d\d{10})', 'maestro' => '((?:5020|5038|630...
[ "private", "function", "getPatternType", "(", "$", "cardNumber", ")", "{", "if", "(", "empty", "(", "$", "cardNumber", ")", ")", "return", ";", "$", "types", "=", "[", "'visa'", "=>", "'(4\\d{12}(?:\\d{3})?)'", ",", "'amex'", "=>", "'(3[47]\\d{13})'", ",", ...
Returns the credit card type based on a credit card number pattern. @param string $cardNumber Credit card number. @return string
[ "Returns", "the", "credit", "card", "type", "based", "on", "a", "credit", "card", "number", "pattern", "." ]
c0ba041bda3fdcc696e4a01278647f386e9d8715
https://github.com/amsgames/laravel-shop-gateway-paypal/blob/c0ba041bda3fdcc696e4a01278647f386e9d8715/src/GatewayPayPal.php#L257-L279
224,138
culturekings/afterpay
src/Service/InStore/Refund.php
Refund.createOrReverse
public function createOrReverse( Model\InStore\Refund $refund, Model\InStore\Reversal $refundReversal = null, HandlerStack $stack = null ) { try { return $this->create($refund, $stack); } catch (ApiException $refundException) { // http://docs.afterpay....
php
public function createOrReverse( Model\InStore\Refund $refund, Model\InStore\Reversal $refundReversal = null, HandlerStack $stack = null ) { try { return $this->create($refund, $stack); } catch (ApiException $refundException) { // http://docs.afterpay....
[ "public", "function", "createOrReverse", "(", "Model", "\\", "InStore", "\\", "Refund", "$", "refund", ",", "Model", "\\", "InStore", "\\", "Reversal", "$", "refundReversal", "=", "null", ",", "HandlerStack", "$", "stack", "=", "null", ")", "{", "try", "{"...
Helper method to automatically attempt to reverse a refund if an error occurs. Refund reversal model does not have to be passed in and will be automatically generated if not. @param Model\InStore\Refund $refund @param Model\InStore\Reversal|null $refundReversal @param HandlerStack|null $stack @retur...
[ "Helper", "method", "to", "automatically", "attempt", "to", "reverse", "a", "refund", "if", "an", "error", "occurs", "." ]
d2fde2eed6d6102464ffd9d3bea7623f31e77a61
https://github.com/culturekings/afterpay/blob/d2fde2eed6d6102464ffd9d3bea7623f31e77a61/src/Service/InStore/Refund.php#L100-L145
224,139
unreal4u/mqtt
src/DataTypes/TopicFilter.php
TopicFilter.setTopicName
private function setTopicName(string $topicFilter): self { $this->generalRulesCheck($topicFilter); $this->topicFilter = $topicFilter; return $this; }
php
private function setTopicName(string $topicFilter): self { $this->generalRulesCheck($topicFilter); $this->topicFilter = $topicFilter; return $this; }
[ "private", "function", "setTopicName", "(", "string", "$", "topicFilter", ")", ":", "self", "{", "$", "this", "->", "generalRulesCheck", "(", "$", "topicFilter", ")", ";", "$", "this", "->", "topicFilter", "=", "$", "topicFilter", ";", "return", "$", "this...
Will validate and set the topic filter @param string $topicFilter @return TopicFilter @throws \OutOfBoundsException @throws \InvalidArgumentException
[ "Will", "validate", "and", "set", "the", "topic", "filter" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/DataTypes/TopicFilter.php#L61-L67
224,140
ibuildingsnl/qa-tools
src/Core/Composer/RequireCache.php
RequireCache.storeConfiguration
public function storeConfiguration( Configuration $targetConfiguration, PackageSet $requiredPackages, Configuration $newConfiguration ) { $key = $this->getKey($targetConfiguration, $requiredPackages); $this->configurations[$key] = $newConfiguration; }
php
public function storeConfiguration( Configuration $targetConfiguration, PackageSet $requiredPackages, Configuration $newConfiguration ) { $key = $this->getKey($targetConfiguration, $requiredPackages); $this->configurations[$key] = $newConfiguration; }
[ "public", "function", "storeConfiguration", "(", "Configuration", "$", "targetConfiguration", ",", "PackageSet", "$", "requiredPackages", ",", "Configuration", "$", "newConfiguration", ")", "{", "$", "key", "=", "$", "this", "->", "getKey", "(", "$", "targetConfig...
Stores the Composer newConfiguration that resulted from requiring the given set of requiredPackages. @param Configuration $targetConfiguration The configuration on which the require was performed. @param PackageSet $requiredPackages @param Configuration $newConfiguration The configuration that resulted from the req...
[ "Stores", "the", "Composer", "newConfiguration", "that", "resulted", "from", "requiring", "the", "given", "set", "of", "requiredPackages", "." ]
0c4999a74c55b03a826e1c881f75ee3fba6329f7
https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/src/Core/Composer/RequireCache.php#L30-L38
224,141
TypistTech/wp-admin-tabs
src/AdminTab.php
AdminTab.isActive
public function isActive(): bool { if (! isset($_SERVER['REQUEST_URI'])) { // Input var okay. return false; } $currentUrl = esc_url_raw( wp_unslash($_SERVER['REQUEST_URI']) // Input var okay. ); $matchUrl = str_replace( esc_url_raw(get_s...
php
public function isActive(): bool { if (! isset($_SERVER['REQUEST_URI'])) { // Input var okay. return false; } $currentUrl = esc_url_raw( wp_unslash($_SERVER['REQUEST_URI']) // Input var okay. ); $matchUrl = str_replace( esc_url_raw(get_s...
[ "public", "function", "isActive", "(", ")", ":", "bool", "{", "if", "(", "!", "isset", "(", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ")", "{", "// Input var okay.", "return", "false", ";", "}", "$", "currentUrl", "=", "esc_url_raw", "(", "wp_unsla...
Whether this tab is active, i.e. current screen is on this tab. @return bool
[ "Whether", "this", "tab", "is", "active", "i", ".", "e", ".", "current", "screen", "is", "on", "this", "tab", "." ]
f70386fbe8c2f8823cbee25e5b8fdeddfab00eaf
https://github.com/TypistTech/wp-admin-tabs/blob/f70386fbe8c2f8823cbee25e5b8fdeddfab00eaf/src/AdminTab.php#L81-L98
224,142
TypistTech/wp-admin-tabs
src/AdminTabCollection.php
AdminTabCollection.add
public function add(AdminTab ...$adminTabs) { $this->adminTabs = array_unique( array_merge($this->adminTabs, $adminTabs), SORT_REGULAR ); }
php
public function add(AdminTab ...$adminTabs) { $this->adminTabs = array_unique( array_merge($this->adminTabs, $adminTabs), SORT_REGULAR ); }
[ "public", "function", "add", "(", "AdminTab", "...", "$", "adminTabs", ")", "{", "$", "this", "->", "adminTabs", "=", "array_unique", "(", "array_merge", "(", "$", "this", "->", "adminTabs", ",", "$", "adminTabs", ")", ",", "SORT_REGULAR", ")", ";", "}" ...
Add admin tabs. @param AdminTab[] ...$adminTabs Admin tabs to be added. @return void
[ "Add", "admin", "tabs", "." ]
f70386fbe8c2f8823cbee25e5b8fdeddfab00eaf
https://github.com/TypistTech/wp-admin-tabs/blob/f70386fbe8c2f8823cbee25e5b8fdeddfab00eaf/src/AdminTabCollection.php#L44-L50
224,143
joachim-n/case-converter
CaseString.php
CaseString.sentence
public static function sentence($string) { $pieces = explode(' ', $string); // Put the first word into lowercase, unless it's all capitals. if (!preg_match('@^[[:upper:]]+$@', $pieces[0])) { $pieces[0] = lcfirst($pieces[0]); } return new StringAssembler($pieces); }
php
public static function sentence($string) { $pieces = explode(' ', $string); // Put the first word into lowercase, unless it's all capitals. if (!preg_match('@^[[:upper:]]+$@', $pieces[0])) { $pieces[0] = lcfirst($pieces[0]); } return new StringAssembler($pieces); }
[ "public", "static", "function", "sentence", "(", "$", "string", ")", "{", "$", "pieces", "=", "explode", "(", "' '", ",", "$", "string", ")", ";", "// Put the first word into lowercase, unless it's all capitals.", "if", "(", "!", "preg_match", "(", "'@^[[:upper:]]...
Takes a sentence case string. @param $string The string. @return \CaseConverter\StringAssembler A string assembler object with the string pieces set on it.
[ "Takes", "a", "sentence", "case", "string", "." ]
f31486030bd46242218a0d7d75becab0b02da2f4
https://github.com/joachim-n/case-converter/blob/f31486030bd46242218a0d7d75becab0b02da2f4/CaseString.php#L105-L114
224,144
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.productFormAction
public function productFormAction() { $userLocale = $this->getUser()->getLocale(); $status = $this->getStatus($userLocale); $units = $this->getUnits($userLocale); $deliveryStates = $this->getDeliveryStates($userLocale); return $this->render( 'SuluProductBundle:T...
php
public function productFormAction() { $userLocale = $this->getUser()->getLocale(); $status = $this->getStatus($userLocale); $units = $this->getUnits($userLocale); $deliveryStates = $this->getDeliveryStates($userLocale); return $this->render( 'SuluProductBundle:T...
[ "public", "function", "productFormAction", "(", ")", "{", "$", "userLocale", "=", "$", "this", "->", "getUser", "(", ")", "->", "getLocale", "(", ")", ";", "$", "status", "=", "$", "this", "->", "getStatus", "(", "$", "userLocale", ")", ";", "$", "un...
Returns template for product list. @return Response
[ "Returns", "template", "for", "product", "list", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L38-L56
224,145
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.attributeFormAction
public function attributeFormAction() { $repository = $this->getDoctrine() ->getRepository('SuluProductBundle:AttributeType'); $types = $repository->findAll(); $attributeTypes = []; foreach ($types as $type) { $attributeTypes[] = [ 'id' => $ty...
php
public function attributeFormAction() { $repository = $this->getDoctrine() ->getRepository('SuluProductBundle:AttributeType'); $types = $repository->findAll(); $attributeTypes = []; foreach ($types as $type) { $attributeTypes[] = [ 'id' => $ty...
[ "public", "function", "attributeFormAction", "(", ")", "{", "$", "repository", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getRepository", "(", "'SuluProductBundle:AttributeType'", ")", ";", "$", "types", "=", "$", "repository", "->", "findAll", "(...
Returns template for attribute list. @return Response
[ "Returns", "template", "for", "attribute", "list", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L97-L117
224,146
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.productPricingAction
public function productPricingAction() { $userLocale = $this->getUser()->getLocale(); /** @var TaxClass[] $taxClasses */ $taxClasses = $this->get('sulu_product.tax_class_manager')->findAll($userLocale); $taxClassTitles = []; foreach ($taxClasses as $taxClass) { ...
php
public function productPricingAction() { $userLocale = $this->getUser()->getLocale(); /** @var TaxClass[] $taxClasses */ $taxClasses = $this->get('sulu_product.tax_class_manager')->findAll($userLocale); $taxClassTitles = []; foreach ($taxClasses as $taxClass) { ...
[ "public", "function", "productPricingAction", "(", ")", "{", "$", "userLocale", "=", "$", "this", "->", "getUser", "(", ")", "->", "getLocale", "(", ")", ";", "/** @var TaxClass[] $taxClasses */", "$", "taxClasses", "=", "$", "this", "->", "get", "(", "'sulu...
Returns template for product pricing. @return Response
[ "Returns", "template", "for", "product", "pricing", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L124-L152
224,147
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.getStatus
protected function getStatus($locale) { /** @var Status[] $statuses */ $statuses = $this->get('sulu_product.status_manager')->findAll($locale); $statusTitles = []; foreach ($statuses as $status) { $statusTitles[] = [ 'id' => $status->getId(), ...
php
protected function getStatus($locale) { /** @var Status[] $statuses */ $statuses = $this->get('sulu_product.status_manager')->findAll($locale); $statusTitles = []; foreach ($statuses as $status) { $statusTitles[] = [ 'id' => $status->getId(), ...
[ "protected", "function", "getStatus", "(", "$", "locale", ")", "{", "/** @var Status[] $statuses */", "$", "statuses", "=", "$", "this", "->", "get", "(", "'sulu_product.status_manager'", ")", "->", "findAll", "(", "$", "locale", ")", ";", "$", "statusTitles", ...
Returns status for products. @param string $locale @return array
[ "Returns", "status", "for", "products", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L191-L205
224,148
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.getUnits
protected function getUnits($locale) { /** @var Status[] $units */ $units = $this->get('sulu_product.unit_manager')->findAll($locale); $unitTitles = []; foreach ($units as $unit) { $unitTitles[] = [ 'id' => $unit->getId(), 'name' => $unit-...
php
protected function getUnits($locale) { /** @var Status[] $units */ $units = $this->get('sulu_product.unit_manager')->findAll($locale); $unitTitles = []; foreach ($units as $unit) { $unitTitles[] = [ 'id' => $unit->getId(), 'name' => $unit-...
[ "protected", "function", "getUnits", "(", "$", "locale", ")", "{", "/** @var Status[] $units */", "$", "units", "=", "$", "this", "->", "get", "(", "'sulu_product.unit_manager'", ")", "->", "findAll", "(", "$", "locale", ")", ";", "$", "unitTitles", "=", "["...
Returns units. @param string $locale @return array
[ "Returns", "units", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L214-L228
224,149
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.getCurrencies
protected function getCurrencies($locale) { /** @var Currency[] $currencies */ $currencies = $this->get('sulu_product.currency_manager')->findAll($locale); $currencyTitles = []; foreach ($currencies as $currency) { $currencyTitles[] = [ 'id' => $currency-...
php
protected function getCurrencies($locale) { /** @var Currency[] $currencies */ $currencies = $this->get('sulu_product.currency_manager')->findAll($locale); $currencyTitles = []; foreach ($currencies as $currency) { $currencyTitles[] = [ 'id' => $currency-...
[ "protected", "function", "getCurrencies", "(", "$", "locale", ")", "{", "/** @var Currency[] $currencies */", "$", "currencies", "=", "$", "this", "->", "get", "(", "'sulu_product.currency_manager'", ")", "->", "findAll", "(", "$", "locale", ")", ";", "$", "curr...
Returns currencies. @param string $locale @return array
[ "Returns", "currencies", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L237-L253
224,150
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.getCategoryUrl
protected function getCategoryUrl() { $rootKey = $this->container->getParameter('sulu_product.category_root_key'); if (null !== $rootKey) { return $this->generateUrl( 'get_category_children', ['key' => $rootKey, 'flat' => 'true', 'sortBy' => 'depth', 'sor...
php
protected function getCategoryUrl() { $rootKey = $this->container->getParameter('sulu_product.category_root_key'); if (null !== $rootKey) { return $this->generateUrl( 'get_category_children', ['key' => $rootKey, 'flat' => 'true', 'sortBy' => 'depth', 'sor...
[ "protected", "function", "getCategoryUrl", "(", ")", "{", "$", "rootKey", "=", "$", "this", "->", "container", "->", "getParameter", "(", "'sulu_product.category_root_key'", ")", ";", "if", "(", "null", "!==", "$", "rootKey", ")", "{", "return", "$", "this",...
Returns url for fetching categories. If sulu_product.category_root_key is specified only categories of this specific root key are going to be fetched. Otherwise the whole category tree is returned. @return string
[ "Returns", "url", "for", "fetching", "categories", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L263-L278
224,151
sulu/SuluProductBundle
Controller/TemplateController.php
TemplateController.getDeliveryStates
protected function getDeliveryStates($locale) { $states = $this->getDeliveryStatusManager()->findAll($locale); $deliveryStates = []; foreach ($states as $state) { $deliveryStates[] = [ 'id' => $state->getId(), 'name' => $state->getName(), ...
php
protected function getDeliveryStates($locale) { $states = $this->getDeliveryStatusManager()->findAll($locale); $deliveryStates = []; foreach ($states as $state) { $deliveryStates[] = [ 'id' => $state->getId(), 'name' => $state->getName(), ...
[ "protected", "function", "getDeliveryStates", "(", "$", "locale", ")", "{", "$", "states", "=", "$", "this", "->", "getDeliveryStatusManager", "(", ")", "->", "findAll", "(", "$", "locale", ")", ";", "$", "deliveryStates", "=", "[", "]", ";", "foreach", ...
Returns delivery states. @param string $locale @return array
[ "Returns", "delivery", "states", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/TemplateController.php#L287-L300
224,152
sulu/SuluProductBundle
Entity/Unit.php
Unit.getTranslation
public function getTranslation($locale) { $translation = null; // Use first translation as a fallback. if (count($this->translations) > 0) { $translation = $this->translations[0]; } /** @var UnitTranslation $translationData */ foreach ($this->translation...
php
public function getTranslation($locale) { $translation = null; // Use first translation as a fallback. if (count($this->translations) > 0) { $translation = $this->translations[0]; } /** @var UnitTranslation $translationData */ foreach ($this->translation...
[ "public", "function", "getTranslation", "(", "$", "locale", ")", "{", "$", "translation", "=", "null", ";", "// Use first translation as a fallback.", "if", "(", "count", "(", "$", "this", "->", "translations", ")", ">", "0", ")", "{", "$", "translation", "=...
Returns the translation for the given locale. @param string $locale @return Translation
[ "Returns", "the", "translation", "for", "the", "given", "locale", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/Unit.php#L127-L145
224,153
sulu/SuluProductBundle
Controller/ProductVariantAttributeController.php
ProductVariantAttributeController.deleteAction
public function deleteAction($productId, $attributeId) { $this->getVariantAttributeManager()->removeVariantAttributeRelation( $productId, $attributeId ); $this->getDoctrine()->getEntityManager()->flush(); $view = $this->view(null, Response::HTTP_NO_CONTENT);...
php
public function deleteAction($productId, $attributeId) { $this->getVariantAttributeManager()->removeVariantAttributeRelation( $productId, $attributeId ); $this->getDoctrine()->getEntityManager()->flush(); $view = $this->view(null, Response::HTTP_NO_CONTENT);...
[ "public", "function", "deleteAction", "(", "$", "productId", ",", "$", "attributeId", ")", "{", "$", "this", "->", "getVariantAttributeManager", "(", ")", "->", "removeVariantAttributeRelation", "(", "$", "productId", ",", "$", "attributeId", ")", ";", "$", "t...
Deletes attribute from variant. @Delete("products/{productId}/variant-attributes/{attributeId}") @param int $productId @param int $attributeId @return Response
[ "Deletes", "attribute", "from", "variant", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductVariantAttributeController.php#L121-L133
224,154
unreal4u/mqtt
src/Protocol/Publish.php
Publish.createVariableHeaderFlags
private function createVariableHeaderFlags(): string { if ($this->isRedelivery) { // DUP flag: if the message is a re-delivery, mark it as such $this->specialFlags |= 8; $this->logger->debug('Activating redelivery bit'); } if ($this->message->isRetained()...
php
private function createVariableHeaderFlags(): string { if ($this->isRedelivery) { // DUP flag: if the message is a re-delivery, mark it as such $this->specialFlags |= 8; $this->logger->debug('Activating redelivery bit'); } if ($this->message->isRetained()...
[ "private", "function", "createVariableHeaderFlags", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "isRedelivery", ")", "{", "// DUP flag: if the message is a re-delivery, mark it as such", "$", "this", "->", "specialFlags", "|=", "8", ";", "$", "this",...
Sets some common flags and returns the variable header string should there be one @return string @throws OutOfRangeException @throws InvalidQoSLevel
[ "Sets", "some", "common", "flags", "and", "returns", "the", "variable", "header", "string", "should", "there", "be", "one" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L100-L123
224,155
unreal4u/mqtt
src/Protocol/Publish.php
Publish.shouldExpectAnswer
public function shouldExpectAnswer(): bool { $shouldExpectAnswer = !($this->message->getQoSLevel() === 0); $this->logger->debug('Checking whether we should expect an answer or not', [ 'shouldExpectAnswer' => $shouldExpectAnswer, ]); return $shouldExpectAnswer; }
php
public function shouldExpectAnswer(): bool { $shouldExpectAnswer = !($this->message->getQoSLevel() === 0); $this->logger->debug('Checking whether we should expect an answer or not', [ 'shouldExpectAnswer' => $shouldExpectAnswer, ]); return $shouldExpectAnswer; }
[ "public", "function", "shouldExpectAnswer", "(", ")", ":", "bool", "{", "$", "shouldExpectAnswer", "=", "!", "(", "$", "this", "->", "message", "->", "getQoSLevel", "(", ")", "===", "0", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Chec...
QoS level 0 does not have to wait for a answer, so return false. Any other QoS level returns true @return bool @throws InvalidQoSLevel
[ "QoS", "level", "0", "does", "not", "have", "to", "wait", "for", "a", "answer", "so", "return", "false", ".", "Any", "other", "QoS", "level", "returns", "true" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L144-L151
224,156
unreal4u/mqtt
src/Protocol/Publish.php
Publish.analyzeFirstByte
private function analyzeFirstByte(int $firstByte, QoSLevel $qoSLevel): Publish { $this->logger->debug('Analyzing first byte', [sprintf('%08d', decbin($firstByte))]); // Retained bit is bit 0 of first byte $this->message->setRetainFlag(false); if (($firstByte & 1) === 1) { ...
php
private function analyzeFirstByte(int $firstByte, QoSLevel $qoSLevel): Publish { $this->logger->debug('Analyzing first byte', [sprintf('%08d', decbin($firstByte))]); // Retained bit is bit 0 of first byte $this->message->setRetainFlag(false); if (($firstByte & 1) === 1) { ...
[ "private", "function", "analyzeFirstByte", "(", "int", "$", "firstByte", ",", "QoSLevel", "$", "qoSLevel", ")", ":", "Publish", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Analyzing first byte'", ",", "[", "sprintf", "(", "'%08d'", ",", "decbin",...
Sets several bits and pieces from the first byte of the fixed header for the Publish packet @param int $firstByte @param QoSLevel $qoSLevel @return Publish @throws InvalidQoSLevel
[ "Sets", "several", "bits", "and", "pieces", "from", "the", "first", "byte", "of", "the", "fixed", "header", "for", "the", "Publish", "packet" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L206-L227
224,157
unreal4u/mqtt
src/Protocol/Publish.php
Publish.determineIncomingQoSLevel
private function determineIncomingQoSLevel(int $bitString): QoSLevel { // QoS lvl are in bit positions 1-2. Shifting is strictly speaking not needed, but increases human comprehension $shiftedBits = $bitString >> 1; $incomingQoSLevel = 0; if (($shiftedBits & 1) === 1) { $...
php
private function determineIncomingQoSLevel(int $bitString): QoSLevel { // QoS lvl are in bit positions 1-2. Shifting is strictly speaking not needed, but increases human comprehension $shiftedBits = $bitString >> 1; $incomingQoSLevel = 0; if (($shiftedBits & 1) === 1) { $...
[ "private", "function", "determineIncomingQoSLevel", "(", "int", "$", "bitString", ")", ":", "QoSLevel", "{", "// QoS lvl are in bit positions 1-2. Shifting is strictly speaking not needed, but increases human comprehension", "$", "shiftedBits", "=", "$", "bitString", ">>", "1", ...
Finds out the QoS level in a fixed header for the Publish object @param int $bitString @return QoSLevel @throws InvalidQoSLevel
[ "Finds", "out", "the", "QoS", "level", "in", "a", "fixed", "header", "for", "the", "Publish", "object" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L236-L250
224,158
unreal4u/mqtt
src/Protocol/Publish.php
Publish.completePossibleIncompleteMessage
private function completePossibleIncompleteMessage(string $rawMQTTHeaders, ClientInterface $client): string { // Read at least one extra byte from the stream if we know that the message is too short if (strlen($rawMQTTHeaders) < 2) { $rawMQTTHeaders .= $client->readBrokerData(1); ...
php
private function completePossibleIncompleteMessage(string $rawMQTTHeaders, ClientInterface $client): string { // Read at least one extra byte from the stream if we know that the message is too short if (strlen($rawMQTTHeaders) < 2) { $rawMQTTHeaders .= $client->readBrokerData(1); ...
[ "private", "function", "completePossibleIncompleteMessage", "(", "string", "$", "rawMQTTHeaders", ",", "ClientInterface", "$", "client", ")", ":", "string", "{", "// Read at least one extra byte from the stream if we know that the message is too short", "if", "(", "strlen", "("...
Gets the full message in case this object needs to @param string $rawMQTTHeaders @param ClientInterface $client @return string @throws OutOfBoundsException @throws InvalidArgumentException @throws MessageTooBig @throws InvalidQoSLevel
[ "Gets", "the", "full", "message", "in", "case", "this", "object", "needs", "to" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L263-L290
224,159
unreal4u/mqtt
src/Protocol/Publish.php
Publish.fillObject
public function fillObject(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface { // Retrieve full message first $fullMessage = $this->completePossibleIncompleteMessage($rawMQTTHeaders, $client); // Handy to maintain for debugging purposes #$this->logger->debug(...
php
public function fillObject(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface { // Retrieve full message first $fullMessage = $this->completePossibleIncompleteMessage($rawMQTTHeaders, $client); // Handy to maintain for debugging purposes #$this->logger->debug(...
[ "public", "function", "fillObject", "(", "string", "$", "rawMQTTHeaders", ",", "ClientInterface", "$", "client", ")", ":", "ReadableContentInterface", "{", "// Retrieve full message first", "$", "fullMessage", "=", "$", "this", "->", "completePossibleIncompleteMessage", ...
Will perform sanity checks and fill in the Readable object with data @param string $rawMQTTHeaders @param ClientInterface $client @return ReadableContentInterface @throws MessageTooBig @throws OutOfBoundsException @throws InvalidQoSLevel @throws InvalidArgumentException @throws OutOfRangeException
[ "Will", "perform", "sanity", "checks", "and", "fill", "in", "the", "Readable", "object", "with", "data" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L303-L347
224,160
unreal4u/mqtt
src/Protocol/Publish.php
Publish.composePubRecAnswer
private function composePubRecAnswer(): PubRec { $this->checkForValidPacketIdentifier(); $pubRec = new PubRec($this->logger); $pubRec->setPacketIdentifier($this->packetIdentifier); return $pubRec; }
php
private function composePubRecAnswer(): PubRec { $this->checkForValidPacketIdentifier(); $pubRec = new PubRec($this->logger); $pubRec->setPacketIdentifier($this->packetIdentifier); return $pubRec; }
[ "private", "function", "composePubRecAnswer", "(", ")", ":", "PubRec", "{", "$", "this", "->", "checkForValidPacketIdentifier", "(", ")", ";", "$", "pubRec", "=", "new", "PubRec", "(", "$", "this", "->", "logger", ")", ";", "$", "pubRec", "->", "setPacketI...
Composes a PubRec answer with the same packetIdentifier as what we received @return PubRec @throws InvalidRequest
[ "Composes", "a", "PubRec", "answer", "with", "the", "same", "packetIdentifier", "as", "what", "we", "received" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L380-L386
224,161
unreal4u/mqtt
src/Protocol/Publish.php
Publish.composePubAckAnswer
private function composePubAckAnswer(): PubAck { $this->checkForValidPacketIdentifier(); $pubAck = new PubAck($this->logger); $pubAck->setPacketIdentifier($this->packetIdentifier); return $pubAck; }
php
private function composePubAckAnswer(): PubAck { $this->checkForValidPacketIdentifier(); $pubAck = new PubAck($this->logger); $pubAck->setPacketIdentifier($this->packetIdentifier); return $pubAck; }
[ "private", "function", "composePubAckAnswer", "(", ")", ":", "PubAck", "{", "$", "this", "->", "checkForValidPacketIdentifier", "(", ")", ";", "$", "pubAck", "=", "new", "PubAck", "(", "$", "this", "->", "logger", ")", ";", "$", "pubAck", "->", "setPacketI...
Composes a PubAck answer with the same packetIdentifier as what we received @return PubAck @throws InvalidRequest
[ "Composes", "a", "PubAck", "answer", "with", "the", "same", "packetIdentifier", "as", "what", "we", "received" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L394-L400
224,162
unreal4u/mqtt
src/Protocol/Publish.php
Publish.checkForValidPacketIdentifier
private function checkForValidPacketIdentifier(): self { if ($this->packetIdentifier === null) { $this->logger->critical('No valid packet identifier found at a stage where there MUST be one set'); throw new InvalidRequest('You are trying to send a request without a valid packet ident...
php
private function checkForValidPacketIdentifier(): self { if ($this->packetIdentifier === null) { $this->logger->critical('No valid packet identifier found at a stage where there MUST be one set'); throw new InvalidRequest('You are trying to send a request without a valid packet ident...
[ "private", "function", "checkForValidPacketIdentifier", "(", ")", ":", "self", "{", "if", "(", "$", "this", "->", "packetIdentifier", "===", "null", ")", "{", "$", "this", "->", "logger", "->", "critical", "(", "'No valid packet identifier found at a stage where the...
Will check whether the current object has a packet identifier set. If not, we are in serious problems! @return Publish @throws InvalidRequest
[ "Will", "check", "whether", "the", "current", "object", "has", "a", "packet", "identifier", "set", ".", "If", "not", "we", "are", "in", "serious", "problems!" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Publish.php#L408-L416
224,163
actualreports/pdfgeneratorapi-laravel
src/Http/Controllers/TemplateController.php
TemplateController.edit
public function edit(Request $request, $template) { $data = $this->getData(); /** * Set workspace identifier */ \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(Auth::user())); return redirect()->away(\PDFGeneratorAPI::editor($template,...
php
public function edit(Request $request, $template) { $data = $this->getData(); /** * Set workspace identifier */ \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(Auth::user())); return redirect()->away(\PDFGeneratorAPI::editor($template,...
[ "public", "function", "edit", "(", "Request", "$", "request", ",", "$", "template", ")", "{", "$", "data", "=", "$", "this", "->", "getData", "(", ")", ";", "/**\n * Set workspace identifier\n */", "\\", "PDFGeneratorAPI", "::", "setWorkspace", "...
Redirects to editor to edit the new template @param \Illuminate\Http\Request $request @param integer $template @return \Illuminate\Http\RedirectResponse
[ "Redirects", "to", "editor", "to", "edit", "the", "new", "template" ]
f5fb75cb7c5f15029844378f9c9c098f7126178a
https://github.com/actualreports/pdfgeneratorapi-laravel/blob/f5fb75cb7c5f15029844378f9c9c098f7126178a/src/Http/Controllers/TemplateController.php#L156-L166
224,164
actualreports/pdfgeneratorapi-laravel
src/Http/Controllers/TemplateController.php
TemplateController.editAsCopy
public function editAsCopy(Request $request, $template) { $name = $request->get('name'); $data = $this->getData(); try { /** * Set workspace identifier */ \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(A...
php
public function editAsCopy(Request $request, $template) { $name = $request->get('name'); $data = $this->getData(); try { /** * Set workspace identifier */ \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(A...
[ "public", "function", "editAsCopy", "(", "Request", "$", "request", ",", "$", "template", ")", "{", "$", "name", "=", "$", "request", "->", "get", "(", "'name'", ")", ";", "$", "data", "=", "$", "this", "->", "getData", "(", ")", ";", "try", "{", ...
Creates a copy of given template and redirects to editor to edit the new template @param \Illuminate\Http\Request $request @param integer $template @return \Illuminate\Http\RedirectResponse
[ "Creates", "a", "copy", "of", "given", "template", "and", "redirects", "to", "editor", "to", "edit", "the", "new", "template" ]
f5fb75cb7c5f15029844378f9c9c098f7126178a
https://github.com/actualreports/pdfgeneratorapi-laravel/blob/f5fb75cb7c5f15029844378f9c9c098f7126178a/src/Http/Controllers/TemplateController.php#L193-L215
224,165
sulu/SuluProductBundle
Entity/UnitMapping.php
UnitMapping.setUnit
public function setUnit(\Sulu\Bundle\ProductBundle\Entity\Unit $unit) { $this->unit = $unit; return $this; }
php
public function setUnit(\Sulu\Bundle\ProductBundle\Entity\Unit $unit) { $this->unit = $unit; return $this; }
[ "public", "function", "setUnit", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "Unit", "$", "unit", ")", "{", "$", "this", "->", "unit", "=", "$", "unit", ";", "return", "$", "this", ";", "}" ]
Set unit. @param \Sulu\Bundle\ProductBundle\Entity\Unit $unit @return UnitMapping
[ "Set", "unit", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/UnitMapping.php#L75-L80
224,166
sulu/SuluProductBundle
Entity/AttributeRepository.php
AttributeRepository.getAttributeQuery
private function getAttributeQuery($locale) { $queryBuilder = $this->createQueryBuilder('attribute') ->leftJoin('attribute.translations', 'translations', 'WITH', 'translations.locale = :locale') ->leftJoin('attribute.type', 'type') ->setParameter('locale', $locale); ...
php
private function getAttributeQuery($locale) { $queryBuilder = $this->createQueryBuilder('attribute') ->leftJoin('attribute.translations', 'translations', 'WITH', 'translations.locale = :locale') ->leftJoin('attribute.type', 'type') ->setParameter('locale', $locale); ...
[ "private", "function", "getAttributeQuery", "(", "$", "locale", ")", "{", "$", "queryBuilder", "=", "$", "this", "->", "createQueryBuilder", "(", "'attribute'", ")", "->", "leftJoin", "(", "'attribute.translations'", ",", "'translations'", ",", "'WITH'", ",", "'...
Returns the query for attributes. @param string $locale The locale to load @return \Doctrine\ORM\QueryBuilder
[ "Returns", "the", "query", "for", "attributes", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/AttributeRepository.php#L106-L114
224,167
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setClientId
public function setClientId(ClientId $clientId): self { $this->clientId = $clientId; $this->logger->debug('Set clientId', ['actualClientString' => (string)$clientId]); if ($this->clientId->isEmptyClientId()) { $this->logger->debug('Empty clientId detected, forcing clean session b...
php
public function setClientId(ClientId $clientId): self { $this->clientId = $clientId; $this->logger->debug('Set clientId', ['actualClientString' => (string)$clientId]); if ($this->clientId->isEmptyClientId()) { $this->logger->debug('Empty clientId detected, forcing clean session b...
[ "public", "function", "setClientId", "(", "ClientId", "$", "clientId", ")", ":", "self", "{", "$", "this", "->", "clientId", "=", "$", "clientId", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Set clientId'", ",", "[", "'actualClientString'", "=>...
Handles everything related to setting the ClientId @param ClientId $clientId @return Parameters
[ "Handles", "everything", "related", "to", "setting", "the", "ClientId" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L173-L183
224,168
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.getConnectionUrl
public function getConnectionUrl(): string { return sprintf( '%s://%s:%d', $this->brokerPort->getTransmissionProtocol(), $this->host, $this->brokerPort->getBrokerPort() ); }
php
public function getConnectionUrl(): string { return sprintf( '%s://%s:%d', $this->brokerPort->getTransmissionProtocol(), $this->host, $this->brokerPort->getBrokerPort() ); }
[ "public", "function", "getConnectionUrl", "(", ")", ":", "string", "{", "return", "sprintf", "(", "'%s://%s:%d'", ",", "$", "this", "->", "brokerPort", "->", "getTransmissionProtocol", "(", ")", ",", "$", "this", "->", "host", ",", "$", "this", "->", "brok...
Returns the connection string @TODO Currently only TCP connections supported, SSL will come @return string
[ "Returns", "the", "connection", "string" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L197-L205
224,169
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setKeepAlivePeriod
public function setKeepAlivePeriod(int $keepAlivePeriod): self { if ($keepAlivePeriod > 65535 || $keepAlivePeriod < 0) { $this->logger->error('Keep alive period must be between 0 and 65535'); throw new \InvalidArgumentException('Keep alive period must be between 0 and 65535'); ...
php
public function setKeepAlivePeriod(int $keepAlivePeriod): self { if ($keepAlivePeriod > 65535 || $keepAlivePeriod < 0) { $this->logger->error('Keep alive period must be between 0 and 65535'); throw new \InvalidArgumentException('Keep alive period must be between 0 and 65535'); ...
[ "public", "function", "setKeepAlivePeriod", "(", "int", "$", "keepAlivePeriod", ")", ":", "self", "{", "if", "(", "$", "keepAlivePeriod", ">", "65535", "||", "$", "keepAlivePeriod", "<", "0", ")", "{", "$", "this", "->", "logger", "->", "error", "(", "'K...
Keep alive period is measured in positive seconds. The maximum is 18h, 12m and 15s, equivalent to 65535 seconds @param int $keepAlivePeriod @return Parameters @throws \InvalidArgumentException
[ "Keep", "alive", "period", "is", "measured", "in", "positive", "seconds", ".", "The", "maximum", "is", "18h", "12m", "and", "15s", "equivalent", "to", "65535", "seconds" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L224-L233
224,170
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setCredentials
public function setCredentials(string $username, string $password): self { $this->bitFlag &= ~64; $this->bitFlag &= ~128; if ($username !== '') { $this->logger->debug('Username set, setting username flag'); $this->bitFlag |= 128; $this->username = $userna...
php
public function setCredentials(string $username, string $password): self { $this->bitFlag &= ~64; $this->bitFlag &= ~128; if ($username !== '') { $this->logger->debug('Username set, setting username flag'); $this->bitFlag |= 128; $this->username = $userna...
[ "public", "function", "setCredentials", "(", "string", "$", "username", ",", "string", "$", "password", ")", ":", "self", "{", "$", "this", "->", "bitFlag", "&=", "~", "64", ";", "$", "this", "->", "bitFlag", "&=", "~", "128", ";", "if", "(", "$", ...
Sets the 6th and 7th bit of the connect flag @param string $username @param string $password @return Parameters
[ "Sets", "the", "6th", "and", "7th", "bit", "of", "the", "connect", "flag" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L242-L260
224,171
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setWillRetainBit
private function setWillRetainBit(bool $willRetain): self { $this->bitFlag &= ~32; if ($willRetain === true) { $this->logger->debug('Setting will retain flag'); $this->bitFlag |= 32; } return $this; }
php
private function setWillRetainBit(bool $willRetain): self { $this->bitFlag &= ~32; if ($willRetain === true) { $this->logger->debug('Setting will retain flag'); $this->bitFlag |= 32; } return $this; }
[ "private", "function", "setWillRetainBit", "(", "bool", "$", "willRetain", ")", ":", "self", "{", "$", "this", "->", "bitFlag", "&=", "~", "32", ";", "if", "(", "$", "willRetain", "===", "true", ")", "{", "$", "this", "->", "logger", "->", "debug", "...
Sets the 5th bit of the connect flag @see http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349230 @param bool $willRetain @return Parameters
[ "Sets", "the", "5th", "bit", "of", "the", "connect", "flag" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L269-L277
224,172
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setWillQoSLevelBit
private function setWillQoSLevelBit(int $QoSLevel): self { // Reset first the will QoS bits and proceed to set them $this->bitFlag &= ~8; // Third bit: 8 $this->bitFlag &= ~16; // Fourth bit: 16 if ($QoSLevel !== 0) { $this->logger->debug(sprintf( 'Settin...
php
private function setWillQoSLevelBit(int $QoSLevel): self { // Reset first the will QoS bits and proceed to set them $this->bitFlag &= ~8; // Third bit: 8 $this->bitFlag &= ~16; // Fourth bit: 16 if ($QoSLevel !== 0) { $this->logger->debug(sprintf( 'Settin...
[ "private", "function", "setWillQoSLevelBit", "(", "int", "$", "QoSLevel", ")", ":", "self", "{", "// Reset first the will QoS bits and proceed to set them", "$", "this", "->", "bitFlag", "&=", "~", "8", ";", "// Third bit: 8", "$", "this", "->", "bitFlag", "&=", "...
Determines and sets the 3rd and 4th bits of the connect flag @see http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349230 @param int $QoSLevel @return Parameters
[ "Determines", "and", "sets", "the", "3rd", "and", "4th", "bits", "of", "the", "connect", "flag" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L286-L303
224,173
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setWill
public function setWill(Message $message): self { // Proceed only if we have a valid message $this->bitFlag &= ~4; if ($message->getTopicName() !== '') { $this->logger->debug('Setting will flag'); $this->bitFlag |= 4; } $this->will = $message; ...
php
public function setWill(Message $message): self { // Proceed only if we have a valid message $this->bitFlag &= ~4; if ($message->getTopicName() !== '') { $this->logger->debug('Setting will flag'); $this->bitFlag |= 4; } $this->will = $message; ...
[ "public", "function", "setWill", "(", "Message", "$", "message", ")", ":", "self", "{", "// Proceed only if we have a valid message", "$", "this", "->", "bitFlag", "&=", "~", "4", ";", "if", "(", "$", "message", "->", "getTopicName", "(", ")", "!==", "''", ...
Sets the given will. Will also set the 2nd bit of the connect flags if a message is provided @see http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349230 @param Message $message @return Parameters @throws \unreal4u\MQTT\Exceptions\InvalidQoSLevel @throws \unreal4u\MQTT\Exceptions\MissingTopicN...
[ "Sets", "the", "given", "will", ".", "Will", "also", "set", "the", "2nd", "bit", "of", "the", "connect", "flags", "if", "a", "message", "is", "provided" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L315-L330
224,174
unreal4u/mqtt
src/Protocol/Connect/Parameters.php
Parameters.setCleanSession
public function setCleanSession(bool $cleanSession): self { $this->bitFlag &= ~2; if ($cleanSession === true) { $this->logger->debug('Clean session flag set'); $this->bitFlag |= 2; } $this->cleanSession = $cleanSession; return $this; }
php
public function setCleanSession(bool $cleanSession): self { $this->bitFlag &= ~2; if ($cleanSession === true) { $this->logger->debug('Clean session flag set'); $this->bitFlag |= 2; } $this->cleanSession = $cleanSession; return $this; }
[ "public", "function", "setCleanSession", "(", "bool", "$", "cleanSession", ")", ":", "self", "{", "$", "this", "->", "bitFlag", "&=", "~", "2", ";", "if", "(", "$", "cleanSession", "===", "true", ")", "{", "$", "this", "->", "logger", "->", "debug", ...
Sets the 1st bit of the connect flags @param bool $cleanSession @return Parameters
[ "Sets", "the", "1st", "bit", "of", "the", "connect", "flags" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/Connect/Parameters.php#L338-L347
224,175
sulu/SuluProductBundle
Entity/SpecialPriceRepository.php
SpecialPriceRepository.findAllCurrent
public function findAllCurrent($limit = 1000, $page = 1) { try { $qb = $this->getValidSpecialPriceQuery(); $adapter = new DoctrineORMAdapter($qb); $pagerfanta = new Pagerfanta($adapter); $pagerfanta->setMaxPerPage($limit); $pagerfanta->setCurrentP...
php
public function findAllCurrent($limit = 1000, $page = 1) { try { $qb = $this->getValidSpecialPriceQuery(); $adapter = new DoctrineORMAdapter($qb); $pagerfanta = new Pagerfanta($adapter); $pagerfanta->setMaxPerPage($limit); $pagerfanta->setCurrentP...
[ "public", "function", "findAllCurrent", "(", "$", "limit", "=", "1000", ",", "$", "page", "=", "1", ")", "{", "try", "{", "$", "qb", "=", "$", "this", "->", "getValidSpecialPriceQuery", "(", ")", ";", "$", "adapter", "=", "new", "DoctrineORMAdapter", "...
Returns the current special prices. @param int $limit @param int $page @return null|Pagerfanta
[ "Returns", "the", "current", "special", "prices", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/SpecialPriceRepository.php#L32-L46
224,176
sulu/SuluProductBundle
Entity/SpecialPriceRepository.php
SpecialPriceRepository.findAllCurrentIds
public function findAllCurrentIds($limit = 1000) { try { $queryBuilder = $this->getValidSpecialPriceQuery() ->select('specialPrice.id') ->addOrderBy('specialPrice.id', 'DESC'); $query = $queryBuilder->getQuery() ->useResultCache(true, 3...
php
public function findAllCurrentIds($limit = 1000) { try { $queryBuilder = $this->getValidSpecialPriceQuery() ->select('specialPrice.id') ->addOrderBy('specialPrice.id', 'DESC'); $query = $queryBuilder->getQuery() ->useResultCache(true, 3...
[ "public", "function", "findAllCurrentIds", "(", "$", "limit", "=", "1000", ")", "{", "try", "{", "$", "queryBuilder", "=", "$", "this", "->", "getValidSpecialPriceQuery", "(", ")", "->", "select", "(", "'specialPrice.id'", ")", "->", "addOrderBy", "(", "'spe...
Returns the ids of a specific amount of special prices. @param int $limit @return array|null
[ "Returns", "the", "ids", "of", "a", "specific", "amount", "of", "special", "prices", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/SpecialPriceRepository.php#L55-L70
224,177
sulu/SuluProductBundle
Entity/SpecialPriceRepository.php
SpecialPriceRepository.getValidSpecialPriceQuery
protected function getValidSpecialPriceQuery() { $qb = $this->createQueryBuilder('specialPrice') ->leftJoin('specialPrice.product', 'product') ->leftJoin('product.status', 'productStatus') ->where(':now BETWEEN specialPrice.startDate AND specialPrice.endDate') ...
php
protected function getValidSpecialPriceQuery() { $qb = $this->createQueryBuilder('specialPrice') ->leftJoin('specialPrice.product', 'product') ->leftJoin('product.status', 'productStatus') ->where(':now BETWEEN specialPrice.startDate AND specialPrice.endDate') ...
[ "protected", "function", "getValidSpecialPriceQuery", "(", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", "'specialPrice'", ")", "->", "leftJoin", "(", "'specialPrice.product'", ",", "'product'", ")", "->", "leftJoin", "(", "'product.statu...
Returns special price querybuilder. @return \Doctrine\ORM\QueryBuilder
[ "Returns", "special", "price", "querybuilder", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/SpecialPriceRepository.php#L77-L88
224,178
unreal4u/mqtt
src/Utilities.php
Utilities.convertNumberToBinaryString
public static function convertNumberToBinaryString(int $number): string { if ($number > 65535) { throw new OutOfRangeException('This is an INT16 conversion, so the maximum is 65535'); } return chr($number >> 8) . chr($number & 255); }
php
public static function convertNumberToBinaryString(int $number): string { if ($number > 65535) { throw new OutOfRangeException('This is an INT16 conversion, so the maximum is 65535'); } return chr($number >> 8) . chr($number & 255); }
[ "public", "static", "function", "convertNumberToBinaryString", "(", "int", "$", "number", ")", ":", "string", "{", "if", "(", "$", "number", ">", "65535", ")", "{", "throw", "new", "OutOfRangeException", "(", "'This is an INT16 conversion, so the maximum is 65535'", ...
Converts a number to a binary string that the MQTT protocol understands @param int $number @return string @throws OutOfRangeException
[ "Converts", "a", "number", "to", "a", "binary", "string", "that", "the", "MQTT", "protocol", "understands" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Utilities.php#L51-L58
224,179
unreal4u/mqtt
src/Utilities.php
Utilities.convertBinaryStringToNumber
public static function convertBinaryStringToNumber(string $binaryString): int { return self::convertEndianness((ord($binaryString{1}) << 8) + (ord($binaryString{0}) & 255)); }
php
public static function convertBinaryStringToNumber(string $binaryString): int { return self::convertEndianness((ord($binaryString{1}) << 8) + (ord($binaryString{0}) & 255)); }
[ "public", "static", "function", "convertBinaryStringToNumber", "(", "string", "$", "binaryString", ")", ":", "int", "{", "return", "self", "::", "convertEndianness", "(", "(", "ord", "(", "$", "binaryString", "{", "1", "}", ")", "<<", "8", ")", "+", "(", ...
Converts a binary representation of a number to an actual int @param string $binaryString @return int @throws OutOfRangeException
[ "Converts", "a", "binary", "representation", "of", "a", "number", "to", "an", "actual", "int" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Utilities.php#L67-L70
224,180
unreal4u/mqtt
src/Utilities.php
Utilities.convertRemainingLengthStringToInt
public static function convertRemainingLengthStringToInt(string $remainingLengthField): int { $multiplier = 128; $value = 0; $iteration = 0; do { // Extract the next byte in the sequence $encodedByte = ord($remainingLengthField{$iteration}); // A...
php
public static function convertRemainingLengthStringToInt(string $remainingLengthField): int { $multiplier = 128; $value = 0; $iteration = 0; do { // Extract the next byte in the sequence $encodedByte = ord($remainingLengthField{$iteration}); // A...
[ "public", "static", "function", "convertRemainingLengthStringToInt", "(", "string", "$", "remainingLengthField", ")", ":", "int", "{", "$", "multiplier", "=", "128", ";", "$", "value", "=", "0", ";", "$", "iteration", "=", "0", ";", "do", "{", "// Extract th...
The remaining length of a message is encoded in this specific way, the opposite of formatRemainingLengthOutput Many thanks to Peter's blog for your excellent examples and knowledge. @see http://indigoo.com/petersblog/?p=263 Original pseudo-algorithm as per the documentation: <pre> multiplier = 1 value = 0 do encodedB...
[ "The", "remaining", "length", "of", "a", "message", "is", "encoded", "in", "this", "specific", "way", "the", "opposite", "of", "formatRemainingLengthOutput" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Utilities.php#L139-L160
224,181
sulu/SuluProductBundle
Controller/WebsiteProductController.php
WebsiteProductController.indexAction
public function indexAction(ProductInterface $product, ProductTranslation $translation) { $apiProduct = $this->getProductFactory()->createApiEntity($product, $translation->getLocale()); return $this->render( $this->getProductViewTemplate(), [ 'product' => $ap...
php
public function indexAction(ProductInterface $product, ProductTranslation $translation) { $apiProduct = $this->getProductFactory()->createApiEntity($product, $translation->getLocale()); return $this->render( $this->getProductViewTemplate(), [ 'product' => $ap...
[ "public", "function", "indexAction", "(", "ProductInterface", "$", "product", ",", "ProductTranslation", "$", "translation", ")", "{", "$", "apiProduct", "=", "$", "this", "->", "getProductFactory", "(", ")", "->", "createApiEntity", "(", "$", "product", ",", ...
This action is used for displaying a product via a template. The template that is defined by sulu_product.template parameter is used for displaying the product. @param ProductInterface $product @param ProductTranslation $translation @return Response
[ "This", "action", "is", "used", "for", "displaying", "a", "product", "via", "a", "template", ".", "The", "template", "that", "is", "defined", "by", "sulu_product", ".", "template", "parameter", "is", "used", "for", "displaying", "the", "product", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/WebsiteProductController.php#L35-L46
224,182
sulu/SuluProductBundle
Controller/WebsiteProductController.php
WebsiteProductController.getAllRoutesOfProduct
public function getAllRoutesOfProduct(ProductInterface $product) { $urls = []; /** @var ProductTranslation $productTranslation */ foreach ($product->getTranslations() as $productTranslation) { if ($productTranslation->getRoute()) { $urls[$productTranslation->getLo...
php
public function getAllRoutesOfProduct(ProductInterface $product) { $urls = []; /** @var ProductTranslation $productTranslation */ foreach ($product->getTranslations() as $productTranslation) { if ($productTranslation->getRoute()) { $urls[$productTranslation->getLo...
[ "public", "function", "getAllRoutesOfProduct", "(", "ProductInterface", "$", "product", ")", "{", "$", "urls", "=", "[", "]", ";", "/** @var ProductTranslation $productTranslation */", "foreach", "(", "$", "product", "->", "getTranslations", "(", ")", "as", "$", "...
Returns all routes that are defined for given product. @param ProductInterface $product @return array
[ "Returns", "all", "routes", "that", "are", "defined", "for", "given", "product", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/WebsiteProductController.php#L55-L66
224,183
sulu/SuluProductBundle
Product/ProductPriceManager.php
ProductPriceManager.getBasePriceForCurrency
public function getBasePriceForCurrency(ProductInterface $product, $currency = null) { $currency = $currency ?: $this->defaultCurrency; if ($prices = $product->getPrices()) { foreach ($prices as $price) { if ($price->getCurrency()->getCode() == $currency && $price->getMin...
php
public function getBasePriceForCurrency(ProductInterface $product, $currency = null) { $currency = $currency ?: $this->defaultCurrency; if ($prices = $product->getPrices()) { foreach ($prices as $price) { if ($price->getCurrency()->getCode() == $currency && $price->getMin...
[ "public", "function", "getBasePriceForCurrency", "(", "ProductInterface", "$", "product", ",", "$", "currency", "=", "null", ")", "{", "$", "currency", "=", "$", "currency", "?", ":", "$", "this", "->", "defaultCurrency", ";", "if", "(", "$", "prices", "="...
Returns the base prices for the product by a given currency. @param ProductInterface $product @param null|string $currency @return null|ProductPrice
[ "Returns", "the", "base", "prices", "for", "the", "product", "by", "a", "given", "currency", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductPriceManager.php#L134-L146
224,184
sulu/SuluProductBundle
Product/ProductPriceManager.php
ProductPriceManager.isValidSpecialPrice
private function isValidSpecialPrice(SpecialPrice $specialPrice) { $startDate = $specialPrice->getStartDate(); $endDate = $specialPrice->getEndDate(); $now = new \DateTime(); // Check if special price is stil valid. if (($now >= $startDate && $now <= $endDate) || ...
php
private function isValidSpecialPrice(SpecialPrice $specialPrice) { $startDate = $specialPrice->getStartDate(); $endDate = $specialPrice->getEndDate(); $now = new \DateTime(); // Check if special price is stil valid. if (($now >= $startDate && $now <= $endDate) || ...
[ "private", "function", "isValidSpecialPrice", "(", "SpecialPrice", "$", "specialPrice", ")", "{", "$", "startDate", "=", "$", "specialPrice", "->", "getStartDate", "(", ")", ";", "$", "endDate", "=", "$", "specialPrice", "->", "getEndDate", "(", ")", ";", "$...
Checks if a special price is still valid by today. @param SpecialPrice $specialPrice @return bool
[ "Checks", "if", "a", "special", "price", "is", "still", "valid", "by", "today", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/ProductPriceManager.php#L234-L249
224,185
kesar/PhpOpenSubtitles
src/kesar/PhpOpenSubtitles/HashGenerator.php
HashGenerator.get
public function get() { $handle = fopen($this->filePath, "rb"); $fileSize = filesize($this->filePath); $hash = array( 3 => 0, 2 => 0, 1 => ($fileSize >> 16) & 0xFFFF, 0 => $fileSize & 0xFFFF ); for ($i = 0; $i < 8192; $i++) ...
php
public function get() { $handle = fopen($this->filePath, "rb"); $fileSize = filesize($this->filePath); $hash = array( 3 => 0, 2 => 0, 1 => ($fileSize >> 16) & 0xFFFF, 0 => $fileSize & 0xFFFF ); for ($i = 0; $i < 8192; $i++) ...
[ "public", "function", "get", "(", ")", "{", "$", "handle", "=", "fopen", "(", "$", "this", "->", "filePath", ",", "\"rb\"", ")", ";", "$", "fileSize", "=", "filesize", "(", "$", "this", "->", "filePath", ")", ";", "$", "hash", "=", "array", "(", ...
Hash to send to OpenSubtitles @return string
[ "Hash", "to", "send", "to", "OpenSubtitles" ]
8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3
https://github.com/kesar/PhpOpenSubtitles/blob/8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3/src/kesar/PhpOpenSubtitles/HashGenerator.php#L22-L50
224,186
sulu/SuluProductBundle
Entity/TaxClassTranslation.php
TaxClassTranslation.setTaxClass
public function setTaxClass(\Sulu\Bundle\ProductBundle\Entity\TaxClass $taxClass = null) { $this->taxClass = $taxClass; return $this; }
php
public function setTaxClass(\Sulu\Bundle\ProductBundle\Entity\TaxClass $taxClass = null) { $this->taxClass = $taxClass; return $this; }
[ "public", "function", "setTaxClass", "(", "\\", "Sulu", "\\", "Bundle", "\\", "ProductBundle", "\\", "Entity", "\\", "TaxClass", "$", "taxClass", "=", "null", ")", "{", "$", "this", "->", "taxClass", "=", "$", "taxClass", ";", "return", "$", "this", ";",...
Set taxClass. @param \Sulu\Bundle\ProductBundle\Entity\TaxClass $taxClass @return TaxClassTranslation
[ "Set", "taxClass", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/TaxClassTranslation.php#L104-L109
224,187
unreal4u/mqtt
src/DataTypes/Message.php
Message.getQoSLevel
public function getQoSLevel(): int { if ($this->qosLevel === null) { // QoSLevel defaults at 0 $this->qosLevel = new QoSLevel(0); } return $this->qosLevel->getQoSLevel(); }
php
public function getQoSLevel(): int { if ($this->qosLevel === null) { // QoSLevel defaults at 0 $this->qosLevel = new QoSLevel(0); } return $this->qosLevel->getQoSLevel(); }
[ "public", "function", "getQoSLevel", "(", ")", ":", "int", "{", "if", "(", "$", "this", "->", "qosLevel", "===", "null", ")", "{", "// QoSLevel defaults at 0", "$", "this", "->", "qosLevel", "=", "new", "QoSLevel", "(", "0", ")", ";", "}", "return", "$...
Gets the current QoS level @return int @throws \unreal4u\MQTT\Exceptions\InvalidQoSLevel
[ "Gets", "the", "current", "QoS", "level" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/DataTypes/Message.php#L102-L109
224,188
dave-redfern/laravel-doctrine-behaviours
src/Traits/Blamable.php
Blamable.blameCreator
public function blameCreator($user) { if (is_null($this->createdBy) && is_null($this->updatedBy)) { $this->createdBy = $this->updatedBy = $user; } }
php
public function blameCreator($user) { if (is_null($this->createdBy) && is_null($this->updatedBy)) { $this->createdBy = $this->updatedBy = $user; } }
[ "public", "function", "blameCreator", "(", "$", "user", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "createdBy", ")", "&&", "is_null", "(", "$", "this", "->", "updatedBy", ")", ")", "{", "$", "this", "->", "createdBy", "=", "$", "this", ...
Initialise the blamable fields @param string $user @return void
[ "Initialise", "the", "blamable", "fields" ]
c481eea497a0df6fc46bc2cadb08a0ed0ae819a4
https://github.com/dave-redfern/laravel-doctrine-behaviours/blob/c481eea497a0df6fc46bc2cadb08a0ed0ae819a4/src/Traits/Blamable.php#L64-L69
224,189
sulu/SuluProductBundle
EventListener/ProductTranslationEventListener.php
ProductTranslationEventListener.postPersist
public function postPersist(ProductTranslationEvent $productTranslationEvent) { $this->productRouteManager->saveRoute($productTranslationEvent->getProductTranslation()); $this->entityManager->flush(); }
php
public function postPersist(ProductTranslationEvent $productTranslationEvent) { $this->productRouteManager->saveRoute($productTranslationEvent->getProductTranslation()); $this->entityManager->flush(); }
[ "public", "function", "postPersist", "(", "ProductTranslationEvent", "$", "productTranslationEvent", ")", "{", "$", "this", "->", "productRouteManager", "->", "saveRoute", "(", "$", "productTranslationEvent", "->", "getProductTranslation", "(", ")", ")", ";", "$", "...
Called when product translation has been created and stored to database. Will save a new product route. @param ProductTranslationEvent $productTranslationEvent
[ "Called", "when", "product", "translation", "has", "been", "created", "and", "stored", "to", "database", ".", "Will", "save", "a", "new", "product", "route", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/EventListener/ProductTranslationEventListener.php#L51-L55
224,190
unreal4u/mqtt
src/Protocol/PubRec.php
PubRec.performSpecialActions
public function performSpecialActions(ClientInterface $client, WritableContentInterface $originalRequest): bool { $this->controlPacketIdentifiers($originalRequest); $pubRel = new PubRel($this->logger); $pubRel->setPacketIdentifier($this->packetIdentifier); $pubComp = $client->process...
php
public function performSpecialActions(ClientInterface $client, WritableContentInterface $originalRequest): bool { $this->controlPacketIdentifiers($originalRequest); $pubRel = new PubRel($this->logger); $pubRel->setPacketIdentifier($this->packetIdentifier); $pubComp = $client->process...
[ "public", "function", "performSpecialActions", "(", "ClientInterface", "$", "client", ",", "WritableContentInterface", "$", "originalRequest", ")", ":", "bool", "{", "$", "this", "->", "controlPacketIdentifiers", "(", "$", "originalRequest", ")", ";", "$", "pubRel",...
Any class can overwrite the default behaviour @param ClientInterface $client @param WritableContentInterface $originalRequest @return bool @throws LogicException
[ "Any", "class", "can", "overwrite", "the", "default", "behaviour" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Protocol/PubRec.php#L84-L92
224,191
sulu/SuluProductBundle
Api/Unit.php
Unit.getName
public function getName() { if (!$this->entity->getTranslation($this->locale)) { return null; } return $this->entity->getTranslation($this->locale)->getName(); }
php
public function getName() { if (!$this->entity->getTranslation($this->locale)) { return null; } return $this->entity->getTranslation($this->locale)->getName(); }
[ "public", "function", "getName", "(", ")", "{", "if", "(", "!", "$", "this", "->", "entity", "->", "getTranslation", "(", "$", "this", "->", "locale", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "entity", "->", "getTransla...
The name of the type. @VirtualProperty @SerializedName("name") @Groups({"cart"}) @return int The name of the type
[ "The", "name", "of", "the", "type", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Unit.php#L60-L67
224,192
dave-redfern/laravel-doctrine-behaviours
src/Traits/Timestampable.php
Timestampable.initializeTimestamps
public function initializeTimestamps() { if (is_null($this->createdAt) && is_null($this->updatedAt)) { $this->createdAt = Carbon::now(); $this->updatedAt = Carbon::now(); } }
php
public function initializeTimestamps() { if (is_null($this->createdAt) && is_null($this->updatedAt)) { $this->createdAt = Carbon::now(); $this->updatedAt = Carbon::now(); } }
[ "public", "function", "initializeTimestamps", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "createdAt", ")", "&&", "is_null", "(", "$", "this", "->", "updatedAt", ")", ")", "{", "$", "this", "->", "createdAt", "=", "Carbon", "::", "now"...
Initialises the timestamp properties
[ "Initialises", "the", "timestamp", "properties" ]
c481eea497a0df6fc46bc2cadb08a0ed0ae819a4
https://github.com/dave-redfern/laravel-doctrine-behaviours/blob/c481eea497a0df6fc46bc2cadb08a0ed0ae819a4/src/Traits/Timestampable.php#L62-L68
224,193
sulu/SuluProductBundle
DependencyInjection/SuluProductExtension.php
SuluProductExtension.retrieveProductTypesMap
private function retrieveProductTypesMap() { $productTypeMap = []; LoadProductTypes::processProductTypesFixtures( function (\DOMElement $element) use (&$productTypeMap) { $productTypeMap[$element->getAttribute('key')] = $element->getAttribute('id'); } ...
php
private function retrieveProductTypesMap() { $productTypeMap = []; LoadProductTypes::processProductTypesFixtures( function (\DOMElement $element) use (&$productTypeMap) { $productTypeMap[$element->getAttribute('key')] = $element->getAttribute('id'); } ...
[ "private", "function", "retrieveProductTypesMap", "(", ")", "{", "$", "productTypeMap", "=", "[", "]", ";", "LoadProductTypes", "::", "processProductTypesFixtures", "(", "function", "(", "\\", "DOMElement", "$", "element", ")", "use", "(", "&", "$", "productType...
Returns key to id mapping for product-types. Processes product-types fixtures xml. @return array
[ "Returns", "key", "to", "id", "mapping", "for", "product", "-", "types", ".", "Processes", "product", "-", "types", "fixtures", "xml", "." ]
9f22c2dab940a04463c98e415b15ea1d62828316
https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/DependencyInjection/SuluProductExtension.php#L104-L114
224,194
robwittman/leaky-bucket-rate-limiter
src/RateLimiter.php
RateLimiter.fetchBucket
protected function fetchBucket($key) { $data = $this->storage->get($key); return json_decode($data, TRUE); }
php
protected function fetchBucket($key) { $data = $this->storage->get($key); return json_decode($data, TRUE); }
[ "protected", "function", "fetchBucket", "(", "$", "key", ")", "{", "$", "data", "=", "$", "this", "->", "storage", "->", "get", "(", "$", "key", ")", ";", "return", "json_decode", "(", "$", "data", ",", "TRUE", ")", ";", "}" ]
Fetch our bucket data from storage @param string $key @return void
[ "Fetch", "our", "bucket", "data", "from", "storage" ]
c74720acfd80f3a6a258b591faae6f27b786cde4
https://github.com/robwittman/leaky-bucket-rate-limiter/blob/c74720acfd80f3a6a258b591faae6f27b786cde4/src/RateLimiter.php#L132-L135
224,195
robwittman/leaky-bucket-rate-limiter
src/RateLimiter.php
RateLimiter.save
protected function save($bucket) { return $this->storage->set($this->key, json_encode($bucket->getData())); }
php
protected function save($bucket) { return $this->storage->set($this->key, json_encode($bucket->getData())); }
[ "protected", "function", "save", "(", "$", "bucket", ")", "{", "return", "$", "this", "->", "storage", "->", "set", "(", "$", "this", "->", "key", ",", "json_encode", "(", "$", "bucket", "->", "getData", "(", ")", ")", ")", ";", "}" ]
Save our bucket to storage @param object $bucket @return boolean
[ "Save", "our", "bucket", "to", "storage" ]
c74720acfd80f3a6a258b591faae6f27b786cde4
https://github.com/robwittman/leaky-bucket-rate-limiter/blob/c74720acfd80f3a6a258b591faae6f27b786cde4/src/RateLimiter.php#L142-L144
224,196
unreal4u/mqtt
src/Client.php
Client.checkAndReturnAnswer
private function checkAndReturnAnswer(WritableContentInterface $object): string { $returnValue = ''; if ($object->shouldExpectAnswer() === true) { $this->enableSynchronousTransfer(true); $returnValue = $this->readBrokerHeader(); $this->enableSynchronousTransfer(fa...
php
private function checkAndReturnAnswer(WritableContentInterface $object): string { $returnValue = ''; if ($object->shouldExpectAnswer() === true) { $this->enableSynchronousTransfer(true); $returnValue = $this->readBrokerHeader(); $this->enableSynchronousTransfer(fa...
[ "private", "function", "checkAndReturnAnswer", "(", "WritableContentInterface", "$", "object", ")", ":", "string", "{", "$", "returnValue", "=", "''", ";", "if", "(", "$", "object", "->", "shouldExpectAnswer", "(", ")", "===", "true", ")", "{", "$", "this", ...
Checks on the writable object whether we should wait for an answer and either wait or return an empty string @param WritableContentInterface $object @return string
[ "Checks", "on", "the", "writable", "object", "whether", "we", "should", "wait", "for", "an", "answer", "and", "either", "wait", "or", "return", "an", "empty", "string" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Client.php#L140-L150
224,197
unreal4u/mqtt
src/Client.php
Client.checkForConnectionErrors
private function checkForConnectionErrors(int $errorCode, string $errorDescription): self { if ($errorCode !== 0 || $this->socket === null) { $this->logger->critical('Could not connect to broker', [ 'errorCode' => $errorCode, 'errorDescription' => $errorDescriptio...
php
private function checkForConnectionErrors(int $errorCode, string $errorDescription): self { if ($errorCode !== 0 || $this->socket === null) { $this->logger->critical('Could not connect to broker', [ 'errorCode' => $errorCode, 'errorDescription' => $errorDescriptio...
[ "private", "function", "checkForConnectionErrors", "(", "int", "$", "errorCode", ",", "string", "$", "errorDescription", ")", ":", "self", "{", "if", "(", "$", "errorCode", "!==", "0", "||", "$", "this", "->", "socket", "===", "null", ")", "{", "$", "thi...
Checks for socket error connections, will throw an exception if any is found @param int $errorCode @param string $errorDescription @return Client @throws \unreal4u\MQTT\Exceptions\NotConnected
[ "Checks", "for", "socket", "error", "connections", "will", "throw", "an", "exception", "if", "any", "is", "found" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Client.php#L160-L172
224,198
unreal4u/mqtt
src/Client.php
Client.setSocketTimeout
private function setSocketTimeout(): self { $timeCalculation = $this->connectionParameters->getKeepAlivePeriod() * 1.5; $seconds = (int)floor($timeCalculation); stream_set_timeout($this->socket, $seconds, (int)($timeCalculation - $seconds) * 1000); return $this; }
php
private function setSocketTimeout(): self { $timeCalculation = $this->connectionParameters->getKeepAlivePeriod() * 1.5; $seconds = (int)floor($timeCalculation); stream_set_timeout($this->socket, $seconds, (int)($timeCalculation - $seconds) * 1000); return $this; }
[ "private", "function", "setSocketTimeout", "(", ")", ":", "self", "{", "$", "timeCalculation", "=", "$", "this", "->", "connectionParameters", "->", "getKeepAlivePeriod", "(", ")", "*", "1.5", ";", "$", "seconds", "=", "(", "int", ")", "floor", "(", "$", ...
Calculates and sets the timeout on the socket connection according to the MQTT standard 1.5 times the keep alive period is the maximum amount of time the connection may remain idle before the broker decides to close it. Odd numbers will also produce a 0.5 second extra time, take this into account as well @return Clie...
[ "Calculates", "and", "sets", "the", "timeout", "on", "the", "socket", "connection", "according", "to", "the", "MQTT", "standard" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Client.php#L211-L218
224,199
unreal4u/mqtt
src/Client.php
Client.preSocketCommunication
private function preSocketCommunication(WritableContentInterface $object): self { $this->objectStack[$object::getControlPacketValue()] = $object; if ($object instanceof Connect) { $this->generateSocketConnection($object); } return $this; }
php
private function preSocketCommunication(WritableContentInterface $object): self { $this->objectStack[$object::getControlPacketValue()] = $object; if ($object instanceof Connect) { $this->generateSocketConnection($object); } return $this; }
[ "private", "function", "preSocketCommunication", "(", "WritableContentInterface", "$", "object", ")", ":", "self", "{", "$", "this", "->", "objectStack", "[", "$", "object", "::", "getControlPacketValue", "(", ")", "]", "=", "$", "object", ";", "if", "(", "$...
Stuff that has to happen before we actually begin sending data through our socket @param WritableContentInterface $object @return Client @throws \unreal4u\MQTT\Exceptions\NotConnected @throws \unreal4u\MQTT\Exceptions\Connect\NoConnectionParametersDefined
[ "Stuff", "that", "has", "to", "happen", "before", "we", "actually", "begin", "sending", "data", "through", "our", "socket" ]
84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4
https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Client.php#L239-L248