3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class FormModel { private array $attributes; private array $attributesLabels; private array $attributesErrors = []; public function __construct() { $this->attributes = $this->attributes(); $this->attributesLabels = $this->attributeLabels(); } public function getAttributeValue(string $attribute) { return $this->readProperty($attribute); } public function attributeHint(string $attribute): string { $hints = $this->attributeHints(); return $hints[$attribute] ?? ''; } public function attributeHints(): array { return []; } public function attributeLabel(string $attribute): string { return $this->attributesLabels[$attribute] ?? $this->generateAttributeLabel($attribute); } public function formName(): string { return ''; } public function hasAttribute(string $attribute): bool { return \array_key_exists($attribute, $this->attributes); } public function error(string $attribute): array { return $this->attributesErrors[$attribute] ?? []; } public function errors(): array { return $this->attributesErrors ?? []; } public function errorSummary(bool $showAllErrors): array { $lines = []; $errors = $showAllErrors ? $this->errors() : [$this->firstErrors()]; foreach ($errors as $error) { $lines = \array_merge($lines, $error); } return $lines; } public function firstError(string $attribute): string { return isset($this->attributesErrors[$attribute]) ? reset($this->attributesErrors[$attribute]) : ''; } public function firstErrors(): array { if (empty($this->attributesErrors)) { return []; } $errors = []; foreach ($this->attributesErrors as $name => $es) { if (!empty($es)) { $errors[$name] = \reset($es); } } return $errors; } public function hasErrors(?string $attribute = null): bool { return $attribute === null ? !empty($this->attributesErrors) : isset($this->attributesErrors[$attribute]); } public function load(array $data): bool { $result = false; $scope = $this->formName(); if ($scope === '' && !empty($data)) { $this->setAttributes($data); $result = true; } elseif (isset($data[$scope])) { $this->setAttributes($data[$scope]); $result = true; } return $result; } public function setAttributes(array $values): void { foreach ($values as $name => $value) { if (isset($this->attributes[$name])) { switch ($this->attributes[$name]) { case 'bool': $this->writeProperty($name, (bool) $value); break; case 'float': $this->writeProperty($name, (float) $value); break; case 'int': $this->writeProperty($name, (int) $value); break; default: $this->writeProperty($name, $value); break; } } } } protected function addError(string $attribute, string $error): void { $this->attributesErrors[$attribute][] = $error; } private function addErrors(array $items): void { foreach ($items as $attribute => $errors) { foreach ((array)$errors as $error) { $this->attributesErrors[$attribute][] = $error; } } } private function attributes(): array { $class = new \ReflectionClass($this); foreach ($class->getProperties() as $property) { if (!$property->isStatic()) { $type = (new \ReflectionProperty($property->class, $property->name))->getType(); if ($type !== null) { $this->attributes[$property->getName()] = $type->getName(); } else { throw new \InvalidArgumentException( "You must specify the type hint for \"$property->class\" class." ); } } } return $this->attributes; } private function clearErrors(?string $attribute = null): void { if ($attribute === null) { $this->attributesErrors = []; } else { unset($this->attributesErrors[$attribute]); } } private function readProperty(string $attribute) { $class = get_class($this); if (!property_exists($class, $attribute)) { throw new InvalidArgumentException("Undefined property: \"$class::$attribute\"."); } $getter = fn ($class, $attribute) => $class->$attribute; $getter = \Closure::bind($getter, null, $this); return $getter($this, $attribute); } private function writeProperty(string $attribute, $value): void { $setter = fn ($class, $attribute, $value) => $class->$attribute = $value; $setter = \Closure::bind($setter, null, $this); $setter($this, $attribute, $value); } } class LoginForm extends FormModel { private ?string $login = null; private ?string $password = null; private bool $rememberMe = false; public function getLogin(): ?string { return $this->login; } public function getPassword(): ?string { return $this->password; } public function getRememberMe(): bool { return $this->rememberMe; } public function login(string $value): void { $this->login = $value; } public function password(string $value): void { $this->password = $value; } public function rememberMe(bool $value): void { $this->rememberMe = $value; } public function attributeHints(): array { return [ 'login' => 'Write your id or email.', 'password' => 'Write your password.' ]; } public function attributeLabels(): array { return [ 'login' => 'Login:', 'password' => 'Password:', 'rememberMe' => 'remember Me:' ]; } public function formName(): string { return 'LoginForm'; } public function addError(string $attribute, string $error): void { parent::addError($attribute, $error); } } $form = new LoginForm(); $form->login('yiiliveext'); $form->addError('login', 'Login incorrect'); var_dump($form->errors());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  (null)
number of ops:  16
compiled vars:  !0 = $form
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  266     0  E >   NEW                                              $1      'LoginForm'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
  267     3        INIT_METHOD_CALL                                         !0, 'login'
          4        SEND_VAL_EX                                              'yiiliveext'
          5        DO_FCALL                                      0          
  268     6        INIT_METHOD_CALL                                         !0, 'addError'
          7        SEND_VAL_EX                                              'login'
          8        SEND_VAL_EX                                              'Login+incorrect'
          9        DO_FCALL                                      0          
  269    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'errors'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class FormModel:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  __construct
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_METHOD_CALL                                         'attributes'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN_OBJ                                               'attributes'
          3        OP_DATA                                                  $1
   11     4        INIT_METHOD_CALL                                         'attributeLabels'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN_OBJ                                               'attributesLabels'
          7        OP_DATA                                                  $3
   12     8      > RETURN                                                   null

