當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayHelper::trim方法代碼示例

本文整理匯總了PHP中ArrayHelper::trim方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayHelper::trim方法的具體用法?PHP ArrayHelper::trim怎麽用?PHP ArrayHelper::trim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArrayHelper的用法示例。


在下文中一共展示了ArrayHelper::trim方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

    public function __construct($configuration, $value = NULL) {
        parent::__construct($configuration);

        $adjustedValue = is_array($value) ? ArrayHelper::trim($value) : StringHelper::trim($value);
        if (is_array($adjustedValue) && count($adjustedValue) === 1) {
            $adjustedValue = $adjustedValue[0];
        }

        $parameterName = $this->getParameterName();
        $this->$parameterName = $adjustedValue;
    }
開發者ID:reisystems-india,項目名稱:GovDashboard-Community,代碼行數:11,代碼來源:AbstractValueBasedOperatorHandler.php

示例2: cleanFunctionParameters

    public static function cleanFunctionParameters($datasetName, $columns, $parameters, $orderBy, array $options = NULL) {
        $metamodel = data_controller_get_metamodel();
        $dataset = $metamodel->getDataset($datasetName);

        $cleanedColumns = ArrayHelper::trim($columns);

        $cleanedParameters = NULL;
        if (isset($parameters)) {
            foreach ($parameters as $key => $value) {
                $key = StringHelper::trim($key);

                // ignoring system parameters
                list($elementNameSpace) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($key);
                if (!isset($elementNameSpace)) {
                    continue;
                }

                $cleanedParameters[$key] = $value;
            }
        }

        $cleanedOrderBy = NULL;
        ArrayHelper::addUniqueValues($cleanedOrderBy, ArrayHelper::trim($orderBy));

        $cleanedOptions = NULL;
        if (isset($options)) {
            foreach ($options as $name => $option) {
                $cleanedOption = NULL;
                if (isset($option)) {
                    if ($name == AbstractQueryRequest::OPTION__FORMULA_DEF) {
                        // cleaning all formulas
                        foreach ($option as $index => $formula) {
                            $cleanedFormula = clone $formula;

                            $parser = new FormulaExpressionParser($cleanedFormula->expressionLanguage);
                            $cleanedFormula->source = $parser->parse($cleanedFormula->source, 'DatasetUIMetaDataQueryHelper::cleanFormulaExpressionColumnNames');

                            $cleanedOption[$index] = $cleanedFormula;
                        }

                        // assembling clean formulas to calculate 'measure' flag
                        if (isset($cleanedOption)) {
                            $columnReferenceFactory = new CompositeColumnReferenceFactory(array(
                                $dataset,
                                new FormulaReferenceFactory($cleanedOption)));

                            $expressionAssembler = new FormulaExpressionAssembler($columnReferenceFactory);
                            foreach ($cleanedOption as $index => $cleanedFormula) {
                                // assembling full expressions to detect if any aggregation function present
                                $expression = $expressionAssembler->assemble($cleanedFormula);
                                // process the formula expression
                                $handler = FormulaExpressionLanguageFactory::getInstance()->getHandler($cleanedFormula->expressionLanguage);
                                $lexemes = $handler->lex($expression);
                                $syntaxTree = $handler->parse($lexemes);
                                // checking if the formula expression contains references to any aggregation functions
                                $cleanedFormula->isMeasure = $handler->isMeasure($syntaxTree);
                            }
                        }
                    }
                    elseif (is_array($option)) {
                        $cleanedOption = ArrayHelper::copy($option);
                    }
                    elseif (is_object($option)) {
                        $cleanedOption = clone $option;
                    }
                    else {
                        $cleanedOption = $option;
                    }
                }

                if (isset($cleanedOption)) {
                    $cleanedOptions[$name] = $cleanedOption;
                }
            }
        }

        // adjusting list of columns we need to return
        $requestedColumnNames = NULL;
        // preparing list of unique column names
        ArrayHelper::addUniqueValues($requestedColumnNames, $cleanedColumns);
        // adding columns which are used to sort result
        if ($cleanedOrderBy) {
            foreach ($cleanedOrderBy as $directionalColumnName) {
                list($columnName, $isSortAscending) = ColumnBasedComparator_AbstractSortingConfiguration::parseDirectionalColumnName($directionalColumnName);
                ArrayHelper::addUniqueValue($requestedColumnNames, $columnName);
            }
        }

        return array($requestedColumnNames, $cleanedParameters, $cleanedOrderBy, $cleanedOptions);
    }
開發者ID:reisystems-india,項目名稱:GovDashboard-Community,代碼行數:90,代碼來源:DatasetUIMetaDataQueryHelper.php

示例3: adjustOrderBy

 protected function adjustOrderBy(AbstractDataQueryControllerRequest $request) {
     $request->orderBy = ArrayHelper::trim($request->orderBy);
 }
開發者ID:reisystems-india,項目名稱:GovDashboard-Community,代碼行數:3,代碼來源:DataQueryControllerRequestCleaner.php


注:本文中的ArrayHelper::trim方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。