3v4l.org

run code in 300+ PHP versions simultaneously
<?php // All of the code needed for this test. function __( $text ) { return $text; } /** * Webfonts Schema Validator. * * Validates the webfont schema. */ class WP_Webfonts_Schema_Validator { /** * Valid font styles. * * @since 5.9.0 * * @var string[] */ const VALID_FONT_STYLE = array( 'normal', 'italic', 'oblique', 'inherit', 'initial', 'revert', 'unset' ); /** * Valid font display values. * * @since 5.9.0 * * @var string[] */ const VALID_FONT_DISPLAY = array( 'auto', 'block', 'fallback', 'swap' ); /** * Valid font weight values. * * @since 5.9.0 * * @var string[] */ const VALID_FONT_WEIGHT = array( 'normal', 'bold', 'bolder', 'lighter', 'inherit' ); /** * An array of valid CSS properties for @font-face. * * @since 5.9.0 * * @var string[] */ protected $font_face_properties = array( 'ascend-override', 'descend-override', 'font-display', 'font-family', 'font-stretch', 'font-style', 'font-weight', 'font-variant', 'font-feature-settings', 'font-variation-settings', 'line-gap-override', 'size-adjust', 'src', 'unicode-range', ); /** * Basic schema structure. * * @since 5.9.0 * * @var array */ protected $basic_schema = array( 'provider' => '', 'font-family' => '', 'font-style' => 'normal', 'font-weight' => '400', 'font-display' => 'fallback', ); /** * Webfont being validated. * * Set as a property for performance. * * @var array */ private $webfont = array(); /** * Checks if the given webfont schema is valid. * * @since 5.9.0 * * @param array $webfont Webfont to validate. * @return bool True when valid. False when invalid. */ public function is_valid_schema( array $webfont ) { $is_valid = ( $this->is_valid_provider( $webfont ) && $this->is_valid_font_family( $webfont ) ); if ( ! $is_valid ) { return false; } if ( 'local' === $webfont['provider'] || array_key_exists( 'src', $webfont ) ) { $is_valid = $this->is_src_valid( $webfont ); } return $is_valid; } /** * Checks if the provider is validate. * * @since 5.9.0 * * @param array $webfont Webfont to validate. * @return bool True if valid. False if invalid. */ private function is_valid_provider( array $webfont ) { // @todo check if provider is registered. if ( empty( $webfont['provider'] ) || ! is_string( $webfont['provider'] ) ) { trigger_error( __( 'Webfont provider must be a non-empty string.' ) ); return false; } return true; } /** * Checks if the font family is validate. * * @since 5.9.0 * * @param array $webfont Webfont to validate. * @return bool True when valid. False when invalid. */ private function is_valid_font_family( array $webfont ) { if ( empty( $webfont['font-family'] ) || ! is_string( $webfont['font-family'] ) ) { trigger_error( __( 'Webfont font family must be a non-empty string.' ) ); return false; } return true; } /** * Checks if the "src" value is valid. * * @since 5.9.0 * * @param array $webfont Webfont to validate. * @return bool True if valid. False if invalid. */ private function is_src_valid( $webfont ) { if ( empty( $webfont['src'] ) || ( ! is_string( $webfont['src'] ) && ! is_array( $webfont['src'] ) ) ) { trigger_error( __( 'Webfont src must be a non-empty string or an array of strings.' ) ); return false; } foreach ( (array) $webfont['src'] as $src ) { if ( ! is_string( $src ) ) { trigger_error( __( 'Each webfont src must be a non-empty string.' ) ); return false; } if ( ! $this->is_src_value_valid( $src ) ) { trigger_error( __( 'Webfont src must be a valid URL or a data URI.' ) ); return false; } } return true; } /** * Checks if the given `src` value is valid. * * @since 5.9.0 * * @param string $src Source to validate. * @return bool True when valid. False when invalid. */ private function is_src_value_valid( $src ) { // Validate data URLs. if ( preg_match( '/^data:.+;base64/', $src ) ) { return true; } // Validate URLs. if ( filter_var( $src, FILTER_VALIDATE_URL ) ) { return true; } // Check if it's a URL starting with "//" (omitted protocol). if ( 0 === strpos( $src, '//' ) ) { return true; } // Check if it's a relative URL. if ( 0 === strpos( $src, 'file:./' ) ) { return true; } return false; } /** * Sets valid properties. * * @since 5.9.0 * * @param array $webfont Webfont definition. * @return array Updated webfont. */ public function set_valid_properties( array $webfont ) { $this->webfont = array_merge( $this->basic_schema, $webfont ); $this->set_valid_font_face_property(); $this->set_valid_font_style(); $this->set_valid_font_weight(); $this->set_valid_font_display(); $webfont = $this->webfont; $this->webfont = array(); // Reset property. return $webfont; } /** * Checks if the CSS property is valid for @font-face. * * @since 5.9.0 */ private function set_valid_font_face_property() { foreach ( array_keys( $this->webfont ) as $property ) { /* * Skip valid configuration parameters (these are configuring the webfont * but are not @font-face properties. */ if ( 'provider' === $property ) { continue; } if ( ! in_array( $property, $this->font_face_properties, true ) ) { unset( $this->webfont[ $property ] ); } } } /** * Checks if the font style is validate. * * @since 5.9.0 */ private function set_valid_font_style() { // If empty or not a string, trigger an error and then set the default value. if ( empty( $this->webfont['font-style'] ) || ! is_string( $this->webfont['font-style'] ) ) { trigger_error( __( 'Webfont font style must be a non-empty string.' ) ); } elseif ( // Bail out if the font-weight is a valid value. in_array( $this->webfont['font-style'], self::VALID_FONT_STYLE, true ) || preg_match( '/^oblique\s+(\d+)%/', $this->webfont['font-style'] ) ) { return; } $this->webfont['font-style'] = 'normal'; } /** * Sets a default font weight if invalid. * * @since 5.9.0 */ private function set_valid_font_weight() { // If empty or not a string, trigger an error and then set the default value. if ( empty( $this->webfont['font-weight'] ) || ! is_string( $this->webfont['font-weight'] ) ) { trigger_error( __( 'Webfont font weight must be a non-empty string.' ) ); } elseif ( // Bail out if the font-weight is a valid value. // Check if value is a single font-weight, formatted as a number. in_array( $this->webfont['font-weight'], self::VALID_FONT_WEIGHT, true ) || // Check if value is a single font-weight, formatted as a number. preg_match( '/^(\d+)$/', $this->webfont['font-weight'], $matches ) || // Check if value is a range of font-weights, formatted as a number range. preg_match( '/^(\d+)\s+(\d+)$/', $this->webfont['font-weight'], $matches ) ) { return; } // Not valid. Set the default value. $this->webfont['font-weight'] = '400'; } /** * Sets a default font display if invalid. * * @since 5.9.0 */ private function set_valid_font_display() { if ( ! empty( $this->webfont['font-display'] ) && in_array( $this->webfont['font-display'], self::VALID_FONT_DISPLAY, true ) ) { return; } $this->webfont['font-display'] = 'fallback'; } } class Profiler { private $validator; private $total_in_microseconds = 0.0; private $cycles = 0; public function __construct( $validator ) { $this->validator = $validator; } public function register( array $webfont ) { $webfont = $this->convert_to_kabeb_case( $webfont ); $this->cycles++; $start_time = microtime( true ); // Validate schema. if ( ! $this->validator->is_valid_schema( $webfont ) ) { // return ''; // Skip for this test. } $webfont = $this->validator->set_valid_properties( $webfont ); // Do the registration. // Get stats. $end_time = microtime( true ); $this->total_in_microseconds += ( $end_time - $start_time ) * 1000000.0; // store in microseconds. } private function convert_to_kabeb_case( array $webfont ) { $kebab_case = preg_replace( '/(?<!^)[A-Z]/', '-$0', array_keys( $webfont ) ); $kebab_case = array_map( 'strtolower', $kebab_case ); return array_combine( $kebab_case, array_values( $webfont ) ); } public function get_avg_microseconds() { return $this->total_in_microseconds / $this->cycles; } } // Let's Go! $profiler = new Profiler( new WP_Webfonts_Schema_Validator() ); $webfont = array( 'fontFamily' => 'Source Serif Pro', 'fontWeight' => '200 900', 'fontStyle' => 'normal', 'fontStretch' => 'normal', 'src' => 'file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2', 'provider' => 'local', ); /** * Benchmark the average time the Validator takes to validate a single webfont. * The profiler is set to 10,000 cycles to get a fair sampling and distribution. */ $num_time_to_run_validator = 10000; // do work. for ( $i = 1; $i <= $num_time_to_run_validator; $i++ ) { $profiler->register( $webfont ); } printf( "Ran %d in %s microseconds", $num_time_to_run_validator, number_format( $profiler->get_avg_microseconds(), 4 ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
Branch analysis from position: 10
filename:       /in/BbY12
function name:  (null)
number of ops:  28
compiled vars:  !0 = $profiler, !1 = $webfont, !2 = $num_time_to_run_validator, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  385     0  E >   NEW                                              $4      'Profiler'
          1        NEW                                              $5      'WP_Webfonts_Schema_Validator'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $5
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
  386     6        ASSIGN                                                   !1, <array>
  401     7        ASSIGN                                                   !2, 10000
  404     8        ASSIGN                                                   !3, 1
          9      > JMP                                                      ->14
  405    10    >   INIT_METHOD_CALL                                         !0, 'register'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
  404    13        PRE_INC                                                  !3
         14    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         15      > JMPNZ                                                    ~14, ->10
  408    16    >   INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 'Ran+%25d+in+%25s+microseconds'
  409    18        SEND_VAR                                                 !2
  410    19        INIT_FCALL                                               'number_format'
         20        INIT_METHOD_CALL                                         !0, 'get_avg_microseconds'
         21        DO_FCALL                                      0  $15     
         22        SEND_VAR                                                 $15
         23        SEND_VAL                                                 4
         24        DO_ICALL                                         $16     
         25        SEND_VAR                                                 $16
  408    26        DO_ICALL                                                 
  411    27      > RETURN                                                   1

