本文整理汇总了PHP中XLite\Core\Converter::convertToCamelCase方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::convertToCamelCase方法的具体用法?PHP Converter::convertToCamelCase怎么用?PHP Converter::convertToCamelCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\Converter
的用法示例。
在下文中一共展示了Converter::convertToCamelCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
$session = $this->getTestSession();
$this->assertTrue(0 < $session->getId(), 'check session id');
foreach ($this->testSession as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $session->{$m}(), 'Check ' . $k);
}
}
示例2: testCreate
/**
* testCreate
*
* @return void
* @see ____func_see____
* @since 1.0.22
*/
public function testCreate()
{
$method = $this->getTestMethod();
$this->assertTrue(0 < $method->getMethodId(), 'check method id');
foreach ($this->testMethod as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $method->{$m}(), 'Check ' . $k);
}
}
示例3: getEntityValue
/**
* Get entity value
*
* @return mixed
*/
protected function getEntityValue()
{
$result = null;
$entity = $this->getEntity();
$method = 'get' . \XLite\Core\Converter::convertToCamelCase($this->getParam(static::PARAM_FIELD_NAME));
if (method_exists($entity, $method)) {
// $method assembled from 'get' + field short name
$result = $this->getEntity()->{$method}();
}
return $result;
}
示例4: doNoAction
/**
* Preprocessor for no-action run
*
* @return void
*/
protected function doNoAction()
{
$dictionary = \XLite\Core\Request::getInstance()->dictionary;
if ($dictionary) {
$method = 'assembleDictionary' . \XLite\Core\Converter::convertToCamelCase($dictionary);
if (method_exists($this, $method)) {
$this->data = $this->processData($this->{$method}(strval(\XLite\Core\Request::getInstance()->erm)));
}
}
$this->silent = true;
}
示例5: testCreate
public function testCreate()
{
$group = $this->getTestGroup();
$this->assertEquals(3, count($group->getOptions()), 'Check options count');
$options = $group->getOptions();
$option = $options[0];
foreach ($this->testOption as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $option->{$m}(), 'Check ' . $k . ' (option)');
}
$this->assertEquals(10, $options[2]->getSurcharge('price')->getModifier(), 'Check modifier');
$this->assertEquals('$', $options[2]->getSurcharge('price')->getModifierType(), 'Check modifier type');
$this->assertEquals(1, $options[2]->getExceptions()->count(), 'Check exceptions');
}
示例6: addConfigOptions
/**
* Add options to HTML Purifier config
*
* @param \HTMLPurifier_Config $config Config instance
*
* @return \HTMLPurifier_Config
*/
public static function addConfigOptions($config, $options)
{
foreach ($options as $name => $value) {
if ('1' == $value) {
$value = true;
} elseif ('0' == $value) {
$value = false;
}
$method = 'prepareOptionValue' . \XLite\Core\Converter::convertToCamelCase(str_replace('.', '', $name));
if (method_exists(static::getInstance(), $method)) {
$value = static::$method($value);
}
if (!is_null($value)) {
$config->set($name, $value);
}
}
$config = static::postprocessOptions($config, $options);
return $config;
}
示例7: testCreate
/**
* testCreate
*
* @return void
* @see ____func_see____
* @since 1.0.13
*/
public function testCreate()
{
$c = $this->currency;
$this->assertTrue(0 < $c->getCurrencyId(), 'check currency id');
foreach ($this->testData as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $c->{$m}(), 'Check ' . $k);
}
$o = $this->getTestOrder();
$o->setCurrency($c);
$c->addOrders($o);
$this->assertEquals($o, $c->getOrders()->get(0), 'check order');
try {
$this->getTestCurrency(true);
$this->fail('check code unique failed');
} catch (\PDOException $e) {
$this->assertRegExp('/SQLSTATE\\[23000\\]/', $e->getMessage(), 'check code unique');
}
}
示例8: defineColumns
/**
* Define columns
*
* @return array
*/
protected function defineColumns()
{
$columns = array('orderNumber' => array(), static::CUSTOMER_PREFIX . 'Email' => array(), static::CUSTOMER_PREFIX . 'Anonymous' => array(), static::CUSTOMER_PREFIX . 'AddressSame' => array());
foreach (\XLite\Core\Database::getRepo('XLite\\Model\\AddressField')->findAllEnabled() as $field) {
$name = ucfirst(\XLite\Core\Converter::convertToCamelCase($field->getServiceName()));
$columns[static::CUSTOMER_PREFIX . $name . 'Billing' . static::ADDRESS_FIELD_SUFFIX] = array(static::COLUMN_GETTER => 'getBillingAddressFieldValue', static::COLUMN_FORMATTER => 'formatBillingAddressFieldValue', 'service_name' => $field->getServiceName());
}
foreach (\XLite\Core\Database::getRepo('XLite\\Model\\AddressField')->findAllEnabled() as $field) {
$name = ucfirst(\XLite\Core\Converter::convertToCamelCase($field->getServiceName()));
$columns[static::CUSTOMER_PREFIX . $name . 'Shipping' . static::ADDRESS_FIELD_SUFFIX] = array(static::COLUMN_GETTER => 'getShippingAddressFieldValue', static::COLUMN_FORMATTER => 'formatShippingAddressFieldValue', 'service_name' => $field->getServiceName());
}
$columns += array(static::ITEM_PREFIX . 'Name' => array(static::COLUMN_MULTIPLE => true), static::ITEM_PREFIX . 'SKU' => array(static::COLUMN_MULTIPLE => true), static::ITEM_PREFIX . 'Attributes' => array(static::COLUMN_MULTIPLE => true), static::ITEM_PREFIX . 'Price' => array(static::COLUMN_MULTIPLE => true), static::ITEM_PREFIX . 'Quantity' => array(static::COLUMN_MULTIPLE => true), static::ITEM_PREFIX . 'Subtotal' => array(static::COLUMN_MULTIPLE => true));
foreach ($this->getOrderItemSurchargeTypes() as $type) {
$columns[$type['name'] . ' (item surcharge)'] = array('type' => $type, static::COLUMN_GETTER => 'getOrderItemSurchargeColumnValue', static::COLUMN_MULTIPLE => true);
}
$columns += array(static::ITEM_PREFIX . 'Total' => array(static::COLUMN_MULTIPLE => true), 'subtotal' => array());
foreach ($this->getOrderSurchargeTypes() as $type) {
$columns[$type['name'] . ' (surcharge)'] = array('type' => $type, static::COLUMN_GETTER => 'getOrderSurchargeColumnValue');
}
$columns += array('total' => array(), 'currency' => array(), 'shippingMethod' => array(), 'trackingNumber' => array(), static::PAYMENT_TRANSACTION_PREFIX . 'Method' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Status' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Value' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Note' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Type' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Id' => array(static::COLUMN_MULTIPLE => true), static::PAYMENT_TRANSACTION_PREFIX . 'Data' => array(static::COLUMN_MULTIPLE => true), 'date' => array(), 'paymentStatus' => array(), 'shippingStatus' => array(), 'notes' => array(), 'adminNotes' => array(), 'detailCode' => array(static::COLUMN_MULTIPLE => true), 'detailLabel' => array(static::COLUMN_MULTIPLE => true), 'detailValue' => array(static::COLUMN_MULTIPLE => true));
return $columns;
}
示例9: testConstruct
/**
* testConstruct
*
* @return void
* @access public
* @see ____func_see____
* @since 1.0.0
*/
public function testConstruct()
{
$dataToSet = array();
$dataToCheck = array();
foreach ($this->getProductData() as $key => $data) {
list($actual, $expected) = $data;
$dataToSet[$key] = $actual;
$dataToCheck[$key] = isset($expected) ? $expected : $actual;
}
$entity = new \XLite\Model\Product($dataToSet);
foreach ($dataToCheck as $key => $value) {
$this->assertEquals($value, $entity->{'get' . \XLite\Core\Converter::convertToCamelCase($key)}(), 'Field "' . $key . '" does not match');
}
// Order item
$i = new \XLite\Model\OrderItem();
$entity->addOrderItems($i);
$this->assertEquals($i, $entity->getOrderItems()->get(0), 'check order item');
// Image
$i = new \XLite\Model\Image\Product\Image();
$entity->addImages($i);
$this->assertEquals($i, $entity->getImages()->get(0), 'check image');
}
示例10: testCreate
/**
* testCreate
*
* @return void
* @access public
* @see ____func_see____
* @since 1.0.0
*/
public function testCreate()
{
$order = $this->getTestOrder();
$this->assertTrue(0 < $order->getOrderId(), 'check order id');
foreach ($order as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $order->{$m}(), 'Check test order: ' . $k);
}
$this->assertEquals($this->getProduct()->getProductId(), $order->getItems()->get(0)->getObject()->getProductId(), 'check product id');
$this->assertEquals('Purchase Order', $order->getPaymentMethod()->getName(), 'check payment method');
$this->assertFalse(is_null($order->getProfile()), 'check profile');
$this->assertFalse(is_null($order->getProfile()->getOrder()), 'check profile\'s order');
$this->assertEquals($order->getOrderId(), $order->getProfile()->getOrder()->getOrderId(), 'check profile\'s order id');
$this->assertTrue(0 < $order->getDate(), 'check date');
$shippingCost = $order->getSurchargeSumByType('shipping');
$this->assertEquals(1, $order->getItems()->get(0)->getAmount(), 'check quantity');
$this->assertEquals($this->getProduct()->getPrice(), $order->getItems()->get(0)->getPrice(), 'check price');
$this->assertEquals($this->getProduct()->getPrice(), $order->getItems()->get(0)->getSubtotal(), 'check item subtotal');
$this->assertEquals($this->getProduct()->getPrice(), $order->getSubtotal(), 'check order subtotal');
$this->assertEquals(round($shippingCost + $this->getProduct()->getPrice(), 2), $order->getTotal(), 'check total');
// Payment method
$pm = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->findOneBy(array('service_name' => 'PurchaseOrder'));
$order->setPaymentMethod($pm);
$this->assertEquals($pm, $order->getPaymentMethod(), 'check payment method');
// Saved modifiers
$surcharge = new \XLite\Model\Order\Surcharge();
$surcharge->setType('shipping');
$surcharge->setCode('ttt');
$surcharge->setValue(10.0);
$surcharge->setInclude(false);
$surcharge->setAvailable(true);
$surcharge->setClass(get_called_class());
$surcharge->setName('test');
$order->getSurcharges()->add($surcharge);
$surcharge->setOwner($order);
$count = count($order->getSurcharges());
$this->assertEquals($surcharge, $order->getSurcharges()->get($count - 1), 'check surcharge');
}
示例11: getHelp
/**
* Get help
*
* @return string
*/
protected function getHelp()
{
$help = null;
$action = \XLite\Core\Request::getInstance()->action;
if ($action) {
$method = 'getHelp' . \XLite\Core\Converter::convertToCamelCase($action);
$help = method_exists($this, $method) ? $this->{$method}() : 'Action \'' . $action . '\' has not help note';
} else {
$help = $this->getControllerHelp();
}
return $help;
}
示例12: getFieldBySchema
/**
* Create field widget
*
* @param string $name Field name
* @param array $data Field data
*
* @return \XLite\View\FormField\AFormField
*/
protected function getFieldBySchema($name, array $data)
{
$result = null;
$class = $data[\XLite\View\Model\Address\Address::SCHEMA_CLASS];
if (\XLite\Core\Operator::isClassExists($class)) {
$method = 'prepareFieldParams' . \XLite\Core\Converter::convertToCamelCase($name);
if (method_exists($this, $method)) {
$data = $this->{$method}($data);
}
$result = new $class($this->getFieldSchemaArgs($name, $data));
}
return $result;
}
示例13: preprocessOption
/**
* Preprocess option change and return true on success
*
* @param \XLite\Model\Config $option Option entity
*
* @return boolean
*/
protected function preprocessOption($option)
{
$result = true;
$method = 'preprocess' . \XLite\Core\Converter::convertToCamelCase($option->name) . 'Option';
if (method_exists($this, $method)) {
$result = $this->{$method}($option);
}
return $result;
}
示例14: postprocessSurcharge
/**
* Postprocess surcharge
*
* @param float $surcharge Surcharge
*
* @return mixed
*/
protected function postprocessSurcharge($surcharge)
{
static $methodNames = array();
$type = $this->getType();
if (!isset($methodNames[$type])) {
$name = 'postprocessSurcharge' . \XLite\Core\Converter::convertToCamelCase($this->getType());
$methodNames[$type] = method_exists($this, $name) ? $name : false;
}
return $methodNames[$type] ? $this->{$methodNames[$type]}($surcharge) : $surcharge;
}
示例15: createCapostParcels
/**
* Calculated and create Canada Post parcels for the order
*
* @param boolean $replace Flag - replace order's parcels or not
*
* @return void
*/
public function createCapostParcels($replace = false)
{
$modifier = $this->getModifier(\XLite\Model\Base\Surcharge::TYPE_SHIPPING, 'SHIPPING');
$rawPackages = $modifier && $modifier->getMethod() && $modifier->getMethod()->getProcessorObject() ? $modifier->getMethod()->getProcessorObject()->getPackages($modifier) : array();
$capostConfig = \XLite\Core\Config::getInstance()->XC->CanadaPost;
if ($replace) {
// Remove order's parcels
$this->removeAllCapostParcels();
}
if (!empty($rawPackages) && is_array($rawPackages)) {
foreach ($rawPackages as $packageIdx => $package) {
$parcel = new \XLite\Module\XC\CanadaPost\Model\Order\Parcel();
$parcel->setOrder($this);
$parcel->setNumber($packageIdx + 1);
$parcel->setQuoteType($capostConfig->quote_type);
// Set parcel box dimensions and weight
foreach (array('weight', 'length', 'width', 'height') as $_param) {
$parcel->{'setBox' . \XLite\Core\Converter::convertToCamelCase($_param)}($package['box'][$_param]);
}
// Set parcel types (DEFAULT)
foreach (array('document', 'unpackaged', 'mailing_tube', 'oversized') as $_param) {
$parcel->{'setIs' . \XLite\Core\Converter::convertToCamelCase($_param)}($capostConfig->{$_param});
}
// Set default parcel options (from the module settings)
$optClasses = $parcel->getAllowedOptionClasses();
foreach ($optClasses as $optClass => $classData) {
if ($parcel::OPT_CLASS_COVERAGE == $optClass) {
// Do not use default settings for "coverage"
continue;
}
// Set default option value from module settings
$value = isset($capostConfig->{$optClass}) ? $capostConfig->{$optClass} : '';
if ($classData[$parcel::OPT_SCHEMA_MULTIPLE] && $classData[$parcel::OPT_SCHEMA_MANDATORY] && !isset($classData[$parcel::OPT_SCHEMA_ALLOWED_OPTIONS][$value])) {
// Set allowed option value
$value = array_shift(array_keys($classData[$parcel::OPT_SCHEMA_ALLOWED_OPTIONS]));
}
$parcel->{'setOpt' . \XLite\Core\Converter::convertToCamelCase($optClass)}($value);
}
// Add items to the parcel
foreach ($package['items'] as $itemIdx => $item) {
$parcelItem = new \XLite\Module\XC\CanadaPost\Model\Order\Parcel\Item();
$parcelItem->setAmount($item['qty']);
$parcelItem->setOrderItem($this->getItemById($item['id']));
// Assign parcel to the order
$parcel->addItem($parcelItem);
}
// Assign parcel to the order
$this->addCapostParcel($parcel);
\XLite\Core\Database::getEM()->persist($parcel);
}
\XLite\Core\Database::getEM()->flush();
}
}