Allows the disabling of states

@param array $states

@return array
485610
protected function parseStates(array $states)
    {
        $newStates = array();
        foreach ($states as $key => $state) {
            if (null === $state) {
                $newStates[] = $key;
            } elseif (self::CFG_STATE_DISABLE !== $state) {
                $newStates[] = $state;
            } elseif (null !== $index = array_search($key, $newStates)) {
                unset($newStates[$index]);
            }
        }

        return $newStates;
    }
724527
public function toggleOptions($options, $state = null)
    {
        if ($state === null) {
            $state = ($this->options & $options) !== $options;
        }

        return $this->setOptions(
            $state ?
            $this->options | $options :
            $this->options & ~$options
        );
    }
217046
public function checkState($storeState, $state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				if(isset($_GET['state']))
				{
					$state = $_GET['state'];
				}
				else
				{
					$state = '';
				}
			}
			else
			{
				$state = $this->state;
			}
		}
		return $storeState === $state;
	}
1178931
protected function setState($state)
    {
        if (!array_key_exists($state, $this->stateDirectives)) {
            throw new InvalidArgumentException("Invalid state {$state}");
        }
        $this->state = $state;
        return $this;
    }
936222
public function variantStateExcluded($state)
    {
        foreach ($this->excludedVariantStates as $excludedstate) {
            $matches = true;

            foreach ($excludedstate as $variant => $variantstate) {
                if (!isset($state[$variant]) || $state[$variant] != $variantstate) {
                    $matches = false;
                    break;
                }
            }

            if ($matches) {
                return true;
            }
        }
    }
45053
private function getObjectStateIds(array $stateIdentifiers): array
    {
        $idList = [];

        foreach ($stateIdentifiers as $identifier) {
            $identifier = explode('|', $identifier);
            if (count($identifier) !== 2) {
                continue;
            }

            try {
                $stateGroup = $this->objectStateHandler->loadGroupByIdentifier($identifier[0]);
                $objectState = $this->objectStateHandler->loadByIdentifier($identifier[1], $stateGroup->id);
                $idList[$stateGroup->id][] = $objectState->id;
            } catch (NotFoundException $e) {
                continue;
            }
        }

        return $idList;
    }
1143389
public function renderState($state)
    {
        $list = SiteState::getList();

        if (isset($list[$state])) {
            return $this->t($list[$state]);
        }

        return $this->t("Unknown");
    }
438493
public static function set_StockState( $state )
    {
        if( $state instanceof StockState or null === $state ) {
            $state = StockState::makeFromString( $state );
        }
        return $state;
    }
290670
public function execute(State $state) {
        $errors = [];
        foreach ($state->functions as $function) {
            $errors = array_merge($errors, $this->verifyReturn($function, $state));
        }
        foreach ($state->methods as $method) {
            $errors = array_merge($errors, $this->verifyReturn($method, $state));
        }
        return $errors;
    }
155182
public function getCodeFields($state = null)
    {
        $fields = [
            'client_id' => $this->clientId,
            'redirect_uri' => $this->redirectUrl,
            'view' => $this->view,
            'response_type' => 'code',
        ];

        if ($this->usesState()) {
            $fields['state'] = $state;
        }

        return $fields;
    }
401794
protected function clean(array $services = array())
    {
        if (empty($services)) {
            return array();
        }

        if (!empty($this->config['allow'])) {
            $allow = array_map('strtolower', (array) $this->config['allow']);
            $services = array_filter($services, function ($arr) use ($allow) {
                $serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
                return (in_array($serviceName, $allow));
            });
        }

        if (!empty($services) && !empty($this->config['deny'])) {
            $deny = array_map('strtolower', (array) $this->config['deny']);
            $services = array_filter($services, function ($arr) use ($deny) {
                $serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
                return (!in_array($serviceName, $deny));
            });
        }

        return (array) $services;
    }
760234
public function getStates()
    {
        $appID = App::getCurrentID();
        $complementID = self::getCurrentID();
        $states = $this->getStatesFromFile();

        if (isset($states[$appID][$complementID])) {
            return $this->states = $states[$appID][$complementID];
        }

        return $this->states = [];
    }
364131
public function findUnreachableStates(): array
	{
		$g = new Graph();
		$g->indexNodeAttr('unreachable');

		$g->createNode('', ['unreachable' => false]);
		foreach ($this->states as $s => $state) {
			if ($s !== '') {
				$g->createNode($s, ['unreachable' => true]);
			}
		}

		foreach ($this->actions as $a => $action) {
			foreach ($action['transitions'] ?? [] as $source => $transition) {
				foreach ($transition['targets'] ?? [] as $target) {
					$g->createEdge(null, $g->getNode($source), $g->getNode($target), []);
				}
			}
		}

		GraphSearch::DFS($g)
			->onNode(function (Node $node) use ($g) {
				$node->setAttr('unreachable', false);
				return true;
			})
			->start([$g->getNode('')]);

		return array_map(function(Node $n) { return $n->getId(); }, $g->getNodesByAttr('unreachable', true));
	}
422840
public function setState(int $state): ControllerInterface
    {
        switch ($state) {
            case self::STATE_PLAYING:
                return $this->play();
            case self::STATE_PAUSED:
                return $this->pause();
            case self::STATE_STOPPED:
                return $this->pause();
        }
        throw new \InvalidArgumentException("Unknown state: {$state})");
    }
541018
public function state($options = array())
    {
        $options = new AnConfig($options);

        $options->append(array(
            'country_selector' => 'countery-selector',
            'country' => 'US',
            'selected' => null,
            'use_state_code' => true,
            'prompt' => true,
        ));

        $country = strtolower($options->country);

        $country_selector = null;

        if ($options->country_selector) {
            $country_selector = $options->country_selector;
        }

        $use_state_code = $options->use_state_code;

        unset($options->use_state_code);
        unset($options->country);
        unset($options->country_selector);

        $states = array();
        $provinces = array();

        foreach (self::$US_STATES as $key => $name) {
            $states[$use_state_code ? $key : $name] = AnTranslator::_($name);
        }

        foreach (self::$CANADA_PROVINCES as $key => $name) {
            $provinces[$use_state_code ? $key : $name] = AnTranslator::_($name);
        }

        $selected = $options->selected;

        unset($options->selected);

        $options = AnConfig::unbox($options);

        $states = $this->_html->select($options['name'], array('options' => $states, 'selected' => $selected), array_merge($options, array('country' => 'us')));
        $provinces = $this->_html->select($options['name'], array('options' => $provinces, 'selected' => $selected), array_merge($options, array('country' => 'canada')));
        $custom = $this->_html->textfield($options['name'], $selected, array_merge($options, array('country' => 'custom')));

        if (empty($country_selector)) {
            return $country == 'us' ? $states : $provinces;
        }

        return $states.$provinces.$custom;
    }
27174
def process_states(instates)
      outstates = {}
      instates.each do |inst|
        name = inst.delete(:name)
        outstates[name] ||= []
        outstates[name] << inst
      end
      return outstates
    end
1259704
public function changeState($state)
    {
        $availableStates = $this->dbObject('Status')->enumValues();
        if (in_array($state, $availableStates)) {
            $this->Status = $state;
            return true;
        } else {
            user_error(_t('Reservation.STATE_CHANGE_ERROR', 'Selected state is not available'));
            return false;
        }
    }