3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace AdLabs\ParserBundle\Parsers; /** * Класс парсинга данных * @author Syomik Dmitriy <dsemik@gmail.com> */ class Parsers{ /** * put your comment there... * * @var \stdClass */ protected $inputData; /** * Укзаатель на менеджер сущностей * * @var mixed */ protected $entityManager; /** * логгер * * @var mixed */ protected $logger; /** * Контент файла * * @var string */ protected $fileContent; /** * Массив общих шаблонов парсинга * * @var array */ protected $patterns; /** * Объект класса данных * * @var ParsersObjectData */ protected $objectData; /** * Статус отработки основого шаблона * * @var boolean */ protected $patternStatus; /** * put your comment there... * * @param mixed $objectData объект данных * @param mixed $entityManager Entity Manager * @param mixed $logger логер * * @return Parsers */ public function __construct($objectData, $entityManager, $logger) { $this->objectData = $objectData; $this->entityManager = $entityManager; $this->logger = $logger; } /** * Установить входящие данные * * @param \StdClass $inputData входящие данные (запрос, путь к файлу) * */ public function setInputData(\StdClass $inputData) { $this->inputData = $inputData; } /** * Получить объект данных * * @return ParsersObjectData */ public function getObjectData() { return $this->objectData; } /** * Инициализация поисковой системы и шаблонов для парсинга * * @return boolean */ public function init() { $infoParseResult = $this->pathInfoParse(); $patternResult = $this->getPatterns(); $contentResult = $this->getContent(); return $infoParseResult && $patternResult && $contentResult; } /** * Получить все шаблоны для текущей поисковой системы * * @return boolen */ private function getPatterns() { $this->patterns = $this->entityManager ->getRepository("AdLabsParserBundle:PoiskovikPattern") ->getPatterns($this->objectData->getSearchEngine(), $this->objectData->getDataType()); if (!empty($this->patterns)) { return true; } else { $this->logger->write('Patterns not found '.__CLASS__.' '.__METHOD__); } return false; } /** * Инит поисковой системы из имени файла * * @param string $parsePath * * @return boolen */ private function pathInfoParse() { $parsePath = (string) $this->inputData->path; $pathInfo = pathinfo($parsePath); if (!empty($pathInfo['extension'])) { $this->objectData->setDataType($pathInfo['extension']); $this->objectData->setSearchEngine((string) $this->inputData->searchEngine); $this->objectData->setQuery((string) $this->inputData->query); return true; } $this->logger->write('Error init search engine'); return false; } /** * Получить контент файла * * @return boolen */ private function getContent() { $filePath = (string) $this->inputData->path; if (is_file($filePath)) { $this->fileContent = file_get_contents($filePath); if (!empty($this->fileContent)) { return true; } else { $this->logger->write('File '.$filePath.' is empty'); } } else { $this->logger->write('Parse file '.$filePath.' not found'); } return false; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  175     0  E > > RETURN                                                   1

Class AdLabs\ParserBundle\Parsers\Parsers:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  __construct
number of ops:  10
compiled vars:  !0 = $objectData, !1 = $entityManager, !2 = $logger
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   71     3        ASSIGN_OBJ                                               'objectData'
          4        OP_DATA                                                  !0
   72     5        ASSIGN_OBJ                                               'entityManager'
          6        OP_DATA                                                  !1
   73     7        ASSIGN_OBJ                                               'logger'
          8        OP_DATA                                                  !2
   74     9      > RETURN                                                   null

End of function __construct

Function setinputdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  setInputData
number of ops:  4
compiled vars:  !0 = $inputData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   RECV                                             !0      
   84     1        ASSIGN_OBJ                                               'inputData'
          2        OP_DATA                                                  !0
   85     3      > RETURN                                                   null

End of function setinputdata

Function getobjectdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  getObjectData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E >   FETCH_OBJ_R                                      ~0      'objectData'
          1      > RETURN                                                   ~0
   94     2*     > RETURN                                                   null

End of function getobjectdata

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 11
filename:       /in/i7gne
function name:  init
number of ops:  15
compiled vars:  !0 = $infoParseResult, !1 = $patternResult, !2 = $contentResult
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  103     0  E >   INIT_METHOD_CALL                                         'pathInfoParse'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
  104     3        INIT_METHOD_CALL                                         'getPatterns'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
  105     6        INIT_METHOD_CALL                                         'getContent'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
  107     9      > JMPZ_EX                                          ~9      !0, ->11
         10    >   BOOL                                             ~9      !1
         11    > > JMPZ_EX                                          ~9      ~9, ->13
         12    >   BOOL                                             ~9      !2
         13    > > RETURN                                                   ~9
  108    14*     > RETURN                                                   null

End of function init

Function getpatterns:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  getPatterns
number of ops:  27
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  117     0  E >   FETCH_OBJ_R                                      ~1      'entityManager'
  118     1        INIT_METHOD_CALL                                         ~1, 'getRepository'
          2        SEND_VAL_EX                                              'AdLabsParserBundle%3APoiskovikPattern'
          3        DO_FCALL                                      0  $2      
  119     4        INIT_METHOD_CALL                                         $2, 'getPatterns'
          5        FETCH_OBJ_R                                      ~3      'objectData'
          6        INIT_METHOD_CALL                                         ~3, 'getSearchEngine'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        FETCH_OBJ_R                                      ~5      'objectData'
         10        INIT_METHOD_CALL                                         ~5, 'getDataType'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR_NO_REF_EX                                       $6
         13        DO_FCALL                                      0  $7      
  117    14        ASSIGN_OBJ                                               'patterns'
  119    15        OP_DATA                                                  $7
  121    16        ISSET_ISEMPTY_PROP_OBJ                           ~8      'patterns'
         17        BOOL_NOT                                         ~9      ~8
         18      > JMPZ                                                     ~9, ->21
  122    19    > > RETURN                                                   <true>
         20*       JMP                                                      ->25
  124    21    >   FETCH_OBJ_R                                      ~10     'logger'
         22        INIT_METHOD_CALL                                         ~10, 'write'
         23        SEND_VAL_EX                                              'Patterns+not+found+AdLabs%5CParserBundle%5CParsers%5CParsers+AdLabs%5CParserBundle%5CParsers%5CParsers%3A%3AgetPatterns'
         24        DO_FCALL                                      0          
  127    25      > RETURN                                                   <false>
  128    26*     > RETURN                                                   null

End of function getpatterns

Function pathinfoparse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  pathInfoParse
number of ops:  38
compiled vars:  !0 = $parsePath, !1 = $pathInfo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  139     0  E >   FETCH_OBJ_R                                      ~2      'inputData'
          1        FETCH_OBJ_R                                      ~3      ~2, 'path'
          2        CAST                                          6  ~4      ~3
          3        ASSIGN                                                   !0, ~4
  140     4        INIT_NS_FCALL_BY_NAME                                    'AdLabs%5CParserBundle%5CParsers%5Cpathinfo'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
  141     8        ISSET_ISEMPTY_DIM_OBJ                         1  ~8      !1, 'extension'
          9        BOOL_NOT                                         ~9      ~8
         10      > JMPZ                                                     ~9, ->32
  142    11    >   FETCH_OBJ_R                                      ~10     'objectData'
         12        INIT_METHOD_CALL                                         ~10, 'setDataType'
         13        CHECK_FUNC_ARG                                           
         14        FETCH_DIM_FUNC_ARG                               $11     !1, 'extension'
         15        SEND_FUNC_ARG                                            $11
         16        DO_FCALL                                      0          
  143    17        FETCH_OBJ_R                                      ~13     'objectData'
         18        INIT_METHOD_CALL                                         ~13, 'setSearchEngine'
         19        FETCH_OBJ_R                                      ~14     'inputData'
         20        FETCH_OBJ_R                                      ~15     ~14, 'searchEngine'
         21        CAST                                          6  ~16     ~15
         22        SEND_VAL_EX                                              ~16
         23        DO_FCALL                                      0          
  144    24        FETCH_OBJ_R                                      ~18     'objectData'
         25        INIT_METHOD_CALL                                         ~18, 'setQuery'
         26        FETCH_OBJ_R                                      ~19     'inputData'
         27        FETCH_OBJ_R                                      ~20     ~19, 'query'
         28        CAST                                          6  ~21     ~20
         29        SEND_VAL_EX                                              ~21
         30        DO_FCALL                                      0          
  146    31      > RETURN                                                   <true>
  149    32    >   FETCH_OBJ_R                                      ~23     'logger'
         33        INIT_METHOD_CALL                                         ~23, 'write'
         34        SEND_VAL_EX                                              'Error+init+search+engine'
         35        DO_FCALL                                      0          
  151    36      > RETURN                                                   <false>
  152    37*     > RETURN                                                   null

End of function pathinfoparse

Function getcontent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i7gne
function name:  getContent
number of ops:  33
compiled vars:  !0 = $filePath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  161     0  E >   FETCH_OBJ_R                                      ~1      'inputData'
          1        FETCH_OBJ_R                                      ~2      ~1, 'path'
          2        CAST                                          6  ~3      ~2
          3        ASSIGN                                                   !0, ~3
  162     4        INIT_NS_FCALL_BY_NAME                                    'AdLabs%5CParserBundle%5CParsers%5Cis_file'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $5      
          7      > JMPZ                                                     $5, ->25
  163     8    >   INIT_NS_FCALL_BY_NAME                                    'AdLabs%5CParserBundle%5CParsers%5Cfile_get_contents'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $7      
         11        ASSIGN_OBJ                                               'fileContent'
         12        OP_DATA                                                  $7
  164    13        ISSET_ISEMPTY_PROP_OBJ                           ~8      'fileContent'
         14        BOOL_NOT                                         ~9      ~8
         15      > JMPZ                                                     ~9, ->18
  165    16    > > RETURN                                                   <true>
         17*       JMP                                                      ->24
  167    18    >   FETCH_OBJ_R                                      ~10     'logger'
         19        INIT_METHOD_CALL                                         ~10, 'write'
         20        CONCAT                                           ~11     'File+', !0
         21        CONCAT                                           ~12     ~11, '+is+empty'
         22        SEND_VAL_EX                                              ~12
         23        DO_FCALL                                      0          
         24      > JMP                                                      ->31
  170    25    >   FETCH_OBJ_R                                      ~14     'logger'
         26        INIT_METHOD_CALL                                         ~14, 'write'
         27        CONCAT                                           ~15     'Parse+file+', !0
         28        CONCAT                                           ~16     ~15, '+not+found'
         29        SEND_VAL_EX                                              ~16
         30        DO_FCALL                                      0          
  173    31    > > RETURN                                                   <false>
  174    32*     > RETURN                                                   null

End of function getcontent

End of class AdLabs\ParserBundle\Parsers\Parsers.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.19 ms | 1408 KiB | 19 Q