Filter the attributes.

@param bool $determineDatabase Determine for filter database session attributes.
If is false, this filter non database attributes.

@return array
420615
private function filterAttributes($determineDatabase = false)
    {
        $databaseAttributes = \array_merge(
            (array) $this->databaseKeys['common'],
            (array) $this->databaseKeys[$this->getScope()]
        );

        if ($determineDatabase) {
            return \array_intersect_key($this->attributes, \array_flip($databaseAttributes));
        }

        return \array_diff_key($this->attributes, \array_flip($databaseAttributes));
    }
1021266
public function getFilteredData($context = null)
    {
        $data = $this->getRawData();
        foreach ($data as $offset => $value) $data[$offset] = $this->getFilteredValue($offset, $context);

        return $data;
    }
365737
public function getChangedAttributes(array $fields = [])
    {
        $changed = [];

        if (empty($fields)) {
            $fields = $this->getMeta()->getAttributes();
        }

        $dirty = $this->getDirtyAttributes();
        if (empty($dirty)) {
            $dirty = $fields;
        }

        foreach ($this->getPrimaryKeyValues() as $name => $value) {
            if ($value) {
                $changed[$name] = $value;
            }
        }

        $platform = $this->getConnection()->getDatabasePlatform();

        $meta = self::getMeta();
        foreach ($this->getAttributes() as $name => $attribute) {
            if (in_array($name, $fields) && in_array($name, $dirty) && $meta->hasField($name)) {
                $field = $this->getField($name);
                $sqlType = $field->getSqlType();
                if ($sqlType) {
                    $value = $field->convertToDatabaseValue($attribute, $platform);
                    $changed[$name] = null === $value ? $field->default : $value;
                }
            }
        }

        return $changed;
    }
483518
public function getDatabases(): array
    {
        $names = array_unique(array_merge(array_keys($this->databases), array_keys($this->config->getDatabases())));

        $result = [];
        foreach ($names as $name) {
            $result[] = $this->database($name);
        }

        return $result;
    }
211590
protected function filterPresetAttributes($attributes, $position = 'field')
    {
        if (!$this->preset || $position != 'field') {
            return $attributes;
        }

        if (!is_array($this->preset)) {
            $this->preset = ['field' => $this->preset, 'type' => 'slug'];
        }

        $presetField = array_get($this->preset, 'field');
        $presetType = array_get($this->preset, 'type');

        if ($this->arrayName) {
            $fullPresetField = $this->arrayName.'['.implode('][', HtmlHelper::nameToArray($presetField)).']';
        }
        else {
            $fullPresetField = $presetField;
        }

        $newAttributes = [
            'data-input-preset' => '[name="'.$fullPresetField.'"]',
            'data-input-preset-type' => $presetType,
            'data-input-preset-closest-parent' => 'form'
        ];

        if ($prefixInput = array_get($this->preset, 'prefixInput')) {
            $newAttributes['data-input-preset-prefix-input'] = $prefixInput;
        }

        return $attributes + $newAttributes;
    }
934312
public function getAttributes()
    {

        // initialize the array with the attributes
        $attributes = array();

        // prepare the pattern to filter the attributes
        $pattern = sprintf('%s-*', $this->getSerial());

        // prepare the array with the attributes
        foreach ($this as $key => $value) {
            if (fnmatch($pattern, $key)) {
                $attributes[$key] = $value;
            }
        }

        // return the attributes
        return $attributes;
    }
314556
protected function filterCustomCasts()
    {
        $customCasts = [];
        foreach ($this->casts as $attribute => $castClass) {
            if (is_subclass_of($castClass, CustomCastBase::class)) {
                $customCasts[$attribute] = $castClass;
            }
        }

        return $customCasts;
    }
