3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Album\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; use Album\Model\Album; use Album\Form\AlbumForm; class AlbumController extends AbstractActionController { protected $albumTable; public function indexAction() { return new ViewModel(array( 'albums' => $this->getAlbumTable()->fetchAll(), )); } public function addAction() { $form = new AlbumForm(); $form->get('submit')->setAttribute('value', 'Add'); $request = $this->getRequest(); if ($request->isPost()) { $album = new Album(); $form->setInputFilter($album->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $album->exchangeArray($form->getData()); $this->getAlbumTable()->saveAlbum($album); // Redirect to list of albums return $this->redirect()->toRoute('album'); } } return array('form' => $form); } public function editAction() { $id = (int)$this->params('id'); if (!$id) { return $this->redirect()->toRoute('album', array('action'=>'add')); } $album = $this->getAlbumTable()->getAlbum($id); $form = new AlbumForm(); $form->bind($album); $form->get('submit')->setAttribute('value', 'Edit'); $request = $this->getRequest(); if ($request->isPost()) { $form->setData($request->getPost()); if ($form->isValid()) { $this->getAlbumTable()->saveAlbum($album); // Redirect to list of albums return $this->redirect()->toRoute('album'); } } return array( 'id' => $id, 'form' => $form, ); } public function deleteAction() { $id = (int)$this->params('id'); if (!$id) { return $this->redirect()->toRoute('album'); } $request = $this->getRequest(); if ($request->isPost()) { $del = $request->getPost()->get('del', 'No'); if ($del == 'Yes') { $id = (int)$request->getPost()->get('id'); $this->getAlbumTable()->deleteAlbum($id); } // Redirect to list of albums return $this->redirect()->toRoute('album'); } return array( 'id' => $id, 'album' => $this->getAlbumTable()->getAlbum($id) ); } public function getAlbumTable() { if (!$this->albumTable) { $sm = $this->getServiceLocator(); $this->albumTable = $sm->get('Album\Model\AlbumTable'); } return $this->albumTable; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vnItD
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                            'album%5Ccontroller%5Calbumcontroller', 'zend%5Cmvc%5Ccontroller%5Cabstractactioncontroller'
  105     1      > RETURN                                                   1

Class Album\Controller\AlbumController:
Function indexaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vnItD
function name:  indexAction
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $0      'Zend%5CView%5CModel%5CViewModel'
   17     1        INIT_METHOD_CALL                                         'getAlbumTable'
          2        DO_FCALL                                      0  $1      
          3        INIT_METHOD_CALL                                         $1, 'fetchAll'
          4        DO_FCALL                                      0  $2      
          5        INIT_ARRAY                                       ~3      $2, 'albums'
          6        SEND_VAL_EX                                              ~3
          7        DO_FCALL                                      0          
          8      > RETURN                                                   $0
   19     9*     > RETURN                                                   null

End of function indexaction

Function addaction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 48
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 48
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/vnItD
function name:  addAction
number of ops:  51
compiled vars:  !0 = $form, !1 = $request, !2 = $album
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $3      'Album%5CForm%5CAlbumForm'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   24     3        INIT_METHOD_CALL                                         !0, 'get'
          4        SEND_VAL_EX                                              'submit'
          5        DO_FCALL                                      0  $6      
          6        INIT_METHOD_CALL                                         $6, 'setAttribute'
          7        SEND_VAL_EX                                              'value'
          8        SEND_VAL_EX                                              'Add'
          9        DO_FCALL                                      0          
   26    10        INIT_METHOD_CALL                                         'getRequest'
         11        DO_FCALL                                      0  $8      
         12        ASSIGN                                                   !1, $8
   27    13        INIT_METHOD_CALL                                         !1, 'isPost'
         14        DO_FCALL                                      0  $10     
         15      > JMPZ                                                     $10, ->48
   28    16    >   NEW                                              $11     'Album%5CModel%5CAlbum'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !2, $11
   29    19        INIT_METHOD_CALL                                         !0, 'setInputFilter'
         20        INIT_METHOD_CALL                                         !2, 'getInputFilter'
         21        DO_FCALL                                      0  $14     
         22        SEND_VAR_NO_REF_EX                                       $14
         23        DO_FCALL                                      0          
   30    24        INIT_METHOD_CALL                                         !0, 'setData'
         25        INIT_METHOD_CALL                                         !1, 'getPost'
         26        DO_FCALL                                      0  $16     
         27        SEND_VAR_NO_REF_EX                                       $16
         28        DO_FCALL                                      0          
   31    29        INIT_METHOD_CALL                                         !0, 'isValid'
         30        DO_FCALL                                      0  $18     
         31      > JMPZ                                                     $18, ->48
   32    32    >   INIT_METHOD_CALL                                         !2, 'exchangeArray'
         33        INIT_METHOD_CALL                                         !0, 'getData'
         34        DO_FCALL                                      0  $19     
         35        SEND_VAR_NO_REF_EX                                       $19
         36        DO_FCALL                                      0          
   33    37        INIT_METHOD_CALL                                         'getAlbumTable'
         38        DO_FCALL                                      0  $21     
         39        INIT_METHOD_CALL                                         $21, 'saveAlbum'
         40        SEND_VAR_EX                                              !2
         41        DO_FCALL                                      0          
   36    42        INIT_METHOD_CALL                                         'redirect'
         43        DO_FCALL                                      0  $23     
         44        INIT_METHOD_CALL                                         $23, 'toRoute'
         45        SEND_VAL_EX                                              'album'
         46        DO_FCALL                                      0  $24     
         47      > RETURN                                                   $24
   40    48    >   INIT_ARRAY                                       ~25     !0, 'form'
         49      > RETURN                                                   ~25
   41    50*     > RETURN                                                   null

End of function addaction

Function editaction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 58
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 58
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/vnItD
function name:  editAction
number of ops:  62
compiled vars:  !0 = $id, !1 = $album, !2 = $form, !3 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   INIT_METHOD_CALL                                         'params'
          1        SEND_VAL_EX                                              'id'
          2        DO_FCALL                                      0  $4      
          3        CAST                                          4  ~5      $4
          4        ASSIGN                                                   !0, ~5
   46     5        BOOL_NOT                                         ~7      !0
          6      > JMPZ                                                     ~7, ->14
   47     7    >   INIT_METHOD_CALL                                         'redirect'
          8        DO_FCALL                                      0  $8      
          9        INIT_METHOD_CALL                                         $8, 'toRoute'
         10        SEND_VAL_EX                                              'album'
         11        SEND_VAL_EX                                              <array>
         12        DO_FCALL                                      0  $9      
         13      > RETURN                                                   $9
   49    14    >   INIT_METHOD_CALL                                         'getAlbumTable'
         15        DO_FCALL                                      0  $10     
         16        INIT_METHOD_CALL                                         $10, 'getAlbum'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $11     
         19        ASSIGN                                                   !1, $11
   51    20        NEW                                              $13     'Album%5CForm%5CAlbumForm'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !2, $13
   52    23        INIT_METHOD_CALL                                         !2, 'bind'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0          
   53    26        INIT_METHOD_CALL                                         !2, 'get'
         27        SEND_VAL_EX                                              'submit'
         28        DO_FCALL                                      0  $17     
         29        INIT_METHOD_CALL                                         $17, 'setAttribute'
         30        SEND_VAL_EX                                              'value'
         31        SEND_VAL_EX                                              'Edit'
         32        DO_FCALL                                      0          
   55    33        INIT_METHOD_CALL                                         'getRequest'
         34        DO_FCALL                                      0  $19     
         35        ASSIGN                                                   !3, $19
   56    36        INIT_METHOD_CALL                                         !3, 'isPost'
         37        DO_FCALL                                      0  $21     
         38      > JMPZ                                                     $21, ->58
   57    39    >   INIT_METHOD_CALL                                         !2, 'setData'
         40        INIT_METHOD_CALL                                         !3, 'getPost'
         41        DO_FCALL                                      0  $22     
         42        SEND_VAR_NO_REF_EX                                       $22
         43        DO_FCALL                                      0          
   58    44        INIT_METHOD_CALL                                         !2, 'isValid'
         45        DO_FCALL                                      0  $24     
         46      > JMPZ                                                     $24, ->58
   59    47    >   INIT_METHOD_CALL                                         'getAlbumTable'
         48        DO_FCALL                                      0  $25     
         49        INIT_METHOD_CALL                                         $25, 'saveAlbum'
         50        SEND_VAR_EX                                              !1
         51        DO_FCALL                                      0          
   62    52        INIT_METHOD_CALL                                         'redirect'
         53        DO_FCALL                                      0  $27     
         54        INIT_METHOD_CALL                                         $27, 'toRoute'
         55        SEND_VAL_EX                                              'album'
         56        DO_FCALL                                      0  $28     
         57      > RETURN                                                   $28
   67    58    >   INIT_ARRAY                                       ~29     !0, 'id'
   68    59        ADD_ARRAY_ELEMENT                                ~29     !2, 'form'
         60      > RETURN                                                   ~29
   70    61*     > RETURN                                                   null

End of function editaction

Function deleteaction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 46
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 40
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vnItD
function name:  deleteAction
number of ops:  55
compiled vars:  !0 = $id, !1 = $request, !2 = $del
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     0  E >   INIT_METHOD_CALL                                         'params'
          1        SEND_VAL_EX                                              'id'
          2        DO_FCALL                                      0  $3      
          3        CAST                                          4  ~4      $3
          4        ASSIGN                                                   !0, ~4
   75     5        BOOL_NOT                                         ~6      !0
          6      > JMPZ                                                     ~6, ->13
   76     7    >   INIT_METHOD_CALL                                         'redirect'
          8        DO_FCALL                                      0  $7      
          9        INIT_METHOD_CALL                                         $7, 'toRoute'
         10        SEND_VAL_EX                                              'album'
         11        DO_FCALL                                      0  $8      
         12      > RETURN                                                   $8
   79    13    >   INIT_METHOD_CALL                                         'getRequest'
         14        DO_FCALL                                      0  $9      
         15        ASSIGN                                                   !1, $9
   80    16        INIT_METHOD_CALL                                         !1, 'isPost'
         17        DO_FCALL                                      0  $11     
         18      > JMPZ                                                     $11, ->46
   81    19    >   INIT_METHOD_CALL                                         !1, 'getPost'
         20        DO_FCALL                                      0  $12     
         21        INIT_METHOD_CALL                                         $12, 'get'
         22        SEND_VAL_EX                                              'del'
         23        SEND_VAL_EX                                              'No'
         24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !2, $13
   82    26        IS_EQUAL                                                 !2, 'Yes'
         27      > JMPZ                                                     ~15, ->40
   83    28    >   INIT_METHOD_CALL                                         !1, 'getPost'
         29        DO_FCALL                                      0  $16     
         30        INIT_METHOD_CALL                                         $16, 'get'
         31        SEND_VAL_EX                                              'id'
         32        DO_FCALL                                      0  $17     
         33        CAST                                          4  ~18     $17
         34        ASSIGN                                                   !0, ~18
   84    35        INIT_METHOD_CALL                                         'getAlbumTable'
         36        DO_FCALL                                      0  $20     
         37        INIT_METHOD_CALL                                         $20, 'deleteAlbum'
         38        SEND_VAR_EX                                              !0
         39        DO_FCALL                                      0          
   88    40    >   INIT_METHOD_CALL                                         'redirect'
         41        DO_FCALL                                      0  $22     
         42        INIT_METHOD_CALL                                         $22, 'toRoute'
         43        SEND_VAL_EX                                              'album'
         44        DO_FCALL                                      0  $23     
         45      > RETURN                                                   $23
   92    46    >   INIT_ARRAY                                       ~24     !0, 'id'
   93    47        INIT_METHOD_CALL                                         'getAlbumTable'
         48        DO_FCALL                                      0  $25     
         49        INIT_METHOD_CALL                                         $25, 'getAlbum'
         50        SEND_VAR_EX                                              !0
         51        DO_FCALL                                      0  $26     
         52        ADD_ARRAY_ELEMENT                                ~24     $26, 'album'
         53      > RETURN                                                   ~24
   95    54*     > RETURN                                                   null

End of function deleteaction

Function getalbumtable:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/vnItD
function name:  getAlbumTable
number of ops:  14
compiled vars:  !0 = $sm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   99     0  E >   FETCH_OBJ_R                                      ~1      'albumTable'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->11
  100     3    >   INIT_METHOD_CALL                                         'getServiceLocator'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
  101     6        INIT_METHOD_CALL                                         !0, 'get'
          7        SEND_VAL_EX                                              'Album%5CModel%5CAlbumTable'
          8        DO_FCALL                                      0  $6      
          9        ASSIGN_OBJ                                               'albumTable'
         10        OP_DATA                                                  $6
  103    11    >   FETCH_OBJ_R                                      ~7      'albumTable'
         12      > RETURN                                                   ~7
  104    13*     > RETURN                                                   null

End of function getalbumtable

End of class Album\Controller\AlbumController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.86 ms | 1411 KiB | 13 Q