Coder Social home page Coder Social logo

kontrolio's People

Contributors

franzose avatar maximkou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kontrolio's Issues

Валидатор Url не работает под PHP 7.3

Uncaught exception PHPException: PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 179 in /***/vendor/franzose/kontrolio/src/Rules/Core/Url.php on line 74
Backtrace:
      1. preg_match('~^
           (http|https)://                                 # protocol
           (([\pL\pN-]+:)?([\pL\pN-]+)@)?          # basic auth
           (
               ([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
                   |                                              # or
               \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}                 # a IP address
                   |                                              # or
               \[
                   (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9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[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))
               \]  # a IPv6 address
           )
           (:[0-9]+)?                              # a port (optional)
           (/?|/\S+|\?\S*|\#\S*)                   # a /, nothing, a / with something, a query or a fragment
       $~ixu', 'www.somedomain.ru') in Url.php, line 74
      2. Kontrolio\Rules\Core\Url->isValid('www.somedomain.ru') in Validator.php, line 439
      3. Kontrolio\Validator->handle(object Kontrolio\Rules\Core\Url, 'homepage', 'www.somedomain.ru') in Validator.php, line 408
      4. Kontrolio\Validator->validate() in ProfileController.php, line 427

allowEmptyValue work incorrect

'orgPostAddress' => [
    (new Core\Length(2,25))->allowEmptyValue()
]

passes not only empty value. This rule passes ANY value

Return messages segments if messages array not provided

Thank you for the great package (I'm so surprised it has so little downloads count).

It would be great to provide a little future.

I want to leave messages array empty and receive the output like:

[
   'email' => [
        'email.email',
        'email.not_blank'
    ]
]

Then I'll pass this array to my translator, instead of creating array by hands every time.

вывод ошибок валидации

спасибо за валидатор. сам хотел нечто подобное соорудить но вы первее )
допустим такой код

    $validator = Validator::getInstance()->make($request->getParsedBody(), [
      'type' => 'between:1,5',
      'value' => [
        function($value) {
          return is_numeric($value);
        },
        new LessThanOrEqual(20),
      ],
    ]);
    if (!$validator->validate()) {
      dd($validator->getErrorsList());
    }

отдаёт

array:1 [
  0 => "value.less_than_or_equal"
]

хотелось бы вариант вывода - есть в поле ошибка или нет
т.е. key тот-же что и во входных данных а значение boolean
успешно или не успешно валидировано поле
это возможно?

вообще универсальности ради было бы неплохо дать возможность сделать свой форматтер
который возвращает ошибки в том виде как нужно в конкретной ситуации.
ну прицепить стандартный вариант форматтера, как наглядное пособие.

спасибо!

Sometime rule not work

$data = [];
or
$data = [
    'attribute' => ''
];
or
$data = [
    'attribute' => 'abcd'
];

always invalid with:

$rules = [
    'attribute' => [
        new Sometimes,
        new Length(5, 15)
    ]
];

this code does nothing

if ($this->bypass) {
    continue;
}

he passes only Sometimes rule, and always execute isValid of Length

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.