idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
4,400
public function getMetadata ( $ forceFetch = false ) { if ( empty ( $ this -> metadata ) || $ forceFetch ) { $ metadataUrlQuery = new UrlQuery ( $ this -> buildViewUrl ( ) , $ this -> sodaClient -> getToken ( ) , $ this -> sodaClient -> getEmail ( ) , $ this -> sodaClient -> getPassword ( ) ) ; $ metadataUrlQuery -> se...
Get the metadata of a dataset
4,401
public function getDataset ( $ filterOrSoqlQuery = "" ) { $ headers = array ( ) ; if ( ! ( $ filterOrSoqlQuery instanceof SoqlQuery ) && StringUtilities :: isNullOrEmpty ( $ filterOrSoqlQuery ) ) { $ filterOrSoqlQuery = new SoqlQuery ( ) ; } $ dataset = $ this -> urlQuery -> sendGet ( $ filterOrSoqlQuery , $ this -> so...
Fetch a dataset based on a resource ID .
4,402
public function replace ( $ payload ) { $ upsertData = $ this -> handleJson ( $ payload ) ; return $ this -> urlQuery -> sendPut ( $ upsertData , $ this -> sodaClient -> associativeArrayEnabled ( ) ) ; }
Replace the entire dataset with the new payload provided
4,403
public function upsert ( $ payload ) { $ upsertData = $ this -> handleJson ( $ payload ) ; return $ this -> urlQuery -> sendPost ( $ upsertData , $ this -> sodaClient -> associativeArrayEnabled ( ) ) ; }
Create update and delete rows in a single operation using their row identifiers .
4,404
private function buildApiUrl ( $ location , $ identifier = NULL ) { if ( $ identifier === NULL ) { $ identifier = $ this -> resourceId ; } return sprintf ( "%s://%s/%s/%s.json" , UrlQuery :: DEFAULT_PROTOCOL , $ this -> sodaClient -> getDomain ( ) , $ location , $ identifier ) ; }
Build the URL that will be used to access the API for the respective action
4,405
private function handleJson ( $ payload ) { $ uploadData = $ payload ; if ( is_array ( $ payload ) ) { $ uploadData = json_encode ( $ payload ) ; } else if ( $ payload instanceof Converter ) { $ uploadData = $ payload -> toJson ( ) ; } else if ( ! StringUtilities :: isJson ( $ payload ) ) { throw new \ InvalidArgumentE...
Handle different forms of data to be returned in JSON format so it can be sent to Socrata .
4,406
private function individualRow ( $ rowID , $ method ) { $ headers = array ( ) ; $ apiEndPoint = $ this -> buildApiUrl ( "resource" , $ this -> resourceId . "/" . $ rowID ) ; $ urlQuery = new UrlQuery ( $ apiEndPoint , $ this -> sodaClient -> getToken ( ) , $ this -> sodaClient -> getEmail ( ) , $ this -> sodaClient -> ...
Interact with an individual row . Either to retrieve it or to delete it ; both actions use the same API endpoint with the exception of what type of request is sent .
4,407
private function sendIndividualRequest ( $ urlQuery , $ method , $ associativeArrays , & $ headers ) { if ( $ method === "get" ) { return $ urlQuery -> sendGet ( "" , $ associativeArrays , $ headers ) ; } else if ( $ method === "delete" ) { return $ urlQuery -> sendDelete ( $ associativeArrays , $ headers ) ; } throw n...
Send the appropriate request header based on the method that s required
4,408
private function parseApiVersion ( $ responseHeaders ) { if ( array_key_exists ( 'X-SODA2-Legacy-Types' , $ responseHeaders ) && $ responseHeaders [ 'X-SODA2-Legacy-Types' ] ) { return 1 ; } if ( array_key_exists ( 'X-SODA2-Truth-Last-Modified' , $ responseHeaders ) ) { if ( empty ( $ this -> metadata ) ) { $ this -> g...
Determine the version number of the API this dataset is using
4,409
public static function parseOrder ( $ string ) { if ( $ string === self :: ASC || $ string === self :: DESC ) { return $ string ; } throw new \ InvalidArgumentException ( sprintf ( "An invalid sort order (%s) was given; you may only sort using ASC or DESC." , $ string ) ) ; }
Ensure that we have a proper sorting order so return only valid ordering options
4,410
public function set ( $ key , $ response , $ seconds ) { return $ this -> memcached -> set ( $ key , $ response , $ seconds ) ; }
Adds the response string into the cache under the given key .
4,411
public function has ( $ key ) { $ this -> memcached -> get ( $ key ) ; if ( $ this -> memcached -> getResultCode ( ) == Memcached :: RES_NOTFOUND ) { return false ; } return true ; }
Determines if the cache has the given key .
4,412
public function matchlist ( $ identity , $ rankedQueues = null , $ seasons = null , $ championIds = null , $ beginIndex = null , $ endIndex = null , $ beginTime = null , $ endTime = null ) { $ summonerId = $ this -> extractId ( $ identity ) ; $ requestParamas = $ this -> parseParams ( $ rankedQueues , $ seasons , $ cha...
Get the match list by summoner identity .
4,413
protected function parseParams ( $ rankedQueues = null , $ seasons = null , $ championIds = null , $ beginIndex = null , $ endIndex = null , $ beginTime = null , $ endTime = null ) { $ params = [ ] ; if ( isset ( $ rankedQueues ) ) { if ( is_array ( $ rankedQueues ) ) { $ params [ 'rankedQueues' ] = implode ( ',' , $ r...
Parse the params into an array .
4,414
public function add ( $ identifier , $ value ) { if ( array_key_exists ( $ identifier , $ this -> variables ) ) { throw new InvalidVariableException ( 'Duplicate variable declaration, "' . $ identifier . '" already set!' , 1224479063 ) ; } if ( in_array ( strtolower ( $ identifier ) , self :: $ reservedVariableNames ) ...
Add a variable to the context
4,415
public function get ( $ identifier ) { switch ( $ identifier ) { case '_all' : return $ this -> variables ; case 'true' : case 'on' : case 'yes' : return true ; case 'false' : case 'off' : case 'no' : return false ; } if ( ! array_key_exists ( $ identifier , $ this -> variables ) ) { throw new InvalidVariableException ...
Get a variable from the context . Throws exception if variable is not found in context .
4,416
public function remove ( $ identifier ) { if ( ! array_key_exists ( $ identifier , $ this -> variables ) ) { throw new InvalidVariableException ( 'Tried to remove a variable "' . $ identifier . '" which is not stored in the context!' , 1224479372 ) ; } unset ( $ this -> variables [ $ identifier ] ) ; }
Remove a variable from context . Throws exception if variable is not found in context .
4,417
public function exists ( $ identifier ) { if ( in_array ( $ identifier , self :: $ reservedVariableNames , true ) ) { return true ; } return array_key_exists ( $ identifier , $ this -> variables ) ; }
Checks if this property exists in the VariableContainer .
4,418
protected function forceStatusCodeHttpOK ( Request $ request , SymfonyResponse $ response , ResponseModelInterface $ responseModel ) { if ( $ request -> headers -> has ( 'X-Force-Status-Code-200' ) || ( $ request -> getRequestFormat ( ) == Format :: FORMAT_JSON && $ request -> query -> has ( self :: PARAMETER_CALLBACK ...
Check if we should put the status code in the output and force a 200 OK in the header
4,419
protected function forceEmptyResponseOnHttpNoContent ( SymfonyResponse $ response ) { if ( $ response -> getStatusCode ( ) === Response :: HTTP_NO_CONTENT ) { $ response -> setContent ( null ) ; $ response -> headers -> remove ( 'Content-Type' ) ; } }
Make sure content is empty when the status code is 204 NoContent
4,420
public function parse ( $ templateString ) { if ( ! is_string ( $ templateString ) ) { throw new Exception ( 'Parse requires a template string as argument, ' . gettype ( $ templateString ) . ' given.' , 1224237899 ) ; } $ this -> reset ( ) ; $ templateString = $ this -> extractEscapingModifier ( $ templateString ) ; $ ...
Parses a given template string and returns a parsed template object .
4,421
protected function reset ( ) { $ this -> escapingEnabled = true ; $ this -> ignoredNamespaceIdentifierPatterns = array ( ) ; $ this -> namespaces = array ( 'f' => 'TYPO3\Fluid\ViewHelpers' ) ; $ this -> emitInitializeNamespaces ( $ this ) ; }
Resets the parser to its default values .
4,422
protected function buildObjectTree ( $ splitTemplate , $ context ) { $ regularExpression_openingViewHelperTag = self :: $ SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG ; $ regularExpression_closingViewHelperTag = self :: $ SCAN_PATTERN_TEMPLATE_CLOSINGVIEWHELPERTAG ; $ state = $ this -> objectManager -> get ( \ TYPO3 \ Fluid \ C...
Build object tree from the split template
4,423
protected function openingViewHelperTagHandler ( ParsingState $ state , $ namespaceIdentifier , $ methodIdentifier , $ arguments , $ selfclosing ) { $ argumentsObjectTree = $ this -> parseArguments ( $ arguments ) ; $ viewHelperWasOpened = $ this -> initializeViewHelperAndAddItToStack ( $ state , $ namespaceIdentifier ...
Handles an opening or self - closing view helper tag .
4,424
protected function initializeViewHelperAndAddItToStack ( ParsingState $ state , $ namespaceIdentifier , $ methodIdentifier , $ argumentsObjectTree ) { if ( $ this -> isNamespaceValid ( $ namespaceIdentifier , $ methodIdentifier ) === false ) { return false ; } $ resolvedViewHelperClassName = $ this -> resolveViewHelper...
Initialize the given ViewHelper and adds it to the current node and to the stack .
4,425
protected function abortIfUnregisteredArgumentsExist ( $ expectedArguments , $ actualArguments ) { $ expectedArgumentNames = array ( ) ; foreach ( $ expectedArguments as $ expectedArgument ) { $ expectedArgumentNames [ ] = $ expectedArgument -> getName ( ) ; } foreach ( array_keys ( $ actualArguments ) as $ argumentNam...
Throw an exception if there are arguments which were not registered before .
4,426
protected function abortIfRequiredArgumentsAreMissing ( $ expectedArguments , $ actualArguments ) { $ actualArgumentNames = array_keys ( $ actualArguments ) ; foreach ( $ expectedArguments as $ expectedArgument ) { if ( $ expectedArgument -> isRequired ( ) && ! in_array ( $ expectedArgument -> getName ( ) , $ actualArg...
Throw an exception if required arguments are missing
4,427
protected function rewriteBooleanNodesInArgumentsObjectTree ( $ argumentDefinitions , & $ argumentsObjectTree ) { foreach ( $ argumentDefinitions as $ argumentName => $ argumentDefinition ) { if ( $ argumentDefinition -> getType ( ) === 'boolean' && isset ( $ argumentsObjectTree [ $ argumentName ] ) ) { $ argumentsObje...
Wraps the argument tree if a node is boolean into a Boolean syntax tree node
4,428
protected function resolveViewHelperName ( $ namespaceIdentifier , $ methodIdentifier ) { $ explodedViewHelperName = explode ( '.' , $ methodIdentifier ) ; if ( count ( $ explodedViewHelperName ) > 1 ) { $ className = implode ( '\\' , array_map ( 'ucfirst' , $ explodedViewHelperName ) ) ; } else { $ className = ucfirst...
Resolve a viewhelper name .
4,429
protected function closingViewHelperTagHandler ( ParsingState $ state , $ namespaceIdentifier , $ methodIdentifier ) { if ( $ this -> isNamespaceValid ( $ namespaceIdentifier , $ methodIdentifier ) === false ) { return false ; } $ lastStackElement = $ state -> popNodeFromStack ( ) ; if ( ! ( $ lastStackElement instance...
Handles a closing view helper tag
4,430
protected function callInterceptor ( NodeInterface & $ node , $ interceptionPoint , ParsingState $ state ) { if ( $ this -> configuration === null ) { return ; } if ( $ this -> escapingEnabled ) { foreach ( $ this -> configuration -> getEscapingInterceptors ( $ interceptionPoint ) as $ interceptor ) { $ node = $ interc...
Call all interceptors registered for a given interception point .
4,431
protected function parseArguments ( $ argumentsString ) { $ argumentsObjectTree = array ( ) ; $ matches = array ( ) ; if ( preg_match_all ( self :: $ SPLIT_PATTERN_TAGARGUMENTS , $ argumentsString , $ matches , PREG_SET_ORDER ) > 0 ) { $ escapingEnabledBackup = $ this -> escapingEnabled ; $ this -> escapingEnabled = fa...
Parse arguments of a given tag and build up the Arguments Object Tree for each argument . Returns an associative array where the key is the name of the argument and the value is a single Argument Object Tree .
4,432
protected function textAndShorthandSyntaxHandler ( ParsingState $ state , $ text , $ context ) { $ sections = preg_split ( self :: $ SPLIT_PATTERN_SHORTHANDSYNTAX , $ text , - 1 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ) ; foreach ( $ sections as $ section ) { $ matchedVariables = array ( ) ; if ( preg_match ( ...
Handler for everything which is not a ViewHelperNode .
4,433
protected function arrayHandler ( ParsingState $ state , $ arrayText ) { $ arrayNode = $ this -> objectManager -> get ( \ TYPO3 \ Fluid \ Core \ Parser \ SyntaxTree \ ArrayNode :: class , $ this -> recursiveArrayHandler ( $ arrayText ) ) ; $ state -> getNodeFromStack ( ) -> addChildNode ( $ arrayNode ) ; }
Handler for array syntax . This creates the array object recursively and adds it to the current node .
4,434
protected function recursiveArrayHandler ( $ arrayText ) { $ matches = array ( ) ; if ( preg_match_all ( self :: $ SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS , $ arrayText , $ matches , PREG_SET_ORDER ) > 0 ) { $ arrayToBuild = array ( ) ; foreach ( $ matches as $ singleMatch ) { $ arrayKey = $ this -> unquoteString ( $...
Recursive function which takes the string representation of an array and builds an object tree from it .
4,435
protected function textHandler ( ParsingState $ state , $ text ) { $ node = $ this -> objectManager -> get ( \ TYPO3 \ Fluid \ Core \ Parser \ SyntaxTree \ TextNode :: class , $ text ) ; $ this -> callInterceptor ( $ node , InterceptorInterface :: INTERCEPT_TEXT , $ state ) ; $ state -> getNodeFromStack ( ) -> addChild...
Text node handler
4,436
protected function isNamespaceValid ( $ namespaceIdentifier , $ methodIdentifier ) { if ( array_key_exists ( $ namespaceIdentifier , $ this -> namespaces ) ) { return true ; } foreach ( $ this -> ignoredNamespaceIdentifierPatterns as $ namespaceIdentifierPattern ) { if ( preg_match ( $ namespaceIdentifierPattern , $ na...
Validates the given namespaceIdentifier and throws an exception if the namespace is unknown and not ignored
4,437
public function all ( ) { $ params = [ 'freeToPlay' => $ this -> free , ] ; $ info = $ this -> request ( 'champion' , $ params ) ; $ championList = new ChampionList ( $ info ) ; return $ this -> attachStaticDataToDto ( $ championList ) ; }
Gets all the champions in the given region .
4,438
public function championById ( $ championId ) { $ info = $ this -> request ( 'champion/' . $ championId ) ; return $ this -> attachStaticDataToDto ( new Champ ( $ info ) ) ; }
Gets the information for a single champion
4,439
public function register ( LoopInterface $ loop , $ port , $ host = '127.0.0.1' , array $ cert = [ ] ) { $ socket = new SocketServer ( "{$host}:{$port}" , $ loop ) ; if ( count ( $ cert ) > 0 ) { $ socket = new SecureSocketServer ( $ socket , $ loop , $ cert ) ; } $ http = new HttpServer ( $ socket ) ; $ http -> on ( '...
Setup socket for main loop
4,440
public function champion ( $ championId ) { if ( ! isset ( $ this -> info [ 'champions' ] [ $ championId ] ) ) { return null ; } return $ this -> info [ 'champions' ] [ $ championId ] ; }
Get the champion by the id returned by the API .
4,441
protected function getPathContent ( $ data ) { $ info = file_get_contents ( $ this -> path ) ; list ( $ expires , $ hits ) = explode ( ',' , $ info ) ; if ( $ expires <= time ( ) ) { unlink ( $ this -> path ) ; $ hits = 0 ; $ expires = null ; } if ( $ data == 'hits' ) { return $ hits ; } if ( $ data == 'expires' ) { re...
Gets the content of the current path and returns the data requested .
4,442
protected function writePathContent ( $ expires , $ count ) { $ info = $ expires . ',' . $ count ; return file_put_contents ( $ this -> path , $ info ) ; }
Writes the new expiry timestamp and count to the given path for this limit .
4,443
public function whereIn ( $ column , $ params ) { $ this -> prepareWhereInStatement ( $ column , $ params , false ) ; $ this -> addParams ( $ params ) ; return $ this ; }
Add where in statement
4,444
public function whereNotIn ( $ column , $ params ) { $ this -> prepareWhereInStatement ( $ column , $ params , true ) ; $ this -> addParams ( $ params ) ; return $ this ; }
Add where not in statement
4,445
public function having ( $ statement , $ params = null ) { $ this -> having [ ] = $ statement ; $ this -> addParams ( $ params ) ; return $ this ; }
Add statement for HAVING ...
4,446
public function getQuery ( ) { $ sql = $ this -> prepareSelectString ( ) ; $ sql .= $ this -> prepareJoinString ( ) ; $ sql .= $ this -> prepareWhereString ( ) ; $ sql .= $ this -> prepareGroupByString ( ) ; $ sql .= $ this -> prepareHavingString ( ) ; $ sql .= $ this -> prepareOrderByString ( ) ; $ sql .= $ this -> pr...
Returns generated SQL query
4,447
private function prepareSelectString ( ) { if ( empty ( $ this -> select ) ) { $ this -> select ( "*" ) ; } return "SELECT " . implode ( ", " , $ this -> select ) . " FROM " . implode ( ", " , $ this -> from ) . " " ; }
Returns prepared select string
4,448
public function execute ( ) { if ( $ this -> db === null ) { $ this -> db = DB :: getInstance ( ) ; } return $ this -> db -> execQuery ( $ this ) ; }
Execute built query This will prepare query bind params and execute query
4,449
private function prepareWhereInStatement ( $ column , $ params , $ not_in = false ) { $ qm = array_fill ( 0 , count ( $ params ) , "?" ) ; $ in = ( $ not_in ) ? "NOT IN" : "IN" ; $ this -> where [ ] = $ column . " " . $ in . " (" . implode ( ", " , $ qm ) . ")" ; }
Prepares where in statement
4,450
public function render ( array $ arguments , $ value = null ) { return self :: renderStatic ( array ( 'arguments' => $ arguments , 'value' => $ value ) , $ this -> buildRenderChildrenClosure ( ) , $ this -> renderingContext ) ; }
Format the arguments with the given printf format string .
4,451
public function offAny ( callable $ listener ) { if ( false !== $ index = array_search ( $ listener , $ this -> anyListeners , true ) ) { unset ( $ this -> anyListeners [ $ index ] ) ; } }
Disable a onAny listener
4,452
public function handleFatalError ( $ code , $ message , $ file , $ line ) { error_log ( $ message , 0 ) ; $ this -> handleException ( new FatalErrorException ( $ message , 500 , $ file , $ line ) ) ; return true ; }
Display a fatal error .
4,453
public function currentGame ( $ identity ) { $ summonerId = $ this -> extractId ( $ identity ) ; $ response = $ this -> request ( $ summonerId , [ ] , false , false ) ; $ game = $ this -> attachStaticDataToDto ( new CurrentGameDto ( $ response ) ) ; $ this -> attachResponse ( $ identity , $ game , 'game' ) ; return $ g...
Gets the current game of summoner .
4,454
protected function getWidgetUri ( ) { $ uriBuilder = $ this -> controllerContext -> getUriBuilder ( ) ; $ argumentsToBeExcludedFromQueryString = array ( '@package' , '@subpackage' , '@controller' ) ; $ uriBuilder -> reset ( ) -> setSection ( $ this -> arguments [ 'section' ] ) -> setCreateAbsoluteUri ( true ) -> setArg...
Get the URI for a non - AJAX Request .
4,455
public function addMiddleware ( $ callback ) { $ this -> middlewares [ ] = function ( Callable $ next , Request $ request , Response $ response ) use ( $ callback ) { $ container = Container :: getInstance ( ) ; $ parameters = array_merge ( [ "request" => $ request , "response" => $ response , "next" => $ next ] , $ re...
Add a middleware
4,456
public function launch ( Request $ request , Response $ response ) { if ( count ( $ this -> routes ) === 0 ) { throw new \ RuntimeException ( "No routes defined" ) ; } $ this -> uri = $ request -> httpRequest -> getPath ( ) ; if ( $ this -> uri = null ) { $ this -> uri = "/" ; } $ request -> on ( 'end' , function ( ) u...
Launch the route parsing
4,457
private function matchRoutes ( Request $ request , Response $ response ) { $ stack = [ ] ; $ path = $ request -> httpRequest -> getPath ( ) ; $ method = $ request -> httpRequest -> getMethod ( ) ; foreach ( $ this -> routes as $ route ) { if ( ! $ route -> match ( $ path , $ method ) ) { continue ; } $ methodArgs = $ r...
Try to match the current uri with all routes
4,458
protected function runStack ( array $ stack , Request $ request , Response $ response ) { $ stack [ ] = function ( ) use ( $ response ) { $ response -> end ( ) ; } ; $ finalStack = array_merge ( $ this -> middlewares , $ stack ) ; $ this -> waterfall ( $ finalStack , [ $ request , $ response ] ) ; }
Launch route stack
4,459
public function delete ( ) { if ( $ this -> batchId !== null ) { $ this -> sendApiCall ( self :: ACTION_REMOVE , $ this -> getCreateUrl ( ) . '/' . urlencode ( $ this -> batchId ) ) ; } }
Delete the poll messages from the server
4,460
public function setFields ( array $ fields ) { parent :: setFields ( $ fields ) ; if ( empty ( $ this -> batchId ) ) { $ this -> batchId = null ; } if ( isset ( $ fields [ '_embedded' ] [ 'messages' ] ) ) { $ this -> messages = $ fields [ '_embedded' ] [ 'messages' ] ; } }
Set the fields for the object
4,461
private function initEvents ( ) { $ this -> router -> on ( 'NotFound' , function ( $ request , $ response ) { $ response -> setStatus ( 404 ) -> write ( 'Not found' ) -> end ( ) ; } ) ; $ this -> router -> on ( 'error' , function ( $ request , $ response , $ error ) { $ response -> reset ( ) -> setStatus ( 500 ) -> wri...
Init default event catch
4,462
public function on ( $ event , $ callback ) { $ this -> router -> removeAllListeners ( $ event ) ; $ this -> router -> on ( $ event , $ callback ) ; }
Manual router event manager
4,463
public function listen ( $ port , $ host = "127.0.0.1" ) { $ runner = new Runner ( $ this ) ; $ runner -> listen ( $ port , $ host ) ; return $ this ; }
Create runner instance
4,464
public function checkDue ( $ segment , $ pos , $ times ) { $ isDue = true ; $ offsets = \ explode ( ',' , \ trim ( $ segment ) ) ; foreach ( $ offsets as $ offset ) { if ( null === $ isDue = $ this -> isOffsetDue ( $ offset , $ pos , $ times ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Invalid offset value a...
Checks if a cron segment satisfies given time .
4,465
protected function isOffsetDue ( $ offset , $ pos , $ times ) { if ( \ strpos ( $ offset , '/' ) !== false ) { return $ this -> validator -> inStep ( $ times [ $ pos ] , $ offset ) ; } if ( \ strpos ( $ offset , '-' ) !== false ) { return $ this -> validator -> inRange ( $ times [ $ pos ] , $ offset ) ; } if ( \ is_num...
Check if a given offset at a position is due with respect to given time .
4,466
public function createBioVoiceRegistration ( $ recipient , $ language = null , $ webHook = null ) { $ bioVoiceRegistration = $ this -> createEmptyBioVoiceRegistration ( ) ; $ bioVoiceRegistration -> setRecipient ( $ recipient ) ; if ( $ language !== null ) { $ bioVoiceRegistration -> setLanguage ( $ language ) ; } if (...
Create bio voice registration object
4,467
public function createSms ( $ body , array $ recipients , $ sender ) { $ sms = $ this -> createEmptySms ( ) ; $ sms -> setBody ( $ body ) ; $ sms -> setRecipients ( $ recipients ) ; $ sms -> setSender ( $ sender ) ; return $ sms ; }
Create sms object
4,468
public function createTotp ( $ identifier , $ issuer = null ) { $ totp = $ this -> createEmptyTotp ( ) ; $ totp -> setIdentifier ( $ identifier ) ; if ( null !== $ issuer ) { $ totp -> setIssuer ( $ issuer ) ; } return $ totp ; }
Create new totp secret secret
4,469
public function createWidgetSession ( array $ allowedTypes = null , $ recipient = null , $ backupCodeIdentifier = null , $ totpIdentifier = null , $ issuer = null ) { $ widgetSession = $ this -> createEmptyWidgetSession ( ) ; if ( $ allowedTypes !== null ) { $ widgetSession -> setAllowedTypes ( $ allowedTypes ) ; } if ...
Create widget session object
4,470
public function createWidgetRegisterSession ( array $ allowedTypes = null , $ recipient = null , $ backupCodeIdentifier = null , $ totpIdentifier = null , $ issuer = null ) { $ widgetRegisterSession = $ this -> createEmptyWidgetRegisterSession ( ) ; if ( $ allowedTypes !== null ) { $ widgetRegisterSession -> setAllowed...
Create widget register session object
4,471
public function getShardByRegion ( $ region ) { foreach ( $ this -> info as $ shard ) { if ( $ shard -> slug == $ region ) return $ shard ; } return null ; }
Get a shard by its region .
4,472
public function setRenderingContext ( RenderingContextInterface $ renderingContext ) { $ this -> baseRenderingContext = $ renderingContext ; $ this -> baseRenderingContext -> getViewHelperVariableContainer ( ) -> setView ( $ this ) ; $ this -> controllerContext = $ renderingContext -> getControllerContext ( ) ; }
Injects a fresh rendering context
4,473
public function assign ( $ key , $ value ) { $ templateVariableContainer = $ this -> baseRenderingContext -> getTemplateVariableContainer ( ) ; if ( $ templateVariableContainer -> exists ( $ key ) ) { $ templateVariableContainer -> remove ( $ key ) ; } $ templateVariableContainer -> add ( $ key , $ value ) ; return $ t...
Assign a value to the variable container .
4,474
public function assignMultiple ( array $ values ) { $ templateVariableContainer = $ this -> baseRenderingContext -> getTemplateVariableContainer ( ) ; foreach ( $ values as $ key => $ value ) { if ( $ templateVariableContainer -> exists ( $ key ) ) { $ templateVariableContainer -> remove ( $ key ) ; } $ templateVariabl...
Assigns multiple values to the JSON output . However only the key value is accepted .
4,475
public function render ( $ actionName = null ) { $ this -> baseRenderingContext -> setControllerContext ( $ this -> controllerContext ) ; $ this -> templateParser -> setConfiguration ( $ this -> buildParserConfiguration ( ) ) ; $ templateIdentifier = $ this -> getTemplateIdentifier ( $ actionName ) ; if ( $ this -> tem...
Loads the template source and render the template . If layoutName is set in a PostParseFacet callback it will render the file with the given layout .
4,476
protected function renderStandaloneSection ( $ sectionName , array $ variables = null , $ ignoreUnknown = false ) { $ templateIdentifier = $ this -> getTemplateIdentifier ( ) ; if ( $ this -> templateCompiler -> has ( $ templateIdentifier ) ) { $ parsedTemplate = $ this -> templateCompiler -> get ( $ templateIdentifier...
Renders a section on its own i . e . without the a surrounding template .
4,477
public static function isTotpException ( EntityException $ e ) { if ( in_array ( $ e -> getStatusCode ( ) , array ( RestStatusCodesInterface :: REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY , RestStatusCodesInterface :: REST_CLIENT_ERROR_LOCKED ) ) && in_array ( $ e -> getJsonErrorCode ( ) , self :: getVerificationJsonStatusC...
Test if the entity exception is the result of a verification exception
4,478
public function attachment ( Closure $ callback ) { $ this -> attachments [ ] = $ attachment = new Attachment ; $ callback ( $ attachment ) ; return $ this ; }
Add an attachment for the message .
4,479
public static function isBackupCodeException ( EntityException $ e ) { if ( in_array ( $ e -> getStatusCode ( ) , array ( RestStatusCodesInterface :: REST_CLIENT_ERROR_CONFLICT , RestStatusCodesInterface :: REST_CLIENT_ERROR_UNPROCESSABLE_ENTITY , RestStatusCodesInterface :: REST_CLIENT_ERROR_LOCKED ) ) && in_array ( $...
Test if the entity exception is the result of a backup code exception
4,480
public function get ( $ key , $ defaultValue = null ) { if ( isset ( $ this -> session [ $ key ] ) && ! empty ( $ this -> session [ $ key ] ) ) { return $ this -> session [ $ key ] ; } return $ defaultValue ; }
Gets a session variable
4,481
public static function load ( $ path ) { if ( is_dir ( $ path ) ) { foreach ( preg_grep ( '/^\.env$/' , scandir ( $ path ) ) as $ filename ) { $ filePath = rtrim ( $ path , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . $ filename ; if ( is_readable ( $ filePath ) ) { foreach ( parse_ini_file ( $ filePath ) as $ envKey ...
Load . env file
4,482
public function render ( $ path = null , $ package = null , Resource $ resource = null , $ localize = true ) { if ( $ resource !== null ) { $ uri = $ this -> resourceManager -> getPublicPersistentResourceUri ( $ resource ) ; if ( $ uri === false ) { $ uri = '404-Resource-Not-Found' ; } } else { if ( $ path === null ) {...
Render the URI to the resource . The filename is used from child content .
4,483
protected function makeRequest ( $ path , $ requestId , array $ params ) { if ( $ this -> appendId ( $ requestId ) ) { $ path .= "/$requestId" ; } return $ this -> request ( $ path , $ params , true ) ; }
Make the request given the proper information .
4,484
protected function setUpParams ( $ name = '' , $ requestId = null , $ data = null , $ listData = '' , $ itemData = '' ) { $ params = [ ] ; if ( ! is_null ( $ this -> locale ) ) { $ params [ 'locale' ] = $ this -> locale ; } if ( ! is_null ( $ this -> DDversion ) ) { $ params [ 'version' ] = $ this -> DDversion ; } if (...
Set up the boiler plate for the param array for any static data call .
4,485
public function featuredGames ( ) { $ response = $ this -> request ( 'featured' , [ ] , false , false ) ; return $ this -> attachStaticDataToDto ( new FeaturedGamesDto ( $ response ) ) ; }
Requests all featured games .
4,486
protected function renderHiddenFieldForEmptyValue ( ) { $ emptyHiddenFieldNames = array ( ) ; if ( $ this -> viewHelperVariableContainer -> exists ( \ TYPO3 \ Fluid \ ViewHelpers \ FormViewHelper :: class , 'emptyHiddenFieldNames' ) ) { $ emptyHiddenFieldNames = $ this -> viewHelperVariableContainer -> get ( \ TYPO3 \ ...
Renders a hidden field with the same name as the element to make sure the empty value is submitted in case nothing is selected . This is needed for checkbox and multiple select fields
4,487
public function has ( $ id ) { if ( ! is_string ( $ id ) ) { throw new ContainerException ( '$id must be a string' ) ; } if ( array_key_exists ( $ id , $ this -> definitions ) ) { return true ; } return false ; }
Check if item is available in container
4,488
public function get ( $ id ) { if ( ! is_string ( $ id ) ) { throw new ContainerException ( '$id must be a string' ) ; } if ( ! isset ( $ this -> definitions [ $ id ] ) ) { throw new NotFoundException ( "Unresolvable " . $ id ) ; } return $ this -> definitions [ $ id ] ; }
Get an item of the container
4,489
public function call ( $ action , array $ args = [ ] ) { $ method = $ action ; $ class = null ; if ( is_string ( $ action ) ) { list ( $ class , $ method ) = explode ( '@' , $ action ) ; } elseif ( is_array ( $ action ) ) { list ( $ class , $ method ) = $ action ; if ( ! is_object ( $ class ) ) { throw new ContainerExc...
Call method with given parameters
4,490
public function getParametersDictionary ( array $ args = [ ] ) { $ dictionary = [ ] ; foreach ( $ args as $ parameter ) { if ( ! is_object ( $ parameter ) ) continue ; $ dictionary [ get_class ( $ parameter ) ] = $ parameter ; } return array_merge ( $ args , $ dictionary ) ; }
Find object and set classname alias on argument list
4,491
public function getParameters ( \ ReflectionFunctionAbstract $ reflection , array $ args = [ ] ) { $ dependencies = $ reflection -> getParameters ( ) ; $ parameters = [ ] ; foreach ( $ dependencies as $ parameter ) { $ parameters [ ] = $ this -> getParameter ( $ parameter , $ args ) ; } return $ parameters ; }
Get reflection parameters
4,492
public function getParameter ( \ ReflectionParameter $ parameter , array $ args = [ ] ) { $ class = $ parameter -> getClass ( ) ; if ( $ class && $ this -> has ( $ class -> name ) ) { return $ this -> get ( $ class -> name ) ; } if ( $ class && array_key_exists ( $ class -> name , $ args ) ) { return $ args [ $ class -...
Get paremeter value
4,493
public function build ( $ class ) { $ reflection = new \ ReflectionClass ( $ class ) ; $ parameters = [ ] ; if ( ! is_null ( $ reflection -> getConstructor ( ) ) ) { $ parameters = $ this -> getParameters ( $ reflection -> getConstructor ( ) ) ; } return new $ class ( ... $ parameters ) ; }
Create a new container for asked class
4,494
public function get ( $ key ) { if ( isset ( $ this -> info [ $ key ] ) ) { return $ this -> info [ $ key ] ; } return null ; }
Gets the attribute of this Dto .
4,495
public function loadStaticData ( Staticdata $ staticData ) { $ fields = $ this -> getStaticFields ( ) ; $ optimizer = new StaticOptimizer ; $ optimizer -> optimizeFields ( $ fields ) -> setStaticInfo ( $ staticData ) ; $ this -> addStaticData ( $ optimizer ) ; return $ this ; }
Attempts to load all static data within the children DTO objects .
4,496
public function raw ( ) { $ raw = [ ] ; foreach ( $ this -> info as $ key => $ info ) { if ( is_array ( $ info ) ) { $ info = $ this -> unpack ( $ info ) ; } if ( $ info instanceof AbstractDto ) { $ info = $ info -> raw ( ) ; } $ raw [ $ key ] = $ info ; } return $ raw ; }
Returns the raw info array
4,497
protected function getStaticFields ( ) { $ fields = [ ] ; foreach ( $ this -> info as $ info ) { if ( is_array ( $ info ) ) { foreach ( $ info as $ value ) { if ( $ value instanceof AbstractDto ) { $ fields += $ value -> getStaticFields ( ) ; } } } if ( $ info instanceof AbstractDto ) { $ fields += $ info -> getStaticF...
Gets all static fields that we expect to need to get all static data for any child dto object .
4,498
protected function addStaticData ( StaticOptimizer $ optimizer ) { foreach ( $ this -> info as $ info ) { if ( is_array ( $ info ) ) { foreach ( $ info as $ value ) { if ( $ value instanceof AbstractDto ) { $ value -> addStaticData ( $ optimizer ) ; } } } if ( $ info instanceof AbstractDto ) { $ info -> addStaticData (...
Attempts to add the static data that we got from getStaticData to any children DTO objects .
4,499
protected function unpack ( array $ info ) { $ return = [ ] ; foreach ( $ info as $ key => $ value ) { if ( $ value instanceof AbstractDto ) { $ value = $ value -> raw ( ) ; } $ return [ $ key ] = $ value ; } return $ return ; }
Unpacks an array that contains Dto objects .