当前位置: 首页>>代码示例>>PHP>>正文


PHP InputException::addError方法代码示例

本文整理汇总了PHP中Magento\Framework\Exception\InputException::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP InputException::addError方法的具体用法?PHP InputException::addError怎么用?PHP InputException::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Exception\InputException的用法示例。


在下文中一共展示了InputException::addError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAddErrorWithSameMessage

 /**
  * Verify the message and params are not used to determine the call count
  *
  * @return void
  */
 public function testAddErrorWithSameMessage()
 {
     $rawMessage = 'Foo "%var"';
     $params = ['var' => 'Bar'];
     $expectedProcessedMessage = 'Foo "Bar"';
     $inputException = new InputException(new Phrase($rawMessage, $params));
     $this->assertEquals($rawMessage, $inputException->getRawMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertFalse($inputException->wasErrorAdded());
     $this->assertCount(0, $inputException->getErrors());
     $inputException->addError(new Phrase($rawMessage, $params));
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertTrue($inputException->wasErrorAdded());
     $this->assertCount(0, $inputException->getErrors());
     $inputException->addError(new Phrase($rawMessage, $params));
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertTrue($inputException->wasErrorAdded());
     $errors = $inputException->getErrors();
     $this->assertCount(2, $errors);
     $this->assertEquals($expectedProcessedMessage, $errors[0]->getMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[0]->getLogMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[1]->getMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[1]->getLogMessage());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:InputExceptionTest.php

示例2: validate

 /**
  * Validate user credentials
  *
  * @param string $username
  * @param string $password
  * @throws InputException
  * @return void
  */
 public function validate($username, $password)
 {
     $exception = new InputException();
     if (!is_string($username) || strlen($username) == 0) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'username']));
     }
     if (!is_string($password) || strlen($password) == 0) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'password']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:21,代码来源:CredentialsValidator.php

