根据定义的字段从请求中填充字段值并返回表单数据.

@param string $excepts
@param bool   $useDefault

@return array
424265
public final function formData($excepts = '', $useDefault = false) {
        $this->inflate($excepts, $useDefault);

        return $this->_formData;
    }
1295418
protected function _getFieldValue($field, $useDefault = true)
    {
        $fieldOptions = static::$_classFields[get_called_class()][$field];

        if (isset($this->_record[$fieldOptions['columnName']])) {
            $value = $this->_record[$fieldOptions['columnName']];

            // apply type-dependent transformations
            switch ($fieldOptions['type']) {
                case 'password':
                {
                    return $value;
                }

                case 'timestamp':
                {
                    if (!isset($this->_convertedValues[$field])) {
                        if ($value && $value != '0000-00-00 00:00:00') {
                            $this->_convertedValues[$field] = strtotime($value);
                        } else {
                            $this->_convertedValues[$field] = null;
                        }
                    }

                    return $this->_convertedValues[$field];
                }
                case 'serialized':
                {
                    if (!isset($this->_convertedValues[$field])) {
                        $this->_convertedValues[$field] = is_string($value) ? unserialize($value) : $value;
                    }

                    return $this->_convertedValues[$field];
                }
                case 'set':
                case 'list':
                {
                    if (!isset($this->_convertedValues[$field])) {
                        $delim = empty($fieldOptions['delimiter']) ? ',' : $fieldOptions['delimiter'];
                        $this->_convertedValues[$field] = array_filter(preg_split('/\s*'.$delim.'\s*/', $value));
                    }

                    return $this->_convertedValues[$field];
                }

                case 'boolean':
                {
                    if (!isset($this->_convertedValues[$field])) {
                        $this->_convertedValues[$field] = (boolean)$value;
                    }

                    return $this->_convertedValues[$field];
                }

                default:
                {
                    return $value;
                }
            }
        } elseif ($useDefault && isset($fieldOptions['default'])) {
            // return default
            return $fieldOptions['default'];
        } else {
            switch ($fieldOptions['type']) {
                case 'set':
                case 'list':
                {
                    return [];
                }
                default:
                {
                    return null;
                }
            }
        }
    }
327525
protected function getInverseBooleanSelectList($includeNull = false)
    {
        $results = array();
        if( $includeNull ) {
            $results[ '' ] = Translate::recursive('common.both');
        }

        $results[ 0 ] = Translate::recursive('common.yes');
        $results[ 1 ] = Translate::recursive('common.no');

        return $results;
    }
1315516
public function getStructureDifferences($db, $excepted, $drop = false)
    {
        if (isset($excepted['table'])) {
            $excepted = array($excepted['table'] => $excepted);
        }
        $actions = array();
        foreach ($excepted as $table => $value) {
            $current = $this->getCurrentStructure($db, $table);
            if (count($current) > 0) {
                $dbTable = array_shift($current);
                if ($this->getHash($value) != $this->getHash($dbTable)) {

//                    if(strtolower($value['engine']) != strtolower($dbTable['engine'])) {
//                        $actions[] = array(
//                            'sql' => $this->getChangeEngine($table, $value['engine']),
//                            'action' => 'change_engine'
//                        );
//                    }

                    $subject1 = array($value['fields']);
                    $subject2 = array($dbTable['fields']);

                    foreach ($subject1 as $index => $test1) {
                        $test2 = $subject2[$index];
                        // Search for add and changes
                        foreach ($test1 as $key => $item) {
                            if (isset($test2[$key])) {
                                $item2 = $test2[$key];
                                // possible changes
                                if ($this->getHash($item) !== $this->getHash($item2)) {
                                    $actions[] = array(
                                        'sql' => $this->getAlterChange($table, $item),
                                        'action' => 'alter_field'
                                    );
                                }
                            } else {
                                // create the new instance
                                $actions[] = array('sql' => $this->getAlterAdd($table, $item), 'action' => 'add_field');
                            }
                        }
                        //Search for deletion
                        foreach ($test2 as $key => $item) {
                            if (!isset($test1[$key]) && $drop) {
                                $actions[] = array(
                                    'sql' => $this->getAlterDrop($table, $item, $key),
                                    'action' => 'drop_field'
                                );
                            }
                        }
                    }

                    $test1 = $value['keys'];
                    $test2 = $dbTable['keys'];
                    foreach ($test1 as $key => $item) {
                        if (!$this->haveKey($item, $test2)) {
                            $actions[] = array('sql' => $this->getAddKey($table, $item), 'action' => 'add_key');
                        }
                    }
                    //Search for deletion
                    foreach ($test2 as $key => $item) {
                        if (!$this->haveKey($item, $test1)) {
                            $actions[] = array(
                                'sql' => $this->getDropKey($table, $item),
                                'action' => 'drop_key'
                            );
                        }
                    }

                    $test1 = $value['unique'];
                    $test2 = $dbTable['unique'];
                    foreach ($test1 as $key => $item) {
                        if (!$this->haveUnique($item, $test2)) {
                            $actions[] = array('sql' => $this->getAddKey($table, $item), 'action' => 'add_unique');
                        }
                    }
                    //Search for deletion
                    foreach ($test2 as $key => $item) {
                        if (!$this->haveKey($item, $test1)) {
                            $actions[] = array(
                                'sql' => $this->getDropKey($table, $item),
                                'action' => 'drop_unique'
                            );
                        }
                    }

                }
            } else {
                //                if(!$value instanceof \stdClass) die_stack_trace();
                $actions[] = array('sql' => $this->getCreateTable($value), 'action' => 'create_table');
            }
        }
        if ($current) {
            foreach ($current as $table => $value) {
                if (!isset($excepted[$table]) && $drop) {
                    $actions[] = array('sql' => $this->getDropTable($value), 'action' => 'drop_table');
                }
            }
        }
        return $actions;
    }
