3v4l.org

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

End of function __invoke

End of class CorrectStructureValidator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.23 ms | 1004 KiB | 15 Q