Function __:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BbY12
function name:  __
number of ops:  3
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1      > RETURN                                                   !0
    8     2*     > RETURN                                                   null

End of function __

Class WP_Webfonts_Schema_Validator:
Function is_valid_schema:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/BbY12
function name:  is_valid_schema
number of ops:  25
compiled vars:  !0 = $webfont, !1 = $is_valid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  100     0  E >   RECV                                             !0      
  102     1        INIT_METHOD_CALL                                         'is_valid_provider'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4      > JMPZ_EX                                          ~3      $2, ->9
  103     5    >   INIT_METHOD_CALL                                         'is_valid_font_family'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        BOOL                                             ~3      $4
  101     9    >   ASSIGN                                                   !1, ~3
  106    10        BOOL_NOT                                         ~6      !1
         11      > JMPZ                                                     ~6, ->13
  107    12    > > RETURN                                                   <false>
  110    13    >   FETCH_DIM_R                                      ~7      !0, 'provider'
         14        IS_IDENTICAL                                     ~8      ~7, 'local'
         15      > JMPNZ_EX                                         ~8      ~8, ->18
         16    >   ARRAY_KEY_EXISTS                                 ~9      'src', !0
         17        BOOL                                             ~8      ~9
         18    > > JMPZ                                                     ~8, ->23
  111    19    >   INIT_METHOD_CALL                                         'is_src_valid'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $10     
         22        ASSIGN                                                   !1, $10
  114    23    > > RETURN                                                   !1
  115    24*     > RETURN                                                   null

