idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
234,400 | public function login ( $ username = null , $ password = null ) { if ( ! isset ( $ username ) && isset ( $ _POST [ 'username' ] ) ) { $ username = $ _POST [ 'username' ] ; } if ( ! isset ( $ password ) && isset ( $ _POST [ 'password' ] ) ) { $ password = $ _POST [ 'password' ] ; } $ result = $ this -> request ( 'POST' ... | Log the client in at the SSO server . |
234,401 | public function get ( ) { $ class = null ; if ( $ this -> state ) { for ( $ i = 5 ; $ i > 0 ; $ i -- ) { $ exceptionQueue [ ] = sprintf ( "State%s" , substr ( $ this -> state , 0 , $ i ) ) ; } while ( ! $ class and $ _class = array_shift ( $ exceptionQueue ) ) { $ file = __DIR__ . "/Exception/States/{$_class}.php" ; if... | Get the actual exception |
234,402 | public function execute ( $ request ) { $ logger = $ GLOBALS [ 'logger' ] ; try { parent :: execute ( $ request ) ; } catch ( AuthenticationException $ ex ) { $ logger -> error ( 'Unauthorized attempt to access resource, being redirected to home page' , array ( $ ex -> getMessage ( ) ) ) ; $ this -> _handleUnauthentica... | Checks for secure routing currently security is handled at a base route level |
234,403 | protected function _handleUnauthenticatedAccess ( ) { header ( "HTTP/1.0 401 Unauthorized" ) ; $ renderer = new TwigRenderer ( ) ; $ output = $ renderer -> render ( 'unauth.tmpl' , array ( ) ) ; $ result = array ( "code" => "401" , "message" => $ output ) ; echo parent :: encodeData ( $ result ) ; exit ; } | Handle Unauthenticated access . |
234,404 | public function domain ( $ domain = null ) { if ( null !== $ domain ) { if ( false === is_string ( $ domain ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ domain ) ) , E_USER_ERROR ) ; } if ( false === Router :: routeExists ( $ this -... | Set the domain |
234,405 | public function syn ( ) { if ( ! isset ( $ this -> options [ "host" ] ) || empty ( $ this -> options [ "host" ] ) ) { $ this -> options [ "host" ] = $ this -> default_host ; } if ( ! isset ( $ this -> options [ "port" ] ) || empty ( $ this -> options [ "port" ] ) ) { $ this -> options [ "port" ] = $ this -> default_por... | Connects the AbstractTransport object and performs initial actions on the remote server . |
234,406 | public function listCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' ) { $ this -> beforeCommand ( ) ; $ table = new ConsoleTable ( ) ; $ table -> setHeaders ( [ 'UID' , 'Title' , 'Page ID' , 'Status' ] ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) ... | Lists page language overlays . |
234,407 | public function initializeCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' , bool $ verbose = false ) { $ this -> beforeCommand ( ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) as $ pageUid ) { $ languageOverlay = LanguageOverlay :: where ( [ [ 'pid'... | Initializes page language overlays . |
234,408 | public function hideCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' , bool $ verbose = false ) { $ this -> beforeCommand ( ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) as $ pageUid ) { $ languageOverlay = LanguageOverlay :: where ( [ [ 'pid' , '='... | Hides page language overlays . |
234,409 | protected function getPageUids ( int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' ) { $ exclude = $ exclude === '-' ? '' : $ exclude ; $ exclude = GeneralUtility :: intExplode ( ',' , $ exclude , true ) ; $ pagesTreeList = $ this -> queryGenerator -> getTreeList ( $ pid , $ recursion , 0 , 1 ) ; $ pageUids ... | Gets page UIDs . |
234,410 | public function process ( ContainerBuilder $ container ) { $ registryDefinition = $ container -> getDefinition ( 'spray_serializer.serializer_registry' ) ; $ tagged = $ container -> findTaggedServiceIds ( 'spray_serializer' ) ; foreach ( $ tagged as $ id => $ tags ) { foreach ( $ tags as $ attr ) { $ registryDefinition... | Find services tagged with spray_serializer and attach them to the serializer registry . |
234,411 | public function getToken ( $ tokenId ) { if ( $ this -> storage -> hasToken ( $ tokenId ) ) { return $ this -> storage -> getToken ( $ tokenId ) ; } $ token = new CsrfToken ( $ tokenId , $ this -> generateValue ( ( int ) $ this -> tokenLength ) ) ; $ this -> storage -> setToken ( $ tokenId , $ token ) ; return $ token ... | returns a CSRF token for the given token id |
234,412 | public function refreshToken ( $ tokenId ) { $ this -> storage -> removeToken ( $ tokenId ) ; $ token = new CsrfToken ( $ tokenId , $ this -> generateValue ( ( int ) $ this -> tokenLength ) ) ; $ this -> storage -> setToken ( $ tokenId , $ token ) ; return $ token ; } | generates a new token for the given id a new token will be generated independent of whether a token value previously existed or not useful to enforce once - only tokens |
234,413 | public function isTokenValid ( CsrfToken $ token ) { $ tokenId = $ token -> getId ( ) ; if ( ! $ this -> storage -> hasToken ( $ tokenId ) ) { return FALSE ; } return hash_equals ( $ this -> storage -> getToken ( $ tokenId ) -> getValue ( ) , $ token -> getValue ( ) ) ; } | check whether the given CSRF token is valid returns TRUE if the token is valid FALSE otherwise |
234,414 | public static function getSessionCookieForExportUser ( $ user , $ pass ) { global $ wgServerHTTP , $ wgScriptPath , $ wgODBTechnicalUser ; $ user = urlencode ( $ user ) ; $ pass = urlencode ( $ pass ) ; $ apiPath = "/api.php?action=login&format=json&lgname=$user&lgpassword=$pass" ; $ response = Http :: post ( $ wgServe... | Requests a session cookie for a user . |
234,415 | public function addClassListeners ( $ instance ) { if ( ! $ this -> driver ) { throw Exception :: noDriver ( ) ; } foreach ( $ this -> driver -> getListenersForClass ( $ instance ) as $ listener ) { $ this -> addListener ( $ listener [ 'event' ] , array ( $ instance , $ listener [ 'method' ] ) ) ; } } | Automatically maps event listeners associated with a class using the driver provided to this instance and registers them . |
234,416 | public function addListeners ( $ event , $ listeners ) { foreach ( $ listeners as $ listener ) { $ this -> addListener ( $ event , $ listener ) ; } } | Adds a set of listeners . |
234,417 | public function getListeners ( $ event ) { if ( ! isset ( $ this -> listeners [ $ event ] ) || ! is_array ( $ this -> listeners [ $ event ] ) ) { return array ( ) ; } return $ this -> listeners [ $ event ] ; } | Retrieves all listeners for an event . |
234,418 | public function dispatch ( $ event , Event $ eventObject ) { if ( ! isset ( $ this -> listeners [ $ event ] ) ) { return ; } foreach ( $ this -> listeners [ $ event ] as $ listener ) { call_user_func_array ( $ listener , array ( $ eventObject ) ) ; if ( $ eventObject -> propagationHalted ( ) ) { break ; } } } | Dispatches an event to all listeners . |
234,419 | protected final function BuiltInTemplateFile ( ) { $ class = new \ ReflectionClass ( $ this ) ; $ classFile = Str :: Replace ( '\\' , '/' , $ class -> getFileName ( ) ) ; $ templatePath = Str :: Replace ( '/Modules/' , '/Templates/' , $ classFile ) ; return Path :: AddExtension ( $ templatePath , 'phtml' , true ) ; } | Returns the template file that comes with the bundle module |
234,420 | public function up ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] , $ this -> _currentPosition [ 1 ] - $ count , ) ; return $ this ; } | Move up current position |
234,421 | public function down ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] , $ this -> _currentPosition [ 1 ] + $ count , ) ; return $ this ; } | Move down current position |
234,422 | public function left ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] - $ count , $ this -> _currentPosition [ 1 ] , ) ; return $ this ; } | Move left current position |
234,423 | public function right ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] + $ count , $ this -> _currentPosition [ 1 ] , ) ; return $ this ; } | Move right current position |
234,424 | public function move ( $ dx , $ dy ) { if ( $ dx < 0 ) { $ this -> left ( abs ( $ dx ) ) ; } else { $ this -> right ( abs ( $ dx ) ) ; } if ( $ dy < 0 ) { $ this -> up ( abs ( $ dy ) ) ; } else { $ this -> down ( abs ( $ dy ) ) ; } return $ this ; } | Move current position |
234,425 | public function setAncor ( $ position = null ) { if ( is_null ( $ position ) === true ) { $ position = $ this -> _currentPosition ; } $ this -> _ancorPosition = $ position ; return $ this ; } | Set ancor position |
234,426 | public function getEscapeSequencesByPath ( $ dx = null , $ dy = null ) { if ( is_null ( $ dx ) === true ) { $ dx = $ this -> _currentPosition [ 0 ] - $ this -> _ancorPosition [ 0 ] ; } if ( is_null ( $ dy ) === true ) { $ dy = $ this -> _currentPosition [ 1 ] - $ this -> _ancorPosition [ 1 ] ; } return self :: getMovin... | Get escape sequences by path |
234,427 | public static function getMovingEscapeSequences ( $ dx , $ dy ) { $ escapeSequences = '' ; if ( $ dy < 0 ) { $ escapeSequences .= self :: getUpEscapeSequence ( abs ( $ dy ) ) ; } else if ( $ dy > 0 ) { $ escapeSequences .= self :: getDownEscapeSequence ( abs ( $ dy ) ) ; } if ( $ dx < 0 ) { $ escapeSequences .= self ::... | Get moving escape sequences |
234,428 | protected function retryJob ( $ id ) { $ failed = $ this -> laravel [ 'queue.failer' ] -> find ( $ id ) ; if ( ! is_null ( $ failed ) ) { $ failed = ( object ) $ failed ; $ failed -> payload = $ this -> resetAttempts ( $ failed -> payload ) ; $ this -> laravel [ 'queue' ] -> connection ( $ failed -> connection ) -> pus... | Retry the queue job with the given ID . |
234,429 | protected function resetAttempts ( $ payload ) { $ payload = json_decode ( $ payload , true ) ; if ( isset ( $ payload [ 'attempts' ] ) ) { $ payload [ 'attempts' ] = 1 ; } return json_encode ( $ payload ) ; } | Reset the payload attempts . |
234,430 | public function validate ( $ value , & $ error = null ) { $ result = $ this -> validateValue ( $ value ) ; if ( empty ( $ result ) ) { return true ; } list ( $ message , $ params ) = $ result ; $ params [ 'attribute' ] = Yii :: t ( 'yii' , 'the input value' ) ; $ params [ 'value' ] = is_array ( $ value ) ? 'array()' : ... | Validates a given value . You may use this method to validate a value out of the context of a data model . |
234,431 | public function addError ( $ model , $ attribute , $ message , $ params = [ ] ) { $ value = $ model -> $ attribute ; $ params [ 'attribute' ] = $ model -> getAttributeLabel ( $ attribute ) ; $ params [ 'value' ] = is_array ( $ value ) ? 'array()' : $ value ; $ model -> addError ( $ attribute , Yii :: $ app -> getI18n (... | Adds an error about the specified attribute to the model object . This is a helper method that performs message selection and internationalization . |
234,432 | public static function getAllFiles ( $ dir , $ subdir = false ) { $ path = '' ; $ stack [ ] = $ dir ; while ( $ stack ) { $ thisdir = array_pop ( $ stack ) ; if ( $ dircont = scandir ( $ thisdir ) ) { $ i = 0 ; while ( isset ( $ dircont [ $ i ] ) ) { if ( $ dircont [ $ i ] !== '.' && $ dircont [ $ i ] !== '..' ) { $ cu... | Get all directory files and directories |
234,433 | public static function getAllSubdirectories ( $ dir , $ subdir = false ) { $ path = '' ; $ stack [ ] = $ dir ; while ( $ stack ) { $ thisdir = array_shift ( $ stack ) ; if ( $ dircont = scandir ( $ thisdir ) ) { $ i = 0 ; while ( isset ( $ dircont [ $ i ] ) ) { if ( $ dircont [ $ i ] !== '.' && $ dircont [ $ i ] !== '.... | Get all subdirectories of directory |
234,434 | final public static function getValueOf ( $ rawValue ) { $ values = static :: getValues ( ) ; if ( ! array_key_exists ( $ rawValue , $ values ) ) { throw new OutOfBoundsException ( sprintf ( 'Enum "%s" has no value with raw value "%s".' , get_called_class ( ) , $ rawValue ) ) ; } return $ values [ $ rawValue ] ; } | Returns an instance of Enumerable by raw value . |
234,435 | private static function initializeEnum ( $ enumClass ) { self :: $ isInInitializationState = true ; try { $ classReflection = new ReflectionClass ( $ enumClass ) ; if ( ! $ classReflection -> isFinal ( ) ) { throw new LogicException ( sprintf ( 'Enumerable class must be final, but "%s" is not final.' , $ enumClass ) ) ... | Initializes values of enumerable class . |
234,436 | private static function isServiceMethod ( ReflectionMethod $ method ) { return ! $ method -> isPublic ( ) || in_array ( $ method -> getShortName ( ) , self :: getServiceMethods ( ) ) ; } | Checks that given method is for the internal use . |
234,437 | protected function BeforeDelete ( ) { foreach ( self :: $ deleteHooks as $ hook ) { $ hook -> BeforeDelete ( $ this -> item ) ; } $ logger = new Logger ( BackendModule :: Guard ( ) -> GetUser ( ) ) ; $ logger -> ReportPageAction ( $ this -> item , Action :: Delete ( ) ) ; $ file = Path :: Combine ( PHINE_PATH , 'Public... | Remove htaccess page commands before page is deleted |
234,438 | private function sanitize ( $ value , $ sanitizers ) { if ( is_string ( $ sanitizers ) === true ) return call_user_func ( $ sanitizers , $ value ) ; if ( is_array ( $ sanitizers ) === true ) { $ valueFiltered = $ value ; if ( count ( $ sanitizers ) === 2 && is_callable ( $ sanitizers ) === true ) return call_user_func ... | Sanitizes a value with the given functions and callbacks |
234,439 | public function parse ( $ marcspec ) { if ( ! preg_match_all ( '/' . $ this -> MARCSPEC . '/' , $ marcspec , $ this -> parsed , PREG_SET_ORDER ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: FS . InvalidMARCspecException :: MISSINGFIELD , $ marcspec ) ; } $ this -> parsed = array_filter ( $ this ... | parses MARCspec . |
234,440 | public function parseSubfields ( $ subfieldspec ) { if ( ! preg_match_all ( '/' . $ this -> SUBFIELD . '/' , $ subfieldspec , $ _subfieldMatches , PREG_SET_ORDER ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: SF . InvalidMARCspecException :: SFCHAR , $ subfieldspec ) ; } array_walk ( $ _subfield... | Matches subfieldspecs . |
234,441 | public function subfieldToArray ( $ subfieldspec ) { if ( ! $ _sf = $ this -> parseSubfields ( $ subfieldspec ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: SF . InvalidMARCspecException :: UNKNOWN , $ subfieldspec ) ; } if ( 1 < count ( $ _sf ) ) { throw new InvalidMARCspecException ( InvalidMA... | calls parseSubfields but makes sure only one subfield is present . |
234,442 | private function matchSubSpecs ( $ subSpecs ) { $ _subSpecs = [ ] ; if ( ! preg_match_all ( '/' . $ this -> SUBSPEC . '/U' , $ subSpecs , $ _subSpecMatches , PREG_SET_ORDER ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: SS . InvalidMARCspecException :: UNKNOWN , $ subSpecs ) ; } foreach ( $ _sub... | parses subspecs into an array . |
234,443 | private function matchSubTerms ( $ subSpec ) { if ( preg_match ( '/(?<![\\\\\$])[\{\}]/' , $ subSpec , $ _error , PREG_OFFSET_CAPTURE ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: SS . InvalidMARCspecException :: ESCAPE , $ subSpec ) ; } if ( preg_match_all ( '/' . $ this -> SUBTERMS . '/' , $ ... | Parses a single SubSpec into sunTerms . |
234,444 | public function getBalance ( $ user_id , $ type = - 1 ) { $ url = $ this -> authenticationService -> getServerEndPoint ( ) . Endpoints :: VERSION . Endpoints :: BASE_WALLET . Endpoints :: WALLET_CREDITS_BALANCE ; $ url = sprintf ( $ url , $ user_id , $ type ) ; $ result = $ this -> authenticationService -> getTransport... | Get the wallet balance of a user |
234,445 | public function getTransactionDetail ( $ transaction_id ) { $ url = $ this -> authenticationService -> getServerEndPoint ( ) . Endpoints :: VERSION . Endpoints :: BASE_WALLET . Endpoints :: WALLET_TRANSACTION ; $ url = sprintf ( $ url , $ transaction_id ) ; $ result = $ this -> authenticationService -> getTransport ( )... | Get details about a particular transaction |
234,446 | public function getTransactionDetailsForUser ( $ user_id , $ count = 10 , $ paginated_url = null , $ page = 1 ) { if ( $ paginated_url ) { $ url = $ paginated_url ; } else { $ url = $ this -> authenticationService -> getServerEndPoint ( ) . Endpoints :: VERSION . Endpoints :: BASE_WALLET . Endpoints :: WALLET_TRANSACTI... | Get all transactions for a particular user |
234,447 | public function addBalance ( $ user_id , $ value_to_add , $ transaction_type = WalletTransactionTypes :: TRANSACTIONAL , $ expires_in_days = 0 , $ transaction_id = null , $ meta_data = null , $ tag = null , $ frozen = false ) { $ url = $ this -> authenticationService -> getServerEndPoint ( ) . Endpoints :: VERSION . En... | Add balance to a particular user s wallet |
234,448 | public function make ( ) { $ authority = $ this -> host ; $ fragment = $ this -> fragment ; $ query = $ this -> query ; if ( $ this -> host !== '' && $ this -> user !== null ) { $ user = $ this -> user ; if ( $ this -> pass ) { $ user = $ this -> user . ':' . $ this -> pass ; } $ authority = $ user . '@' . $ authority ... | Creates the URI instance . |
234,449 | public function user ( $ user , $ pass = null ) { if ( $ pass ) { $ this -> pass = $ pass ; } $ this -> user = $ user ; return $ this ; } | Sets the user component . |
234,450 | public function getTerms ( $ vocabulary_id ) { if ( ! $ data = Cache :: get ( $ this -> getTaxonomyCacheKey ( ) ) ) { $ data = $ this -> cacheTermsForContent ( ) ; } if ( ! is_numeric ( $ vocabulary_id ) ) { $ vocabulary_id = T :: vocabulary ( $ vocabulary_id ) ; } $ results = new Collection ( ) ; if ( array_key_exists... | Get the terms from a content |
234,451 | public function addTerm ( $ term_id ) { TermContainer :: findOrFail ( $ term_id ) ; if ( $ this -> getTaxonomyQuery ( ) -> where ( 'term_id' , $ term_id ) -> count ( ) ) { return ; } $ this -> taxonomies ( ) -> attach ( $ term_id ) ; Cache :: forget ( $ this -> getTaxonomyCacheKey ( ) ) ; } | Link a term to this content |
234,452 | public function removeTerms ( $ vocabulary_id = null ) { if ( $ vocabulary_id === null ) { return $ this -> getTaxonomyQuery ( ) -> delete ( ) ; } if ( ! is_numeric ( $ vocabulary_id ) ) { $ vocabulary_id = T :: vocabulary ( $ vocabulary_id ) ; } return $ this -> getTaxonomyQuery ( ) -> whereIn ( 'term_id' , function (... | Removes terms specified by a vocabulary or all |
234,453 | private function getTaxonomyQuery ( ) { $ t = $ this -> taxonomies ( ) ; return $ t -> newPivotStatement ( ) -> where ( $ t -> getForeignKey ( ) , $ this -> getKey ( ) ) -> where ( $ t -> getMorphType ( ) , $ t -> getMorphClass ( ) ) ; } | Get a new plain query builder for the pivot table . |
234,454 | public function commit ( ) { return setcookie ( $ this -> name , $ this -> value , $ this -> expires , $ this -> path , $ this -> domain , $ this -> secure , $ this -> httpOnly ) ; } | Send the cookie |
234,455 | public function addListener ( $ listener , $ event , $ prior = null ) { if ( ! is_callable ( $ event ) ) { return false ; } if ( ! array_key_exists ( $ listener , $ this -> listeners ) ) { $ this -> listeners [ $ listener ] = [ ] ; } if ( ! $ prior ) { $ this -> listeners [ $ listener ] [ ] = $ event ; } else { array_s... | Add listener on event |
234,456 | public function signal ( $ listener , array $ params = [ ] ) { $ result = null ; if ( array_key_exists ( $ listener , $ this -> listeners ) && 0 !== count ( $ this -> listeners [ $ listener ] ) ) { foreach ( $ this -> listeners [ $ listener ] as $ listen ) { $ result = call_user_func ( $ listen , $ params ) ; if ( $ re... | Send signal to run event |
234,457 | public function isValidResponse ( $ username , $ hash , $ challenge ) { if ( self :: NTLM_BLOB_HEADER != substr ( $ this -> clientBlob , 0 , 8 ) ) { return false ; } if ( ! SecurityUtil :: timingSafeEquals ( $ username , $ this -> username ) ) { return false ; } if ( ! SecurityUtil :: timingSafeEquals ( $ this -> provi... | Needs the MD4 hash of the UTF - 16LE encoded password of the user in hex - or binary format . |
234,458 | public function light ( ) { $ forms = safe_column ( 'name' , 'txp_form' , '1 = 1' ) ; $ beacon = new Rah_Beacon_Handler ( ) ; foreach ( $ forms as $ name ) { if ( ! preg_match ( '/^[a-z][a-z0-9_]*$/' , $ name ) ) { trace_add ( '[rah_beacon: ' . $ name . ' skipped]' ) ; continue ; } Txp :: get ( 'Textpattern_Tag_Registr... | Registers forms as tags . |
234,459 | public function atts ( $ atts ) { global $ variable ; foreach ( lAtts ( $ atts , $ variable , false ) as $ name => $ value ) { $ variable [ $ name ] = $ value ; } } | A tag for assigning attribute defaults for tags . |
234,460 | private function loadConfigPackages ( ) { $ config = Container :: getInstance ( ) -> get ( 'config' ) ; $ list = $ config -> get ( 'global.package' ) ; if ( empty ( $ list ) || ! is_array ( $ list ) ) { return ; } foreach ( $ list as $ name => $ data ) { if ( ! isset ( $ data [ 'config' ] ) ) { continue ; } $ config ->... | Load configs from packages . |
234,461 | private function _merge_values ( $ data , $ values , $ columns ) { foreach ( $ values as $ key => $ value ) { if ( ! is_numeric ( $ key ) && $ key != '[]' ) { if ( isset ( $ columns [ $ key ] ) ) { $ type = strtolower ( $ columns [ $ key ] ) ; if ( $ value === null ) { $ type = 'null' ; } switch ( $ type ) { case 'int'... | Attach Value to row data . |
234,462 | private function _define_column_types ( \ PDOStatement $ result ) { $ columns = array ( ) ; $ intTypes = array ( 'int' , 'integer' , 'long' , 'tiny' , 'smallint' , 'int4' ) ; try { for ( $ i = 0 ; $ i < $ result -> columnCount ( ) ; ++ $ i ) { $ meta = $ result -> getColumnMeta ( $ i ) ; if ( $ meta && $ meta [ 'name' ... | Define columns from result . |
234,463 | public function addThreshold ( $ threshold , $ driver ) { if ( ! is_int ( $ threshold ) || $ threshold <= 0 ) { throw new InvalidArgumentException ( "The threshold '{$threshold}' is invalid. The threshold must be an integer and greater than '0'." ) ; } $ this -> sortThresholds [ $ threshold ] = $ driver ; } | Adds a new sorting algorithm with the specified threshold |
234,464 | public function determineDriver ( $ collectionCount ) { $ determinedDriver = 'native' ; ksort ( $ this -> sortThresholds , SORT_NUMERIC ) ; foreach ( $ this -> sortThresholds as $ threshold => $ driver ) { if ( $ collectionCount <= $ threshold ) { $ determinedDriver = $ driver ; break ; } } return $ determinedDriver ; ... | Determines the driver to use based on a collection s size |
234,465 | protected function getSessionObject ( $ access_token = NULL ) { $ session = NULL ; if ( ! empty ( $ access_token ) && isset ( $ access_token [ 'access_token' ] ) ) { $ session [ 'access_token' ] = $ access_token [ 'access_token' ] ; $ session [ 'base_domain' ] = $ this -> getVariable ( 'base_domain' , self :: DEFAULT_B... | Try to get session object from custom method . |
234,466 | protected function makeOAuth2Request ( $ path , $ method = 'GET' , $ params = array ( ) ) { if ( ( ! isset ( $ params [ 'access_token' ] ) || empty ( $ params [ 'access_token' ] ) ) && $ oauth_token = $ this -> getAccessToken ( ) ) { $ params [ 'access_token' ] = $ oauth_token ; } return $ this -> makeRequest ( $ path ... | Make an OAuth2 . 0 Request . |
234,467 | public function all ( $ scopes = [ ] ) { return $ this -> _get ( 'servers/' . $ this -> server_id . '/software/' . $ this -> software_id . '/exploits' , null , $ scopes ) ; } | Gets a list of all exploits of this particular software |
234,468 | protected function tableExists ( $ tableName ) { if ( isset ( $ this -> nonExistingTables [ $ tableName ] ) ) return false ; if ( isset ( $ this -> existingTables [ $ tableName ] ) ) return true ; $ exists = $ this -> schemaManager -> tablesExist ( array ( $ tableName ) ) ; if ( ! $ exists ) { $ this -> nonExistingTabl... | Checks if the given table exists |
234,469 | protected function validateMappings ( $ mappings , $ allowAssociations ) { $ type = null ; foreach ( $ mappings as $ mapping ) { switch ( $ mapping -> type ) { case Type :: TIMESTAMP : $ thisType = Type :: DATE ; break ; case Type :: FLOAT : $ thisType = Type :: INT ; break ; default : if ( ! $ mapping -> isAssociation... | Validate that the provided mappings use compatible serialization strategies . |
234,470 | public function checkTableExist ( $ table , $ con = NULL ) { $ connection = $ this -> checkConnection ( $ con ) ; $ query = $ connection -> query ( "SELECT 1 FROM {$table} LIMIT 1" ) ; if ( $ query !== false ) { return true ; } } | checkTableExist Check if table already in the database |
234,471 | protected static function checkTableName ( $ tableName , $ con = NULL ) { $ connection = self :: checkConnection ( $ con ) ; $ query = $ connection -> query ( "SELECT 1 FROM {$tableName} LIMIT 1" ) ; if ( $ query !== false ) { return $ tableName ; } throw new TableDoesNotExistException ( ) ; } | checkTableName Return the table name |
234,472 | protected static function checkColumn ( $ tableName , $ columnName , $ con = NULL ) { $ connection = self :: checkConnection ( $ con ) ; $ result = $ connection -> prepare ( "SELECT {$columnName} FROM {$tableName}" ) ; $ result -> execute ( ) ; if ( ! $ result -> columnCount ( ) ) { throw new ColumnNotExistExeption ( )... | checkColumn Check if column exist in table |
234,473 | protected static function buildColumn ( $ data ) { $ counter = 0 ; $ insertQuery = "" ; $ arraySize = count ( $ data ) ; foreach ( $ data as $ key => $ value ) { $ counter ++ ; $ insertQuery .= self :: sanitize ( $ key ) ; if ( $ arraySize > $ counter ) $ insertQuery .= ", " ; } return $ insertQuery ; } | buildColumn Build the column name |
234,474 | protected static function buildClause ( $ tableName , $ data ) { $ counter = 0 ; $ updateQuery = "" ; $ arraySize = count ( $ data ) ; foreach ( $ data as $ key => $ value ) { $ counter ++ ; $ columnName = self :: checkColumn ( $ tableName , self :: sanitize ( $ key ) ) ; $ updateQuery .= $ columnName . " = '" . self :... | buildClause Build the clause value |
234,475 | protected function fields ( ) { if ( isset ( $ this -> fillables ) ) { $ this -> output = ( sizeof ( $ this -> fillables ) > 0 ) ? implode ( $ this -> fillables , ',' ) : '*' ; } else { $ this -> output = '*' ; } return $ this -> output ; } | Get the fields to be fillables defined in the model |
234,476 | public function addModule ( Module $ module ) { if ( $ this -> db !== $ module -> getDB ( ) ) throw new MigrationException ( "The DB instances should be the same" ) ; $ name = self :: normalizeModule ( $ module -> getModule ( ) ) ; $ this -> modules [ $ name ] = $ module ; return $ this ; } | Register a module that has already been instantiated |
234,477 | public function addMigration ( string $ module , string $ path ) { $ module = self :: normalizeModule ( $ module ) ; if ( isset ( $ this -> modules [ $ module ] ) ) throw new MigrationException ( "Duplicate module: " . $ module ) ; $ instance = new Module ( $ module , $ path , $ this -> db ) ; $ this -> modules [ $ mod... | Add a new migration using a module name and a path |
234,478 | public function getDeploymentRevision ( ) { if ( $ this -> version === false ) { $ version = $ this -> cache -> get ( 'DeploymentRevision' ) ; if ( $ version === false ) { $ version = $ this -> versionDao -> getSystemVersion ( ) ; if ( $ version === false ) $ version = $ this -> incrementDeploymentRevision ( 'Initial s... | Returns the current system version |
234,479 | public function incrementDeploymentRevision ( $ details = null ) { if ( ! $ this -> incrementedOnce ) { $ backtrace = null ; $ version = $ this -> versionDao -> insertSystemVersion ( $ details , $ backtrace ) ; $ this -> Events -> trigger ( 'SystemVersion.increment' , $ version ) ; $ this -> version = $ version ; $ thi... | Increases the current SystemVersion by one |
234,480 | private function build ( $ pString ) { for ( $ i = 0 ; $ i < strlen ( $ pString ) ; $ i ++ ) { $ this -> addChar ( $ pString [ $ i ] ) ; } } | Builds the suffix tree off the given string |
234,481 | private function addSuffixLink ( $ pNode ) { if ( $ this -> needSuffixLink > 0 ) { $ this -> nodes [ $ this -> needSuffixLink ] -> link = $ pNode ; } $ this -> needSuffixLink = $ pNode ; } | Adds the given node as target of the current suffix link |
234,482 | private function newNode ( $ pStart , $ pEnd ) { $ this -> nodes [ ++ $ this -> currentNode ] = new Node ( $ pStart , $ pEnd , $ this -> currentNode ) ; return $ this -> currentNode ; } | Creates as new node with given start and end indexes . Increases the current node by one . |
234,483 | private function addChar ( $ pChar ) { $ this -> text [ ++ $ this -> position ] = $ pChar ; $ this -> needSuffixLink = - 1 ; $ this -> remainder ++ ; while ( $ this -> remainder > 0 ) { if ( $ this -> activeLength === 0 ) { $ this -> activeEdge = $ this -> position ; } if ( ! array_key_exists ( $ this -> getActiveEdge ... | Adds a single character to the suffix tree . Updates edges as well as nodes |
234,484 | public function getAllSurpriseValues ( ) { $ allSurprises = array ( ) ; foreach ( $ this -> nodes as $ node ) { if ( $ node -> start != - 1 && $ node -> end != - 1 ) { $ allSurprises [ ] = $ node -> surpriseValue ; } } return $ allSurprises ; } | Returns an array containing the surprise values of each node of this tree . |
234,485 | private function findSurpriseValue ( Node $ pNode , $ pSubstring ) { $ length = $ pNode -> end - $ pNode -> start ; $ text = implode ( '' , $ this -> text ) ; if ( ( $ pNode -> start != - 1 && $ pNode -> end != - 1 ) ) { if ( substr ( $ text , $ pNode -> start , $ length ) === $ pSubstring ) { return $ pNode -> surpris... | Tries to find the surprise value of the given substring in the given node . If not successfull for the given string and a child node starts with the first letter of the given string it will try its corresponding child . Used in a recursive manner with given node representing the root node at the begin |
234,486 | public function hasSubstring ( $ pSubstring ) { if ( strlen ( $ pSubstring ) < 1 ) { return - 1 ; } return $ this -> findSubstring ( $ this -> nodes [ $ this -> root ] , $ pSubstring ) ; } | Scan tree for occurences of the given substring . |
234,487 | public function setSSLKey ( $ certificateFile , $ password = null ) { if ( $ password ) { $ this -> options [ GuzzleRequestOptions :: SSL_KEY ] = [ $ certificateFile , $ password ] ; } else { $ this -> options [ GuzzleRequestOptions :: SSL_KEY ] = $ certificateFile ; } } | Specify the path to a file containing a private SSL key in PEM format . |
234,488 | public function setCertificate ( $ certificateFile , $ password = null ) { if ( $ password ) { $ this -> options [ GuzzleRequestOptions :: CERT ] = [ $ certificateFile , $ password ] ; } else { $ this -> options [ GuzzleRequestOptions :: CERT ] = $ certificateFile ; } } | Set to a string to specify the path to a file containing a PEM formatted client side certificate |
234,489 | public function addHeader ( $ key , $ value ) { $ this -> options [ GuzzleRequestOptions :: HEADERS ] [ $ key ] = $ value ; return $ this ; } | Headers to add to the request . |
234,490 | public function addQuery ( $ param , $ value ) { if ( ! isset ( $ this -> options [ GuzzleRequestOptions :: QUERY ] ) ) { $ this -> options [ GuzzleRequestOptions :: QUERY ] = [ ] ; } if ( ! is_array ( $ this -> options [ GuzzleRequestOptions :: QUERY ] ) ) { throw new \ LogicException ( 'The query has been set as stri... | Add Query string parameter |
234,491 | public function setAuth ( $ username , $ password , $ type = 'basic' ) { $ this -> options [ GuzzleRequestOptions :: AUTH ] = [ $ username , $ password , $ type ] ; return $ this ; } | Specifies HTTP authorization parameters to use with the request |
234,492 | public function get ( $ option ) { return ( isset ( $ this -> options [ $ option ] ) ? $ this -> options [ $ option ] : null ) ; } | Get a option value |
234,493 | public function dump ( ) { $ dump = [ ] ; if ( $ this -> hasParameters ( ) ) { foreach ( $ this -> parameters as $ parameter ) { $ dump [ $ parameter -> getName ( ) ] = $ parameter -> dump ( ) ; } } return $ dump ; } | Dump parameters . |
234,494 | private function ClassFile ( ) { if ( ! $ this -> classFile ) { $ class = new \ ReflectionClass ( $ this ) ; $ this -> classFile = $ class -> getFileName ( ) ; } return $ this -> classFile ; } | The class definition file |
234,495 | function Render ( ) { $ templateDir = Path :: Combine ( __DIR__ , 'Templates' ) ; $ templateFile = Path :: AddExtension ( Path :: Filename ( $ this -> ClassFile ( ) ) , 'phtml' , true ) ; ob_start ( ) ; require Path :: Combine ( $ templateDir , $ templateFile ) ; return ob_get_clean ( ) ; } | Renders and returns the html output |
234,496 | function Value ( $ field , $ trim = true ) { $ result = Request :: IsPost ( ) ? Request :: PostData ( $ field ) : $ this -> DefaultValue ( $ field ) ; if ( $ trim ) { return trim ( $ result ) ; } return $ result ; } | Gets the value of a field |
234,497 | function GotoNext ( ) { $ next = Page :: NextStep ( $ this -> Step ( ) ) ; Response :: Redirect ( Path :: AddExtension ( $ next , 'php' ) ) ; } | Redirects to the next step |
234,498 | protected function generateDeleteView ( $ dir ) { $ this -> renderFile ( 'crud/views/delete.html.twig.twig' , $ dir . '/delete.html.twig' , [ 'route_prefix' => $ this -> routePrefix , 'route_name_prefix' => $ this -> routeNamePrefix , 'entity' => $ this -> entity , 'bundle' => $ this -> bundle -> getName ( ) , 'actions... | Generates the delete . html . twig template in the final bundle . |
234,499 | public function get ( $ modelName , $ directory = null ) { if ( empty ( $ modelName ) ) { throw new ModelException ( "Could not load model. No name provided" , 1 ) ; } $ directories = ( is_null ( $ directory ) ? $ this -> modelPaths : array ( $ directory ) ) ; $ event = Events :: fireEvent ( 'modelLoadEvent' , $ modelN... | Get a model . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.