idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
6,500 | public function getRows ( $ query ) { try { $ stmt = $ this -> db -> query ( $ query ) ; return $ stmt -> fetchAll ( PDO :: FETCH_ASSOC ) ; } catch ( Exception $ e ) { return [ ] ; } } | Get rows of data by query |
6,501 | protected function prepareRepository ( ) { $ config = $ this -> container [ 'config' ] ; $ this -> builder -> clean ( $ config [ 'build.directory' ] ) ; $ workingCopy = $ this -> git -> workingCopy ( $ config [ 'build.directory' ] ) ; $ this -> doGitInit ( $ workingCopy , $ config [ 'deploy.git.url' ] , $ config [ 'dep... | Prepare the build directory as a git repository . |
6,502 | protected function doGitInit ( GitWorkingCopy $ workingCopy , $ url , $ branch ) { $ workingCopy -> init ( ) ; $ workingCopy -> remote ( 'add' , 'origin' , $ url ) ; try { $ this -> output -> writeln ( "Attempting to fetch <path>origin/{$branch}</path>" , OutputInterface :: VERBOSITY_VERBOSE ) ; $ workingCopy -> fetch ... | Set up the git repository for our build . |
6,503 | protected function rebuild ( ) { $ command = $ this -> getApplication ( ) -> find ( 'build' ) ; $ input = new ArrayInput ( [ '--no-clean' => true , ] ) ; return $ command -> run ( $ input , $ this -> output ) === 0 ; } | Delegate to the build command to rebuild the site . |
6,504 | protected function deployWithGit ( GitWorkingCopy $ workingCopy ) { if ( ! $ workingCopy -> hasChanges ( ) ) { return $ this -> output -> writeln ( '<comment>No changes to deploy!</comment>' ) ; } $ this -> output -> writeln ( '<info>Ready to deploy changes:</info>' ) ; $ this -> output -> write ( $ workingCopy -> getS... | Deploy the current contents of our working copy . |
6,505 | protected function askForChangesConfirmation ( GitWorkingCopy $ workingCopy ) { $ deployTo = "{$this->container['config']['deploy.git.url']}#{$this->container['config']['deploy.git.branch']}" ; $ confirm = new ConfirmationQuestion ( "<comment>Commit all and push to <path>{$deployTo}</path>?</comment> [Yn] " ) ; return ... | Ask user to confirm changes listed by git status . |
6,506 | private function hasSession ( ) { if ( DI :: getDefault ( ) -> has ( 'session' ) === true ) { $ this -> session = DI :: getDefault ( ) -> getSession ( ) ; if ( $ this -> session -> getId ( ) === '' ) { $ this -> session -> start ( ) ; } return true ; } return false ; } | Check if \ Phalcon \ Di has session service |
6,507 | public function render ( array $ params = [ ] ) { return trim ( String :: insert ( $ this -> getStatement ( ) , $ params + $ this -> getParams ( ) , [ 'escape' => false ] ) ) . ';' ; } | Render the statement by injecting custom parameters . Merge with the default parameters to fill in any missing keys . |
6,508 | private function setFallbackValues ( ) { $ hash = md5 ( null ) ; $ this -> currentPage [ $ hash ] = 0 ; $ this -> itemsPerPage [ $ hash ] = 10 ; $ this -> maxPagerItems [ $ hash ] = 3 ; $ this -> totalItems [ $ hash ] = 0 ; } | Sets default values |
6,509 | public function getTotalItems ( $ id = null ) { $ hash = md5 ( $ id ) ; return isset ( $ this -> totalItems [ $ hash ] ) ? $ this -> totalItems [ $ hash ] : 0 ; } | Get the total items in the non - paginated version of the query |
6,510 | public function getLastPage ( $ id = null ) { $ totalItems = ( $ this -> getTotalItems ( $ id ) > 0 ) ? $ this -> getTotalItems ( $ id ) : 1 ; return ( int ) ceil ( $ totalItems / $ this -> getItemsPerPage ( $ id ) ) ; } | Gets the last page number |
6,511 | public static function default_data_provider ( ) { return array ( 'last_active' => time ( ) , 'current_lang' => \ CCLang :: current ( ) , 'client_agent' => \ CCServer :: client ( 'agent' ) , 'client_ip' => \ CCServer :: client ( 'ip' ) , 'client_port' => \ CCServer :: client ( 'port' ) , 'client_lang' => \ CCServer :: ... | Some default values for our session |
6,512 | public function valid_fingerprint ( $ fingerprint = null ) { if ( is_null ( $ fingerprint ) ) { $ fingerprint = \ CCIn :: get ( \ ClanCats :: $ config -> get ( 'session.default_fingerprint_parameter' ) , false ) ; } return $ this -> fingerprint === $ fingerprint ; } | Does the current session fingerprint match a parameter |
6,513 | public function once ( $ key , $ default = null ) { $ value = \ CCArr :: get ( $ key , $ this -> _data , $ default ) ; \ CCArr :: delete ( $ key , $ this -> _data ) ; return $ value ; } | Get a value from data and remove it afterwards |
6,514 | public function read ( ) { if ( $ this -> id ) { if ( ! $ this -> _data = $ this -> _driver -> read ( $ this -> id ) ) { $ this -> regenerate ( ) ; $ this -> _data = array ( ) ; } if ( ! is_array ( $ this -> _data ) ) { $ this -> _data = array ( ) ; } $ this -> _data = array_merge ( $ this -> _data , $ this -> default_... | Read data from the session driver . This overwrite s any changes made on runtime . |
6,515 | public function write ( ) { $ this -> _driver -> write ( $ this -> id , $ this -> _data ) ; \ CCCookie :: set ( $ this -> cookie_name ( ) , $ this -> id , \ CCArr :: get ( 'lifetime' , $ this -> _config , \ CCDate :: minutes ( 5 ) ) ) ; } | Write the session to the driver |
6,516 | public function regenerate ( ) { do { $ id = \ CCStr :: random ( 32 ) ; } while ( $ this -> _driver -> has ( $ id ) ) ; $ this -> fingerprint = sha1 ( $ id ) ; return $ this -> id = $ id ; } | Generate a new session id and checks the dirver for dublicates . |
6,517 | public function gc ( ) { $ lifetime = \ CCArr :: get ( 'lifetime' , $ this -> _config , \ CCDate :: minutes ( 5 ) ) ; if ( $ lifetime < ( $ min_lifetime = \ CCArr :: get ( 'min_lifetime' , $ this -> _config , \ CCDate :: minutes ( 5 ) ) ) ) { $ lifetime = $ min_lifetime ; } $ this -> _driver -> gc ( $ lifetime ) ; } | Garbage collection delete all outdated sessions |
6,518 | public function generate ( ) { $ this -> printMessage ( '' ) ; $ this -> printMessage ( 'Creating Collection config' ) ; Files :: saveCollectionConfig ( ( new ConfigGenerator ( $ this -> config ) ) -> create ( ) ) ; $ this -> printMessage ( 'Creating Models, Controllers, Requests, Responses, and Exceptions' ) ; foreach... | Generate the SDK |
6,519 | public function create ( TicketObject $ ticket ) { $ response = $ this -> client -> post ( 'tickets' , array ( 'ticket' => $ ticket ) ) ; return new TicketObject ( $ response ) ; } | Creates a ticket |
6,520 | public function update ( TicketObject $ ticket ) { return new TicketObject ( $ this -> client -> post ( 'tickets/' . $ ticket -> guid , array ( "ticket" => $ ticket ) ) ) ; } | Updates the ticket |
6,521 | public function check ( $ eventId , $ barcode , $ terminalId = null , Location $ location = null ) { return new TicketCheckIn ( $ this -> client -> post ( 'check' , [ 'event' => $ eventId , 'barcode' => $ barcode , 'terminalId' => $ terminalId , 'location' => $ location ] ) ) ; } | Check a ticket barcode for an event . |
6,522 | public function localPathAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ form = $ this -> createForm ( new ChoiceLocalPath ( ) , [ 'path' => $ request -> get ( 'path' ) ? : '' ] ) ; return $ this... | Form field local path . |
6,523 | public function localPathFoldersAction ( Request $ request ) { $ form = $ this -> createForm ( new ChoiceLocalPath ( ) ) ; $ form -> handleRequest ( $ request ) ; $ path = $ form -> get ( 'path' ) -> getData ( ) ? : Filesystem :: getUserHomeDir ( ) ; if ( ( $ root = $ request -> get ( 'root' ) ) && strpos ( $ path , $ ... | Return list folders for path . |
6,524 | public function imageAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } return $ this -> render ( 'AnimeDbAppBundle:Form:image.html.twig' , [ 'form' => $ this -> createForm ( new UploadImage ( ) ) -> ... | Form field image . |
6,525 | public static function parse ( $ lang ) { $ conf = ClanCats :: $ config -> language ; if ( isset ( $ lang ) && strlen ( $ lang ) > 1 ) { $ lang = explode ( ',' , strtolower ( $ lang ) ) ; $ lang = explode ( '-' , $ lang [ 0 ] ) ; if ( ! isset ( $ lang [ 1 ] ) ) { $ lang [ 1 ] = $ lang [ 0 ] ; } $ available = $ conf [ '... | Match an language code with the aviable languages |
6,526 | public static function load ( $ path , $ overwrite = false ) { if ( array_key_exists ( $ path , static :: $ data [ static :: $ current_language ] ) && $ overwrite === false ) { return ; } $ file_path = CCPath :: get ( $ path , CCDIR_LANGUAGE . static :: $ current_language . '/' , EXT ) ; if ( ! file_exists ( $ file_pat... | Load a language file into the appliaction |
6,527 | public static function line ( $ key , $ params = array ( ) ) { $ path = substr ( $ key , 0 , strpos ( $ key , '.' ) ) ; $ key = substr ( $ key , strpos ( $ key , '.' ) + 1 ) ; if ( isset ( static :: $ aliases [ $ path ] ) ) { return static :: line ( static :: $ aliases [ $ path ] . '.' . $ key , $ params ) ; } if ( ! i... | Recive a translated line |
6,528 | public function addCoverageValidatorPoolForCover ( $ coverToken ) { $ this -> addValidator ( new ValidatorClassNameMethodName ( $ coverToken ) ) ; $ this -> addValidator ( new ValidatorMethodName ( $ coverToken ) ) ; $ this -> addValidator ( new ValidatorClassName ( $ coverToken ) ) ; $ this -> addValidator ( new Valid... | init all available cover validator classes use incoming coverToken as parameter |
6,529 | public function analysePHPUnitFiles ( ) { $ testFiles = $ this -> scanFilesInPath ( $ this -> testSourcePath ) ; foreach ( $ testFiles as $ file ) { $ this -> analyseClassesInFile ( $ file ) ; } return $ this -> coverFishOutput -> writeResult ( $ this -> coverFishResult ) ; } | scan all unit - test files inside specific path |
6,530 | public function analyseCoverAnnotations ( $ phpDocBlock , CoverFishPHPUnitTest $ phpUnitTest ) { $ this -> validatorCollection -> clear ( ) ; $ phpUnitTest -> clearCoverMappings ( ) ; $ phpUnitTest -> clearCoverAnnotation ( ) ; foreach ( $ phpDocBlock [ 'covers' ] as $ cover ) { $ phpUnitTest -> addCoverAnnotation ( $ ... | scan all annotations inside one single unit test file |
6,531 | public function analyseClassesInFile ( $ file ) { $ ts = new PHP_Token_Stream ( $ file ) ; $ this -> phpUnitFile = new CoverFishPHPUnitFile ( ) ; foreach ( $ ts -> getClasses ( ) as $ className => $ classData ) { $ fqnClass = sprintf ( '%s\\%s' , $ this -> coverFishHelper -> getAttributeByKey ( 'namespace' , $ classDat... | scan all classes inside one defined unit test file |
6,532 | public function setKeyCode ( $ keyCode ) { $ this -> keyCode = ( int ) $ keyCode ; $ this -> keyName = null ; return $ this ; } | Set the key code |
6,533 | protected function getOnInitScriptText ( ) { $ scriptText = null ; if ( $ this -> control ) { $ controlId = Builder :: escapeText ( $ this -> control -> getId ( ) ) ; $ scriptText = "declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});" ; } else { $ scriptText = "declare ToggleInterfaceControl <=> Page.... | Get the on init script text |
6,534 | protected function getKeyPressScriptText ( ) { $ scriptText = null ; $ keyProperty = null ; $ keyValue = null ; if ( $ this -> keyName ) { $ keyProperty = "KeyName" ; $ keyValue = Builder :: getText ( $ this -> keyName ) ; } else if ( $ this -> keyCode ) { $ keyProperty = "KeyCode" ; $ keyValue = Builder :: getInteger ... | Get the key press script text |
6,535 | public static function clear ( $ event , $ what = null ) { if ( is_null ( $ what ) ) { unset ( static :: $ events [ $ event ] ) ; return ; } if ( array_key_exists ( $ what , static :: $ events [ $ event ] [ $ what ] ) ) { unset ( static :: $ events [ $ event ] [ $ what ] ) ; } } | clear an event |
6,536 | public static function ready ( $ event , $ params = array ( ) ) { $ responses = static :: fire ( $ event , $ params ) ; foreach ( static :: pack ( $ responses ) as $ response ) { if ( $ response !== true ) { return false ; } } return true ; } | also fires an event but returns a bool positiv only if all responses where positiv like all system ready YESS! |
6,537 | public static function fire ( $ event , $ params = array ( ) ) { if ( ! array_key_exists ( $ event , static :: $ events ) ) { return ; } $ event = static :: $ events [ $ event ] ; $ return = array ( ) ; if ( array_key_exists ( 'before' , $ event ) ) { $ return [ 'before' ] = static :: call ( $ event [ 'before' ] , $ pa... | fire an event |
6,538 | public static function pass ( $ event , $ param = null ) { if ( ! array_key_exists ( $ event , static :: $ events ) ) { return $ param ; } $ event = static :: $ events [ $ event ] ; if ( array_key_exists ( 'before' , $ event ) ) { $ param = static :: call ( $ event [ 'before' ] , $ param , true ) ; } if ( array_key_exi... | pass an var to an event the diffrence to fire is that the param gets modified by each event |
6,539 | protected static function call ( $ callbacks , $ params , $ pass = false ) { $ response = array ( ) ; if ( $ pass ) { $ response = $ params ; } foreach ( $ callbacks as $ callback ) { if ( $ pass ) { $ response = call_user_func_array ( $ callback , array ( $ response ) ) ; } else { $ response [ ] = call_user_func_array... | call an callback array |
6,540 | protected static function pack ( $ responses ) { return array_merge ( CCArr :: get ( 'before' , $ responses , array ( ) ) , CCArr :: get ( 'main' , $ responses , array ( ) ) , CCArr :: get ( 'after' , $ responses , array ( ) ) ) ; } | packs all responses into one array |
6,541 | public function preSave ( Event $ event , Query $ query , $ id , array & $ data ) { $ data [ $ this -> getConfig ( $ query -> getType ( ) === Query :: UPDATE ? 'updateField' : 'createField' ) ] = time ( ) ; return true ; } | Append the current timestamp to the data . |
6,542 | public function getSQLFilter ( $ radius , $ scale = 'km' ) { GeoFunctions :: $ Latitude = $ this -> name . 'Latitude' ; GeoFunctions :: $ Longditude = $ this -> name . 'Longditude' ; return GeoFunctions :: getSQLSquare ( $ this -> getLatitude ( ) , $ this -> getLongditude ( ) , $ radius , $ scale ) ; } | return a SQL Bounce for WHERE Clause |
6,543 | public function getDistanceFromLocation ( Location $ location , $ scale = 'km' ) { return GeoFunctions :: getDistance ( $ this -> getLatitude ( ) , $ this -> getLongditude ( ) , $ location -> getLatitude ( ) , $ location -> getLongditude ( ) , $ scale ) ; } | return the Distance to the given location |
6,544 | public static function is_callable ( $ key ) { if ( is_callable ( $ key ) ) { return true ; } if ( array_key_exists ( $ key , static :: $ _container ) ) { return true ; } return false ; } | Is this callable |
6,545 | public static function call ( ) { $ arguments = func_get_args ( ) ; $ key = array_shift ( $ arguments ) ; if ( is_string ( $ key ) && array_key_exists ( $ key , static :: $ _container ) && is_callable ( static :: $ _container [ $ key ] ) ) { return call_user_func_array ( static :: $ _container [ $ key ] , $ arguments )... | call a container |
6,546 | protected function buildGraph ( & $ graph , $ distanceComputeCallback , array $ objects ) { $ graph = new Helpers \ Graph ( ) ; while ( $ object = array_shift ( $ objects ) ) { $ graph -> addNode ( $ object , $ this -> computeDistances ( $ object , $ objects , $ distanceComputeCallback ) ) ; } } | Create a graph where each ready player is a node |
6,547 | private function computeDistances ( $ object , $ followers , $ distanceComputeCallback ) { $ distances = array ( ) ; foreach ( $ followers as $ follower ) { if ( $ follower == $ object ) continue ; $ distances [ $ follower -> id ] = call_user_func ( $ distanceComputeCallback , $ object -> data , $ follower -> data ) ; ... | Compute distance for a player with all his followers |
6,548 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ next ) : ResponseInterface { $ path = $ request -> getUri ( ) -> getPath ( ) ; if ( ! empty ( $ this -> basePath ) && 0 === strpos ( $ path , $ this -> basePath ) ) { $ cleanPath = substr ( $ path , strlen ( $ this -> basePath ) ) ; ... | strip away the basePath |
6,549 | public function setCache ( $ file ) { if ( ! empty ( $ file ) ) { $ this -> cache = new AccessTokenCache ( $ file ) ; $ this -> setAccessToken ( $ this -> cache -> get ( ) ) ; } } | sets the cache file when possible |
6,550 | public function send ( $ messageText , callable $ callable = null ) { $ message = new Message ( $ messageText ) ; $ response = $ this -> connection -> sendMessage ( $ message ) -> getBody ( ) ; if ( $ callable ) { $ response = call_user_func ( $ callable , $ response ) ; } return $ response ; } | Send text to the server . |
6,551 | public function send ( Request $ request , $ async = false ) : \ Psr \ Http \ Message \ StreamInterface { $ this -> currentUri = $ request -> fullUrl ( ) ; $ options = [ ] ; if ( $ request -> method ( ) === 'POST' || $ request -> method ( ) === 'PUT' ) { $ options [ 'json' ] = $ request -> request -> all ( ) ; } $ clie... | Send the given request through the application . This method allows you to fully customize the entire Request object . |
6,552 | public function delete ( $ key ) { try { $ this -> get ( $ key ) ; } catch ( KeyNotFoundException $ e ) { return false ; } unset ( $ this -> store [ $ key ] ) ; return true ; } | Removes a key . |
6,553 | public function setPassword ( $ p1 , $ p2 = null , $ login = false ) { $ this -> password = $ this -> integration -> setPassword ( $ p1 , $ p2 , $ login , $ this ) ; return $ this ; } | Set the password if the passwords match . |
6,554 | public static function checkDomain ( $ domain_name ) { if ( $ domain_name [ 0 ] == '.' ) $ domain_name = substr ( $ domain_name , 1 ) ; return ( preg_match ( "/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i" , $ domain_name ) && preg_match ( "/^.{1,253}$/" , $ domain_name ) && preg_match ( "/^[^\.]{1,63}(\.[^\.]{1... | Check if domain is valid |
6,555 | protected function buildStructuredHeaders ( ) : void { $ this -> structuredHeaders = array ( ) ; $ headers = $ this -> entry [ PoTokens :: TRANSLATED ] ; $ headers = ( $ headers === null ) ? array ( ) : $ headers ; $ full = implode ( '' , $ headers ) ; $ headers = explode ( "\n" , $ full ) ; $ pattern = '/([a-z0-9\-]+)... | Populate the internal structuredHeaders property with contents of this entry s msgstr value . |
6,556 | protected function storeStructuredHeader ( ) : bool { if ( is_null ( $ this -> structuredHeaders ) ) { return false ; } $ headers = array ( "" ) ; foreach ( $ this -> structuredHeaders as $ h ) { $ headers [ ] = $ h [ 'key' ] . ': ' . $ h [ 'value' ] . "\n" ; } $ this -> entry [ PoTokens :: TRANSLATED ] = $ headers ; r... | Rebuild the this entry s msgstr value using contents of the internal structuredHeaders property . |
6,557 | public function getHeader ( string $ key ) : ? string { $ this -> buildStructuredHeaders ( ) ; $ lkey = strtolower ( $ key ) ; $ header = null ; if ( isset ( $ this -> structuredHeaders [ $ lkey ] [ 'value' ] ) ) { $ header = $ this -> structuredHeaders [ $ lkey ] [ 'value' ] ; } return $ header ; } | Get a header value string by key |
6,558 | public function setHeader ( string $ key , string $ value ) : void { $ this -> buildStructuredHeaders ( ) ; $ lkey = strtolower ( $ key ) ; if ( isset ( $ this -> structuredHeaders [ $ lkey ] ) ) { $ this -> structuredHeaders [ $ lkey ] [ 'value' ] = $ value ; } else { $ newHeader = array ( 'key' => $ key , 'value' => ... | Set the value of a header string for a key . |
6,559 | public function setCreateDate ( ? int $ time = null ) : void { $ this -> setHeader ( 'POT-Creation-Date' , $ this -> formatTimestamp ( $ time ) ) ; } | Set the POT - Creation - Date header |
6,560 | public function setRevisionDate ( ? int $ time = null ) : void { $ this -> setHeader ( 'PO-Revision-Date' , $ this -> formatTimestamp ( $ time ) ) ; } | Set the PO - Revision - Date header |
6,561 | protected function formatTimestamp ( ? int $ time = null ) : string { if ( empty ( $ time ) ) { $ time = time ( ) ; } return gmdate ( 'Y-m-d H:iO' , $ time ) ; } | Format a timestamp following PO file conventions |
6,562 | public function buildDefaultHeader ( ) : void { $ this -> set ( PoTokens :: MESSAGE , "" ) ; $ this -> set ( PoTokens :: TRANSLATOR_COMMENTS , 'SOME DESCRIPTIVE TITLE' ) ; $ this -> add ( PoTokens :: TRANSLATOR_COMMENTS , 'Copyright (C) YEAR HOLDER' ) ; $ this -> add ( PoTokens :: TRANSLATOR_COMMENTS , 'LICENSE' ) ; $ ... | Create a default header entry |
6,563 | public static function callObjectMethod ( $ object , $ name , Array $ args = NULL ) { $ args = ( array ) $ args ; switch ( count ( $ args ) ) { case 0 : return $ object -> $ name ( ) ; case 1 : return $ object -> $ name ( $ args [ 0 ] ) ; case 2 : return $ object -> $ name ( $ args [ 0 ] , $ args [ 1 ] ) ; case 3 : ret... | Ruft eine Methode auf einem Objekt auf |
6,564 | public function confirmationValidate ( $ attribute ) { if ( ! $ this -> hasErrors ( ) ) { if ( $ this -> user !== null ) { $ confirmationRequired = Yii :: $ app -> settings -> get ( 'enableConfirmation' , 'user' ) && ! Yii :: $ app -> settings -> get ( 'enableUnconfirmedLogin' , 'user' ) ; if ( $ confirmationRequired &... | Validates the confirmation . This method serves as the inline validation for password . |
6,565 | public function setUserAction ( $ link , $ label = null ) { if ( $ label ) { $ this -> userAction = [ 'link' => $ link , 'label' => $ label , ] ; } else { $ this -> userAction = $ link ; } } | set a user facing link as continue action |
6,566 | public static function clean_paths ( $ string ) { $ string = str_replace ( ROOT_DIR , '' , $ string ) ; $ string = str_replace ( '.php' , '' , $ string ) ; return $ string ; } | cleans file paths from redundant information i . e . ROOT_DIR and . php is removed |
6,567 | protected function _compile_regex ( $ route ) { $ pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`' ; if ( preg_match_all ( $ pattern , $ route , $ matches , PREG_SET_ORDER ) ) { $ match_types = array ( 'i' => '[0-9]++' , 'a' => '[0-9A-Za-z]++' , 'h' => '[0-9A-Fa-f]++' , '*' => '.+?' , '' => '[^/]++' ) ; foreach... | Compiles the regex necessary to capture all match types within a route . |
6,568 | private function validate ( $ name ) { if ( ! is_string ( $ name ) ) { throw new InvalidNameException ( 'Migration name must be a string, got ' . gettype ( $ name ) ) ; } if ( strlen ( $ name ) === 0 ) { throw new InvalidNameException ( 'Migration name must not be empty' ) ; } $ validCharsRegex = '/^[' . self :: NAME_V... | Ensure the migration name is acceptable . |
6,569 | protected function setupContainer ( ) { $ container = Registry :: init ( ) ; $ container -> add ( 'app' , $ this ) ; $ container -> add ( 'registry' , $ container ) ; $ container -> add ( 'config' , function ( ) { return new Config ( $ this -> getConfigPath ( ) , 'prod' ) ; } ) ; $ this -> config = $ container -> make ... | Registers container and some classes |
6,570 | protected function configure ( ) { $ config = $ this -> config -> get ( 'app' ) ; $ this -> charset = $ config [ 'charset' ] ; mb_internal_encoding ( $ this -> charset ) ; date_default_timezone_set ( $ config [ 'timezone' ] ) ; } | Sets up basic application configurations |
6,571 | protected function registerServices ( ) { $ services = array_filter ( $ this -> config -> get ( 'app.services' ) , function ( $ service ) { return class_exists ( $ service ) ; } ) ; foreach ( $ services as $ service ) { $ obj = new $ service ( $ this -> container ) ; $ obj -> services ( ) ; $ this -> services [ ] = $ o... | Registers all defined services |
6,572 | public function get ( int $ entityId ) { $ response = $ this -> infakt -> get ( $ this -> getServiceName ( ) . '/' . $ entityId . '.json' ) ; if ( 2 != substr ( ( string ) $ response -> getStatusCode ( ) , 0 , 1 ) ) { return null ; } return $ this -> getMapper ( ) -> map ( \ GuzzleHttp \ json_decode ( $ response -> get... | Get entity by ID . |
6,573 | protected function getModelClass ( ) : string { $ class = substr ( get_class ( $ this ) , strrpos ( get_class ( $ this ) , '\\' ) + 1 ) ; $ class = substr ( $ class , 0 , strlen ( $ class ) - strlen ( 'Repository' ) ) ; return 'Infakt\\Model\\' . $ class ; } | Get fully - qualified class name of a model . |
6,574 | protected function getMapperClass ( ) : string { $ class = substr ( get_class ( $ this ) , strrpos ( get_class ( $ this ) , '\\' ) + 1 ) ; $ class = substr ( $ class , 0 , strlen ( $ class ) - strlen ( 'Repository' ) ) ; return 'Infakt\\Mapper\\' . $ class . 'Mapper' ; } | Get fully - qualified class name of a mapper . |
6,575 | public function withExistingProxy ( HlsProxy $ hlsProxy ) { if ( is_null ( $ this -> proxies ) ) { $ this -> proxies = [ ] ; } array_push ( $ this -> proxies , $ hlsProxy ) ; return $ this ; } | Fluent setter for the property proxies |
6,576 | public function toArray ( ) { return [ 'message' => $ this -> getMessageException ( ) , 'errors' => $ this -> getErrors ( ) , 'debugCode' => $ this -> getDebugCode ( ) , 'details' => $ this -> getDetails ( ) , 'routeBack' => redirect ( ) -> back ( ) -> getTargetUrl ( ) ] ; } | convierte el Objeto en un array |
6,577 | public function fetchToken ( Request $ request ) { foreach ( $ this -> config -> getOperators ( ) as $ name ) { $ operator = $ this -> getOperator ( $ name ) ; if ( $ operator -> hasToken ( $ request ) ) { return $ operator -> fetchToken ( $ request ) ; } } return null ; } | Fetch authorization token from request if any . |
6,578 | public function isMigrationApplied ( Name $ name ) { $ this -> ensureMigrationExists ( $ name ) ; $ collection = $ this -> getAppliedCollection ( ) ; $ criteria = [ 'className' => ( string ) $ name ] ; $ record = $ collection -> find ( $ criteria ) -> getSingleResult ( ) ; if ( $ record === null ) { return false ; } el... | Check if a migration has been applied . |
6,579 | public function migrate ( Name $ name , Direction $ direction , OutputInterface $ output ) { $ migration = $ this -> createMigrationInstance ( $ name , $ output ) ; $ output -> writeln ( '<info>Migrating ' . $ direction . '...</info> <comment>' . $ name . '</comment>' ) ; if ( $ direction -> isUp ( ) ) { $ migration ->... | Migrate up or down . |
6,580 | public function getAllMigrations ( ) { $ iterator = new \ DirectoryIterator ( $ this -> configuration -> getMigrationsDirectory ( ) ) ; $ migrations = [ ] ; foreach ( $ iterator as $ file ) { $ fileName = ( string ) $ file ; if ( $ fileName === '.' || $ fileName === '..' ) { continue ; } if ( ! is_dir ( $ file -> getPa... | Get a list of all migrations sorted alphabetically . |
6,581 | public function getMigrationsNotApplied ( ) { $ migrationsNotApplied = [ ] ; $ migrations = $ this -> getAllMigrations ( ) ; foreach ( $ migrations as $ migration ) { if ( ! $ migration -> isApplied ( ) ) { $ migrationsNotApplied [ ] = $ migration ; } } return $ migrationsNotApplied ; } | Return array with all migrations that were note applied . |
6,582 | private function setMigrationApplied ( Name $ name , $ isApplied ) { $ collection = $ this -> getAppliedCollection ( ) ; $ criteria = [ 'className' => ( string ) $ name ] ; $ newObj = [ '$set' => [ 'className' => ( string ) $ name , 'isApplied' => $ isApplied ] ] ; $ collection -> upsert ( $ criteria , $ newObj ) ; } | Update the database to record whether or not the migration has been applied . |
6,583 | public function getBroadcastFactory ( ) : ? Factory { if ( ! $ this -> hasBroadcastFactory ( ) ) { $ this -> setBroadcastFactory ( $ this -> getDefaultBroadcastFactory ( ) ) ; } return $ this -> broadcastFactory ; } | Get broadcast factory |
6,584 | public function setItem ( Control $ item ) { $ item -> checkId ( ) ; if ( $ item instanceof Scriptable ) { $ item -> setScriptEvents ( true ) ; } $ this -> item = $ item ; return $ this ; } | Set the Item Control |
6,585 | public function validateMapping ( CoverFishMapping $ coverMapping ) { $ coverFishResult = new CoverFishResult ( ) ; $ coverFishResult = $ this -> prepareCoverFishResult ( $ coverFishResult ) ; $ coverFishResult = $ this -> validateDefaultCoverClassMapping ( $ coverMapping , $ coverFishResult ) ; $ coverFishResult = $ t... | main validator mapping engine if any of our cover validator checks will fail return corresponding result immediately ... |
6,586 | final function createLabel ( $ message , $ login = null , $ countdown = null , $ isAnimated = false , $ hideOnF6 = true , $ showBackgroud = false ) { $ this -> removeLabel ( $ login ) ; $ ui = Windows \ Label :: Create ( $ login ) ; $ ui -> setPosition ( 0 , 40 ) ; $ ui -> setMessage ( $ message , $ countdown ) ; $ ui ... | Display a text message in the center of the player s screen If countdown is set the message will be refresh every second the end of the countdown |
6,587 | final function updateLobbyWindow ( $ serverName , $ playersCount , $ playingPlayersCount , $ averageTime ) { $ lobbyWindow = Windows \ LobbyWindow :: Create ( ) ; Windows \ LobbyWindow :: setServerName ( $ serverName ) ; Windows \ LobbyWindow :: setAverageWaitingTime ( $ averageTime == - 1 ? - 1 : ceil ( $ averageTime ... | Display the lobby Window on the right of the screen |
6,588 | final function removePlayerFromPlayerList ( $ login ) { Windows \ PlayerList :: Erase ( $ login ) ; $ playerLists = Windows \ PlayerList :: GetAll ( ) ; foreach ( $ playerLists as $ playerList ) { $ playerList -> removePlayer ( $ login ) ; } Windows \ PlayerList :: RedrawAll ( ) ; } | Remove a player from the playerlist and destroy his list |
6,589 | public final function transactionCommit ( ) { if ( 1 == $ this -> intTransactionDepth ) { $ this -> executeTransactionCommit ( ) ; } if ( $ this -> intTransactionDepth <= 0 ) { throw new Caller ( "The transaction commit call is called before the transaction begin was called." ) ; } $ this -> intTransactionDepth -- ; } | This function commits the database transaction . |
6,590 | public function escapeIdentifiers ( $ mixIdentifiers ) { if ( is_array ( $ mixIdentifiers ) ) { return array_map ( array ( $ this , 'EscapeIdentifier' ) , $ mixIdentifiers ) ; } else { return $ this -> escapeIdentifier ( $ mixIdentifiers ) ; } } | Given an array of identifiers this method returns array of escaped identifiers For corner case handling if a single identifier is supplied a single escaped identifier is returned |
6,591 | public function escapeIdentifiersAndValues ( $ mixColumnsAndValuesArray ) { $ result = array ( ) ; foreach ( $ mixColumnsAndValuesArray as $ strColumn => $ mixValue ) { $ result [ $ this -> escapeIdentifier ( $ strColumn ) ] = $ this -> sqlVariable ( $ mixValue ) ; } return $ result ; } | Escapes both column and values when supplied as an array |
6,592 | public function insertOrUpdate ( $ strTable , $ mixColumnsAndValuesArray , $ strPKNames = null ) { $ strEscapedArray = $ this -> escapeIdentifiersAndValues ( $ mixColumnsAndValuesArray ) ; $ strColumns = array_keys ( $ strEscapedArray ) ; $ strUpdateStatement = '' ; foreach ( $ strEscapedArray as $ strColumn => $ strVa... | INSERTs or UPDATEs a table |
6,593 | public final function query ( $ strQuery ) { $ timerName = null ; if ( ! $ this -> blnConnectedFlag ) { $ this -> connect ( ) ; } if ( $ this -> blnEnableProfiling ) { $ timerName = 'queryExec' . mt_rand ( ) ; Timer :: start ( $ timerName ) ; } $ result = $ this -> executeQuery ( $ strQuery ) ; if ( $ this -> blnEnable... | Sends the SELECT query to the database and returns the result |
6,594 | private function logQuery ( $ strQuery , $ dblQueryTime ) { if ( $ this -> blnEnableProfiling ) { $ objDebugBacktrace = debug_backtrace ( ) ; if ( ( count ( $ objDebugBacktrace ) > 3 ) && ( array_key_exists ( 'function' , $ objDebugBacktrace [ 2 ] ) ) && ( ( $ objDebugBacktrace [ 2 ] [ 'function' ] == 'QueryArray' ) ||... | If EnableProfiling is on then log the query to the profile array |
6,595 | public function outputProfiling ( $ blnPrintOutput = true ) { $ strPath = isset ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ 'REQUEST_URI' ] : $ _SERVER [ 'PHP_SELF' ] ; $ strOut = '<div class="qDbProfile">' ; if ( $ this -> blnEnableProfiling ) { $ strOut .= sprintf ( '<form method="post" id="frmDbProfile%s" action="... | Displays the OutputProfiling results plus a link which will popup the details of the profiling . |
6,596 | public static function extractCommentOptions ( $ strComment ) { $ ret [ 0 ] = null ; $ ret [ 1 ] = null ; if ( ( $ strComment ) && ( $ pos1 = strpos ( $ strComment , '{' ) ) !== false && ( $ pos2 = strrpos ( $ strComment , '}' , $ pos1 ) ) ) { $ strJson = substr ( $ strComment , $ pos1 , $ pos2 - $ pos1 + 1 ) ; $ a = j... | Utility function to extract the json embedded options structure from the comments . |
6,597 | protected function get_custom_routes ( ) { $ routes = [ ] ; $ routes [ 'GET' ] [ 'foo' ] = 'bar' ; $ accept = fem \ request :: get_primary_accept ( ) ; $ routes [ 'GET' ] [ 'foo' ] = 'bar->' . $ accept ; $ routes [ 'GET' ] [ 'foo' ] = 'bar::' . $ accept ; $ routes [ 'GET' ] [ 'foo' ] = function ( $ url , $ method ) { }... | user defined mapping url to handler |
6,598 | public function getDelegate ( $ packageType ) { if ( ! isset ( $ this -> _instances [ $ packageType ] ) ) { if ( isset ( $ this -> _delegates [ $ packageType ] ) ) { $ classname = $ this -> _delegates [ $ packageType ] ; $ instance = new $ classname ( $ this -> io , $ this -> composer , 'nooku-framework' ) ; $ this -> ... | Returns a specialized LibraryInstaller subclass to deal with the given package type . |
6,599 | public function setDirectory ( $ directory ) { if ( strpos ( $ directory , '/' ) !== 0 ) { throw new Exception \ InvalidArgumentException ( 'Directory name must be an absolute path.' ) ; } if ( ! is_dir ( $ directory ) ) { throw new Exception \ LogicException ( 'Template directory does not exist.' ) ; } $ this -> direc... | Template resolution is restricted to the paths under the template directory . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.