idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
44,700 | public function newItemUpdateStruct ( ? Item $ item = null ) : ItemUpdateStruct { $ itemUpdateStruct = new ItemUpdateStruct ( ) ; if ( ! $ item instanceof Item ) { return $ itemUpdateStruct ; } $ this -> configStructBuilder -> buildConfigUpdateStructs ( $ item , $ itemUpdateStruct ) ; return $ itemUpdateStruct ; } | Creates a new item update struct . |
44,701 | public function newQueryUpdateStruct ( string $ locale , ? Query $ query = null ) : QueryUpdateStruct { $ queryUpdateStruct = new QueryUpdateStruct ( ) ; $ queryUpdateStruct -> locale = $ locale ; if ( ! $ query instanceof Query ) { return $ queryUpdateStruct ; } $ queryUpdateStruct -> fillParametersFromQuery ( $ query... | Creates a new query update struct for provided locale . |
44,702 | public function applyStatusCondition ( QueryBuilder $ query , ? int $ status , string $ statusColumn = 'status' , string $ paramName = 'status' ) : void { $ query -> andWhere ( $ query -> expr ( ) -> eq ( $ statusColumn , ':' . $ paramName ) ) -> setParameter ( $ paramName , $ status , Type :: INTEGER ) ; } | Applies status condition to the query . |
44,703 | public function applyOffsetAndLimit ( QueryBuilder $ query , ? int $ offset , ? int $ limit ) : void { $ query -> setFirstResult ( $ offset ?? 0 ) ; if ( is_int ( $ limit ) && $ limit > 0 ) { $ query -> setMaxResults ( $ limit ) ; } } | Applies offset and limit to the query . |
44,704 | private function buildItems ( LayoutList $ layouts ) : Generator { foreach ( $ layouts as $ layout ) { yield $ this -> buildItem ( $ layout ) ; } } | Builds the items from provided layouts . |
44,705 | public function getBlockTypes ( bool $ onlyEnabled = false ) : array { if ( ! $ onlyEnabled ) { return $ this -> blockTypes ; } return array_values ( array_filter ( $ this -> blockTypes , static function ( BlockType $ blockType ) : bool { return $ blockType -> isEnabled ( ) ; } ) ) ; } | Returns the block types in this group . |
44,706 | public function getCollectionRunner ( Collection $ collection , int $ flags = 0 ) : CollectionRunnerInterface { $ collectionQuery = $ collection -> getQuery ( ) ; if ( $ collectionQuery instanceof Query ) { $ queryRunner = $ this -> getQueryRunner ( $ collectionQuery , $ flags ) ; return new DynamicCollectionRunner ( $... | Builds and returns the collection runner for provided collection . |
44,707 | private function getQueryRunner ( Query $ query , int $ flags = 0 ) : QueryRunnerInterface { $ showContextualSlots = ( bool ) ( $ flags & ResultSet :: INCLUDE_UNKNOWN_ITEMS ) ; if ( $ showContextualSlots && $ query -> isContextual ( ) ) { return new ContextualQueryRunner ( ) ; } return new QueryRunner ( $ this -> cmsIt... | Builds the query runner for the provided query based on provided flags . |
44,708 | public function createMenu ( ) : ItemInterface { $ menu = $ this -> factory -> createItem ( 'root' ) ; if ( $ this -> authorizationChecker -> isGranted ( 'nglayouts:ui:access' ) ) { $ menu -> addChild ( 'layout_resolver' , [ 'route' => 'ngbm_admin_layout_resolver_index' ] ) -> setLabel ( 'menu.main_menu.layout_resolver... | Builds the main menu . |
44,709 | public function getPlugin ( string $ pluginName ) : ExtensionPluginInterface { if ( ! isset ( $ this -> plugins [ $ pluginName ] ) ) { throw new RuntimeException ( sprintf ( 'Extension plugin "%s" does not exist' , $ pluginName ) ) ; } return $ this -> plugins [ $ pluginName ] ; } | Returns the plugin by name . Name of the plugin is its fully qualified class name . |
44,710 | private function loadConfigFiles ( ContainerBuilder $ container ) : void { $ loader = new YamlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'default_settings.yml' ) ; $ loader -> load ( 'services/errors.yml' ) ; $ loader -> load ( 'services/view/providers.yml' ) ... | Loads configuration from various YAML files . |
44,711 | private function validateCurrentDesign ( string $ currentDesign , array $ designList ) : void { if ( $ currentDesign !== 'standard' && ! in_array ( $ currentDesign , $ designList , true ) ) { throw new InvalidConfigurationException ( sprintf ( 'Design "%s" does not exist. Available designs are: %s' , $ currentDesign , ... | Validates that the design specified in configuration exists in the system . |
44,712 | public function getPager ( Collection $ collection , int $ startPage , ? int $ maxPages = null , int $ flags = 0 ) : Pagerfanta { $ maxTotalCount = null ; if ( is_int ( $ maxPages ) && $ maxPages > 0 ) { $ maxTotalCount = $ maxPages * $ this -> getMaxPerPage ( $ collection ) ; } $ pagerAdapter = new ResultBuilderAdapte... | Builds and returns the Pagerfanta pager for provided collection . |
44,713 | private function buildPager ( AdapterInterface $ adapter , Collection $ collection , int $ startPage ) : Pagerfanta { $ pager = new Pagerfanta ( $ adapter ) ; $ pager -> setNormalizeOutOfRangePages ( true ) ; $ pager -> setMaxPerPage ( $ this -> getMaxPerPage ( $ collection ) ) ; $ pager -> setCurrentPage ( $ startPage... | Builds the pager from provided adapter . |
44,714 | private function getMaxPerPage ( Collection $ collection ) : int { $ limit = $ collection -> getLimit ( ) ?? 0 ; return $ limit > 0 && $ limit < $ this -> maxLimit ? $ limit : $ this -> maxLimit ; } | Returns the maximum number of items per page for the provided collection while taking into account the injected maximum number of items . |
44,715 | public function mapParameters ( ParameterDefinitionCollectionInterface $ definitions , array $ values ) : Generator { foreach ( $ definitions -> getParameterDefinitions ( ) as $ parameterDefinition ) { $ parameterName = $ parameterDefinition -> getName ( ) ; $ parameterType = $ parameterDefinition -> getType ( ) ; $ va... | Maps the parameter values based on provided collection of parameters . |
44,716 | public function serializeValues ( ParameterDefinitionCollectionInterface $ definitions , array $ values , array $ fallbackValues = [ ] ) : Generator { yield from $ fallbackValues ; foreach ( $ definitions -> getParameterDefinitions ( ) as $ parameterDefinition ) { $ parameterName = $ parameterDefinition -> getName ( ) ... | Serializes the parameter values based on provided collection of parameters . |
44,717 | protected function resolveOptions ( array $ config ) : array { $ optionsResolver = new OptionsResolver ( ) ; $ optionsResolver -> setDefault ( 'name' , null ) ; $ optionsResolver -> setDefault ( 'type' , null ) ; $ optionsResolver -> setDefault ( 'options' , [ ] ) ; $ optionsResolver -> setDefault ( 'parent' , null ) ;... | Resolves the provided parameter builder configuration . |
44,718 | public function mapLayouts ( array $ data ) : array { $ layouts = [ ] ; foreach ( $ data as $ dataItem ) { $ layoutId = ( int ) $ dataItem [ 'id' ] ; $ locale = $ dataItem [ 'locale' ] ; if ( ! isset ( $ layouts [ $ layoutId ] ) ) { $ layouts [ $ layoutId ] = [ 'id' => $ layoutId , 'type' => $ dataItem [ 'type' ] , 'na... | Maps data from database to layout values . |
44,719 | public function mapZones ( array $ data ) : array { $ zones = [ ] ; foreach ( $ data as $ dataItem ) { $ zones [ $ dataItem [ 'identifier' ] ] = Zone :: fromArray ( [ 'identifier' => $ dataItem [ 'identifier' ] , 'layoutId' => ( int ) $ dataItem [ 'layout_id' ] , 'status' => ( int ) $ dataItem [ 'status' ] , 'rootBlock... | Maps data from database to zone values . |
44,720 | public function onException ( GetResponseForExceptionEvent $ event ) : void { $ attributes = $ event -> getRequest ( ) -> attributes ; if ( $ attributes -> get ( SetIsAdminRequestListener :: ADMIN_FLAG_NAME ) !== true ) { return ; } if ( ! $ event -> getRequest ( ) -> isXmlHttpRequest ( ) ) { return ; } $ exception = $... | Converts Symfony authentication exceptions to HTTP Access Denied exception . |
44,721 | private function validateChangeCollectionType ( Block $ block , string $ collectionIdentifier , int $ newType , string $ queryType ) : void { $ this -> validate ( $ newType , [ new Constraints \ NotBlank ( ) , new Constraints \ Choice ( [ 'choices' => [ Collection :: TYPE_MANUAL , Collection :: TYPE_DYNAMIC , ] , 'stri... | Validates block creation parameters from the request . |
44,722 | private function getZones ( LayoutTypeInterface $ layoutType ) : Generator { foreach ( $ layoutType -> getZones ( ) as $ zone ) { $ allowedBlockDefinitions = $ zone -> getAllowedBlockDefinitions ( ) ; yield [ 'identifier' => $ zone -> getIdentifier ( ) , 'name' => $ zone -> getName ( ) , 'allowed_block_definitions' => ... | Returns the array with layout type zones . |
44,723 | public function onView ( GetResponseForControllerResultEvent $ event ) : void { $ view = $ event -> getControllerResult ( ) ; if ( ! $ view instanceof ViewInterface ) { return ; } $ response = $ view -> getResponse ( ) ; if ( ! $ response instanceof Response ) { return ; } $ renderedView = '' ; try { $ renderedView = $... | Renders the view provided by the event . |
44,724 | private function getOverflowItems ( ResultSet $ resultSet ) : Generator { $ includedPositions = [ ] ; foreach ( $ resultSet -> getResults ( ) as $ result ) { if ( $ result -> getItem ( ) instanceof ManualItem ) { $ includedPositions [ ] = $ result -> getItem ( ) -> getCollectionItem ( ) -> getPosition ( ) ; } if ( $ re... | Returns all items from the collection which are overflown . Overflown items are those NOT included in the provided result set as defined by collection offset and limit . |
44,725 | public function onBuildView ( CollectViewParametersEvent $ event ) : void { $ view = $ event -> getView ( ) ; if ( ! $ view instanceof LayoutViewInterface ) { return ; } if ( $ view -> getContext ( ) !== ViewInterface :: CONTEXT_ADMIN ) { return ; } $ event -> addParameter ( 'http_cache_enabled' , $ this -> cacheEnable... | Injects if the HTTP cache clearing is enabled or not . |
44,726 | private function buildManualResult ( CollectionItem $ collectionItem , Iterator $ queryIterator ) : ? Result { if ( ! $ this -> visibilityResolver -> isVisible ( $ collectionItem ) || ! $ collectionItem -> isValid ( ) ) { $ queryValue = $ this -> getQueryValue ( $ queryIterator ) ; if ( ! $ queryValue instanceof CmsIte... | Builds the result from a manual item . |
44,727 | private function getQueryValue ( Iterator $ queryIterator ) { if ( ! $ queryIterator -> valid ( ) ) { return null ; } $ queryValue = $ queryIterator -> current ( ) ; $ queryIterator -> next ( ) ; return $ queryValue ; } | Returns the current value from the query and advances the iterator . |
44,728 | private function runQuery ( Collection $ collection , int $ offset , int $ limit ) : Iterator { $ collectionQuery = $ collection -> getQuery ( ) ; if ( ! $ collectionQuery instanceof Query ) { return new ArrayIterator ( ) ; } $ queryOffset = $ offset - $ this -> getManualItemsCount ( $ collection , 0 , $ offset ) ; $ q... | Returns the iterator that can be used to iterate over provided collection query . |
44,729 | public function onBuildView ( CollectViewParametersEvent $ event ) : void { $ view = $ event -> getView ( ) ; if ( ! $ view instanceof BlockViewInterface ) { return ; } if ( ! in_array ( $ view -> getContext ( ) , $ this -> enabledContexts , true ) ) { return ; } $ this -> dataCollector -> collectBlockView ( $ view ) ;... | Includes results built from all block collections if specified so . |
44,730 | private function generateBlockTypeConfig ( array $ blockTypes , array $ blockDefinitions ) : array { foreach ( $ blockDefinitions as $ identifier => $ blockDefinition ) { if ( isset ( $ blockTypes [ $ identifier ] [ 'definition_identifier' ] ) && $ blockTypes [ $ identifier ] [ 'definition_identifier' ] !== '' && $ blo... | Generates the block type configuration from provided block definitions . |
44,731 | private function buildBlockTypes ( ContainerBuilder $ container , array $ blockTypes ) : Generator { foreach ( $ blockTypes as $ identifier => $ blockType ) { $ serviceIdentifier = sprintf ( 'netgen_block_manager.block.block_type.%s' , $ identifier ) ; $ container -> register ( $ serviceIdentifier , BlockType :: class ... | Builds the block type objects from provided configuration . |
44,732 | private function validateBlockTypes ( array $ blockTypes , array $ blockDefinitions ) : void { foreach ( $ blockTypes as $ identifier => $ blockType ) { if ( ! isset ( $ blockDefinitions [ $ blockType [ 'definition_identifier' ] ] ) ) { throw new RuntimeException ( sprintf ( 'Block definition "%s" used in "%s" block ty... | Validates block type config . |
44,733 | private function includeParameter ( ParameterDefinition $ parameterDefinition , array $ groups ) : bool { $ parameterGroups = $ parameterDefinition -> getGroups ( ) ; if ( count ( $ parameterGroups ) === 0 || count ( $ groups ) === 0 ) { return true ; } return count ( array_intersect ( $ parameterGroups , $ groups ) ) ... | Returns if the parameter will be included in the form based on provided groups . |
44,734 | private function copyBlockCollections ( Block $ block , Block $ targetBlock ) : void { $ collectionReferences = $ this -> loadCollectionReferences ( $ block ) ; foreach ( $ collectionReferences as $ collectionReference ) { $ collection = $ this -> collectionHandler -> loadCollection ( $ collectionReference -> collectio... | Copies all block collections to another block . |
44,735 | private function createBlockCollectionsStatus ( Block $ block , int $ newStatus ) : void { $ collectionReferences = $ this -> loadCollectionReferences ( $ block ) ; foreach ( $ collectionReferences as $ collectionReference ) { $ collection = $ this -> collectionHandler -> loadCollection ( $ collectionReference -> colle... | Creates a new status for all collections in specified block . |
44,736 | private function deleteBlockCollections ( array $ blockIds , ? int $ status = null ) : void { $ collectionIds = $ this -> queryHandler -> loadBlockCollectionIds ( $ blockIds , $ status ) ; foreach ( $ collectionIds as $ collectionId ) { $ this -> collectionHandler -> deleteCollection ( $ collectionId , $ status ) ; } $... | Deletes block collections with specified block IDs . |
44,737 | private function matches ( ViewInterface $ view , array $ matchConfig ) : bool { foreach ( $ matchConfig as $ matcher => $ matcherConfig ) { if ( ! isset ( $ this -> matchers [ $ matcher ] ) ) { throw TemplateResolverException :: noTemplateMatcher ( $ matcher ) ; } $ matcherConfig = ! is_array ( $ matcherConfig ) ? [ $... | Matches the view to provided config with configured matchers . |
44,738 | private function evaluateParameters ( ViewInterface $ view , array $ parameters ) : Generator { foreach ( $ parameters as $ key => $ value ) { if ( is_string ( $ value ) && mb_strpos ( $ value , '@=' ) === 0 ) { $ expressionLanguage = new ExpressionLanguage ( ) ; $ value = $ expressionLanguage -> evaluate ( mb_substr (... | Iterates over all provided parameters and evaluates the values with expression engine if the parameter value specifies so . |
44,739 | protected function jsonReturn ( array $ array , $ httpCode = 200 , $ contentType = 'application/json' ) { return $ this -> response -> setHeader ( 'Content-Type' , $ contentType ) -> setStatusCode ( $ httpCode ) -> setJsonContent ( $ array ) ; } | response json content |
44,740 | protected function input ( $ key = null , $ defaultValue = null ) { return is_null ( $ key ) ? $ _REQUEST : fnGet ( $ _REQUEST , $ key , $ defaultValue ) ; } | Get input from request |
44,741 | protected static function builtInLabel ( array $ parameters , $ innerHtml ) { return Tag :: tagHtml ( 'label' , $ parameters , false , true ) . $ innerHtml . Tag :: tagHtmlClose ( 'label' ) ; } | Make a label element |
44,742 | protected static function builtInMultipleChoose ( array $ parameters ) { static :: checkRequiredParameters ( $ parameters , [ 'id' , 'options' ] ) ; $ options = ( array ) $ parameters [ 'options' ] ; $ parameters [ 0 ] = $ id = $ parameters [ 'id' ] ; $ expand = isset ( $ parameters [ 'expand' ] ) ? $ parameters [ 'exp... | Make a multiple select widget if options < 5 it will be expanded into radios by default |
44,743 | protected static function builtInSingleChoose ( array $ parameters ) { static :: checkRequiredParameters ( $ parameters , [ 'id' , 'options' ] ) ; $ options = ( array ) $ parameters [ 'options' ] ; $ parameters [ 0 ] = $ id = $ parameters [ 'id' ] ; $ expand = isset ( $ parameters [ 'expand' ] ) ? $ parameters [ 'expan... | Make a single select widget if options < 5 it will be expanded into radios by default |
44,744 | public function initialize ( ) { $ this -> initializeConnections ( ) ; $ this -> _table and $ this -> setSource ( $ this -> _table ) ; $ this -> keepSnapshots ( true ) ; } | Runs once only when the model instance is created at the first time |
44,745 | protected function getServiceInfo ( $ instance = null ) { $ file = $ this -> runDir . 'service-info.php' ; $ info = is_file ( $ file ) ? include ( $ file ) : [ ] ; return $ instance ? fnGet ( $ info , $ instance , [ ] ) : $ info ; } | Get service info including pid manager pid and port |
44,746 | public function onStart ( SwooleServer $ server ) { @ cli_set_process_title ( $ this -> name . ': master process/reactor threads; port=' . $ this -> swoolePort ) ; $ this -> pid = $ server -> master_pid ; $ this -> managerPid = $ server -> manager_pid ; $ this -> startCommandHandler ( ) ; $ this -> updateServiceInfo ( ... | Callback after service started |
44,747 | protected function prepareServiceAwareComponents ( ) { foreach ( static :: $ di -> getServices ( ) as $ name => $ service ) { if ( ! $ service -> isShared ( ) ) { continue ; } $ component = static :: $ di -> getShared ( $ name ) ; if ( $ component instanceof ServiceAwareInterface ) { $ this -> serviceAwareComponents [ ... | Resolve service aware components Each component will be reset before every request is handled |
44,748 | public function sendCommand ( $ command , $ port = null , & $ error = null ) { $ port or $ port = $ this -> choosePort ( ) ; $ sockFile = $ this -> runDir . "command-{$port}.sock" ; if ( ! $ socket = @ stream_socket_client ( 'unix://' . $ sockFile , $ errNo , $ errStr , 5 ) ) { $ error = [ 'err' => $ errNo , 'message' ... | Send command to service command handler |
44,749 | public function read ( $ key ) { $ this -> _cachedData or $ this -> _cachedData = Cache :: get ( 'model-metadata' ) ; return isset ( $ this -> _cachedData [ $ key ] ) ? $ this -> _cachedData [ $ key ] : null ; } | Reads meta - data from files |
44,750 | public function write ( $ key , $ data ) { $ this -> _cachedData [ $ key ] = $ data ; Cache :: set ( 'model-metadata' , $ this -> _cachedData , Cache :: TTL_ONE_MONTH ) ; } | Writes the meta - data to files |
44,751 | public function run ( string $ file , Node $ node ) : array { $ hints = [ ] ; $ case_conds = [ ] ; foreach ( $ node -> children as $ case ) { $ cond = $ case -> children [ 'cond' ] ; foreach ( $ case_conds as $ case_cond ) { if ( $ this -> isEqualsWithoutLineno ( $ case_cond , $ cond ) ) { $ hints [ ] = new Hint ( self... | Detect case condition in switch statement . |
44,752 | public function run ( string $ file , Node $ node ) : array { while ( count ( $ node -> children ) >= 2 ) { $ catch = array_shift ( $ node -> children ) ; if ( $ this -> isIncludeThrowableNode ( $ catch ) ) { foreach ( $ node -> children as $ after_catch ) { if ( ! $ this -> isIncludeThrowableNode ( $ after_catch ) ) {... | Detect a catch expression not reachable by catch expressions of Exception or Throwable |
44,753 | private function isIncludeExceptionNode ( Node $ node ) : bool { foreach ( $ node -> children [ 'class' ] -> children as $ class ) { if ( $ class -> children [ 'name' ] === 'Exception' ) { return true ; } } return false ; } | Check if the node catches Exception |
44,754 | private function isIncludeThrowableNode ( Node $ node ) : bool { foreach ( $ node -> children [ 'class' ] -> children as $ class ) { if ( $ class -> children [ 'name' ] === 'Throwable' ) { return true ; } } return false ; } | Check if the node catches Throwable |
44,755 | public static function create ( OutputInterface $ output , array $ files , array $ hints ) : Base { switch ( Config :: getInstance ( ) -> format ) { case 'pretty' : return new Pretty ( $ output , $ files , $ hints ) ; case 'json' : return new JSON ( $ output , $ files , $ hints ) ; default : return new Pretty ( $ outpu... | Factory method that returns the specified formatter . |
44,756 | protected function configure ( ) { $ this -> setName ( 'check' ) -> setDescription ( 'A pair programming partner for writing better PHP' ) -> addArgument ( 'files' , InputArgument :: IS_ARRAY , 'List of file names or directory names to be analyzed' ) -> addOption ( 'php-version' , null , InputOption :: VALUE_OPTIONAL ,... | Define commands and other options . |
44,757 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { Logger :: getInstance ( $ output ) -> info ( 'Start Pahout command' ) ; Config :: load ( $ input -> getOptions ( ) , $ input -> getOption ( 'config' ) ) ; Logger :: getInstance ( ) -> info ( 'Start instruction' ) ; Logger :: getInstance ... | CLI execution entrypoint |
44,758 | public function isAffected ( Hint $ hint ) : bool { return $ hint -> filename === $ this -> filename && $ hint -> type === $ this -> body && ( $ this -> start_line - 1 ) <= $ hint -> lineno && $ hint -> lineno <= ( $ this -> end_line + 1 ) ; } | Determine whether hint is target of annotation |
44,759 | public function getRoles ( ) : ? array { $ roles = $ this -> roles ; $ groupRoles = [ [ ] ] ; foreach ( $ this -> getGroups ( ) as $ group ) { $ groupRoles [ ] = $ group -> getRoles ( ) ; } $ groupRoles = array_merge ( ... $ groupRoles ) ; return array_unique ( array_merge ( $ roles , $ groupRoles ) ) ; } | Group combined Roles . |
44,760 | public static function make ( array $ options = [ ] , int $ backoff = null , array $ codes = null ) { $ config = array_merge ( [ 'connect_timeout' => self :: CONNECT_TIMEOUT , 'timeout' => self :: TIMEOUT ] , $ options ) ; $ config [ 'handler' ] = self :: handler ( $ backoff , $ codes , $ options [ 'handler' ] ?? null ... | Create a new guzzle client . |
44,761 | public static function handler ( int $ backoff = null , array $ codes = null , HandlerStack $ stack = null ) { $ stack = $ stack ? : HandlerStack :: create ( ) ; $ stack -> push ( Middleware :: retry ( function ( $ retries , RequestInterface $ request , ResponseInterface $ response = null , TransferException $ exceptio... | Create a new guzzle handler stack . |
44,762 | public function run ( string $ file , Node $ node ) : array { $ hints = [ ] ; $ catch_block_list = [ ] ; foreach ( $ node -> children as $ catch ) { $ klasses = $ catch -> children [ 'class' ] ; $ stmts = $ catch -> children [ 'stmts' ] ; foreach ( $ catch_block_list as $ catch_block ) { $ catch_klasses = $ catch_block... | Detect catch blocks of the same implementation . |
44,763 | private function messages ( array $ exceptions ) { $ names = array_map ( function ( $ exception ) { return $ exception -> children [ 'name' ] ; } , $ exceptions ) ; if ( count ( $ names ) > 1 ) { $ last = array_slice ( $ names , - 1 ) ; $ message = implode ( "`, `" , array_slice ( $ names , 0 , count ( $ names ) - 1 ) ... | Build a hint message from exceptions . |
44,764 | public static function create ( ) : array { $ tools = [ ] ; $ config = Config :: getInstance ( ) ; foreach ( self :: VALID_TOOLS as $ tool ) { if ( $ tool !== 'SyntaxError' ) { $ klass = "Pahout\\Tool\\" . $ tool ; $ tools [ ] = new $ klass ( ) ; } } return array_filter ( $ tools , function ( $ tool ) use ( $ config ) ... | Factory method that returns list of tool instances matching PHP version . |
44,765 | public static function dig ( array $ files , Config $ config ) : array { $ list = [ ] ; $ pattern = implode ( "|" , array_map ( "preg_quote" , $ config -> extensions ) ) ; foreach ( $ files as $ file ) { Logger :: getInstance ( ) -> info ( 'Load: ' . $ file ) ; if ( is_dir ( $ file ) ) { Logger :: getInstance ( ) -> de... | Dig file paths from files or directories . |
44,766 | public function isEqualsWithoutLineno ( $ a , $ b ) : Bool { if ( is_array ( $ a ) ) { if ( ! is_array ( $ b ) ) { return false ; } foreach ( $ a as $ key => $ value ) { if ( ! ( array_key_exists ( $ key , $ b ) && $ this -> isEqualsWithoutLineno ( $ value , $ b [ $ key ] ) ) ) { return false ; } } } elseif ( $ a insta... | Verify that it is the same except for line number of Node . |
44,767 | public function isFunctionCall ( $ node , string $ function ) : Bool { if ( $ node instanceof Node && $ node -> kind === \ ast \ AST_CALL ) { $ expr = $ node -> children [ 'expr' ] ; if ( $ expr -> kind === \ ast \ AST_NAME && $ expr -> children [ 'name' ] === $ function ) { return true ; } } return false ; } | Verify that node is AST_CALL of the specified function name . |
44,768 | public static function getInstance ( OutputInterface $ output = null ) : ConsoleLogger { if ( ! isset ( self :: $ logger ) ) { self :: $ logger = new ConsoleLogger ( $ output ) ; } return self :: $ logger ; } | Generate or provide the single logger instance . |
44,769 | public static function create ( string $ filename , string $ source ) : array { $ annotations = [ ] ; $ tokens = token_get_all ( $ source ) ; $ comments = array_filter ( $ tokens , function ( $ token ) { return in_array ( $ token [ 0 ] , [ T_COMMENT , T_DOC_COMMENT ] , true ) ; } ) ; foreach ( $ comments as $ comment )... | Annotation facotry method |
44,770 | public function instruct ( ) { foreach ( $ this -> files as $ file ) { Logger :: getInstance ( ) -> info ( 'Parse: ' . $ file ) ; try { $ root = \ ast \ parse_file ( $ file , Config :: AST_VERSION ) ; $ this -> annotations = Annotation :: create ( $ file , file_get_contents ( $ file ) ) ; if ( $ root instanceof Node ) ... | Tell you about PHP hints . |
44,771 | private function traverse ( string $ file , Node $ node ) { Logger :: getInstance ( ) -> debug ( 'Traverse: ' . \ ast \ get_kind_name ( $ node -> kind ) ) ; foreach ( $ this -> tools as $ tool ) { Logger :: getInstance ( ) -> debug ( 'Entrypoint check: ' . get_class ( $ tool ) ) ; if ( $ tool :: ENTRY_POINT !== $ node ... | Traverse AST nodes with DFS and check the entrypoint of tools . |
44,772 | public function run ( string $ file , Node $ node ) : array { $ hints = [ ] ; $ keys = [ ] ; foreach ( $ node -> children as $ elem ) { if ( is_null ( $ elem ) ) { continue ; } $ key = $ elem -> children [ 'key' ] ; if ( ! is_null ( $ key ) ) { foreach ( $ keys as $ other_key ) { if ( $ this -> isEqualsWithoutLineno ( ... | Detect duplicate numbers strings node key |
44,773 | public function print ( ) { if ( count ( $ this -> hints ) === 0 ) { $ this -> output -> writeln ( '<fg=black;bg=green>Awesome! There is nothing from me to teach you!</>' ) ; $ this -> output -> write ( "\n" ) ; } else { foreach ( $ this -> hints as $ hint ) { $ this -> output -> writeln ( '<info>' . $ hint -> filename... | Print hints to the console throught output interface of symfony console . |
44,774 | private function shouldCheckOption ( $ node ) : Bool { if ( ! $ node instanceof Node ) { return true ; } if ( $ node -> kind === \ ast \ AST_CONST ) { return true ; } if ( $ node -> kind === \ ast \ AST_BINARY_OP && $ node -> flags === \ ast \ flags \ BINARY_BITWISE_OR ) { return true ; } return false ; } | Check whether the passed options node should be checked . |
44,775 | private function isIncludeJSONThrowOnErrorOption ( $ node ) : Bool { if ( ! $ node instanceof Node ) { return false ; } if ( $ node -> kind === \ ast \ AST_CONST ) { $ name = $ node -> children [ "name" ] ; if ( $ name -> kind === \ ast \ AST_NAME && $ name -> children [ "name" ] === "JSON_THROW_ON_ERROR" ) { return tr... | Check whether the passed node has JSON_THROW_ON_ERROR |
44,776 | public function run ( string $ file , Node $ node ) : array { if ( $ this -> inspectedFile === $ file ) { return [ ] ; } $ found = false ; foreach ( $ node -> children as $ child ) { if ( ! $ child instanceof Node ) { continue ; } if ( $ child -> kind !== \ ast \ AST_DECLARE ) { continue ; } $ declares = $ child -> chi... | Check whether the passed node has strict_types declaration . |
44,777 | public function run ( string $ file , Node $ node ) : array { if ( $ node -> flags !== \ ast \ flags \ ARRAY_SYNTAX_LONG ) { Logger :: getInstance ( ) -> debug ( 'Ignore flags: ' . $ node -> flags ) ; return [ ] ; } return [ new Hint ( self :: HINT_TYPE , self :: HINT_MESSAGE , $ file , $ node -> lineno , self :: HINT_... | Detect ARRAY_SYNTAX_LONG node . |
44,778 | public function registerConfirm ( \ Swift_Mailer $ mailer , EventDispatcherInterface $ dispatcher , TranslatorInterface $ translator , $ token ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ user = $ em -> getRepository ( $ this -> getParameter ( 'pd_user.user_class' ) ) -> findOneBy ( [ 'confirmationToken' ... | Registration Confirm Token . |
44,779 | public function resetting ( Request $ request , EventDispatcherInterface $ dispatcher , \ Swift_Mailer $ mailer , TranslatorInterface $ translator ) { if ( $ this -> checkAuth ( ) ) { return $ this -> redirectToRoute ( $ this -> getParameter ( 'pd_user.login_redirect' ) ) ; } $ form = $ this -> createForm ( $ this -> g... | Resetting Request . |
44,780 | public function resettingPassword ( Request $ request , UserPasswordEncoderInterface $ encoder , EventDispatcherInterface $ dispatcher , \ Swift_Mailer $ mailer , TranslatorInterface $ translator , $ token ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ user = $ em -> getRepository ( $ this -> getParameter (... | Reset Password Form . |
44,781 | private function sendEmail ( UserInterface $ user , \ Swift_Mailer $ mailer , $ subject , $ body , $ templateId ) { if ( \ is_array ( $ body ) ) { $ body [ 'email' ] = $ user -> getEmail ( ) ; $ body [ 'fullname' ] = $ user -> getProfile ( ) -> getFullName ( ) ; } else { $ body = [ 'email' => $ user -> getEmail ( ) , '... | Send Mail . |
44,782 | public function isActive ( ) { if ( $ this -> _isActive === null ) { $ this -> _isActive = ( ( bool ) $ this -> getConfig ( ) -> getConfigParam ( 'blAmazonLoginActive' ) === true && ( string ) $ this -> getConfig ( ) -> getConfigParam ( 'sAmazonLoginClientId' ) !== '' && ( string ) $ this -> getConfig ( ) -> getConfigP... | Method checks if Amazon Login is active and can be used |
44,783 | public function createOxidUser ( $ oUserData ) { $ aFullName = explode ( ' ' , trim ( $ oUserData -> name ) ) ; $ sLastName = array_pop ( $ aFullName ) ; $ sFirstName = implode ( ' ' , $ aFullName ) ; $ oUser = $ this -> getObjectFactory ( ) -> createOxidObject ( 'oxUser' ) ; $ oUser -> assign ( array ( 'oxregister' =>... | Create new oxid user with details from Amazon |
44,784 | public function getAmazonLanguage ( ) { $ aLanguages = $ this -> getConfig ( ) -> getConfigParam ( 'aAmazonLanguages' ) ; $ sLanguageAbbr = $ this -> getLanguage ( ) -> getLanguageAbbr ( ) ; return isset ( $ aLanguages [ $ sLanguageAbbr ] ) ? $ aLanguages [ $ sLanguageAbbr ] : $ sLanguageAbbr ; } | Method returns language for Amazon GUI elements |
44,785 | public function getLangIdByAmazonLanguage ( $ sAmazonLanguageString ) { $ aLanguages = $ this -> getConfig ( ) -> getConfigParam ( 'aAmazonLanguages' ) ; $ sAbbreviation = array_search ( $ sAmazonLanguageString , $ aLanguages ) ; $ aAllLangIds = $ this -> getLanguage ( ) -> getAllShopLanguageIds ( ) ; return array_sear... | Returns Language Id by Amazon Language string |
44,786 | public function getOrderLanguageId ( oxOrder $ oOrder ) { $ oData = $ this -> getClient ( ) -> getOrderReferenceDetails ( $ oOrder , array ( ) , true ) ; if ( isset ( $ oData -> GetOrderReferenceDetailsResult -> OrderReferenceDetails -> OrderLanguage ) === false ) { return ( int ) $ oOrder -> getFieldData ( 'oxlang' ) ... | Returns Language ID to use for made order |
44,787 | protected static function _deactivateOldModule ( ) { $ sModule = self :: OLD_MODULE_ID ; $ oModule = self :: _getModule ( ) ; if ( $ oModule -> load ( $ sModule ) === false ) { self :: _getUtilsView ( ) -> addErrorToDisplay ( new oxException ( 'EXCEPTION_MODULE_NOT_LOADED' ) ) ; return false ; } try { $ oModuleCache = ... | Deactivates the old module . |
44,788 | protected static function _removeTempVersionNumberFromDatabase ( ) { $ oConfig = self :: _getConfig ( ) ; $ sModuleId = self :: _getDatabase ( ) -> quote ( self :: TMP_DB_ID ) ; $ sQuotedShopId = self :: _getDatabase ( ) -> quote ( $ oConfig -> getShopId ( ) ) ; $ sDeleteSql = "DELETE FROM `oxconfig` ... | Removes the temporary version number of the module from the database . |
44,789 | protected static function _executeSqlFile ( $ sFile ) { $ blSuccess = false ; $ sFileWithPath = dirname ( __FILE__ ) . '/../../../_db/' . $ sFile ; if ( file_exists ( $ sFileWithPath ) ) { $ sSqlFile = file_get_contents ( $ sFileWithPath ) ; $ aSqlRows = explode ( ';' , $ sSqlFile ) ; $ aSqlRows = array_map ( 'trim' , ... | Executes a sql file . |
44,790 | public static function onActivate ( ) { $ sSql = "SELECT COUNT(OXID) FROM oxpayments WHERE OXID IN ('jagamazon', 'bestitamazon')" ; $ iRes = self :: _getDatabase ( ) -> getOne ( $ sSql ) ; if ( $ iRes !== false && ( int ) $ iRes === 0 ) { self :: _executeSqlFile ( 'install.sql' ) ; $ oDbHandler = ... | Execute required sql statements . |
44,791 | public static function getCurrentVersion ( ) { $ aVersions = ( array ) self :: _getConfig ( ) -> getConfigParam ( 'aModuleVersions' ) ; $ aPossibleModuleNames = array ( 'jagAmazonPayment4Oxid' , 'bestitAmazonPay4Oxid' ) ; foreach ( $ aPossibleModuleNames as $ sPossibleModuleName ) { if ( isset ( $ aVersions [ $ sPossib... | Returns the current installed version . |
44,792 | public static function clearTmp ( ) { $ sTmpDir = self :: _getConfig ( ) -> getConfigParam ( 'sCompileDir' ) ; $ sTmpDir = rtrim ( $ sTmpDir , '/' ) . '/' ; $ sSmartyDir = $ sTmpDir . 'smarty/' ; foreach ( self :: _streamSafeGlob ( $ sTmpDir , '*.txt' ) as $ sFileName ) { unlink ( $ sFileName ) ; } foreach ( self :: _s... | Clear tmp dir and smarty cache . |
44,793 | protected function _getAmazonClient ( $ aConfig = array ( ) ) { if ( $ this -> _oAmazonClient === null ) { $ aConfig = array_merge ( $ aConfig , array ( 'merchant_id' => $ this -> getConfig ( ) -> getConfigParam ( 'sAmazonSellerId' ) , 'access_key' => $ this -> getConfig ( ) -> getConfigParam ( 'sAmazonAWSAccessKeyId' ... | Returns the amazon api client . |
44,794 | protected function _addSandboxSimulationParams ( $ sMethod , array & $ aParams ) { if ( ( bool ) $ this -> getConfig ( ) -> getConfigParam ( 'blAmazonSandboxActive' ) !== true || ( bool ) $ this -> getConfig ( ) -> getConfigParam ( 'sSandboxSimulation' ) === false ) { return ; } $ sSandboxSimulation = ( string ) $ this... | Amazon add sandbox simulation params |
44,795 | public function getAmazonProperty ( $ sPropertyName , $ blCommon = false ) { $ sSandboxPrefix = '' ; if ( $ blCommon === false && ( bool ) $ this -> getConfig ( ) -> getConfigParam ( 'blAmazonSandboxActive' ) === true ) { $ sSandboxPrefix = 'Sandbox' ; } $ sAmazonLocale = $ this -> getConfig ( ) -> getConfigParam ( 'sA... | Returns class property by given property name and other params |
44,796 | public function processOrderReference ( oxOrder $ oOrder , stdClass $ oOrderReference ) { $ sOrderReferenceStatus = $ oOrderReference -> OrderReferenceStatus -> State ; if ( $ sOrderReferenceStatus === 'Open' && ( string ) $ oOrder -> getFieldData ( 'oxtransstatus' ) === 'AMZ-Order-Suspended' ) { $ this -> authorize ( ... | Process order reference . |
44,797 | public function getOrderReferenceDetails ( $ oOrder = null , array $ aParams = array ( ) , $ blReadonly = false ) { $ aRequestParameters = array ( ) ; $ sAmazonOrderReferenceId = ( $ oOrder === null ) ? ( string ) $ this -> getSession ( ) -> getVariable ( 'amazonOrderReferenceId' ) : '' ; if ( $ oOrder !== null ) { $ a... | Amazon GetOrderReferenceDetails method |
44,798 | public function setOrderReferenceDetails ( $ oBasket = null , array $ aRequestParameters = array ( ) ) { $ aRequestParameters [ 'amazon_order_reference_id' ] = $ this -> getSession ( ) -> getVariable ( 'amazonOrderReferenceId' ) ; if ( $ oBasket !== null ) { $ oActiveShop = $ this -> getConfig ( ) -> getActiveShop ( ) ... | Amazon SetOrderReferenceDetails method |
44,799 | public function confirmOrderReference ( array $ aRequestParameters = array ( ) ) { $ aRequestParameters [ 'amazon_order_reference_id' ] = $ this -> getSession ( ) -> getVariable ( 'amazonOrderReferenceId' ) ; return $ this -> _convertResponse ( $ this -> _getAmazonClient ( ) -> confirmOrderReference ( $ aRequestParamet... | Amazon ConfirmOrderReference method |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.