3v4l.org

run code in 300+ PHP versions simultaneously
<?php // @source https://refactoring.guru/ru/design-patterns/decorator/php/example#example-1 namespace RefactoringGuru\Decorator\RealWorld; /** * Интерфейс Компонента объявляет метод фильтрации, который должен быть * реализован всеми конкретными компонентами и декораторами. */ interface InputFormat { public function formatText(string $text): string; } /** * Конкретный Компонент является основным элементом декорирования. Он содержит * исходный текст как есть, без какой-либо фильтрации или форматирования. */ class TextInput implements InputFormat { public function formatText(string $text): string { return $text; } } /** * Базовый класс Декоратора не содержит реальной логики фильтрации или * форматирования. Его основная цель – реализовать базовую инфраструктуру * декорирования: поле для хранения обёрнутого компонента или другого декоратора * и базовый метод форматирования, который делегирует работу обёрнутому объекту. * Реальная работа по форматированию выполняется подклассами. */ class TextFormat implements InputFormat { /** * @var InputFormat */ protected $inputFormat; public function __construct(InputFormat $inputFormat) { $this->inputFormat = $inputFormat; } /** * Декоратор делегирует всю работу обёрнутому компоненту. */ public function formatText(string $text): string { return $this->inputFormat->formatText($text); } } /** * Этот Конкретный Декоратор удаляет все теги HTML из данного текста. */ class PlainTextFilter extends TextFormat { public function formatText(string $text): string { $text = parent::formatText($text); return strip_tags($text); } } /** * Этот Конкретный Декоратор удаляет только опасные теги и атрибуты HTML, * которые могут привести к XSS-уязвимости. */ class DangerousHTMLTagsFilter extends TextFormat { private $dangerousTagPatterns = [ "|<script.*?>([\s\S]*)?</script>|i", // ... ]; private $dangerousAttributes = [ "onclick", "onkeypress", // ... ]; public function formatText(string $text): string { $text = parent::formatText($text); foreach ($this->dangerousTagPatterns as $pattern) { $text = preg_replace($pattern, '', $text); } foreach ($this->dangerousAttributes as $attribute) { $text = preg_replace_callback('|<(.*?)>|', function ($matches) use ($attribute) { $result = preg_replace("|$attribute=|i", '', $matches[1]); return "<" . $result . ">"; }, $text); } return $text; } } /** * Этот Конкретный Декоратор предоставляет элементарное преобразование Markdown * → HTML. */ class MarkdownFormat extends TextFormat { public function formatText(string $text): string { $text = parent::formatText($text); // Форматирование элементов блока. $chunks = preg_split('|\n\n|', $text); foreach ($chunks as &$chunk) { // Форматирование заголовков. if (preg_match('|^#+|', $chunk)) { $chunk = preg_replace_callback('|^(#+)(.*?)$|', function ($matches) { $h = strlen($matches[1]); return "<h$h>" . trim($matches[2]) . "</h$h>"; }, $chunk); } // Форматирование параграфов. else { $chunk = "<p>$chunk</p>"; } } $text = implode("\n\n", $chunks); // Форматирование встроенных элементов. $text = preg_replace("|__(.*?)__|", '<strong>$1</strong>', $text); $text = preg_replace("|\*\*(.*?)\*\*|", '<strong>$1</strong>', $text); $text = preg_replace("|_(.*?)_|", '<em>$1</em>', $text); $text = preg_replace("|\*(.*?)\*|", '<em>$1</em>', $text); return $text; } } ///////////////////////////////////////////////////////////////////////////////////////// /** * Клиентский код может быть частью реального веб-сайта, который отображает * создаваемый пользователями контент. Поскольку он работает с модулями * форматирования через интерфейс компонента, ему всё равно, получает ли он * простой объект компонента или обёрнутый. */ function displayCommentAsAWebsite(InputFormat $format, string $text) { // .. echo $format->formatText($text); // .. } /** * Модули форматирования пользовательского ввода очень удобны при работе с * контентом, создаваемым пользователями. Отображение такого контента «как есть» * может быть очень опасным, особенно когда его могут создавать анонимные * пользователи (например, комментарии). Ваш сайт не только рискует получить * массу спам-ссылок, но также может быть подвергнут XSS-атакам. */ $dangerousComment = <<<HERE Hello! Nice blog post! Please visit my <a href='http://www.iwillhackyou.com'>homepage</a>. <script src="http://www.iwillhackyou.com/script.js"> performXSSAttack(); </script> HERE; ///////////////////////////////////////////////////////////////////////////////////////// /** * Наивное отображение комментариев (небезопасное). */ $naiveInput = new TextInput(); echo "Website renders comments without filtering (unsafe):\n"; displayCommentAsAWebsite($naiveInput, $dangerousComment); echo "\n\n\n"; ///////////////////////////////////////////////////////////////////////////////////////// /** * Отфильтрованное отображение комментариев (безопасное). */ $filteredInput = new PlainTextFilter($naiveInput); echo "Website renders comments after stripping all tags (safe):\n"; displayCommentAsAWebsite($filteredInput, $dangerousComment); echo "\n\n\n"; ///////////////////////////////////////////////////////////////////////////////////////// /** * Декоратор позволяет складывать несколько входных форматов для получения * точного контроля над отображаемым содержимым. */ $dangerousForumPost = <<<HERE # Welcome This is my first post on this **gorgeous** forum. <script src="http://www.iwillhackyou.com/script.js"> performXSSAttack(); </script> HERE; /** * Наивное отображение сообщений (небезопасное, без форматирования). */ $naiveInput = new TextInput(); echo "Website renders a forum post without filtering and formatting (unsafe, ugly):\n"; displayCommentAsAWebsite($naiveInput, $dangerousForumPost); echo "\n\n\n"; /** * Форматтер Markdown + фильтрация опасных тегов (безопасно, красиво). */ $text = new TextInput(); $markdown = new MarkdownFormat($text); $filteredInput = new DangerousHTMLTagsFilter($markdown); //$filteredInput = new PlainTextFilter($filteredInput); echo "Website renders a forum post after translating markdown markup" . " and filtering some dangerous HTML tags and attributes (safe, pretty):\n"; displayCommentAsAWebsite($filteredInput, $dangerousForumPost); echo "\n\n\n"; /////////////////////////////////////////////////////////////////////////////////////////
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  (null)
number of ops:  53
compiled vars:  !0 = $dangerousComment, !1 = $naiveInput, !2 = $filteredInput, !3 = $dangerousForumPost, !4 = $text, !5 = $markdown
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DECLARE_CLASS                                            'refactoringguru%5Cdecorator%5Crealworld%5Ctextinput'
   35     1        DECLARE_CLASS                                            'refactoringguru%5Cdecorator%5Crealworld%5Ctextformat'
   59     2        DECLARE_CLASS                                            'refactoringguru%5Cdecorator%5Crealworld%5Cplaintextfilter', 'refactoringguru%5Cdecorator%5Crealworld%5Ctextformat'
   72     3        DECLARE_CLASS                                            'refactoringguru%5Cdecorator%5Crealworld%5Cdangeroushtmltagsfilter', 'refactoringguru%5Cdecorator%5Crealworld%5Ctextformat'
  106     4        DECLARE_CLASS                                            'refactoringguru%5Cdecorator%5Crealworld%5Cmarkdownformat', 'refactoringguru%5Cdecorator%5Crealworld%5Ctextformat'
  162     5        ASSIGN                                                   !0, 'Hello%21+Nice+blog+post%21%0APlease+visit+my+%3Ca+href%3D%27http%3A%2F%2Fwww.iwillhackyou.com%27%3Ehomepage%3C%2Fa%3E.%0A%3Cscript+src%3D%22http%3A%2F%2Fwww.iwillhackyou.com%2Fscript.js%22%3E%0A++performXSSAttack%28%29%3B%0A%3C%2Fscript%3E'
  175     6        NEW                                              $7      'RefactoringGuru%5CDecorator%5CRealWorld%5CTextInput'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $7
  176     9        ECHO                                                     'Website+renders+comments+without+filtering+%28unsafe%29%3A%0A'
  177    10        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5CdisplayCommentAsAWebsite'
         11        SEND_VAR_EX                                              !1
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
  178    14        ECHO                                                     '%0A%0A%0A'
  185    15        NEW                                              $11     'RefactoringGuru%5CDecorator%5CRealWorld%5CPlainTextFilter'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !2, $11
  186    19        ECHO                                                     'Website+renders+comments+after+stripping+all+tags+%28safe%29%3A%0A'
  187    20        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5CdisplayCommentAsAWebsite'
         21        SEND_VAR_EX                                              !2
         22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0          
  188    24        ECHO                                                     '%0A%0A%0A'
  196    25        ASSIGN                                                   !3, '%23+Welcome%0A%0AThis+is+my+first+post+on+this+%2A%2Agorgeous%2A%2A+forum.%0A%0A%3Cscript+src%3D%22http%3A%2F%2Fwww.iwillhackyou.com%2Fscript.js%22%3E%0A++performXSSAttack%28%29%3B%0A%3C%2Fscript%3E'
  209    26        NEW                                              $16     'RefactoringGuru%5CDecorator%5CRealWorld%5CTextInput'
         27        DO_FCALL                                      0          
         28        ASSIGN                                                   !1, $16
  210    29        ECHO                                                     'Website+renders+a+forum+post+without+filtering+and+formatting+%28unsafe%2C+ugly%29%3A%0A'
  211    30        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5CdisplayCommentAsAWebsite'
         31        SEND_VAR_EX                                              !1
         32        SEND_VAR_EX                                              !3
         33        DO_FCALL                                      0          
  212    34        ECHO                                                     '%0A%0A%0A'
  217    35        NEW                                              $20     'RefactoringGuru%5CDecorator%5CRealWorld%5CTextInput'
         36        DO_FCALL                                      0          
         37        ASSIGN                                                   !4, $20
  218    38        NEW                                              $23     'RefactoringGuru%5CDecorator%5CRealWorld%5CMarkdownFormat'
         39        SEND_VAR_EX                                              !4
         40        DO_FCALL                                      0          
         41        ASSIGN                                                   !5, $23
  219    42        NEW                                              $26     'RefactoringGuru%5CDecorator%5CRealWorld%5CDangerousHTMLTagsFilter'
         43        SEND_VAR_EX                                              !5
         44        DO_FCALL                                      0          
         45        ASSIGN                                                   !2, $26
  222    46        ECHO                                                     'Website+renders+a+forum+post+after+translating+markdown+markup+and+filtering+some+dangerous+HTML+tags+and+attributes+%28safe%2C+pretty%29%3A%0A'
  223    47        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5CdisplayCommentAsAWebsite'
         48        SEND_VAR_EX                                              !2
         49        SEND_VAR_EX                                              !3
         50        DO_FCALL                                      0          
  224    51        ECHO                                                     '%0A%0A%0A'
  226    52      > RETURN                                                   1