示例3: processInputError

 /**
  * Process an input error
  *
  * @param array $inputError
  * @return void
  * @throws InputException
  */
 protected function processInputError($inputError)
 {
     if (!empty($inputError)) {
         $exception = new InputException();
         foreach ($inputError as $errorParamField) {
             $exception->addError(new Phrase(InputException::REQUIRED_FIELD, ['fieldName' => $errorParamField]));
         }
         if ($exception->wasErrorAdded()) {
             throw $exception;
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:ServiceInputProcessor.php

示例4: validateNewOptionData

 /**
  * Ensure that all necessary data is available for a new option creation.
  *
  * @param OptionInterface $option
  * @return void
  * @throws InputException
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function validateNewOptionData(OptionInterface $option)
 {
     $inputException = new InputException();
     if (!$option->getAttributeId()) {
         $inputException->addError(__('Option attribute ID is not specified.'));
     }
     if (!$option->getLabel()) {
         $inputException->addError(__('Option label is not specified.'));
     }
     if (!$option->getValues()) {
         $inputException->addError(__('Option values are not specified.'));
     } else {
         foreach ($option->getValues() as $optionValue) {
             if (!$optionValue->getValueIndex()) {
                 $inputException->addError(__('Value index is not specified for an option.'));
             }
             if (null === $optionValue->getPricingValue()) {
                 $inputException->addError(__('Price is not specified for an option.'));
             }
             if (null === $optionValue->getIsPercent()) {
                 $inputException->addError(__('Percent/absolute is not specified for an option.'));
             }
         }
     }
     if ($inputException->wasErrorAdded()) {
         throw $inputException;
     }
 }
开发者ID:kid17,项目名称:magento2,代码行数:36,代码来源:OptionRepository.php

示例5: testCreateCustomerWithErrors

 public function testCreateCustomerWithErrors()
 {
     $serviceInfo = ['rest' => ['resourcePath' => self::RESOURCE_PATH, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST], 'soap' => ['service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'CreateAccount']];
     $customerDataArray = $this->dataObjectProcessor->buildOutputDataArray($this->customerHelper->createSampleCustomerDataObject(), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $invalidEmail = 'invalid';
     $customerDataArray['email'] = $invalidEmail;
     $requestData = ['customer' => $customerDataArray, 'password' => CustomerHelper::PASSWORD];
     try {
         $this->_webApiCall($serviceInfo, $requestData);
         $this->fail('Expected exception did not occur.');
     } catch (\Exception $e) {
         if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
             $expectedException = new InputException();
             $expectedException->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'email', 'value' => $invalidEmail]));
             $this->assertInstanceOf('SoapFault', $e);
             $this->checkSoapFault($e, $expectedException->getRawMessage(), 'env:Sender', $expectedException->getParameters());
         } else {
             $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode());
             $exceptionData = $this->processRestExceptionResult($e);
             $expectedExceptionData = ['message' => InputException::INVALID_FIELD_VALUE, 'parameters' => ['fieldName' => 'email', 'value' => $invalidEmail]];
             $this->assertEquals($expectedExceptionData, $exceptionData);
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:24,代码来源:AccountManagementTest.php

示例6: testCreateCustomerWithoutAddressRequiresException

 /**
  * Test creating a customer with absent required address fields
  */
 public function testCreateCustomerWithoutAddressRequiresException()
 {
     $customerDataArray = $this->dataObjectProcessor->buildOutputDataArray($this->customerHelper->createSampleCustomerDataObject(), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     foreach ($customerDataArray[Customer::KEY_ADDRESSES] as &$address) {
         $address[Address::FIRSTNAME] = null;
     }
     $serviceInfo = ['rest' => ['resourcePath' => self::RESOURCE_PATH, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST], 'soap' => ['service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save']];
     $requestData = ['customer' => $customerDataArray];
     try {
         $this->_webApiCall($serviceInfo, $requestData);
         $this->fail('Expected exception did not occur.');
     } catch (\Exception $e) {
         if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
             $expectedException = new InputException();
             $expectedException->addError(__('%fieldName is a required field.', ['fieldName' => Address::FIRSTNAME]));
             $this->assertInstanceOf('SoapFault', $e);
             $this->checkSoapFault($e, $expectedException->getRawMessage(), 'env:Sender', $expectedException->getParameters());
         } else {
             $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode());
             $exceptionData = $this->processRestExceptionResult($e);
             $expectedExceptionData = ['message' => '%fieldName is a required field.', 'parameters' => ['fieldName' => Address::FIRSTNAME]];
             $this->assertEquals($expectedExceptionData, $exceptionData);
         }
     }
     try {
         $this->customerRegistry->retrieveByEmail($customerDataArray[Customer::EMAIL], $customerDataArray[Customer::WEBSITE_ID]);
         $this->fail('An expected NoSuchEntityException was not thrown.');
     } catch (NoSuchEntityException $e) {
         $exception = NoSuchEntityException::doubleField('email', $customerDataArray[Customer::EMAIL], 'websiteId', $customerDataArray[Customer::WEBSITE_ID]);
         $this->assertEquals($exception->getMessage(), $e->getMessage(), 'Exception message does not match expected message.');
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:35,代码来源:CustomerRepositoryTest.php

示例7: validate

 /**
  * Validate tax rate
  *
  * @param \Magento\Tax\Api\Data\TaxRateInterface $taxRate
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
 {
     $exception = new InputException();
     $countryCode = $taxRate->getTaxCountryId();
     if (!\Zend_Validate::is($countryCode, 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'country_id']));
     } elseif (!\Zend_Validate::is($this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty')) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'country_id', 'value' => $countryCode]));
     }
     $regionCode = $taxRate->getTaxRegionId();
     // if regionCode eq 0 (all regions *), do not validate with existing region list
     if (\Zend_Validate::is($regionCode, 'NotEmpty') && $regionCode != "0" && !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(), 'NotEmpty')) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'region_id', 'value' => $regionCode]));
     }
     if (!\Zend_Validate::is($taxRate->getRate(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'percentage_rate']));
     }
     if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code']));
     }
     if ($taxRate->getZipIsRange()) {
         $zipRangeFromTo = ['zip_from' => $taxRate->getZipFrom(), 'zip_to' => $taxRate->getZipTo()];
         foreach ($zipRangeFromTo as $key => $value) {
             if (!is_numeric($value) || $value < 0) {
                 $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => $key, 'value' => $value]));
             }
         }
         if ($zipRangeFromTo['zip_from'] > $zipRangeFromTo['zip_to']) {
             $exception->addError(__('Range To should be equal or greater than Range From.'));
         }
     } else {
         if (!\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')) {
             $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode']));
         }
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:49,代码来源:RateRepository.php

示例8: _validate

 /**
  * Validate Slider Item values.
  *
  * @param \Stepzerosolutions\Tbslider\Api\Data\SlideritemsInterface $slider
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($slider)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($slider->getSlideritemTitle(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'slideritem_title']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:stepzerosolutions,项目名称:tbslider,代码行数:20,代码来源:ItemsRepository.php

示例9: validateTaxClassData

 /**
  * Validate TaxClass Data
  *
  * @param \Magento\Tax\Api\Data\TaxClassInterface $taxClass
  * @return void
  * @throws InputException
  */
 protected function validateTaxClassData(\Magento\Tax\Api\Data\TaxClassInterface $taxClass)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is(trim($taxClass->getClassName()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => TaxClassInterface::KEY_NAME]));
     }
     $classType = $taxClass->getClassType();
     if (!\Zend_Validate::is(trim($classType), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => TaxClassInterface::KEY_TYPE]));
     } elseif ($classType !== TaxClassManagementInterface::TYPE_CUSTOMER && $classType !== TaxClassManagementInterface::TYPE_PRODUCT) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => TaxClassInterface::KEY_TYPE, 'value' => $classType]));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:Repository.php