End of function is_valid_schema

Function is_valid_provider:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/BbY12
function name:  is_valid_provider
number of ops:  17
compiled vars:  !0 = $webfont
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  125     0  E >   RECV                                             !0      
  129     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      !0, 'provider'
          2      > JMPNZ_EX                                         ~1      ~1, ->7
  130     3    >   FETCH_DIM_R                                      ~2      !0, 'provider'
          4        TYPE_CHECK                                   64  ~3      ~2
          5        BOOL_NOT                                         ~4      ~3
          6        BOOL                                             ~1      ~4
          7    > > JMPZ                                                     ~1, ->15
  132     8    >   INIT_FCALL                                               'trigger_error'
          9        INIT_FCALL                                               '__'
         10        SEND_VAL                                                 'Webfont+provider+must+be+a+non-empty+string.'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
  134    14      > RETURN                                                   <false>
  137    15    > > RETURN                                                   <true>
  138    16*     > RETURN                                                   null

End of function is_valid_provider

Function is_valid_font_family:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/BbY12
function name:  is_valid_font_family
number of ops:  17
compiled vars:  !0 = $webfont
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  148     0  E >   RECV                                             !0      
  150     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      !0, 'font-family'
          2      > JMPNZ_EX                                         ~1      ~1, ->7
  151     3    >   FETCH_DIM_R                                      ~2      !0, 'font-family'
          4        TYPE_CHECK                                   64  ~3      ~2
          5        BOOL_NOT                                         ~4      ~3
          6        BOOL                                             ~1      ~4
          7    > > JMPZ                                                     ~1, ->15
  153     8    >   INIT_FCALL                                               'trigger_error'
          9        INIT_FCALL                                               '__'
         10        SEND_VAL                                                 'Webfont+font+family+must+be+a+non-empty+string.'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
  155    14      > RETURN                                                   <false>
  158    15    > > RETURN                                                   <true>
  159    16*     > RETURN                                                   null

