Removes any already selected options from the available options, returns
a newly built array.
@param  array  $activeKeys
@param  array  $availableOptions
@return array
489397
protected function filterActiveOptions(array $activeKeys, array &$availableOptions)
    {
        $active = [];
        foreach ($availableOptions as $id => $option) {
            if (!in_array($id, $activeKeys)) {
                continue;
            }

            $active[$id] = $option;
            unset($availableOptions[$id]);
        }

        return $active;
    }
896567
public function getAddons($active = false) {
        if ($active) {
            return array_keys($this->enabled);
        }
        return array_keys($this->addons);
    }
12475
public function deleteOption($categoryKey, $optionKey)
    {
        $this->requireOptionExists($categoryKey, $optionKey);

        $this->optionModel->where(['category_key' => $categoryKey, 'key' => $optionKey])->delete();
        $this->refresh();
        unset($this->options[$categoryKey][$optionKey]);
    }
275586
public function pre_update_option_active_plugins( array $plugins ): array {

		$plugin = plugin_basename( \dirname( __DIR__, 2 ) . '/laps.php' );
		$key    = array_search( $plugin, $plugins, true );

		if ( false !== $key && $key > 0 ) {

			unset( $plugins[ $key ] );
			array_unshift( $plugins, $plugin );
			$plugins = array_values( $plugins );
		}

		return $plugins;
	}
440443
public function select($options = [])
    {
        $source = [];

        foreach ($options as $key => $value) {
            $source[] = [
                'value' => $key,
                'text' => $value,
            ];
        }

        $this->addOptions(['source' => $source]);
    }
552795
public function removeOptionByKey($key, $option)
    {
        if ($this->hasOption($key, $option)) {
            unset($this->container[$key][$option]);
        }

        return $this;
    }
467869
public static function filterActiveOptions($data, $options_active, $existing_values = [], $skip_values = []) {
		if (!empty($existing_values) && !is_array($existing_values)) {
			$existing_values = [$existing_values];
		}
		foreach ($data as $k => $v) {
			// existing values
			if (!empty($existing_values) && in_array($k, $existing_values)) {
				continue;
			}
			// skip values
			if (!empty($skip_values) && in_array($k, $skip_values)) {
				unset($data[$k]);
				continue;
			}
			// options active
			if (!empty($options_active)) {
				foreach ($options_active as $k2 => $v2) {
					if (($v[$k2] ?? '') !== $v2) {
						unset($data[$k]);
						break;
					}
				}
			}
		}
		return $data;
	}
613493
protected function buildSelectOptions($options, $selectedValues = array())
    {
        $str = '';
        $inOptgroup = false;
        foreach ($options as $opt) {
            // $str = '';
            if (isset($opt['optgroup'])) {
                if ($inOptgroup) {
                    $str .= '</optgroup>'."\n";
                    $inOptgroup = false;
                }
                if ($opt['optgroup']) {
                    // open an optgroup
                    $attribs = $opt['attribs'];
                    $attribs['label'] = $opt['label'];
                    $str .= '<optgroup'.Html::buildAttribString($attribs).'>'."\n";
                    $inOptgroup = true;
                }
            } else {
                $optAttribs = \array_merge(array(
                    // 'cname' => 'option',
                    // 'innerhtml' => \htmlspecialchars($opt['label']),
                    'selected' => \in_array($opt['attribs']['value'], $selectedValues),
                ), $opt['attribs']);
                // unset($optAttribs['label']);
                $str .= Html::buildTag('option', $optAttribs, \htmlspecialchars($opt['label']))."\n";
            }
            // $this->props['attribs']['innerhtml'] .= $str;
        }
        if ($inOptgroup) {
            // $this->props['attribs']['innerhtml'] .= '</optgroup>';
            $str .= '</optgroup>'."\n";
        }
        return $str;
    }
917608
private function extractDistinctAvailableStateMethodNames(array $availableStates)
    {
        $methodNames = array();
        foreach ($availableStates as $availableToState) {
            $methodNames = array_unique(array_merge(
                $methodNames, $this->extractAvailableStateMethodNames($availableToState)
            ));
        }

        return $methodNames;
    }
82637
public function params(array $keys = array(), $onlyExistingParams = false)
    {
        if(count($keys) == 0)
            return $this->params;

        $params = array();

        foreach($keys as $key) {
            $key = trim($key);

            if($onlyExistingParams && isset($this->params[$key]))
                $params[$key] = $this->params[$key];
            else
                $params[$key] = isset($this->params[$key]) ? $this->params[$key] : null;
        }

        return $params;
    }
943429
public function delete($key, $options = array()) {
        $return= false;
        if ($cache = $this->getCacheProvider($this->getOption(xPDO::OPT_CACHE_KEY, $options), $options)) {
            $return= $cache->delete($key, $options);
        }
        return $return;
    }
326315
public function options($options = [])
    {
        if ($options instanceof Arrayable) {
            $options = $options->toArray();
        }

        $this->options = array_merge($this->options, $options);

        return $this;
    }
292816
public function availableIncludeKeys(): array
    {
        $availableKeys = [];
        if (($transformer = $this->transformer()) !== null && ($transformer instanceof  TransformerInterface)) {
            $availableKeys = $transformer->getAvailableIncludes();
        }

        return $availableKeys;
    }
154419
public function select(array $keys)
    {
        $list = [];
        foreach ($keys as $key) {
            if ($this->containsKey($key)) {
                $list[$key] = $this->get($key);
            }
        }

        return $this->createFrom($list);
    }
891424
public function remove( ...$with_keys ) : self {

		foreach ( $with_keys as $keys ) {
			foreach ( (array) $keys as $k ) {
				$this->offsetUnset( $k );
			}
		}

		return $this;
	}
624355
public static function remove( &$options = array(), $key )
    {
        $_originalValue = null;

        if ( static::contains( $options, $key ) )
        {
            $_cleanedKey = static::_cleanKey( $key );

            if ( is_array( $options ) )
            {
                if ( !isset( $options[$key] ) && isset( $options[$_cleanedKey] ) )
                {
                    $key = $_cleanedKey;
                }

                if ( isset( $options[$key] ) )
                {
                    $_originalValue = $options[$key];
                    unset( $options[$key] );
                }
            }
            else
            {
                if ( !isset( $options->{$key} ) && isset( $options->{$_cleanedKey} ) )
                {
                    $key = $_cleanedKey;
                }

                if ( isset( $options->{$key} ) )
                {
                    $_originalValue = $options->{$key};
                }

                unset( $options->{$key} );
            }
        }

        return $_originalValue;
    }
1314467
public function clear()
    {
        if ($this->locked) {
            throw new AccessException('Options cannot be cleared from a lazy option or normalizer.');
        }

        $this->defined = [];
        $this->defaults = [];
        $this->nested = [];
        $this->required = [];
        $this->resolved = [];
        $this->lazy = [];
        $this->normalizers = [];
        $this->allowedTypes = [];
        $this->allowedValues = [];
        $this->deprecated = [];

        return $this;
    }