@param array              $values
@param RuleInterface|null $next

@return RuleInterface
327141
protected static function enum(array $values, RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new Enum($values) : new AndOperator(static::enum($values), $next);
    }
340655
public static function asJsonApiDateTime(RuleInterface $next = null): RuleInterface
    {
        return self::stringToDateTime(DateTime::JSON_API_FORMAT, $next);
    }
556047
public static function postRelationship(RuleInterface $next = null): RuleInterface
    {
        return self::toOneRelationship(PostSchema::TYPE, self::postId($next));
    }
791178
protected static function stringArrayToIntArray(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new StringArrayToIntArray() : new AndOperator(new StringArrayToIntArray(), $next);
    }
25467
public function nextIf($type, $value = null)
    {
        if ($this->test($type, $value)) {
            return $this->next();
        }
    }
171690
public static function userId(RuleInterface $next = null): RuleInterface
    {
        return self::stringToInt(self::readable(UsersApi::class, $next));
    }
373268
public static function userRelationship(RuleInterface $next = null): RuleInterface
    {
        return self::toOneRelationship(UserSchema::TYPE, static::userId($next));
    }
630674
public function values(array $values)
    {
        $this->sqlParts['values'] = is_array(current($values)) ? $values : [$values];

        return $this;
    }
1244726
public function setValues(array $values)
    {
        foreach ($values as $name => $value) {
            if ($element = $this->get($name)) {
                $element->setValue($value);
            }
        }
        return $this;
    }
859467
public static function readable(string $apiClass, RuleInterface $next = null): RuleInterface
    {
        $primary = new IsReadableViaApiRule($apiClass);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
298657
public function setValues(array $values)
    {
        $this->getValidator()->validateRequired($values, $this->required);
        $this->values = array_merge($this->values, $values);
        
        return $this;
    }
1258032
public function setValues(array $values)
    {
        foreach ($values as $name => $value) {
            $this->fields->set($name, $value);
        }

        return $this;
    }
458837
function add(Expr $next) {
		if ($this->isNull()) {
			throw new \UnexpectedValueException("Cannot add anything to NULL");
		}
		if ($this->next) {
			$this->next->add($next);
		} else {
			$this->next = $next;
		}
		return $this;
	}
897668
public function setAutocompleterValues($values) {
        if (is_array($values) && $this->isAssoc($values)) {
            $values = array_merge(array_keys($values), array_values($values));
        }

        if (null !== $values && !is_array($values)) {
            if (!$values instanceof \Traversable || $values instanceof \Countable) {
                throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
            }
        }

        if ($this->hidden) {
            throw new \LogicException('A hidden question cannot use the autocompleter.');
        }

        $this->autocompleterValues = $values;

        return $this;
    }
215881
public function setValues($values)
    {
        foreach ($this->findScenario() as $name) {
            if (array_key_exists($name, $values)) {
                $this->$name = $values[$name];
            }
        }
        return $this;
    }
430922
public static function toOneRelationship(string $type, RuleInterface $next = null): RuleInterface
    {
        $primary = new ToOneRelationshipTypeCheckerRule($type);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
116182
public function setInitFormValues(array $values) {

		$this->initFormValues = $values;

		foreach($values as $name => $value) {
			if(isset($this->elements[$name]) && is_object($this->elements[$name])) {

				if($this->elements[$name] instanceof CheckboxElement) {
					if(empty($this->requestValues)) {
						$this->elements[$name]->setChecked($this->elements[$name]->getValue() == $value);
					}
					else {
						$this->elements[$name]->setChecked(!is_null($this->requestValues->get($name)));
					}
				}

				else if(is_null($this->elements[$name]->getValue())) {
					$this->elements[$name]->setValue($value);
				}
			}
		}

		return $this;

	}