Function %00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A92%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  RefactoringGuru\Decorator\RealWorld\{closure}
number of ops:  17
compiled vars:  !0 = $matches, !1 = $attribute, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   93     2        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
          3        ROPE_INIT                                     3  ~4      '%7C'
          4        ROPE_ADD                                      1  ~4      ~4, !1
          5        ROPE_END                                      2  ~3      ~4, '%3D%7Ci'
          6        SEND_VAL_EX                                              ~3
          7        SEND_VAL_EX                                              ''
          8        CHECK_FUNC_ARG                                           
          9        FETCH_DIM_FUNC_ARG                               $6      !0, 1
         10        SEND_FUNC_ARG                                            $6
         11        DO_FCALL                                      0  $7      
         12        ASSIGN                                                   !2, $7
   94    13        CONCAT                                           ~9      '%3C', !2
         14        CONCAT                                           ~10     ~9, '%3E'
         15      > RETURN                                                   ~10
   95    16*     > RETURN                                                   null

End of function %00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A92%243

Function %00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A117%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  RefactoringGuru\Decorator\RealWorld\{closure}
number of ops:  22
compiled vars:  !0 = $matches, !1 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  117     0  E >   RECV                                             !0      
  118     1        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cstrlen'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_DIM_FUNC_ARG                               $2      !0, 1
          4        SEND_FUNC_ARG                                            $2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
  119     7        ROPE_INIT                                     3  ~6      '%3Ch'
          8        ROPE_ADD                                      1  ~6      ~6, !1
          9        ROPE_END                                      2  ~5      ~6, '%3E'
         10        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Ctrim'
         11        CHECK_FUNC_ARG                                           
         12        FETCH_DIM_FUNC_ARG                               $8      !0, 2
         13        SEND_FUNC_ARG                                            $8
         14        DO_FCALL                                      0  $9      
         15        CONCAT                                           ~10     ~5, $9
         16        ROPE_INIT                                     3  ~12     '%3C%2Fh'
         17        ROPE_ADD                                      1  ~12     ~12, !1
         18        ROPE_END                                      2  ~11     ~12, '%3E'
         19        CONCAT                                           ~14     ~10, ~11
         20      > RETURN                                                   ~14
  120    21*     > RETURN                                                   null

