idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
38,600
public static function importAuthenticationKey ( HiddenString $ keyData ) : AuthenticationKey { return new AuthenticationKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load a symmetric authentication key from a string
38,601
public static function importEncryptionKey ( HiddenString $ keyData ) : EncryptionKey { return new EncryptionKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load a symmetric encryption key from a string
38,602
public static function importEncryptionPublicKey ( HiddenString $ keyData ) : EncryptionPublicKey { return new EncryptionPublicKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load specifically an encryption public key from a string
38,603
public static function importEncryptionSecretKey ( HiddenString $ keyData ) : EncryptionSecretKey { return new EncryptionSecretKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load specifically an encryption secret key from a string
38,604
public static function importSignaturePublicKey ( HiddenString $ keyData ) : SignaturePublicKey { return new SignaturePublicKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load specifically a signature public key from a string
38,605
public static function importSignatureSecretKey ( HiddenString $ keyData ) : SignatureSecretKey { return new SignatureSecretKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ; }
Load specifically a signature secret key from a string
38,606
public static function importEncryptionKeyPair ( HiddenString $ keyData ) : EncryptionKeyPair { return new EncryptionKeyPair ( new EncryptionSecretKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ) ; }
Load an asymmetric encryption key pair from a string
38,607
public static function importSignatureKeyPair ( HiddenString $ keyData ) : SignatureKeyPair { return new SignatureKeyPair ( new SignatureSecretKey ( new HiddenString ( self :: getKeyDataFromString ( Hex :: decode ( $ keyData -> getString ( ) ) ) ) ) ) ; }
Load an asymmetric signature key pair from a string
38,608
public static function loadAuthenticationKey ( string $ filePath ) : AuthenticationKey { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new AuthenticationKey ( self :: loadKeyFile ( $ filePath ) ) ; }
Load a symmetric authentication key from a file
38,609
public static function loadEncryptionKey ( string $ filePath ) : EncryptionKey { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new EncryptionKey ( self :: loadKeyFile ( $ filePath ) ) ; }
Load a symmetric encryption key from a file
38,610
public static function loadSignaturePublicKey ( string $ filePath ) : SignaturePublicKey { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new SignaturePublicKey ( self :: loadKeyFile ( $ filePath ) ) ; }
Load specifically a signature public key from a file
38,611
public static function loadSignatureSecretKey ( string $ filePath ) : SignatureSecretKey { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new SignatureSecretKey ( self :: loadKeyFile ( $ filePath ) ) ; }
Load specifically a signature secret key from a file
38,612
public static function loadEncryptionKeyPair ( string $ filePath ) : EncryptionKeyPair { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new EncryptionKeyPair ( new EncryptionSecretKey ( self :: loadKeyFile ( $ filePath ) ) ) ; }
Load an asymmetric encryption key pair from a file
38,613
public static function loadSignatureKeyPair ( string $ filePath ) : SignatureKeyPair { if ( ! \ is_readable ( $ filePath ) ) { throw new CannotPerformOperation ( 'Cannot read keyfile: ' . $ filePath ) ; } return new SignatureKeyPair ( new SignatureSecretKey ( self :: loadKeyFile ( $ filePath ) ) ) ; }
Load an asymmetric signature key pair from a file
38,614
protected static function loadKeyFile ( string $ filePath ) : HiddenString { $ fileData = \ file_get_contents ( $ filePath ) ; if ( $ fileData === false ) { throw new CannotPerformOperation ( 'Cannot load key from file: ' . $ filePath ) ; } $ data = Hex :: decode ( $ fileData ) ; \ sodium_memzero ( $ fileData ) ; retur...
Read a key from a file verify its checksum
38,615
public function configureProviderPlugins ( ContainerBuilder $ container , array $ config , string $ providerServiceId ) : array { $ plugins = [ ] ; foreach ( $ config [ 'plugins' ] as $ plugin ) { if ( $ plugin [ 'reference' ] [ 'enabled' ] ) { $ plugins [ ] = $ plugin [ 'reference' ] [ 'id' ] ; } } if ( isset ( $ conf...
Configure plugins for a client .
38,616
public function getTotalDuration ( ) : float { $ time = 0 ; foreach ( $ this -> data [ 'queries' ] as $ command ) { $ time += $ command [ 'duration' ] ; } return $ time ; }
Returns the execution time of all collected requests in seconds .
38,617
protected function getRootNode ( TreeBuilder $ treeBuilder , string $ name ) { if ( \ method_exists ( $ treeBuilder , 'getRootNode' ) ) { return $ treeBuilder -> getRootNode ( ) ; } else { return $ treeBuilder -> root ( $ name ) ; } }
Proxy to get root node for Symfony < 4 . 2 .
38,618
private function createClientPluginNode ( ) { $ builder = new TreeBuilder ( 'plugins' ) ; $ node = $ this -> getRootNode ( $ builder , 'plugins' ) ; $ pluginList = $ node -> info ( 'A list of plugin service ids. The order is important.' ) -> prototype ( 'array' ) ; $ pluginList -> beforeNormalization ( ) -> always ( fu...
Create plugin node of a client .
38,619
public function getOne ( ) { $ query = $ this -> prepareQuery ( func_get_args ( ) ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { $ row = $ this -> fetch ( $ res ) ; if ( is_array ( $ row ) ) { return reset ( $ row ) ; } $ this -> free ( $ res ) ; } return FALSE ; }
Helper function to get scalar value right out of query and optional arguments
38,620
public function getRow ( ) { $ query = $ this -> prepareQuery ( func_get_args ( ) ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { $ ret = $ this -> fetch ( $ res ) ; $ this -> free ( $ res ) ; return $ ret ; } return FALSE ; }
Helper function to get single row right out of query and optional arguments
38,621
public function getCol ( ) { $ ret = array ( ) ; $ query = $ this -> prepareQuery ( func_get_args ( ) ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { while ( $ row = $ this -> fetch ( $ res ) ) { $ ret [ ] = reset ( $ row ) ; } $ this -> free ( $ res ) ; } return $ ret ; }
Helper function to get single column right out of query and optional arguments
38,622
public function getAll ( ) { $ ret = array ( ) ; $ query = $ this -> prepareQuery ( func_get_args ( ) ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { while ( $ row = $ this -> fetch ( $ res ) ) { $ ret [ ] = $ row ; } $ this -> free ( $ res ) ; } return $ ret ; }
Helper function to get all the rows of resultset right out of query and optional arguments
38,623
public function getInd ( ) { $ args = func_get_args ( ) ; $ index = array_shift ( $ args ) ; $ query = $ this -> prepareQuery ( $ args ) ; $ ret = array ( ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { while ( $ row = $ this -> fetch ( $ res ) ) { $ ret [ $ row [ $ index ] ] = $ row ; } $ this -> free ( $ res ) ; ...
Helper function to get all the rows of resultset into indexed array right out of query and optional arguments
38,624
public function getIndCol ( ) { $ args = func_get_args ( ) ; $ index = array_shift ( $ args ) ; $ query = $ this -> prepareQuery ( $ args ) ; $ ret = array ( ) ; if ( $ res = $ this -> rawQuery ( $ query ) ) { while ( $ row = $ this -> fetch ( $ res ) ) { $ key = $ row [ $ index ] ; unset ( $ row [ $ index ] ) ; $ ret ...
Helper function to get a dictionary - style array right out of query and optional arguments
38,625
public function whiteList ( $ input , $ allowed , $ default = FALSE ) { $ found = array_search ( $ input , $ allowed ) ; return ( $ found === FALSE ) ? $ default : $ allowed [ $ found ] ; }
function to implement whitelisting feature sometimes we can t allow a non - validated user - supplied data to the query even through placeholder especially if it comes down to SQL OPERATORS
38,626
public function filterArray ( $ input , $ allowed ) { foreach ( array_keys ( $ input ) as $ key ) { if ( ! in_array ( $ key , $ allowed ) ) { unset ( $ input [ $ key ] ) ; } } return $ input ; }
function to filter out arrays for the whitelisting purposes useful to pass entire superglobal to the INSERT or UPDATE query OUGHT to be used for this purpose as there could be fields to which user should have no access to .
38,627
protected function rawQuery ( $ query ) { $ start = microtime ( TRUE ) ; $ res = mysqli_query ( $ this -> conn , $ query ) ; $ timer = microtime ( TRUE ) - $ start ; $ this -> stats [ ] = array ( 'query' => $ query , 'start' => $ start , 'timer' => $ timer , ) ; if ( ! $ res ) { $ error = mysqli_error ( $ this -> conn ...
protected function which actually runs a query against Mysql server . also logs some stats like profiling info and error message
38,628
protected function cutStats ( ) { if ( count ( $ this -> stats ) > 100 ) { reset ( $ this -> stats ) ; $ first = key ( $ this -> stats ) ; unset ( $ this -> stats [ $ first ] ) ; } }
On a long run we can eat up too much memory with mere statsistics Let s keep it at reasonable size leaving only last 100 entries .
38,629
public function headers ( $ assoc = false ) { if ( ! $ assoc ) { return $ this -> headers ; } return $ this -> prettifyHeaders ( $ this -> headers ) ; }
The response headers
38,630
private function prettifyHeaders ( array $ headers ) { return array_reduce ( array_filter ( $ headers ) , function ( $ result , $ header ) { if ( false === strpos ( $ header , ':' ) ) { $ result [ 'Status' ] = trim ( $ header ) ; return $ result ; } list ( $ key , $ value ) = explode ( ':' , $ header , 2 ) ; $ result [...
Returns response headers as associative array
38,631
private function buildUrl ( $ queryParams = null ) { $ path = '/' . implode ( '/' , $ this -> path ) ; if ( isset ( $ queryParams ) ) { $ path .= '?' . http_build_query ( $ queryParams ) ; } return sprintf ( '%s%s%s' , $ this -> host , $ this -> version ? : '' , $ path ) ; }
Build the final URL to be passed
38,632
private function createCurlOptions ( $ method , $ body = null , $ headers = null ) { $ options = [ CURLOPT_RETURNTRANSFER => true , CURLOPT_HEADER => true , CURLOPT_CUSTOMREQUEST => strtoupper ( $ method ) , CURLOPT_SSL_VERIFYPEER => true , CURLOPT_FAILONERROR => false ] + $ this -> curlOptions ; if ( isset ( $ headers...
Creates curl options for a request this function does not mutate any private variables
38,633
public function makeRequest ( $ method , $ url , $ body = null , $ headers = null , $ retryOnLimit = false ) { $ channel = curl_init ( $ url ) ; $ options = $ this -> createCurlOptions ( $ method , $ body , $ headers ) ; curl_setopt_array ( $ channel , $ options ) ; $ content = curl_exec ( $ channel ) ; $ response = $ ...
Make the API call and return the response . This is separated into it s own function so we can mock it easily for testing .
38,634
public function makeAllRequests ( array $ requests = [ ] ) { if ( empty ( $ requests ) ) { $ requests = $ this -> savedRequests ; } list ( $ channels , $ multiHandle ) = $ this -> createCurlMultiHandle ( $ requests ) ; $ isRunning = null ; do { curl_multi_exec ( $ multiHandle , $ isRunning ) ; } while ( $ isRunning ) ;...
Send all saved requests at once
38,635
public function getMethodLimits ( string $ api_key , string $ region , string $ endpoint ) { return @ $ this -> limits [ $ region ] [ $ api_key ] [ 'method' ] [ $ endpoint ] ; }
Returns interval limits for provided API key on provided region .
38,636
public function canCall ( string $ api_key , string $ region , string $ resource , string $ endpoint ) : bool { $ appLimits = $ this -> getAppLimits ( $ api_key , $ region ) ; if ( is_array ( $ appLimits ) && $ resource != LeagueAPI :: RESOURCE_STATICDATA ) { foreach ( $ appLimits as $ timeInterval => $ limits ) { if (...
Determines whether or not API call can be made .
38,637
public function save ( string $ name , $ data , int $ length ) : bool { return $ this -> memcached -> set ( $ name , $ data , $ length ) ; }
Saves data to cache memory .
38,638
public function isSaved ( string $ name ) : bool { return $ this -> load ( $ name ) !== false || $ this -> memcached -> getResultCode ( ) !== \ Memcached :: RES_NOTFOUND ; }
Checks whether or not is saved in cache .
38,639
public function load ( string $ name , bool $ returnStorage = false ) { $ path = $ this -> cacheDir . DIRECTORY_SEPARATOR . $ name ; $ res = @ fopen ( $ path , 'r' ) ; if ( $ res == false ) return false ; $ storage = @ unserialize ( fread ( $ res , filesize ( $ path ) ) ) ; fclose ( $ res ) ; if ( $ returnStorage ) ret...
Loads data stored in file .
38,640
public function save ( string $ name , $ data , int $ length ) : bool { if ( $ length <= 0 ) throw new SettingsException ( "Expiration time has to be greater than 0." ) ; $ path = $ this -> cacheDir . DIRECTORY_SEPARATOR . $ name ; $ res = @ fopen ( $ path , 'w+' ) ; if ( $ res == false ) throw new SettingsException ( ...
Saves data to file .
38,641
protected function _setupCacheProvider ( ) { if ( $ this -> isSettingSet ( self :: SET_CACHE_PROVIDER ) == false || ( $ this -> getSetting ( self :: SET_CACHE_PROVIDER ) == self :: CACHE_PROVIDER_FILE && $ this -> isSettingSet ( self :: SET_CACHE_PROVIDER_PARAMS ) == false ) ) { $ this -> setSettings ( [ self :: SET_CA...
Initializes library cache provider .
38,642
public function _setupCacheCalls ( ) { if ( $ this -> isSettingSet ( self :: SET_CACHE_CALLS_LENGTH ) == false ) { $ this -> setSetting ( self :: SET_CACHE_CALLS_LENGTH , [ self :: RESOURCE_CHAMPION => 60 * 10 , self :: RESOURCE_CHAMPIONMASTERY => 60 * 60 , self :: RESOURCE_LEAGUE => 60 * 10 , self :: RESOURCE_MATCH =>...
Initializes library call caching .
38,643
protected function _setupBeforeCalls ( ) { $ this -> beforeCall [ ] = function ( ) { if ( $ this -> getSetting ( self :: SET_CACHE_RATELIMIT ) && $ this -> rlc != false ) if ( $ this -> rlc -> canCall ( $ this -> getSetting ( $ this -> used_key ) , $ this -> getSetting ( self :: SET_REGION ) , $ this -> getResource ( )...
Sets up internal callbacks - before the call is made .
38,644
protected function _setupAfterCalls ( ) { $ this -> afterCall [ ] = function ( ) { if ( $ this -> getSetting ( self :: SET_CACHE_RATELIMIT , false ) && $ this -> rlc != false ) $ this -> rlc -> registerLimits ( $ this -> getSetting ( $ this -> used_key ) , $ this -> getSetting ( self :: SET_REGION ) , $ this -> getReso...
Sets up internal callbacks - after the call is made .
38,645
protected function loadCache ( ) { if ( $ this -> getSetting ( self :: SET_CACHE_RATELIMIT , false ) ) { $ rlc = $ this -> cache -> load ( self :: CACHE_KEY_RLC ) ; if ( $ rlc == false ) $ rlc = new RateLimitControl ( $ this -> regions ) ; $ this -> rlc = $ rlc ; } if ( $ this -> getSetting ( self :: SET_CACHE_CALLS , ...
Loads required cache objects
38,646
protected function saveCache ( ) { if ( $ this -> getSetting ( self :: SET_CACHE_RATELIMIT , false ) ) { $ this -> cache -> save ( self :: CACHE_KEY_RLC , $ this -> rlc , $ this -> rlc_savetime ) ; } if ( $ this -> getSetting ( self :: SET_CACHE_CALLS , false ) ) { $ this -> cache -> save ( self :: CACHE_KEY_CCC , $ th...
Saves required cache objects .
38,647
public function setSetting ( string $ name , $ value ) : self { if ( in_array ( $ name , self :: SETTINGS_INIT_ONLY ) ) throw new SettingsException ( "Settings option '$name' can only be set on initialization of the library." ) ; $ this -> settings [ $ name ] = $ value ; return $ this ; }
Sets new value for specified key in settings .
38,648
public function setRegion ( string $ region ) : self { $ this -> setSetting ( self :: SET_REGION , $ this -> regions -> getRegionName ( $ region ) ) ; $ this -> setSetting ( self :: SET_PLATFORM , $ this -> platforms -> getPlatformName ( $ region ) ) ; return $ this ; }
Sets new region to be used on API calls .
38,649
public function setTemporaryRegion ( string $ tempRegion ) : self { $ this -> setSetting ( self :: SET_ORIG_REGION , $ this -> getSetting ( self :: SET_REGION ) ) ; $ this -> setSetting ( self :: SET_REGION , $ this -> regions -> getRegionName ( $ tempRegion ) ) ; $ this -> setSetting ( self :: SET_PLATFORM , $ this ->...
Sets temporary region to be used on API calls . Saves current region .
38,650
public function unsetTemporaryRegion ( ) : self { if ( $ this -> isSettingSet ( self :: SET_ORIG_REGION ) ) { $ region = $ this -> getSetting ( self :: SET_ORIG_REGION ) ; $ this -> setSetting ( self :: SET_REGION , $ region ) ; $ this -> setSetting ( self :: SET_PLATFORM , $ this -> platforms -> getPlatformName ( $ re...
Unets temporary region and returns original region .
38,651
protected function setResource ( string $ resource , string $ endpoint ) : self { $ this -> resource = $ resource ; $ this -> resource_endpoint = $ endpoint ; return $ this ; }
Sets call resource for target endpoint .
38,652
protected function addQuery ( string $ name , $ value ) : self { if ( ! is_null ( $ value ) ) { $ this -> query_data [ $ name ] = $ value ; } return $ this ; }
Adds GET parameter to called URL .
38,653
public function nextAsync ( callable $ onFulfilled = null , callable $ onRejected = null , string $ group = "default" ) : self { $ client = @ $ this -> async_clients [ $ group ] ; if ( ! $ client ) $ this -> async_clients [ $ group ] = $ client = new Client ( ) ; $ this -> async_requests [ $ group ] [ ] = $ this -> nex...
Adds next API call to given async request group . Sending needs to be initiated by calling commitAsync function .
38,654
public function commitAsync ( string $ group = "default" ) { $ list = [ ] ; $ requests = @ $ this -> async_requests [ $ group ] ? : [ ] ; foreach ( $ requests as $ request ) $ list [ ] = $ request -> getPromise ( ) ; unset ( $ this -> async_requests [ $ group ] ) ; settle ( $ list ) -> wait ( ) ; }
Initiates async requests from given group . Waits until completed .
38,655
public function getChampionRotations ( ) { $ resultPromise = $ this -> setEndpoint ( "/lol/platform/" . self :: RESOURCE_CHAMPION_VERSION . "/champion-rotations" ) -> setResource ( self :: RESOURCE_CHAMPION , "/champion-rotations" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueuePromise ( $ resultPromise , function...
Retrieve current champion rotations .
38,656
public function getCurrentGameInfo ( string $ encrypted_summoner_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/spectator/" . self :: RESOURCE_SPECTATOR_VERSION . "/active-games/by-summoner/{$encrypted_summoner_id}" ) -> setResource ( self :: RESOURCE_SPECTATOR , "/active-games/by-summoner/%s" ) -> makeCall ( )...
Get current game information for the given summoner ID .
38,657
public function getFeaturedGames ( ) { $ resultPromise = $ this -> setEndpoint ( "/lol/spectator/" . self :: RESOURCE_SPECTATOR_VERSION . "/featured-games" ) -> setResource ( self :: RESOURCE_SPECTATOR , "/featured-games" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueuePromise ( $ resultPromise , function ( array ...
Get list of featured games .
38,658
public function getLeagueById ( string $ league_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/league/" . self :: RESOURCE_LEAGUE_VERSION . "/leagues/{$league_id}" ) -> setResource ( self :: RESOURCE_LEAGUE , "/leagues/%s" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueuePromise ( $ resultPromise , function...
Get league by its UUID .
38,659
public function getLeaguePositionsForSummoner ( string $ encrypted_summoner_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/league/" . self :: RESOURCE_LEAGUE_VERSION . "/positions/by-summoner/{$encrypted_summoner_id}" ) -> setResource ( self :: RESOURCE_LEAGUE , "/positions/by-summoner/%s" ) -> makeCall ( ) ; r...
Get leagues mapped by summoner ID for a given list of summoner IDs .
38,660
public function getLeagueEntriesForSummoner ( string $ encrypted_summoner_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/league/" . self :: RESOURCE_LEAGUE_VERSION . "/entries/by-summoner/{$encrypted_summoner_id}" ) -> setResource ( self :: RESOURCE_LEAGUE , "/entries/by-summoner/%s" ) -> makeCall ( ) ; return ...
Get league entries in all queues for a given summoner ID .
38,661
public function getLeagueEntries ( string $ queue , string $ tier , string $ division ) { $ resultPromise = $ this -> setEndpoint ( "/lol/league/" . self :: RESOURCE_LEAGUE_VERSION . "/entries/{$queue}/{$tier}/{$division}" ) -> setResource ( self :: RESOURCE_LEAGUE , "/entries/%s/%s/%s" ) -> makeCall ( ) ; return $ thi...
Get all the league entries .
38,662
public function getLeagueGrandmaster ( string $ game_queue_type ) { $ resultPromise = $ this -> setEndpoint ( "/lol/league/" . self :: RESOURCE_LEAGUE_VERSION . "/grandmasterleagues/by-queue/{$game_queue_type}" ) -> setResource ( self :: RESOURCE_LEAGUE , "/grandmasterleagues/by-queue/%s" ) -> makeCall ( ) ; return $ t...
Get grandmaster tier leagues .
38,663
public function getStaticChampions ( bool $ data_by_key = null , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticChampionListDto { $ result = false ; try { if ( $ data_by_key ) $ result = DataDragonAPI :: getStaticChampionsWithKeys ( $ locale , $ version ) ; else $ result = DataDragonAPI :: g...
Retrieves champion list .
38,664
public function getStaticChampion ( int $ champion_id , bool $ extended = false , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticChampionDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticChampionByKey ( $ champion_id , $ locale , $ version ) ; if ( $ extended && $ result ) ...
Retrieves a champion by its numeric key .
38,665
public function getStaticItems ( string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticItemListDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticItems ( $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loaded." ) ; array_walk ( $ resu...
Retrieves item list .
38,666
public function getStaticItem ( int $ item_id , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticItemDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticItem ( $ item_id , $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loaded." )...
Retrieves item by its unique ID .
38,667
public function getStaticMaps ( string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticMapDataDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticMaps ( $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loaded." ) ; $ this -> result_data ...
Retrieve map data .
38,668
public function getStaticMastery ( int $ mastery_id , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticMasteryDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticMastery ( $ mastery_id , $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed t...
Retrieves mastery by its unique ID .
38,669
public function getStaticReforgedRunePaths ( string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticReforgedRunePathList { $ result = false ; try { $ result = DataDragonAPI :: getStaticReforgedRunes ( $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loa...
Retrieve reforged rune path .
38,670
public function getStaticRune ( int $ rune_id , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticRuneDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticRune ( $ rune_id , $ locale , $ version ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loaded." )...
Retrieves rune by its unique ID .
38,671
public function getStaticSummonerSpells ( bool $ data_by_key = false , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticSummonerSpellListDto { $ result = false ; try { if ( $ data_by_key ) $ result = DataDragonAPI :: getStaticSummonerSpellsWithKeys ( $ locale , $ version ) ; else $ result = Da...
Retrieves summoner spell list .
38,672
public function getStaticSummonerSpell ( int $ summoner_spell_id , string $ locale = 'en_US' , string $ version = null ) : StaticData \ StaticSummonerSpellDto { $ result = false ; try { $ result = DataDragonAPI :: getStaticSummonerSpellById ( $ summoner_spell_id , $ locale , $ version ) ; if ( ! $ result ) throw new Se...
Retrieves summoner spell by its unique numeric key .
38,673
public function getStaticVersions ( ) : array { $ result = false ; try { $ result = DataDragonAPI :: getStaticVersions ( ) ; if ( ! $ result ) throw new ServerException ( "StaticData failed to be loaded." ) ; $ this -> result_data = $ result ; } catch ( DataDragonExceptions \ ArgumentException $ ex ) { throw new Reques...
Retrieve version data .
38,674
public function getStatusData ( string $ override_region = null ) { $ resultPromise = $ this -> setEndpoint ( "/lol/status/" . self :: RESOURCE_STATUS_VERSION . "/shard-data" ) -> setResource ( self :: RESOURCE_STATICDATA , "/shard-data" ) -> makeCall ( $ override_region ) ; return $ this -> resolveOrEnqueuePromise ( $...
Get status data - shard list .
38,675
public function getMatch ( $ match_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/match/" . self :: RESOURCE_MATCH_VERSION . "/matches/{$match_id}" ) -> setResource ( self :: RESOURCE_MATCH , "/matches/%i" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueuePromise ( $ resultPromise , function ( array $ result...
Retrieve match by match ID .
38,676
public function getMatchByTournamentCode ( $ match_id , string $ tournament_code ) { $ resultPromise = $ this -> setEndpoint ( "/lol/match/" . self :: RESOURCE_MATCH_VERSION . "/matches/{$match_id}/by-tournament-code/{$tournament_code}" ) -> setResource ( self :: RESOURCE_MATCH , "/matches/%i/by-tournament-code/%s" ) -...
Retrieve match by match ID and tournament code .
38,677
public function getMatchIdsByTournamentCode ( string $ tournament_code ) { $ resultPromise = $ this -> setEndpoint ( "/lol/match/" . self :: RESOURCE_MATCH_VERSION . "/matches/by-tournament-code/{$tournament_code}/ids" ) -> setResource ( self :: RESOURCE_MATCH , "/matches/by-tournament-code/%s/ids" ) -> makeCall ( ) ; ...
Retrieve list of match IDs by tournament code .
38,678
public function getMatchlistByAccount ( string $ encrypted_account_id , $ queue = null , $ season = null , $ champion = null , int $ beginTime = null , int $ endTime = null , int $ beginIndex = null , int $ endIndex = null ) : Objects \ MatchlistDto { $ resultPromise = $ this -> setEndpoint ( "/lol/match/" . self :: RE...
Retrieve matchlist by account ID .
38,679
public function getMatchTimeline ( $ match_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/match/" . self :: RESOURCE_MATCH_VERSION . "/timelines/by-match/{$match_id}" ) -> setResource ( self :: RESOURCE_MATCH , "/timelines/by-match/%i" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueuePromise ( $ resultPromi...
Retrieve matchlsit by account ID .
38,680
public function getSummoner ( string $ encrypted_summoner_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/summoner/" . self :: RESOURCE_SUMMONER_VERSION . "/summoners/{$encrypted_summoner_id}" ) -> setResource ( self :: RESOURCE_SUMMONER , "/summoners/%s" ) -> makeCall ( ) ; return $ this -> resolveOrEnqueueProm...
Get single summoner object for a given summoner ID .
38,681
public function getSummonerByName ( string $ summoner_name ) { $ summoner_name = str_replace ( ' ' , '' , $ summoner_name ) ; $ resultPromise = $ this -> setEndpoint ( "/lol/summoner/" . self :: RESOURCE_SUMMONER_VERSION . "/summoners/by-name/{$summoner_name}" ) -> setResource ( self :: RESOURCE_SUMMONER , "/summoners/...
Get summoner name for a given summoner name .
38,682
public function getSummonerByAccount ( string $ encrypted_account_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/summoner/" . self :: RESOURCE_SUMMONER_VERSION . "/summoners/by-account/{$encrypted_account_id}" ) -> setResource ( self :: RESOURCE_SUMMONER , "/summoners/by-account/%s" ) -> makeCall ( ) ; return $...
Get single summoner object for a given summoner s account ID .
38,683
public function getThirdPartyCodeBySummonerId ( string $ encrypted_summoner_id ) { $ resultPromise = $ this -> setEndpoint ( "/lol/platform/" . self :: RESOURCE_THIRD_PARTY_CODE_VERSION . "/third-party-code/by-summoner/{$encrypted_summoner_id}" ) -> setResource ( self :: RESOURCE_THIRD_PARTY_CODE , "/third-party-code/b...
Get third party code for given summoner ID .
38,684
public function editTournamentCode ( string $ tournament_code , TournamentCodeUpdateParameters $ parameters ) { if ( $ this -> getSetting ( self :: SET_INTERIM , false ) ) throw new RequestException ( 'This endpoint is not available in interim mode.' ) ; if ( in_array ( $ parameters -> pickType , self :: TOURNAMENT_ALL...
Updates tournament code s settings .
38,685
public function getTournamentCodeData ( string $ tournament_code ) { if ( $ this -> getSetting ( self :: SET_INTERIM , false ) ) throw new RequestException ( 'This endpoint is not available in interim mode.' ) ; $ resultPromise = $ this -> setEndpoint ( "/lol/tournament/" . self :: RESOURCE_TOURNAMENT_VERSION . "/codes...
Retrieves tournament code settings for given tournament code .
38,686
public function createTournamentProvider ( ProviderRegistrationParameters $ parameters ) { if ( $ this -> getSetting ( self :: SET_INTERIM , false ) ) return $ this -> createTournamentProvider_STUB ( $ parameters ) ; if ( empty ( $ parameters -> url ) ) throw new RequestParameterException ( 'Callback URL (url) may not ...
Creates a tournament provider and returns its ID .
38,687
public function createTournament ( TournamentRegistrationParameters $ parameters ) { if ( $ this -> getSetting ( self :: SET_INTERIM , false ) ) return $ this -> createTournament_STUB ( $ parameters ) ; if ( empty ( $ parameters -> name ) ) throw new RequestParameterException ( 'Tournament name (name) may not be empty....
Creates a tournament and returns its ID .
38,688
public function getTournamentLobbyEvents ( string $ tournament_code ) { if ( $ this -> getSetting ( self :: SET_INTERIM , false ) ) return $ this -> getTournamentLobbyEvents_STUB ( $ tournament_code ) ; $ resultPromise = $ this -> setEndpoint ( "/lol/tournament/" . self :: RESOURCE_TOURNAMENT_VERSION . "/lobby-events/b...
Gets a list of lobby events by tournament code .
38,689
public function createTournamentCodes_STUB ( int $ tournament_id , int $ count , TournamentCodeParameters $ parameters ) { if ( $ parameters -> teamSize <= 0 ) throw new RequestParameterException ( 'Team size (teamSize) must be greater than or equal to 1.' ) ; if ( $ parameters -> teamSize >= 6 ) throw new RequestParam...
Create a mock tournament code for the given tournament .
38,690
public function createTournament_STUB ( TournamentRegistrationParameters $ parameters ) { if ( empty ( $ parameters -> name ) ) throw new RequestParameterException ( 'Tournament name (name) may not be empty.' ) ; if ( $ parameters -> providerId <= 0 ) throw new RequestParameterException ( 'ProviderID (providerId) must ...
Creates a mock tournament and returns its ID .
38,691
public function getTournamentLobbyEvents_STUB ( string $ tournament_code ) { $ resultPromise = $ this -> setEndpoint ( "/lol/tournament-stub/" . self :: RESOURCE_TOURNAMENT_STUB_VERSION . "/lobby-events/by-code/{$tournament_code}" ) -> setResource ( self :: RESOURCE_TOURNAMENT_STUB , "/lobby-events/by-code/%s" ) -> use...
Gets a mock list of lobby events by tournament code .
38,692
public function setPromise ( PromiseInterface $ promise ) : self { $ this -> promise = $ promise ; $ promise -> then ( $ this -> onFulfilled , $ this -> onRejected ) ; return $ this ; }
Promise setter .
38,693
public static function initByVersion ( string $ version , array $ customSettings = [ ] ) { self :: setSettings ( [ self :: SET_VERSION => $ version , self :: SET_ENDPOINT => self :: getCdnUrl ( ) , ] ) ; if ( ! empty ( $ customSettings ) ) self :: setSettings ( $ customSettings ) ; self :: $ initialized = true ; }
Creates new instance by specifying CDN version .
38,694
public static function initByRealmObject ( StaticRealmDto $ realm , array $ customSettings = [ ] ) { self :: setSettings ( [ self :: SET_ENDPOINT => $ realm -> cdn . "/" , self :: SET_VERSION => $ realm -> dd , ] ) ; if ( ! empty ( $ customSettings ) ) self :: setSettings ( $ customSettings ) ; self :: $ initialized = ...
Creates new instance from Realm object .
38,695
public static function setSettings ( array $ values ) { foreach ( $ values as $ name => $ value ) self :: setSetting ( $ name , $ value ) ; }
Sets new values for specified set of keys in settings .
38,696
public static function getStaticDataFileUrl ( string $ dataType , string $ key = null , $ locale = 'en_US' , $ version = null , string $ fragment = null ) : string { if ( is_null ( $ version ) ) self :: checkInit ( ) ; return self :: getCdnUrl ( ) . ( $ version ? : self :: getSetting ( self :: SET_VERSION ) ) . "/data/...
Returns static - data file URL based on given type .
38,697
protected static function loadStaticData ( string $ url , callable $ processing = null ) : array { $ urlHash = md5 ( $ url ) ; $ data = self :: loadCachedStaticData ( $ url ) ; if ( $ data ) return $ data ; $ data = @ file_get_contents ( $ url ) ; if ( $ data == false ) throw new ArgumentException ( "Failed to load sta...
Loads static - data for given URL . First from cache if it doesnt exist try to fetch up - to date from web .
38,698
public static function getProfileIconUrl ( int $ profile_icon_id ) : string { self :: checkInit ( ) ; return self :: getSetting ( self :: SET_ENDPOINT ) . self :: getSetting ( self :: SET_VERSION ) . "/img/profileicon/{$profile_icon_id}.png" ; }
Returns profile icon URL .
38,699
public static function getProfileIconO ( SummonerDto $ summoner , array $ attributes = [ ] ) : Html { return self :: getProfileIcon ( $ summoner -> profileIconId , $ attributes ) ; }
Returns profile icon from API static - data Summoner object in img HTML TAG .