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


PHP StringUtils::upperCaseWords方法代码示例

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


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

示例1: getType

 /**
  * Get attribute type based on its backend model.
  * 
  * @param \Magento\Eav\Api\Data\AttributeInterface $attribute
  * @param string $serviceClass
  * @param $serviceBackendModelDataInterfaceMap array
  * @return string|null
  */
 public function getType($attribute, $serviceClass, $serviceBackendModelDataInterfaceMap)
 {
     $backendModel = $attribute->getBackendModel();
     //If empty backend model, check if it can be derived
     if (empty($backendModel)) {
         $backendModelClass = sprintf('Magento\\Eav\\Model\\Attribute\\Data\\%s', $this->stringUtility->upperCaseWords($attribute->getFrontendInput()));
         $backendModel = class_exists($backendModelClass) ? $backendModelClass : null;
     }
     $dataInterface = isset($serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel]) ? $serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel] : null;
     return $dataInterface;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:19,代码来源:ComplexType.php

示例2: getVariable

 /**
  * Return variable value for var construction
  *
  * @param string $value raw parameters
  * @param string $default default value
  * @return string
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function getVariable($value, $default = '{no_value_defined}')
 {
     \Magento\Framework\Profiler::start('email_template_processing_variables');
     $tokenizer = new Template\Tokenizer\Variable();
     $tokenizer->setString($value);
     $stackVars = $tokenizer->tokenize();
     $result = $default;
     $last = 0;
     for ($i = 0; $i < count($stackVars); $i++) {
         if ($i == 0 && isset($this->templateVars[$stackVars[$i]['name']])) {
             // Getting of template value
             $stackVars[$i]['variable'] =& $this->templateVars[$stackVars[$i]['name']];
         } elseif (isset($stackVars[$i - 1]['variable']) && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\DataObject) {
             // If object calling methods or getting properties
             if ($stackVars[$i]['type'] == 'property') {
                 $caller = 'get' . $this->string->upperCaseWords($stackVars[$i]['name'], '_', '');
                 $stackVars[$i]['variable'] = method_exists($stackVars[$i - 1]['variable'], $caller) ? $stackVars[$i - 1]['variable']->{$caller}() : $stackVars[$i - 1]['variable']->getData($stackVars[$i]['name']);
             } elseif ($stackVars[$i]['type'] == 'method') {
                 // Calling of object method
                 if (method_exists($stackVars[$i - 1]['variable'], $stackVars[$i]['name']) || substr($stackVars[$i]['name'], 0, 3) == 'get') {
                     $stackVars[$i]['args'] = $this->getStackArgs($stackVars[$i]['args']);
                     $stackVars[$i]['variable'] = call_user_func_array([$stackVars[$i - 1]['variable'], $stackVars[$i]['name']], $stackVars[$i]['args']);
                 }
             }
             $last = $i;
         }
     }
     if (isset($stackVars[$last]['variable'])) {
         // If value for construction exists set it
         $result = $stackVars[$last]['variable'];
     }
     \Magento\Framework\Profiler::stop('email_template_processing_variables');
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:42,代码来源:Template.php

示例3: _saveSection

 /**
  * Custom save logic for section
  *
  * @return void
  */
 protected function _saveSection()
 {
     $method = '_save' . $this->string->upperCaseWords($this->getRequest()->getParam('section'), '_', '');
     if (method_exists($this, $method)) {
         $this->{$method}();
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Save.php

示例4: create

 /**
  * Create Form Element
  *
  * @param \Magento\Customer\Api\Data\AttributeMetadataInterface $attribute
  * @param string|int|bool $value
  * @param string $entityTypeCode
  * @param bool $isAjax
  * @return \Magento\Customer\Model\Metadata\Form\AbstractData
  */
 public function create(\Magento\Customer\Api\Data\AttributeMetadataInterface $attribute, $value, $entityTypeCode, $isAjax = false)
 {
     $dataModelClass = $attribute->getDataModel();
     $params = ['entityTypeCode' => $entityTypeCode, 'value' => is_null($value) ? false : $value, 'isAjax' => $isAjax, 'attribute' => $attribute];
     /** TODO fix when Validation is implemented MAGETWO-17341 */
     if ($dataModelClass == 'Magento\\Customer\\Model\\Attribute\\Data\\Postcode') {
         $dataModelClass = 'Magento\\Customer\\Model\\Metadata\\Form\\Postcode';
     }
     if (!empty($dataModelClass)) {
         $dataModel = $this->_objectManager->create($dataModelClass, $params);
     } else {
         $dataModelClass = sprintf('Magento\\Customer\\Model\\Metadata\\Form\\%s', $this->_string->upperCaseWords($attribute->getFrontendInput()));
         $dataModel = $this->_objectManager->create($dataModelClass, $params);
     }
     return $dataModel;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:25,代码来源:ElementFactory.php

示例5: processMetadataContent

 /**
  * @param string $name
  * @param string $content
  * @return mixed
  */
 protected function processMetadataContent($name, $content)
 {
     $method = 'get' . $this->string->upperCaseWords($name, '_', '');
     if (method_exists($this->pageConfig, $method)) {
         $content = $this->pageConfig->{$method}();
     }
     return $content;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Renderer.php

示例6: groupFactory

 /**
  * Group model factory
  *
  * @param string $type Option type
  * @return \Magento\Catalog\Model\Product\Option\Type\DefaultType
  * @throws LocalizedException
  */
 public function groupFactory($type)
 {
     $group = $this->getGroupByType($type);
     if (!empty($group)) {
         return $this->_optionFactory->create('Magento\\Catalog\\Model\\Product\\Option\\Type\\' . $this->string->upperCaseWords($group));
     }
     throw new LocalizedException(__('The option type to get group instance is incorrect.'));
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:15,代码来源:Option.php

示例7: getType

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function getType($attributeCode, $serviceClass)
 {
     if (!$serviceClass || !$attributeCode || !isset($this->serviceEntityTypeMap[$serviceClass]) || !isset($this->serviceBackendModelDataInterfaceMap[$serviceClass])) {
         return null;
     }
     try {
         $attribute = $this->attributeRepository->get($this->serviceEntityTypeMap[$serviceClass], $attributeCode);
         $backendModel = $attribute->getBackendModel();
     } catch (NoSuchEntityException $e) {
         return null;
     }
     //If empty backend model, check if it can be derived
     if (empty($backendModel)) {
         $backendModelClass = sprintf('Magento\\Eav\\Model\\Attribute\\Data\\%s', $this->stringUtility->upperCaseWords($attribute->getFrontendInput()));
         $backendModel = class_exists($backendModelClass) ? $backendModelClass : null;
     }
     $dataInterface = isset($this->serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel]) ? $this->serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel] : null;
     return $dataInterface;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:EavCustomAttributeTypeLocator.php

示例8: setOptions

 /**
  * Set many options at once
  *
  * @param array $options
  * @param array $default
  * @return $this
  */
 public function setOptions($options, $default = [])
 {
     $options = !is_array($options) && !$options instanceof \Traversable ? $default : $options;
     if (is_array($options) || $options instanceof \Traversable) {
         foreach ($options as $option => $value) {
             $setter = 'set' . $this->_stringHelper->upperCaseWords($option, '_', '');
             if (method_exists($this, $setter)) {
                 $this->{$setter}($value);
             } else {
                 $this->setOption($option, $value);
             }
         }
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:22,代码来源:Config.php

示例9: create

 /**
  * Return attribute data model by attribute
  * Set entity to data model (need for work)
  *
  * @param \Magento\Eav\Model\Attribute $attribute
  * @param \Magento\Framework\Model\AbstractModel $entity
  * @return \Magento\Eav\Model\Attribute\Data\AbstractData
  */
 public function create(\Magento\Eav\Model\Attribute $attribute, \Magento\Framework\Model\AbstractModel $entity)
 {
     /* @var $dataModel \Magento\Eav\Model\Attribute\Data\AbstractData */
     $dataModelClass = $attribute->getDataModel();
     if (!empty($dataModelClass)) {
         if (empty($this->_dataModels[$dataModelClass])) {
             $dataModel = $this->_objectManager->create($dataModelClass);
             $this->_dataModels[$dataModelClass] = $dataModel;
         } else {
             $dataModel = $this->_dataModels[$dataModelClass];
         }
     } else {
         if (empty($this->_dataModels[$attribute->getFrontendInput()])) {
             $dataModelClass = sprintf('Magento\\Eav\\Model\\Attribute\\Data\\%s', $this->string->upperCaseWords($attribute->getFrontendInput()));
             $dataModel = $this->_objectManager->create($dataModelClass);
             $this->_dataModels[$attribute->getFrontendInput()] = $dataModel;
         } else {
             $dataModel = $this->_dataModels[$attribute->getFrontendInput()];
         }
     }
     $dataModel->setAttribute($attribute);
     $dataModel->setEntity($entity);
     return $dataModel;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:AttributeDataFactory.php

示例10: testUpperCaseWordsWithSeparators

 /**
  * @param string $testString
  * @param string $sourceSeparator
  * @param string $destinationSeparator
  * @param string $expected
  *
  * @dataProvider upperCaseWordsWithSeparatorsDataProvider
  */
 public function testUpperCaseWordsWithSeparators($testString, $sourceSeparator, $destinationSeparator, $expected)
 {
     $actual = $this->_string->upperCaseWords($testString, $sourceSeparator, $destinationSeparator);
     $this->assertEquals($expected, $actual);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:StringUtilsTest.php


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