End of function __construct

Function getattributevalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  getAttributeValue
number of ops:  6
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        INIT_METHOD_CALL                                         'readProperty'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   17     5*     > RETURN                                                   null

End of function getattributevalue

Function attributehint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  attributeHint
number of ops:  11
compiled vars:  !0 = $attribute, !1 = $hints
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        INIT_METHOD_CALL                                         'attributeHints'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
   23     4        FETCH_DIM_IS                                     ~4      !1, !0
          5        COALESCE                                         ~5      ~4
          6        QM_ASSIGN                                        ~5      ''
          7        VERIFY_RETURN_TYPE                                       ~5
          8      > RETURN                                                   ~5
   24     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function attributehint

Function attributehints:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  attributeHints
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E > > RETURN                                                   <array>
   29     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function attributehints

Function attributelabel:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  attributeLabel
number of ops:  12
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        FETCH_OBJ_IS                                     ~1      'attributesLabels'
          2        FETCH_DIM_IS                                     ~2      ~1, !0
          3        COALESCE                                         ~3      ~2
          4        INIT_METHOD_CALL                                         'generateAttributeLabel'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $4      
          7        QM_ASSIGN                                        ~3      $4
          8        VERIFY_RETURN_TYPE                                       ~3
          9      > RETURN                                                   ~3
   34    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function attributelabel

Function formname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  formName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E > > RETURN                                                   ''
   39     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function formname

Function hasattribute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  hasAttribute
number of ops:  7
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   43     1        FETCH_OBJ_R                                      ~1      'attributes'
          2        ARRAY_KEY_EXISTS                                 ~2      !0, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
   44     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function hasattribute

Function error:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  error
number of ops:  9
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
   48     1        FETCH_OBJ_IS                                     ~1      'attributesErrors'
          2        FETCH_DIM_IS                                     ~2      ~1, !0
          3        COALESCE                                         ~3      ~2
          4        QM_ASSIGN                                        ~3      <array>
          5        VERIFY_RETURN_TYPE                                       ~3
          6      > RETURN                                                   ~3
   49     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function error

Function errors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  errors
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   FETCH_OBJ_IS                                     ~0      'attributesErrors'
          1        COALESCE                                         ~1      ~0
          2        QM_ASSIGN                                        ~1      <array>
          3        VERIFY_RETURN_TYPE                                       ~1
          4      > RETURN                                                   ~1
   54     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function errors

Function errorsummary:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
Branch analysis from position: 20
filename:       /in/CWjDe
function name:  errorSummary
number of ops:  25
compiled vars:  !0 = $showAllErrors, !1 = $lines, !2 = $errors, !3 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   RECV                                             !0      
   58     1        ASSIGN                                                   !1, <array>
   59     2      > JMPZ                                                     !0, ->7
          3    >   INIT_METHOD_CALL                                         'errors'
          4        DO_FCALL                                      0  $5      
          5        QM_ASSIGN                                        ~6      $5
          6      > JMP                                                      ->11
          7    >   INIT_METHOD_CALL                                         'firstErrors'
          8        DO_FCALL                                      0  $7      
          9        INIT_ARRAY                                       ~8      $7
         10        QM_ASSIGN                                        ~6      ~8
         11    >   ASSIGN                                                   !2, ~6
   61    12      > FE_RESET_R                                       $10     !2, ->20
         13    > > FE_FETCH_R                                               $10, !3, ->20
   62    14    >   INIT_FCALL                                               'array_merge'
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !1, $11
   61    19      > JMP                                                      ->13
         20    >   FE_FREE                                                  $10
   65    21        VERIFY_RETURN_TYPE                                       !1
         22      > RETURN                                                   !1
   66    23*       VERIFY_RETURN_TYPE                                       
         24*     > RETURN                                                   null

