3v4l.org

run code in 500+ PHP versions simultaneously
<?php class CorrectStructureValidator implements ValidatorRuleInterface { private string $format = 'Поле должно иметь следующий вид: %s. Вы написали - %s.'; private string $pattern; private string $verbalDescriptionOfPattern; public function __construct(string $pattern, string $verbalDescriptionOfPattern) { $this->pattern = $pattern; $this->verbalDescriptionOfPattern = $verbalDescriptionOfPattern; } public function __invoke(mixed $value): ?ValidationError { $result = preg_match($this->pattern, $value); if (!result) { $errorText = sprintf( $this->format, $this->verbalDescriptionOfPattern, $value ); return new ValidationError($errorText); } else { return null; } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbBpm
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'correctstructurevalidator'
   31     1      > RETURN                                                       1

Class CorrectStructureValidator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbBpm
function name:  __construct
number of ops:  7
compiled vars:  !0 = $pattern, !1 = $verbalDescriptionOfPattern
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   13     2        ASSIGN_OBJ                                                   'pattern'
          3        OP_DATA                                                      !0
   14     4        ASSIGN_OBJ                                                   'verbalDescriptionOfPattern'
          5        OP_DATA                                                      !1
   15     6      > RETURN                                                       null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbBpm
function name:  __invoke
number of ops:  24
compiled vars:  !0 = $value, !1 = $result, !2 = $errorText
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   19     1        FETCH_OBJ_R                                          ~3      'pattern'
          2        FRAMELESS_ICALL_2                preg_match          ~4      ~3, !0
          3        ASSIGN                                                       !1, ~4
   20     4        FETCH_CONSTANT                                       ~6      'result'
          5        BOOL_NOT                                             ~7      ~6
          6      > JMPZ                                                         ~7, ->21
   21     7    >   INIT_FCALL                                                   'sprintf'
   22     8        FETCH_OBJ_R                                          ~8      'format'
          9        SEND_VAL                                                     ~8
   23    10        FETCH_OBJ_R                                          ~9      'verbalDescriptionOfPattern'
         11        SEND_VAL                                                     ~9
   24    12        SEND_VAR                                                     !0
   21    13        DO_ICALL                                             $10     
         14        ASSIGN                                                       !2, $10
   26    15        NEW                                                  $12     'ValidationError'
         16        SEND_VAR_EX                                                  !2
         17        DO_FCALL                                          0          
         18        VERIFY_RETURN_TYPE                                           $12
         19      > RETURN                                                       $12
   20    20*       JMP                                                          ->22
   28    21    > > RETURN                                                       null
   30    22*       VERIFY_RETURN_TYPE                                           
         23*     > RETURN                                                       null

End of function __invoke

End of class CorrectStructureValidator.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.6 ms | 1611 KiB | 14 Q