End of function %00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A117%245

Function refactoringguru%5Cdecorator%5Crealworld%5Cdisplaycommentasawebsite:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  RefactoringGuru\Decorator\RealWorld\displayCommentAsAWebsite
number of ops:  7
compiled vars:  !0 = $format, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  146     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  150     2        INIT_METHOD_CALL                                         !0, 'formatText'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
  153     6      > RETURN                                                   null

End of function refactoringguru%5Cdecorator%5Crealworld%5Cdisplaycommentasawebsite

Class RefactoringGuru\Decorator\RealWorld\InputFormat:
Function formattext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  formatText
number of ops:  3
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        VERIFY_RETURN_TYPE                                       
          2      > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\InputFormat.

Class RefactoringGuru\Decorator\RealWorld\TextInput:
Function formattext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  formatText
number of ops:  5
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        VERIFY_RETURN_TYPE                                       !0
          2      > RETURN                                                   !0
   25     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\TextInput.

Class RefactoringGuru\Decorator\RealWorld\TextFormat:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  __construct
number of ops:  4
compiled vars:  !0 = $inputFormat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   44     1        ASSIGN_OBJ                                               'inputFormat'
          2        OP_DATA                                                  !0
   45     3      > RETURN                                                   null

End of function __construct

Function formattext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  formatText
number of ops:  9
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
   52     1        FETCH_OBJ_R                                      ~1      'inputFormat'
          2        INIT_METHOD_CALL                                         ~1, 'formatText'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        VERIFY_RETURN_TYPE                                       $2
          6      > RETURN                                                   $2
   53     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\TextFormat.

