Log error event. It provides the same functionality as sprintf() by passing two or more arguments.

@param string $value What to be formatted
@param mixed ...$args (Optional) One or more arguments

@return self Returns itself

@see sprintf()
512126
public function error($value, ...$args) {
        return call_user_func_array(
            [__CLASS__, 'event'],
            array_merge([self::ERROR, $value], $args)
        );
    }
851212
public function setLogger($value)
    {
        if ($value === null || $value instanceof LoggerInterface) {
            $this->logger = $value;
        } else {
            $this->logger = new LoggerWrapper($value);
        }
        if ($this->apiClient !== null) {
            $this->apiClient->setLogger($this->logger);
        }
    }
141555
public function compileWiths($value, array $args = array())
    {
        $generated = parent::compileString($value);

        ob_start() and extract($args, EXTR_SKIP);

        try {
            eval('?>'.$generated);
        } catch (\Exception $e) {
            ob_get_clean();
            throw $e;
        }

        $content = ob_get_clean();

        return $content;
    }
413699
public function setArgument($argument, $value)
    {
        Arr::set($this->arguments, $argument, $value);

        return $this;
    }
806006
protected function validateDecimal($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        if (count($args) == 0) {
            throw new ValidatorConfigException("Validator 'decimal' must have argument in validator list for parameter {$parameter}");
        }

        $decimals = (int)$args[0];

        if ($decimals <= 0) {
            throw new ValidatorConfigException("Validator 'decimal' has invalid value which is lower or equal to zero; for parameter={$parameter}");
        }

        if ($decimals > 100) {
            throw new ValidatorConfigException("Validator 'decimal' can't have that large argument; parameter={$parameter}");
        }

        //$value = $this->getValue($parameter);

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = trim((string)$value);

        if ($value === '') {
            return null;
        }

        if (!is_numeric($value)) {
            return Message::getMessage(Message::NUMERIC, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        $parts = explode('.', $value);

        if (count($parts) == 1) {
            return null; // value is not decimal, it's probably integer, so it's ok
        }

        $valueDecimals = $parts[1];

        if (strlen($valueDecimals) > $decimals) {
            return Message::getMessage(Message::DECIMAL, [
                'param' => $parameter,
                'value' => $value,
                'decimals' => $decimals
            ]);
        }

        return null;
    }
206056
private function validate(string $value) : void
    {
        foreach ($this->validators as $validator) {
            if (! $validator->isValid($value)) {
                foreach ($validator->getFailureMessages() as $messageKey => $message) {
                    $this->addTranslatableError($messageKey, $message);
                }
            }
        }
    }
534239
private function formatField($value, array $args = []) {
        if ($value === null) {
            $r = $this->translate('null');
        } elseif ($value === true) {
            $r = $this->translate('true');
        } elseif ($value === false) {
            $r = $this->translate('false');
        } elseif (is_string($value)) {
            $r = $this->translate($value);
        } elseif (is_numeric($value)) {
            $r = $value;
        } elseif (is_array($value)) {
            $argArray = array_map([$this, 'formatField'], $value);
            $r = implode(', ', $argArray);
        } elseif ($value instanceof \DateTimeInterface) {
            $r = $value->format('c');
        } else {
            $r = $value;
        }

        $format = array_shift($args);
        switch ($format) {
            case 'plural':
                $singular = array_shift($args);
                $plural = array_shift($args) ?: $singular.'s';
                $count = is_array($value) ? count($value) : $value;
                $r = $count == 1 ? $singular : $plural;
                break;
        }

        return (string)$r;
    }
1022895
public function validate($value)
    {
        $assert = $this->getAssert();
        if ($assert !== null) {
            if (is_callable($assert)) {
                if (!call_user_func($assert, $value, $this)) {
                    throw new AssertException(
                        sprintf('Custom validation fail with value (%s) "%s"', gettype($value), print_r($value, true))
                    );
                }
            } else {
                if ($value !== $assert) {
                    throw new AssertException(
                        sprintf(
                            'Failed asserting that actual value (%s) "%s" matches expected value (%s) "%s".',
                            gettype($value),
                            print_r($value, true),
                            gettype($assert),
                            print_r($assert, true)
                        )
                    );
                }
            }
        }

        return true;
    }
1112743
static function regexp($value, &$error, $args)
    {
        if (is_scalar($value)){
//            $patterns = $args;
            if (sizeof($args) == 1 && is_array($args[0])) $args = $args[0];
            foreach ($args as $pattern){
                if (empty($pattern)) return $value;
                if (preg_match($pattern, $value)) return $value;
            }
        }
        $error = new Error('Некорректное регулярное выражение', 'regexp');
        return $value;
    }
54228
public function set($argument, $value = null)
    {
        if (!is_array($argument)) {
            $argument = array($argument => $value);
        }

        return $this->setArguments($argument);
    }
150889
public function Check($value)
    {
        if ($this->trimValue)
            $value = trim($value);
        $result = array();
        if (!preg_match($this->pattern, $value))
            $this->error = self::NoMatch;
        
        return $this->error == '';
    }
410971
public function processDetailFieldValue($value, $args = [])
    {
        $parent = $this->owner->hasMethod('getParent') ? $this->owner->getParent() : null;
        
        return ViewTools::singleton()->processAttribute($value, $this->owner, $parent, $args);
    }
815302
public static function stringOrInteger($value)
    {
        if (!is_string($value) and !is_int($value)) {
            $message = sprintf('Value "%s" expected to be string or integer, type %s given.', static::stringify($value), gettype($value));

            throw static::createException($value, $message, static::INVALID_STRING_INTEGER, null);
        }
    }
151727
static function string($value, &$error, $args)
    {
        if (isset($value) && is_scalar($value)){
            return strval($value);
        }
        $error = new Error('Должно быть строкой', 'string');
        return '';
    }
15744
public function setMessage(string $value) : Log
    {

        if ($this->data['message'] !== $value) {
            $this->data['message'] = $value;
            $this->setModified('message');
        }

        return $this;
    }
1062335
protected function validateSlug($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        //$value = $this->getValue($parameter);

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = trim((string)$value);

        if ($value === '') {
            return null;
        }

        if (!Validate::isSlug($value)) {
            return Message::getMessage(Message::SLUG, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        return null;
    }
405760
public function debug($value, ...$args) {
        return call_user_func_array(
            [__CLASS__, 'event'],
            array_merge([self::DEBUG, $value], $args)
        );
    }