idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
59,100 | public function setNextEntrySign ( $ sign ) { if ( $ this -> _mode === self :: GM_BOOLEAN ) { include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; throw new Zend_Search_Lucene_Search_QueryParserException ( 'It\'s not allowed to mix boolean and signs styles in the same subquery.' ) ; } $ this -> _mode = s... | Set sign for next entry |
59,101 | public function addEntry ( Zend_Search_Lucene_Search_QueryEntry $ entry ) { if ( $ this -> _mode !== self :: GM_BOOLEAN ) { $ this -> _signs [ ] = $ this -> _nextEntrySign ; } $ this -> _entries [ ] = $ entry ; $ this -> _nextEntryField = null ; $ this -> _nextEntrySign = null ; } | Add entry to a query |
59,102 | public function processFuzzyProximityModifier ( $ parameter = null ) { if ( $ this -> _nextEntryField !== null || $ this -> _nextEntrySign !== null ) { include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; throw new Zend_Search_Lucene_Search_QueryParserException ( '\'~\' modifier must follow word or phras... | Process fuzzy search or proximity search modifier |
59,103 | public function boost ( $ boostFactor ) { if ( $ this -> _nextEntryField !== null || $ this -> _nextEntrySign !== null ) { include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; throw new Zend_Search_Lucene_Search_QueryParserException ( '\'^\' modifier must follow word, phrase or subquery.' ) ; } $ lastEnt... | Set boost factor to the entry |
59,104 | public function addLogicalOperator ( $ operator ) { if ( $ this -> _mode === self :: GM_SIGNS ) { include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; throw new Zend_Search_Lucene_Search_QueryParserException ( 'It\'s not allowed to mix boolean and signs styles in the same subquery.' ) ; } $ this -> _mode... | Process logical operator |
59,105 | public function writeString ( $ str ) { settype ( $ str , 'string' ) ; $ chars = $ strlen = strlen ( $ str ) ; $ containNullChars = false ; for ( $ count = 0 ; $ count < $ strlen ; $ count ++ ) { if ( ( ord ( $ str [ $ count ] ) & 0xC0 ) == 0xC0 ) { $ addBytes = 1 ; if ( ord ( $ str [ $ count ] ) & 0x20 ) { $ addBytes ... | Writes a string to the end of file . |
59,106 | protected function mayCache ( $ item ) { return ( isset ( $ item ) && is_object ( $ item ) && isset ( $ item -> headers ) && is_string ( $ item -> headers -> etag ) && ! empty ( $ item -> headers -> etag ) && isset ( $ item -> body ) && is_object ( $ item -> body ) ) ; } | Returns whether or not the item may be cached . It has to be a stdClass that Sag would return with a valid E - Tag and no cache headers that tell us to not cache . |
59,107 | public function performSearch ( ) { try { $ index = Zend_Search_Lucene :: open ( self :: get_index_location ( ) ) ; Zend_Search_Lucene :: setResultSetLimit ( 100 ) ; $ query = new Zend_Search_Lucene_Search_Query_Boolean ( ) ; $ term = Zend_Search_Lucene_Search_QueryParser :: parse ( $ this -> getQuery ( ) ) ; $ query -... | Perform a search query on the index |
59,108 | private function buildQueryUrl ( $ params ) { $ url = parse_url ( $ _SERVER [ 'REQUEST_URI' ] ) ; if ( ! array_key_exists ( 'query' , $ url ) ) { $ url [ 'query' ] = '' ; } parse_str ( $ url [ 'query' ] , $ url [ 'query' ] ) ; if ( ! is_array ( $ url [ 'query' ] ) ) { $ url [ 'query' ] = array ( ) ; } if ( array_key_ex... | Build a nice query string for the results |
59,109 | public static function get_meta_data ( ) { $ data = self :: $ meta_data ; $ defaults = array ( 'Description' => _t ( 'DocumentationViewer.OPENSEARCHDESC' , 'Search the documentation' ) , 'Tags' => _t ( 'DocumentationViewer.OPENSEARCHTAGS' , 'documentation' ) , 'Contact' => Config :: inst ( ) -> get ( 'Email' , 'admin_e... | Returns the meta data needed by opensearch . |
59,110 | public function renderResults ( ) { if ( ! $ this -> results && $ this -> query ) { $ this -> performSearch ( ) ; } if ( ! $ this -> outputController ) { return user_error ( 'Call renderResults() on a DocumentationViewer instance.' , E_USER_ERROR ) ; } $ request = $ this -> outputController -> getRequest ( ) ; $ data =... | Renders the search results into a template . Either the search results template or the Atom feed . |
59,111 | public function merge ( ) { if ( $ this -> _mergeDone ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Merge is already done.' ) ; } if ( count ( $ this -> _segmentInfos ) < 1 ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'W... | Do merge . |
59,112 | private function _mergeNorms ( ) { foreach ( $ this -> _writer -> getFieldInfos ( ) as $ fieldInfo ) { if ( $ fieldInfo -> isIndexed ) { foreach ( $ this -> _segmentInfos as $ segName => $ segmentInfo ) { if ( $ segmentInfo -> hasDeletions ( ) ) { $ srcNorm = $ segmentInfo -> normVector ( $ fieldInfo -> name ) ; $ norm... | Merge field s normalization factors |
59,113 | public function canView ( ) { return ( Director :: isDev ( ) || Director :: is_cli ( ) || ! $ this -> config ( ) -> get ( 'check_permission' ) || Permission :: check ( $ this -> config ( ) -> get ( 'check_permission' ) ) ) ; } | Can the user view this documentation . Hides all functionality for private wikis . |
59,114 | public function getContent ( ) { $ page = $ this -> getPage ( ) ; $ html = $ page -> getHTML ( ) ; $ html = $ this -> replaceChildrenCalls ( $ html ) ; return $ html ; } | Return the content for the page . If its an actual documentation page then display the content from the page otherwise display the contents from the index . md file if its a folder |
59,115 | public function includeChildren ( $ args ) { if ( isset ( $ args [ 'Folder' ] ) ) { $ children = $ this -> getManifest ( ) -> getChildrenFor ( Controller :: join_links ( dirname ( $ this -> record -> getPath ( ) ) , $ args [ 'Folder' ] ) ) ; } else { $ children = $ this -> getManifest ( ) -> getChildrenFor ( dirname ( ... | Short code parser |
59,116 | public function getBreadcrumbs ( ) { if ( $ this -> record ) { return $ this -> getManifest ( ) -> generateBreadcrumbs ( $ this -> record , $ this -> record -> getEntity ( ) ) ; } } | Generate a list of breadcrumbs for the user . |
59,117 | public function Link ( $ action = '' ) { $ link = Controller :: join_links ( Director :: baseURL ( ) , Config :: inst ( ) -> get ( 'DocumentationViewer' , 'link_base' ) , $ this -> getLanguage ( ) , $ action , '/' ) ; return $ link ; } | Return the base link to this documentation location . |
59,118 | public function AllPages ( $ version = null ) { $ pages = $ this -> getManifest ( ) -> getPages ( ) ; $ output = new ArrayList ( ) ; $ baseLink = $ this -> getDocumentationBaseHref ( ) ; foreach ( $ pages as $ url => $ page ) { if ( ! is_null ( $ version ) && ( string ) $ page [ 'version' ] !== ( string ) $ version ) {... | Generate a list of all the pages in the documentation grouped by the first letter of the page . |
59,119 | public function getNextPage ( ) { return ( $ this -> record ) ? $ this -> getManifest ( ) -> getNextPage ( $ this -> record -> getPath ( ) , $ this -> getEntity ( ) -> getPath ( ) ) : null ; } | Returns the next page . Either retrieves the sibling of the current page or return the next sibling of the parent page . |
59,120 | public function getPreviousPage ( ) { return ( $ this -> record ) ? $ this -> getManifest ( ) -> getPreviousPage ( $ this -> record -> getPath ( ) , $ this -> getEntity ( ) -> getPath ( ) ) : null ; } | Returns the previous page . Either returns the previous sibling or the parent of this page |
59,121 | protected function getAtoumArguments ( ) { $ inlinedArguments = array ( ) ; foreach ( $ this -> atoumArguments as $ name => $ values ) { $ inlinedArguments [ ] = $ name ; if ( null !== $ values ) { $ inlinedArguments [ ] = $ values ; } } return $ inlinedArguments ; } | Return inlined atoum cli arguments |
59,122 | private function assertValid ( $ object , int $ code = 0 ) { $ errors = $ this -> validator -> validate ( $ object ) ; if ( count ( $ errors ) ) { throw ValidationException :: becauseOfValidationErrors ( $ errors , $ code ) ; } } | Assert that object is valid . |
59,123 | public function rewrite ( Zend_Search_Lucene_Interface $ index ) { $ query = new Zend_Search_Lucene_Search_Query_Boolean ( ) ; $ query -> setBoost ( $ this -> getBoost ( ) ) ; foreach ( $ this -> _subqueries as $ subqueryId => $ subquery ) { $ query -> addSubquery ( $ subquery -> rewrite ( $ index ) , ( $ this -> _sign... | Re - write queries into primitive queries |
59,124 | private static function finalize_code_output ( $ i , $ output ) { if ( isset ( $ output [ $ i ] ) && trim ( $ output [ $ i ] ) ) { $ output [ $ i ] .= "\n```\n" ; } else { $ output [ $ i ] = "```" ; } return $ output ; } | Adds the closing code backticks . Removes trailing whitespace . |
59,125 | public static function generate_html_id ( $ title ) { $ t = $ title ; $ t = str_replace ( '&' , '-and-' , $ t ) ; $ t = str_replace ( '&' , '-and-' , $ t ) ; $ t = preg_replace ( '/[^A-Za-z0-9]+/' , '-' , $ t ) ; $ t = preg_replace ( '/-+/' , '-' , $ t ) ; $ t = trim ( $ t , '-' ) ; $ t = strtolower ( $ t ) ; retur... | Generate an html element id from a string |
59,126 | public static function rewrite_relative_links ( $ md , $ page ) { $ baselink = $ page -> getEntity ( ) -> Link ( ) ; $ re = '/ ([^\!]?) # exclude image format \[ (.*?) # link title (non greedy) \] \( (.*?) # link url (non greedy) \) /x' ; preg_match_all ( $ re , $ md , $ matches ) ; $ relativePath = Do... | Resolves all relative links within markdown . |
59,127 | public function writeDate ( DateTime $ data ) { $ this -> stream -> writeDouble ( $ data -> format ( 'U' ) * 1000 ) ; $ this -> stream -> writeInt ( 0 ) ; } | Writes a date object |
59,128 | public function getAll ( $ cache = true ) { if ( $ cache ) { return $ this -> cache -> getAll ( ) ; } $ all = [ ] ; $ rows = $ this -> database -> table ( $ this -> config [ 'db_table' ] ) -> get ( ) ; foreach ( $ rows as $ row ) { $ value = json_decode ( $ row -> setting_value , true ) ; $ all [ $ row -> setting_key ]... | Fetch all values |
59,129 | public function forget ( $ key ) { $ keyExp = explode ( '.' , $ key ) ; $ query = $ this -> database -> table ( $ this -> config [ 'db_table' ] ) -> where ( 'setting_key' , $ keyExp [ 0 ] ) ; $ row = $ query -> first ( [ 'setting_value' ] ) ; if ( ! is_null ( $ row ) ) { if ( count ( $ keyExp ) > 1 ) { $ setting_value ... | Remove a settings from database and cache file |
59,130 | public function clean ( $ params = [ ] ) { if ( ! empty ( $ this -> config [ 'primary_config_file' ] ) ) { $ default_settings = Arr :: dot ( Config :: get ( $ this -> config [ 'primary_config_file' ] ) ) ; $ saved_settings = Arr :: dot ( $ this -> getAll ( $ cache = false ) ) ; if ( array_key_exists ( 'flush' , $ param... | Cleans settings that are no longer used in primary config file |
59,131 | public static function obtainWriteLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> createFile ( self :: WRITE_LOCK_FILE ) ; if ( ! $ lock -> lock ( LOCK_EX ) ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Can\'t obtain exclusive... | Obtain exclusive write lock on the index |
59,132 | public static function releaseWriteLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> getFileObject ( self :: WRITE_LOCK_FILE ) ; $ lock -> unlock ( ) ; } | Release exclusive write lock |
59,133 | public static function obtainReadLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> createFile ( self :: READ_LOCK_FILE ) ; if ( ! $ lock -> lock ( LOCK_SH ) ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Can\'t obtain shared read... | Obtain shared read lock on the index |
59,134 | public static function releaseReadLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> getFileObject ( self :: READ_LOCK_FILE ) ; $ lock -> unlock ( ) ; } | Release shared read lock |
59,135 | public static function escalateReadLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { self :: _startReadLockProcessing ( $ lockDirectory ) ; $ lock = $ lockDirectory -> getFileObject ( self :: READ_LOCK_FILE ) ; $ lock -> unlock ( ) ; for ( $ retries = 0 ; $ retries < 10 ; $ retries ++ ) { if ( $ lock -> l... | Escalate Read lock to exclusive level |
59,136 | public static function deEscalateReadLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> getFileObject ( self :: READ_LOCK_FILE ) ; $ lock -> lock ( LOCK_SH ) ; } | De - escalate Read lock to shared level |
59,137 | public static function obtainOptimizationLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> createFile ( self :: OPTIMIZATION_LOCK_FILE ) ; if ( ! $ lock -> lock ( LOCK_EX , true ) ) { return false ; } return $ lock ; } | Obtain exclusive optimization lock on the index |
59,138 | public static function releaseOptimizationLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { $ lock = $ lockDirectory -> getFileObject ( self :: OPTIMIZATION_LOCK_FILE ) ; $ lock -> unlock ( ) ; } | Release exclusive optimization lock |
59,139 | public static function getActualGeneration ( Zend_Search_Lucene_Storage_Directory $ directory ) { include_once 'Zend/Search/Lucene/Exception.php' ; try { for ( $ count = 0 ; $ count < self :: GENERATION_RETRIEVE_COUNT ; $ count ++ ) { $ genFile = $ directory -> getFileObject ( 'segments.gen' , false ) ; $ format = $ ge... | Get current generation number |
59,140 | public function setFormatVersion ( $ formatVersion ) { if ( $ formatVersion != self :: FORMAT_PRE_2_1 && $ formatVersion != self :: FORMAT_2_1 && $ formatVersion != self :: FORMAT_2_3 ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Unsupported index format' ) ; } $ this -... | Set index format version . Index is converted to this format at the nearest upfdate time |
59,141 | private function _readPre21SegmentsFile ( ) { $ segmentsFile = $ this -> _directory -> getFileObject ( 'segments' ) ; $ format = $ segmentsFile -> readInt ( ) ; if ( $ format != ( int ) 0xFFFFFFFF ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Wrong segments file format'... | Read segments file for pre - 2 . 1 Lucene index format |
59,142 | private function _readSegmentsFile ( ) { $ segmentsFile = $ this -> _directory -> getFileObject ( self :: getSegmentFileName ( $ this -> _generation ) ) ; $ format = $ segmentsFile -> readInt ( ) ; if ( $ format == ( int ) 0xFFFFFFFC ) { $ this -> _formatVersion = self :: FORMAT_2_3 ; } else if ( $ format == ( int ) 0x... | Read segments file |
59,143 | private function _close ( ) { if ( $ this -> _closed ) { return ; } $ this -> commit ( ) ; Zend_Search_Lucene_LockManager :: releaseReadLock ( $ this -> _directory ) ; if ( $ this -> _closeDirOnExit ) { $ this -> _directory -> close ( ) ; } $ this -> _directory = null ; $ this -> _writer = null ; $ this -> _segmentInfo... | Close current index and free resources |
59,144 | private function _getIndexWriter ( ) { if ( $ this -> _writer === null ) { include_once 'Zend/Search/Lucene/Index/Writer.php' ; $ this -> _writer = new Zend_Search_Lucene_Index_Writer ( $ this -> _directory , $ this -> _segmentInfos , $ this -> _formatVersion ) ; } return $ this -> _writer ; } | Returns an instance of Zend_Search_Lucene_Index_Writer for the index |
59,145 | public function termDocs ( Zend_Search_Lucene_Index_Term $ term , $ docsFilter = null ) { $ subResults = array ( ) ; $ segmentStartDocId = 0 ; foreach ( $ this -> _segmentInfos as $ segmentInfo ) { $ subResults [ ] = $ segmentInfo -> termDocs ( $ term , $ segmentStartDocId , $ docsFilter ) ; $ segmentStartDocId += $ se... | Returns IDs of all documents containing term . |
59,146 | private function _updateDocCount ( ) { $ this -> _docCount = 0 ; foreach ( $ this -> _segmentInfos as $ segInfo ) { $ this -> _docCount += $ segInfo -> count ( ) ; } } | Update document counter |
59,147 | public function optimize ( ) { $ this -> commit ( ) ; if ( count ( $ this -> _segmentInfos ) > 1 || $ this -> hasDeletions ( ) ) { $ this -> _getIndexWriter ( ) -> optimize ( ) ; $ this -> _updateDocCount ( ) ; } } | Optimize index . |
59,148 | protected function getWithBuilder ( array $ with , ? array $ withCounts = null , ? array $ where = null , ? SortOptions $ sortOptions = null ) : Builder { return $ this -> query ( ) -> when ( $ with , function ( Builder $ query ) use ( $ with ) { return $ query -> with ( $ with ) ; } ) -> when ( $ withCounts , function... | Returns builder that satisfied requested conditions with eager loaded requested relations and relations counts ordered by requested rules . |
59,149 | protected function getNestedWhereConditions ( $ builder , array $ criteria ) { $ subQuery = $ builder -> forNestedWhere ( ) ; foreach ( $ criteria as $ key => $ criterionData ) { switch ( true ) { case $ criterionData instanceof Criterion : $ criterion = $ criterionData ; break ; case is_string ( $ key ) && ( ( ! is_ar... | Returns query builder with applied criteria . This method work recursively and group nested criteria in one level . |
59,150 | protected function isNestedCriteria ( array $ criterionData ) : bool { $ isValid = true ; foreach ( $ criterionData as $ key => $ possibleCriterion ) { $ isValid = $ isValid && ( ( is_int ( $ key ) && is_array ( $ possibleCriterion ) ) || ( $ key === Criterion :: BOOLEAN && in_array ( $ possibleCriterion , [ 'and' , 'o... | Shows whether given criterion data is nested . |
59,151 | protected function parseCriterion ( array $ criterionData ) : Criterion { return new Criterion ( [ Criterion :: ATTRIBUTE => $ criterionData [ 0 ] ?? null , Criterion :: OPERATOR => $ criterionData [ 1 ] ?? null , Criterion :: VALUE => $ criterionData [ 2 ] ?? null , Criterion :: BOOLEAN => $ criterionData [ 3 ] ?? 'an... | Transforms criterion data into DTO . |
59,152 | protected function isCriterionValid ( Criterion $ criterion ) : bool { $ isMultipleOperator = ( is_array ( $ criterion -> value ) || $ criterion -> value instanceof Collection ) && in_array ( $ criterion -> operator , $ this -> multipleOperators ) ; $ isSingleOperator = is_string ( $ criterion -> value ) && in_array ( ... | Checks whether the criterion is valid . |
59,153 | public function getMarkdown ( $ removeMetaData = false ) { try { if ( is_file ( $ this -> getPath ( ) ) && $ md = file_get_contents ( $ this -> getPath ( ) ) ) { $ this -> populateMetaDataFromText ( $ md , $ removeMetaData ) ; return $ md ; } $ this -> read = true ; } catch ( InvalidArgumentException $ e ) { } return f... | Return the raw markdown for a given documentation page . |
59,154 | public function Link ( $ short = false ) { return Controller :: join_links ( $ this -> entity -> Link ( $ short ) , $ this -> getRelativeLink ( ) ) ; } | Returns the URL that will be required for the user to hit to view the given document base name . |
59,155 | public function populateMetaDataFromText ( & $ md , $ removeMetaData = false ) { if ( ! $ md ) { return ; } $ parser = new \ Mni \ FrontYAML \ Parser ( ) ; $ document = $ parser -> parse ( $ md , false ) ; $ yaml = $ document -> getYAML ( ) ; if ( $ yaml ) { foreach ( $ yaml as $ key => $ value ) { if ( ! property_exis... | Return metadata from the first html block in the page then remove the block on request |
59,156 | public function finishExpression ( ) { if ( $ this -> getState ( ) != self :: ST_LITERAL ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Literal expected.' ) ; } $ this -> _conjunctions [ ] = $ this -> _currentConjunction ; return $ this -> _conjunctions ; } | Finish an expression and return result |
59,157 | public function writeByte ( $ byte ) { $ this -> _data .= chr ( $ byte ) ; $ this -> _position = strlen ( $ this -> _data ) ; return 1 ; } | Writes a byte to the end of the file . |
59,158 | public function readBytes ( $ num ) { $ returnValue = substr ( $ this -> _data , $ this -> _position , $ num ) ; $ this -> _position += $ num ; return $ returnValue ; } | Read num bytes from the current position in the file and advances the file pointer . |
59,159 | public function readBinary ( ) { $ length = $ this -> readVInt ( ) ; $ returnValue = substr ( $ this -> _data , $ this -> _position , $ length ) ; $ this -> _position += $ length ; return $ returnValue ; } | Reads binary data from the current position in the file and advances the file pointer . |
59,160 | public function getStatus ( ) { if ( null === $ this -> username || null === $ this -> password ) { throw new Exception \ InvalidCredentialsException ( 'No API credentials provided' ) ; } $ res = $ this -> getAdapter ( ) -> getContent ( self :: SMS_STATUS_URL , 'POST' , $ headers = array ( ) , $ this -> getParameters (... | Retrieves the queued delivery receipts |
59,161 | protected function parseStatusResults ( $ result , array $ extra_result_data = array ( ) ) { $ result = trim ( $ result ) ; $ this -> checkForUnrecoverableError ( $ result ) ; return $ this -> checkForStatusResult ( $ result ) ; } | Parses the data returned by the API for a status request . |
59,162 | protected function parseSendResults ( $ result , array $ extra_result_data = array ( ) ) { $ result = trim ( $ result ) ; $ this -> checkForUnrecoverableError ( $ result ) ; if ( ! $ this -> isMessageSent ( $ result ) ) { return array_merge ( $ this -> getDefaults ( ) , $ extra_result_data ) ; } $ sms_data = array ( 's... | Parses the data returned by the API for a send request . |
59,163 | public function normalize ( Zend_Search_Lucene_Analysis_Token $ token ) { foreach ( $ this -> _filters as $ filter ) { $ token = $ filter -> normalize ( $ token ) ; if ( $ token === null ) { return null ; } } return $ token ; } | Apply filters to the token . Can return null when the token was removed . |
59,164 | public function withAddedInterceptor ( string $ name , array $ functions ) : self { if ( ! isset ( $ this -> interceptors [ $ name ] ) ) { $ this -> interceptors [ $ name ] = [ ] ; } $ this -> interceptors [ $ name ] = array_merge ( $ this -> interceptors [ $ name ] , $ functions ) ; return $ this ; } | Add a function to the interceptor |
59,165 | public function removeInterceptor ( string $ name ) : self { if ( isset ( $ this -> interceptors [ $ name ] ) ) { unset ( $ this -> interceptors [ $ name ] ) ; } return $ this ; } | Remove the interceptor |
59,166 | public function callInterceptor ( string $ name , ... $ arguments ) { if ( ! empty ( $ this -> interceptors [ $ name ] ) ) { foreach ( $ this -> interceptors [ $ name ] as $ function ) { $ ret = Helper :: call ( $ function , ... $ arguments ) ; if ( $ ret !== null ) { return $ ret ; } } } return null ; } | Call the interceptor |
59,167 | public static function parse ( $ strQuery , $ encoding = null ) { self :: _getInstance ( ) ; self :: $ _instance -> reset ( ) ; include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; try { include_once 'Zend/Search/Lucene/Search/QueryParserContext.php' ; self :: $ _instance -> _encoding = ( $ encoding !== ... | Parses a query string |
59,168 | public function addTermEntry ( ) { include_once 'Zend/Search/Lucene/Search/QueryEntry/Term.php' ; $ entry = new Zend_Search_Lucene_Search_QueryEntry_Term ( $ this -> _currentToken -> text , $ this -> _context -> getField ( ) ) ; $ this -> _context -> addEntry ( $ entry ) ; } | Add term to a query |
59,169 | public function addPhraseEntry ( ) { include_once 'Zend/Search/Lucene/Search/QueryEntry/Phrase.php' ; $ entry = new Zend_Search_Lucene_Search_QueryEntry_Phrase ( $ this -> _currentToken -> text , $ this -> _context -> getField ( ) ) ; $ this -> _context -> addEntry ( $ entry ) ; } | Add phrase to a query |
59,170 | public function processModifierParameter ( ) { if ( $ this -> _lastToken === null ) { include_once 'Zend/Search/Lucene/Search/QueryParserException.php' ; throw new Zend_Search_Lucene_Search_QueryParserException ( 'Lexeme modifier parameter must follow lexeme modifier. Char position 0.' ) ; } switch ( $ this -> _lastTok... | Process modifier parameter |
59,171 | protected function cached ( string $ key , Closure $ dataGetter ) { if ( $ this -> cacheRepository -> has ( $ key ) ) { return $ this -> cacheRepository -> get ( $ key ) ; } $ result = $ dataGetter ( ) ; $ this -> cacheRepository -> put ( $ key , $ result , $ this -> cacheTimeout ) ; return $ result ; } | Get data from cache . If it not exists in cache got it in repository and store in cache . |
59,172 | private function find ( $ id ) : ? Model { try { return $ this -> repository -> findOrFail ( $ id ) ; } catch ( ModelNotFoundException $ exception ) { return null ; } } | Find model in original repository . |
59,173 | protected function invalidate ( Model $ model ) : void { $ key = $ this -> prefix . ":" . $ model -> getKey ( ) ; if ( $ this -> cacheRepository -> has ( $ key ) ) { $ this -> cacheRepository -> forget ( $ key ) ; } $ this -> cacheRepository -> forget ( "$this->prefix.:all" ) ; } | Invalidate model in cache . |
59,174 | public function setMax ( string $ key , int $ max_size = - 1 ) : int { $ is_exist = ! $ this -> init ( $ key , $ max_size ) ; if ( $ is_exist && $ this -> resource_map [ $ key ] instanceof Channel ) { $ current_max = $ this -> status_map [ $ key ] [ 'max' ] ; $ this -> status_map [ $ key ] [ 'max' ] = $ max_size ; if (... | expend will create the new chan |
59,175 | public static function mkdirs ( $ dir , $ mode = 0777 , $ recursive = true ) { if ( ( $ dir === null ) || $ dir === '' ) { return false ; } if ( is_dir ( $ dir ) || $ dir === '/' ) { return true ; } if ( self :: mkdirs ( dirname ( $ dir ) , $ mode , $ recursive ) ) { return mkdir ( $ dir , $ mode ) ; } return false ; } | Utility function to recursive directory creation |
59,176 | public function fileList ( ) { $ result = array ( ) ; $ dirContent = opendir ( $ this -> _dirPath ) ; while ( ( $ file = readdir ( $ dirContent ) ) !== false ) { if ( ( $ file == '..' ) || ( $ file == '.' ) ) { continue ; } if ( ! is_dir ( $ this -> _dirPath . '/' . $ file ) ) { $ result [ ] = $ file ; } } closedir ( $... | Returns an array of strings one for each file in the directory . |
59,177 | public function purgeFile ( $ filename ) { if ( isset ( $ this -> _fileHandlers [ $ filename ] ) ) { $ this -> _fileHandlers [ $ filename ] -> close ( ) ; } unset ( $ this -> _fileHandlers [ $ filename ] ) ; } | Purge file if it s cached by directory object |
59,178 | public function renameFile ( $ from , $ to ) { global $ php_errormsg ; if ( isset ( $ this -> _fileHandlers [ $ from ] ) ) { $ this -> _fileHandlers [ $ from ] -> close ( ) ; } unset ( $ this -> _fileHandlers [ $ from ] ) ; if ( isset ( $ this -> _fileHandlers [ $ to ] ) ) { $ this -> _fileHandlers [ $ to ] -> close ( ... | Renames an existing file in the directory . |
59,179 | private function _retrieveNodeText ( DOMNode $ node , & $ text ) { if ( $ node -> nodeType == XML_TEXT_NODE ) { $ text .= $ node -> nodeValue ; if ( ! in_array ( $ node -> parentNode -> tagName , $ this -> _inlineTags ) ) { $ text .= ' ' ; } } else if ( $ node -> nodeType == XML_ELEMENT_NODE && $ node -> nodeName != 's... | Get node text |
59,180 | public static function loadHTML ( $ data , $ storeContent = false , $ defaultEncoding = '' ) { return new Zend_Search_Lucene_Document_Html ( $ data , false , $ storeContent , $ defaultEncoding ) ; } | Load HTML document from a string |
59,181 | public static function loadHTMLFile ( $ file , $ storeContent = false , $ defaultEncoding = '' ) { return new Zend_Search_Lucene_Document_Html ( $ file , true , $ storeContent , $ defaultEncoding ) ; } | Load HTML document from a file |
59,182 | protected function _highlightTextNode ( DOMText $ node , $ wordsToHighlight , $ callback , $ params ) { include_once 'Zend/Search/Lucene/Analysis/Analyzer.php' ; $ analyzer = Zend_Search_Lucene_Analysis_Analyzer :: getDefault ( ) ; $ analyzer -> setInput ( $ node -> nodeValue , 'UTF-8' ) ; $ matchedTokens = array ( ) ;... | Highlight text in text node |
59,183 | protected function _highlightNodeRecursive ( DOMNode $ contextNode , $ wordsToHighlight , $ callback , $ params ) { $ textNodes = array ( ) ; if ( ! $ contextNode -> hasChildNodes ( ) ) { return ; } foreach ( $ contextNode -> childNodes as $ childNode ) { if ( $ childNode -> nodeType == XML_TEXT_NODE ) { $ textNodes [ ... | highlight words in content of the specified node |
59,184 | public function highlightExtended ( $ words , $ callback , $ params = array ( ) ) { include_once 'Zend/Search/Lucene/Analysis/Analyzer.php' ; if ( ! is_array ( $ words ) ) { $ words = array ( $ words ) ; } $ wordsToHighlightList = array ( ) ; $ analyzer = Zend_Search_Lucene_Analysis_Analyzer :: getDefault ( ) ; foreach... | Highlight text using specified View helper or callback function . |
59,185 | public function getHtmlBody ( ) { $ xpath = new DOMXPath ( $ this -> _doc ) ; $ bodyNodes = $ xpath -> query ( '/html/body' ) -> item ( 0 ) -> childNodes ; $ outputFragments = array ( ) ; for ( $ count = 0 ; $ count < $ bodyNodes -> length ; $ count ++ ) { $ outputFragments [ ] = $ this -> _doc -> saveXML ( $ bodyNodes... | Get HTML body |
59,186 | private function _calculateMaxDistance ( $ prefixLength , $ termLength , $ length ) { $ this -> _maxDistances [ $ length ] = ( int ) ( ( 1 - $ this -> _minimumSimilarity ) * ( min ( $ termLength , $ length ) + $ prefixLength ) ) ; return $ this -> _maxDistances [ $ length ] ; } | Calculate maximum distance for specified word length |
59,187 | public static function createIndex ( Zend_Search_Lucene_Storage_Directory $ directory , $ generation , $ nameCount ) { if ( $ generation == 0 ) { foreach ( $ directory -> fileList ( ) as $ file ) { if ( $ file == 'deletable' || $ file == 'segments' || isset ( self :: $ _indexExtensions [ substr ( $ file , strlen ( $ fi... | Create empty index |
59,188 | private function _hasAnythingToMerge ( ) { $ segmentSizes = array ( ) ; foreach ( $ this -> _segmentInfos as $ segName => $ segmentInfo ) { $ segmentSizes [ $ segName ] = $ segmentInfo -> count ( ) ; } $ mergePool = array ( ) ; $ poolSize = 0 ; $ sizeToMerge = $ this -> maxBufferedDocs ; asort ( $ segmentSizes , SORT_N... | Check if we have anything to merge |
59,189 | private function _maybeMergeSegments ( ) { if ( Zend_Search_Lucene_LockManager :: obtainOptimizationLock ( $ this -> _directory ) === false ) { return ; } if ( ! $ this -> _hasAnythingToMerge ( ) ) { Zend_Search_Lucene_LockManager :: releaseOptimizationLock ( $ this -> _directory ) ; return ; } $ this -> _updateSegment... | Merge segments if necessary |
59,190 | private function _mergeSegments ( $ segments ) { $ newName = $ this -> _newSegmentName ( ) ; include_once 'Zend/Search/Lucene/Index/SegmentMerger.php' ; $ merger = new Zend_Search_Lucene_Index_SegmentMerger ( $ this -> _directory , $ newName ) ; foreach ( $ segments as $ segmentInfo ) { $ merger -> addSource ( $ segmen... | Merge specified segments |
59,191 | public function commit ( ) { if ( $ this -> _currentSegment !== null ) { $ newSegment = $ this -> _currentSegment -> close ( ) ; if ( $ newSegment !== null ) { $ this -> _newSegments [ $ newSegment -> getName ( ) ] = $ newSegment ; } $ this -> _currentSegment = null ; } $ this -> _updateSegments ( ) ; } | Commit current changes |
59,192 | public function optimize ( ) { if ( Zend_Search_Lucene_LockManager :: obtainOptimizationLock ( $ this -> _directory ) === false ) { return false ; } $ this -> _updateSegments ( ) ; $ this -> _mergeSegments ( $ this -> _segmentInfos ) ; Zend_Search_Lucene_LockManager :: releaseOptimizationLock ( $ this -> _directory ) ;... | Merges all segments together into new one |
59,193 | private function _newSegmentName ( ) { Zend_Search_Lucene_LockManager :: obtainWriteLock ( $ this -> _directory ) ; $ generation = Zend_Search_Lucene :: getActualGeneration ( $ this -> _directory ) ; $ segmentsFile = $ this -> _directory -> getFileObject ( Zend_Search_Lucene :: getSegmentFileName ( $ generation ) , fal... | Get name for new segment |
59,194 | public function using ( $ name ) { if ( isset ( $ this -> providers [ $ name ] ) ) { $ this -> provider = $ this -> providers [ $ name ] ; } return $ this ; } | Sets the provider to use . |
59,195 | public function getProvider ( ) { if ( null === $ this -> provider ) { if ( 0 === count ( $ this -> providers ) ) { throw new \ RuntimeException ( 'No provider registered.' ) ; } else { $ this -> provider = $ this -> providers [ key ( $ this -> providers ) ] ; } } return $ this -> provider ; } | Returns the provider to use . |
59,196 | public function getField ( $ fieldName ) { if ( ! array_key_exists ( $ fieldName , $ this -> _fields ) ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( "Field name \"$fieldName\" not found in document." ) ; } return $ this -> _fields [ $ fieldName ] ; } | Returns Zend_Search_Lucene_Field object for a named field in this document . |
59,197 | public function addValueSortToCollection ( $ collection , $ dir = 'asc' ) { $ attributeCode = $ this -> getAttribute ( ) -> getAttributeCode ( ) ; $ attributeId = $ this -> getAttribute ( ) -> getId ( ) ; $ attributeTable = $ this -> getAttribute ( ) -> getBackend ( ) -> getTable ( ) ; $ linkField = $ this -> getAttrib... | Add Value Sort To Collection Select |
59,198 | public function getTitle ( ) { if ( ! $ this -> title ) { $ this -> title = DocumentationHelper :: clean_page_name ( $ this -> key ) ; } return $ this -> title ; } | Get the title of this module . |
59,199 | public function Link ( $ short = false ) { if ( $ this -> getIsDefaultEntity ( ) ) { $ base = Controller :: join_links ( Director :: baseURL ( ) , Config :: inst ( ) -> get ( 'DocumentationViewer' , 'link_base' ) , $ this -> getLanguage ( ) , '/' ) ; } else { $ base = Controller :: join_links ( Director :: baseURL ( ) ... | Returns the web accessible link to this entity . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.