-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] PHP Reflection

, 15 2017 . 13:32 +

, Habr! , PHP Reflection. , - , - .


image


Laravel . , framework' , .


:


Validator::extend('someRule', function ($attribute, $value, $parameters, $validator) {
        // some code...
        return $result; // boolean
}, ':attribute is invalid');

, . , , . . getter' . , composer update .


, Reflection, , . , . , . , .


. - . , . , ...


Validator::extend('someRule', function ($attribute, $value, $parameters, $validator) {

        //  -.        .
        //            (,    )
        $ninja = function() { 
                //          
                return $this->initialRules;
        };
        $initialRules = $ninja->call($validator); //  $newThis

        // some code
        return $result;

}, ':attribute is invalid');

- , : , . (laravel ). , .


, PHP 5.4


, . , , . , - .


.

Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/333396/

:  

: [1] []
 

:
: 

: ( )

:

  URL