Class RefactoringGuru\Decorator\RealWorld\PlainTextFilter:
Function formattext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zcrcj
function name:  formatText
number of ops:  12
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   RECV                                             !0      
   63     1        INIT_STATIC_METHOD_CALL                                  'formatText'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   64     5        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cstrip_tags'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $3      
          8        VERIFY_RETURN_TYPE                                       $3
          9      > RETURN                                                   $3
   65    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\PlainTextFilter.

Class RefactoringGuru\Decorator\RealWorld\DangerousHTMLTagsFilter:
Function formattext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 28
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 15
filename:       /in/Zcrcj
function name:  formatText
number of ops:  33
compiled vars:  !0 = $text, !1 = $pattern, !2 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   83     0  E >   RECV                                             !0      
   85     1        INIT_STATIC_METHOD_CALL                                  'formatText'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
   87     5        FETCH_OBJ_R                                      ~5      'dangerousTagPatterns'
          6      > FE_RESET_R                                       $6      ~5, ->15
          7    > > FE_FETCH_R                                               $6, !1, ->15
   88     8    >   INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
          9        SEND_VAR_EX                                              !1
         10        SEND_VAL_EX                                              ''
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $7      
         13        ASSIGN                                                   !0, $7
   87    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $6
   91    16        FETCH_OBJ_R                                      ~9      'dangerousAttributes'
         17      > FE_RESET_R                                       $10     ~9, ->28
         18    > > FE_FETCH_R                                               $10, !2, ->28
   92    19    >   INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace_callback'
         20        SEND_VAL_EX                                              '%7C%3C%28.%2A%3F%29%3E%7C'
         21        DECLARE_LAMBDA_FUNCTION                                  '%00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A92%243'
         22        BIND_LEXICAL                                             ~11, !2
   95    23        SEND_VAL_EX                                              ~11
   92    24        SEND_VAR_EX                                              !0
         25        DO_FCALL                                      0  $12     
         26        ASSIGN                                                   !0, $12
   91    27      > JMP                                                      ->18
         28    >   FE_FREE                                                  $10
   98    29        VERIFY_RETURN_TYPE                                       !0
         30      > RETURN                                                   !0
   99    31*       VERIFY_RETURN_TYPE                                       
         32*     > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\DangerousHTMLTagsFilter.