End of function is_valid_font_family

Function is_src_valid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 49
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 49
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 48
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 11
Branch analysis from position: 12
filename:       /in/BbY12
function name:  is_src_valid
number of ops:  52
compiled vars:  !0 = $webfont, !1 = $src
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  169     0  E >   RECV                                             !0      
  171     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~2      !0, 'src'
          2      > JMPNZ_EX                                         ~2      ~2, ->12
  173     3    >   FETCH_DIM_R                                      ~3      !0, 'src'
          4        TYPE_CHECK                                   64  ~4      ~3
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ_EX                                          ~5      ~5, ->11
          7    >   FETCH_DIM_R                                      ~6      !0, 'src'
          8        TYPE_CHECK                                  128  ~7      ~6
          9        BOOL_NOT                                         ~8      ~7
         10        BOOL                                             ~5      ~8
         11    >   BOOL                                             ~2      ~5
         12    > > JMPZ                                                     ~2, ->20
  176    13    >   INIT_FCALL                                               'trigger_error'
         14        INIT_FCALL                                               '__'
         15        SEND_VAL                                                 'Webfont+src+must+be+a+non-empty+string+or+an+array+of+strings.'
         16        DO_FCALL                                      0  $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                                 
  178    19      > RETURN                                                   <false>
  181    20    >   FETCH_DIM_R                                      ~11     !0, 'src'
         21        CAST                                          7  ~12     ~11
         22      > FE_RESET_R                                       $13     ~12, ->49
         23    > > FE_FETCH_R                                               $13, !1, ->49
  182    24    >   TYPE_CHECK                                   64  ~14     !1
         25        BOOL_NOT                                         ~15     ~14
         26      > JMPZ                                                     ~15, ->35
  183    27    >   INIT_FCALL                                               'trigger_error'
         28        INIT_FCALL                                               '__'
         29        SEND_VAL                                                 'Each+webfont+src+must+be+a+non-empty+string.'
         30        DO_FCALL                                      0  $16     
         31        SEND_VAR                                                 $16
         32        DO_ICALL                                                 
  185    33        FE_FREE                                                  $13
         34      > RETURN                                                   <false>
  188    35    >   INIT_METHOD_CALL                                         'is_src_value_valid'
         36        SEND_VAR_EX                                              !1
         37        DO_FCALL                                      0  $18     
         38        BOOL_NOT                                         ~19     $18
         39      > JMPZ                                                     ~19, ->48
  189    40    >   INIT_FCALL                                               'trigger_error'
         41        INIT_FCALL                                               '__'
         42        SEND_VAL                                                 'Webfont+src+must+be+a+valid+URL+or+a+data+URI.'
         43        DO_FCALL                                      0  $20     
         44        SEND_VAR                                                 $20
         45        DO_ICALL                                                 
  191    46        FE_FREE                                                  $13
         47      > RETURN                                                   <false>
  181    48    > > JMP                                                      ->23
         49    >   FE_FREE                                                  $13
  195    50      > RETURN                                                   <true>
  196    51*     > RETURN                                                   null

