ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class AsyncTestData
|
||||
{
|
||||
/**
|
||||
* @var $msgValue
|
||||
*/
|
||||
protected $msgValue;
|
||||
|
||||
/**
|
||||
* @var $path
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* set path to tmp directory.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
public function setTextFilePath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTextFilePath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $strValue
|
||||
* @return void
|
||||
*/
|
||||
public function setValue($strValue)
|
||||
{
|
||||
$this->msgValue = $strValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->msgValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class CustomHandler
|
||||
{
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function process($simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'custom-string-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData[] $simpleDataItems
|
||||
*/
|
||||
public function processArray($simpleDataItems)
|
||||
{
|
||||
foreach ($simpleDataItems as $objItem) {
|
||||
file_put_contents(
|
||||
$objItem->getTextFilePath(),
|
||||
'custom-array-' . $objItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $simpleDataItems
|
||||
*/
|
||||
public function processMixed($simpleDataItems)
|
||||
{
|
||||
/** @var AsyncTestData[] $simpleDataItems */
|
||||
$simpleDataItems = is_array($simpleDataItems) ? $simpleDataItems : [$simpleDataItems];
|
||||
foreach ($simpleDataItems as $simpleDataItem) {
|
||||
if (!($simpleDataItem instanceof AsyncTestData)) {
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'Invalid data item given. Was expected instance of ' . AsyncTestData::class . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
continue;
|
||||
}
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'custom-mixed-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class RequestHandler
|
||||
{
|
||||
/**
|
||||
* @param \Magento\TestModuleAsyncAmqp\Model\AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function process($simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'InvokedFromRequestHandler-' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleAsyncAmqp\Model;
|
||||
|
||||
class WildCardHandler
|
||||
{
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodOne(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodOne - wildcard.queue.one - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodTwo(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodTwo - wildcard.queue.two - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodThree(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodThree - wildcard.queue.three - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AsyncTestData $simpleDataItem
|
||||
*/
|
||||
public function methodFour(AsyncTestData $simpleDataItem)
|
||||
{
|
||||
file_put_contents(
|
||||
$simpleDataItem->getTextFilePath(),
|
||||
'WildCardHandler::methodFour - wildcard.queue.four - ' . $simpleDataItem->getValue() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user