idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
19,400 | public static function Format ( $ str = '' , array $ args = [ ] ) { foreach ( $ args as $ key => $ value ) { $ pos = strpos ( $ str , '{' . $ key . '}' ) ; if ( $ pos !== FALSE ) $ str = substr ( $ str , 0 , $ pos ) . $ value . substr ( $ str , $ pos + strlen ( $ key ) + 2 ) ; } return $ str ; } | Format string function . |
19,401 | public function verifyAuthenticationRequest ( SsoClient $ ssoClient , \ TYPO3 \ Flow \ Http \ Request $ request , $ argumentName , $ signature ) { $ uri = clone $ request -> getUri ( ) ; $ arguments = $ uri -> getArguments ( ) ; unset ( $ arguments [ $ argumentName ] ) ; if ( isset ( $ arguments [ '__csrfToken' ] ) ) {... | Verifies the authenticity of an request to the authentication endpoint |
19,402 | public function buildCallbackRedirectUri ( SsoClient $ ssoClient , AccessToken $ accessToken , $ callbackUri ) { $ accessTokenCipher = $ this -> rsaWalletService -> encryptWithPublicKey ( $ accessToken -> getIdentifier ( ) , $ ssoClient -> getPublicKey ( ) ) ; $ signature = $ this -> rsaWalletService -> sign ( $ access... | Builds the callback URI to the client after authentication on the server |
19,403 | public function createAccessToken ( SsoClient $ ssoClient , \ TYPO3 \ Flow \ Security \ Account $ account ) { $ accessToken = new \ Flowpack \ SingleSignOn \ Server \ Domain \ Model \ AccessToken ( ) ; $ accessToken -> setAccount ( $ account ) ; $ accessToken -> setExpiryTime ( time ( ) + \ Flowpack \ SingleSignOn \ Se... | Create an access token for the given SSO client |
19,404 | public static function getReference ( $ name ) { if ( isset ( self :: $ customer_references [ $ name ] ) ) { return self :: $ customer_references [ $ name ] ; } else { return null ; } } | Get the target static from the manager |
19,405 | public function token ( Request $ request ) { $ bridgeResponse = new BridgeResponse ; $ oauthRequest = OAuthRequest :: createFromRequest ( $ request ) ; $ response = $ this -> server -> handleTokenRequest ( $ oauthRequest , $ bridgeResponse ) ; if ( $ response -> isOk ( ) ) { $ user = $ this -> userService -> findById ... | Handle an OAuth token request |
19,406 | protected function setLastLogin ( $ userId ) { $ user = $ this -> userService -> findById ( $ userId ) ; $ result = $ this -> userService -> update ( $ user , [ 'last_login' => time ( ) ] ) ; } | Set the last_login timestamp in the database |
19,407 | public function logout ( Request $ request ) { $ content = json_decode ( $ request -> getContent ( ) , true ) ; $ securityToken = $ this -> security -> getToken ( ) ; $ user = $ securityToken -> getUser ( ) ; $ accessToken = $ securityToken -> getOAuthToken ( ) ; $ refreshToken = Arr :: get ( $ content , 'refresh_token... | Handle logout request |
19,408 | protected function expireAccessToken ( $ accessToken ) { $ token = $ this -> accessTokenMapper -> findBy ( [ 'access_token' => $ accessToken ] ) ; if ( ! $ token ) { throw new OutOfBoundsException ( 'Access token not found.' ) ; } $ token -> setExpires ( date ( "Y-m-d H:i:s" , time ( ) ) ) ; $ this -> accessTokenMapper... | Expire an access token |
19,409 | protected function expireRefreshToken ( $ refreshToken , $ user ) { $ token = $ this -> refreshTokenMapper -> findBy ( [ 'refresh_token' => $ refreshToken , 'user_id' => $ user -> getId ( ) , ] ) ; if ( ! $ token ) { throw new OutOfBoundsException ( 'Refresh token not found.' ) ; } $ token -> setExpires ( date ( "Y-m-d... | Expire a refresh token |
19,410 | protected function getUserFromRequest ( Request $ request ) { $ username = $ request -> get ( 'username' ) ; return $ this -> userService -> findByEmail ( $ username ) ; } | Get the user from the request |
19,411 | public function cardType ( Int $ type ) { if ( ! isset ( $ this -> cardTypes [ $ type ] ) ) { throw new Exception \ InvalidCardTypeException ( NULL , $ type ) ; } $ this -> settings [ 'cardType' ] = $ type ; return $ this ; } | Sets card type . |
19,412 | public function returnUrl ( String $ success , String $ fail = NULL ) { $ this -> settings [ 'okUrl' ] = URL :: site ( $ success ) ; $ this -> settings [ 'failUrl' ] = URL :: site ( $ fail ?? $ success ) ; return $ this ; } | Sets return url . |
19,413 | protected function prep_contents ( ) { $ properties = array ( 'created' => $ this -> created , 'expiration' => $ this -> expiration , 'dependencies' => $ this -> dependencies , 'content_handler' => $ this -> content_handler ) ; $ properties = '{{' . self :: PROPS_TAG . '}}' . json_encode ( $ properties ) . '{{/' . self... | Prepend the cache properties |
19,414 | protected function unprep_contents ( $ payload ) { $ properties_end = strpos ( $ payload , '{{/' . self :: PROPS_TAG . '}}' ) ; if ( $ properties_end === false ) { throw new \ UnexpectedValueException ( 'Cache has bad formatting' ) ; } $ this -> contents = substr ( $ payload , $ properties_end + strlen ( '{{/' . self :... | Remove the prepended cache properties and save them in class properties |
19,415 | public function listAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ usageManager = $ this -> get ( 'phlexible_elementtype.usage_manager' ) ; $ elementtype = $ elementtypeService -> findElementtype ( $ id ) ; $ usa... | Show Usage of an Element Type . |
19,416 | public function addPages ( ArrayCollection $ pages ) { foreach ( $ pages as $ page ) { $ page -> addApp ( $ this ) ; $ this -> pages -> add ( $ page ) ; } } | Add pages to the app . |
19,417 | public function removePages ( ArrayCollection $ pages ) { foreach ( $ pages as $ page ) { $ page -> removeApp ( $ this ) ; $ this -> pages -> removeElement ( $ page ) ; } } | Remove pages from the app . |
19,418 | public static function init ( JSONObject $ json ) { $ object = NULL ; if ( ! $ json -> has ( "@type" ) ) throw new ModelFormatException ( "Not a valid object" ) ; try { switch ( strtolower ( $ json -> get ( "@type" ) ) ) { case "comment" : $ object = CommentObjectBuilder :: buildFromJSON ( $ json -> __toString ( ) ) ; ... | Parses the JSONObject and creates a matching Sonic object |
19,419 | public static function extractValueFromEntity ( $ entity , $ property ) { $ getter = self :: createGetter ( $ entity , $ property ) ; return $ entity -> $ getter ( ) ; } | Extract the value of a property from an entity . |
19,420 | public function install ( TaskReposity $ job ) { if ( ! $ this -> getBasic ( ) -> jobExists ( $ job -> buildCommandWithExpression ( ) ) ) { $ this -> getBasic ( ) -> event ( function ( ) use ( $ job ) { return $ job ; } ) ; $ this -> getBasic ( ) -> run ( ) ; } } | install the default cron |
19,421 | public function event ( Closure $ command ) { $ response = $ command ( ) ; if ( $ this -> resolveCommandResponse ( $ response ) ) { EventReposity :: add ( $ response ) ; } } | add a new event to reposity |
19,422 | public function run ( ) { $ events = $ this -> dueEvents ( EventReposity :: getEvents ( ) ) ; foreach ( $ events as $ event ) { $ event -> execute ( ) ; } } | run the all commands |
19,423 | public static function targetNotFound ( $ targetName , Exception $ cause = null ) { return new static ( sprintf ( 'The install target "%s" does not exist.' , $ targetName ) , self :: TARGET_NOT_FOUND , $ cause ) ; } | Creates an exception for a target name that was not found . |
19,424 | public static function addTo ( $ key , $ value ) { if ( isset ( self :: $ vars [ $ key ] ) ) { self :: $ vars [ $ key ] .= $ value ; } else { self :: $ vars [ $ key ] = $ value ; } } | Add content to an existing variable |
19,425 | public static function get ( $ key , $ nullIfUndefined = true , $ defaultValueIfUndefined = null ) { if ( ! isset ( self :: $ vars [ $ key ] ) ) { if ( $ nullIfUndefined ) { if ( $ defaultValueIfUndefined ) { return $ defaultValueIfUndefined ; } return null ; } else { throw new \ Exception ( 'Valeur ' . $ key . ' non d... | Get a variable s content |
19,426 | public static function bytesToHuman ( $ bytes , $ decimals = 2 ) { $ bytes = max ( $ bytes , 0 ) ; $ pow = floor ( ( $ bytes ? log ( $ bytes ) : 0 ) / log ( self :: KILOBYTE ) ) ; $ pow = min ( $ pow , count ( self :: $ byte_units ) - 1 ) ; $ bytes /= pow ( self :: KILOBYTE , $ pow ) ; return self :: numberFormat ( $ b... | Converts a byte number into a human readable format |
19,427 | protected function apply ( $ pinocchio ) { $ variables = array ( 'configuration' => $ this -> configuration , 'pinocchio' => $ pinocchio , ) ; ob_start ( ) ; extract ( $ variables ) ; include ( $ this -> configuration -> get ( 'template' ) ) ; return ob_get_clean ( ) ; } | Apply the formatter to the given Pinocchio instance . Returns the resulting HTML page . |
19,428 | public function factory ( $ namespace , array $ args = [ ] ) { $ namespace = $ this -> checkOverrider ( $ namespace ) ; $ this -> classExists ( $ namespace ) -> callEvent ( 'register_before_create' , [ $ namespace , $ args ] ) ; try { $ object = new $ namespace ( ... $ args ) ; } catch ( \ Exception $ exception ) { thr... | create new instance of given class |
19,429 | public function singletonFactory ( $ namespace , array $ args = [ ] , $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ namespace ; } if ( ! isset ( $ this -> singletons [ $ name ] ) ) { $ this -> singletons [ $ name ] = $ this -> factory ( $ namespace , $ args ) ; } $ this -> callEvent ( 'register_before_return... | create singleton instance of given class |
19,430 | protected function checkOverrider ( $ namespace ) { if ( $ this -> allowOverride && isset ( $ this -> overrides [ $ namespace ] ) ) { $ oldNamespace = $ namespace ; $ namespace = $ this -> overrides [ $ namespace ] [ 'overrider' ] ; $ this -> classExists ( $ namespace ) ; if ( $ this -> overrides [ $ oldNamespace ] [ '... | check that given class should be replaced by some other |
19,431 | public function destroySingleton ( $ name = null ) { if ( is_null ( $ name ) ) { $ this -> singletons = [ ] ; } if ( isset ( $ this -> singletons [ $ name ] ) ) { unset ( $ this -> singletons [ $ name ] ) ; } $ this -> makeLog ( 'Destroy singleton: ' . ( is_null ( $ name ) ? 'all' : $ name ) ) ; return $ this ; } | destroy called object |
19,432 | public function unsetOverrider ( $ namespace = null ) { if ( is_null ( $ namespace ) ) { $ this -> overrides = [ ] ; } else { unset ( $ this -> overrides [ $ namespace ] ) ; } $ this -> makeLog ( 'Override unset for: ' . $ namespace ) ; return $ this ; } | disable given or all overriders |
19,433 | function ctc_redirect_taxonomy ( ) { $ id = isset ( $ _GET [ 'id' ] ) ? ( int ) $ _GET [ 'id' ] : '' ; if ( is_front_page ( ) && ! empty ( $ _GET [ 'redirect_taxonomy' ] ) && taxonomy_exists ( $ _GET [ 'redirect_taxonomy' ] ) && ! empty ( $ id ) ) { $ taxonomy = $ _GET [ 'redirect_taxonomy' ] ; $ term_url = get_term_li... | Redirect Dropdown URL |
19,434 | public function toDBObject ( ) { $ info = pathinfo ( $ this -> path ) ; switch ( $ info [ 'extension' ] ) { case 'yaml' : case 'yml' : return DBField :: create_field ( 'YAMLField' , file_get_contents ( $ this -> path ) ) ; case 'json' : return DBField :: create_field ( 'JSONField' , file_get_contents ( $ this -> path )... | Converts the file content into a SerialisedDBField |
19,435 | public function actionInit ( ) { $ rbac = new Rbac ( ) ; $ rbac -> initRolesAndActions ( ) ; $ this -> stdout ( Yii :: t ( 'users' , 'Roles updated' ) . "\n" , Console :: FG_GREEN ) ; } | Init all roles |
19,436 | public function equals ( $ value ) { if ( is_object ( $ value ) && get_class ( $ value ) == get_class ( $ this ) ) { $ equals = $ value -> value ( ) === $ this -> value ( ) ; } else { $ equals = $ this -> value ( ) === ( ( string ) $ value ) ; } return $ equals ; } | Returns whether the value is equal to this value |
19,437 | private static function validate ( ) { $ me = get_called_class ( ) ; if ( ! isset ( self :: $ consts [ $ me ] ) ) { $ constants = self :: constants ( ) ; if ( ! isset ( $ constants [ "__DEFAULT" ] ) ) { self :: toss ( "UndefinedConstantException" , "Class {me} does have a __DEFAULT constant." ) ; } foreach ( $ constant... | Validates the enum class definition for correctness |
19,438 | public function fortypeAction ( Request $ request ) { $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ for = $ request -> get ( 'type' , Elementtype :: TYPE_FULL ) ; $ elementtypes = $ elementtypeService -> findAllElementtypes ( ) ; $ allowedForFull = $ allowedForStructure = $ al... | List Element Types . |
19,439 | public static function createArgs ( array $ pointer , array $ context ) { if ( array_key_exists ( 'args' , $ pointer ) ) { $ args = $ pointer [ 'args' ] ; if ( ! is_array ( $ args ) ) { throw new InvalidPointer ( 'args must be an array' ) ; } } elseif ( array_key_exists ( 'options' , $ pointer ) ) { $ args = [ $ pointe... | Creates a arguments list |
19,440 | public static function resolveRelatedPath ( $ from , $ to ) { $ from_parts = array_filter ( explode ( '/' , $ from ) ) ; $ to_parts = array_filter ( explode ( '/' , $ to ) ) ; foreach ( $ from_parts as $ i => $ path ) { if ( in_array ( $ path , $ to_parts ) ) { $ from_parts [ $ i ] = null ; $ to_parts [ $ i ] = null ; ... | Returns a relative path between two filesystem realpaths |
19,441 | public function map ( array & $ row ) { $ inputs = $ this -> parse ( $ this -> inputsParams , $ row ) ; $ outputs = $ this -> parse ( $ this -> outputParams , $ row ) ; return $ inputs && $ outputs ? [ $ inputs , $ outputs ] : null ; } | Creates an Instance class from an array using the inputKeys and outputKeys specified in the construct |
19,442 | public static function Trxpv ( array $ r , array $ pv , array & $ trpv ) { $ tr = [ ] ; IAU :: Tr ( $ r , $ tr ) ; IAU :: Rxpv ( $ tr , $ pv , $ trpv ) ; return ; } | - - - - - - - - - i a u T r x p v - - - - - - - - - |
19,443 | protected function trashCurrentItems ( ) { $ trash = $ this -> entity -> getEntityAttributeValueTrash ( ) ; foreach ( $ this -> items as $ value ) { $ trash -> push ( $ value ) ; } } | Trash the current values by queuing into entity object these trashed values will physically deleted on entity save . |
19,444 | public function record ( EventMessage $ message ) : void { $ eventRecord = new EventRecord ( $ message , $ this -> aggregateId , $ this -> aggregateType , $ this -> nextSequence ( ) ) ; $ this -> lastSequence = $ eventRecord -> sequenceNumber ( ) ; $ this -> eventRecords -> add ( $ eventRecord ) ; } | Records an event message |
19,445 | public function initializeSequence ( int $ committedSequence ) : void { assert ( $ this -> isEmpty ( ) , 'Cannot initialize sequence after adding events' ) ; $ this -> committedSequence = $ committedSequence ; } | Initializes the committed sequence |
19,446 | public function commit ( ) : void { $ this -> committedSequence = $ this -> lastSequence ( ) ; $ this -> eventRecords = SortedSet :: comparable ( EventRecord :: class ) ; } | Clears events and updates committed sequence number |
19,447 | public function count ( ) : int { if ( ! is_null ( $ this -> count ) ) { return $ this -> count ; } $ count = 0 ; foreach ( $ this as $ entity ) { $ count ++ ; } $ this -> count = $ count ; return $ count ; } | Get the count of entities . |
19,448 | function it_can_be_compared_to_other_template_fragments ( $ sameValue , $ differentValue , $ differentType ) { $ sameValue -> getValueMask ( ) -> willReturn ( [ '1' , '2' ] ) ; $ sameValue -> getTypeMask ( ) -> willReturn ( '[..]' ) ; $ this -> equals ( $ sameValue ) -> shouldReturn ( true ) ; $ differentValue -> getVa... | It can be compared to other template fragments . |
19,449 | public function dispatch ( $ function , $ args ) { $ class_name = get_class ( $ this ) ; $ class = new \ ReflectionClass ( $ class_name ) ; if ( $ function == '' ) { $ function = $ class -> getConstant ( 'DEFAULT_FUNCTION' ) ; } $ function = str_replace ( '.' , '' , $ function ) ; if ( $ function == '' ) { return $ thi... | Call controler function according to the given name . |
19,450 | public static function Era00 ( $ dj1 , $ dj2 ) { $ d1 ; $ d2 ; $ t ; $ f ; $ theta ; if ( $ dj1 < $ dj2 ) { $ d1 = $ dj1 ; $ d2 = $ dj2 ; } else { $ d1 = $ dj2 ; $ d2 = $ dj1 ; } $ t = $ d1 + ( $ d2 - DJ00 ) ; $ f = fmod ( $ d1 , 1.0 ) + fmod ( $ d2 , 1.0 ) ; $ theta = IAU :: Anp ( D2PI * ( $ f + 0.7790572732640 + 0.00... | - - - - - - - - - i a u E r a 0 0 - - - - - - - - - |
19,451 | public static function on ( $ class , $ name , callable $ handler ) { $ class = ObjectHelper :: getClass ( $ class ) ; if ( ! isset ( static :: $ events [ $ class ] [ $ name ] ) ) { static :: $ events [ $ class ] [ $ name ] = [ ] ; } static :: $ events [ $ class ] [ $ name ] [ ] = $ handler ; } | Subscribing in event . |
19,452 | public static function trigger ( $ class , $ name , Event $ event = null ) { if ( empty ( static :: $ events ) ) { return ; } if ( $ event === null ) { $ event = new static ; } $ event -> handled = false ; $ event -> name = $ name ; if ( is_object ( $ class ) ) { if ( $ event -> owner === null ) { $ event -> owner = $ ... | Publishing event . |
19,453 | public static function off ( $ class , $ name , callable $ handler = null ) { $ class = ObjectHelper :: getClass ( $ class ) ; if ( $ handler === null ) { unset ( static :: $ events [ $ class ] [ $ name ] ) ; if ( empty ( static :: $ events [ $ class ] ) ) { unset ( static :: $ events [ $ class ] ) ; } return true ; } ... | Detach event . |
19,454 | public static function offMulti ( array $ names ) { foreach ( $ names as $ value ) { list ( $ class , $ name ) = $ value ; static :: off ( $ class , $ name ) ; } } | Detach events . |
19,455 | public static function get ( $ class , $ name ) { $ class = ObjectHelper :: getClass ( $ class ) ; return ! empty ( static :: $ events [ $ class ] [ $ name ] ) ? static :: $ events [ $ class ] [ $ name ] : null ; } | Get event . |
19,456 | public static function exists ( $ class , $ name ) { $ class = ObjectHelper :: getClass ( $ class ) ; do { if ( ! empty ( self :: $ events [ $ class ] [ $ name ] ) ) { return true ; } } while ( ( $ class = get_parent_class ( $ class ) ) !== false ) ; return false ; } | Exists event . |
19,457 | public static function countHandlers ( $ class , $ name ) { $ class = ObjectHelper :: getClass ( $ class ) ; $ count = 0 ; do { if ( ! empty ( self :: $ events [ $ class ] [ $ name ] ) ) { $ count += count ( static :: $ events [ $ class ] [ $ name ] ) ; } } while ( ( $ class = get_parent_class ( $ class ) ) !== false )... | Count handlers of events . |
19,458 | public function toHuman ( ) { $ units = array ( "week" => 7 * 24 * 3600 , "day" => 24 * 3600 , "hour" => 3600 , "minute" => 60 , "second" => 1 , ) ; if ( $ this -> seconds == 0 ) return "0 seconds" ; $ s = "" ; foreach ( $ units as $ name => $ divisor ) { if ( $ quot = intval ( $ this -> seconds / $ divisor ) ) { $ s .... | Convert seconds to human readable text . |
19,459 | public function findAsset ( $ url ) { if ( empty ( $ url ) ) { return false ; } $ this -> asset = $ this -> processUrl ( $ url ) ; if ( $ this -> asset === false ) { return false ; } $ mainAsset = $ this -> findMainAsset ( $ this -> docRoot . DS . $ this -> assetDir . DS . $ this -> asset [ 'asset' ] ) ; if ( $ mainAss... | find the asset and create symlink |
19,460 | public function findMainAsset ( $ asset ) { if ( file_exists ( $ asset ) && $ this -> checkLink ( $ asset ) ) { return '/' . $ this -> assetDir . '/' . $ this -> asset [ 'asset' ] ; } return false ; } | check for a main asset |
19,461 | public function findThemeAsset ( $ theme , $ asset ) { if ( ! empty ( $ theme ) ) { $ Folders = $ this -> engine -> getFolders ( ) ; if ( $ Folders -> exists ( $ theme ) ) { $ this -> Folder = $ Folders -> get ( $ theme ) ; $ folderPath = rtrim ( $ this -> Folder -> getPath ( ) , '/' ) ; $ folderPath = $ this -> remove... | check for a theme asset |
19,462 | public function findFallbackAsset ( $ asset , $ Folder = null ) { $ folderEmpty = empty ( $ Folder ) ; $ folderAllowFallback = ! empty ( $ Folder ) && $ Folder -> getFallback ( ) ; if ( $ folderEmpty || $ folderAllowFallback ) { $ fallbackPath = $ this -> engine -> getDirectory ( ) ; $ fallbackPath = $ this -> removeVi... | find the fallback asset |
19,463 | public function removeViewFromPath ( $ path ) { $ folderBits = explode ( '/' , $ path ) ; if ( strtolower ( end ( $ folderBits ) ) === 'views' ) { array_pop ( $ folderBits ) ; $ path = implode ( '/' , $ folderBits ) ; } return $ path ; } | remove views from any folder path |
19,464 | public function setDocRoot ( $ docRoot ) { if ( empty ( $ docRoot ) || ! file_exists ( $ docRoot ) || ! is_dir ( $ docRoot ) ) { throw new \ InvalidArgumentException ( 'The document root set is not a valid directory.' ) ; } $ this -> docRoot = rtrim ( $ docRoot , '/' ) ; } | set the document root |
19,465 | public function setFileSystem ( $ fileSystem ) { if ( ! is_object ( $ fileSystem ) || ! is_a ( $ fileSystem , 'Symfony\Component\Filesystem\Filesystem' ) ) { throw new \ InvalidArgumentException ( 'The File System was not a valid object.' ) ; } $ this -> fileSystem = $ fileSystem ; } | set the file system |
19,466 | public function setAssetDir ( $ assetDir ) { $ emptyAssetDir = empty ( $ assetDir ) ; $ folderNotExists = ! file_exists ( $ this -> docRoot . DS . $ assetDir ) ; $ folderNotDir = ! is_dir ( $ this -> docRoot . DS . $ assetDir ) ; if ( $ emptyAssetDir || $ folderNotExists || $ folderNotDir ) { throw new \ InvalidArgumen... | set the asset container folder |
19,467 | public static function compare ( ComparableInterface $ first = null , ComparableInterface $ second = null , $ nullGreater = false ) { if ( $ first === $ second ) { return self :: EQUAL ; } elseif ( null === $ first ) { return $ nullGreater ? self :: FIRST_GT_SECOND : self :: FIRST_LT_SECOND ; } elseif ( null === $ seco... | Compares an object with another object for order . |
19,468 | public function setTemplates ( array $ templates ) { if ( $ templates !== null && is_array ( $ templates ) ) { $ this -> _userChangedTemplates = array_merge ( array_keys ( $ templates ) , $ this -> _userChangedTemplates ) ; } $ this -> _setTemplatesWrapper ( $ templates ) ; } | Sets templates to use . |
19,469 | protected function _setTemplatesInternal ( array $ templates ) { if ( is_array ( $ templates ) ) { foreach ( $ this -> _userChangedTemplates as $ key ) { if ( array_key_exists ( $ key , $ templates ) ) { unset ( $ templates [ $ key ] ) ; } } } $ this -> _setTemplatesWrapper ( $ templates ) ; } | Set templates after removing the ones previously set by the user this is to protect against overriding the users wishes |
19,470 | public function submit ( $ caption = null , array $ options = [ ] ) { if ( ! preg_match ( '/\.(jpg|jpe|jpeg|gif|png|ico)$/' , $ caption ) ) { $ options = $ this -> parseButtonClass ( $ options ) ; } if ( ! empty ( $ this -> getConfig ( 'layout.classes.submitContainer' ) ) ) { $ this -> _setTemplatesInternal ( [ 'submit... | Creates submit button but adds bootstrap styling |
19,471 | protected function _bootstrapTypeMap ( $ type ) { $ map = $ this -> _bootstrapTypeMap ; return isset ( $ map [ $ type ] ) ? $ map [ $ type ] : 'text' ; } | Maps the type to bootstrap else text |
19,472 | protected function _parseOptions ( $ fieldName , $ options ) { $ needsMagicType = false ; if ( empty ( $ options [ 'type' ] ) ) { $ needsMagicType = true ; $ context = $ this -> _getContext ( ) ; $ internalType = $ context -> type ( $ fieldName ) ; if ( $ this -> isHtml5Render ( $ options ) && in_array ( $ internalType... | In case the type is defined manually by the user we need to map it |
19,473 | static function getSession ( ) { if ( self :: $ session == null ) { $ sessionImplClassName = Settings :: getSettings ( 'php-platform/session' , "session.class" ) ; try { $ sessionImplReflectionClass = new \ ReflectionClass ( $ sessionImplClassName ) ; } catch ( \ ReflectionException $ re ) { throw new ProgrammingError ... | This method returns Session singleton object |
19,474 | public function findColumn ( $ label ) { $ column = false ; foreach ( $ this -> getColumns ( ) as $ col ) { if ( $ col -> getLabel ( ) == $ label ) { $ column = $ col ; break ; } } return $ column ; } | Finds the column with the specified label |
19,475 | public static function insert ( & $ arr , $ path , $ value , $ delimiter = '.' ) { if ( ! static :: exists ( $ arr , $ path , $ delimiter ) ) { static :: set ( $ arr , $ path , $ value , $ delimiter ) ; } } | Inserts a new value into a key or path only if the key or path does not yet exists . |
19,476 | public static function exists ( array & $ arr , $ path , $ delimiter = '.' ) { if ( array_key_exists ( $ path , $ arr ) ) { return true ; } $ segments = explode ( $ delimiter , $ path ) ; $ cur = $ arr ; foreach ( $ segments as $ segment ) { if ( ! is_array ( $ cur ) or ! array_key_exists ( $ segment , $ cur ) ) { retu... | Tests if a key or path exists in a specified array . If the specified key or path exists this method will return TRUE otherwise FALSE . |
19,477 | public static function keys ( $ array , $ prefix = null ) { $ keys = array_keys ( $ array ) ; if ( ! empty ( $ prefix ) ) { $ keys = static :: prefix ( $ keys , $ prefix ) ; } return $ keys ; } | This method will return all the keys of a given array and optionally prefix each key with a specified prefix . |
19,478 | public static function values ( $ array , $ prefix = null ) { $ values = array_values ( $ array ) ; if ( ! empty ( $ prefix ) ) { $ values = static :: prefix ( $ values , $ prefix ) ; } return $ values ; } | This method will return all values of a given array and optionally prefix each value with a specified prefix . |
19,479 | public static function map ( $ callbacks , $ arr , $ keys = null ) { foreach ( $ arr as $ key => $ val ) { if ( is_array ( $ val ) ) { $ arr [ $ key ] = static :: map ( $ callbacks , $ arr [ $ key ] ) ; } elseif ( ! is_array ( $ keys ) or in_array ( $ key , $ keys ) ) { if ( is_array ( $ callbacks ) ) { foreach ( $ cal... | Recursive version of array_map applies one or more callbacks to all elements in an array including sub - arrays . |
19,480 | public static function remapCollection ( array $ collection , array $ map , $ createMode = true ) { $ results = array ( ) ; foreach ( $ collection as $ item ) { $ results [ ] = self :: remap ( $ item , $ map , $ createMode ) ; } return $ results ; } | Remaps a collection . |
19,481 | public static function extract ( array & $ arr , $ path , $ default = null , $ delimiter = '.' ) { $ value = static :: get ( $ arr , $ path , $ default , $ delimiter ) ; static :: delete ( $ arr , $ path , $ delimiter ) ; return $ value ; } | Returns a value for a specified array key and deletes the key . |
19,482 | public static function getFromHeaderLine ( $ header_line , $ source_url ) { $ parts = explode ( ';' , trim ( $ header_line ) ) ; $ name = '' ; $ value = '' ; $ expires = null ; $ path = null ; $ domain = '' ; preg_match ( '#([^=]*)=(.*)#' , $ parts [ 0 ] , $ match ) ; $ name = trim ( $ match [ 1 ] ) ; $ value = trim ( ... | Returns a CookieDescriptor - object initiated by the given cookie - header - line . |
19,483 | protected function validateDate ( string & $ strDate ) { if ( ! preg_match ( "/\d{4}\-\d{2}-\d{2}/" , $ strDate ) ) { if ( $ iTime = strtotime ( $ strDate ) ) { $ strDate = date ( 'Y-m-d' , $ iTime ) ; } else { throw new \ Exception ( 'Invalid date string given to ' . debug_backtrace ( ) [ 1 ] [ 'function' ] . '. Use f... | Verifies that the given date string is in format YYYY - MM - DD . |
19,484 | public function transform ( $ entity ) { if ( $ entity === NULL ) { return NULL ; } $ getter = 'get' . ucfirst ( $ this -> identifierName ) ; return array ( '__class' => $ this -> entityClass , $ this -> identifierName => $ entity -> $ getter ( ) ) ; } | Transforms an entity to its json object |
19,485 | public function reverseTransform ( $ properties ) { if ( ! is_array ( $ properties ) ) { return NULL ; } if ( ! isset ( $ properties [ $ this -> identifierName ] ) ) { throw new TransformationFailedException ( sprintf ( 'Identifier (%s) for entity %s is not set in properties %s' , $ this -> identifierName , $ this -> e... | Transforms an json object to an entity |
19,486 | public function moveTo ( string $ destination ) : void { $ destination = is_dir ( $ destination ) ? ( "$destination/{$this->clientName}" ) : $ destination ; Filesystem :: checkWritable ( dirname ( $ destination ) ) ; if ( ! move_uploaded_file ( $ this -> path , $ destination ) ) { throw new FilesystemException ( "Faile... | Move the uploaded file safely to another location . Ensures that files were actually uploaded through PHP before moving them . |
19,487 | public static function create ( $ className , $ level ) { $ event = new LogEvent ( ) ; $ event -> _setLevel ( LogLevel :: create ( $ level ) ) ; $ event -> _setDate ( DateMilli :: create ( ) ) ; $ trace = debug_backtrace ( DEBUG_BACKTRACE_PROVIDE_OBJECT , 4 ) ; $ trace [ 'class' ] = $ className ; $ trace [ 'file' ] = $... | Create a new log event and return it |
19,488 | private function scandir ( $ dir ) { $ dir = trim ( $ dir , '/' ) . '/' ; $ absolute = $ this -> absolute ( $ dir ) ; $ files = scandir ( $ absolute ) ; foreach ( $ files as $ file ) { if ( $ file === "." || $ file === ".." ) { continue ; } if ( is_dir ( $ absolute . $ file ) ) { $ this -> scandir ( $ dir . $ file ) ; ... | recursively scan the directory for any files |
19,489 | public function createInstruction ( InputDescriptor $ input , TemplateInterface $ template , array $ flags = [ ] ) { if ( ! $ template -> getManaged ( ) ) { return null ; } $ cacheItem = $ this -> cacheManager -> findByTemplateAndFile ( $ template -> getKey ( ) , $ input -> getFileId ( ) , $ input -> getFileVersion ( )... | Resolve batch to queue items . |
19,490 | public function prepareHeaders ( $ requestHeaders ) { $ responseHeaders = [ ] ; if ( isset ( $ requestHeaders [ 'Origin' ] , $ this -> _cors [ 'Origin' ] ) ) { if ( in_array ( '*' , $ this -> _cors [ 'Origin' ] ) || in_array ( $ requestHeaders [ 'Origin' ] , $ this -> _cors [ 'Origin' ] ) ) { $ responseHeaders [ 'Acces... | For each CORS headers create the specific response . |
19,491 | protected function prepareAllowHeaders ( $ type , $ requestHeaders , & $ responseHeaders ) { $ requestHeaderField = 'Access-Control-Request-' . $ type ; $ responseHeaderField = 'Access-Control-Allow-' . $ type ; if ( ! isset ( $ requestHeaders [ $ requestHeaderField ] , $ this -> _cors [ $ requestHeaderField ] ) ) { re... | Handle classic CORS request to avoid duplicate code . |
19,492 | private function createClientDefinition ( $ rootDir ) { $ bugsnagClient = new Definition ( Client :: class , [ $ this -> configuration -> getApiKey ( ) , ] ) ; $ bugsnagClient -> setFactory ( [ Client :: class , "make" ] ) ; $ bugsnagClient -> setPublic ( false ) ; $ rootDir = dirname ( $ rootDir ) ; $ bugsnagClient ->... | Creates the bugsnag client |
19,493 | private function addLoggerReferenceToContainer ( Definition $ handlerDefinition , ContainerBuilder $ container ) { $ monitoringDefinition = new Definition ( FingersCrossedHandler :: class , [ $ handlerDefinition , Logger :: WARNING ] ) ; $ monitoringDefinition -> setPublic ( false ) ; $ container -> setDefinition ( sel... | Adds the monolog handler to the service container |
19,494 | private function collectReportTransformers ( Definition $ handler , ContainerBuilder $ container ) { $ taggedServices = $ container -> findTaggedServiceIds ( self :: REPORT_TRANSFORMER_TAG ) ; foreach ( $ taggedServices as $ serviceId => $ tags ) { $ handler -> addMethodCall ( "addReportTransformer" , [ new Reference (... | Collects all report transformers and registers them in the handler |
19,495 | private function registerMonologHandlerInAllChannels ( ContainerBuilder $ container ) { $ monitoringReference = new Reference ( self :: MONOLOG_HANDLER_SERVICE_ID ) ; foreach ( $ container -> getDefinitions ( ) as $ key => $ definition ) { if ( 0 === strpos ( $ key , "monolog.logger." ) ) { $ definition -> addMethodCal... | Registers the monolog handler in all channels |
19,496 | public static function create ( Comparator $ comparator , ? string $ keyType = null , ? string $ valueType = null ) : SortedTable { return new static ( $ comparator , $ keyType , $ valueType ) ; } | Creates collection with a custom comparator |
19,497 | public static function comparable ( ? string $ keyType = null , ? string $ valueType = null ) : SortedTable { assert ( Validate :: isNull ( $ keyType ) || Validate :: implementsInterface ( $ keyType , Comparable :: class ) , sprintf ( '%s expects $keyType to implement %s' , __METHOD__ , Comparable :: class ) ) ; return... | Creates collection with comparable keys |
19,498 | public function addGlobals ( $ globals ) { foreach ( $ globals as $ name => $ value ) { if ( ! is_object ( $ value ) ) { $ value = new ViewRendererStaticClassProxy ( $ value ) ; } $ this -> twig -> addGlobal ( $ name , $ value ) ; } } | Adds a global objects or static classes |
19,499 | public function addLexerOptions ( $ options ) { $ lexer = new \ Twig_Lexer ( $ this -> twig , $ options ) ; $ this -> twig -> setLexer ( $ lexer ) ; } | Sets a Twig lexer options to change templates syntax |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.