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


PHP Utils\ArrayManager类代码示例

本文整理汇总了PHP中Includes\Utils\ArrayManager的典型用法代码示例。如果您正苦于以下问题:PHP ArrayManager类的具体用法?PHP ArrayManager怎么用?PHP ArrayManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: translate

 /**
  * Translate label
  *
  * @param string $name Label name
  * @param string $code Language code
  *
  * @return string|void
  */
 public function translate($name, $code)
 {
     if (!isset($this->translations[$code])) {
         $this->translations[$code] = $this->getRepo()->findLabelsByCode($code);
     }
     return \Includes\Utils\ArrayManager::getIndex($this->translations[$code], $name);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:Db.php

示例2: getCriticalPath

 /**
  * Method to get critical path length for a node
  *
  * @param string $module Module actual name
  *
  * @return integer
  */
 public function getCriticalPath($module)
 {
     if (!isset($this->criticalPaths)) {
         $this->criticalPaths = $this->calculateCriticalPathLengths();
     }
     return \Includes\Utils\ArrayManager::getIndex($this->criticalPaths, $module);
 }
开发者ID:kingsj,项目名称:core,代码行数:14,代码来源:Modules.php

示例3: getAllMetadata

 /**
  * Return all classes metadata
  *
  * @param string $class Class name OPTIONAL
  *
  * @return array
  */
 public static function getAllMetadata($class = null)
 {
     if (!isset(static::$metadata)) {
         static::$metadata = array();
         // Create hash array to quick access its elements
         foreach (static::getHandler()->getMetadataFactory()->getAllMetadata() as $data) {
             static::$metadata[$data->name] = $data;
         }
     }
     return \Includes\Utils\ArrayManager::getIndex(static::$metadata, $class);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:EntityManager.php

示例4: getMinQuantity

 /**
  * Return minimum quantity
  *
  * @return integer
  */
 protected function getMinQuantity()
 {
     $minQuantity = $this->getProduct()->getMinQuantity($this->getCart()->getProfile() ? $this->getCart()->getProfile()->getMembership() : null);
     $result = parent::getMinQuantity();
     $minimumQuantity = $minQuantity ? $minQuantity : $result;
     if (!$this->isCartPage()) {
         $items = \XLite\Model\Cart::getInstance()->getItemsByProductId($this->getProduct()->getProductId());
         $quantityInCart = $items ? \Includes\Utils\ArrayManager::sumObjectsArrayFieldValues($items, 'getAmount', true) : 0;
         $result = $minimumQuantity > $quantityInCart ? $minimumQuantity - $quantityInCart : $result;
     } else {
         $result = $minimumQuantity;
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:19,代码来源:QuantityBox.php

示例5: prepareBuyerData

 /**
  * Translate array of data received from Paypal to the array for updating cart
  *
  * @param array $paypalData Array of customer data received from Paypal
  *
  * @return array
  */
 public function prepareBuyerData($paypalData)
 {
     $countryCode = \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOCOUNTRYCODE');
     $country = \XLite\Core\Database::getRepo('XLite\\Model\\Country')->findOneByCode($countryCode);
     $stateCode = \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOSTATE');
     $state = $country && $stateCode ? \XLite\Core\Database::getRepo('XLite\\Model\\State')->findOneByCountryAndCode($country->getCode(), $stateCode) : null;
     $street = trim(\Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOSTREET') . ' ' . \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOSTREET2'));
     $data = array('shippingAddress' => array('name' => (string) \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTONAME'), 'street' => $street, 'country' => $country ?: '', 'state' => $state ? $state : (string) \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOSTATE'), 'city' => (string) \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOCITY'), 'zipcode' => (string) \Includes\Utils\ArrayManager::getIndex($paypalData, 'SHIPTOZIP'), 'phone' => (string) \Includes\Utils\ArrayManager::getIndex($paypalData, 'PHONENUM')));
     return $data;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:ExpressCheckoutMerchantAPI.php

示例6: checkDiskFreeSpace

 /**
  * Check if there is enough disk free space.
  * Return message on error
  *
  * @return string
  */
 protected function checkDiskFreeSpace()
 {
     $message = null;
     $totalSize = \Includes\Utils\ArrayManager::sumObjectsArrayFieldValues($this->getEntries(), 'getPackSize');
     $freeSpaceRaw = \Includes\Utils\FileManager::getDiskFreeSpace(LC_DIR_TMP);
     $freeSpace = null !== $freeSpaceRaw ? max(0, $freeSpaceRaw - self::FREE_SPACE_RESERVE) : null;
     if (null !== $freeSpace && $totalSize > $freeSpace) {
         $message = \XLite\Core\Translation::getInstance()->translate('Not enough disk space. Required: {{req}} (+{{reserve}} reserve). Available: {{avail}}', array('req' => \XLite\Core\Converter::formatFileSize($totalSize), 'reserve' => \XLite\Core\Converter::formatFileSize(self::FREE_SPACE_RESERVE), 'avail' => \XLite\Core\Converter::formatFileSize($freeSpace)));
     }
     return $message;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:17,代码来源:Cell.php

示例7: getItemsByVariantId

 /**
  * Find items by variant ID
  *
  * @param integer $variantId Variant ID to use
  *
  * @return array
  */
 public function getItemsByVariantId($variantId)
 {
     $items = $this->getItems();
     return \Includes\Utils\ArrayManager::filter($items, array($this, 'isItemVariantIdEqual'), $variantId);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:12,代码来源:Order.php

示例8: getMetadata

 /**
  * Get module metadata (or only the certain field from it)
  *
  * @param string $name Array index
  *
  * @return mixed
  */
 protected function getMetadata($name)
 {
     return \Includes\Utils\ArrayManager::getIndex($this->metadata, $name, true);
 }
开发者ID:kingsj,项目名称:core,代码行数:11,代码来源:Uploaded.php

示例9: isRedirectToCleanURLNeeded

 /**
  * Check if redirect to clean URL is needed
  *
  * @return boolean
  */
 protected function isRedirectToCleanURLNeeded()
 {
     return preg_match('/\\/cart\\.php/Si', \Includes\Utils\ArrayManager::getIndex(\XLite\Core\Request::getInstance()->getServerData(), 'REQUEST_URI'));
 }
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:ACustomer.php

示例10: defineRequestData

 /**
  * Prepare and save passed data
  *
  * @param array       $data Passed data OPTIONAL
  * @param string|null $name Index in request data array (optional) OPTIONAL
  *
  * @return void
  */
 protected function defineRequestData(array $data = array(), $name = null)
 {
     if (empty($data)) {
         $data = $this->prepareRequestParamsList();
     }
     // FIXME: check if there is the way to avoid this
     $this->formFields = null;
     // TODO: check if there is more convenient way to do this
     $this->requestData = $this->prepareRequestData($data);
     $this->requestData = \Includes\Utils\ArrayManager::filterByKeys($this->requestData, $this->getFormFields(true));
     $this->requestData = $this->prepareRequestDataByFormFields($this->requestData);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:20,代码来源:AModel.php

示例11: getPageTemplate

 /**
  * getPageTemplate
  *
  * @return string
  */
 public function getPageTemplate()
 {
     return \Includes\Utils\ArrayManager::getIndex($this->getPageTemplates(), $this->getPage());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:AController.php

示例12: getFieldInfo

 /**
  * Return info about model field
  *
  * @param string $field Field name
  * @param string $param Data param OPTIONAL
  *
  * @return array|mixed
  */
 public function getFieldInfo($field, $param = null)
 {
     try {
         $result = $this->getClassMetadata()->getFieldMapping($field);
     } catch (\Doctrine\ORM\Mapping\MappingException $exception) {
         $result = $this->getClassMetadata()->getAssociationMapping($field);
     }
     return \Includes\Utils\ArrayManager::getIndex($result, $param, null !== $param);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:ARepo.php

示例13: getFilesToOverWrite

 /**
  * Retrive list of files that must be overwritten by request for install upgrades
  *
  * @return array
  */
 protected function getFilesToOverWrite()
 {
     $allFilesPlain = array();
     foreach (\XLite\Upgrade\Cell::getInstance()->getCustomFiles() as $files) {
         $allFilesPlain = array_merge($allFilesPlain, $files);
     }
     return \Includes\Utils\ArrayManager::filterByKeys($allFilesPlain, array_keys((array) \XLite\Core\Request::getInstance()->toRemain), true);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Upgrade.php

示例14: getAttributeValue

 /**
  * Get attribute column data
  *
  * @param \XLite\Model\Product   $product   Product object
  * @param \XLite\Model\Attribute $attribute Attribute object
  *
  * @return array
  */
 protected function getAttributeValue($product, $attributeName)
 {
     $value = null;
     $attr = \Includes\Utils\ArrayManager::searchInArraysArray($this->getAttributesColumns(), 'attributeName', $attributeName);
     if ($attr) {
         $entity = \XLite\Core\Database::getRepo('XLite\\Model\\Attribute')->find($attr['attributeId']);
         if ($entity) {
             $value = $entity->getAttributeValue($product, true);
         }
         if ($value && is_array($value)) {
             $value = array_shift($value);
         }
     }
     return $value ?: '';
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:23,代码来源:Products.php

示例15: getDbOptions

 /**
  * Getter method for $this->dbOptions
  *
  * @return array
  */
 protected static function getDbOptions($name = null)
 {
     return \Includes\Utils\ArrayManager::getIndex(static::$dbOptions ?: \Includes\Utils\ConfigParser::getOptions(array('database_details')), $name);
 }
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:Database.php


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