End of function errorsummary

Function firsterror:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  firstError
number of ops:  16
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   RECV                                             !0      
   70     1        FETCH_OBJ_IS                                     ~1      'attributesErrors'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->11
          4    >   INIT_FCALL                                               'reset'
          5        FETCH_OBJ_W                                      $3      'attributesErrors'
          6        FETCH_DIM_W                                      $4      $3, !0
          7        SEND_REF                                                 $4
          8        DO_ICALL                                         $5      
          9        QM_ASSIGN                                        ~6      $5
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~6      ''
         12    >   VERIFY_RETURN_TYPE                                       ~6
         13      > RETURN                                                   ~6
   71    14*       VERIFY_RETURN_TYPE                                       
         15*     > RETURN                                                   null

End of function firsterror

Function firsterrors:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/CWjDe
function name:  firstErrors
number of ops:  22
compiled vars:  !0 = $errors, !1 = $es, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'attributesErrors'
          1      > JMPZ                                                     ~3, ->3
   76     2    > > RETURN                                                   <array>
   79     3    >   ASSIGN                                                   !0, <array>
   81     4        FETCH_OBJ_R                                      ~5      'attributesErrors'
          5      > FE_RESET_R                                       $6      ~5, ->17
          6    > > FE_FETCH_R                                       ~7      $6, !1, ->17
          7    >   ASSIGN                                                   !2, ~7
   82     8        ISSET_ISEMPTY_CV                                 ~9      !1
          9        BOOL_NOT                                         ~10     ~9
         10      > JMPZ                                                     ~10, ->16
   83    11    >   INIT_FCALL                                               'reset'
         12        SEND_REF                                                 !1
         13        DO_ICALL                                         $12     
         14        ASSIGN_DIM                                               !0, !2
         15        OP_DATA                                                  $12
   81    16    > > JMP                                                      ->6
         17    >   FE_FREE                                                  $6
   87    18        VERIFY_RETURN_TYPE                                       !0
         19      > RETURN                                                   !0
   88    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of function firsterrors

Function haserrors:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  hasErrors
number of ops:  14
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   90     0  E >   RECV_INIT                                        !0      null
   92     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
          3    >   ISSET_ISEMPTY_PROP_OBJ                           ~2      'attributesErrors'
          4        BOOL_NOT                                         ~3      ~2
          5        QM_ASSIGN                                        ~4      ~3
          6      > JMP                                                      ->10
          7    >   FETCH_OBJ_IS                                     ~5      'attributesErrors'
          8        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      ~5, !0
          9        QM_ASSIGN                                        ~4      ~6
         10    >   VERIFY_RETURN_TYPE                                       ~4
         11      > RETURN                                                   ~4
   93    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function haserrors

Function load:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 10
filename:       /in/CWjDe
function name:  load
number of ops:  28
compiled vars:  !0 = $data, !1 = $result, !2 = $scope
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   RECV                                             !0      
   97     1        ASSIGN                                                   !1, <false>
   99     2        INIT_METHOD_CALL                                         'formName'
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !2, $4
  101     5        IS_IDENTICAL                                     ~6      !2, ''
          6      > JMPZ_EX                                          ~6      ~6, ->10
          7    >   ISSET_ISEMPTY_CV                                 ~7      !0
          8        BOOL_NOT                                         ~8      ~7
          9        BOOL                                             ~6      ~8
         10    > > JMPZ                                                     ~6, ->16
  102    11    >   INIT_METHOD_CALL                                         'setAttributes'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
  103    14        ASSIGN                                                   !1, <true>
  101    15      > JMP                                                      ->24
  104    16    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         17      > JMPZ                                                     ~11, ->24
  105    18    >   INIT_METHOD_CALL                                         'setAttributes'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $12     !0, !2
         21        SEND_FUNC_ARG                                            $12
         22        DO_FCALL                                      0          
  106    23        ASSIGN                                                   !1, <true>
  109    24    >   VERIFY_RETURN_TYPE                                       !1
         25      > RETURN                                                   !1
  110    26*       VERIFY_RETURN_TYPE                                       
         27*     > RETURN                                                   null