End of function is_src_valid

Function is_src_value_valid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BbY12
function name:  is_src_value_valid
number of ops:  29
compiled vars:  !0 = $src
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  206     0  E >   RECV                                             !0      
  208     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5Edata%3A.%2B%3Bbase64%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->7
  209     6    > > RETURN                                                   <true>
  213     7    >   INIT_FCALL                                               'filter_var'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 273
         10        DO_ICALL                                         $2      
         11      > JMPZ                                                     $2, ->13
  214    12    > > RETURN                                                   <true>
  218    13    >   INIT_FCALL                                               'strpos'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 '%2F%2F'
         16        DO_ICALL                                         $3      
         17        IS_IDENTICAL                                             $3, 0
         18      > JMPZ                                                     ~4, ->20
  219    19    > > RETURN                                                   <true>
  223    20    >   INIT_FCALL                                               'strpos'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 'file%3A.%2F'
         23        DO_ICALL                                         $5      
         24        IS_IDENTICAL                                             $5, 0
         25      > JMPZ                                                     ~6, ->27
  224    26    > > RETURN                                                   <true>
  227    27    > > RETURN                                                   <false>
  228    28*     > RETURN                                                   null

End of function is_src_value_valid

Function set_valid_properties:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BbY12
function name:  set_valid_properties
number of ops:  22
compiled vars:  !0 = $webfont
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  238     0  E >   RECV                                             !0      
  239     1        INIT_FCALL                                               'array_merge'
          2        FETCH_OBJ_R                                      ~2      'basic_schema'
          3        SEND_VAL                                                 ~2
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN_OBJ                                               'webfont'
          7        OP_DATA                                                  $3
  241     8        INIT_METHOD_CALL                                         'set_valid_font_face_property'
          9        DO_FCALL                                      0          
  242    10        INIT_METHOD_CALL                                         'set_valid_font_style'
         11        DO_FCALL                                      0          
  243    12        INIT_METHOD_CALL                                         'set_valid_font_weight'
         13        DO_FCALL                                      0          
  244    14        INIT_METHOD_CALL                                         'set_valid_font_display'
         15        DO_FCALL                                      0          
  246    16        FETCH_OBJ_R                                      ~8      'webfont'
         17        ASSIGN                                                   !0, ~8
  247    18        ASSIGN_OBJ                                               'webfont'
         19        OP_DATA                                                  <array>
  249    20      > RETURN                                                   !0
  250    21*     > RETURN                                                   null

End of function set_valid_properties

Function set_valid_font_face_property:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/BbY12
function name:  set_valid_font_face_property
number of ops:  22
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  258     0  E >   INIT_FCALL                                               'array_keys'
          1        FETCH_OBJ_R                                      ~1      'webfont'
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                         $2      
          4      > FE_RESET_R                                       $3      $2, ->20
          5    > > FE_FETCH_R                                               $3, !0, ->20
  263     6    >   IS_IDENTICAL                                             !0, 'provider'
          7      > JMPZ                                                     ~4, ->9
  264     8    > > JMP                                                      ->5
  267     9    >   INIT_FCALL                                               'in_array'
         10        SEND_VAR                                                 !0
         11        FETCH_OBJ_R                                      ~5      'font_face_properties'
         12        SEND_VAL                                                 ~5
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $6      
         15        BOOL_NOT                                         ~7      $6
         16      > JMPZ                                                     ~7, ->19
  268    17    >   FETCH_OBJ_UNSET                                  $8      'webfont'
         18        UNSET_DIM                                                $8, !0
  258    19    > > JMP                                                      ->5
         20    >   FE_FREE                                                  $3
  271    21      > RETURN                                                   null

