本文整理汇总了PHP中Includes\Utils\ArrayManager类的典型用法代码示例。如果您正苦于以下问题:PHP ArrayManager类的具体用法?PHP ArrayManager怎么用?PHP ArrayManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getDependencyCSSClass
/**
* Get some data for depenendecy in list
*
* @param \XLite\Model\Module $module Current module
*
* @return string
*/
protected function getDependencyCSSClass(\XLite\Model\Module $module)
{
return \Includes\Utils\ArrayManager::getIndex($this->getDependencyData($module), 'class', true);
}
开发者ID:kewaunited,项目名称:xcart,代码行数:11,代码来源:AModule.php
示例17: getMembershipErrors
/**
* Get the errors which are connected with the membership of the user who placed the order
*
* @param \XLite\Model\Order $order
*
* @return array
*/
protected function getMembershipErrors(\XLite\Model\Order $order)
{
$found = true;
$memberships = $this->getMemberships();
// Memberhsip
if (0 < count($memberships)) {
$membership = $order->getProfile() ? $order->getProfile()->getMembership() : null;
$found = $membership ? \Includes\Utils\ArrayManager::findValue($memberships, array($this, 'checkMembershipId'), $membership->getMembershipId()) : false;
}
return $found ? array() : array(static::ERROR_MEMBERSHIP);
}
开发者ID:kewaunited,项目名称:xcart,代码行数:18,代码来源:Coupon.php
示例18: getSelectedTab
/**
* Returns a description of the selected tab. If no tab is selected, returns NULL.
*
* @return array
*/
protected function getSelectedTab()
{
return \Includes\Utils\ArrayManager::getIndex($this->getTabs(), $this->getCurrentTarget());
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:ATabs.php
示例19: getPlugins
/**
* Return list of registered plugins
*
* @param string $hook Hook name OPTIONAL
*
* @return array
*/
protected static function getPlugins($hook = null)
{
if (!isset(static::$plugins)) {
// Check config file
if (\Includes\Utils\FileManager::isFileReadable(static::getConfigFile())) {
// Iterate over all sections
foreach (parse_ini_file(static::getConfigFile(), true) as $section => $plugins) {
// Set plugins order
asort($plugins, SORT_NUMERIC);
// Save plugins list
static::$plugins[$section] = array_fill_keys(array_keys($plugins), null);
}
} else {
\Includes\ErrorHandler::fireError('Unable to read config file for the Decorator plugins');
}
}
return \Includes\Utils\ArrayManager::getIndex(static::$plugins, $hook);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:25,代码来源:PluginManager.php
示例20: getSpecificOptions
/**
* Get specific options list for 'from' and for 'to' lists
*
* @param boolean $from Flag: is need to get options for 'from' list
*
* @return array
*/
protected function getSpecificOptions($from = true)
{
$options = $this->getOptions();
$values = $this->getValue();
$keys = is_array($values) ? $values : array($values);
$result = \Includes\Utils\ArrayManager::filterByKeys($options, $keys, $from);
return $result;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:15,代码来源:AListbox.php
注:本文中的Includes\Utils\ArrayManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论