idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
15,800 | private function dimOffset ( ArrayLookupNode $ node ) { $ this -> mustMatch ( '[' , $ node ) ; if ( $ this -> currentType !== ']' ) { $ node -> addChild ( $ this -> expr ( ) , 'key' ) ; } $ this -> mustMatch ( ']' , $ node , NULL , TRUE ) ; } | Parse dimensional offset . |
15,801 | private function functionCallParameterList ( $ node ) { $ arguments = new CommaListNode ( ) ; $ this -> mustMatch ( '(' , $ node , 'openParen' ) ; $ node -> addChild ( $ arguments , 'arguments' ) ; if ( $ this -> tryMatch ( ')' , $ node , 'closeParen' , TRUE ) ) { return ; } if ( $ this -> currentType === T_YIELD ) { $... | Parse function call parameter list . |
15,802 | private function functionCallParameter ( ) { switch ( $ this -> currentType ) { case '&' : return $ this -> writeVariable ( ) ; case T_ELLIPSIS : $ node = new SplatNode ( ) ; $ this -> mustMatch ( T_ELLIPSIS , $ node ) ; $ node -> addChild ( $ this -> expr ( ) , 'expression' ) ; return $ node ; default : return $ this ... | Parse function call parameter . |
15,803 | private function arrayDeference ( Node $ node ) { while ( $ this -> currentType === '[' ) { $ n = $ node ; $ node = new ArrayLookupNode ( ) ; $ node -> addChild ( $ n , 'array' ) ; $ this -> dimOffset ( $ node ) ; } return $ node ; } | Apply any array deference to operand . |
15,804 | private function functionDeclaration ( ) { $ node = new FunctionDeclarationNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_FUNCTION , $ node ) ; $ this -> tryMatch ( '&' , $ node , 'reference' ) ; $ name_node = new NameNode ( ) ; $ this -> mustMatch ( T_STRING , $ name_node , NULL , TRUE ) ; $... | Parse function declaration . |
15,805 | private function parameterList ( ParentNode $ parent ) { $ node = new CommaListNode ( ) ; $ this -> mustMatch ( '(' , $ parent , 'openParen' ) ; $ parent -> addChild ( $ node , 'parameters' ) ; if ( $ this -> tryMatch ( ')' , $ parent , 'closeParen' , TRUE ) ) { return ; } do { $ node -> addChild ( $ this -> parameter ... | Parse parameter list . |
15,806 | private function parameter ( ) { $ node = new ParameterNode ( ) ; if ( $ type = $ this -> optionalTypeHint ( ) ) { $ node -> addChild ( $ type , 'typeHint' ) ; } $ this -> tryMatch ( '&' , $ node , 'reference' ) ; $ this -> tryMatch ( T_ELLIPSIS , $ node , 'variadic' ) ; $ this -> mustMatch ( T_VARIABLE , $ node , 'nam... | Parse parameter . |
15,807 | private function optionalTypeHint ( ) { static $ array_callable_types = [ T_ARRAY , T_CALLABLE ] ; $ node = NULL ; if ( $ node = $ this -> tryMatchToken ( $ array_callable_types ) ) { return $ node ; } elseif ( in_array ( $ this -> currentType , self :: $ namespacePathTypes ) ) { return $ this -> name ( ) ; } return NU... | Parse optional class type for parameter . |
15,808 | private function innerStatementList ( StatementBlockNode $ parent , $ terminator ) { while ( $ this -> currentType !== NULL && $ this -> currentType !== $ terminator ) { $ this -> matchHidden ( $ parent ) ; $ parent -> addChild ( $ this -> innerStatement ( ) ) ; } } | Parse inner statement list . |
15,809 | private function innerStatementBlock ( ) { $ node = new StatementBlockNode ( ) ; $ this -> mustMatch ( '{' , $ node , NULL , FALSE , TRUE ) ; $ this -> innerStatementList ( $ node , '}' ) ; $ this -> mustMatch ( '}' , $ node , NULL , TRUE , TRUE ) ; return $ node ; } | Parse inner statement block . |
15,810 | private function innerStatement ( ) { switch ( $ this -> currentType ) { case T_HALT_COMPILER : throw new ParserException ( $ this -> filename , $ this -> iterator -> getLineNumber ( ) , $ this -> iterator -> getColumnNumber ( ) , "__halt_compiler can only be used from the outermost scope" ) ; case T_ABSTRACT : case T_... | Parse an inner statement . |
15,811 | private function name ( ) { $ node = new NameNode ( ) ; if ( $ this -> tryMatch ( T_NAMESPACE , $ node ) ) { $ this -> mustMatch ( T_NS_SEPARATOR , $ node ) ; } elseif ( $ this -> tryMatch ( T_NS_SEPARATOR , $ node ) ) { } $ this -> mustMatch ( T_STRING , $ node , NULL , TRUE ) ; while ( $ this -> tryMatch ( T_NS_SEPAR... | Parse a namespace path . |
15,812 | private function _namespace ( ) { $ node = new NamespaceNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_NAMESPACE , $ node ) ; if ( $ this -> currentType === T_STRING ) { $ name = $ this -> namespaceName ( ) ; $ node -> addChild ( $ name , 'name' ) ; } $ this -> matchHidden ( $ node ) ; $ body... | Parse a namespace declaration . |
15,813 | private function namespaceBlock ( ) { $ node = new StatementBlockNode ( ) ; $ this -> matchHidden ( $ node ) ; while ( $ this -> currentType !== NULL ) { if ( $ this -> currentType === T_NAMESPACE && ! $ this -> isLookAhead ( T_NS_SEPARATOR ) ) { break ; } $ node -> addChild ( $ this -> topStatement ( ) ) ; $ this -> m... | Parse a list of top level namespace statements . |
15,814 | private function namespaceName ( ) { $ node = new NameNode ( ) ; $ this -> mustMatch ( T_STRING , $ node , NULL , TRUE ) ; while ( $ this -> tryMatch ( T_NS_SEPARATOR , $ node ) ) { $ this -> mustMatch ( T_STRING , $ node , NULL , TRUE ) ; } return $ node ; } | Parse a namespace name . |
15,815 | private function useBlock ( ) { $ node = new UseDeclarationBlockNode ( ) ; $ node -> addChild ( $ this -> _use ( ) ) ; while ( $ this -> currentType === T_USE ) { $ this -> matchHidden ( $ node ) ; $ node -> addChild ( $ this -> _use ( ) ) ; } return $ node ; } | Parse a block of use declaration statements . |
15,816 | private function _use ( ) { $ node = new UseDeclarationStatementNode ( ) ; $ this -> mustMatch ( T_USE , $ node ) ; $ this -> tryMatch ( T_FUNCTION , $ node , 'useFunction' ) || $ this -> tryMatch ( T_CONST , $ node , 'useConst' ) ; $ declarations = new CommaListNode ( ) ; do { $ declarations -> addChild ( $ this -> us... | Parse a use declaration list . |
15,817 | private function useDeclaration ( ) { $ declaration = new UseDeclarationNode ( ) ; $ node = new NameNode ( ) ; $ this -> tryMatch ( T_NS_SEPARATOR , $ node ) ; $ this -> mustMatch ( T_STRING , $ node , NULL , TRUE ) -> getText ( ) ; while ( $ this -> tryMatch ( T_NS_SEPARATOR , $ node ) ) { $ this -> mustMatch ( T_STRI... | Parse a use declaration . |
15,818 | private function classDeclaration ( ) { $ node = new ClassNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> tryMatch ( T_ABSTRACT , $ node , 'abstract' ) || $ this -> tryMatch ( T_FINAL , $ node , 'final' ) ; $ this -> mustMatch ( T_CLASS , $ node ) ; $ name_node = new NameNode ( ) ; $ this -> mustMatch ( T_S... | Parse a class declaration . |
15,819 | private function classMemberList ( $ doc_comment , ModifiersNode $ modifiers ) { if ( $ modifiers -> getAbstract ( ) ) { throw new ParserException ( $ this -> filename , $ this -> iterator -> getLineNumber ( ) , $ this -> iterator -> getColumnNumber ( ) , "members can not be declared abstract" ) ; } if ( $ modifiers ->... | Parse a class member list . |
15,820 | private function classMember ( ) { $ node = new ClassMemberNode ( ) ; $ this -> mustMatch ( T_VARIABLE , $ node , 'name' , TRUE ) ; if ( $ this -> tryMatch ( '=' , $ node ) ) { $ node -> addChild ( $ this -> staticScalar ( ) , 'value' ) ; } return $ node ; } | Parse a class member . |
15,821 | private function classMethod ( $ doc_comment , ModifiersNode $ modifiers ) { $ node = new ClassMethodNode ( ) ; $ node -> mergeNode ( $ doc_comment ) ; $ node -> mergeNode ( $ modifiers ) ; $ this -> mustMatch ( T_FUNCTION , $ node ) ; $ this -> tryMatch ( '&' , $ node , 'reference' ) ; $ this -> mustMatch ( T_STRING ,... | Parse a class method |
15,822 | private function traitUse ( ) { $ node = new TraitUseNode ( ) ; $ this -> mustMatch ( T_USE , $ node ) ; $ traits = new CommaListNode ( ) ; do { $ traits -> addChild ( $ this -> name ( ) ) ; } while ( $ this -> tryMatch ( ',' , $ traits ) ) ; $ node -> addChild ( $ traits , 'traits' ) ; if ( $ this -> tryMatch ( '{' , ... | Parse a trait use statement . |
15,823 | private function traitAdaptation ( ) { $ qualified_name = $ this -> name ( ) ; if ( $ qualified_name -> childCount ( ) === 1 && $ this -> currentType !== T_DOUBLE_COLON ) { return $ this -> traitAlias ( $ qualified_name ) ; } $ node = new TraitMethodReferenceNode ( ) ; $ node -> addChild ( $ qualified_name , 'traitName... | Parse a trait adaptation statement . |
15,824 | private function traitAlias ( $ trait_method_reference ) { $ node = new TraitAliasNode ( ) ; $ node -> addChild ( $ trait_method_reference , 'traitMethodReference' ) ; $ this -> mustMatch ( T_AS , $ node ) ; if ( $ trait_modifier = $ this -> tryMatchToken ( self :: $ visibilityTypes ) ) { $ node -> addChild ( $ trait_m... | Parse a trait alias . |
15,825 | private function interfaceDeclaration ( ) { $ node = new InterfaceNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_INTERFACE , $ node ) ; $ name_node = new NameNode ( ) ; $ this -> mustMatch ( T_STRING , $ name_node , NULL , TRUE ) ; $ node -> addChild ( $ name_node , 'name' ) ; if ( $ this -> ... | Parse an interface declaration . |
15,826 | private function interfaceMethod ( ) { static $ visibility_keyword_types = [ T_PUBLIC , T_PROTECTED , T_PRIVATE ] ; $ node = new InterfaceMethodNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ is_static = $ this -> tryMatch ( T_STATIC , $ node , 'static' ) ; while ( in_array ( $ this -> currentType , $ visibility_ke... | Parse an interface method declaration . |
15,827 | private function traitDeclaration ( ) { $ node = new TraitNode ( ) ; $ this -> matchDocComment ( $ node ) ; $ this -> mustMatch ( T_TRAIT , $ node ) ; $ name_node = new NameNode ( ) ; $ this -> mustMatch ( T_STRING , $ name_node , NULL , TRUE ) ; $ node -> addChild ( $ name_node , 'name' ) ; if ( $ this -> currentType ... | Parse a trait declaration . |
15,828 | private function nextToken ( $ capture_doc_comment = FALSE ) { $ this -> iterator -> next ( ) ; $ capture_doc_comment ? $ this -> skipHiddenCaptureDocComment ( ) : $ this -> skipHidden ( ) ; $ this -> current = $ this -> iterator -> current ( ) ; if ( $ this -> current ) { $ this -> currentType = $ this -> current -> g... | Move iterator to next non hidden token . |
15,829 | private function isLookAhead ( $ expected_type , $ skip_type = NULL ) { $ token = NULL ; for ( $ offset = 1 ; ; $ offset ++ ) { $ token = $ this -> iterator -> peek ( $ offset ) ; if ( $ token === NULL ) { return FALSE ; } if ( ! ( $ token instanceof HiddenNode ) && $ token -> getType ( ) !== $ skip_type ) { return $ e... | Look ahead from current position at tokens and check if the token at offset is of an expected type where the offset ignores hidden tokens . |
15,830 | public function update ( ContentUpdateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( null !== $ content = ContentQuery :: create ( ) -> findPk ( $ event -> getContentId ( ) ) ) { $ con = Propel :: getWriteConnection ( ContentTableMap :: DATABASE_NAME ) ; $ con -> beginTransaction ( ) ; $ c... | process update content |
15,831 | public function updateSeo ( UpdateSeoEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { return $ this -> genericUpdateSeo ( ContentQuery :: create ( ) , $ event , $ dispatcher ) ; } | Change Content SEO |
15,832 | public function viewCheck ( ViewCheckEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( $ event -> getView ( ) == 'content' ) { $ content = ContentQuery :: create ( ) -> filterById ( $ event -> getViewId ( ) ) -> filterByVisible ( 1 ) -> count ( ) ; if ( $ content == 0 ) { $ dispatcher -> disp... | Check if is a content view and if content_id is visible |
15,833 | protected function initParser ( ) { $ this -> parser -> unregisterPlugin ( 'function' , 'intl' ) ; $ this -> parser -> registerPlugin ( 'function' , 'intl' , [ $ this , 'translate' ] ) ; $ this -> parser -> assign ( "locales" , $ this -> locales ) ; } | Initialize the smarty parser . |
15,834 | public function translate ( $ params , $ smarty ) { $ translation = '' ; if ( empty ( $ params [ "l" ] ) ) { throw new RuntimeException ( 'Translation Error. Key is empty.' ) ; } elseif ( empty ( $ params [ "locale" ] ) ) { throw new RuntimeException ( 'Translation Error. Locale is empty.' ) ; } else { $ inString = ( 0... | Smarty function that replace the classic intl function . |
15,835 | public function importChangePosition ( UpdatePositionEvent $ updatePositionEvent , $ eventName , EventDispatcherInterface $ dispatcher ) { $ this -> handler -> getImport ( $ updatePositionEvent -> getObjectId ( ) , true ) ; $ this -> genericUpdatePosition ( new ImportQuery , $ updatePositionEvent , $ dispatcher ) ; } | Handle import change position event |
15,836 | public function importCategoryChangePosition ( UpdatePositionEvent $ updatePositionEvent , $ eventName , EventDispatcherInterface $ dispatcher ) { $ this -> handler -> getCategory ( $ updatePositionEvent -> getObjectId ( ) , true ) ; $ this -> genericUpdatePosition ( new ImportCategoryQuery , $ updatePositionEvent , $ ... | Handle import category change position event |
15,837 | protected function checkModuleArgument ( $ paramValue ) { if ( ! preg_match ( '#^([a-z0-9]+):([\+-]?[0-9]+|up|down)$#i' , $ paramValue , $ matches ) ) { throw new \ InvalidArgumentException ( 'Arguments must be in format moduleName:[+|-]position where position is an integer or up or down.' ) ; } $ this -> moduleQuery -... | Check a module argument format |
15,838 | protected function checkPositions ( InputInterface $ input , OutputInterface $ output , & $ isAbsolute = false ) { $ isRelative = false ; foreach ( array_count_values ( $ this -> positionsList ) as $ value => $ count ) { if ( \ is_int ( $ value ) && $ value [ 0 ] !== '+' && $ value [ 0 ] !== '-' ) { $ isAbsolute = true... | Check positions consistency |
15,839 | public function importsClass ( $ class_name = NULL ) { if ( $ this -> useFunction || $ this -> useConst ) { return FALSE ; } if ( $ class_name ) { foreach ( $ this -> getDeclarations ( ) as $ declaration ) { if ( $ declaration -> getName ( ) -> getPath ( ) === $ class_name ) { return TRUE ; } } return FALSE ; } else { ... | Test whether use declaration imports a class . |
15,840 | public function importsFunction ( $ function_name = NULL ) { if ( ! $ this -> useFunction ) { return FALSE ; } if ( $ function_name ) { foreach ( $ this -> getDeclarations ( ) as $ declaration ) { if ( $ declaration -> getName ( ) -> getPath ( ) === $ function_name ) { return TRUE ; } } return FALSE ; } else { return T... | Test whether use declaration imports a function . |
15,841 | public function importsConst ( $ const_name = NULL ) { if ( ! $ this -> useConst ) { return FALSE ; } if ( $ const_name ) { foreach ( $ this -> getDeclarations ( ) as $ declaration ) { if ( $ declaration -> getName ( ) -> getPath ( ) === $ const_name ) { return TRUE ; } } return FALSE ; } else { return TRUE ; } } | Test whether use declaration imports a constant . |
15,842 | public function getDeliveryAddress ( ) { try { return AddressQuery :: create ( ) -> findPk ( $ this -> getRequest ( ) -> getSession ( ) -> getOrder ( ) -> getChoosenDeliveryAddress ( ) ) ; } catch ( \ Exception $ ex ) { throw new \ LogicException ( "Failed to get delivery address (" . $ ex -> getMessage ( ) . ")" ) ; }... | Return an Address a CouponManager can process |
15,843 | public function getCartTotalPrice ( $ withItemsInPromo = true ) { $ total = 0 ; $ cartItems = $ this -> getRequest ( ) -> getSession ( ) -> getSessionCart ( $ this -> getDispatcher ( ) ) -> getCartItems ( ) ; foreach ( $ cartItems as $ cartItem ) { if ( $ withItemsInPromo || ! $ cartItem -> getPromo ( ) ) { $ total += ... | Return Products total price |
15,844 | public function getCurrentCoupons ( ) { $ couponCodes = $ this -> getRequest ( ) -> getSession ( ) -> getConsumedCoupons ( ) ; if ( null === $ couponCodes ) { return array ( ) ; } $ couponFactory = $ this -> container -> get ( 'thelia.coupon.factory' ) ; $ coupons = [ ] ; foreach ( $ couponCodes as $ couponCode ) { try... | Return all Coupon given during the Checkout |
15,845 | public function getParser ( ) { if ( $ this -> parser == null ) { $ this -> parser = $ this -> container -> get ( 'thelia.parser' ) ; $ this -> parser -> setTemplateDefinition ( $ this -> parser -> getTemplateHelper ( ) -> getActiveAdminTemplate ( ) ) ; } return $ this -> parser ; } | Return platform Parser |
15,846 | public function pushCouponInSession ( $ couponCode ) { $ consumedCoupons = $ this -> getRequest ( ) -> getSession ( ) -> getConsumedCoupons ( ) ; if ( ! isset ( $ consumedCoupons ) || ! $ consumedCoupons ) { $ consumedCoupons = array ( ) ; } if ( ! isset ( $ consumedCoupons [ $ couponCode ] ) ) { $ consumedCoupons [ $ ... | Add a coupon in session |
15,847 | public function drawBaseBackOfficeInputs ( $ templateName , $ otherFields ) { return $ this -> facade -> getParser ( ) -> render ( $ templateName , array_merge ( $ otherFields , [ 'attribute_field_name' => $ this -> makeCouponFieldName ( self :: ATTRIBUTE ) , 'attribute_value' => $ this -> attribute , 'attribute_av_fie... | Renders the template which implements coupon specific user - input using the provided template file and a list of specific input fields . |
15,848 | protected function addSeoFields ( $ exclude = array ( ) ) { if ( ! \ in_array ( 'url' , $ exclude ) ) { $ this -> formBuilder -> add ( 'url' , 'text' , [ 'required' => false , 'label' => Translator :: getInstance ( ) -> trans ( 'Rewriten URL' ) , 'label_attr' => [ 'for' => 'rewriten_url_field' , ] , 'attr' => [ 'placeh... | Add seo meta title meta description and meta keywords fields |
15,849 | protected function getCurrentListOrder ( $ update_session = true ) { return $ this -> getListOrderFromSession ( $ this -> objectName , $ this -> orderRequestParameterName , $ this -> defaultListOrder ) ; } | Return the current list order identifier updating it in the same time . |
15,850 | public function renderToolStyleHeaderAction ( ) { $ melisTool = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTool' ) ; $ melisTool -> setMelisToolKey ( 'meliscms' , 'meliscms_tool_templates' ) ; $ melisKey = $ this -> params ( ) -> fromRoute ( 'melisKey' , '' ) ; $ zoneConfig = $ this -> params ( ) -> fromRoute (... | This is where you place your buttons for the tools |
15,851 | public function getStyleByPageId ( $ pageId ) { $ style = "" ; $ pageStyle = $ this -> getServiceLocator ( ) -> get ( 'MelisPageStyle' ) ; if ( $ pageStyle ) { $ dataStyle = $ pageStyle -> getStyleByPageId ( $ pageId ) ; $ style = $ dataStyle ; } return $ style ; } | Return style of a page |
15,852 | public function insertTemplate ( HookRenderEvent $ event , $ code ) { if ( array_key_exists ( $ code , $ this -> templates ) ) { $ templates = explode ( ';' , $ this -> templates [ $ code ] ) ; $ allArguments = $ event -> getTemplateVars ( ) + $ event -> getArguments ( ) ; foreach ( $ templates as $ template ) { list (... | This function is called when hook uses the automatic insert template . |
15,853 | public function render ( $ templateName , array $ parameters = array ( ) ) { $ templateDir = $ this -> assetsResolver -> resolveAssetSourcePath ( $ this -> module -> getCode ( ) , false , $ templateName , $ this -> parser ) ; if ( null !== $ templateDir ) { $ content = $ this -> parser -> render ( $ templateDir . DS . ... | helper function allowing you to render a template using a template engine |
15,854 | public function dump ( $ fileName ) { $ fileDir = $ this -> assetsResolver -> resolveAssetSourcePath ( $ this -> module -> getCode ( ) , false , $ fileName , $ this -> parser ) ; if ( null !== $ fileDir ) { $ content = file_get_contents ( $ fileDir . DS . $ fileName ) ; if ( false === $ content ) { $ content = "" ; } }... | helper function allowing you to get the content of a file |
15,855 | public function addCSS ( $ fileName , $ attributes = [ ] , $ filters = [ ] ) { $ tag = "" ; $ url = $ this -> assetsResolver -> resolveAssetURL ( $ this -> module -> getCode ( ) , $ fileName , "css" , $ this -> parser , $ filters ) ; if ( "" !== $ url ) { $ tags = array ( ) ; $ tags [ ] = '<link rel="stylesheet" type="... | helper function allowing you to generate the HTML link tag |
15,856 | protected function getRequest ( ) { if ( null === $ this -> request ) { $ this -> request = $ this -> getParser ( ) -> getRequest ( ) ; } return $ this -> request ; } | get the request |
15,857 | protected function getSession ( ) { if ( null === $ this -> session ) { if ( null !== $ this -> getRequest ( ) ) { $ this -> session = $ this -> request -> getSession ( ) ; } } return $ this -> session ; } | get the session |
15,858 | protected function getView ( ) { $ ret = "" ; if ( null !== $ this -> getRequest ( ) ) { $ ret = $ this -> getRequest ( ) -> attributes -> get ( "_view" , "" ) ; } return $ ret ; } | Get the view argument for the request . |
15,859 | protected function getCart ( ) { if ( null === $ this -> cart ) { $ this -> cart = $ this -> getSession ( ) ? $ this -> getSession ( ) -> getSessionCart ( $ this -> dispatcher ) : null ; } return $ this -> cart ; } | Get the cart from the session |
15,860 | protected function getOrder ( ) { if ( null === $ this -> order ) { $ this -> order = $ this -> getSession ( ) ? $ this -> getSession ( ) -> getOrder ( ) : null ; } return $ this -> order ; } | Get the order from the session |
15,861 | protected function getCurrency ( ) { if ( null === $ this -> currency ) { $ this -> currency = $ this -> getSession ( ) ? $ this -> getSession ( ) -> getCurrency ( true ) : Currency :: getDefaultCurrency ( ) ; } return $ this -> currency ; } | Get the current currency used or if not present the default currency for the shop |
15,862 | protected function getCustomer ( ) { if ( null === $ this -> customer ) { $ this -> customer = $ this -> getSession ( ) ? $ this -> getSession ( ) -> getCustomerUser ( ) : null ; } return $ this -> customer ; } | Get the current customer logged in . If no customer is logged return null |
15,863 | protected function getLang ( ) { if ( null === $ this -> lang ) { $ this -> lang = $ this -> getSession ( ) ? $ this -> getSession ( ) -> getLang ( true ) : $ this -> lang = Lang :: getDefaultLanguage ( ) ; } return $ this -> lang ; } | Get the current lang used or if not present the default lang for the shop |
15,864 | public function addTemplate ( $ hookCode , $ value ) { if ( array_key_exists ( $ hookCode , $ this -> templates ) ) { throw new \ InvalidArgumentException ( sprintf ( "The hook '%s' is already used in this class." , $ hookCode ) ) ; } $ this -> templates [ $ hookCode ] = $ value ; } | Add a new template for automatic render |
15,865 | protected function addHooksMethodCall ( ContainerBuilder $ container , Definition $ definition ) { $ moduleHooks = ModuleHookQuery :: create ( ) -> orderByHookId ( ) -> orderByPosition ( ) -> orderById ( ) -> find ( ) ; $ modulePosition = 0 ; $ hookId = 0 ; foreach ( $ moduleHooks as $ moduleHook ) { if ( ! $ container... | First the new hooks are positioning next to the last module hook . Next if the module hook and module hook is active a new listener is added to the service definition . |
15,866 | protected function getHookType ( $ name ) { $ type = TemplateDefinition :: FRONT_OFFICE ; if ( null !== $ name && \ is_string ( $ name ) ) { $ name = preg_replace ( "[^a-z]" , "" , strtolower ( trim ( $ name ) ) ) ; if ( \ in_array ( $ name , array ( 'bo' , 'back' , 'backoffice' ) ) ) { $ type = TemplateDefinition :: B... | get the hook type according to the type attribute of the hook tag |
15,867 | protected function isValidHookMethod ( $ className , $ methodName , $ block , $ failSafe = false ) { try { $ method = new ReflectionMethod ( $ className , $ methodName ) ; $ parameters = $ method -> getParameters ( ) ; $ eventType = ( $ block ) ? HookDefinition :: RENDER_BLOCK_EVENT : HookDefinition :: RENDER_FUNCTION_... | Test if the method that will handled the hook is valid |
15,868 | protected function genericUpdatePosition ( ModelCriteria $ query , UpdatePositionEvent $ event , EventDispatcherInterface $ dispatcher = null ) { if ( null !== $ object = $ query -> findPk ( $ event -> getObjectId ( ) ) ) { if ( ! isset ( class_uses ( $ object ) [ 'Thelia\Model\Tools\PositionManagementTrait' ] ) ) { th... | Changes object position selecting absolute ou relative change . |
15,869 | protected function genericUpdateSeo ( ModelCriteria $ query , UpdateSeoEvent $ event , EventDispatcherInterface $ dispatcher = null ) { if ( null !== $ object = $ query -> findPk ( $ event -> getObjectId ( ) ) ) { $ object -> setDispatcher ( $ dispatcher !== null ? $ dispatcher : $ event -> getDispatcher ( ) ) -> setLo... | Changes SEO Fields for an object . |
15,870 | public function genericToggleVisibility ( ModelCriteria $ query , ToggleVisibilityEvent $ event , EventDispatcherInterface $ dispatcher = null ) { if ( null !== $ object = $ query -> findPk ( $ event -> getObjectId ( ) ) ) { $ newVisibility = ! $ object -> getVisible ( ) ; $ object -> setDispatcher ( $ dispatcher !== n... | Toggle visibility for an object |
15,871 | protected function schemaValidate ( \ DOMDocument $ dom , \ SplFileInfo $ xsdFile ) { $ errorMessages = [ ] ; try { libxml_use_internal_errors ( true ) ; if ( ! $ dom -> schemaValidate ( $ xsdFile -> getRealPath ( ) ) ) { $ errors = libxml_get_errors ( ) ; foreach ( $ errors as $ error ) { $ errorMessages [ ] = sprintf... | Validate the schema of a XML file with a given xsd file |
15,872 | public function onKernelView ( GetResponseForControllerResultEvent $ event ) { $ parser = $ this -> container -> get ( 'thelia.parser' ) ; $ templateHelper = $ this -> container -> get ( 'thelia.template_helper' ) ; $ parser -> setTemplateDefinition ( $ templateHelper -> getActiveFrontTemplate ( ) , true ) ; $ request ... | Launch the parser defined on the constructor and get the result . |
15,873 | public function enterNode ( Node $ node ) { if ( $ node instanceof ConstFetch || $ node instanceof FuncCall ) { $ node -> name = null ; } if ( $ node instanceof FullyQualified ) { $ this -> names [ ] = $ node -> toString ( ) ; } return $ node ; } | Enter the node and record the name . |
15,874 | public function getMethodNames ( ) { return array_map ( function ( ClassMethodNode $ node ) { return $ node -> getName ( ) -> getText ( ) ; } , $ this -> getMethods ( ) -> toArray ( ) ) ; } | Returns the names of all class methods regardless of visibility . |
15,875 | public function getProperty ( $ name ) { $ name = ltrim ( $ name , '$' ) ; $ properties = $ this -> getProperties ( ) -> filter ( function ( ClassMemberNode $ property ) use ( $ name ) { return ltrim ( $ property -> getName ( ) , '$' ) === $ name ; } ) ; return $ properties -> isEmpty ( ) ? NULL : $ properties [ 0 ] ; ... | Returns a property by name if it exists . |
15,876 | public function createProperty ( $ name , ExpressionNode $ value = NULL , $ visibility = 'public' ) { return $ this -> appendProperty ( ClassMemberNode :: create ( $ name , $ value , $ visibility ) ) ; } | Creates a new property in this class . |
15,877 | public function appendProperty ( $ property ) { if ( is_string ( $ property ) ) { $ property = ClassMemberListNode :: create ( $ property ) ; } $ properties = $ this -> statements -> children ( Filter :: isInstanceOf ( '\Pharborist\ClassMemberListNode' ) ) ; if ( $ properties -> count ( ) === 0 ) { $ this -> statements... | Add property to class . |
15,878 | public static function create ( $ comment ) { $ comment = trim ( $ comment ) ; $ lines = array_map ( 'trim' , explode ( "\n" , $ comment ) ) ; $ text = "/**\n" ; foreach ( $ lines as $ i => $ line ) { $ text .= ' * ' . $ line . "\n" ; } $ text .= ' */' ; return new DocCommentNode ( T_DOC_COMMENT , $ text ) ; } | Creates a PHPDoc comment . |
15,879 | public function setIndent ( $ indent ) { $ lines = explode ( "\n" , $ this -> text ) ; if ( count ( $ lines ) === 1 ) { return $ this ; } $ comment = '' ; $ last_index = count ( $ lines ) - 1 ; foreach ( $ lines as $ i => $ line ) { if ( $ i === 0 ) { $ comment .= trim ( $ line ) . "\n" ; } elseif ( $ i === $ last_inde... | Set indent for document comment . |
15,880 | public function getDocBlock ( ) { if ( $ this -> docBlock === NULL ) { $ namespace = '\\' ; $ aliases = array ( ) ; $ namespace_node = $ this -> closest ( Filter :: isInstanceOf ( '\Pharborist\Namespaces\NamespaceNode' ) ) ; if ( $ namespace_node !== NULL ) { $ namespace = $ namespace_node -> getName ( ) ? $ namespace_... | Return the parsed doc comment . |
15,881 | public function getParametersByName ( ) { $ param_tags = $ this -> getDocBlock ( ) -> getTagsByName ( 'param' ) ; $ parameters = array ( ) ; foreach ( $ param_tags as $ param_tag ) { $ name = ltrim ( $ param_tag -> getVariableName ( ) , '$' ) ; $ parameters [ $ name ] = $ param_tag ; } return $ parameters ; } | Get the parameter tags by name . |
15,882 | public function getParameter ( $ parameterName ) { $ parameterName = ltrim ( $ parameterName , '$' ) ; $ param_tags = $ this -> getDocBlock ( ) -> getTagsByName ( 'param' ) ; foreach ( $ param_tags as $ param_tag ) { if ( ltrim ( $ param_tag -> getVariableName ( ) , '$' ) === $ parameterName ) { return $ param_tag ; } ... | Get a parameter tag . |
15,883 | public function make ( array $ config ) { Arr :: requires ( $ config , [ 'token' ] ) ; $ client = new Client ( ) ; return new PagerdutyGateway ( $ client , $ config ) ; } | Create a new pagerduty gateway instance . |
15,884 | public function fetch ( array $ options = [ ] , array $ modifyVars = [ ] ) { if ( empty ( $ options [ 'overwrite' ] ) ) { $ options [ 'overwrite' ] = true ; } $ overwrite = $ options [ 'overwrite' ] ; unset ( $ options [ 'overwrite' ] ) ; $ matches = $ css = $ less = [ ] ; preg_match_all ( '@(<link[^>]+>)@' , $ this ->... | Fetches less stylesheets added to css block and compiles them |
15,885 | public function less ( $ less = 'styles.less' , array $ options = [ ] , array $ modifyVars = [ ] ) { $ options = $ this -> setOptions ( $ options ) ; $ less = ( array ) $ less ; if ( $ options [ 'js' ] [ 'env' ] == 'development' ) { return $ this -> jsBlock ( $ less , $ options ) ; } try { $ css = $ this -> compile ( $... | Compiles any less files passed and returns the compiled css . In case of error it will load less with the javascritp parser so you ll be able to see any errors on screen . If not check out the error . log file in your CakePHP s logs folder . |
15,886 | protected function jsBlock ( $ less , array $ options = [ ] ) { $ return = '' ; $ less = ( array ) $ less ; foreach ( $ less as $ les ) { $ return .= $ this -> Html -> meta ( 'link' , null , [ 'link' => $ les , 'rel' => 'stylesheet/less' ] ) ; } $ return .= $ this -> Html -> scriptBlock ( sprintf ( 'less = %s;' , json_... | Returns the required script and link tags to get less . js working |
15,887 | protected function compile ( array $ input , $ cache , array $ options = [ ] , array $ modifyVars = [ ] ) { $ parse = $ this -> prepareInputFilesForParsing ( $ input ) ; if ( $ cache ) { $ options += [ 'cache_dir' => $ this -> cssPath ] ; return \ Less_Cache :: Get ( $ parse , $ options , $ modifyVars ) ; } $ lessc = n... | Compiles an input less file to an output css file using the PHP compiler . |
15,888 | protected function prepareInputFilesForParsing ( array $ input = [ ] ) { $ parse = [ ] ; foreach ( $ input as $ in ) { $ less = realpath ( WWW_ROOT . $ in ) ; list ( $ plugin , $ basefile ) = $ this -> _View -> pluginSplit ( $ in , false ) ; if ( ! empty ( $ plugin ) ) { $ less = realpath ( Plugin :: path ( $ plugin ) ... | Prepares input files as Less . php parser wants them . |
15,889 | protected function setOptions ( array $ options ) { $ this -> parserDefaults = array_merge ( $ this -> parserDefaults , [ 'import_callback' => function ( $ lessTree ) { if ( $ pathAndUri = $ lessTree -> PathAndUri ( ) ) { return $ pathAndUri ; } $ file = $ lessTree -> getPath ( ) ; list ( $ plugin , $ basefile ) = $ th... | Sets the less configuration var options based on the ones given by the user and our default ones . |
15,890 | protected function assetBaseUrl ( $ plugin , $ asset ) { $ dir = dirname ( $ asset ) ; $ path = ! empty ( $ dir ) && $ dir != '.' ? "/$dir" : null ; return $ this -> Url -> assetUrl ( $ plugin . $ path ) ; } | Returns tha full base url for the given asset |
15,891 | protected function pluginAssetFile ( array $ url ) { list ( $ plugin , $ basefile ) = $ url ; if ( $ plugin && Plugin :: loaded ( $ plugin ) ) { return realpath ( Plugin :: path ( $ plugin ) . 'webroot' . DS . $ basefile ) ; } return false ; } | Builds asset file path for a plugin based on url . |
15,892 | protected function assetSplit ( $ url ) { $ basefile = ltrim ( ltrim ( $ url , '.' ) , '/' ) ; $ exploded = explode ( '/' , $ basefile ) ; $ plugin = Inflector :: camelize ( array_shift ( $ exploded ) ) ; $ basefile = implode ( DS , $ exploded ) ; return [ $ plugin , $ basefile ] ; } | Splits an asset URL |
15,893 | public function make ( array $ config ) { Arr :: requires ( $ config , [ 'token' ] ) ; $ client = new Client ( ) ; return new PushoverGateway ( $ client , $ config ) ; } | Create a new pushover gateway instance . |
15,894 | public function finalizeRows ( ) { if ( true === $ this -> countable && $ this -> getResultDataCollectionCount ( ) !== $ realCount = $ this -> getCount ( ) ) { foreach ( $ this -> collection as & $ item ) { $ item -> set ( 'LOOP_TOTAL' , $ realCount ) ; } } } | Adjust the collection once all results have been added . |
15,895 | public static function parse ( string $ amount ) { $ parser = new DecimalMoneyParser ( new ISOCurrencies ( ) ) ; return static :: given ( $ parser -> parse ( $ amount , new Currency ( 'MYR' ) ) -> getAmount ( ) ) ; } | Parse value as ringgit . |
15,896 | public function findByCountryAndModule ( Country $ country , Module $ module , State $ state = null ) { $ response = null ; $ countryInAreaList = CountryAreaQuery :: findByCountryAndState ( $ country , $ state ) ; foreach ( $ countryInAreaList as $ countryInArea ) { $ response = self :: create ( ) -> filterByAreaId ( $... | Check if a delivery module is suitable for the given country . |
15,897 | public function renderPagetabEditionAction ( ) { $ idPage = $ this -> params ( ) -> fromRoute ( 'idPage' , $ this -> params ( ) -> fromQuery ( 'idPage' , '' ) ) ; $ melisKey = $ this -> params ( ) -> fromRoute ( 'melisKey' , '' ) ; $ container = new Container ( 'meliscms' ) ; if ( ! empty ( $ container [ 'content-pages... | Makes the rendering of the Page Edition Tab |
15,898 | public function savePageSessionPluginAction ( ) { $ idPage = $ this -> params ( ) -> fromRoute ( 'idPage' , $ this -> params ( ) -> fromQuery ( 'idPage' , '' ) ) ; $ translator = $ this -> serviceLocator -> get ( 'translator' ) ; $ postValues = array ( ) ; $ request = $ this -> getRequest ( ) ; if ( ! empty ( $ idPage ... | Saves datas edited in a page and posted to this function Save is made in SESSION . |
15,899 | public function removePageSessionPluginAction ( ) { $ module = $ this -> getRequest ( ) -> getQuery ( 'module' , null ) ; $ pluginName = $ this -> getRequest ( ) -> getQuery ( 'pluginName' , '' ) ; $ pageId = $ this -> getRequest ( ) -> getQuery ( 'pageId' , null ) ; $ pluginId = $ this -> getRequest ( ) -> getQuery ( ... | Remove a specific plugin from a pageId Save is made in SESSION . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.