3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Piwik - free/libre analytics platform * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ namespace Piwik; use Piwik\Tests\Framework\Mock\File; function filesize($filename) { if (File::getFileSize() !== null) { return File::getFileSize(); } return \filesize($filename); } function file_exists($filename) { if (File::getFileExists() !== null) { return File::getFileExists(); } return \file_exists($filename); } class Test { public static function tester() { return file_exists('test'); } } namespace Piwik\Tests\Framework\Mock; class File { static $filesize = null; static $fileExists = null; public static function getFileSize() { return self::$filesize; } public static function setFileSize($filesize) { self::$filesize = $filesize; } public static function reset() { self::$filesize = null; self::$fileExists = null; } public static function getFileExists() { return self::$fileExists; } public static function setFileExists($exists) { self::$fileExists = $exists; } } File::setFileSize(1024 * 1024 * 101); File::setFileExists(true); var_dump(\Piwik\Test::tester());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'setFileSize'
          1        SEND_VAL                                                 105906176
          2        DO_FCALL                                      0          
   70     3        INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'setFileExists'
          4        SEND_VAL                                                 <true>
          5        DO_FCALL                                      0          
   72     6        INIT_NS_FCALL_BY_NAME                                    'Piwik%5CTests%5CFramework%5CMock%5Cvar_dump'
          7        INIT_STATIC_METHOD_CALL                                  'Piwik%5CTest', 'tester'
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR_NO_REF_EX                                       $2
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Function piwik%5Cfilesize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  Piwik\filesize
number of ops:  13
compiled vars:  !0 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'getFileSize'
          2        DO_FCALL                                      0  $1      
          3        TYPE_CHECK                                  1020          $1
          4      > JMPZ                                                     ~2, ->8
   15     5    >   INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'getFileSize'
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   18     8    >   INIT_FCALL                                               'filesize'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11      > RETURN                                                   $4
   19    12*     > RETURN                                                   null

End of function piwik%5Cfilesize

Function piwik%5Cfile_exists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  Piwik\file_exists
number of ops:  13
compiled vars:  !0 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'getFileExists'
          2        DO_FCALL                                      0  $1      
          3        TYPE_CHECK                                  1020          $1
          4      > JMPZ                                                     ~2, ->8
   24     5    >   INIT_STATIC_METHOD_CALL                                  'Piwik%5CTests%5CFramework%5CMock%5CFile', 'getFileExists'
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   27     8    >   INIT_FCALL                                               'file_exists'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11      > RETURN                                                   $4
   28    12*     > RETURN                                                   null

End of function piwik%5Cfile_exists

Class Piwik\Test:
Function tester:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  tester
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_NS_FCALL_BY_NAME                                    'Piwik%5Cfile_exists'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
          4*     > RETURN                                                   null

End of function tester

End of class Piwik\Test.

Class Piwik\Tests\Framework\Mock\File:
Function getfilesize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  getFileSize
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'filesize'
          1      > RETURN                                                   ~0
   45     2*     > RETURN                                                   null

End of function getfilesize

Function setfilesize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  setFileSize
number of ops:  4
compiled vars:  !0 = $filesize
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
   49     1        ASSIGN_STATIC_PROP                                       'filesize'
          2        OP_DATA                                                  !0
   50     3      > RETURN                                                   null

End of function setfilesize

Function reset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  reset
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E >   ASSIGN_STATIC_PROP                                       'filesize'
          1        OP_DATA                                                  null
   55     2        ASSIGN_STATIC_PROP                                       'fileExists'
          3        OP_DATA                                                  null
   56     4      > RETURN                                                   null

End of function reset

Function getfileexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  getFileExists
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'fileExists'
          1      > RETURN                                                   ~0
   61     2*     > RETURN                                                   null

End of function getfileexists

Function setfileexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/shrVv
function name:  setFileExists
number of ops:  4
compiled vars:  !0 = $exists
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   RECV                                             !0      
   65     1        ASSIGN_STATIC_PROP                                       'fileExists'
          2        OP_DATA                                                  !0
   66     3      > RETURN                                                   null

End of function setfileexists

End of class Piwik\Tests\Framework\Mock\File.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.05 ms | 1409 KiB | 19 Q