1022604
protected function getDatabaseInformation(InputInterface $input, OutputInterface $output)
    {
        $db = array();

        /**
         * @var \Symfony\Component\Console\Helper\DialogHelper
         */
        $dialog = $this->getHelperSet()->get('dialog');

        if (!$dbHost = $input->getOption('db-host')) {
            $dbHost = $dialog->ask($output, Lang::get('enter_db_host'), 'localhost');
        }

        if (!$dbName = $input->getOption('db-name')) {
            $dbName = $dialog->ask($output, Lang::get('enter_db_name'), 'phpci');
        }

        if (!$dbUser = $input->getOption('db-user')) {
            $dbUser = $dialog->ask($output, Lang::get('enter_db_user'), 'phpci');
        }

        if (!$dbPass = $input->getOption('db-pass')) {
            $dbPass = $dialog->askHiddenResponse($output, Lang::get('enter_db_pass'));
        }

        $db['servers']['read'] = $dbHost;
        $db['servers']['write'] = $dbHost;
        $db['name'] = $dbName;
        $db['username'] = $dbUser;
        $db['password'] = $dbPass;

        return $db;
    }
327589
protected function toModelAttributes($model, $attributes)
    {
        $filtered = [];
        $filter = $this->getAttributeFilter();

        foreach ($attributes as $key => $value) {
            if (!$filter($key, $value)) {
                continue;
            }

            $filtered[$key] = $value;
        }

        return $filtered;
    }
390545
public function createDatabase($database=null)
    {
        if (!$database) $database = $this->getDatabase();
        $sql = $this->getSchema()->getCreateDatabaseSql($database);
        return $this->query($sql);
    }
1055254
protected function doSelectDatabase($name)
    {
        $riak = $this->riakClient->selectDB($name);
        $numRetries = $this->config->getRetryQuery();
        $loggerCallable = $this->config->getLoggerCallable();

        return $loggerCallable !== null
            ? new LoggableDatabase($this, $riak, $this->eventManager, $numRetries, $loggerCallable)
            : new Database($this, $riak, $this->eventManager, $numRetries);
    }
1000928
public function dropSelectedDatabase()
    {
        $databaseName = $this->connector->getSelectedDatabase();
        if ($databaseName) {
            $this->connector->unloadDatabase();
            $this->schemaManager->dropDatabase($databaseName);
        }
    }
747341
protected function getFilteredOutAttributes()
    {
        $filterOutAttributes = array_merge(
            $this->model->getHidden(),
            [
                $this->model->getKeyName(),
                'deleted_at',
            ]
        );

        return array_unique($filterOutAttributes);
    }
1195027
protected function contains(array $attributes = array())
    {
        $collection = $this->findAll();
        $filtered   = $collection->filter(function($value, $key) use($attributes) {
            foreach ($attributes as $keyname => $attrVal) {
                if ($value->{$keyname} != $attrVal) {
                    return false;
                }
            }
            return true;
        });
        return $filtered->count() > 0;
    }
955235
protected function filterAttributes($attributes, $position = 'field')
    {
        $position = strtolower($position);

        $attributes = $this->filterTriggerAttributes($attributes, $position);
        $attributes = $this->filterPresetAttributes($attributes, $position);

        if ($position == 'field' && $this->disabled) {
            $attributes = $attributes + ['disabled' => 'disabled'];
        }

        if ($position == 'field' && $this->readOnly) {
            $attributes = $attributes + ['readonly' => 'readonly'];

            if ($this->type == 'checkbox' || $this->type == 'switch') {
                $attributes = $attributes + ['onclick' => 'return false;'];
            }
        }

        return $attributes;
    }
1122430
public function _getAttributesArray($attributeSetId)
    {
        $result = [];
        $attributes = $this->attributeCollection->create()
            ->setAttributeSetFilter($attributeSetId)
            ->getItems();

        foreach ($attributes as $attribute) {
            $result[] = $attribute->getAttributeCode();
        }

        return $result;
    }
852632
public function getDatabases() {
		$client = $this->getClient();

		if ($this->_profilerEnabled) {
			$event = $this->getProfiler()->startRead('Databases list');
		}

		$databasesRaw = $client->listDBs();

		if ($this->_profilerEnabled) {
			$event->stopSuccess();
		}

		$databases = [];

		foreach ($databasesRaw['databases'] as $database) {
			$databases[] = $database['name'];
		}

		return $databases;
	}