idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
25,200
public function filterByDisplaycost ( $ displaycost = null , $ comparison = null ) { if ( is_array ( $ displaycost ) ) { $ useMinMax = false ; if ( isset ( $ displaycost [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_DISPLAYCOST , $ displaycost [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ displaycost [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_DISPLAYCOST , $ displaycost [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_DISPLAYCOST , $ displaycost , $ comparison ) ; }
Filter the query on the displayCost column
25,201
public function filterByModname ( $ modname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ modname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_MODNAME , $ modname , $ comparison ) ; }
Filter the query on the modName column
25,202
public function filterByLightmap ( $ lightmap = null , $ comparison = null ) { if ( is_array ( $ lightmap ) ) { $ useMinMax = false ; if ( isset ( $ lightmap [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_LIGHTMAP , $ lightmap [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ lightmap [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_LIGHTMAP , $ lightmap [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_LIGHTMAP , $ lightmap , $ comparison ) ; }
Filter the query on the lightMap column
25,203
public function filterByExeversion ( $ exeversion = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ exeversion ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_EXEVERSION , $ exeversion , $ comparison ) ; }
Filter the query on the exeVersion column
25,204
public function filterByExebuild ( $ exebuild = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ exebuild ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_EXEBUILD , $ exebuild , $ comparison ) ; }
Filter the query on the exeBuild column
25,205
public function filterByEnvironmentname ( $ environmentname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ environmentname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_ENVIRONMENTNAME , $ environmentname , $ comparison ) ; }
Filter the query on the environmentName column
25,206
public function filterByVehiclename ( $ vehiclename = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ vehiclename ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_VEHICLENAME , $ vehiclename , $ comparison ) ; }
Filter the query on the vehicleName column
25,207
public function filterByUnlimiterrequired ( $ unlimiterrequired = null , $ comparison = null ) { if ( is_string ( $ unlimiterrequired ) ) { $ unlimiterrequired = in_array ( strtolower ( $ unlimiterrequired ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MxmapTableMap :: COL_UNLIMITERREQUIRED , $ unlimiterrequired , $ comparison ) ; }
Filter the query on the unlimiterRequired column
25,208
public function filterByRoutename ( $ routename = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ routename ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_ROUTENAME , $ routename , $ comparison ) ; }
Filter the query on the routeName column
25,209
public function filterByLengthname ( $ lengthname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ lengthname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_LENGTHNAME , $ lengthname , $ comparison ) ; }
Filter the query on the lengthName column
25,210
public function filterByLaps ( $ laps = null , $ comparison = null ) { if ( is_array ( $ laps ) ) { $ useMinMax = false ; if ( isset ( $ laps [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_LAPS , $ laps [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ laps [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_LAPS , $ laps [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_LAPS , $ laps , $ comparison ) ; }
Filter the query on the laps column
25,211
public function filterByDifficultyname ( $ difficultyname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ difficultyname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_DIFFICULTYNAME , $ difficultyname , $ comparison ) ; }
Filter the query on the difficultyName column
25,212
public function filterByReplaytypename ( $ replaytypename = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ replaytypename ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYTYPENAME , $ replaytypename , $ comparison ) ; }
Filter the query on the replayTypeName column
25,213
public function filterByReplaywrid ( $ replaywrid = null , $ comparison = null ) { if ( is_array ( $ replaywrid ) ) { $ useMinMax = false ; if ( isset ( $ replaywrid [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRID , $ replaywrid [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ replaywrid [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRID , $ replaywrid [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRID , $ replaywrid , $ comparison ) ; }
Filter the query on the replayWRID column
25,214
public function filterByReplaywrtime ( $ replaywrtime = null , $ comparison = null ) { if ( is_array ( $ replaywrtime ) ) { $ useMinMax = false ; if ( isset ( $ replaywrtime [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRTIME , $ replaywrtime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ replaywrtime [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRTIME , $ replaywrtime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRTIME , $ replaywrtime , $ comparison ) ; }
Filter the query on the replayWRTime column
25,215
public function filterByReplaywruserid ( $ replaywruserid = null , $ comparison = null ) { if ( is_array ( $ replaywruserid ) ) { $ useMinMax = false ; if ( isset ( $ replaywruserid [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRUSERID , $ replaywruserid [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ replaywruserid [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRUSERID , $ replaywruserid [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRUSERID , $ replaywruserid , $ comparison ) ; }
Filter the query on the replayWRUserID column
25,216
public function filterByReplaywrusername ( $ replaywrusername = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ replaywrusername ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYWRUSERNAME , $ replaywrusername , $ comparison ) ; }
Filter the query on the replayWRUsername column
25,217
public function filterByRatingvotecount ( $ ratingvotecount = null , $ comparison = null ) { if ( is_array ( $ ratingvotecount ) ) { $ useMinMax = false ; if ( isset ( $ ratingvotecount [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTECOUNT , $ ratingvotecount [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ ratingvotecount [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTECOUNT , $ ratingvotecount [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTECOUNT , $ ratingvotecount , $ comparison ) ; }
Filter the query on the ratingVoteCount column
25,218
public function filterByRatingvoteaverage ( $ ratingvoteaverage = null , $ comparison = null ) { if ( is_array ( $ ratingvoteaverage ) ) { $ useMinMax = false ; if ( isset ( $ ratingvoteaverage [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTEAVERAGE , $ ratingvoteaverage [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ ratingvoteaverage [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTEAVERAGE , $ ratingvoteaverage [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_RATINGVOTEAVERAGE , $ ratingvoteaverage , $ comparison ) ; }
Filter the query on the ratingVoteAverage column
25,219
public function filterByReplaycount ( $ replaycount = null , $ comparison = null ) { if ( is_array ( $ replaycount ) ) { $ useMinMax = false ; if ( isset ( $ replaycount [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYCOUNT , $ replaycount [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ replaycount [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYCOUNT , $ replaycount [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_REPLAYCOUNT , $ replaycount , $ comparison ) ; }
Filter the query on the replayCount column
25,220
public function filterByTrackvalue ( $ trackvalue = null , $ comparison = null ) { if ( is_array ( $ trackvalue ) ) { $ useMinMax = false ; if ( isset ( $ trackvalue [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_TRACKVALUE , $ trackvalue [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ trackvalue [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_TRACKVALUE , $ trackvalue [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_TRACKVALUE , $ trackvalue , $ comparison ) ; }
Filter the query on the trackValue column
25,221
public function filterByComments ( $ comments = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ comments ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_COMMENTS , $ comments , $ comparison ) ; }
Filter the query on the comments column
25,222
public function filterByCommentscount ( $ commentscount = null , $ comparison = null ) { if ( is_array ( $ commentscount ) ) { $ useMinMax = false ; if ( isset ( $ commentscount [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_COMMENTSCOUNT , $ commentscount [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ commentscount [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_COMMENTSCOUNT , $ commentscount [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_COMMENTSCOUNT , $ commentscount , $ comparison ) ; }
Filter the query on the commentsCount column
25,223
public function filterByAwardcount ( $ awardcount = null , $ comparison = null ) { if ( is_array ( $ awardcount ) ) { $ useMinMax = false ; if ( isset ( $ awardcount [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_AWARDCOUNT , $ awardcount [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ awardcount [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_AWARDCOUNT , $ awardcount [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_AWARDCOUNT , $ awardcount , $ comparison ) ; }
Filter the query on the awardCount column
25,224
public function filterByHasscreenshot ( $ hasscreenshot = null , $ comparison = null ) { if ( is_string ( $ hasscreenshot ) ) { $ hasscreenshot = in_array ( strtolower ( $ hasscreenshot ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MxmapTableMap :: COL_HASSCREENSHOT , $ hasscreenshot , $ comparison ) ; }
Filter the query on the hasScreenshot column
25,225
public function filterByHasthumbnail ( $ hasthumbnail = null , $ comparison = null ) { if ( is_string ( $ hasthumbnail ) ) { $ hasthumbnail = in_array ( strtolower ( $ hasthumbnail ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MxmapTableMap :: COL_HASTHUMBNAIL , $ hasthumbnail , $ comparison ) ; }
Filter the query on the hasThumbnail column
25,226
public function filterByHasghostblocks ( $ hasghostblocks = null , $ comparison = null ) { if ( is_string ( $ hasghostblocks ) ) { $ hasghostblocks = in_array ( strtolower ( $ hasghostblocks ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MxmapTableMap :: COL_HASGHOSTBLOCKS , $ hasghostblocks , $ comparison ) ; }
Filter the query on the hasGhostblocks column
25,227
public function filterByEmbeddedobjectscount ( $ embeddedobjectscount = null , $ comparison = null ) { if ( is_array ( $ embeddedobjectscount ) ) { $ useMinMax = false ; if ( isset ( $ embeddedobjectscount [ 'min' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_EMBEDDEDOBJECTSCOUNT , $ embeddedobjectscount [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ embeddedobjectscount [ 'max' ] ) ) { $ this -> addUsingAlias ( MxmapTableMap :: COL_EMBEDDEDOBJECTSCOUNT , $ embeddedobjectscount [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MxmapTableMap :: COL_EMBEDDEDOBJECTSCOUNT , $ embeddedobjectscount , $ comparison ) ; }
Filter the query on the embeddedObjectsCount column
25,228
public function filterByMap ( $ map , $ comparison = null ) { if ( $ map instanceof \ eXpansion \ Bundle \ Maps \ Model \ Map ) { return $ this -> addUsingAlias ( MxmapTableMap :: COL_TRACKUID , $ map -> getMapuid ( ) , $ comparison ) ; } elseif ( $ map instanceof ObjectCollection ) { if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } return $ this -> addUsingAlias ( MxmapTableMap :: COL_TRACKUID , $ map -> toKeyValue ( 'PrimaryKey' , 'Mapuid' ) , $ comparison ) ; } else { throw new PropelException ( 'filterByMap() only accepts arguments of type \eXpansion\Bundle\Maps\Model\Map or Collection' ) ; } }
Filter the query by a related \ eXpansion \ Bundle \ Maps \ Model \ Map object
25,229
public function useMapQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinMap ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Map' , '\eXpansion\Bundle\Maps\Model\MapQuery' ) ; }
Use the Map relation Map object
25,230
public function format ( array $ record ) { if ( isset ( $ record [ "datetime" ] ) && ( $ record [ "datetime" ] instanceof \ DateTime ) ) { $ record [ "timestamp" ] = $ record [ "datetime" ] -> format ( "Y-m-d\TH:i:s.uO" ) ; } return parent :: format ( $ record ) ; }
Appends the timestamp parameter for indexing by Loggly .
25,231
public function init ( ) { parent :: init ( ) ; $ reservation = $ this -> getReservation ( ) ; if ( ! in_array ( $ reservation -> Status , array ( 'PENDING' , 'PAID' ) ) ) { ReservationSession :: end ( ) ; $ this -> redirect ( $ this -> Link ( '/' ) ) ; } elseif ( $ reservation -> Status !== 'PAID' ) { $ this -> extend ( 'afterPaymentComplete' , $ reservation ) ; } }
Init the success controller check if files should be created and send
25,232
public function loadAndMerge ( string $ filename ) { if ( \ file_exists ( $ filename ) ) { $ this -> filename = $ filename ; $ configArray = \ json_decode ( \ file_get_contents ( $ filename ) , true ) ; if ( $ configArray ) { $ this -> confValues = \ array_replace_recursive ( $ this -> confValues , $ configArray ) ; } else { throw new SpinException ( 'Invalid JSON file "' . $ filename . '"' ) ; } } return $ this ; }
Load & Merge Configuration file to existing config
25,233
public function addHeader ( $ headers ) { foreach ( ( array ) $ headers as $ header ) { if ( strpos ( $ header , "\n" ) !== false || strpos ( $ header , "\r" ) !== false ) { throw new \ InvalidArgumentException ( 'Headers can not contain newline characters for security reasons' ) ; } $ this -> headers [ ] = $ header ; } return $ this ; }
Add headers to the message
25,234
protected function logDLStats ( ) { $ q = \ Database :: getInstance ( ) -> prepare ( "SELECT id FROM `tl_dlstats` WHERE `filename`=?" ) -> execute ( $ this -> _filename ) ; if ( $ q -> next ( ) ) { $ this -> _statId = $ q -> id ; \ Database :: getInstance ( ) -> prepare ( "UPDATE `tl_dlstats` SET `tstamp`=?, `downloads`=`downloads`+1 WHERE `id`=?" ) -> execute ( time ( ) , $ this -> _statId ) ; } else { $ q = \ Database :: getInstance ( ) -> prepare ( "INSERT IGNORE INTO `tl_dlstats` %s" ) -> set ( array ( 'tstamp' => time ( ) , 'filename' => $ this -> _filename , 'downloads' => 1 ) ) -> execute ( ) ; $ this -> _statId = $ q -> insertId ; } $ this -> setBlockingIP ( $ this -> IP , $ this -> _filename ) ; }
Helper function log file name
25,235
protected function countVote ( $ toCount ) { $ value = 0 ; foreach ( $ this -> votes as $ login => $ vote ) { if ( $ vote === $ toCount ) { $ value ++ ; } } return $ value ; }
Count votes of a certain type .
25,236
protected function generateEtag ( \ DateTime $ timeStamp ) { $ user = $ this -> securityService -> findGitUser ( ) ; $ userString = '' ; if ( null !== $ user ) { $ userString = $ user -> getGitUserName ( ) ; } return md5 ( $ timeStamp -> getTimestamp ( ) . $ userString ) ; }
Generate an etag based on the timestamp and the current user .
25,237
public function scanDirectory ( $ directory ) { $ extensions = $ this -> getOption ( 'extensions' ) ; foreach ( scandir ( $ directory ) as $ object ) { if ( $ object === '.' || $ object === '..' ) { continue ; } $ inputFile = $ directory . DIRECTORY_SEPARATOR . $ object ; if ( is_dir ( $ inputFile ) ) { foreach ( $ this -> scanDirectory ( $ inputFile ) as $ file ) { yield $ file ; } continue ; } if ( $ this -> fileMatchExtensions ( $ object , $ extensions ) ) { yield $ inputFile ; } } }
Get all file matching extensions list recursively in a directory .
25,238
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ pollerNames = $ input -> getOption ( 'poller' ) ; $ forceFullSync = $ input -> getOption ( 'force-full-sync' ) ; if ( $ pollerNames ) { $ pollersToRun = [ ] ; foreach ( $ pollerNames as $ name ) { $ pollersToRun [ ] = $ this -> pollerCollection -> getPoller ( $ name ) ; } } else { $ pollersToRun = $ this -> pollerCollection ; } $ exitCode = 0 ; foreach ( $ pollersToRun as $ poller ) { $ isSuccessfulRun = $ this -> runPoller ( $ poller , $ forceFullSync , $ output ) ; if ( ! $ isSuccessfulRun ) { $ exitCode = 1 ; } } return $ exitCode ; }
Tries to execute action specified
25,239
private function runPoller ( Poller $ poller , $ forceFullSync , OutputInterface $ output ) { $ output -> write ( sprintf ( "Run poller <info>%s</info>, force mode is <comment>%s</comment>: " , $ poller -> getName ( ) , $ forceFullSync ? 'on' : 'off' ) ) ; try { $ processed = $ poller -> poll ( $ forceFullSync ) ; $ output -> writeln ( "<info>OK</info> (Processed: <comment>$processed</comment>)" ) ; return true ; } catch ( Exception $ e ) { $ output -> writeln ( "<error>FAIL</error> (Details: <error>{$e->getMessage()}</error>)" ) ; return false ; } }
Runs poller specified
25,240
public function getAvailableOverrides ( ) { $ path = $ this -> getPath ( ) ; $ suffix = $ this -> getSuffix ( ) ; $ glob = "{$path}/*{$suffix}" ; $ result = [ ] ; foreach ( glob ( $ glob ) as $ file ) { $ identifier = basename ( $ file , $ suffix ) ; $ result [ $ identifier ] = $ file ; } return $ result ; }
Returns a list of all available overrides .
25,241
public function setFormat ( $ format ) { if ( $ format ) { $ format = strtolower ( $ format ) ; if ( ! in_array ( $ format , static :: $ validFormats ) ) { throw new Exception ( "Format {$format} is not supported" ) ; } $ this -> format = $ format ; if ( ! $ this -> suffix ) { $ this -> setSuffix ( ".{$format}" ) ; } } return $ this ; }
Set format of the override files .
25,242
final public function sendRequest ( Request $ request , $ callback ) { if ( $ this -> enabled -> get ( ) == false ) { return ; } $ this -> webaccess -> request ( self :: dedimaniaUrl , [ [ $ this , "process" ] , $ callback ] , $ request -> getXml ( ) , true , 600 , 3 , 5 , 'eXpansion server controller' , 'application/x-www-form-urlencoded; charset=UTF-8' ) ; }
Send a request to Dedimania
25,243
protected function setGReplay ( $ login ) { if ( $ this -> enabled -> get ( ) == false ) { return ; } $ tempReplay = new IXR_Base64 ( "" ) ; $ this -> dedimaniaService -> setGReplay ( "" , $ tempReplay ) ; $ player = new Player ( ) ; $ player -> login = $ login ; try { $ this -> factory -> getConnection ( ) -> saveBestGhostsReplay ( $ player , "exp2_temp_replay" ) ; $ replay = new IXR_Base64 ( $ this -> fileSystem -> getUserData ( ) -> readAndDelete ( "Replays" . DIRECTORY_SEPARATOR . "exp2_temp_replay.Replay.Gbx" ) ) ; $ this -> dedimaniaService -> setGReplay ( $ login , $ replay ) ; } catch ( \ Exception $ e ) { $ this -> console -> writeln ( 'Dedimania: $f00Error while fetching GhostsReplay' ) ; } }
Sets new Ghost replay for the map
25,244
public function onEndMapStart ( $ count , $ time , $ restarted , Map $ map ) { if ( $ this -> enabled -> get ( ) == false ) { return ; } if ( ! $ restarted ) { $ this -> setRecords ( ) ; } }
Callback sent when the EndMap section start .
25,245
private function getNormalizedCharset ( $ charset ) { $ upper = null ; if ( is_array ( $ charset ) ) { $ upper = array_map ( 'strtoupper' , $ charset ) ; } else { $ upper = strtoupper ( $ charset ) ; } return preg_replace ( '/[^A-Z0-9]+/' , '' , $ upper ) ; }
The passed charset is uppercased and stripped of non - alphanumeric characters before being returned .
25,246
private function getMbCharset ( $ cs ) { $ normalized = $ this -> getNormalizedCharset ( $ cs ) ; if ( array_key_exists ( $ normalized , self :: $ mbListedEncodings ) ) { return self :: $ mbListedEncodings [ $ normalized ] ; } elseif ( array_key_exists ( $ normalized , self :: $ mbAliases ) ) { return self :: $ mbAliases [ $ normalized ] ; } return false ; }
Looks up a charset from mb_list_encodings and identified aliases checking if the lookup has been cached already first .
25,247
public function setVote ( $ login , $ vote ) { $ player = $ this -> playerStorage -> getPlayerInfo ( $ login ) ; $ obj = [ "login" => $ login , "nickname" => $ player -> getNickName ( ) , "vote" => $ vote , ] ; $ this -> changedVotes [ $ player -> getLogin ( ) ] = new MxVote ( ( object ) $ obj ) ; $ this -> chatNotification -> sendMessage ( 'expansion_mxkarma.chat.votechanged' , $ login ) ; }
sets vote value
25,248
public function onStartMapEnd ( $ count , $ time , $ restarted , Map $ map ) { $ this -> startTime = time ( ) ; $ this -> mxKarma -> loadVotes ( array_keys ( $ this -> playerStorage -> getOnline ( ) ) , false ) ; }
Callback sent when the StartMap section end .
25,249
public function onEndMapEnd ( $ count , $ time , $ restarted , Map $ map ) { if ( ! empty ( $ this -> changedVotes ) ) { $ votes = [ ] ; foreach ( $ this -> changedVotes as $ vote ) { $ votes [ ] = $ vote ; } $ this -> mxKarma -> saveVotes ( $ map , ( time ( ) - $ this -> startTime ) , $ votes ) ; } }
Callback sent when the EndMap section end .
25,250
public function add ( $ middleware ) { if ( ! is_string ( $ middleware ) && ! $ middleware instanceof MiddlewareInterface ) { throw new \ InvalidArgumentException ( 'Middleware must be a string or an instance of MiddlewareInterface' ) ; } $ class = is_string ( $ middleware ) ? new $ middleware : $ middleware ; array_push ( $ this -> middleware , $ class ) ; }
Add a middleware to the end of the queue .
25,251
public function prepend ( $ middleware ) { if ( ! is_string ( $ middleware ) && ! $ middleware instanceof MiddlewareInterface ) { throw new \ InvalidArgumentException ( 'Middleware must be a string or an instance of MiddlewareInterface' ) ; } $ class = is_string ( $ middleware ) ? new $ middleware : $ middleware ; array_unshift ( $ this -> middleware , $ class ) ; }
Add a middleware to the beginning of the queue .
25,252
public function dispatch ( ServerRequestInterface $ request , ResponseInterface $ response ) : ResponseInterface { reset ( $ this -> middleware ) ; $ this -> response = $ response ; return $ this -> handle ( $ request ) ; }
Dispatch the middleware queue .
25,253
public function handle ( ServerRequestInterface $ request ) : ResponseInterface { if ( ! isset ( $ this -> middleware [ $ this -> index ] ) ) { return $ this -> response ; } $ middleware = $ this -> middleware [ $ this -> index ] ; return $ middleware -> process ( $ request , $ this -> next ( ) ) ; }
Handle the request return a response and calls next middleware .
25,254
public function push ( array $ message , callable $ messageHandler ) { $ this -> beanstalkMapper -> put ( serialize ( array_merge ( $ messageHandler ( ) , $ message ) ) ) ; return null ; }
Push data to task
25,255
public function request ( ) { $ scriptSettings = $ this -> gameDataStorage -> getScriptOptions ( ) ; $ currentMap = $ this -> mapStorage -> getCurrentMap ( ) ; $ nbLaps = 1 ; if ( $ currentMap -> lapRace ) { $ nbLaps = $ currentMap -> nbLaps ; } if ( $ scriptSettings [ 'S_ForceLapsNb' ] != - 1 ) { $ nbLaps = $ scriptSettings [ 'S_ForceLapsNb' ] ; } $ this -> dispatch ( 'set' , [ $ nbLaps ] ) ; }
Request call to fetch something ..
25,256
public function getMaxJournalVoucherNumber ( $ id , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } return $ this -> JournalVoucher -> setConnection ( $ databaseConnectionName ) -> where ( 'organization_id' , '=' , $ id ) -> max ( 'number' ) ; }
Get the max journal voucher number
25,257
public function getByOrganizationByPeriodAndByStatus ( $ organizationId , $ periodIds , $ status , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } return $ this -> JournalVoucher -> setConnection ( $ databaseConnectionName ) -> where ( 'organization_id' , '=' , $ organizationId ) -> whereIn ( 'period_id' , $ periodIds ) -> where ( 'status' , '=' , $ status ) -> get ( ) ; }
Get journal voucher by organization by period and by status
25,258
public function subsequentByPeriodByNumberAndByOrganization ( $ periodId , $ number , $ organizationId , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } return $ this -> JournalVoucher -> setConnection ( $ databaseConnectionName ) -> where ( 'period_id' , '=' , $ periodId ) -> where ( 'number' , '>' , $ number ) -> where ( 'organization_id' , '=' , $ organizationId ) -> get ( ) ; }
Get subsequent journal vouchers by period by number and by organization id
25,259
public function subsequentByPeriodByVoucherTypeByNumberAndByOrganization ( $ periodId , $ voucherTypeId , $ number , $ organizationId , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } return $ this -> JournalVoucher -> setConnection ( $ databaseConnectionName ) -> where ( 'period_id' , '=' , $ periodId ) -> where ( 'voucher_type_id' , '=' , $ voucherTypeId ) -> where ( 'number' , '>' , $ number ) -> where ( 'organization_id' , '=' , $ organizationId ) -> get ( ) ; }
Get subsequent journal vouchers by period by voucher type id by number and by organization id
25,260
public function subtractOneNumber ( $ journalVoucherIds , $ databaseConnectionName = null ) { if ( empty ( $ databaseConnectionName ) ) { $ databaseConnectionName = $ this -> databaseConnectionName ; } $ this -> JournalVoucher -> setConnection ( $ databaseConnectionName ) -> whereIn ( 'id' , $ journalVoucherIds ) -> update ( array ( 'number' => $ this -> DB -> raw ( 'number - 1' ) ) ) ; return true ; }
Flag sales with accounting journals generated
25,261
public function filterByMapuid ( $ mapuid = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ mapuid ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapratingTableMap :: COL_MAPUID , $ mapuid , $ comparison ) ; }
Filter the query on the mapUid column
25,262
public function filterByScore ( $ score = null , $ comparison = null ) { if ( is_array ( $ score ) ) { $ useMinMax = false ; if ( isset ( $ score [ 'min' ] ) ) { $ this -> addUsingAlias ( MapratingTableMap :: COL_SCORE , $ score [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ score [ 'max' ] ) ) { $ this -> addUsingAlias ( MapratingTableMap :: COL_SCORE , $ score [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MapratingTableMap :: COL_SCORE , $ score , $ comparison ) ; }
Filter the query on the score column
25,263
protected function createConfigs ( $ groups , $ permissions , ContainerBuilder $ container ) { $ configManager = $ container -> findDefinition ( ConfigManagerInterface :: class ) ; foreach ( $ groups as $ groupCode => $ group ) { $ pathPrefix = $ container -> getParameter ( 'expansion.admin_groups.config.path' ) . "/$groupCode" ; $ id = 'expansion.admin_groups.config.label.' . $ groupCode ; $ container -> setDefinition ( $ id , new ChildDefinition ( 'expansion.admin_groups.config.label.abstract' ) ) -> replaceArgument ( '$path' , "$pathPrefix/label" ) -> replaceArgument ( '$defaultValue' , $ group [ 'label' ] ) ; $ configManager -> addMethodCall ( 'registerConfig' , [ new Reference ( $ id ) , $ id ] ) ; $ id = 'expansion.admin_groups.config.logins.' . $ groupCode ; $ container -> setDefinition ( $ id , new ChildDefinition ( 'expansion.admin_groups.config.logins.abstract' ) ) -> setArgument ( '$path' , "$pathPrefix/logins" ) -> setArgument ( '$defaultValue' , $ group [ 'logins' ] ) ; $ configManager -> addMethodCall ( 'registerConfig' , [ new Reference ( $ id ) , $ id ] ) ; if ( $ groupCode != "master_admin" ) { foreach ( $ permissions as $ permission ) { $ id = 'expansion.admin_groups.config.permissions.' . $ groupCode . ".$permission" ; $ container -> setDefinition ( $ id , new ChildDefinition ( 'expansion.admin_groups.config.permissions.abstract' ) ) -> setArgument ( '$path' , "$pathPrefix/perm_$permission" ) -> setArgument ( '$defaultValue' , $ group [ 'logins' ] ) -> setArgument ( '$name' , "expansion_admingroups.permission.$permission.label" ) -> setArgument ( '$description' , "expansion_admingroups.permission.$permission.description" ) ; $ configManager -> addMethodCall ( 'registerConfig' , [ new Reference ( $ id ) , $ id ] ) ; } } } }
Create the config services .
25,264
public function getLastQuery ( string $ key = null ) { return $ key ? $ this -> profiles [ 'query' ] [ $ this -> queryCount ] [ $ key ] ?? null : $ this -> profiles [ 'query' ] [ $ this -> queryCount ] ?? null ; }
Get last query .
25,265
public function getTotalTime ( bool $ indexed = false ) { if ( $ this -> profiles == null ) { return null ; } $ totalTime = 0.00 ; $ totalTimeIndexed = '' ; if ( isset ( $ this -> profiles [ 'connection' ] ) ) { $ totalTime += $ this -> profiles [ 'connection' ] [ 'time' ] ; if ( $ indexed ) { $ totalTimeIndexed .= "connection({$totalTime})" ; } } if ( isset ( $ this -> profiles [ 'query' ] ) ) { foreach ( $ this -> profiles [ 'query' ] as $ i => $ profile ) { $ totalTime += $ profile [ 'time' ] ; if ( $ indexed ) { $ totalTimeIndexed .= " query{$i}({$profile['time']})" ; } } } return ! $ indexed ? $ totalTime : $ totalTimeIndexed ; }
Get total time .
25,266
public function build ( ) { if ( $ this -> container -> hasDefinition ( $ this -> definitionName ( ) ) ) { $ this -> container -> getDefinition ( $ this -> definitionName ( ) ) -> replaceArgument ( 0 , array_unique ( $ this -> configuration , SORT_REGULAR ) ) ; } if ( $ this -> container -> hasDefinition ( $ this -> definitionApiName ( ) ) ) { foreach ( $ this -> configuration as $ key => $ config ) { $ this -> configuration [ $ key ] [ 'enabled' ] = $ config [ 'api_enabled' ] ; if ( array_key_exists ( 'type' , $ config ) ) { $ this -> configuration [ $ key ] [ 'type' ] = $ config [ 'api_type' ] ; } } $ this -> container -> getDefinition ( $ this -> definitionApiName ( ) ) -> replaceArgument ( 0 , array_unique ( $ this -> configuration , SORT_REGULAR ) ) ; } return $ this -> container ; }
Entry point of routes loader builder to inject routes inside route loader .
25,267
protected function sanitize ( array $ configuration ) { foreach ( $ configuration as $ key => $ config ) { if ( null === $ config [ 'name' ] ) { $ configuration [ $ key ] [ 'name' ] = $ this -> defaultRouteName ( $ key ) ; } if ( null === $ config [ 'path' ] ) { $ configuration [ $ key ] [ 'path' ] = $ this -> defaultRoutePath ( $ key ) ; } if ( null === $ config [ 'api_name' ] ) { $ configuration [ $ key ] [ 'api_name' ] = $ this -> defaultApiRouteName ( $ key ) ; } if ( null === $ config [ 'api_path' ] ) { $ configuration [ $ key ] [ 'api_path' ] = $ this -> defaultApiRoutePath ( $ key ) ; } } return $ configuration ; }
Sanitizes and validates the given configuration tree .
25,268
public function getParameters ( ) : array { if ( is_null ( $ this -> parameters ) ) { $ matches = [ ] ; $ regExp = self :: PARAMS_SEARCH_REGEXP ; preg_match_all ( $ regExp , $ this -> str , $ matches ) ; $ this -> parameters = $ matches [ 2 ] ; } return $ this -> parameters ; }
Get a list containing all parameters identified .
25,269
public function render ( $ view , $ view_suffix = '' ) { $ this -> view = $ view ; $ this -> view_suffix = $ view_suffix ; if ( is_singular ( ) ) { $ this -> _render_loop ( ) ; } else { $ this -> _render_direct ( ) ; } }
Rendering the page
25,270
public function view ( ) { $ view = $ this -> _get_args_for_template_part ( ) ; $ view = apply_filters ( 'inc2734_wp_view_controller_view' , $ view ) ; Helper \ get_template_part ( $ view [ 'slug' ] , $ view [ 'name' ] ) ; }
Loading the view template in layout template
25,271
protected function _get_args_for_template_part ( ) { $ view = [ 'slug' => '' , 'name' => '' , ] ; $ template_name = Helper \ locate_template ( ( array ) Helper \ config ( 'view' ) , $ this -> view , $ this -> view_suffix ) ; if ( empty ( $ template_name ) ) { return $ view ; } if ( ! $ this -> view_suffix ) { $ view = [ 'slug' => $ template_name , 'name' => '' , ] ; } else { $ view = [ 'slug' => preg_replace ( '|\-' . preg_quote ( $ this -> view_suffix ) . '$|' , '' , $ template_name ) , 'name' => $ this -> view_suffix , ] ; } if ( is_404 ( ) || is_search ( ) ) { return $ view ; } $ static_template_name = $ this -> get_static_view_template_name ( ) ; if ( locate_template ( $ static_template_name . '.php' , false ) ) { return [ 'slug' => $ static_template_name , 'name' => '' , ] ; } return $ view ; }
Gets the view args
25,272
public function get_static_view_template_name ( ) { $ request_uri = sanitize_text_field ( wp_unslash ( $ _SERVER [ 'REQUEST_URI' ] ) ) ; $ request_uri = $ this -> _get_relative_path ( $ request_uri ) ; $ path = $ this -> _remove_http_query ( $ request_uri ) ; $ path = $ this -> _remove_paged_slug ( $ path ) ; $ path = trim ( $ path , '/' ) ; if ( ! $ path ) { return Helper \ locate_template ( ( array ) Helper \ config ( 'static' ) , 'index' ) ; } $ template_name = Helper \ locate_template ( ( array ) Helper \ config ( 'static' ) , $ path ) ; if ( empty ( $ template_name ) ) { $ template_name = Helper \ locate_template ( ( array ) Helper \ config ( 'static' ) , $ path . '/index' ) ; } return $ template_name ; }
Returns static view template name
25,273
protected function _remove_http_query ( $ uri ) { $ uri = str_replace ( http_build_query ( $ _GET , null , '&' ) , '' , $ uri ) ; $ uri = rtrim ( $ uri , '?' ) ; return $ uri ; }
Return uri that removed http queries
25,274
protected function getGravatarSize ( ) { $ size = $ this -> getSize ( ) ; return $ this -> config [ 'sizes' ] [ $ size ] ?? ( \ is_int ( $ size ) ? $ size : 'small' ) ; }
Get Gravatar size .
25,275
public function setCallback ( $ callback = null ) { if ( ! is_null ( $ callback ) && ! is_callable ( $ callback ) ) { throw new Exception ( "callback must be of type callable or null" ) ; } $ this -> callback = $ callback ; return $ this ; }
Set callback function run for every entry before added to CSV .
25,276
public function setHeader ( array $ header ) { if ( is_numeric ( key ( $ header ) ) ) { $ header = array_fill_keys ( $ header , '' ) ; } $ this -> header = $ header ; return $ this ; }
Set CSV headers .
25,277
public final function CreatePage ( ) { $ method = strtoupper ( $ this -> _context -> get ( "REQUEST_METHOD" ) ) ; $ customAction = strtolower ( $ method ) . ucfirst ( $ this -> _action ) ; if ( method_exists ( $ this , $ customAction ) ) $ this -> $ customAction ( $ this -> getRawRequest ( ) , $ this -> _context -> get ( "id" ) ) ; else throw new BadMethodCallException ( "The method '$customAction' does not exists." ) ; return $ this -> defaultXmlnukeDocument ; }
Expected TWO pa
25,278
public static function DeleteFilesFromPath ( $ file ) { $ files = self :: RetrieveFilesFromFolder ( $ file -> PathSuggested ( ) , null ) ; foreach ( $ files as $ f ) { if ( strpos ( $ f , $ file -> Extension ( ) ) !== false ) { self :: DeleteFileString ( $ f ) ; } } }
Delete File from path
25,279
public static function AdjustSlashes ( $ path ) { if ( self :: isWindowsOS ( ) ) { $ search = "/" ; $ replace = "\\" ; } else { $ search = "\\" ; $ replace = "/" ; } return str_replace ( $ search , $ replace , $ path ) ; }
Return slash to a operational system
25,280
public static function getUriFromFile ( $ absolutepath ) { if ( self :: isWindowsOS ( ) ) { $ result = "file:///" . $ absolutepath ; $ search = "\\" ; $ replace = "/" ; $ result = str_replace ( $ search , $ replace , $ result ) ; } else { $ result = "file://" . $ absolutepath ; } return $ result ; }
Get filr from absolute path
25,281
public static function isReadable ( $ filename ) { if ( ! is_readable ( $ filename ) ) return false ; if ( ( self :: isWindowsOS ( ) || self :: isMacOS ( ) ) && ( count ( glob ( $ filename . '*' ) ) == 0 ) ) throw new \ Xmlnuke \ Core \ Exception \ CaseMismatchException ( 'Your operating system is not case sensitive and it can find the file "' . $ filename . '" ' . 'with different uppercase and lowercase combination in your name. ' . 'However Xmlnuke will not accept it for ensure your code will run on any platform.' ) ; else return true ; }
Check if the file is readable across all platforms
25,282
public static function ForceDirectories ( $ pathname , $ mode = 0777 ) { $ next_pathname = substr ( $ pathname , 0 , strrpos ( $ pathname , self :: Slash ( ) ) ) ; if ( $ next_pathname != "" ) { self :: ForceDirectories ( $ next_pathname , $ mode ) ; } if ( ! file_exists ( $ pathname ) ) { FileUtil :: CreateDirectory ( $ pathname , $ mode ) ; } }
Create a directory structure recursively
25,283
public static function ForceRemoveDirectories ( $ dir ) { if ( $ objs = glob ( $ dir . "/*" ) ) { foreach ( $ objs as $ obj ) { is_dir ( $ obj ) ? self :: ForceRemoveDirectories ( $ obj ) : self :: DeleteFileString ( $ obj ) ; } } self :: DeleteDirectory ( $ dir ) ; }
Remove directorys structure recursively
25,284
public static function OpenRemoteDocument ( $ url ) { $ pat = '/(http|ftp|https):\\/\\/((\\w|\\.)+)/i' ; $ urlParts = preg_split ( $ pat , $ url , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ handle = fsockopen ( $ urlParts [ 2 ] , 80 , $ errno , $ errstr , 30 ) ; if ( ! $ handle ) { throw new FileUtilException ( "Socket error: $errstr ($errno)" ) ; } else { $ out = "GET " . $ urlParts [ 4 ] . " HTTP/1.1\r\n" ; $ out .= "Host: " . $ urlParts [ 2 ] . "\r\n" ; $ out .= "Connection: Close\r\n\r\n" ; fwrite ( $ handle , $ out ) ; return $ handle ; } }
Open a remote document from a specific URL
25,285
public static function ReadRemoteDocument ( $ handle ) { $ retdocument = "" ; $ xml = true ; $ canread = true ; while ( ! feof ( $ handle ) ) { $ buffer = fgets ( $ handle , 4096 ) ; if ( strpos ( strtolower ( $ buffer ) , "content-type:" ) !== false ) { $ xml = ( strpos ( strtolower ( $ buffer ) , "xml" ) !== false ) ; $ canread = ! $ xml ; } if ( trim ( $ buffer ) == "" ) { break ; } } while ( ! feof ( $ handle ) ) { $ buffer = fgets ( $ handle , 4096 ) ; if ( ! $ canread && ( $ buffer [ 0 ] != "<" ) ) { $ buffer = "" ; } else { $ canread = true ; } $ retdocument = $ retdocument . $ buffer ; } fclose ( $ handle ) ; if ( $ xml ) { $ lastvalid = strrpos ( $ retdocument , ">" ) ; $ retdocument = substr ( $ retdocument , 0 , $ lastvalid + 1 ) ; } return $ retdocument ; }
Get the full document opened from OpenRemoteDocument
25,286
public function stringify ( $ value ) : string { if ( $ value instanceof \ DateTimeInterface ) { return $ value -> format ( 'Y-m-d' ) ; } if ( is_array ( $ value ) ) { return self :: ARRAY_VALUE ; } if ( is_object ( $ value ) && ! method_exists ( $ value , '__tostring' ) ) { return self :: OBJECT_VALUE ; } return ( string ) $ value ; }
Cast value to string
25,287
public function add ( string $ profile , $ inheritContext = false ) { if ( $ this -> has ( $ profile ) ) { throw new Exception ( "Profile {$profile} already exist." ) ; } if ( ! strlen ( $ profile ) ) { throw new Exception ( "Profile must be set." ) ; } $ child = clone $ this ; $ child -> clear ( ! $ inheritContext ) ; $ child -> name = ( $ this -> name ? $ this -> name . ' > ' : '' ) . $ profile ; $ child -> children = [ ] ; $ this -> children [ $ profile ] = $ child ; return $ child ; }
Add child profile .
25,288
public function clear ( $ clearContext = false ) { $ this -> start = null ; $ this -> stop = null ; $ this -> laps = [ ] ; if ( $ clearContext ) { $ this -> context = null ; } return $ this ; }
Clear profile .
25,289
public function clearAll ( $ clearContext = false ) { foreach ( $ this -> getProfiles ( ) as $ child ) { $ child -> clearAll ( $ clearContext ) ; } $ this -> clear ( $ clearContext ) ; return $ this ; }
Clear this and all child profiles .
25,290
public function get ( string $ profile ) { if ( ! $ this -> has ( $ profile ) ) { throw new Exception ( "Profile {$profile} does not exist." ) ; } return $ this -> children [ $ profile ] ; }
Get child profile .
25,291
public function note ( $ message = 'Note' , $ context = [ ] , $ level = null ) { if ( is_array ( $ message ) ) { $ level = $ context ? : null ; $ context = $ message ; $ message = 'Note' ; } if ( is_null ( $ message ) ) { return $ this ; } if ( $ this -> context ) { $ context = array_merge ( $ this -> context -> all ( ) , $ context ) ; } $ context [ 'profile' ] = $ this -> name ; if ( isset ( $ context [ 'runtime' ] ) ) { $ formatter = $ this -> getFormatter ( ) ; $ context [ 'runtime' ] = $ formatter ( $ context [ 'runtime' ] ) ; } $ this -> logger -> log ( $ level ? : $ this -> level , $ message , $ context ) ; return $ this ; }
Log note for this profile .
25,292
public function remove ( string $ profile ) { $ child = $ this -> get ( $ profile ) ; $ child -> clearAll ( ) ; $ child -> removeAll ( ) ; unset ( $ this -> children [ $ profile ] ) ; return $ this ; }
Removes specified child profile from this profile .
25,293
public function removeAll ( ) { foreach ( $ this -> getProfiles ( ) as $ profile => $ child ) { $ this -> remove ( $ profile ) ; } return $ this ; }
Removes all child profiles from this profile .
25,294
public function restart ( $ message = 'Restart' , $ context = [ ] ) { if ( is_array ( $ message ) ) { $ context = $ message ; $ message = 'Restart' ; } $ this -> clear ( ) ; $ this -> start ( $ message , $ context ) ; }
Clear and start profile again .
25,295
public function set ( string $ profile , $ inheritContext = false ) { return $ this -> has ( $ profile ) ? $ this -> get ( $ profile ) : $ this -> add ( $ profile , $ inheritContext ) ; }
Set and use profile .
25,296
public function start ( $ message = 'Start' , $ context = [ ] ) { if ( is_array ( $ message ) ) { $ context = $ message ; $ message = 'Start' ; } if ( $ this -> isStarted ( ) ) { throw new Exception ( "Profile {$this->getName()} already started." ) ; } if ( null === $ this -> name ) { if ( $ this -> children ) { throw new Exception ( "Profile {$this->getName()} must be started before all other profiles." ) ; } $ timeStart = $ _SERVER [ 'REQUEST_TIME_FLOAT' ] ?? $ this -> timeCurrent ( ) ; } else { $ timeStart = $ this -> timeCurrent ( ) ; } $ this -> start = $ timeStart ; $ this -> laps [ ] = $ timeStart ; $ this -> note ( $ message , $ context ) ; return $ this ; }
Start this profile .
25,297
public function startAll ( $ message = 'Start' , $ context = [ ] ) { if ( ! $ this -> isStarted ( ) ) { $ this -> start ( $ message , $ context ) ; } foreach ( $ this -> getProfiles ( ) as $ child ) { $ child -> startAll ( $ message , $ context ) ; } return $ this ; }
Start this and all child profiles .
25,298
public function stop ( $ message = 'Stop' , $ context = [ ] , $ lap = true ) { if ( is_array ( $ message ) ) { $ lap = $ context ; $ context = $ message ; $ message = 'Stop' ; } elseif ( is_bool ( $ message ) ) { $ lap = $ message ; $ context = [ ] ; $ message = 'Stop' ; } elseif ( is_bool ( $ context ) ) { $ lap = $ context ; $ context = [ ] ; } if ( ! $ this -> isRunning ( ) ) { throw new Exception ( "Profile {$this->getName()} not running." ) ; } if ( $ lap && count ( $ this -> laps ) > 1 ) { $ this -> lap ( ) ; } $ this -> stop = $ this -> timeCurrent ( ) ; $ context [ 'runtime' ] = $ this -> timeTotal ( ) ; $ this -> note ( $ message , $ context ) ; return $ this ; }
Stop this profile .
25,299
public function stopAll ( $ message = 'Stop' , $ context = [ ] , $ lap = true ) { foreach ( $ this -> getProfiles ( true ) as $ child ) { $ child -> stopAll ( $ message , $ context , $ lap ) ; } if ( $ this -> isRunning ( ) ) { $ this -> stop ( $ message , $ context , $ lap ) ; } return $ this ; }
Stop this profile and all children of this profile .