End of function load

Function setattributes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 42
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 42
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 41
Branch analysis from position: 7
5 jumps found. (Code = 188) Position 1 = 17, Position 2 = 23, Position 3 = 29, Position 4 = 35, Position 5 = 10
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 29
Branch analysis from position: 23
Branch analysis from position: 17
Branch analysis from position: 41
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/CWjDe
function name:  setAttributes
number of ops:  44
compiled vars:  !0 = $values, !1 = $value, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  113     0  E >   RECV                                             !0      
  115     1      > FE_RESET_R                                       $3      !0, ->42
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->42
          3    >   ASSIGN                                                   !2, ~4
  116     4        FETCH_OBJ_IS                                     ~6      'attributes'
          5        ISSET_ISEMPTY_DIM_OBJ                         0          ~6, !2
          6      > JMPZ                                                     ~7, ->41
  117     7    >   FETCH_OBJ_R                                      ~8      'attributes'
          8        FETCH_DIM_R                                      ~9      ~8, !2
          9      > SWITCH_STRING                                            ~9, [ 'bool':->17, 'float':->23, 'int':->29, ], ->35
  118    10    >   CASE                                                     ~9, 'bool'
         11      > JMPNZ                                                    ~10, ->17
  121    12    >   CASE                                                     ~9, 'float'
         13      > JMPNZ                                                    ~10, ->23
  124    14    >   CASE                                                     ~9, 'int'
         15      > JMPNZ                                                    ~10, ->29
         16    > > JMP                                                      ->35
  119    17    >   INIT_METHOD_CALL                                         'writeProperty'
         18        SEND_VAR_EX                                              !2
         19        BOOL                                             ~11     !1
         20        SEND_VAL_EX                                              ~11
         21        DO_FCALL                                      0          
  120    22      > JMP                                                      ->40
  122    23    >   INIT_METHOD_CALL                                         'writeProperty'
         24        SEND_VAR_EX                                              !2
         25        CAST                                          5  ~13     !1
         26        SEND_VAL_EX                                              ~13
         27        DO_FCALL                                      0          
  123    28      > JMP                                                      ->40
  125    29    >   INIT_METHOD_CALL                                         'writeProperty'
         30        SEND_VAR_EX                                              !2
         31        CAST                                          4  ~15     !1
         32        SEND_VAL_EX                                              ~15
         33        DO_FCALL                                      0          
  126    34      > JMP                                                      ->40
  128    35    >   INIT_METHOD_CALL                                         'writeProperty'
         36        SEND_VAR_EX                                              !2
         37        SEND_VAR_EX                                              !1
         38        DO_FCALL                                      0          
  129    39      > JMP                                                      ->40
         40    >   FREE                                                     ~9
  115    41    > > JMP                                                      ->2
         42    >   FE_FREE                                                  $3
  133    43      > RETURN                                                   null

End of function setattributes

Function adderror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CWjDe
function name:  addError
number of ops:  7
compiled vars:  !0 = $attribute, !1 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  135     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  137     2        FETCH_OBJ_W                                      $2      'attributesErrors'
          3        FETCH_DIM_W                                      $3      $2, !0
          4        ASSIGN_DIM                                               $3
          5        OP_DATA                                                  !1
  138     6      > RETURN                                                   null

End of function adderror

Function adderrors:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 14
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/CWjDe
function name:  addErrors
number of ops:  16
compiled vars:  !0 = $items, !1 = $errors, !2 = $attribute, !3 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  140     0  E >   RECV                                             !0      
  142     1      > FE_RESET_R                                       $4      !0, ->14
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->14
          3    >   ASSIGN                                                   !2, ~5
  143     4        CAST                                          7  ~7      !1
          5      > FE_RESET_R                                       $8      ~7, ->12
          6    > > FE_FETCH_R                                               $8, !3, ->12
  144     7    >   FETCH_OBJ_W                                      $9      'attributesErrors'
          8        FETCH_DIM_W                                      $10     $9, !2
          9        ASSIGN_DIM                                               $10
         10        OP_DATA                                                  !3
  143    11      > JMP                                                      ->6
         12    >   FE_FREE                        

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.23 ms | 1033 KiB | 16 Q