Class RefactoringGuru\Decorator\RealWorld\MarkdownFormat:
Function formattext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 30
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 30
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/Zcrcj
function name:  formatText
number of ops:  64
compiled vars:  !0 = $text, !1 = $chunks, !2 = $chunk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
  110     1        INIT_STATIC_METHOD_CALL                                  'formatText'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
  113     5        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_split'
          6        SEND_VAL_EX                                              '%7C%5Cn%5Cn%7C'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !1, $5
  114    10      > FE_RESET_RW                                      $7      !1, ->30
         11    > > FE_FETCH_RW                                              $7, !2, ->30
  116    12    >   INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_match'
         13        SEND_VAL_EX                                              '%7C%5E%23%2B%7C'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0  $8      
         16      > JMPZ                                                     $8, ->25
  117    17    >   INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace_callback'
         18        SEND_VAL_EX                                              '%7C%5E%28%23%2B%29%28.%2A%3F%29%24%7C'
         19        DECLARE_LAMBDA_FUNCTION                                  '%00refactoringguru%5Cdecorator%5Crealworld%5C%7Bclosure%7D%2Fin%2FZcrcj%3A117%245'
  120    20        SEND_VAL_EX                                              ~9
  117    21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0  $10     
         23        ASSIGN                                                   !2, $10
         24      > JMP                                                      ->29
  123    25    >   ROPE_INIT                                     3  ~13     '%3Cp%3E'
         26        ROPE_ADD                                      1  ~13     ~13, !2
         27        ROPE_END                                      2  ~12     ~13, '%3C%2Fp%3E'
         28        ASSIGN                                                   !2, ~12
  114    29    > > JMP                                                      ->11
         30    >   FE_FREE                                                  $7
  126    31        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cimplode'
         32        SEND_VAL_EX                                              '%0A%0A'
         33        SEND_VAR_EX                                              !1
         34        DO_FCALL                                      0  $16     
         35        ASSIGN                                                   !0, $16
  129    36        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
         37        SEND_VAL_EX                                              '%7C__%28.%2A%3F%29__%7C'
         38        SEND_VAL_EX                                              '%3Cstrong%3E%241%3C%2Fstrong%3E'
         39        SEND_VAR_EX                                              !0
         40        DO_FCALL                                      0  $18     
         41        ASSIGN                                                   !0, $18
  130    42        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
         43        SEND_VAL_EX                                              '%7C%5C%2A%5C%2A%28.%2A%3F%29%5C%2A%5C%2A%7C'
         44        SEND_VAL_EX                                              '%3Cstrong%3E%241%3C%2Fstrong%3E'
         45        SEND_VAR_EX                                              !0
         46        DO_FCALL                                      0  $20     
         47        ASSIGN                                                   !0, $20
  131    48        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
         49        SEND_VAL_EX                                              '%7C_%28.%2A%3F%29_%7C'
         50        SEND_VAL_EX                                              '%3Cem%3E%241%3C%2Fem%3E'
         51        SEND_VAR_EX                                              !0
         52        DO_FCALL                                      0  $22     
         53        ASSIGN                                                   !0, $22
  132    54        INIT_NS_FCALL_BY_NAME                                    'RefactoringGuru%5CDecorator%5CRealWorld%5Cpreg_replace'
         55        SEND_VAL_EX                                              '%7C%5C%2A%28.%2A%3F%29%5C%2A%7C'
         56        SEND_VAL_EX                                              '%3Cem%3E%241%3C%2Fem%3E'
         57        SEND_VAR_EX                                              !0
         58        DO_FCALL                                      0  $24     
         59        ASSIGN                                                   !0, $24
  134    60        VERIFY_RETURN_TYPE                                       !0
         61      > RETURN                                                   !0
  135    62*       VERIFY_RETURN_TYPE                                       
         63*     > RETURN                                                   null

End of function formattext

End of class RefactoringGuru\Decorator\RealWorld\MarkdownFormat.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.33 ms | 1427 KiB | 33 Q