idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
4,500 | public function ban ( $ banId ) { if ( ! isset ( $ this -> info [ 'bans' ] ) ) { return null ; } $ bans = $ this -> info [ 'bans' ] ; if ( isset ( $ bans [ $ banId ] ) ) { return $ bans [ $ banId ] ; } return null ; } | Attempts to get a ban from this team . |
4,501 | public function evaluate ( RenderingContextInterface $ renderingContext ) { return self :: getPropertyPath ( $ renderingContext -> getTemplateVariableContainer ( ) , $ this -> objectPath , $ renderingContext ) ; } | Evaluate this node and return the correct object . |
4,502 | private function checkRestPrefixValidity ( array $ restPrefixes ) { foreach ( $ restPrefixes as $ prefix ) { if ( ! is_string ( $ prefix ) ) { throw new DomainException ( 'All provided prefixes for REST must be string' ) ; } if ( strpos ( '/' , $ prefix ) ) { throw new DomainException ( 'Prefixes must not contain "/"' ... | Check if REST prefixes are valid or not . It will throw exception on error |
4,503 | protected function prepareMethodName ( ) { if ( PHP_SAPI === 'cli' ) { $ method = 'cli' ; } else { $ request = $ this -> getContainer ( ) -> get ( 'request' ) ; $ method = $ request -> getMethod ( ) ; } return ucfirst ( strtolower ( $ method ) ) . 'Method' ; } | Prepare method name choose between CLI and all other HTTP methods |
4,504 | protected function extractLanguage ( array & $ parts ) { if ( ! empty ( $ parts ) && in_array ( $ parts [ 0 ] , Config :: get ( 'languages.possible' , [ 'en' ] ) ) ) { $ this -> language = array_shift ( $ parts ) ; } else { $ this -> language = Config :: get ( 'languages.default' , 'en' ) ; } } | If route is prefixed with language extract it |
4,505 | protected function prepareRestRequest ( array & $ parts ) { if ( ! empty ( $ parts ) && in_array ( $ parts [ 0 ] , $ this -> restPrefixes ) ) { array_shift ( $ parts ) ; $ restRoute = $ restParams = [ ] ; $ i = 1 ; foreach ( $ parts as $ part ) { if ( $ i % 2 ) { $ restRoute [ ] = $ part ; } else { $ restParams [ ] = $... | Prepare REST requests |
4,506 | private function finalizeRouterArguments ( array $ parts , array $ camelizedParts , $ actionNamespace , $ bundleName , $ method ) { array_splice ( $ camelizedParts , 1 , 1 , 'Responder' ) ; $ responderNamespace = implode ( '\\' , $ camelizedParts ) . 'Responder' ; $ delta = ( $ this -> routingPhase == self :: ROUTING_P... | Finalize and set all route parameters |
4,507 | protected function connectionErrorHandler ( $ code , $ message , $ file , $ line , $ args ) { $ this -> connectionErrors [ ] = [ 'code' => $ code , 'message' => $ message , 'file' => $ file , 'line' => $ line , 'args' => $ args ] ; } | Connection error handler |
4,508 | public function after ( $ callback ) { $ container = Container :: getInstance ( ) ; $ this -> on ( 'after' , function ( $ request , $ response ) use ( & $ container , & $ callback ) { try { $ container -> call ( $ callback , func_get_args ( ) ) ; } catch ( \ Exception $ e ) { $ this -> emit ( 'error' , [ $ request , $ ... | Helper to listing to after event |
4,509 | public function game ( $ gameId ) { if ( ! isset ( $ this -> info [ 'games' ] [ $ gameId ] ) ) { return null ; } return $ this -> info [ 'games' ] [ $ gameId ] ; } | Get a game by the id . |
4,510 | public function addRoute ( $ method , $ route , $ callback ) { $ route = $ this -> router -> addRoute ( strtoupper ( $ method ) , $ this -> prefix . '/' . $ route , $ callback ) ; $ route -> onAny ( function ( $ event , $ arguments ) { $ this -> emit ( $ event , $ arguments ) ; } ) ; $ this -> routes [ ] = $ route ; re... | Create a new route for the group |
4,511 | public function canPay ( $ amount , $ userId ) { $ balance = config ( 'laravel_balance.user' ) :: find ( $ userId ) -> balance ( ) ; return ( $ balance < $ amount ) ? false : true ; } | Check if user can pay for transaction |
4,512 | public function hitLimits ( $ region , $ count = 1 ) { foreach ( $ this -> limits as $ limit ) { if ( $ limit -> getRegion ( ) == $ region && ! $ limit -> hit ( $ count ) ) { return false ; } } return true ; } | Hit the limit set for the given region . |
4,513 | public function remainingHits ( ) { $ remaining = null ; foreach ( $ this -> limits as $ limit ) { $ hitsLeft = $ limit -> remaining ( ) ; if ( is_null ( $ remaining ) || $ hitsLeft < $ remaining ) { $ remaining = $ hitsLeft ; } } return $ remaining ; } | Returns the lowest |
4,514 | public function set ( $ name , $ value = '' , $ expire = 0 , $ path = '/' , $ domain = '' , $ secure = false , $ httpOnly = false ) { if ( ! is_string ( $ name ) ) { throw new Cookie \ Exception ( 'The cookie name must be string' ) ; } if ( ! isset ( $ this -> cookies [ $ name ] ) ) { $ this -> cookies [ $ name ] = new... | Sets a cookie to be sent at the end of the request This method overrides any cookie set before with the same name |
4,515 | public function get ( $ name ) { if ( ! is_string ( $ name ) ) { throw new Cookie \ Exception ( 'The cookie name must be string' ) ; } if ( isset ( $ this -> cookies [ $ name ] ) ) { $ this -> cookies [ $ name ] -> useEncryption ( $ this -> isUsingEncryption ( ) ) ; return $ this -> cookies [ $ name ] ; } return null ;... | Gets a cookie from the bag |
4,516 | protected function getPartialRootPaths ( ) { if ( $ this -> options [ 'partialRootPaths' ] !== null ) { return $ this -> options [ 'partialRootPaths' ] ; } $ actionRequest = $ this -> controllerContext -> getRequest ( ) ; return array ( str_replace ( '@packageResourcesPath' , 'resource://' . $ actionRequest -> getContr... | Resolves the partial root to be used inside other paths . |
4,517 | protected function getLayoutIdentifier ( $ layoutName = 'Default' ) { $ layoutPathAndFilename = $ this -> getLayoutPathAndFilename ( $ layoutName ) ; $ prefix = 'layout_' . $ layoutName ; return $ this -> createIdentifierForFile ( $ layoutPathAndFilename , $ prefix ) ; } | Returns a unique identifier for the resolved layout file . This identifier is based on the template path and last modification date |
4,518 | protected function getPartialIdentifier ( $ partialName ) { $ partialPathAndFilename = $ this -> getPartialPathAndFilename ( $ partialName ) ; $ prefix = 'partial_' . $ partialName ; return $ this -> createIdentifierForFile ( $ partialPathAndFilename , $ prefix ) ; } | Returns a unique identifier for the resolved partial file . This identifier is based on the template path and last modification date |
4,519 | protected function getPartialSource ( $ partialName ) { $ partialPathAndFilename = $ this -> getPartialPathAndFilename ( $ partialName ) ; $ partialSource = Files :: getFileContents ( $ partialPathAndFilename , FILE_TEXT ) ; if ( $ partialSource === false ) { throw new Exception \ InvalidTemplateResourceException ( '"'... | Figures out which partial to use . |
4,520 | public function canRender ( ControllerContext $ controllerContext ) { $ this -> setControllerContext ( $ controllerContext ) ; try { $ this -> getTemplateSource ( ) ; return true ; } catch ( Exception \ InvalidTemplateResourceException $ e ) { return false ; } } | Checks whether a template can be resolved for the current request context . |
4,521 | public function item ( $ key ) { if ( ! isset ( $ this -> info [ 'items' ] [ $ key ] ) ) { return null ; } return $ this -> info [ 'items' ] [ $ key ] ; } | Gets the item by key . |
4,522 | public function forward ( $ uri , $ method = Request :: METHOD_GET ) { if ( 'cli' === PHP_SAPI ) { throw new BaseException ( 'You can not call forward method in cli mode.' ) ; } $ request = $ this -> getRequest ( ) -> withMethod ( $ method ) ; $ this -> getContainer ( ) -> setShared ( 'request' , $ request ) ; $ oldRou... | Forward to other action without redirect |
4,523 | public function subscribe ( EventManager $ eventManager ) { $ eventManager -> attach ( self :: EVENT_BEFORE_WEB_METHOD , [ $ this , 'beforeWebMethod' ] ) -> attach ( self :: EVENT_AFTER_WEB_METHOD , [ $ this , 'afterWebMethod' ] ) -> attach ( self :: EVENT_BEFORE_CLI_METHOD , [ $ this , 'beforeCLiMethod' ] ) -> attach ... | Subscribe event listener |
4,524 | public function match ( $ matchPosition ) { if ( ! isset ( $ this -> info [ 'matches' ] [ $ matchPosition ] ) ) { return null ; } return $ this -> info [ 'matches' ] [ $ matchPosition ] ; } | Get a match by position . |
4,525 | protected function getTranslatedLabel ( $ value , $ label ) { $ translationConfiguration = $ this -> arguments [ 'translate' ] ; $ translateBy = isset ( $ translationConfiguration [ 'by' ] ) ? $ translationConfiguration [ 'by' ] : 'id' ; $ sourceName = isset ( $ translationConfiguration [ 'source' ] ) ? $ translationCo... | Returns a translated version of the given label |
4,526 | public static function create ( $ oAuthProvider ) { if ( strpos ( $ oAuthProvider , '\\' ) !== false ) { if ( class_exists ( $ oAuthProvider ) ) { $ providerInstance = new $ oAuthProvider ( ) ; if ( ! ( $ providerInstance instanceof AbstractOAuthProvider ) ) { throw new Exception ( sprintf ( 'OAuth provider "%s" must b... | Create OAuth provider |
4,527 | public function init ( ) { error_reporting ( E_ALL ) ; ini_set ( 'display_errors' , 1 ) ; if ( file_exists ( $ this -> baseDir . '/vendor/autoload.php' ) ) { require_once ( $ this -> baseDir . '/vendor/autoload.php' ) ; } else { require_once ( $ this -> baseDir . '/autoload.php' ) ; } require_once ( $ this -> baseDir .... | Configure php to display errors and load all required file |
4,528 | public function loadConfig ( ) { if ( file_exists ( $ this -> baseDir . '/examples/config.php' ) ) { include_once ( $ this -> baseDir . '/examples/config.php' ) ; } else { define ( 'SECRET' , readline ( 'Secret: ' ) ) ; define ( 'API_HOST' , readline ( 'Api host: ' ) ) ; $ configTemplate = "<?php" . PHP_EOL . "define('... | Load config file when it exists ; otherwise create it by asking the user on command line for the required files |
4,529 | public function render ( $ value = null , $ decimals = 0 , $ decimalSeparator = '.' , $ thousandsSeparator = ',' ) { return self :: renderStatic ( array ( 'value' => $ value , 'decimals' => $ decimals , 'decimalSeparator' => $ decimalSeparator , 'thousandsSeparator' => $ thousandsSeparator ) , $ this -> buildRenderChil... | Render the supplied byte count as a human readable string . |
4,530 | public static function postParseEvent ( ViewHelperNode $ syntaxTreeNode , array $ viewHelperArguments , TemplateVariableContainer $ variableContainer ) { if ( isset ( $ viewHelperArguments [ 'name' ] ) ) { $ layoutNameNode = $ viewHelperArguments [ 'name' ] ; } else { $ layoutNameNode = new TextNode ( 'Default' ) ; } $... | On the post parse event add the layoutName variable to the variable container so it can be used by the TemplateView . |
4,531 | protected function renderAsList ( array $ flashMessages ) { $ flashMessagesClass = $ this -> arguments [ 'class' ] !== null ? $ this -> arguments [ 'class' ] : 'flashmessages' ; $ tagContent = '' ; foreach ( $ flashMessages as $ singleFlashMessage ) { $ severityClass = sprintf ( '%s-%s' , $ flashMessagesClass , strtolo... | Render the flash messages as unsorted list . This is triggered if no as argument is given to the ViewHelper . |
4,532 | protected function renderFromTemplate ( array $ flashMessages , $ as ) { $ templateVariableContainer = $ this -> renderingContext -> getTemplateVariableContainer ( ) ; $ templateVariableContainer -> add ( $ as , $ flashMessages ) ; $ content = $ this -> renderChildren ( ) ; $ templateVariableContainer -> remove ( $ as ... | Defer the rendering of Flash Messages to the template . In this case the flash messages are stored in the template inside the variable specified in as . |
4,533 | public function ban ( $ pickTurn ) { $ bans = $ this -> info [ 'bannedChampions' ] ; if ( isset ( $ bans [ $ pickTurn ] ) ) { return $ bans [ $ pickTurn ] ; } return null ; } | get a ban from the current game |
4,534 | public function participant ( $ summonerId ) { $ participant = $ this -> info [ 'participants' ] ; if ( isset ( $ participant [ $ summonerId ] ) ) { return $ participant [ $ summonerId ] ; } return null ; } | Gets the participant by the given summoner id . |
4,535 | public function challenger ( $ type = 'RANKED_SOLO_5x5' ) { $ info = $ this -> request ( 'league/challenger' , [ 'type' => $ type ] ) ; $ info [ 'id' ] = null ; return $ this -> attachStaticDataToDto ( new Dto \ League ( $ info ) ) ; } | Gets the league information for the challenger teams . |
4,536 | public function getViewHelper ( $ uniqueCounter , RenderingContextInterface $ renderingContext , $ viewHelperName ) { if ( Bootstrap :: $ staticObjectManager -> getScope ( $ viewHelperName ) === Configuration :: SCOPE_SINGLETON ) { $ viewHelper = Bootstrap :: $ staticObjectManager -> get ( $ viewHelperName ) ; $ viewHe... | Public such that it is callable from within closures |
4,537 | protected function isBinary ( ) { $ binary = false ; if ( ( $ this -> dcs & 200 ) === 0 ) { $ binary = ( ( $ this -> dcs & 4 ) > 0 ) ; } elseif ( ( $ this -> dcs & 248 ) === 240 ) { $ binary = ( ( $ this -> dcs & 4 ) > 0 ) ; } return $ binary ; } | Return true if the sms has been configured as binary message |
4,538 | public function sendSimple ( ) { $ this -> setType ( self :: TYPE_SIMPLE ) ; $ response = $ this -> sendApiCall ( self :: ACTION_CREATE , $ this -> getCreateUrl ( ) ) ; if ( ! isset ( $ response -> getBody ( ) [ '_embedded' ] [ 'items' ] ) ) { throw new Exception ( 'Invalid response returned from server' , Exception ::... | Automatically split multi part sms messages and return result sms messages |
4,539 | protected function getAjaxUri ( ) { $ action = $ this -> arguments [ 'action' ] ; $ arguments = $ this -> arguments [ 'arguments' ] ; if ( $ action === null ) { $ action = $ this -> controllerContext -> getRequest ( ) -> getControllerActionName ( ) ; } $ arguments [ '@action' ] = $ action ; if ( strlen ( $ this -> argu... | Get the URI for an AJAX Request . |
4,540 | public function stopImmediatePropagation ( ) { if ( $ this -> isCancelable ( ) === false ) { throw new Exception ( sprintf ( 'Event "%s" not cancelable.' , $ this -> type ) ) ; } $ this -> immediateStopped = true ; } | Keeps the rest of the handlers from being executed and prevents the event |
4,541 | public function summary ( $ identity ) { $ summonerId = $ this -> extractId ( $ identity ) ; $ params = [ ] ; if ( ! is_null ( $ this -> season ) ) { $ params [ 'season' ] = $ this -> season ; } $ info = $ this -> request ( 'stats/by-summoner/' . $ summonerId . '/summary' , $ params ) ; $ stats = new PlayerStatsSummary... | Gets the stats summary by summoner id . |
4,542 | public function ranked ( $ identity ) { $ summonerId = $ this -> extractId ( $ identity ) ; $ params = [ ] ; if ( ! is_null ( $ this -> season ) ) { $ params [ 'season' ] = $ this -> season ; } $ info = $ this -> request ( 'stats/by-summoner/' . $ summonerId . '/ranked' , $ params ) ; $ stats = $ this -> attachStaticDa... | Gets the stats for ranked queues only by summary id . |
4,543 | public static function mount ( ) { foreach ( self :: $ staticProxy as $ staticProxy ) { $ staticProxyObject = '\\LeagueWrap\\StaticProxy\\Static' . $ staticProxy ; $ staticProxyObject :: mount ( ) ; $ staticProxyObject :: fresh ( ) ; } } | Mount all the static static proxys found in the StaticProxy directory . |
4,544 | public function get ( $ key ) { if ( array_key_exists ( $ key , $ this -> container ) ) { return $ this -> container [ $ key ] ; } return null ; } | Get user detail |
4,545 | public function participant ( $ participantId ) { $ participant = $ this -> info [ 'participants' ] ; if ( isset ( $ participant [ $ participantId ] ) ) { return $ participant [ $ participantId ] ; } return null ; } | Attempts to get a participant from this match . |
4,546 | public function identity ( $ participantId ) { $ participantIdentity = $ this -> info [ 'participantIdentities' ] ; if ( isset ( $ participantIdentity [ $ participantId ] ) ) { return $ participantIdentity [ $ participantId ] ; } return null ; } | Attempts to get a participant identity from this match . |
4,547 | public function team ( $ teamId ) { $ team = $ this -> info [ 'teams' ] ; if ( isset ( $ team [ $ teamId ] ) ) { return $ team [ $ teamId ] ; } return null ; } | Attempts to get a team from this match . |
4,548 | public function getHeaders ( ) { $ headers = array_change_key_case ( $ this -> httpRequest -> getHeaders ( ) , CASE_LOWER ) ; foreach ( $ headers as $ header ) { $ header = array_map ( function ( $ value ) { return strtolower ( $ value ) ; } , $ header ) ; } return $ headers ; } | Get formated headers |
4,549 | private function onEnd ( $ dataResult ) { if ( $ dataResult === null ) return $ this -> emit ( 'end' ) ; if ( $ this -> isJson ( ) ) $ this -> parseJson ( $ dataResult ) ; else $ this -> parseStr ( $ dataResult ) ; } | On request end |
4,550 | private function parseJson ( $ jsonString ) { $ jsonData = json_decode ( $ jsonString , true ) ; if ( $ jsonData === null ) { $ this -> emit ( 'error' , [ json_last_error_msg ( ) ] ) ; return ; } $ this -> setContent ( $ jsonString ) ; $ this -> setData ( $ jsonData ) ; $ this -> emit ( 'end' ) ; } | Parse json string |
4,551 | public function recent ( $ identity ) { $ summonerId = $ this -> extractId ( $ identity ) ; $ info = $ this -> request ( 'game/by-summoner/' . $ summonerId . '/recent' ) ; $ games = $ this -> attachStaticDataToDto ( new RecentGames ( $ info ) ) ; $ this -> attachResponse ( $ identity , $ games , 'recentGames' ) ; retur... | Get the recent games by summoner id . |
4,552 | public function runePage ( $ runePageId ) { if ( ! isset ( $ this -> info [ 'runePages' ] ) ) { return null ; } $ runePages = $ this -> info [ 'runePages' ] ; if ( isset ( $ runePages [ $ runePageId ] ) ) { return $ runePages [ $ runePageId ] ; } return null ; } | Attempts to get a rune page by the id . |
4,553 | public function masteryPage ( $ masteryPageId ) { if ( ! isset ( $ this -> info [ 'masteryPages' ] ) ) { return null ; } $ masteryPages = $ this -> info [ 'masteryPages' ] ; if ( isset ( $ masteryPages [ $ masteryPageId ] ) ) { return $ masteryPages [ $ masteryPageId ] ; } return null ; } | Attempts to get the mastery page by the id . |
4,554 | public function recentGame ( $ gameId ) { if ( ! isset ( $ this -> info [ 'recentGames' ] ) ) { return null ; } $ recentGames = $ this -> info [ 'recentGames' ] ; return $ recentGames -> game ( $ gameId ) ; } | Attempts to get the game by the id . |
4,555 | public function selectVersion ( $ version ) { if ( ! in_array ( $ version , $ this -> versions ) ) { return false ; } $ this -> version = $ version ; return $ this ; } | Select the version of the api you wish to query . |
4,556 | protected function request ( $ path , $ params = [ ] , $ static = false , $ isVersionized = true ) { if ( $ this -> region -> isLocked ( $ this -> permittedRegions ) ) { throw new RegionException ( 'The region "' . $ this -> region -> getRegion ( ) . '" is not permited to query this API.' ) ; } $ this -> client -> base... | Wraps the request of the api in this method . |
4,557 | protected function clientRequest ( $ static , $ uri , $ params ) { if ( ! $ static && ! $ this -> collection -> hitLimits ( $ this -> region -> getRegion ( ) ) ) { throw new LimitReachedException ( 'You have hit the request limit in your collection.' ) ; } $ response = $ this -> client -> request ( $ uri , $ params ) ;... | Make the actual request . |
4,558 | protected function getVersion ( ) { if ( is_null ( $ this -> version ) ) { $ this -> version = reset ( $ this -> versions ) ; } return $ this -> version ; } | Get the version string . |
4,559 | protected function extractIds ( $ identities ) { $ ids = [ ] ; if ( is_array ( $ identities ) ) { foreach ( $ identities as $ identity ) { $ ids [ ] = $ this -> extractId ( $ identity ) ; } } else { $ ids [ ] = $ this -> extractId ( $ identities ) ; } return $ ids ; } | Attempts to extract an ID from the array given . |
4,560 | protected function attachResponse ( $ identity , $ response , $ key ) { if ( $ identity instanceof Summoner ) { $ identity -> set ( $ key , $ response ) ; return true ; } return false ; } | Attempts to attach the response to a summoner object . |
4,561 | protected function attachResponses ( $ identities , $ responses , $ key ) { if ( is_array ( $ identities ) ) { foreach ( $ identities as $ identity ) { if ( $ identity instanceof Summoner ) { $ id = $ identity -> id ; if ( isset ( $ responses [ $ id ] ) ) { $ response = $ responses [ $ id ] ; $ this -> attachResponse (... | Attempts to attach all the responses to the correct summoner . |
4,562 | protected function attachStaticDataToDto ( AbstractDto $ dto ) { if ( $ this -> attachStaticData ) { $ dto -> loadStaticData ( $ this -> staticData ) ; } return $ dto ; } | Will attempt to attach any static data to the given dto if the attach static data flag is set . |
4,563 | protected function checkResponseErrors ( Response $ response ) { $ code = $ response -> getCode ( ) ; if ( $ code === 429 && ! $ response -> hasHeader ( 'Retry-After' ) ) { throw Response \ UnderlyingServiceRateLimitReached :: withResponse ( "Did not receive 'X-Rate-Limit-Type' and 'Retry-After' headers. " . "See https... | Checks the response for Http errors . |
4,564 | public function getSessionBag ( ) { if ( null === $ this -> sessionBag ) { if ( ! $ this -> container ) { throw new Exception ( 'A container object is required to access the \'session_bag\' service.' ) ; } $ this -> sessionBag = $ this -> container -> get ( 'session_bag' , [ $ this -> bagName ] ) ; } return $ this -> s... | Get session bag |
4,565 | public function get ( $ type , array $ default = [ ] , $ remove = true ) { if ( $ this -> has ( $ type ) ) { if ( true === $ remove ) { unset ( $ this -> messages [ $ type ] ) ; } return $ this -> messages [ $ type ] ; } return $ default ; } | Peek type messages |
4,566 | public function getAll ( $ remove = true ) { $ output = $ this -> messages ; if ( true === $ remove ) { $ this -> clear ( ) ; } return $ output ; } | Get all messages and remove theirs |
4,567 | public function reset ( ) { $ this -> tagName = '' ; $ this -> content = '' ; $ this -> attributes = array ( ) ; $ this -> forceClosingTag = false ; } | Resets the TagBuilder by setting all members to their default value |
4,568 | public function render ( ) { if ( empty ( $ this -> tagName ) ) { return '' ; } $ output = '<' . $ this -> tagName ; foreach ( $ this -> attributes as $ attributeName => $ attributeValue ) { $ output .= ' ' . $ attributeName . '="' . $ attributeValue . '"' ; } if ( $ this -> hasContent ( ) || $ this -> forceClosingTag ... | Renders and returns the tag |
4,569 | public function evaluate ( RenderingContextInterface $ renderingContext ) { $ arrayToBuild = array ( ) ; foreach ( $ this -> internalArray as $ key => $ value ) { if ( $ value instanceof AbstractNode ) { $ arrayToBuild [ $ key ] = $ value -> evaluate ( $ renderingContext ) ; } else { $ arrayToBuild [ $ key ] = $ value ... | Evaluate the array and return an evaluated array |
4,570 | protected function getEmail ( $ token ) { if ( in_array ( self :: SCOPE_USER_EMAIL , $ this -> getScopes ( ) ) ) { $ request = new Request ( self :: USER_API_URI . '/emails?access_token=' . $ token , Request :: METHOD_GET ) ; $ request = $ this -> request ( $ request ) ; $ client = new Curl ( ) ; $ response = $ client ... | Get user email |
4,571 | public function player ( $ playerId ) { if ( ! isset ( $ this -> info [ 'fellowPlayers' ] ) ) { return null ; } $ players = $ this -> info [ 'fellowPlayers' ] ; if ( isset ( $ players [ $ playerId ] ) ) { return $ players [ $ playerId ] ; } return null ; } | Attempts to get a fellow player from this game . |
4,572 | private function connection_init ( ) { $ opts = $ this -> config ; $ headers = [ ] ; foreach ( $ opts [ 'headers' ] as $ key => $ value ) $ headers [ ] = "$key: $value" ; $ connection = new JsonRPC \ Client ( $ opts [ 'url' ] , $ opts [ 'timeout' ] , $ headers ) ; $ connection -> ssl_verify_peer = $ opts [ 'ssl_verify_... | Inits Client Connection based on instance params |
4,573 | protected function request ( $ method , $ params ) { Log :: debug ( 'RpcClient call' , [ 'method' => $ method , 'params' => $ params , 'config' => $ this -> config ] ) ; return call_user_func_array ( [ $ this -> connection ( ) , 'execute' ] , [ $ method , $ params ] ) ; } | Execute a remote method |
4,574 | public static function set ( $ key , $ value , $ scope = self :: DEFAULT_SCOPE ) { self :: $ storage [ $ scope ] [ $ key ] = $ value ; } | Store key in registry |
4,575 | public static function get ( $ key , $ scope = self :: DEFAULT_SCOPE ) { if ( isset ( self :: $ storage [ $ scope ] [ $ key ] ) ) { return self :: $ storage [ $ scope ] [ $ key ] ; } return null ; } | Get key from registry |
4,576 | public static function has ( $ key , $ scope = self :: DEFAULT_SCOPE ) { return isset ( self :: $ storage [ $ scope ] [ $ key ] ) ; } | Check key exist or not |
4,577 | public function setStaticInfo ( Staticdata $ staticData ) { $ results = [ ] ; foreach ( $ this -> requests as $ source => $ ids ) { $ result = [ ] ; $ method = 'get' . ucfirst ( $ source ) ; if ( count ( $ ids ) > 1 ) { if ( preg_match ( '/(?<![aeiou])y$/' , $ method ) ) { $ method = substr ( $ method , 0 , - 1 ) . 'ie... | Uses the static api to get all the static information we need that have already been optimized . |
4,578 | public function getDataFromHash ( $ hash ) { $ data = [ ] ; $ fields = $ this -> fields [ $ hash ] ; foreach ( $ fields as $ source => $ ids ) { $ result = [ ] ; $ results = $ this -> results [ $ source ] ; foreach ( $ ids as $ id ) { $ result [ $ id ] = $ results [ $ id ] ; } $ data [ $ source ] = $ result ; } return ... | Gets the result data array from the static api by the given hash . |
4,579 | public function field ( $ title , $ value , $ short = true ) { $ this -> fields [ ] = [ 'title' => ( string ) $ title , 'value' => $ value , 'short' => $ short , ] ; return $ this ; } | Add a field to the attachment |
4,580 | public function resetState ( ) { if ( $ this -> ajaxWidget ) { $ this -> widgetContext = $ this -> objectManager -> get ( \ TYPO3 \ Fluid \ Core \ Widget \ WidgetContext :: class ) ; } } | Resets the ViewHelper state by creating a fresh WidgetContext |
4,581 | public function get ( $ viewHelperName , $ key ) { if ( ! $ this -> exists ( $ viewHelperName , $ key ) ) { throw new InvalidVariableException ( sprintf ( 'No value found for key "%s->%s"' , $ viewHelperName , $ key ) , 1243325768 ) ; } return $ this -> objects [ $ viewHelperName ] [ $ key ] ; } | Gets a variable which is stored |
4,582 | public function exists ( $ viewHelperName , $ key ) { return isset ( $ this -> objects [ $ viewHelperName ] ) && array_key_exists ( $ key , $ this -> objects [ $ viewHelperName ] ) ; } | Determine whether there is a variable stored for the given key |
4,583 | public function remove ( $ viewHelperName , $ key ) { if ( ! $ this -> exists ( $ viewHelperName , $ key ) ) { throw new InvalidVariableException ( sprintf ( 'No value found for key "%s->%s", thus the key cannot be removed.' , $ viewHelperName , $ key ) , 1243352249 ) ; } unset ( $ this -> objects [ $ viewHelperName ] ... | Remove a value from the variable container |
4,584 | public function process ( NodeInterface $ node , $ interceptorPosition , ParsingState $ parsingState ) { if ( $ interceptorPosition === InterceptorInterface :: INTERCEPT_OPENING_VIEWHELPER ) { if ( ! $ node -> getUninitializedViewHelper ( ) -> isChildrenEscapingEnabled ( ) ) { $ this -> childrenEscapingEnabled = false ... | Adds a ViewHelper node using the Format \ HtmlspecialcharsViewHelper to the given node . If escapingInterceptorEnabled in the ViewHelper is FALSE will disable itself inside the ViewHelpers body . |
4,585 | public function loadData ( ) { $ response = $ this -> sendApiCall ( self :: ACTION_RETRIEVE , $ this -> getCreateUrl ( ) ) ; $ this -> verificationTypes = $ response -> getBody ( ) ; } | Load the balance data from the server |
4,586 | protected function convertViewHelperNode ( ViewHelperNode $ node ) { $ initializationPhpCode = '// Rendering ViewHelper ' . $ node -> getViewHelperClassName ( ) . chr ( 10 ) ; $ argumentsVariableName = $ this -> variableName ( 'arguments' ) ; $ initializationPhpCode .= sprintf ( '%s = array();' , $ argumentsVariableNam... | Convert a single ViewHelperNode into its cached representation . If the ViewHelper implements the Compilable facet the ViewHelper itself is asked for its cached PHP code representation . If not a ViewHelper is built and then invoked . |
4,587 | public function flushTemplatesOnViewHelperChanges ( array $ changedFiles ) { if ( ! $ this -> templateCache instanceof FrontendInterface ) { return ; } foreach ( $ changedFiles as $ pathAndFilename => $ status ) { if ( strrpos ( $ pathAndFilename , 'ViewHelper.php' ) !== false ) { $ this -> templateCache -> flush ( ) ;... | Flush cached templates if a ViewHelper class is changed |
4,588 | static function setConfig ( $ config , $ instance = 'default' ) { self :: $ config [ $ instance ] [ 'dsn' ] = array_key_exists ( 'dsn' , $ config ) ? $ config [ 'dsn' ] : "" ; self :: $ config [ $ instance ] [ 'username' ] = array_key_exists ( 'username' , $ config ) ? $ config [ 'username' ] : null ; self :: $ config ... | Set database config params config param should contains dsn username password and options |
4,589 | private function getSetStmt ( $ syntax , $ table , $ data , $ where = null ) { $ columns = array ( ) ; foreach ( array_keys ( $ data ) as $ column ) { $ columns [ ] = "`" . $ column . "` = ?" ; } $ columns = implode ( ", " , $ columns ) ; $ sql = "$syntax `$table` SET " . $ columns . $ this -> buildWhere ( $ where ) ; ... | Build and Get SET statement |
4,590 | private function executeBySyntax ( $ syntax , $ table , $ data , $ where = null , $ where_params = array ( ) , $ stmt_key = null ) { if ( ! is_null ( $ where ) && ! is_array ( $ where ) ) { $ where = array ( $ where ) ; } if ( is_object ( $ data ) ) { $ data = ( array ) $ data ; } $ data = $ this -> removeNonExistentCo... | Perform INSERT UPDATE REPLACE |
4,591 | function insert ( $ table , $ data , $ stmt_key = null ) { return $ this -> executeBySyntax ( self :: INSERT , $ table , $ data , null , array ( ) , $ stmt_key ) ; } | Insert one row |
4,592 | function update ( $ table , $ data , $ where , $ where_params = array ( ) , $ stmt_key = null ) { return $ this -> executeBySyntax ( self :: UPDATE , $ table , $ data , $ where , $ where_params , $ stmt_key ) ; } | Update row in table optionally use previous prepared stmt by stmt_key |
4,593 | function replace ( $ table , $ data , $ stmt_key = null ) { return $ this -> executeBySyntax ( self :: REPLACE , $ table , $ data , null , array ( ) , $ stmt_key ) ; } | Insert or replace row in a table |
4,594 | function count ( $ table , $ where , $ where_params = null ) { $ sql = "SELECT COUNT(*) FROM " . $ table . $ this -> buildWhere ( $ where ) ; $ stmt = $ this -> executeQuery ( $ sql , $ where_params ) ; return $ stmt -> fetchColumn ( ) ; } | Count rows in one table - very simple implementation |
4,595 | function execQueryString ( $ sql , $ params = null ) { if ( ! is_array ( $ params ) && ! is_null ( $ params ) ) { $ params = array ( $ params ) ; } $ stmt = $ this -> prepare ( $ sql ) ; $ stmt -> execute ( $ params ) ; return $ stmt ; } | Prepare & execute query with params |
4,596 | function buildWhere ( $ where , $ operand = "AND" ) { if ( empty ( $ where ) ) { return "" ; } if ( is_array ( $ where ) ) { $ wheres = array ( ) ; foreach ( $ where as $ k => $ w ) { $ wheres [ ] = "(" . $ w . ")" ; } $ where = implode ( " $operand " , $ wheres ) ; } return " WHERE " . $ where ; } | Build where statement for SQL query |
4,597 | function save ( $ table , $ data , $ primary_key , $ stmt_key = null ) { if ( ! empty ( $ data [ $ primary_key ] ) ) { return $ this -> update ( $ table , $ data , $ primary_key . " = ?" , $ data [ $ primary_key ] , $ stmt_key ) ; } else { return $ this -> insert ( $ table , $ data , $ stmt_key ) ; } } | Save data to table |
4,598 | function setFetchTableNames ( $ option = 1 ) { $ this -> setAttribute ( self :: ATTR_FETCH_TABLE_NAMES , $ option ) ; $ this -> fetch_table_names = $ option ; } | Set fetch table names attribute |
4,599 | public function get ( $ key ) { $ key = strtolower ( $ key ) ; if ( isset ( $ this -> summoners [ $ key ] ) ) { return $ this -> summoners [ $ key ] ; } return null ; } | Attempt to get a summoner by key . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.