@param IState|null|IStatePreventable $state
@return mixed
347624
public function onInvalid(IState $state = null)
    {
        return $state->isImplementsInterface(IStatePreventable::class)
            ? $state->getOnTerminate()
            : false;
    }
182508
protected function _sanitize($state)
    {
        //Treat empty string as null
        if ($state->value === '') {
            $state->value = null;
        }

        //Only filter if we have a value
        if(!empty($state->value))
        {
            //Only accepts scalar values and array
            if(!is_scalar($state->value) && !is_array($state->value))
            {
                throw new \UnexpectedValueException(
                    'Value needs to be an array or a scalar, "'.gettype($state->value).'" given'
                );
            }

            $filter = $state->filter;

            if(!($filter instanceof FilterInterface)) {
                $filter =  $this->getObject('filter.factory')->createChain($filter);
            }

            $state->value = $filter->sanitize($state->value);
        }

        return $state;
    }
251343
public static function setValidationState( $state = true)
	{
		$previousState = XBRL::$validating;
		XBRL::$validating = $state;
		return $previousState;
	}
392891
public function updateFromEmbeddedApiResponse(array $data, StateInterface $state = null): StateInterface
    {
        if (!$state) {
            $state = $this->stateRepository->findOneByExternalId($data['id']);
            if (!$state) {
                // only update when we create a new because this is the embedded method
                $state = new State();
                $state->setExternalId($data['id'])
                    ->setExclStatistics($data['exclStatistics'])
                    ->setIsDefault($data['isDefault'])
                    ->setName($data['name']);
            }
        }

        return $state;
    }
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;
	}
185843
public function save($state)
	{
		$command=$this->db->createCommand();
		if(false===$this->exists())
			return $command->insert($this->stateTableName,array(
				$this->keyField=>Yii::app()->name,
				$this->valueField=>serialize($state)
			));
		else
			return $command->update($this->stateTableName,array($this->valueField=>serialize($state)),
				$this->db->quoteColumnName($this->keyField).'=:key',
				array(':key'=>Yii::app()->name)
		);
	}
1043810
public function get($state) : State
    {
        $this->addCallback('GET', $state);
        if (!isset($this->actions['POST'])) {
            $this->addCallback('POST', $state);
        }
        return $this;
    }
515758
private function resolveValue($value, State $state)
    {
        if ($value instanceof FuncContext) {
            return $this->call($value, $state);
        }

        if ($value instanceof ArrayContext) {
            $array = [];

            foreach ($value->values as $key => $val) {
                $array[$key] = $this->resolveValue($val, $state);
            }

            return $array;
        }

        return $value;
    }
981847
public function debug( $state = null )
    {
        $default = self::DEBUG_SIMULATE + self::DEBUG_SHOW_QUERY;
        if( is_bool( $state ) ) {
            $state = $state ? $default : 0;;
        } elseif ( $state === null ) {
            $state = $default;
        }
        $this->debug = $state;
        return $this->debug;
    }
592282
public function setState(\Haven\PersonaBundle\Entity\State $state = null)
    {
        $this->state = $state;
    
        return $this;
    }
531544
public function isLanguageRequiredInUri($state = null)
    {
        if (isset($state)) {
            $this->languageRequiredInUri = (bool) $state;
        }

        return $this->languageRequiredInUri;
    }
775667
private function get_social_service( $state ) {
		$name = $this->get_social_service_name( $state );
		if ( empty( $name ) ) {
			return null;
		}
		foreach ( $this->get_class_list() as $class ) {
			/** @var \Technote\Interfaces\Helper\Social $class */
			if ( $name === $class->get_service_name() ) {
				return $class;
			}
		}

		return null;
	}
121450
protected function isState($state)
    {
        $current = $this->getState();

        return (is_array($state))
            ? in_array($current, $state)
            : $current == $state;
    }
224311
public function getAction($state)
    {
        $type = self::getType('strtolower', false);
        $action = self::$defaultAction[$type];

        if (isset($this->states['action'])) {
            $action = $this->states['action'];
        }

        return ($state === 'uninstalled') ? '' : $action;
    }
1265908
function restore($state=1) {
		$fw=Base::instance();
		if ($this->flag && is_file($file=($path=$fw->get('TEMP').
			$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
			$fw->hash($this->file).'-').$state.'.png')) {
			if (is_resource($this->data))
				imagedestroy($this->data);
			$this->data=imagecreatefromstring($fw->read($file));
			imagesavealpha($this->data,TRUE);
			foreach (glob($path.'*.png',GLOB_NOSORT) as $match)
				if (preg_match('/-(\d+)\.png/',$match,$parts) &&
					$parts[1]>$state)
					@unlink($match);
			$this->count=$state;
		}
		return $this;
	}
1038823
protected function getState($state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				$this->state = md5(\uniqid('', true));
			}
		}
		else
		{
			$this->state = $state;
		}
		return $this->state;
	}
529883
public function getStateColor($state)
    {
        if ($state instanceof StatableInterface) {
            $state = $state->getState();
        }

        return empty($this->colors['state'][$state])
            ? $this->options['state']['default_color']
            : $this->colors['state'][$state]
        ;
    }