idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
4,600 | public function info ( $ identities ) { $ ids = [ ] ; $ names = [ ] ; if ( is_array ( $ identities ) ) { foreach ( $ identities as $ identity ) { if ( gettype ( $ identity ) === 'integer' ) { $ ids [ ] = $ identity ; } else { $ names [ ] = $ identity ; } } } else { if ( gettype ( $ identities ) === 'integer' ) { $ ids ... | Gets the information about the user by the given identification . IDs must be of type integer otherwise numeric string values will be assumed to be names . |
4,601 | public function allInfo ( $ identities ) { $ summoners = $ this -> info ( $ identities ) ; $ this -> runePages ( $ summoners ) ; $ this -> masteryPages ( $ summoners ) ; return $ summoners ; } | Attempts to get all information about this user . This method will make 3 requests! |
4,602 | public function name ( $ identities ) { $ ids = $ this -> extractIds ( $ identities ) ; $ ids = implode ( ',' , $ ids ) ; $ array = $ this -> request ( 'summoner/' . $ ids . '/name' ) ; $ names = [ ] ; foreach ( $ array as $ id => $ name ) { $ names [ $ id ] = $ name ; } return $ names ; } | Gets the name of each summoner from a list of ids . |
4,603 | public function runePages ( $ identities ) { $ ids = $ this -> extractIds ( $ identities ) ; $ ids = implode ( ',' , $ ids ) ; $ array = $ this -> request ( 'summoner/' . $ ids . '/runes' ) ; $ summoners = [ ] ; foreach ( $ array as $ summonerId => $ data ) { $ runePages = [ ] ; foreach ( $ data [ 'pages' ] as $ info )... | Gets all rune pages of the given user object or id . |
4,604 | public function masteryPages ( $ identities ) { $ ids = $ this -> extractIds ( $ identities ) ; $ ids = implode ( ',' , $ ids ) ; $ array = $ this -> request ( 'summoner/' . $ ids . '/masteries' ) ; $ summoners = [ ] ; foreach ( $ array as $ summonerId => $ data ) { $ masteryPages = [ ] ; foreach ( $ data [ 'pages' ] a... | Gets all the mastery pages of the given user object or id . |
4,605 | protected function infoByIds ( $ ids ) { if ( count ( $ ids ) > 40 ) { throw new ListMaxException ( 'This request can only support a list of 40 elements, ' . count ( $ ids ) . ' given.' ) ; } $ idList = implode ( ',' , $ ids ) ; $ array = $ this -> request ( 'summoner/' . $ idList ) ; $ summoners = [ ] ; foreach ( $ ar... | Gets the information by the id of the summoner . |
4,606 | protected function infoByNames ( array $ names ) { if ( count ( $ names ) > 40 ) { throw new ListMaxException ( 'this request can only support a list of 40 elements, ' . count ( $ names ) . ' given.' ) ; } $ nameList = implode ( ',' , $ names ) ; $ nameList = htmlspecialchars ( $ nameList ) ; $ array = $ this -> reques... | Gets the information by the name of the summoner . |
4,607 | protected function addInterceptorToArray ( InterceptorInterface $ interceptor , array & $ interceptorArray ) { foreach ( $ interceptor -> getInterceptionPoints ( ) as $ interceptionPoint ) { if ( ! isset ( $ interceptorArray [ $ interceptionPoint ] ) ) { $ interceptorArray [ $ interceptionPoint ] = new \ SplObjectStora... | Adds an interceptor to apply to values coming from object accessors . |
4,608 | public function getInterceptors ( $ interceptionPoint ) { return isset ( $ this -> interceptors [ $ interceptionPoint ] ) ? $ this -> interceptors [ $ interceptionPoint ] : new \ SplObjectStorage ( ) ; } | Returns all interceptors for a given Interception Point . |
4,609 | public function getEscapingInterceptors ( $ interceptionPoint ) { return isset ( $ this -> escapingInterceptors [ $ interceptionPoint ] ) ? $ this -> escapingInterceptors [ $ interceptionPoint ] : new \ SplObjectStorage ( ) ; } | Returns all escaping interceptors for a given Interception Point . |
4,610 | public function render ( $ subject = null ) { if ( $ subject === null ) { $ subject = $ this -> renderChildren ( ) ; } if ( is_object ( $ subject ) && ! $ subject instanceof \ Countable ) { throw new ViewHelper \ Exception ( 'CountViewHelper only supports arrays and objects implementing \Countable interface. Given: "' ... | Counts the items of a given property . |
4,611 | protected function throwJsonException ( ) { if ( JSON_ERROR_NONE === json_last_error ( ) ) { return ; } switch ( json_last_error ( ) ) { case JSON_ERROR_DEPTH : $ error = 'The maximum stack depth has been exceeded' ; break ; case JSON_ERROR_STATE_MISMATCH : $ error = 'Invalid or malformed JSON' ; break ; case JSON_ERRO... | Throw Json exception |
4,612 | public function isLocked ( array $ regions ) { if ( count ( $ regions ) == 0 ) { return true ; } foreach ( $ regions as $ region ) { if ( $ this -> region == strtolower ( $ region ) ) { return false ; } } return true ; } | Determines wether the given region is locked out . |
4,613 | public function add ( ResourceInterface $ resource ) { $ this -> resources [ $ resource -> getName ( ) ] = $ resource ; $ this -> indexes [ ] = $ resource -> getName ( ) ; return $ this ; } | Adds a resource in the collection |
4,614 | public function remove ( $ resource ) { $ resourceName = $ this -> getResourceName ( $ resource ) ; $ index = array_search ( $ resourceName , $ this -> indexes , true ) ; if ( false !== $ index ) { unset ( $ this -> indexes [ $ index ] ) ; unset ( $ this -> resources [ $ resourceName ] ) ; return true ; } return false ... | Removes an resource from the collection |
4,615 | public function initialize ( ) { if ( false === $ this -> initialized ) { if ( ! $ this -> container ) { throw new Exception ( 'A container object is required to access the \'session\' service.' ) ; } $ this -> session = $ this -> container -> get ( 'session' ) ; $ this -> data = $ this -> session -> get ( $ this -> na... | Initialize session bag |
4,616 | public function set ( $ key , $ value ) { $ this -> initialize ( ) ; $ ids = explode ( '.' , $ key ) ; $ base = & $ this -> data ; while ( $ current = array_shift ( $ ids ) ) { if ( is_array ( $ base ) && array_key_exists ( $ current , $ base ) ) { $ base = & $ base [ $ current ] ; } else { $ base [ $ current ] = [ ] ;... | Set in bag |
4,617 | public function get ( $ key ) { $ this -> initialize ( ) ; $ ids = explode ( '.' , $ key ) ; $ base = & $ this -> data ; while ( $ current = array_shift ( $ ids ) ) { if ( is_array ( $ base ) && array_key_exists ( $ current , $ base ) ) { $ base = & $ base [ $ current ] ; } else { return null ; } } return $ base ; } | Get from bag |
4,618 | public function handleWeb ( ServerRequestInterface $ request ) { $ this -> container -> set ( 'request' , $ request ) ; $ router = $ this -> container -> get ( 'router' ) ; $ router -> handle ( ) ; $ dispatcher = new Dispatcher ( ) ; $ response = $ dispatcher -> setAction ( $ router -> getAction ( ) ) -> setActionNames... | Handle Web Request |
4,619 | public function handleCli ( $ argv ) { if ( ! $ this -> run ) { if ( ! ( count ( $ argv ) >= 2 ) ) { return ; } $ route = str_replace ( ':' , '/' , $ argv [ 1 ] ) ; unset ( $ argv [ 0 ] ) ; $ this -> getRouter ( ) -> handle ( $ route ) ; $ this -> callCli ( array_values ( $ argv ) ) ; $ this -> run = true ; } else { th... | Run application in cli request |
4,620 | private function loadConfig ( ) { $ appBundle = null ; $ this -> getEventManager ( ) -> dispatch ( self :: EVENT_BEFORE_LOAD_CONFIG , $ this ) ; foreach ( $ this -> registerBundles ( ) as $ bundle ) { if ( $ bundle instanceof \ App \ AppBundle ) { $ appBundle = $ bundle ; continue ; } $ bundle -> loadConfig ( ) ; } if ... | Load config from bundles |
4,621 | private function loadService ( ) { $ this -> getEventManager ( ) -> dispatch ( self :: EVENT_BEFORE_LOAD_SERVICE , $ this ) ; foreach ( $ this -> registerBundles ( ) as $ bundle ) { $ bundle -> loadService ( ) ; } $ this -> getEventManager ( ) -> dispatch ( self :: EVENT_AFTER_LOAD_SERVICE , $ this ) ; } | Load services from bundles |
4,622 | protected function loadServicesFromConfig ( ) { foreach ( Config :: get ( 'services' , [ ] ) as $ name => $ service ) { $ service += [ 'shared' => false , 'locked' => false , 'definition' => [ ] ] ; $ this -> container -> set ( $ name , $ service [ 'definition' ] , $ service [ 'shared' ] , $ service [ 'locked' ] ) ; } ... | Load services from config |
4,623 | public function render ( ) { $ nameAttribute = $ this -> getName ( ) ; $ this -> registerFieldNameForFormTokenGeneration ( $ nameAttribute ) ; $ output = '' ; $ resource = $ this -> getUploadedResource ( ) ; if ( $ resource !== null ) { $ resourceIdentityAttribute = '' ; if ( $ this -> hasArgument ( 'id' ) ) { $ resour... | Renders the upload field . |
4,624 | public function onException ( GetResponseForExceptionEvent $ event ) { if ( ! $ this -> eventRequestMatches ( $ event ) ) { return ; } $ event -> setResponse ( $ this -> responseTransformer -> createResponseFromContent ( $ event -> getException ( ) ) ) ; } | convert exception to rest api response |
4,625 | public function onView ( GetResponseForControllerResultEvent $ event ) { if ( ! $ this -> eventRequestMatches ( $ event ) ) { return ; } $ event -> setResponse ( $ this -> responseTransformer -> createResponseFromContent ( $ event -> getControllerResult ( ) ) ) ; } | convert response to rest api response |
4,626 | public function onResponseEarly ( FilterResponseEvent $ event ) { if ( ! $ this -> eventRequestMatches ( $ event ) ) { return ; } $ event -> setResponse ( $ this -> responseTransformer -> transformEarly ( $ event -> getRequest ( ) , $ event -> getResponse ( ) ) ) ; } | converts content to correct output format |
4,627 | public function onResponseLate ( FilterResponseEvent $ event ) { if ( ! $ this -> eventRequestMatches ( $ event ) ) { return ; } $ this -> responseTransformer -> transformLate ( $ event -> getRequest ( ) , $ event -> getResponse ( ) ) ; } | wrap the content if needed |
4,628 | public function send ( ) { if ( $ this -> useEncryption && ! empty ( $ this -> value ) ) { $ value = $ this -> encrypt ( $ this -> value ) ; } else { $ value = $ this -> value ; } setcookie ( $ this -> name , $ value , $ this -> expire , $ this -> path , $ this -> domain , $ this -> secure , $ this -> httpOnly ) ; retu... | Sends the cookie to the HTTP client Stores the cookie definition in session |
4,629 | public function delete ( ) { return setcookie ( $ this -> name , null , 1 , $ this -> path , $ this -> domain , $ this -> secure , $ this -> httpOnly ) ; } | Deletes the cookie by setting an expire time in the past |
4,630 | protected function encrypt ( $ string ) { $ iv = mcrypt_create_iv ( mcrypt_get_iv_size ( $ this -> cipher , $ this -> cipherMode ) , MCRYPT_RAND ) ; return mcrypt_encrypt ( $ this -> cipher , $ this -> secretKey , $ string , $ this -> cipherMode , $ iv ) ; } | Encrypt cookie value |
4,631 | protected function decrypt ( $ encryptedString ) { $ iv = mcrypt_create_iv ( mcrypt_get_iv_size ( $ this -> cipher , $ this -> cipherMode ) , MCRYPT_RAND ) ; return mcrypt_decrypt ( $ this -> cipher , $ this -> secretKey , $ encryptedString , $ this -> cipherMode , $ iv ) ; } | Decrypt cookie value |
4,632 | public function addRole ( $ role , array $ resources = [ ] ) { if ( $ role instanceof RoleInterface ) { $ this -> roles [ $ role -> getName ( ) ] = $ role ; } else { $ role = new Role ( $ role , $ resources ) ; $ this -> roles [ $ role -> getName ( ) ] = $ role ; } } | Add role override if exists |
4,633 | public function hasRole ( $ role ) { if ( $ role instanceof RoleInterface ) { $ role = $ role -> getName ( ) ; } if ( ! is_string ( $ role ) ) { throw new InvalidArgumentException ( 'Role argument must be string or an object implemented "Rad\Authorization\Rbac\RoleInterface".' ) ; } return isset ( $ this -> roles [ $ r... | Has role exists |
4,634 | public function isGranted ( $ resource ) { foreach ( $ this -> roles as $ role ) { if ( true === $ role -> hasResource ( $ resource ) ) { return true ; } } return false ; } | User is granted |
4,635 | protected function fromArray ( array $ definition ) { $ definition += $ this -> defaultDefinition ; $ refClass = new ReflectionClass ( $ definition [ 'class' ] ) ; $ instance = $ refClass -> newInstanceArgs ( self :: parseArguments ( $ definition [ 'arguments' ] ) ) ; foreach ( $ definition [ 'call' ] as $ methodName =... | Load definition from array |
4,636 | protected function generateResponse ( $ statusCode , $ json ) { if ( empty ( $ json ) && $ statusCode == Response :: REST_SUCCESS_NO_CONTENT ) { return new Response ( array ( ) , $ statusCode ) ; } else { $ body = json_decode ( $ json , true ) ; if ( $ body == null ) { throw new ClientException ( 'Error while sending r... | Decode json array and convert it to an array |
4,637 | protected function validateServerResponse ( Response $ response ) { switch ( $ response -> getStatusCode ( ) ) { case Response :: REST_CLIENT_ERROR_UNAUTHORIZED : throw new ClientException ( 'You have provided an invalid API key' , ClientException :: INVALID_APPLICATION_SECRET , $ response ) ; break ; case Response :: ... | Validate response from server |
4,638 | public function addMock ( $ mock ) { $ this -> guzzle = $ this -> buildGuzzle ( $ this -> guzzle -> getConfig ( ) [ 'base_uri' ] , $ mock ) ; } | Attempt to add a mocked handler stack to guzzle primary usage is to be able to test this code . |
4,639 | public function request ( $ path , array $ params = [ ] ) { if ( ! $ this -> guzzle instanceof Guzzle ) { throw new BaseUrlException ( 'BaseUrl was never set. Please call baseUrl($url).' ) ; } $ uri = $ path . '?' . http_build_query ( $ params ) ; $ response = $ this -> guzzle -> get ( $ uri , [ 'timeout' => $ this -> ... | Attempts to do a request of the given path . |
4,640 | public function renderChildren ( ) { if ( $ this -> renderChildrenClosure !== null ) { $ closure = $ this -> renderChildrenClosure ; return $ closure ( ) ; } return $ this -> viewHelperNode -> evaluateChildNodes ( $ this -> renderingContext ) ; } | Helper method which triggers the rendering of everything between the opening and the closing tag . |
4,641 | public function prepareArguments ( ) { if ( ! $ this -> argumentsInitialized ) { $ thisClassName = get_class ( $ this ) ; if ( isset ( self :: $ argumentDefinitionCache [ $ thisClassName ] ) ) { $ this -> argumentDefinitions = self :: $ argumentDefinitionCache [ $ thisClassName ] ; } else { $ this -> registerRenderMeth... | Initialize all arguments and return them |
4,642 | private function registerRenderMethodArguments ( ) { $ methodParameters = static :: getRenderMethodParameters ( $ this -> objectManager ) ; if ( count ( $ methodParameters ) === 0 ) { return ; } if ( Fluid :: $ debugMode ) { $ methodTags = static :: getRenderMethodTagsValues ( $ this -> objectManager ) ; $ paramAnnotat... | Register method arguments for render by analysing the doc comment above . |
4,643 | public static function getRenderMethodParameters ( $ objectManager ) { $ className = get_called_class ( ) ; if ( ! is_callable ( array ( $ className , 'render' ) ) ) { return array ( ) ; } $ reflectionService = $ objectManager -> get ( \ TYPO3 \ Flow \ Reflection \ ReflectionService :: class ) ; return $ reflectionServ... | Returns a map of render method parameters . |
4,644 | public static function getRenderMethodTagsValues ( $ objectManager ) { $ className = get_called_class ( ) ; if ( ! is_callable ( array ( $ className , 'render' ) ) ) { return array ( ) ; } $ reflectionService = $ objectManager -> get ( \ TYPO3 \ Flow \ Reflection \ ReflectionService :: class ) ; return $ reflectionServ... | Returns a map of render method tag values . |
4,645 | public function validateArguments ( ) { $ argumentDefinitions = $ this -> prepareArguments ( ) ; if ( ! count ( $ argumentDefinitions ) ) { return ; } foreach ( $ argumentDefinitions as $ argumentName => $ registeredArgument ) { if ( $ this -> hasArgument ( $ argumentName ) ) { if ( $ this -> arguments [ $ argumentName... | Validate arguments and throw exception if arguments do not validate . |
4,646 | public static function postParseEvent ( ViewHelperNode $ syntaxTreeNode , array $ viewHelperArguments , TemplateVariableContainer $ variableContainer ) { $ nameArgument = $ viewHelperArguments [ 'name' ] ; $ sectionName = $ nameArgument -> getText ( ) ; if ( ! $ variableContainer -> exists ( 'sections' ) ) { $ variable... | Save the associated ViewHelper node in a static public class variable . called directly after the ViewHelper was built . |
4,647 | public function render ( ) { if ( $ this -> viewHelperVariableContainer -> exists ( \ TYPO3 \ Fluid \ ViewHelpers \ SectionViewHelper :: class , 'isCurrentlyRenderingSection' ) ) { $ this -> viewHelperVariableContainer -> remove ( \ TYPO3 \ Fluid \ ViewHelpers \ SectionViewHelper :: class , 'isCurrentlyRenderingSection... | Rendering directly returns all child nodes . |
4,648 | public function write ( $ data ) { $ this -> contentLength += strlen ( $ data ) ; $ this -> data .= $ data ; return $ this ; } | Write data to the response |
4,649 | public function writeJson ( $ data ) { $ data = json_encode ( $ data ) ; $ this -> write ( $ data ) ; $ this -> addHeader ( "Content-Type" , "application/json" ) ; return $ this ; } | Write json to the response |
4,650 | public function reset ( ) { $ this -> contentLength = 0 ; $ this -> data = "" ; $ this -> headers = [ ] ; $ this -> status = 200 ; return $ this ; } | Empty current response |
4,651 | public function end ( ) { $ this -> sendHeaders ( ) ; $ this -> httpResponse -> write ( $ this -> data ) ; $ this -> httpResponse -> end ( ) ; } | End the connexion |
4,652 | public function close ( ) { $ this -> sendHeaders ( ) ; $ this -> httpResponse -> write ( $ this -> data ) ; $ this -> httpResponse -> close ( ) ; } | Close the connexion |
4,653 | public function sendHeaders ( ) { if ( $ this -> headersSent ) { return ; } if ( ! isset ( $ this -> headers [ "Content-Length" ] ) ) { $ this -> sendContentLengthHeaders ( ) ; } $ this -> httpResponse -> writeHead ( $ this -> status , $ this -> headers ) ; $ this -> headersSent = true ; } | Send all headers to the response |
4,654 | public function offsetGet ( $ offset ) { $ info = $ this -> getListByKey ( ) ; if ( ! isset ( $ info [ $ offset ] ) ) { return null ; } return $ info [ $ offset ] ; } | Get the value at the given offset . |
4,655 | public function offsetSet ( $ offset , $ value ) { $ this -> getListByKey ( ) ; if ( is_null ( $ offset ) ) { $ this -> info [ $ this -> listKey ] [ ] = $ value ; } else { $ this -> info [ $ this -> listKey ] [ $ offset ] = $ value ; } } | Set a value at the given offset . |
4,656 | protected function getListByKey ( ) { if ( $ this -> listKey == "" ) return $ this -> info ; if ( is_null ( $ this -> listKey ) || ! isset ( $ this -> info [ $ this -> listKey ] ) ) { throw new ListKeyNotSetException ( 'The listKey is not found in the abstract list DTO' ) ; } return $ this -> info [ $ this -> listKey ]... | Returns the list by key . |
4,657 | public static function setShared ( $ name , $ definition , $ locked = false ) { if ( isset ( self :: $ services [ $ name ] ) && self :: $ services [ $ name ] -> isLocked ( ) ) { throw new ServiceLockedException ( sprintf ( 'Service "%s" is locked.' , $ name ) ) ; } self :: $ services [ $ name ] = new Service ( $ name ,... | Set service as shared |
4,658 | public static function get ( $ name , array $ args = [ ] ) { if ( ! isset ( self :: $ services [ $ name ] ) ) { throw new ServiceNotFoundException ( sprintf ( 'Service "%s" does not exist.' , $ name ) ) ; } $ instance = self :: $ services [ $ name ] -> resolve ( self :: getInstance ( ) , $ args ) ; if ( $ instance inst... | Get and resolve service |
4,659 | public function inRange ( $ value , $ offset ) { $ parts = \ explode ( '-' , $ offset ) ; return $ parts [ 0 ] <= $ value && $ value <= $ parts [ 1 ] ; } | Check if the value is in range of given offset . |
4,660 | public function inStep ( $ value , $ offset ) { $ parts = \ explode ( '/' , $ offset , 2 ) ; if ( empty ( $ parts [ 1 ] ) ) { return false ; } if ( \ strpos ( $ offset , '*/' ) !== false || \ strpos ( $ offset , '0/' ) !== false ) { return $ value % $ parts [ 1 ] === 0 ; } $ parts = \ explode ( '/' , $ offset , 2 ) ; $... | Check if the value is in step of given offset . |
4,661 | public function inStepRange ( $ value , $ start , $ end , $ step ) { if ( ( $ start + $ step ) > $ end ) { return false ; } if ( $ start <= $ value && $ value <= $ end ) { return \ in_array ( $ value , \ range ( $ start , $ end , $ step ) ) ; } return false ; } | Check if the value falls between start and end when advanved by step . |
4,662 | protected function renderHiddenReferrerFields ( ) { $ result = chr ( 10 ) ; $ request = $ this -> controllerContext -> getRequest ( ) ; $ argumentNamespace = null ; if ( ! $ request -> isMainRequest ( ) ) { $ argumentNamespace = $ request -> getArgumentNamespace ( ) ; $ referrer = array ( '@package' => $ request -> get... | Renders hidden form fields for referrer information about the current controller and action . |
4,663 | public static function camelize ( $ word , $ uppercaseFirstLetter = true ) { $ word = self :: underscore ( $ word ) ; $ word = str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , $ word ) ) ) ; if ( $ uppercaseFirstLetter === false ) { $ word = lcfirst ( $ word ) ; } return $ word ; } | Convert strings to CamelCase . |
4,664 | public static function underscore ( $ word ) { $ word = preg_replace ( '/([A-Z]+)([A-Z][a-z])/' , '\1_\2' , $ word ) ; $ word = preg_replace ( '/([a-z])([A-Z])/' , '\1_\2' , $ word ) ; return str_replace ( '-' , '_' , strtolower ( $ word ) ) ; } | Make an underscored lowercase form from the expression in the string . |
4,665 | public function withNotModified ( ) { return $ this -> withStatus ( 304 ) -> withoutHeader ( 'Allow' ) -> withoutHeader ( 'Content-Encoding' ) -> withoutHeader ( 'Content-Language' ) -> withoutHeader ( 'Content-Length' ) -> withoutHeader ( 'Content-MD5' ) -> withoutHeader ( 'Content-Type' ) -> withoutHeader ( 'Last-Mod... | Sends a Not - Modified response |
4,666 | public function withEtag ( $ hash , $ weak = false ) { return $ this -> withHeader ( 'Etag' , sprintf ( '%s"%s"' , ( $ weak ) ? 'W/' : null , $ hash ) ) ; } | Set a custom ETag |
4,667 | public function sendHeaders ( ) { foreach ( $ this -> getHeaders ( ) as $ name => $ values ) { foreach ( $ values as $ value ) { header ( sprintf ( '%s: %s' , $ name , $ value ) , false ) ; } } return $ this ; } | Sends headers to the client |
4,668 | public function getSpell ( $ spellId ) { if ( isset ( $ this -> info [ 'data' ] [ $ spellId ] ) ) { return $ this -> info [ 'data' ] [ $ spellId ] ; } return null ; } | A quick short cut to get the summoner spells by id . |
4,669 | public function where ( $ param , $ filter ) { if ( is_array ( $ param ) ) { $ this -> filters = array_merge ( $ this -> filters , $ param ) ; return ; } $ this -> filters [ $ param ] = $ filter ; } | Create a new filter for current route |
4,670 | public function parse ( ) { preg_match_all ( "#\{(\w+)\}#" , $ this -> uri , $ params ) ; $ replace = [ ] ; foreach ( $ params [ 1 ] as $ param ) { $ replace [ '{' . $ param . '}' ] = '(?<' . $ param . '>' . ( isset ( $ this -> filters [ $ param ] ) ? $ this -> filters [ $ param ] : '[a-zA-Z+0-9-.]+' ) . ')' ; } $ this... | Parse route uri |
4,671 | public function match ( $ path , $ method ) { if ( ! $ this -> isParsed ( ) ) $ this -> parse ( ) ; if ( ! preg_match ( '#' . $ this -> parsedRoute . '$#' , $ path ) ) return false ; if ( strtoupper ( $ method ) !== $ this -> method ) return false ; return true ; } | Check if path match route uri |
4,672 | public function getArgs ( $ path ) { if ( ! $ this -> isParsed ( ) ) $ this -> parse ( ) ; $ data = [ ] ; $ args = [ ] ; preg_match ( '#' . $ this -> parsedRoute . '$#' , $ path , $ data ) ; foreach ( $ data as $ name => $ value ) { if ( is_int ( $ name ) ) continue ; $ args [ $ name ] = $ value ; } return $ args ; } | Parse route arguments |
4,673 | public function run ( Callable $ next , Request $ request , Response $ response ) { $ container = Container :: getInstance ( ) ; $ parameters = array_merge ( [ "request" => $ request , "response" => $ response , "next" => $ next ] , $ request -> getData ( ) ) ; try { $ container -> call ( $ this -> action , $ parameter... | Run the current route |
4,674 | public function isCronDue ( $ expr , $ time = null ) { list ( $ expr , $ times ) = $ this -> process ( $ expr , $ time ) ; foreach ( $ expr as $ pos => $ segment ) { if ( $ segment === '*' || $ segment === '?' ) { continue ; } if ( ! $ this -> checker -> checkDue ( $ segment , $ pos , $ times ) ) { return false ; } } r... | Instance call . |
4,675 | public function filter ( array $ jobs , $ time = null ) { $ dues = $ cache = [ ] ; $ time = $ this -> normalizeTime ( $ time ) ; foreach ( $ jobs as $ name => $ expr ) { $ expr = $ this -> normalizeExpr ( $ expr ) ; if ( ! isset ( $ cache [ $ expr ] ) ) { $ cache [ $ expr ] = $ this -> isCronDue ( $ expr , $ time ) ; }... | Filter only the jobs that are due . |
4,676 | protected function process ( $ expr , $ time ) { $ expr = $ this -> normalizeExpr ( $ expr ) ; $ expr = \ str_ireplace ( \ array_keys ( static :: $ literals ) , \ array_values ( static :: $ literals ) , $ expr ) ; $ expr = \ explode ( ' ' , $ expr ) ; if ( \ count ( $ expr ) < 5 || \ count ( $ expr ) > 6 ) { throw new ... | Process and prepare input . |
4,677 | private function callOnce ( $ fn ) { return function ( ... $ args ) use ( $ fn ) { if ( $ fn === null ) return ; $ fn ( ... $ args ) ; $ fn = null ; } ; } | Call callback one |
4,678 | private function waterfall ( array $ tasks , array $ args ) { $ index = 0 ; $ next = function ( ) use ( & $ index , & $ tasks , & $ next , & $ args ) { if ( $ index == count ( $ tasks ) ) { return ; } $ callback = $ this -> callOnce ( function ( ) use ( & $ next ) { $ next ( ) ; } ) ; $ tasks [ $ index ++ ] ( $ callbac... | Run tasks in series |
4,679 | public function limit ( $ hits , $ seconds , $ region = 'all' , LimitInterface $ limit = null ) { if ( is_null ( $ limit ) ) { $ limit = new Limit ; } if ( ! $ limit -> isValid ( ) ) { $ limit = new FileLimit ; if ( ! $ limit -> isValid ( ) ) { throw new NoValidLimitInterfaceException ( "We could not load a valid limit... | Sets a limit to be added to the collection . |
4,680 | public function evaluate ( RenderingContextInterface $ renderingContext ) { if ( $ this -> viewHelpersByContext -> contains ( $ renderingContext ) ) { $ viewHelper = $ this -> viewHelpersByContext -> offsetGet ( $ renderingContext ) ; $ viewHelper -> resetState ( ) ; } else { $ viewHelper = clone $ this -> uninitialize... | Call the view helper associated with this object . |
4,681 | public function render ( $ values , $ as ) { if ( $ values === null ) { return $ this -> renderChildren ( ) ; } if ( $ this -> values === null ) { $ this -> initializeValues ( $ values ) ; } if ( $ this -> currentCycleIndex === null || $ this -> currentCycleIndex >= count ( $ this -> values ) ) { $ this -> currentCycle... | Renders cycle view helper |
4,682 | public function setRegion ( $ region ) { if ( ! $ region instanceof Region ) { $ region = new Region ( $ region ) ; } $ this -> region = $ region ; return $ this ; } | Set the region code to a valid string . |
4,683 | public function attachStaticData ( $ attach = true , Staticdata $ static = null ) { $ this -> attachStaticData = $ attach ; $ this -> staticData = $ static ; return $ this ; } | Set wether to attach static data to the response . |
4,684 | public static function loadAll ( array $ bundles ) { foreach ( $ bundles as $ bundle ) { if ( ! $ bundle instanceof BundleInterface ) { throw new InvalidArgumentException ( 'Bundle must be instance of "Rad\Core\BundleInterface".' ) ; } self :: load ( $ bundle ) ; } } | Load all bundles |
4,685 | public static function isLoaded ( $ bundleName ) { $ bundleName = Inflection :: camelize ( $ bundleName ) ; return isset ( self :: $ bundlesLoaded [ $ bundleName ] ) ; } | Check bundle is loaded |
4,686 | public static function getNamespace ( $ bundleName ) { if ( isset ( self :: $ bundlesLoaded [ $ bundleName ] ) ) { return self :: $ bundlesLoaded [ $ bundleName ] [ 'namespace' ] ; } throw new MissingBundleException ( sprintf ( 'Bundle "%s" could not be found.' , $ bundleName ) ) ; } | Get bundle namespace |
4,687 | public static function getPath ( $ bundleName ) { if ( isset ( self :: $ bundlesLoaded [ $ bundleName ] ) ) { return self :: $ bundlesLoaded [ $ bundleName ] [ 'path' ] ; } throw new MissingBundleException ( sprintf ( 'Bundle "%s" could not be found.' , $ bundleName ) ) ; } | Get bundle path |
4,688 | protected function groupElements ( array $ elements , $ groupBy ) { $ groups = array ( 'keys' => array ( ) , 'values' => array ( ) ) ; foreach ( $ elements as $ key => $ value ) { if ( is_array ( $ value ) ) { $ currentGroupIndex = isset ( $ value [ $ groupBy ] ) ? $ value [ $ groupBy ] : null ; } elseif ( is_object ( ... | Groups the given array by the specified groupBy property . |
4,689 | public function playerStat ( $ playerStatId ) { if ( ! isset ( $ this -> info [ 'playerStatSummaries' ] [ $ playerStatId ] ) ) { return null ; } return $ this -> info [ 'playerStatSummaries' ] [ $ playerStatId ] ; } | Get the playerstat but the id in the response . |
4,690 | public function getLayoutRootPath ( ) { if ( $ this -> layoutRootPath === null && $ this -> templatePathAndFilename === null ) { throw new Exception \ InvalidTemplateResourceException ( 'No layout root path has been specified. Use setLayoutRootPath().' , 1288091419 ) ; } if ( $ this -> layoutRootPath === null ) { $ thi... | Returns the absolute path to the folder that contains Fluid layout files |
4,691 | public function getPartialRootPath ( ) { if ( $ this -> partialRootPath === null && $ this -> templatePathAndFilename === null ) { throw new Exception \ InvalidTemplateResourceException ( 'No partial root path has been specified. Use setPartialRootPath().' , 1288094511 ) ; } if ( $ this -> partialRootPath === null ) { ... | Returns the absolute path to the folder that contains Fluid partial files |
4,692 | protected function getTemplateSource ( $ actionName = null ) { if ( $ this -> templateSource === null && $ this -> templatePathAndFilename === null ) { throw new Exception \ InvalidTemplateResourceException ( 'No template has been specified. Use either setTemplateSource() or setTemplatePathAndFilename().' , 1288085266 ... | Returns the Fluid template source code |
4,693 | public function render ( $ for = '' , $ as = 'validationResults' ) { $ request = $ this -> controllerContext -> getRequest ( ) ; $ validationResults = $ request -> getInternalArgument ( '__submittedArgumentValidationResults' ) ; if ( $ validationResults !== null && $ for !== '' ) { $ validationResults = $ validationRes... | Iterates through selected errors of the request . |
4,694 | public function match ( $ matchId , $ includeTimeline = false ) { if ( $ includeTimeline ) { $ response = $ this -> request ( 'match/' . $ matchId , [ 'includeTimeline' => ( $ includeTimeline ) ? 'true' : 'false' ] ) ; } else { $ response = $ this -> request ( 'match/' . $ matchId ) ; } return $ this -> attachStaticDat... | Get the match by match id . |
4,695 | protected function setErrorField ( $ name , $ value , $ messages , $ arrayIndex = null ) { foreach ( $ messages as $ errorType => $ error ) { if ( is_numeric ( $ errorType ) && is_array ( $ error ) && isset ( $ error [ 'validation_errors' ] ) ) { $ arrayIndex = ( ( int ) $ errorType ) - 1 ; $ this -> setErrorField ( $ ... | Add all validation messages for one field |
4,696 | protected function getStaticFields ( ) { $ splHash = spl_object_hash ( $ this ) ; $ fields = [ $ splHash => [ ] , ] ; foreach ( $ this -> staticFields as $ field => $ data ) { if ( ! isset ( $ this -> info [ $ field ] ) ) continue ; $ fieldValue = $ this -> info [ $ field ] ; if ( ! isset ( $ fields [ $ splHash ] [ $ d... | Sets all the static fields in the current dto in the fields and aggrigates it with the child dto fields . |
4,697 | protected function addStaticData ( StaticOptimizer $ optimizer ) { $ splHash = spl_object_hash ( $ this ) ; $ info = $ optimizer -> getDataFromHash ( $ splHash ) ; foreach ( $ this -> staticFields as $ field => $ data ) { if ( ! isset ( $ this -> info [ $ field ] ) ) continue ; $ infoArray = $ info [ $ data ] ; $ field... | Takes a result array and attempts to fill in any needed static data . |
4,698 | public static function withResponse ( $ message , Response $ response ) { $ e = new static ( ) ; $ e -> response = $ response ; $ e -> message = $ message ; return $ e ; } | Static constructor for including response . |
4,699 | protected function removeArgumentsFromTemplateVariableContainer ( array $ arguments ) { $ templateVariableContainer = $ this -> getWidgetRenderingContext ( ) -> getTemplateVariableContainer ( ) ; foreach ( $ arguments as $ identifier => $ value ) { $ templateVariableContainer -> remove ( $ identifier ) ; } } | Remove the given arguments from the TemplateVariableContainer of the widget . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.