3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ProfileRepository extends EntityRepository{ public function getProfilesExperimental($searchString, $isMapSearch = false){ $searchString = strtolower($searchString); $em = $this->getEntityManager(); $cit = $em->getRepository('LunnarBundle:City')->findAll(); $cat = $em->getRepository('LunnarBundle:Profilecategory')->findAll(); $bra = $em->getRepository('LunnarBundle:Brand')->findAll(); $cities = array(); $profilecategories = array(); $brands = array(); foreach($cit as $city){ array_push($cities, strtolower($city->getName())); } foreach($cat as $category){ array_push($profilecategories, strtolower($category->getName())); } foreach($bra as $brand){ array_push($brands, strtolower($brand->getName())); } $parameters = array(); //'var' => '%'.$searchString.'%', $searchQuerySelectJoin = "SELECT p FROM LunnarBundle:Profile p LEFT JOIN p.divisions d "; $searchQueryWhere = ""; ////////////////////////// $searchStringArray = explode(" ", $searchString); // Remove í, á and við $removeWords = array('í','á','við'); //Find city, category, brand and save for later, and remove them from $searchStringArray $searchStringArray = array_diff($searchStringArray, $removeWords); $city = array_intersect($searchStringArray, $cities); $searchStringArray = array_diff($searchStringArray, $city); $category = array_intersect($searchStringArray, $profilecategories); $searchStringArray = array_diff($searchStringArray, $category); $brand = array_intersect($searchStringArray, $brands); $searchStringArray = array_diff($searchStringArray, $brand); //// PRINTS print_r($searchStringArray); echo '<br/>'; //print_r($city); //print_r($profilecategory); //print_r($brand); $first = true; $searchTerms = " "; if (sizeof($searchStringArray)>0){ $searchTerms = current($searchStringArray); $parameters['var'] = "%".$searchTerms."%"; $searchQueryWhere = "WHERE ( p.name LIKE :var ".$searchQueryWhere; $first = false; } elseif (sizeof($searchStringArray)==0){ $searchQueryWhere = " WHERE ( ".$searchQueryWhere; } if ($category){ $parameters['category'] = $category; $searchQuerySelectJoin .= " LEFT JOIN p.profilecategory pc "; if (!$first){ $searchQueryWhere .= " AND pc.name = :category "; }else { $first = false; $searchQueryWhere .= " pc.name = :category "; } } if ($brand){ $parameters['brand'] = $brand; $searchQuerySelectJoin .= " LEFT JOIN p.brand b "; if (!$first){ $searchQueryWhere .= " AND b.name = :brand "; }else { $first = false; $searchQueryWhere .= " b.name = :brand "; } } if ($city){ $parameters['city'] = $city; $searchQuerySelectJoin .= " LEFT JOIN d.city c "; if (!$first){ $searchQueryWhere .= " AND c.name = :city "; }else { $first = false; $searchQueryWhere .= " c.name = :city "; } } ////////////////////////// if($isMapSearch == true){ $searchQuery .= "AND d.latitude IS NOT NULL "; } $searchQuery = $searchQuerySelectJoin.$searchQueryWhere." ) ORDER BY p.name ASC"; echo $searchQuery; $query = $this->getEntityManager() ->createQuery( $searchQuery )->setParameters($parameters); return $query->getResult(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IUQt1
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'profilerepository', 'entityrepository'
  119     1      > RETURN                                                   1

Class ProfileRepository:
Function getprofilesexperimental:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 42
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 42
2 jumps found. (Code = 77) Position 1 = 44, Position 2 = 55
Branch analysis from position: 44
2 jumps found. (Code = 78) Position 1 = 45, Position 2 = 55
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 55
2 jumps found. (Code = 77) Position 1 = 57, Position 2 = 68
Branch analysis from position: 57
2 jumps found. (Code = 78) Position 1 = 58, Position 2 = 68
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 122, Position 2 = 134
Branch analysis from position: 122
1 jumps found. (Code = 42) Position 1 = 139
Branch analysis from position: 139
2 jumps found. (Code = 43) Position 1 = 140, Position 2 = 149
Branch analysis from position: 140
2 jumps found. (Code = 43) Position 1 = 145, Position 2 = 147
Branch analysis from position: 145
1 jumps found. (Code = 42) Position 1 = 149
Branch analysis from position: 149
2 jumps found. (Code = 43) Position 1 = 150, Position 2 = 159
Branch analysis from position: 150
2 jumps found. (Code = 43) Position 1 = 155, Position 2 = 157
Branch analysis from position: 155
1 jumps found. (Code = 42) Position 1 = 159
Branch analysis from position: 159
2 jumps found. (Code = 43) Position 1 = 160, Position 2 = 169
Branch analysis from position: 160
2 jumps found. (Code = 43) Position 1 = 165, Position 2 = 167
Branch analysis from position: 165
1 jumps found. (Code = 42) Position 1 = 169
Branch analysis from position: 169
2 jumps found. (Code = 43) Position 1 = 171, Position 2 = 172
Branch analysis from position: 171
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 172
Branch analysis from position: 167
2 jumps found. (Code = 43) Position 1 = 171, Position 2 = 172
Branch analysis from position: 171
Branch analysis from position: 172
Branch analysis from position: 169
Branch analysis from position: 157
2 jumps found. (Code = 43) Position 1 = 160, Position 2 = 169
Branch analysis from position: 160
Branch analysis from position: 169
Branch analysis from position: 159
Branch analysis from position: 147
2 jumps found. (Code = 43) Position 1 = 150, Position 2 = 159
Branch analysis from position: 150
Branch analysis from position: 159
Branch analysis from position: 149
Branch analysis from position: 134
2 jumps found. (Code = 43) Position 1 = 137, Position 2 = 139
Branch analysis from position: 137
2 jumps found. (Code = 43) Position 1 = 140, Position 2 = 149
Branch analysis from position: 140
Branch analysis from position: 149
Branch analysis from position: 139
Branch analysis from position: 68
Branch analysis from position: 55
Branch analysis from position: 42
filename:       /in/IUQt1
function name:  getProfilesExperimental
number of ops:  189
compiled vars:  !0 = $searchString, !1 = $isMapSearch, !2 = $em, !3 = $cit, !4 = $cat, !5 = $bra, !6 = $cities, !7 = $profilecategories, !8 = $brands, !9 = $city, !10 = $category, !11 = $brand, !12 = $parameters, !13 = $searchQuerySelectJoin, !14 = $searchQueryWhere, !15 = $searchStringArray, !16 = $removeWords, !17 = $first, !18 = $searchTerms, !19 = $searchQuery, !20 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    7     2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $21     
          5        ASSIGN                                                   !0, $21
    9     6        INIT_METHOD_CALL                                         'getEntityManager'
          7        DO_FCALL                                      0  $23     
          8        ASSIGN                                                   !2, $23
   10     9        INIT_METHOD_CALL                                         !2, 'getRepository'
         10        SEND_VAL_EX                                              'LunnarBundle%3ACity'
         11        DO_FCALL                                      0  $25     
         12        INIT_METHOD_CALL                                         $25, 'findAll'
         13        DO_FCALL                                      0  $26     
         14        ASSIGN                                                   !3, $26
   11    15        INIT_METHOD_CALL                                         !2, 'getRepository'
         16        SEND_VAL_EX                                              'LunnarBundle%3AProfilecategory'
         17        DO_FCALL                                      0  $28     
         18        INIT_METHOD_CALL                                         $28, 'findAll'
         19        DO_FCALL                                      0  $29     
         20        ASSIGN                                                   !4, $29
   12    21        INIT_METHOD_CALL                                         !2, 'getRepository'
         22        SEND_VAL_EX                                              'LunnarBundle%3ABrand'
         23        DO_FCALL                                      0  $31     
         24        INIT_METHOD_CALL                                         $31, 'findAll'
         25        DO_FCALL                                      0  $32     
         26        ASSIGN                                                   !5, $32
   14    27        ASSIGN                                                   !6, <array>
   15    28        ASSIGN                                                   !7, <array>
   16    29        ASSIGN                                                   !8, <array>
   17    30      > FE_RESET_R                                       $37     !3, ->42
         31    > > FE_FETCH_R                                               $37, !9, ->42
   18    32    >   INIT_FCALL                                               'array_push'
         33        SEND_REF                                                 !6
         34        INIT_FCALL                                               'strtolower'
         35        INIT_METHOD_CALL                                         !9, 'getName'
         36        DO_FCALL                                      0  $38     
         37        SEND_VAR                                                 $38
         38        DO_ICALL                                         $39     
         39        SEND_VAR                                                 $39
         40        DO_ICALL                                                 
   17    41      > JMP                                                      ->31
         42    >   FE_FREE                                                  $37
   20    43      > FE_RESET_R                                       $41     !4, ->55
         44    > > FE_FETCH_R                                               $41, !10, ->55
   21    45    >   INIT_FCALL                                               'array_push'
         46        SEND_REF                                                 !7
         47        INIT_FCALL                                               'strtolower'
         48        INIT_METHOD_CALL                                         !10, 'getName'
         49        DO_FCALL                                      0  $42     
         50        SEND_VAR                                                 $42
         51        DO_ICALL                                         $43     
         52        SEND_VAR                                                 $43
         53        DO_ICALL                                                 
   20    54      > JMP                                                      ->44
         55    >   FE_FREE                                                  $41
   23    56      > FE_RESET_R                                       $45     !5, ->68
         57    > > FE_FETCH_R                                               $45, !11, ->68
   24    58    >   INIT_FCALL                                               'array_push'
         59        SEND_REF                                                 !8
         60        INIT_FCALL                                               'strtolower'
         61        INIT_METHOD_CALL                                         !11, 'getName'
         62        DO_FCALL                                      0  $46     
         63        SEND_VAR                                                 $46
         64        DO_ICALL                                         $47     
         65        SEND_VAR                                                 $47
         66        DO_ICALL                                                 
   23    67      > JMP                                                      ->57
         68    >   FE_FREE                                                  $45
   27    69        ASSIGN                                                   !12, <array>
   31    70        ASSIGN                                                   !13, 'SELECT+p+FROM+LunnarBundle%3AProfile+p+LEFT+JOIN+p.divisions+d+'
   33    71        ASSIGN                                                   !14, ''
   37    72        INIT_FCALL                                               'explode'
         73        SEND_VAL                                                 '+'
         74        SEND_VAR                                                 !0
         75        DO_ICALL                                         $52     
         76        ASSIGN                                                   !15, $52
   40    77        ASSIGN                                                   !16, <array>
   43    78        INIT_FCALL                                               'array_diff'
         79        SEND_VAR                                                 !15
         80        SEND_VAR                                                 !16
         81        DO_ICALL                                         $55     
         82        ASSIGN                                                   !15, $55
   44    83        INIT_FCALL                                               'array_intersect'
         84        SEND_VAR                                                 !15
         85        SEND_VAR                                                 !6
         86        DO_ICALL                                         $57     
         87        ASSIGN                                                   !9, $57
   45    88        INIT_FCALL                                               'array_diff'
         89        SEND_VAR                                                 !15
         90        SEND_VAR                                                 !9
         91        DO_ICALL                                         $59     
         92        ASSIGN                                                   !15, $59
   46    93        INIT_FCALL                                               'array_intersect'
         94        SEND_VAR                                                 !15
         95        SEND_VAR                                                 !7
         96        DO_ICALL                                         $61     
         97        ASSIGN                                                   !10, $61
   47    98        INIT_FCALL                                               'array_diff'
         99        SEND_VAR                                                 !15
        100        SEND_VAR                                                 !10
        101        DO_ICALL                                         $63     
        102        ASSIGN                                                   !15, $63
   48   103        INIT_FCALL                                               'array_intersect'
        104        SEND_VAR                                                 !15
        105        SEND_VAR                                                 !8
        106        DO_ICALL                                         $65     
        107        ASSIGN                                                   !11, $65
   49   108        INIT_FCALL                                               'array_diff'
        109        SEND_VAR                                                 !15
        110        SEND_VAR                                                 !11
        111        DO_ICALL                                         $67     
        112        ASSIGN                                                   !15, $67
   52   113        INIT_FCALL                                               'print_r'
        114        SEND_VAR                                                 !15
        115        DO_ICALL                                                 
   53   116        ECHO                                                     '%3Cbr%2F%3E'
   58   117        ASSIGN                                                   !17, <true>
   59   118        ASSIGN                                                   !18, '+'
   60   119        COUNT                                            ~72     !15
        120        IS_SMALLER                                               0, ~72
        121      > JMPZ                                                     ~73, ->134
   61   122    >   INIT_FCALL                                               'current'
        123        SEND_VAR                                                 !15
        124        DO_ICALL                                         $74     
        125        ASSIGN                                                   !18, $74
   62   126        CONCAT                                           ~77     '%25', !18
        127        CONCAT                                           ~78     ~77, '%25'
        128        ASSIGN_DIM                                               !12, 'var'
        129        OP_DATA                                                  ~78
   63   130        CONCAT                                           ~79     'WHERE+%28+p.name+LIKE+%3Avar+', !14
        131        ASSIGN                                                   !14, ~79
   64   132        ASSIGN                                                   !17, <false>
        133      > JMP                                                      ->139
   65   134    >   COUNT                                            ~82     !15
        135        IS_EQUAL                                                 ~82, 0
        136      > JMPZ                                                     ~83, ->139
   66   137    >   CONCAT                                           ~84     '+WHERE+%28+', !14
        138        ASSIGN                                                   !14, ~84
   69   139    > > JMPZ                                                     !10, ->149
   70   140    >   ASSIGN_DIM                                               !12, 'category'
        141        OP_DATA                                                  !10
   71   142        ASSIGN_OP                                     8          !13, '+LEFT+JOIN+p.profilecategory+pc+'
   72   143        BOOL_NOT                                         ~88     !17
        144      > JMPZ                                                     ~88, ->147
   73   145    >   ASSIGN_OP                                     8          !14, '+AND+pc.name+%3D+%3Acategory+'
        146      > JMP                                                      ->149
   75   147    >   ASSIGN                                                   !17, <false>
   76   148        ASSIGN_OP                                     8          !14, '+pc.name+%3D+%3Acategory+'
   80   149    > > JMPZ                                                     !11, ->159
   81   150    >   ASSIGN_DIM                                               !12, 'brand'
        151        OP_DATA                                                  !11
   82   152        ASSIGN_OP                                     8          !13, '+LEFT+JOIN+p.brand+b+'
   83   153        BOOL_NOT                                         ~94     !17
        154      > JMPZ                                                     ~94, ->157
   84   155    >   ASSIGN_OP                                     8          !14, '+AND+b.name+%3D+%3Abrand+'
        156      > JMP                                                      ->159
   86   157    >   ASSIGN                                                   !17, <false>
   87   158        ASSIGN_OP                                     8          !14, '+b.name+%3D+%3Abrand+'
   91   159    > > JMPZ                                                     !9, ->169
   92   160    >   ASSIGN_DIM                                               !12, 'city'
        161        OP_DATA                                                  !9
   93   162        ASSIGN_OP                                     8          !13, '+LEFT+JOIN+d.city+c+'
   94   163        BOOL_NOT                                         ~100    !17
        164      > JMPZ                                                     ~100, ->167
   95   165    >   ASSIGN_OP                                     8          !14, '+AND+c.name+%3D+%3Acity+'
        166      > JMP                                                      ->169
   97   167    >   ASSIGN                                                   !17, <false>
   98   168        ASSIGN_OP                                     8          !14, '+c.name+%3D+%3Acity+'
  103   169    >   BOOL                                             ~104    !1
        170      > JMPZ                                                     ~104, ->172
  104   171    >   ASSIGN_OP                                     8          !19, 'AND+d.latitude+IS+NOT+NULL+'
  107   172    >   CONCAT                                           ~106    !13, !14
        173        CONCAT                                           ~107    ~106, '+%29+ORDER+BY+p.name+ASC'
        174        ASSIGN                                                   !19, ~107
  109   175        ECHO                                                     !19
  110   176        INIT_METHOD_CALL                                         'getEntityManager'
        177        DO_FCALL                                      0  $109    
  111   178        INIT_METHOD_CALL                                         $109, 'createQuery'
  112   179        SEND_VAR_EX                                              !19
        180        DO_FCALL                                      0  $110    
  113   181        INIT_METHOD_CALL                                         $110, 'setParameters'
        182        SEND_VAR_EX                                              !12
        183        DO_FCALL                                      0  $111    
  110   184        ASSIGN                                                   !20, $111
  115   185        INIT_METHOD_CALL                                         !20, 'getResult'
        186        DO_FCALL                                      0  $113    
        187      > RETURN                                                   $113
  117   188*     > RETURN                                                   null

End of function getprofilesexperimental

End of class ProfileRepository.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.53 ms | 1421 KiB | 27 Q