221996
static public function getPermissionsList($except=null)
    {
        $res = ArrayHelper::map(Yii::$app->authManager->getPermissions(), 'name', 'description');
        if ($except !== null) {
            unset($res[$except]);
        }
        ksort($res);
        return $res;
    }
659380
public function getFunctionsUsed( $excludePrefixes = array() )
	{
		if ( is_string( $excludePrefixes ) )
		{
			$excludePrefixes = array( $excludePrefixes );
		}

		$result = $this->traverseNodes( $this->exprTree, function( $node ) use( &$result, $excludePrefixes )
		{
			// TODO Test the functions in this node and return false if any are found
			return true;
		} );

		return ! $result;
	}
590685
public function clear(array $excepts = [])
    {
        $tmp = array();
        foreach ($excepts as $except) {
            if ($this->has($except)) {
                $tmp[$except] = $this->get($except);
            }
        }
        $this->setAll(array());
        foreach ($tmp as $key => $value) {
            $this->set($key, $value);
        }
    }
677006
public function except()
    {
        $cols = func_get_args();
        //method returns all rows in the collection except for those with the specified keys
        $dstore = new DataStore;
        foreach ($this->rows as $row) {
            foreach ($cols as $col) {
                if (isset($row[$col])) {
                    unset($row[$col]);
                }
            }
            $dstore->append($row);
        }

        $columnsMeta = Utility::get($this->metaData, "columns");
        if ($columnsMeta) {
            foreach ($cols as $col) {
                if (isset($columnsMeta[$col])) {
                    unset($columnsMeta[$col]);
                }
            }
        }
        $dstore->meta(array("columns"=>$columnsMeta));
        return $dstore;
    }
740492
protected function normalizeUsedClasses(array $usedClasses)
    {
        $normalized = array();
        foreach ($usedClasses as $tuple) {
            $tuple[0] = $tuple[0]->toAbsolute();

            if (array_key_exists(1, $tuple)) {
                if (!$tuple[1]->isShortName()) {
                    throw new Exception\InvalidUsedClassAliasException($tuple[1]);
                }

                $normalized[] = $tuple;
            } else {
                $normalized[] = array($tuple[0], $tuple[0]->shortName());
            }
        }

        return $normalized;
    }
440442
private static function doFilter(ReflectionClass $class, array $excluded, bool $requireAbstract = false) : array
    {
        $ignored = array_flip(array_map('strtolower', $excluded));

        return array_filter(
            $class->getMethods(ReflectionMethod::IS_PUBLIC),
            static function (ReflectionMethod $method) use ($ignored, $requireAbstract) : bool {
                return (! $requireAbstract || $method->isAbstract()) && ! (
                    array_key_exists(strtolower($method->getName()), $ignored)
                    || self::methodCannotBeProxied($method)
                );
            }
        );
    }
160717
protected function getResourceMethods($defaults, $options)
	{
		if (isset($options['only']))
		{
			return array_intersect($defaults, $options['only']);
		}
		elseif (isset($options['except']))
		{
			return array_diff($defaults, $options['except']);
		}

		return $defaults;
	}
970248
public function getFilterOptions($idList, $usedOnly, &$arrCount = null)
    {
        if (!$this->isFilterOptionRetrievingPossible($idList)) {
            return [];
        }

        $filter = $this->getTagMetaModel()->getEmptyFilter();

        $this->buildFilterRulesForFilterSetting($filter);

        // Add some more filter rules.
        if ($usedOnly) {
            $this->buildFilterRulesForUsedOnly($filter, $idList ? $idList : []);
        } elseif ($idList && \is_array($idList)) {
            $filter->addFilterRule(new StaticIdList($idList));
        }

        $objItems = $this->getTagMetaModel()->findByFilter(
            $filter,
            $this->getSortingColumn(),
            0,
            0,
            $this->getSortDirection(),
            [$this->getAliasColumn(), $this->getValueColumn()]
        );

        if ($arrCount !== null) {
            $this->calculateFilterOptionsCount($objItems, $arrCount, $idList);
        }

        return $this->convertItemsToFilterOptions(
            $objItems,
            $this->getValueColumn(),
            $this->getAliasColumn(),
            $arrCount
        );
    }
221957
public function exceptValues($excluded = [])
    {
        Arguments::define(
            Boa::arrOf(
                Boa::either(
                    Boa::string(),
                    Boa::integer()
                )
            )
        )->check($excluded);

        return $this->filter(
            function ($value) use ($excluded) {
                return !in_array($value, $excluded);
            }
        );
    }
685553
public function field($field,$except=false){
        if(true === $field) {// 获取全部字段
            $fields     =  $this->getDbFields();
            $field      =  $fields?:'*';
        }elseif($except) {// 字段排除
            if(is_string($field)) {
                $field  =  explode(',',$field);
            }
            $fields     =  $this->getDbFields();
            $field      =  $fields?array_diff($fields,$field):$field;
        }
        $this->options['field']   =   $field;
        return $this;
    }
83452
public function getRandomDbValue(array $except = [])
    {
        $values = $this->getAllowedDbValues($except);

        shuffle($values);

        return array_shift($values);
    }
1282103
protected function prepareValueAndOperator($value, $operator, $useDefault = false)
    {
        if ($useDefault) {
            return [$operator, '='];
        }
        if ($this->invalidOperatorAndValue($operator, $value)) {
            throw new InvalidArgumentException('Illegal operator and value combination.');
        }

        return [$value, $operator];
    }
1241038
public function pullAll(array $keys, $valueDefault = null): array
    {
        return Arrays::pullAll($this->data, $keys, $valueDefault);
    }