示例10: validate

 /**
  * Validate thesaurus values
  *
  * @param \Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface $thesaurus the thesaurus to validate
  *
  * @return void
  * @throws \Magento\Framework\Exception\InputException
  */
 protected function validate(\Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface $thesaurus)
 {
     $exception = new \Magento\Framework\Exception\InputException();
     $validator = new \Zend_Validate();
     if (!$validator->is(trim($thesaurus->getName()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'name']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:19,代码来源:ThesaurusRepository.php

示例11: inputException

 /**
  * {@inheritdoc}
  */
 public function inputException($wrappedErrorParameters)
 {
     $exception = new InputException();
     if ($wrappedErrorParameters) {
         foreach ($wrappedErrorParameters as $error) {
             $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => $error->getFieldName(), 'value' => $error->getValue()]));
         }
     }
     throw $exception;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:Error.php

示例12: _validate

 /**
  * Validate group values.
  *
  * @param \Magento\Customer\Api\Data\GroupInterface $group
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($group)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:20,代码来源:GroupRepository.php

示例13: validate

 /**
  * Validate tax rate
  *
  * @param TaxRateDataObject $taxRate
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(TaxRateDataObject $taxRate)
 {
     $exception = new InputException();
     $countryCode = $taxRate->getCountryId();
     if (!\Zend_Validate::is($countryCode, 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'country_id']);
     } else {
         if (!\Zend_Validate::is($this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty')) {
             $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'country_id', 'value' => $countryCode]);
         }
     }
     $regionCode = $taxRate->getRegionId();
     if (\Zend_Validate::is($regionCode, 'NotEmpty') && !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(), 'NotEmpty')) {
         $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'region_id', 'value' => $regionCode]);
     }
     if (!\Zend_Validate::is($taxRate->getPercentageRate(), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'percentage_rate']);
     }
     if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'code']);
     }
     if ($taxRate->getZipRange()) {
         $zipRangeFromTo = ['zip_from' => $taxRate->getZipRange()->getFrom(), 'zip_to' => $taxRate->getZipRange()->getTo()];
         foreach ($zipRangeFromTo as $key => $value) {
             if (!is_numeric($value) || $value < 0) {
                 $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => $key, 'value' => $value]);
             }
         }
         if ($zipRangeFromTo['zip_from'] > $zipRangeFromTo['zip_to']) {
             $exception->addError('Range To should be equal or greater than Range From.');
         }
     } else {
         if (!\Zend_Validate::is(trim($taxRate->getPostcode()), 'NotEmpty')) {
             $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode']);
         }
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:50,代码来源:TaxRateService.php

示例14: validate

 /**
  * Validate tax rule
  *
  * @param TaxRule $rule
  * @return void
  * @throws InputException
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(TaxRule $rule)
 {
     $exception = new InputException();
     // SortOrder is required and must be 0 or greater
     if (!\Zend_Validate::is(trim($rule->getSortOrder()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::SORT_ORDER]);
     }
     if (!\Zend_Validate::is(trim($rule->getSortOrder()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::SORT_ORDER, 'value' => $rule->getSortOrder(), 'minValue' => 0]);
     }
     // Priority is required and must be 0 or greater
     if (!\Zend_Validate::is(trim($rule->getPriority()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::PRIORITY]);
     }
     if (!\Zend_Validate::is(trim($rule->getPriority()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::PRIORITY, 'value' => $rule->getPriority(), 'minValue' => 0]);
     }
     // Code is required
     if (!\Zend_Validate::is(trim($rule->getCode()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CODE]);
     }
     // customer tax class ids is required
     if ($rule->getCustomerTaxClassIds() === null || !$rule->getCustomerTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CUSTOMER_TAX_CLASS_IDS]);
     } else {
         // see if the customer tax class ids exist
         $customerTaxClassIds = $rule->getCustomerTaxClassIds();
         foreach ($customerTaxClassIds as $customerTaxClassId) {
             try {
                 $taxClass = $this->taxClassService->getTaxClass($customerTaxClassId);
                 if (is_null($taxClass) || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_CUSTOMER)) {
                     $exception->addError(NoSuchEntityException::MESSAGE_SINGLE_FIELD, ['fieldName' => TaxRule::CUSTOMER_TAX_CLASS_IDS, 'value' => $customerTaxClassId]);
                 }
             } catch (NoSuchEntityException $e) {
                 $exception->addError($e->getRawMessage(), $e->getParameters());
             }
         }
     }
     // product tax class ids is required
     if ($rule->getProductTaxClassIds() === null || !$rule->getProductTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::PRODUCT_TAX_CLASS_IDS]);
     } else {
         // see if the product tax class ids exist
         $productTaxClassIds = $rule->getProductTaxClassIds();
         foreach ($productTaxClassIds as $productTaxClassId) {
             try {
                 $taxClass = $this->taxClassService->getTaxClass($productTaxClassId);
                 if (is_null($taxClass) || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_PRODUCT)) {
                     $exception->addError(NoSuchEntityException::MESSAGE_SINGLE_FIELD, ['fieldName' => TaxRule::PRODUCT_TAX_CLASS_IDS, 'value' => $productTaxClassId]);
                 }
             } catch (NoSuchEntityException $e) {
                 $exception->addError($e->getRawMessage(), $e->getParameters());
             }
         }
     }
     // tax rate ids is required
     if ($rule->getTaxRateIds() === null || !$rule->getTaxRateIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::TAX_RATE_IDS]);
     }
     // throw exception if errors were found
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:74,代码来源:TaxRuleService.php

示例15: _validate

 /**
  * Validate group values.
  *
  * @param \Magento\Customer\Api\Data\GroupInterface $group
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($group)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:20,代码来源:GroupRepository.php


注:本文中的Magento\Framework\Exception\InputException::addError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。