End of function set_valid_font_face_property

Function set_valid_font_style:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 31
Branch analysis from position: 8
filename:       /in/BbY12
function name:  set_valid_font_style
number of ops:  37
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  281     0  E >   FETCH_OBJ_IS                                     ~0      'webfont'
          1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      ~0, 'font-style'
          2      > JMPNZ_EX                                         ~1      ~1, ->8
  282     3    >   FETCH_OBJ_R                                      ~2      'webfont'
          4        FETCH_DIM_R                                      ~3      ~2, 'font-style'
          5        TYPE_CHECK                                   64  ~4      ~3
          6        BOOL_NOT                                         ~5      ~4
          7        BOOL                                             ~1      ~5
          8    > > JMPZ                                                     ~1, ->16
  284     9    >   INIT_FCALL                                               'trigger_error'
         10        INIT_FCALL                                               '__'
         11        SEND_VAL                                                 'Webfont+font+style+must+be+a+non-empty+string.'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
  281    15      > JMP                                                      ->33
  287    16    >   INIT_FCALL                                               'in_array'
         17        FETCH_OBJ_R                                      ~8      'webfont'
         18        FETCH_DIM_R                                      ~9      ~8, 'font-style'
         19        SEND_VAL                                                 ~9
         20        SEND_VAL                                                 <array>
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $10     
         23      > JMPNZ_EX                                         ~11     $10, ->31
  288    24    >   INIT_FCALL                                               'preg_match'
         25        SEND_VAL                                                 '%2F%5Eoblique%5Cs%2B%28%5Cd%2B%29%25%2F'
         26        FETCH_OBJ_R                                      ~12     'webfont'
         27        FETCH_DIM_R                                      ~13     ~12, 'font-style'
         28        SEND_VAL                                                 ~13
         29        DO_ICALL                                         $14     
         30        BOOL                                             ~11     $14
         31    > > JMPZ                                                     ~11, ->33
  290    32    > > RETURN                                                   null
  293    33    >   FETCH_OBJ_W                                      $15     'webfont'
         34        ASSIGN_DIM                                               $15, 'font-style'
         35        OP_DATA                                                  'normal'
  294    36      > RETURN                                                   null

End of function set_valid_font_style

Function set_valid_font_weight:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 33, Position 2 = 41
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 41
Branch analysis from position: 32
Branch analysis from position: 8
filename:       /in/BbY12
function name:  set_valid_font_weight
number of ops:  47
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  304     0  E >   FETCH_OBJ_IS                                     ~1      'webfont'
          1        ISSET_ISEMPTY_DIM_OBJ                         1  ~2      ~1, 'font-weight'
          2      > JMPNZ_EX                                         ~2      ~2, ->8
  305     3    >   FETCH_OBJ_R                                      ~3      'webfont'
          4        FETCH_DIM_R                                      ~4      ~3, 'font-weight'
          5        TYPE_CHECK                                   64  ~5      ~4
          6        BOOL_NOT                                         ~6      ~5
          7        BOOL                                             ~2      ~6
          8    > > JMPZ                                                     ~2, ->16
  307     9    >   INIT_FCALL                                               'trigger_error'
         10        INIT_FCALL                                               '__'
         11        SEND_VAL                                                 'Webfont+font+weight+must+be+a+non-empty+string.'
         12        DO_FCALL                                      0  $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
  304    15      > JMP                                                      ->43
  311 

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.26 ms | 1504 KiB | 29 Q