idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
15,700 | protected function getAvailableCoupons ( ) { $ couponManager = $ this -> container -> get ( 'thelia.coupon.manager' ) ; $ availableCoupons = $ couponManager -> getAvailableCoupons ( ) ; $ cleanedCoupons = [ ] ; foreach ( $ availableCoupons as $ availableCoupon ) { $ condition = [ ] ; $ condition [ 'serviceId' ] = $ ava... | Get all available coupons |
15,701 | protected function cleanConditionForTemplate ( ConditionCollection $ conditions ) { $ cleanedConditions = [ ] ; foreach ( $ conditions as $ index => $ condition ) { $ temp = [ 'serviceId' => $ condition -> getServiceId ( ) , 'index' => $ index , 'name' => $ condition -> getName ( ) , 'toolTip' => $ condition -> getTool... | Clean condition for template |
15,702 | protected function feedCouponCreateOrUpdateEvent ( Form $ form , Coupon $ model = null ) { $ data = $ form -> getData ( ) ; $ serviceId = $ data [ 'type' ] ; $ coupon = $ this -> container -> get ( $ serviceId ) ; $ couponEvent = new CouponCreateOrUpdateEvent ( $ data [ 'code' ] , $ serviceId , $ data [ 'title' ] , $ c... | Feed the Coupon Create or Update event with the User inputs |
15,703 | protected function buildConditionFromRequest ( ) { $ request = $ this -> getRequest ( ) ; $ post = $ request -> request -> getIterator ( ) ; $ serviceId = $ request -> request -> get ( 'categoryCondition' ) ; $ operators = [ ] ; $ values = [ ] ; foreach ( $ post as $ key => $ input ) { if ( isset ( $ input [ 'operator'... | Build ConditionInterface from request |
15,704 | protected function manageConditionUpdate ( Coupon $ coupon , ConditionCollection $ conditions ) { $ couponEvent = new CouponCreateOrUpdateEvent ( $ coupon -> getCode ( ) , $ coupon -> getType ( ) , $ coupon -> getTitle ( ) , $ coupon -> getEffects ( ) , $ coupon -> getShortDescription ( ) , $ coupon -> getDescription (... | Manage how a Condition is updated |
15,705 | public function getModelInstance ( $ fileType , $ parentType ) { if ( ! isset ( $ this -> supportedFileModels [ $ this -> getFileTypeIdentifier ( $ fileType , $ parentType ) ] ) ) { throw new FileException ( sprintf ( "Unsupported file type '%s' for parent type '%s'" , $ fileType , $ parentType ) ) ; } $ className = $ ... | Create a new FileModelInterface instance from the supportedFileModels table |
15,706 | public function addFileModel ( $ fileType , $ parentType , $ fullyQualifiedClassName ) { $ this -> supportedFileModels [ $ this -> getFileTypeIdentifier ( $ fileType , $ parentType ) ] = $ fullyQualifiedClassName ; } | A a new FileModelInterface class name to the supported class list . |
15,707 | public function copyUploadedFile ( FileModelInterface $ model , UploadedFile $ uploadedFile , ConnectionInterface $ con = null ) { $ newUploadedFile = null ; if ( $ uploadedFile !== null ) { $ directory = $ model -> getUploadDir ( ) ; $ fileName = $ this -> renameFile ( $ model -> getId ( ) , $ uploadedFile ) ; $ newUp... | Copy UploadedFile into the server storage directory |
15,708 | public function deleteFile ( FileModelInterface $ model ) { $ url = $ model -> getUploadDir ( ) . DS . $ model -> getFile ( ) ; @ unlink ( str_replace ( '..' , '' , $ url ) ) ; $ model -> delete ( ) ; } | Delete image from file storage and database |
15,709 | public function renameFile ( $ modelId , UploadedFile $ uploadedFile ) { $ extension = $ uploadedFile -> getClientOriginalExtension ( ) ; if ( ! empty ( $ extension ) ) { $ extension = '.' . strtolower ( $ extension ) ; } $ fileName = $ this -> sanitizeFileName ( str_replace ( $ extension , '' , $ uploadedFile -> getCl... | Rename file with image model id |
15,710 | public function isImage ( $ mimeType ) { $ isValid = false ; $ allowedType = array ( 'image/jpeg' , 'image/png' , 'image/gif' ) ; if ( \ in_array ( $ mimeType , $ allowedType ) ) { $ isValid = true ; } return $ isValid ; } | Check if a file is an image Check based on mime type |
15,711 | protected function ensureSettings ( ) { if ( ! $ this -> fs -> exists ( Platform :: webDir ( ) . '/sites/default' ) ) { $ this -> fs -> mkdir ( Platform :: webDir ( ) . '/sites/default' , 0775 ) ; } else { $ this -> fs -> chmod ( Platform :: webDir ( ) . '/sites/default' , 0775 ) ; } $ has_settings = $ this -> fs -> ex... | Ensures that the Drupal settings . php is available . |
15,712 | public function drushrc ( ) { switch ( $ this -> version ) { case DrupalStackHelper :: DRUPAL7 : $ this -> fs -> copy ( CLI_ROOT . '/resources/stacks/drupal7/drushrc.php' , Platform :: sharedDir ( ) . '/drushrc.php' , true ) ; break ; case DrupalStackHelper :: DRUPAL8 : $ this -> fs -> copy ( CLI_ROOT . '/resources/sta... | Write a drushrc |
15,713 | public function addPrompt ( $ prompt ) { $ added = false ; if ( ! $ this -> isPrompt ( $ prompt [ 'name' ] ) && ! $ this -> isPluginDismissed ( $ prompt [ 'plugin' ] ) ) { $ prompt [ 'time_added' ] = time ( ) ; $ prompts = $ this -> getPrompts ( ) ; $ prompts [ ] = $ prompt ; $ added = $ this -> savePrompts ( $ prompts... | Add a prompt . |
15,714 | public function admin_notices ( ) { if ( ! current_user_can ( $ this -> userRole ) ) { return ; } $ prompt = $ this -> getNext ( ) ; if ( empty ( $ prompt ) ) { return ; } $ slides = $ this -> getPromptSlides ( $ prompt ) ; if ( ! empty ( $ slides ) ) { echo '<div class="notice notice-success bglib-rating-prompt is-dis... | Add admin notices . |
15,715 | public function ajaxDismiss ( ) { if ( ! current_user_can ( $ this -> userRole ) ) { wp_send_json_error ( __ ( 'Permission denied.' , 'boldgrid-library' ) ) ; } if ( ! check_ajax_referer ( 'bglib-rating-prompt' , 'security' , false ) ) { wp_send_json_error ( __ ( 'Invalid nonce.' , 'boldgrid-library' ) ) ; } $ name = s... | Dismiss a rating prompt via ajax . |
15,716 | public function getLastDismissal ( ) { $ lastDismissal = 0 ; $ prompts = $ this -> getPrompts ( ) ; foreach ( $ prompts as $ prompt ) { $ promptDismissal = 0 ; if ( ! empty ( $ prompt [ 'time_dismissed' ] ) ) { $ promptDismissal = $ prompt [ 'time_dismissed' ] ; } elseif ( ! empty ( $ prompt [ 'time_snoozed' ] ) ) { $ ... | Get the time of the last dismissal or snooze whichever is latest . |
15,717 | public function admin_enqueue_scripts ( ) { if ( ! current_user_can ( $ this -> userRole ) ) { return ; } $ prompt = $ this -> getNext ( ) ; if ( ! empty ( $ prompt ) ) { wp_enqueue_script ( 'bglib-rating-prompt-js' , Library \ Configs :: get ( 'libraryUrl' ) . 'src/assets/js/rating-prompt.js' , 'jquery' , date ( 'Ymd'... | Admin enqueue scripts . |
15,718 | public function getPromptSlides ( $ prompt ) { $ slides = array ( ) ; if ( ! empty ( $ prompt [ 'slides' ] ) ) { foreach ( $ prompt [ 'slides' ] as $ slide_id => $ slide ) { $ slideMarkup = $ this -> getSlideMarkup ( $ slide_id , $ slide ) ; $ slides [ $ slide_id ] = $ slideMarkup ; } } return $ slides ; } | Return the markup of a prompt s slides . |
15,719 | public function getSlideMarkup ( $ slide_id , $ slide ) { $ slideMarkup = '<div data-slide-id="' . esc_attr ( $ slide_id ) . '">' ; $ slideMarkup .= '<p>' . $ slide [ 'text' ] . '</p>' ; if ( ! empty ( $ slide [ 'decisions' ] ) ) { $ slide_decisions = array ( ) ; foreach ( $ slide [ 'decisions' ] as $ decision ) { $ at... | Get the markup for an individual slide . |
15,720 | public function getPrompt ( $ name ) { $ prompt_found = array ( ) ; $ prompts = $ this -> getPrompts ( ) ; foreach ( $ prompts as $ prompt ) { if ( $ name === $ prompt [ 'name' ] ) { $ prompt_found = $ prompt ; break ; } } return $ prompt_found ; } | Get a prompt by name . |
15,721 | public function isPluginDismissed ( $ plugin ) { $ dismissed = false ; $ plugin_prompts = $ this -> getPluginPrompts ( $ plugin ) ; foreach ( $ plugin_prompts as $ prompt ) { if ( ! empty ( $ prompt [ 'time_dismissed' ] ) ) { $ dismissed = true ; } } return $ dismissed ; } | Determine whether or not a given plugin has any dismissed notices . |
15,722 | public function getPluginPrompts ( $ plugin ) { $ pluginPrompts = array ( ) ; $ prompts = $ this -> getPrompts ( ) ; foreach ( $ prompts as $ prompt ) { if ( $ prompt [ 'plugin' ] === $ plugin ) { $ pluginPrompts [ ] = $ prompt ; } } return $ pluginPrompts ; } | Get all prompts for a plugin . |
15,723 | public function getNext ( ) { $ nextPrompt = array ( ) ; $ prompts = $ this -> getPrompts ( ) ; foreach ( $ prompts as $ prompt ) { $ isDismissed = isset ( $ prompt [ 'time_dismissed' ] ) ; $ isOlder = empty ( $ nextPrompt ) || ( ! $ isDismissed && $ prompt [ 'time_added' ] < $ nextPrompt [ 'time_added' ] ) ; $ isStill... | Get the next prompt to display . |
15,724 | public function updatePrompt ( $ prompt_to_save ) { $ found = false ; $ prompts = $ this -> getPrompts ( ) ; foreach ( $ prompts as $ key => $ prompt ) { if ( $ prompt_to_save [ 'name' ] === $ prompt [ 'name' ] ) { $ found = true ; $ prompts [ $ key ] = $ prompt_to_save ; break ; } } return $ found ? $ this -> saveProm... | Update an existing prompt . |
15,725 | public function updatePromptKey ( $ name , $ key , $ value ) { $ prompt = $ this -> getPrompt ( $ name ) ; $ prompt [ $ key ] = $ value ; return $ this -> updatePrompt ( $ prompt ) ; } | Update an attribute for a prompt . |
15,726 | public static function create ( $ name ) { $ name = ( string ) $ name ; $ name = ltrim ( $ name , '\\' ) ; $ namespace_node = Parser :: parseSnippet ( "namespace $name;" ) ; return $ namespace_node ; } | Create namespace declaration . |
15,727 | public function isPaymentModuleFor ( Order $ order ) { $ model = $ this -> getModuleModel ( ) ; return $ order -> getPaymentModuleId ( ) == $ model -> getId ( ) ; } | Check if this module is the payment module for a given order |
15,728 | public function isDeliveryModuleFor ( Order $ order ) { $ model = $ this -> getModuleModel ( ) ; return $ order -> getDeliveryModuleId ( ) == $ model -> getId ( ) ; } | Check if this module is the delivery module for a given order |
15,729 | private function initializeCoreI18n ( ) { if ( $ this -> hasContainer ( ) ) { $ translator = $ this -> container -> get ( 'thelia.translator' ) ; if ( null !== $ translator ) { $ i18nPath = sprintf ( '%s%s/I18n/' , THELIA_MODULE_DIR , $ this -> getCode ( ) ) ; $ languages = LangQuery :: create ( ) -> find ( ) ; foreach... | Add core translations of the module to use in preActivation and postActivation when the module is not yest activated and translations are not available |
15,730 | protected function setArgs ( $ args ) { if ( $ this -> getKey ( ) ) { $ args = wp_parse_args ( $ args , array ( 'key' => $ this -> getKey ( ) ) ) ; } if ( $ this -> getSiteHash ( ) ) { $ args = wp_parse_args ( $ args , array ( 'site_hash' => $ this -> getSiteHash ( ) ) ) ; } return $ this -> args = array ( 'timeout' =>... | Sets the args class property . |
15,731 | private function call ( ) { if ( 'get' === $ this -> method ) { $ response = wp_remote_get ( $ this -> url , $ this -> args ) ; } else { $ response = wp_remote_post ( $ this -> url , $ this -> args ) ; } $ this -> response = json_decode ( wp_remote_retrieve_body ( $ response ) ) ; if ( $ this -> validateResponse ( $ re... | Makes the API call . |
15,732 | private function validateResponse ( $ response ) { if ( is_wp_error ( $ response ) ) { $ this -> error = $ response -> get_error_message ( ) ; return false ; } $ responseCode = wp_remote_retrieve_response_code ( $ response ) ; if ( false === strstr ( $ responseCode , '200' ) ) { $ responseMessage = wp_remote_retrieve_r... | Validates the API response . |
15,733 | public function buildTree ( TokenIterator $ iterator ) { $ this -> skipped = [ ] ; $ this -> skipParent = NULL ; $ this -> docComment = NULL ; $ this -> skippedDocComment = [ ] ; $ this -> iterator = $ iterator ; $ this -> current = $ this -> iterator -> current ( ) ; $ this -> currentType = $ this -> current ? $ this ... | Build a syntax tree from the token iterator . |
15,734 | public static function parseFile ( $ filename ) { $ source = @ file_get_contents ( $ filename ) ; if ( $ source === FALSE ) { return FALSE ; } return self :: parseSource ( $ source , $ filename ) ; } | Parse a file and return the parsed tree |
15,735 | public static function parseSource ( $ source , $ filename = NULL ) { static $ tokenizer , $ parser = NULL ; if ( ! isset ( $ parser ) ) { $ tokenizer = new Tokenizer ( ) ; $ parser = new self ( ) ; } $ tokens = $ tokenizer -> getAll ( $ source , $ filename ) ; $ parser -> filename = $ filename ; return $ parser -> bui... | Parse PHP source code and return the parsed tree . |
15,736 | public static function parseExpression ( $ expression ) { $ tree = self :: parseSource ( '<?php ' . $ expression . ';' ) ; $ statement_node = $ tree -> firstChild ( ) -> next ( ) ; return $ statement_node -> getExpression ( ) -> remove ( ) ; } | Parse a PHP expression . |
15,737 | private function templateStatementList ( ParentNode $ node ) { while ( $ this -> current ) { if ( $ this -> currentType === T_OPEN_TAG ) { return ; } elseif ( $ this -> currentType === T_INLINE_HTML ) { $ node -> addChild ( $ this -> mustMatchToken ( T_INLINE_HTML ) ) ; } elseif ( $ this -> currentType === T_OPEN_TAG_W... | Parse zero or more template statements . |
15,738 | private function topStatementList ( StatementBlockNode $ node , $ terminator = '' ) { $ this -> matchHidden ( $ node ) ; while ( $ this -> currentType !== NULL && $ this -> currentType !== $ terminator ) { $ node -> addChild ( $ this -> topStatement ( ) ) ; $ this -> matchHidden ( $ node ) ; } $ this -> matchHidden ( $... | Parse a list of top level statements . |
15,739 | private function topStatement ( ) { switch ( $ this -> currentType ) { case T_USE : return $ this -> useBlock ( ) ; case T_CONST : return $ this -> _const ( ) ; case T_ABSTRACT : case T_FINAL : case T_CLASS : return $ this -> classDeclaration ( ) ; case T_INTERFACE : return $ this -> interfaceDeclaration ( ) ; case T_T... | Parse a top level statement . |
15,740 | private function _const ( ) { $ node = new ConstantDeclarationStatementNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_CONST , $ node ) ; $ declarations = new CommaListNode ( ) ; do { $ declarations -> addChild ( $ this -> constDeclaration ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ declara... | Parse a constant declaration list . |
15,741 | private function constDeclaration ( ) { $ node = new ConstantDeclarationNode ( ) ; $ name_node = new NameNode ( ) ; $ this -> mustMatch ( T_STRING , $ name_node , NULL , TRUE ) ; $ node -> addChild ( $ name_node , 'name' ) ; if ( $ this -> mustMatch ( '=' , $ node ) ) { $ node -> addChild ( $ this -> staticScalar ( ) ,... | Parse a constant declaration . |
15,742 | private function statement ( ) { switch ( $ this -> currentType ) { case T_CLOSE_TAG : $ node = new TemplateNode ( ) ; $ this -> mustMatch ( T_CLOSE_TAG , $ node ) ; $ this -> templateStatementList ( $ node ) ; if ( $ this -> iterator -> hasNext ( ) ) { $ this -> mustMatch ( T_OPEN_TAG , $ node , NULL , TRUE , TRUE ) ;... | Parse a statement . |
15,743 | private function staticVariableList ( ) { $ node = new StaticVariableStatementNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_STATIC , $ node ) ; $ variables = new CommaListNode ( ) ; do { $ variables -> addChild ( $ this -> staticVariable ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ variabl... | Parse a static variable list . |
15,744 | private function staticVariable ( ) { $ node = new StaticVariableNode ( ) ; $ this -> mustMatch ( T_VARIABLE , $ node , 'name' , TRUE ) ; if ( $ this -> tryMatch ( '=' , $ node ) ) { $ node -> addChild ( $ this -> staticScalar ( ) , 'initialValue' ) ; } return $ node ; } | Parse a static variable . |
15,745 | private function exprStatement ( ) { $ node = new ExpressionStatementNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'expression' ) ; $ this -> endStatement ( $ node ) ; return $ node ; } | Parse expression statement . |
15,746 | private function condition ( ParentNode $ node , $ property_name ) { $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; if ( $ this -> currentType === T_YIELD ) { $ node -> addChild ( $ this -> _yield ( ) , $ property_name ) ; } else { $ node -> addChild ( $ this -> expr ( ) , $ property_name ) ; } $ this -> mustMatc... | Parse condition . |
15,747 | private function _if ( ) { $ node = new IfNode ( ) ; $ this -> mustMatch ( T_IF , $ node ) ; $ this -> condition ( $ node , 'condition' ) ; if ( $ this -> tryMatch ( ':' , $ node , 'openColon' , FALSE , TRUE ) ) { $ node -> addChild ( $ this -> innerIfInnerStatementList ( ) , 'then' ) ; while ( $ this -> currentType ==... | Parse if control structure . |
15,748 | private function innerIfInnerStatementList ( ) { static $ terminators = [ T_ELSEIF , T_ELSE , T_ENDIF ] ; $ node = new StatementBlockNode ( ) ; while ( $ this -> currentType !== NULL && ! in_array ( $ this -> currentType , $ terminators ) ) { $ this -> matchHidden ( $ node ) ; $ node -> addChild ( $ this -> innerStatem... | Parse statements for alternative if syntax . |
15,749 | private function _while ( ) { $ node = new WhileNode ( ) ; $ this -> mustMatch ( T_WHILE , $ node ) ; $ this -> condition ( $ node , 'condition' ) ; if ( $ this -> tryMatch ( ':' , $ node , 'openColon' , FALSE , TRUE ) ) { $ node -> addChild ( $ this -> innerStatementListNode ( T_ENDWHILE ) , 'body' ) ; $ this -> mustM... | Parse while control structure . |
15,750 | private function doWhile ( ) { $ node = new DoWhileNode ( ) ; $ this -> mustMatch ( T_DO , $ node , NULL , FALSE , TRUE ) ; $ node -> addChild ( $ this -> statement ( ) , 'body' ) ; $ this -> mustMatch ( T_WHILE , $ node , 'whileKeyword' ) ; $ this -> condition ( $ node , 'condition' ) ; $ this -> endStatement ( $ node... | Parse do while control stucture . |
15,751 | private function _for ( ) { $ node = new ForNode ( ) ; $ this -> mustMatch ( T_FOR , $ node ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ this -> forExpr ( $ node , ';' , 'initial' ) ; $ this -> forExpr ( $ node , ';' , 'condition' ) ; $ this -> forExpr ( $ node , ')' , 'step' , TRUE , 'closeParen' ) ; if ... | Parse for control structure . |
15,752 | private function forExpr ( ForNode $ parent , $ terminator , $ property_name , $ is_last = FALSE , $ terminator_name = NULL ) { if ( $ this -> tryMatch ( $ terminator , $ parent ) ) { $ parent -> addChild ( new CommaListNode ( ) , $ property_name ) ; return ; } $ parent -> addChild ( $ this -> exprList ( ) , $ property... | Parse a for expression . |
15,753 | private function _switch ( ) { $ node = new SwitchNode ( ) ; $ this -> mustMatch ( T_SWITCH , $ node ) ; $ this -> condition ( $ node , 'switchOn' ) ; if ( $ this -> tryMatch ( ':' , $ node , 'openColon' ) ) { $ this -> tryMatch ( ';' , $ node ) ; while ( $ this -> currentType !== NULL && $ this -> currentType !== T_EN... | Parse a switch control structure . |
15,754 | private function caseStatement ( $ terminator ) { static $ terminators = [ T_CASE , T_DEFAULT ] ; if ( $ this -> currentType === T_CASE ) { $ node = new CaseNode ( ) ; $ this -> mustMatch ( T_CASE , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'matchOn' ) ; if ( ! $ this -> tryMatch ( ':' , $ node , NULL , TRUE... | Parse a case statement . |
15,755 | private function innerCaseStatementList ( $ terminator ) { static $ terminators = [ T_CASE , T_DEFAULT ] ; $ node = new StatementBlockNode ( ) ; while ( $ this -> currentType !== NULL && $ this -> currentType !== $ terminator && ! in_array ( $ this -> currentType , $ terminators ) ) { $ this -> matchHidden ( $ node ) ;... | Parse the inner statements for a case statement . |
15,756 | private function _break ( ) { $ node = new BreakStatementNode ( ) ; $ this -> mustMatch ( T_BREAK , $ node ) ; if ( $ this -> tryMatch ( ';' , $ node , NULL , TRUE , TRUE ) || $ this -> currentType === T_CLOSE_TAG ) { return $ node ; } $ this -> parseLevel ( $ node ) ; $ this -> endStatement ( $ node ) ; return $ node ... | Parse a break statement . |
15,757 | private function _continue ( ) { $ node = new ContinueStatementNode ( ) ; $ this -> mustMatch ( T_CONTINUE , $ node ) ; if ( $ this -> tryMatch ( ';' , $ node , NULL , TRUE , TRUE ) || $ this -> currentType === T_CLOSE_TAG ) { return $ node ; } $ this -> parseLevel ( $ node ) ; $ this -> endStatement ( $ node ) ; retur... | Parse a continue statement . |
15,758 | private function _return ( ) { $ node = new ReturnStatementNode ( ) ; $ this -> mustMatch ( T_RETURN , $ node ) ; if ( $ this -> tryMatch ( ';' , $ node , NULL , TRUE , TRUE ) || $ this -> currentType === T_CLOSE_TAG ) { return $ node ; } $ node -> addChild ( $ this -> expr ( ) , 'expression' ) ; $ this -> endStatement... | Parse a return statement . |
15,759 | private function _yield ( ) { $ node = new YieldNode ( ) ; $ this -> mustMatch ( T_YIELD , $ node ) ; $ expr = $ this -> expr ( ) ; if ( $ this -> tryMatch ( T_DOUBLE_ARROW , $ node ) ) { $ node -> addChild ( $ expr , 'key' ) ; $ node -> addChild ( $ this -> expr ( ) , 'value' ) ; } else { $ node -> addChild ( $ expr ,... | Parse a yield expression . |
15,760 | private function _global ( ) { $ node = new GlobalStatementNode ( ) ; $ this -> mustMatch ( T_GLOBAL , $ node ) ; $ variables = new CommaListNode ( ) ; do { $ variables -> addChild ( $ this -> globalVar ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ variables ) ) ; $ node -> addChild ( $ variables , 'variables' ) ; $ t... | Parse a global variable declaration list . |
15,761 | private function globalVar ( ) { if ( $ this -> currentType === T_VARIABLE ) { return $ this -> mustMatchToken ( T_VARIABLE ) ; } elseif ( $ this -> currentType === '$' ) { if ( $ this -> isLookAhead ( '{' ) ) { return $ this -> _compoundVariable ( ) ; } else { $ node = new VariableVariableNode ( ) ; $ this -> mustMatc... | Parse global variable . |
15,762 | private function _echo ( ) { $ node = new EchoStatementNode ( ) ; $ this -> mustMatch ( T_ECHO , $ node ) ; $ expressions = new CommaListNode ( ) ; do { $ expressions -> addChild ( $ this -> expr ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ expressions ) ) ; $ node -> addChild ( $ expressions , 'expressions' ) ; $ th... | Parse echo statement . |
15,763 | private function _unset ( ) { $ statement_node = new UnsetStatementNode ( ) ; $ node = new UnsetNode ( ) ; $ this -> mustMatch ( T_UNSET , $ node , 'name' ) ; $ arguments = new CommaListNode ( ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ node -> addChild ( $ arguments , 'arguments' ) ; do { $ arguments ->... | Parse an unset statement . |
15,764 | private function _foreach ( ) { $ node = new ForeachNode ( ) ; $ this -> mustMatch ( T_FOREACH , $ node ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ node -> addChild ( $ this -> expr ( ) , 'onEach' ) ; $ this -> mustMatch ( T_AS , $ node ) ; $ value = $ this -> foreachVariable ( ) ; if ( $ this -> current... | Parse foreach control structure . |
15,765 | private function foreachVariable ( ) { if ( $ this -> currentType === T_LIST ) { return $ this -> _list ( ) ; } else { if ( $ this -> currentType === '&' ) { return $ this -> writeVariable ( ) ; } else { return $ this -> variable ( ) ; } } } | Parse a foreach variable . |
15,766 | private function _declare ( ) { $ node = new DeclareNode ( ) ; $ this -> mustMatch ( T_DECLARE , $ node ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ directives = new CommaListNode ( ) ; $ node -> addChild ( $ directives , 'directives' ) ; if ( ! $ this -> tryMatch ( ')' , $ node , 'closeParen' , FALSE , T... | Parse a declare statement . |
15,767 | private function _try ( ) { $ node = new TryCatchNode ( ) ; $ this -> mustMatch ( T_TRY , $ node ) ; $ node -> addChild ( $ this -> innerStatementBlock ( ) , 'try' ) ; $ catch_node = new CatchNode ( ) ; while ( $ this -> tryMatch ( T_CATCH , $ catch_node ) ) { $ this -> mustMatch ( '(' , $ catch_node , 'openParen' ) ; ... | Parse a try control structure . |
15,768 | private function _throw ( ) { $ node = new ThrowStatementNode ( ) ; $ this -> mustMatch ( T_THROW , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'expression' ) ; $ this -> endStatement ( $ node ) ; return $ node ; } | Parse a throw statement . |
15,769 | private function _goto ( ) { $ node = new GotoStatementNode ( ) ; $ this -> mustMatch ( T_GOTO , $ node ) ; $ this -> mustMatch ( T_STRING , $ node , 'label' ) ; $ this -> endStatement ( $ node ) ; return $ node ; } | Parse a goto statement . |
15,770 | private function exprList ( ) { $ node = new CommaListNode ( ) ; do { $ node -> addChild ( $ this -> expr ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ node ) ) ; return $ node ; } | Parse a list of expressions . |
15,771 | private function staticScalar ( ) { if ( $ this -> currentType === T_ARRAY ) { $ node = new ArrayNode ( ) ; $ this -> mustMatch ( T_ARRAY , $ node ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ this -> staticArrayPairList ( $ node , ')' ) ; $ this -> mustMatch ( ')' , $ node , 'closeParen' , TRUE ) ; return... | Parse a static scalar expression . |
15,772 | private function staticOperand ( ) { static $ scalar_types = [ T_STRING_VARNAME , T_CLASS_C , T_LNUMBER , T_DNUMBER , T_CONSTANT_ENCAPSED_STRING , T_LINE , T_FILE , T_DIR , T_TRAIT_C , T_METHOD_C , T_FUNC_C , T_NS_C , ] ; if ( $ scalar = $ this -> tryMatchToken ( $ scalar_types ) ) { return $ scalar ; } elseif ( $ this... | Parse static operand . |
15,773 | private function expr ( $ static = FALSE ) { static $ end_expression_types = [ ':' , ';' , ',' , ')' , ']' , '}' , T_AS , T_DOUBLE_ARROW , T_CLOSE_TAG ] ; $ expression_nodes = [ ] ; while ( $ this -> currentType !== NULL && ! in_array ( $ this -> currentType , $ end_expression_types ) ) { if ( $ op = $ this -> exprOper... | Parse an expression . |
15,774 | private function exprOperator ( $ static = FALSE ) { $ token_type = $ this -> currentType ; if ( $ operator = OperatorFactory :: createOperator ( $ token_type , $ static ) ) { $ this -> mustMatch ( $ token_type , $ operator , 'operator' ) ; if ( $ token_type === '?' ) { if ( $ this -> currentType === ':' ) { $ colon = ... | Parse an expression operator . |
15,775 | private function backtick ( ) { $ node = new BacktickNode ( ) ; $ this -> mustMatch ( '`' , $ node ) ; $ this -> encapsList ( $ node , '`' , TRUE ) ; $ this -> mustMatch ( '`' , $ node , NULL , TRUE ) ; return $ node ; } | Parse a backtick expression . |
15,776 | private function anonymousFunction ( Node $ static = NULL ) { $ node = new AnonymousFunctionNode ( ) ; if ( $ static ) { $ node -> addChild ( $ static ) ; } $ this -> mustMatch ( T_FUNCTION , $ node ) ; $ this -> tryMatch ( '&' , $ node , 'reference' ) ; $ this -> parameterList ( $ node ) ; if ( $ this -> tryMatch ( T_... | Parse an anonymous function declaration . |
15,777 | private function newExpr ( ) { $ node = new NewNode ( ) ; $ this -> mustMatch ( T_NEW , $ node ) ; $ node -> addChild ( $ this -> classNameReference ( ) , 'className' ) ; if ( $ this -> currentType === '(' ) { $ this -> functionCallParameterList ( $ node ) ; } return $ node ; } | Parse a new expression . |
15,778 | private function classNameReference ( ) { switch ( $ this -> currentType ) { case T_STRING : case T_NS_SEPARATOR : case T_NAMESPACE : $ namespace_path = $ this -> name ( ) ; if ( $ this -> currentType === T_DOUBLE_COLON ) { $ node = $ this -> staticMember ( $ namespace_path ) ; return $ this -> dynamicClassNameReferenc... | Parse a class name reference . |
15,779 | private function staticMember ( $ var_node ) { $ node = new ClassMemberLookupNode ( ) ; $ node -> addChild ( $ var_node , 'className' ) ; $ this -> mustMatch ( T_DOUBLE_COLON , $ node ) ; $ node -> addChild ( $ this -> indirectReference ( ) , 'memberName' ) ; return $ node ; } | Parse static member . |
15,780 | private function dynamicClassNameReference ( Node $ object ) { $ node = $ object ; while ( $ this -> currentType === T_OBJECT_OPERATOR ) { $ node = new ObjectPropertyNode ( ) ; $ node -> addChild ( $ object , 'object' ) ; $ this -> mustMatch ( T_OBJECT_OPERATOR , $ node ) ; $ node -> addChild ( $ this -> objectProperty... | Parse a dynamic class name reference . |
15,781 | private function arrayPairList ( ArrayNode $ node , $ terminator ) { $ elements = new CommaListNode ( ) ; do { if ( $ this -> currentType === $ terminator ) { break ; } $ this -> matchHidden ( $ elements ) ; $ elements -> addChild ( $ this -> arrayPair ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ elements , NULL , TR... | Parse array pair list . |
15,782 | private function staticArrayPairList ( ArrayNode $ node , $ terminator ) { $ elements = new CommaListNode ( ) ; do { if ( $ this -> currentType === $ terminator ) { break ; } $ this -> matchHidden ( $ elements ) ; $ value = $ this -> staticScalar ( ) ; if ( $ this -> currentType === T_DOUBLE_ARROW ) { $ pair = new Arra... | Parse static array pair list . |
15,783 | private function arrayPair ( ) { if ( $ this -> currentType === '&' ) { return $ this -> writeVariable ( ) ; } $ node = $ this -> expr ( ) ; if ( $ this -> currentType === T_DOUBLE_ARROW ) { $ expr = $ node ; $ node = new ArrayPairNode ( ) ; $ node -> addChild ( $ expr , 'key' ) ; $ this -> mustMatch ( T_DOUBLE_ARROW ,... | Parse an array pair . |
15,784 | private function writeVariable ( ) { $ node = new ReferenceVariableNode ( ) ; $ this -> mustMatch ( '&' , $ node ) ; $ node -> addChild ( $ this -> variable ( ) , 'variable' ) ; return $ node ; } | Parse a write variable . |
15,785 | private function encapsList ( $ node , $ terminator , $ encaps_whitespace_allowed = FALSE ) { if ( ! $ encaps_whitespace_allowed ) { if ( $ this -> tryMatch ( T_ENCAPSED_AND_WHITESPACE , $ node ) ) { $ node -> addChild ( $ this -> encapsVar ( ) ) ; } } while ( $ this -> currentType !== NULL && $ this -> currentType !==... | Parse an encaps list . |
15,786 | private function encapsVar ( ) { static $ offset_types = [ T_STRING , T_NUM_STRING , T_VARIABLE ] ; $ node = new StringVariableNode ( ) ; if ( $ this -> tryMatch ( T_DOLLAR_OPEN_CURLY_BRACES , $ node ) ) { if ( $ this -> tryMatch ( T_STRING_VARNAME , $ node ) ) { if ( $ this -> tryMatch ( '[' , $ node ) ) { $ node -> a... | Parse an encaps variable . |
15,787 | private function exprClass ( Node $ class_name ) { $ colon_node = new PartialNode ( ) ; $ this -> mustMatch ( T_DOUBLE_COLON , $ colon_node ) ; if ( $ this -> currentType === T_STRING ) { $ class_constant = $ this -> mustMatchToken ( T_STRING ) ; if ( $ this -> currentType === '(' ) { return $ this -> classMethodCall (... | Parse expression operand given class name . |
15,788 | private function classConstant ( $ class_name , $ colon_node , $ class_constant ) { $ node = new ClassConstantLookupNode ( ) ; $ node -> addChild ( $ class_name , 'className' ) ; $ node -> mergeNode ( $ colon_node ) ; $ node -> addChild ( $ class_constant , 'constantName' ) ; return $ node ; } | Construct a class constant . |
15,789 | private function classMethodCall ( $ class_name , $ colon_node , $ method_name ) { $ node = new ClassMethodCallNode ( ) ; $ node -> addChild ( $ class_name , 'className' ) ; $ node -> mergeNode ( $ colon_node ) ; $ node -> addChild ( $ method_name , 'methodName' ) ; $ this -> functionCallParameterList ( $ node ) ; retu... | Construct a class method call . |
15,790 | private function classNameScalar ( $ class_name , $ colon_node ) { $ node = new ClassNameScalarNode ( ) ; $ node -> addChild ( $ class_name , 'className' ) ; $ node -> mergeNode ( $ colon_node ) ; $ this -> mustMatch ( T_CLASS , $ node , NULL , TRUE ) ; return $ node ; } | Construct a class name scalar . |
15,791 | private function variable ( ) { switch ( $ this -> currentType ) { case T_STRING : case T_NS_SEPARATOR : case T_NAMESPACE : $ namespace_path = $ this -> name ( ) ; if ( $ this -> currentType === '(' ) { return $ this -> functionCall ( $ namespace_path ) ; } elseif ( $ this -> currentType === T_DOUBLE_COLON ) { return $... | Parse variable . |
15,792 | private function varClass ( Node $ class_name ) { $ colon_node = new PartialNode ( ) ; $ this -> mustMatch ( T_DOUBLE_COLON , $ colon_node ) ; if ( $ this -> currentType === T_STRING ) { $ method_name = $ this -> mustMatchToken ( T_STRING ) ; return $ this -> classMethodCall ( $ class_name , $ colon_node , $ method_nam... | Parse variable given class name . |
15,793 | private function functionCall ( Node $ function_reference , $ dynamic = FALSE ) { if ( $ dynamic ) { $ node = new CallbackCallNode ( ) ; $ node -> addChild ( $ function_reference , 'callback' ) ; } else { if ( $ function_reference instanceof NameNode && $ function_reference -> childCount ( ) === 1 && $ function_referen... | Apply any function call array and object deference . |
15,794 | private function objectDereference ( Node $ object ) { while ( $ this -> currentType === T_OBJECT_OPERATOR ) { $ operator_node = new PartialNode ( ) ; $ this -> mustMatch ( T_OBJECT_OPERATOR , $ operator_node , 'operator' ) ; $ object_property = $ this -> objectProperty ( ) ; if ( $ this -> currentType === '(' ) { $ no... | Apply any object dereference to object operand . |
15,795 | private function objectProperty ( ) { if ( $ this -> currentType === T_STRING ) { return $ this -> mustMatchToken ( T_STRING ) ; } elseif ( $ this -> currentType === '{' ) { return $ this -> bracesExpr ( ) ; } else { return $ this -> indirectReference ( ) ; } } | Parse object property . |
15,796 | private function indirectReference ( ) { if ( $ this -> currentType === '$' && ! $ this -> isLookAhead ( '{' ) ) { $ node = new VariableVariableNode ( ) ; $ this -> mustMatch ( '$' , $ node ) ; $ node -> addChild ( $ this -> indirectReference ( ) , 'variable' ) ; return $ node ; } return $ this -> referenceVariable ( )... | Parse indirect variable reference . |
15,797 | private function offsetVariable ( Node $ var ) { if ( $ this -> currentType === '{' ) { $ node = new ArrayLookupNode ( ) ; $ node -> addChild ( $ var , 'array' ) ; $ this -> mustMatch ( '{' , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'key' ) ; $ this -> mustMatch ( '}' , $ node , NULL , TRUE ) ; return $ thi... | Apply any offset to variable . |
15,798 | private function _compoundVariable ( ) { $ node = new CompoundVariableNode ( ) ; $ this -> mustMatch ( '$' , $ node ) ; $ this -> mustMatch ( '{' , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'expression' ) ; $ this -> mustMatch ( '}' , $ node , NULL , TRUE ) ; return $ node ; } | Parse compound variable . |
15,799 | private function bracesExpr ( ) { $ node = new NameExpressionNode ( ) ; $ this -> mustMatch ( '{' , $ node ) ; $ node -> addChild ( $ this -> expr ( ) ) ; $ this -> mustMatch ( '}' , $ node , NULL , TRUE ) ; return $ node ; } | Parse braces expression . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.