idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
4,800 | protected function doIterativeUserSelectionSetup ( ) { do { $ modelChoices = $ this -> getIterativeUserSelectionModeChoices ( ) ; if ( empty ( $ modelChoices ) ) return ; $ choice = $ this -> context -> command -> choice ( "Choose a model to set up Sluggable for" , array_merge ( $ modelChoices , [ 'stop' ] ) ) ; if ( $... | Runs through an iterative process wherein the user interactively selects available models to set up |
4,801 | protected function getIterativeUserSelectionModeChoices ( ) { $ choices = [ ] ; foreach ( $ this -> context -> output [ 'models' ] as $ id => $ model ) { if ( in_array ( $ id , $ this -> modelsDone ) ) continue ; $ choices [ ] = $ id . ': ' . $ model [ 'name' ] ; } ksort ( $ choices ) ; return $ choices ; } | Returns the choices for the iterative user model setup selection process leaving out the ones already handled |
4,802 | protected function createCandidateArrayForIterativeUserSelection ( $ moduleId ) { $ candidate = [ 'translated' => null , 'slug_column' => null , 'slug_sources_normal' => $ this -> context -> output [ 'models' ] [ $ moduleId ] [ 'normal_attributes' ] , 'slug_sources_translated' => $ this -> context -> output [ 'models' ... | Creates candidate array for handling sluggable interactive process for the user selection approach |
4,803 | protected function findSluggableCandidateModels ( ) { $ candidates = [ ] ; foreach ( $ this -> context -> output [ 'models' ] as $ model ) { if ( $ this -> isExcludedSluggable ( $ model [ 'module' ] ) ) continue ; if ( $ result = $ this -> applyOverrideForSluggable ( $ model ) ) { $ candidates [ $ model [ 'module' ] ] ... | Finds all the models that the user might want to make sluggable |
4,804 | protected function applyOverrideForSluggable ( array $ model ) { if ( ! array_key_exists ( $ model [ 'module' ] , $ this -> overrides ) ) { return false ; } $ override = $ this -> overrides [ $ model [ 'module' ] ] ; $ analysis = [ 'translated' => false , 'slug_column' => null , 'slug_sources_normal' => [ ] , 'slug_sou... | Returns overridden analysis result for model after checking it against the model s data |
4,805 | protected function analyzeModelForSluggable ( array $ model ) { $ analysis = [ 'translated' => null , 'slug_column' => null , 'slug_sources_normal' => [ ] , 'slug_sources_translated' => [ ] , ] ; $ slugColumns = config ( 'pxlcms.generator.models.slugs.slug_columns' , [ ] ) ; foreach ( $ slugColumns as $ slugColumn ) { ... | Determines whether the model data makes it a sluggable candidate and returns analysis result |
4,806 | public function & setBaseClassExtends ( $ class_name ) { if ( $ class_name && class_exists ( $ class_name ) && ( new \ ReflectionClass ( $ class_name ) ) -> isSubclassOf ( Entity :: class ) ) { } else { throw new InvalidArgumentException ( "Class name '$class_name' is not valid" ) ; } $ this -> base_class_extends = $ c... | Set name of a class that base type class should extend . |
4,807 | public function getIdField ( ) { if ( empty ( $ this -> id_field ) ) { $ this -> id_field = ( new IntegerField ( 'id' , 0 ) ) -> unsigned ( true ) -> size ( $ this -> getExpectedDatasetSize ( ) ) ; } return $ this -> id_field ; } | Return ID field for this type . |
4,808 | public function & addField ( FieldInterface $ field ) { if ( empty ( $ this -> fields [ $ field -> getName ( ) ] ) ) { $ this -> fields [ $ field -> getName ( ) ] = $ field ; $ field -> onAddedToType ( $ this ) ; } else { throw new InvalidArgumentException ( "Field '" . $ field -> getName ( ) . "' already exists in thi... | Add a single field to the type . |
4,809 | public function getAllIndexes ( ) { $ result = [ new Index ( 'id' , [ 'id' ] , IndexInterface :: PRIMARY ) ] ; if ( $ this -> getPolymorph ( ) ) { $ result [ ] = new Index ( 'type' ) ; } if ( ! empty ( $ this -> getIndexes ( ) ) ) { $ result = array_merge ( $ result , $ this -> getIndexes ( ) ) ; } foreach ( $ this -> ... | Return all indexes . |
4,810 | public function & orderBy ( $ order_by ) { if ( empty ( $ order_by ) ) { throw new InvalidArgumentException ( 'Order by value is required' ) ; } elseif ( ! is_string ( $ order_by ) && ! is_array ( $ order_by ) ) { throw new InvalidArgumentException ( 'Order by can be string or array' ) ; } $ this -> order_by = ( array ... | Set how records of this type should be ordered by default . |
4,811 | public function & serialize ( ... $ fields ) { if ( ! empty ( $ fields ) ) { $ this -> serialize = array_unique ( array_merge ( $ this -> serialize , $ fields ) ) ; } return $ this ; } | Set a list of fields that will be included during object serialization . |
4,812 | protected function createRegistrationRecord ( UserInterface $ user ) { $ entityClass = $ this -> getOptions ( ) -> getRegistrationEntityClass ( ) ; $ entity = new $ entityClass ( $ user ) ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ this , array ( 'user' => $ user , 'record' => $ entity ) ) ; $ entity ... | Stored user registration record to database |
4,813 | public function trigger ( Color $ color , $ method , $ args ) { if ( is_callable ( array ( $ this , $ method ) ) ) { array_unshift ( $ args , $ color ) ; return call_user_func_array ( array ( $ this , $ method ) , $ args ) ; } return null ; } | Handel the method call . |
4,814 | public static function overload ( $ envFile = ".env" ) { self :: getLoader ( ) -> overloader = true ; self :: getLoader ( ) -> innerLoad ( $ envFile ) ; } | Overload environment config |
4,815 | public function load ( ) : void { try { $ keys = $ this -> cache -> get ( self :: INDEXING_KEY ) ; if ( $ keys instanceof Keys ) { $ this -> keys = $ keys ; return ; } } catch ( CacheException $ e ) { trigger_error ( $ e -> getMessage ( ) , E_USER_WARNING ) ; } $ this -> keys = new Keys ( ) ; } | Load stored keys from Cache or create new index |
4,816 | public static function render ( SQL \ Direction $ item ) { return Compiler :: expression ( array ( Compiler :: name ( $ item -> getContent ( ) ) , $ item -> getDirection ( ) , ) ) ; } | Render a Direction object |
4,817 | private function addRecordDataAsJsonEncodedField ( $ key , $ label ) { if ( ! empty ( $ this -> record [ $ key ] ) ) { $ this -> addField ( new Field ( $ label , json_encode ( $ this -> record [ $ key ] ) ) ) ; } } | Check if a key is available in the record . If so add it as a field . |
4,818 | public function turnHexKeyToBin ( ) { if ( ! ctype_xdigit ( $ this -> secret ) ) { throw new InvalidSecretKeyException ( sprintf ( 'The secret key "%s" is not a hex key' , $ this -> secret ) ) ; } $ this -> secret = hex2bin ( $ this -> secret ) ; } | Turns the secret hex key into a binary key . |
4,819 | public static function create ( string $ name , string $ value = null ) : self { return new self ( $ name , $ value ) ; } | creates the cookie |
4,820 | private function serviceFactoryMap ( array $ providers ) : array { $ wrap = function ( $ factory ) { return [ $ factory ] ; } ; return array_reduce ( $ providers , function ( $ factories , ServiceProviderInterface $ provider ) use ( $ wrap ) { return array_merge ( $ factories , array_map ( $ wrap , $ provider -> getFac... | Return a service factory map from the given service providers . |
4,821 | private function serviceExtensionMap ( array $ providers ) : array { $ wrap = function ( $ factory ) { return [ $ factory ] ; } ; return array_reduce ( $ providers , function ( $ extensions , ServiceProviderInterface $ provider ) use ( $ wrap ) { return array_merge_recursive ( $ extensions , array_map ( $ wrap , $ prov... | Return a service extension map from the given service providers . |
4,822 | public function unverify ( ) { VerifyEmail :: sendVerificationLink ( $ this , function ( Message $ message ) { $ message -> subject ( $ this -> getVerifyEmailSubject ( ) ) ; } ) ; $ this -> setVerified ( false ) ; } | Unverify the user s email address . |
4,823 | public static function isOn ( $ value , $ flag ) { if ( ! Int :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be of type int." ) ; } if ( ! static :: is ( $ flag ) ) { throw new \ InvalidArgumentException ( "The \$flag parameter must be of type int and a power of 2." ) ; } retur... | Checks if a flag is set in a given value . |
4,824 | public static function setOn ( $ value , $ flag ) { if ( ! Int :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be of type int." ) ; } if ( is_array ( $ flag ) ) { $ ret = $ value ; foreach ( $ flag as $ item ) { $ ret = static :: setOn ( $ ret , $ item ) ; } return $ ret ; } els... | Sets a flag into a value . |
4,825 | public static function getValues ( $ count ) { if ( ! Int :: is ( $ count ) || $ count < 1 ) { throw new \ InvalidArgumentException ( "The \$count parameter must be of type int and greater than zero." ) ; } $ ret = [ ] ; $ flag = 1 ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ ret [ ] = $ flag ; $ flag <<= 1 ; } retur... | Gets an array with n consecutive flag values . |
4,826 | public static function buildMask ( $ flag1 , $ _ = null ) { if ( ! static :: is ( $ flag1 ) ) { throw new \ InvalidArgumentException ( "The first parameter must be a flag." ) ; } $ mask = $ flag1 ; $ args = array_slice ( func_get_args ( ) , 1 ) ; foreach ( $ args as $ flag ) { if ( ! static :: is ( $ flag ) ) { throw n... | Builds a flag mask with the given flags . |
4,827 | public static function mask ( $ value , $ mask ) { if ( ! Int :: is ( $ value ) || ! Int :: is ( $ mask ) ) { throw new \ InvalidArgumentException ( "Both parameters must be integers." ) ; } return ( $ value & $ mask ) ; } | Applies the mask to the given value and returns the masked result . |
4,828 | public function get ( $ index = null , $ type = null ) { return array_filter ( $ this -> entries , function ( $ entry ) use ( $ index , $ type ) { return $ entry -> match ( $ index , $ type ) ; } ) ; } | Get entries for index and type |
4,829 | public function getFinalName ( $ name ) { try { return parent :: findTemplate ( $ name ) ; } catch ( \ Twig_Error_Loader $ e ) { $ exts = \ App :: config ( 'TEMPLATE_EXTENSION' ) ; if ( $ exts ) { if ( ! is_array ( $ exts ) ) { $ exts = Array ( $ exts ) ; } foreach ( $ exts as $ e ) { try { return parent :: findTemplat... | Get the final name where a template lives regardless of whether it was called with an extension or not . |
4,830 | public function pageTheme ( ) { view ( ) -> composer ( "*" , function ( $ view ) { $ theme = config ( "pagekit.theme" , null ) ; if ( ! $ theme ) : if ( view ( ) -> exists ( "theme.page.index" ) ) : $ theme = "theme.page." ; else : $ theme = "page::" ; endif ; endif ; view ( ) -> share ( 'pageTheme' , $ theme ) ; } ) ;... | get the default theme |
4,831 | public function setAuthor ( Author $ author ) { $ this -> attachment [ 'author_name' ] = $ author ; if ( $ author -> hasIcon ( ) ) { $ this -> attachment [ 'author_icon' ] = $ author -> getIcon ( ) ; } if ( $ author -> hasLink ( ) ) { $ this -> attachment [ 'author_link' ] = $ author -> getLink ( ) ; } return $ this ; ... | The author parameters will display a small section at the top of a message attachment . |
4,832 | public function setTitle ( Title $ title ) { $ this -> attachment [ 'title' ] = $ title ; if ( $ title -> hasLink ( ) ) { $ this -> attachment [ 'title_link' ] = $ title -> getLink ( ) ; } return $ this ; } | The title is displayed as larger bold text near the top of a message attachment . |
4,833 | public function addField ( Field $ field ) { if ( ! isset ( $ this -> attachment [ 'fields' ] ) ) { $ this -> attachment [ 'fields' ] = [ ] ; } $ this -> attachment [ 'fields' ] [ ] = $ field ; return $ this ; } | Will be displayed in a table inside the message attachment . |
4,834 | public function save ( $ path = null ) { if ( is_null ( $ path ) ) { $ path = $ this -> file ; } imagejpeg ( $ this -> image , $ path ) ; return $ this ; } | save as jpeg |
4,835 | public function setTypes ( $ attr , $ type = null ) { if ( is_array ( $ attr ) ) $ this -> inputType = array_merge ( $ this -> inputType , $ attr ) ; else $ this -> inputType [ $ attr ] = $ type ; return $ this ; } | Sets the Input types . |
4,836 | public function setTypesGroup ( $ types , $ attr = null ) { if ( ! is_array ( $ types ) ) $ types = [ $ types => $ attr ] ; foreach ( $ types as $ type => $ attrList ) { if ( ! is_array ( $ attrList ) ) $ attrList = [ $ attrList ] ; foreach ( $ attrList as $ attr ) $ this -> inputType [ $ attr ] = $ type ; } return $ t... | Set new or change input types |
4,837 | private function binCheck ( $ bin , $ args = [ '--help' ] ) { $ isExecutable = is_executable ( $ bin ) ; if ( ! $ isExecutable ) { throw new \ Exception ( 'Couldn\'t execute the ' . $ bin . ' binary. Make sure it has the right permissions.' ) ; } exec ( $ bin . ' ' . implode ( ' ' , $ args ) , $ output , $ returnVar ) ... | Todo move to separatly repository |
4,838 | public function getLeafObject ( string $ filepath ) : Leaf { $ leafObject = new $ this -> leafObjectClass ( $ this -> search , $ filepath ) ; if ( $ leafObject instanceof Leaf ) { return $ leafObject ; } throw new \ RuntimeException ( sprintf ( '%s is not a subclass of %s\\Leaf' , $ this -> leafObjectClass , __NAMESPAC... | Return a new leaf object |
4,839 | public function getBannerImageSize ( $ BannerImage , $ BannerType ) { switch ( $ BannerType ) { case self :: BANNER_TYPE_INTERN : return $ this -> getImageSizeInternal ( $ BannerImage ) ; break ; case self :: BANNER_TYPE_EXTERN : return $ this -> getImageSizeExternal ( $ BannerImage ) ; break ; case self :: BANNER_TYPE... | Get the size of an image |
4,840 | protected function getImageSizeInternal ( $ BannerImage ) { try { $ arrImageSize = getimagesize ( TL_ROOT . '/' . $ BannerImage ) ; } catch ( \ Exception $ e ) { $ arrImageSize = false ; } if ( $ arrImageSize === false ) { $ arrImageSize = $ this -> getImageSizeCompressed ( $ BannerImage ) ; } ModuleBannerLog :: writeL... | Get the size of an internal image |
4,841 | protected function getImageSizeExternal ( $ BannerImage ) { $ token = md5 ( uniqid ( rand ( ) , true ) ) ; $ tmpImage = 'system/tmp/mod_banner_fe_' . $ token . '.tmp' ; if ( \ Config :: get ( 'useProxy' ) && in_array ( 'proxy' , \ ModuleLoader :: getActive ( ) ) ) { $ objRequest = new \ ProxyRequest ( ) ; } else { $ ob... | Get the size of an external image |
4,842 | protected function getImageSizeCompressed ( $ BannerImage ) { $ arrImageSize = false ; $ res = $ this -> uncompressSwcData ( $ BannerImage ) ; if ( $ res ) { $ arrImageSize = array ( $ res [ 0 ] , $ res [ 1 ] , 13 ) ; } ModuleBannerLog :: writeLog ( __METHOD__ , __LINE__ , 'Image Size: ' . print_r ( $ arrImageSize , tr... | getimagesize without zlib doesn t work workaround for this |
4,843 | public function getBannerImageSizeNew ( $ oldWidth , $ oldHeight , $ newWidth = 0 , $ newHeight = 0 ) { $ Width = $ oldWidth ; $ Height = $ oldHeight ; $ oriSize = true ; if ( $ newWidth > 0 && $ newHeight > 0 ) { $ Width = $ newWidth ; $ Height = $ newHeight ; $ oriSize = false ; } elseif ( $ newWidth > 0 ) { $ Width ... | Calculate the new size for witdh and height |
4,844 | public function getCheckBannerImageSize ( $ arrImageSize , $ maxWidth , $ maxHeight ) { if ( $ arrImageSize [ 0 ] > $ arrImageSize [ 1 ] ) { if ( $ arrImageSize [ 0 ] > $ maxWidth ) { $ newImageSize = $ this -> getBannerImageSizeNew ( $ arrImageSize [ 0 ] , $ arrImageSize [ 1 ] , $ maxWidth , 0 ) ; $ intWidth = $ newIm... | Calculate the new size if necessary by comparing with maxWidth and maxHeight |
4,845 | public function getCheckBannerImageFallback ( $ BannerImage , $ intWidth , $ intHeight ) { $ fallback_content = false ; $ path_parts = pathinfo ( $ BannerImage ) ; if ( is_file ( TL_ROOT . '/' . $ path_parts [ 'dirname' ] . '/' . $ path_parts [ 'filename' ] . '.jpg' ) ) { $ fallback_ext = '.jpg' ; $ fallback_content = ... | Search and get a flash fallback image path if exists |
4,846 | public static function defaultFQDB ( ) { if ( self :: $ defaultFQDB ) return self :: $ defaultFQDB ; if ( is_callable ( self :: $ FQDBCreatorCallback ) ) return self :: setDefaultFQDB ( call_user_func ( self :: $ FQDBCreatorCallback ) ) ; } | returns default FQDB |
4,847 | public function getUserEmail ( $ info = NULL ) { if ( empty ( $ info ) ) { $ info = $ this -> getUserInfo ( ) ; } $ emails = $ info -> get ( 'emails' ) ; if ( is_array ( $ emails ) && count ( $ emails ) ) { $ email = reset ( $ emails ) ; return $ email [ 'value' ] ; } } | Google can return an array of emails . We only give back the first one since we request one e - mail address |
4,848 | public function sign ( string $ content , string $ aud , ? string $ kid = null ) : PbjxToken { $ kid = $ kid ? : $ this -> defaultKid ; return PbjxToken :: create ( $ content , $ aud , $ kid , $ this -> getSecret ( $ kid ) ) ; } | Creates a new signed token for the provided content . |
4,849 | public function validate ( string $ content , string $ aud , string $ token ) : void { $ actualToken = PbjxToken :: fromString ( $ token ) ; $ expectedToken = PbjxToken :: create ( $ content , $ aud , $ actualToken -> getKid ( ) , $ this -> getSecret ( $ actualToken -> getKid ( ) ) , [ 'exp' => $ actualToken -> getExp ... | Validates that the provided token is valid and okay to use and also creates a new token with the same secret and content and compares our result to the provided token to determine if they are an exact match . |
4,850 | public static function beginsWith ( $ input , $ search , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING ) { $ substr = static :: sub ( $ input , 0 , static :: length ( $ search ) , $ encoding ) ; return ( static :: compare ( $ substr , $ search , $ caseInsensitive ) === 0 ) ; } | Verifies if a string begins with a substring . |
4,851 | public static function endsWith ( $ input , $ search , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING ) { if ( ( $ length = static :: length ( $ search , $ encoding ) ) == 0 ) { return true ; } $ substr = static :: sub ( $ input , - $ length , $ length , $ encoding ) ; return ( static :: compare ( $ ... | Verifies if a string ends with a substring . |
4,852 | public static function isOneOf ( $ input , array $ values , $ caseInsensitive = false , $ returnIndex = false ) { if ( is_null ( $ input ) ) { return false ; } foreach ( $ values as $ index => $ str ) { if ( static :: equals ( $ input , $ str , $ caseInsensitive ) ) { return ( $ returnIndex ) ? $ index : true ; } } ret... | Verifies if the input string is one of the values of the given array . |
4,853 | public static function match ( $ input , $ pattern , array & $ matches = null , $ flags = 0 , $ offset = 0 ) { return preg_match ( $ pattern , $ input , $ matches , $ flags , $ offset ) ; } | Searches the input string for a match to the regular expression given in pattern . |
4,854 | public static function length ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_strlen' ) ? mb_strlen ( $ input , $ encoding ) : strlen ( $ input ) ; } | Gets the length of the given string . |
4,855 | public static function replace ( $ input , $ search , $ replace , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING , & $ count = null ) { return function_exists ( 'mb_strlen' ) ? static :: mbStrReplaceCaller ( $ search , $ replace , $ input , $ caseInsensitive , $ encoding , $ count ) : ( ( $ caseInsen... | Replaces a substring inside a string . |
4,856 | protected static function mbStrReplaceCaller ( $ search , $ replace , $ subject , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING , & $ count = null ) { if ( is_array ( $ subject ) ) { $ result = [ ] ; foreach ( $ subject as $ item ) { $ result [ ] = static :: mbStrReplaceCaller ( $ search , $ replace... | Replaces a substring inside a string with multi - byte support |
4,857 | protected static function mbStrReplaceInternal ( $ search , $ replace , $ subject , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING , & $ count = null ) { $ searchLength = mb_strlen ( $ search , $ encoding ) ; $ subjectLength = mb_strlen ( $ subject , $ encoding ) ; $ offset = 0 ; $ result = '' ; whil... | Implementation of mb_str_replace . Do not call directly . |
4,858 | public static function truncate ( $ input , $ limit , $ continuation = '...' , $ isHtml = false ) { $ offset = 0 ; $ tags = [ ] ; if ( $ isHtml ) { $ input = static :: truncateHtml ( $ input , $ limit , $ offset , $ tags ) ; } $ newString = static :: sub ( $ input , 0 , $ limit = min ( static :: length ( $ input ) , $ ... | Truncates a string to the given length . |
4,859 | public static function lower ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_strtolower' ) ? mb_strtolower ( $ input , $ encoding ) : strtolower ( $ input ) ; } | Returns a lowercased string . |
4,860 | public static function upper ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_strtoupper' ) ? mb_strtoupper ( $ input , $ encoding ) : strtoupper ( $ input ) ; } | Returns an uppercased string . |
4,861 | public static function lcfirst ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_strtolower' ) ? mb_strtolower ( mb_substr ( $ input , 0 , 1 , $ encoding ) , $ encoding ) . mb_substr ( $ input , 1 , mb_strlen ( $ input , $ encoding ) , $ encoding ) : lcfirst ( $ input ) ; } | Returns a string with the first char as lowercase . |
4,862 | public static function ucfirst ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_strtoupper' ) ? mb_strtoupper ( mb_substr ( $ input , 0 , 1 , $ encoding ) , $ encoding ) . mb_substr ( $ input , 1 , mb_strlen ( $ input , $ encoding ) , $ encoding ) : ucfirst ( $ input ) ; } | Returns a string with the first char as uppercase . |
4,863 | public static function ucwords ( $ input , $ encoding = self :: DEFAULT_ENCODING ) { return function_exists ( 'mb_convert_case' ) ? mb_convert_case ( $ input , MB_CASE_TITLE , $ encoding ) : ucwords ( strtolower ( $ input ) ) ; } | Returns a string with the words capitalized . |
4,864 | protected static function studlyBuildPattern ( array $ separators ) { $ pattern = '' ; foreach ( $ separators as $ separator ) { $ pattern .= '|' . preg_quote ( $ separator ) ; } $ pattern = '/(^' . $ pattern . ')(.)/' ; return $ pattern ; } | Builds the studly patter with the given separators . |
4,865 | public static function nsprintf ( $ format , array $ args = [ ] ) { $ filterRegex = '/%s/' ; $ format = preg_replace ( $ filterRegex , '#[:~s]#' , $ format ) ; $ pattern = '/(?<=%)([a-zA-Z0-9_]\w*)(?=\$)/' ; $ pool = [ 'cr' => "\r" , 'lf' => "\n" , 'crlf' => "\r\n" , 'tab' => "\t" ] + $ args ; $ args = [ ] ; $ pos = 0 ... | Function sprintf for named variables inside format . |
4,866 | public function getSource ( ) { if ( is_array ( $ this -> source ) ) { if ( count ( $ this -> source ) != 2 ) { user_error ( 'FoundationSwitchField::getSource(): accepts only 2 options' , E_USER_ERROR ) ; } return array_slice ( $ this -> source , 0 , 2 ) ; } } | Gets the first two items from source array since SwitchField only works with two values . |
4,867 | public function cleanup ( ) { Cache :: clear ( false , 'default' ) ; Cache :: clear ( false , '_cake_model_' ) ; Cache :: clear ( false , '_cake_core_' ) ; $ this -> dispatchShell ( 'orm_cache clear' ) ; $ this -> dispatchShell ( 'orm_cache build' ) ; } | Clears the cache |
4,868 | public function migrate ( $ plugin = null ) { $ plugin = ( $ plugin === null ) ? '' : ' -p ' . $ plugin ; $ this -> dispatchShell ( 'migrations migrate' . $ plugin ) ; } | Run the migration optionally for a plugin |
4,869 | public function save ( $ fileName , $ values , $ map = null ) { if ( $ map !== null ) { $ output = $ this -> createOutputWithMap ( $ values , $ map ) ; } else { $ output = $ this -> createOutput ( $ values ) ; } $ this -> saveToFile ( $ fileName , $ output ) ; } | Writes configuration array to file |
4,870 | public function createOutputWithMap ( array $ values , array $ map ) { $ output = '' ; foreach ( $ map as $ outputLine ) { if ( $ outputLine [ 'type' ] == 'empty' ) { $ output .= PHP_EOL ; } elseif ( $ outputLine [ 'type' ] == 'comment' ) { $ output .= $ outputLine [ 'value' ] . PHP_EOL ; } else { $ output .= $ this ->... | Creates output string with provided map |
4,871 | public function createOutput ( $ values ) { $ output = '' ; foreach ( $ values as $ key => $ value ) { $ output .= $ this -> createLine ( $ key , $ value ) . PHP_EOL ; } return $ output ; } | Creates output string from configuration values |
4,872 | protected function fillTheQueue ( array $ middlewares ) { foreach ( $ middlewares as $ mw ) { if ( is_array ( $ mw ) ) { $ this -> push ( $ mw [ 0 ] , $ mw [ 1 ] ) ; } else { $ this -> push ( $ mw ) ; } } } | Fill the queue with middlewares |
4,873 | protected function evalCondition ( $ condition , RequestInterface $ request , ResponseInterface $ response ) { if ( is_object ( $ condition ) && $ condition instanceof ConditionInterface ) { return $ condition -> evaluate ( $ request , $ response ) ; } elseif ( is_callable ( $ condition ) ) { return $ condition ( $ req... | Evaluate the condition |
4,874 | public function add ( $ request ) { $ this -> onBefore ( $ request ) ; array_push ( $ this -> _requests , $ request ) ; curl_multi_add_handle ( $ this -> _mh , $ request -> curl ) ; $ this -> _updated = true ; } | Add request to execute |
4,875 | public function getBindedLink ( $ row = [ ] ) { $ bind = array_intersect_key ( $ row , array_fill_keys ( $ this -> getBinds ( ) , '' ) ) ; $ link = str_replace ( '%25' , '%' , $ this -> getLink ( ) ) ; return vsprintf ( $ link , $ bind ) ; } | Return the binded link |
4,876 | public function getTimeBetween ( $ first , $ second ) { if ( ! isset ( $ this -> lookup [ $ first ] ) ) { throw new \ LogicException ( sprintf ( 'The point %s was not marked in the profiler %s.' , $ first , $ this -> name ) ) ; } if ( ! isset ( $ this -> lookup [ $ second ] ) ) { throw new \ LogicException ( sprintf ( ... | Get the elapsed time in seconds between the two points . |
4,877 | public function setStart ( $ timeStamp = 0.0 , $ memoryBytes = 0 ) { if ( ! empty ( $ this -> points ) ) { throw new \ RuntimeException ( 'The start point cannot be adjusted after points are added to the profiler.' ) ; } $ this -> startTimeStamp = $ timeStamp ; $ this -> startMemoryBytes = $ memoryBytes ; $ point = new... | Creates a profile point with the specified starting time and memory . |
4,878 | public function install ( ) { $ publicKey = $ this -> certificateStorage -> load ( CertificateType :: PUBLIC_KEY ( ) ) ; $ response = $ this -> sendInstallationPostRequest ( '/v1/installation' , [ 'json' => [ 'client_public_key' => $ publicKey -> toString ( ) , ] , ] ) ; $ responseArray = \ json_decode ( ( string ) $ r... | Registers your public key with the Bunq API . |
4,879 | public function registerDevice ( Token $ token ) { $ this -> sendInstallationPostRequest ( '/v1/device-server' , [ 'headers' => [ 'X-Bunq-Client-Authentication' => $ token -> toString ( ) , ] , 'json' => [ 'description' => 'Bunq PHP API Client' , 'secret' => $ this -> apiKey , 'permitted_ips' => $ this -> permittedIps ... | Registers a device with the Bunq API . |
4,880 | public function createSession ( Token $ token ) { $ response = $ this -> sendInstallationPostRequest ( '/v1/session-server' , [ 'headers' => [ 'X-Bunq-Client-Authentication' => $ token -> toString ( ) , ] , 'json' => [ 'secret' => $ this -> apiKey , ] , ] ) ; $ responseArray = \ json_decode ( ( string ) $ response -> g... | Registers a session with the Bunq API . |
4,881 | private function sendInstallationPostRequest ( $ url , array $ options = [ ] ) { try { return $ this -> httpClient -> request ( 'POST' , $ url , $ options ) ; } catch ( ClientException $ exception ) { throw new BunqException ( $ exception ) ; } } | Sends a post request using the installation HTTP Client |
4,882 | private function authenticate ( ) { $ try = 0 ; while ( true ) { $ try ++ ; try { $ response = $ this -> soapClient -> __soapCall ( 'GetAuthenticationToken' , array ( array ( 'authenticationRequest' => $ this -> authenticationRequest -> toArray ( ) , ) ) ) ; return new AuthenticationTokenResponse ( new \ DateTime ( $ r... | Calls the authentication API |
4,883 | protected function getForm ( FieldTypeInterface $ field , $ force = false ) { $ datasource = $ field -> getDataSource ( ) ; if ( $ datasource === null ) { return null ; } if ( ! $ field -> getOption ( 'form_filter' ) ) { return null ; } $ field_oid = spl_object_hash ( $ field ) ; if ( isset ( $ this -> forms [ $ field_... | Builds form . |
4,884 | private function decrypt ( $ cookieValue ) { if ( $ this -> encrypter && ! empty ( $ cookieValue ) ) { return $ this -> encrypter -> decrypt ( $ cookieValue ) ; } return $ cookieValue ; } | Decrypt a cookie |
4,885 | public function evaluate ( $ expression , $ values = [ ] ) { if ( is_array ( $ values ) ) { return parent :: evaluate ( $ expression , $ values ) ; } else { return $ this -> parse ( $ expression , $ values -> getKeys ( ) ) -> getNodes ( ) -> evaluate ( $ this -> functions , $ values ) ; } } | Evaluate an expression . Overridden to allow passing in a SymbolTable . |
4,886 | public function resend ( Request $ request ) { $ user = Auth :: user ( ) ; if ( $ user -> getVerified ( ) ) { return redirect ( ) -> back ( ) ; } $ response = VerifyEmail :: sendVerificationLink ( $ user , function ( Message $ message ) use ( $ user ) { $ message -> subject ( $ user -> getVerifyEmailSubject ( ) ) ; } )... | Send another verification email . |
4,887 | public function verify ( $ token ) { $ response = VerifyEmail :: verify ( Auth :: user ( ) , $ token ) ; switch ( $ response ) { case VerifyEmail :: EMAIL_VERIFIED : return redirect ( $ this -> redirectPath ( ) ) -> with ( 'status' , trans ( $ response ) ) ; default : return redirect ( ) -> back ( ) -> withErrors ( [ '... | Attempt to verify a user . |
4,888 | public function addColumn ( Column \ Column $ column ) { $ column -> setTable ( $ this ) ; if ( ! $ column -> hasRenderer ( ) ) { $ column -> setRenderer ( $ this -> getRenderer ( ) ) ; } $ this -> columns [ $ column -> getName ( ) ] = $ column ; return $ this ; } | Add a single column to the column container |
4,889 | public function getColumnByIndex ( $ index ) { $ keys = array_keys ( $ this -> columns ) ; if ( empty ( $ keys [ $ index ] ) || empty ( $ column = $ this -> columns [ $ keys [ $ index ] ] ) ) { throw new \ InvalidArgumentException ( 'Table don\'t have a column index : ' . $ index ) ; } return $ column ; } | Return the column from his index |
4,890 | public function addRemoteBoolean ( $ name , $ label = '' , $ function = null ) { $ c = new Column \ RemoteBoolean ( $ name , $ label , $ function ) ; $ this -> addColumn ( $ c ) ; return $ c ; } | Add boolean switch |
4,891 | public function addRemoteText ( $ name , $ label = '' , $ function = null ) { $ c = new Column \ RemoteText ( $ name , $ label , $ function ) ; $ this -> addColumn ( $ c ) ; return $ c ; } | Add remote text |
4,892 | public function addRemoteSelect ( $ name , $ label = '' , $ index = null , $ option = [ ] , $ function = null ) { $ c = new Column \ RemoteSelect ( $ name , $ label , $ index , $ option , $ function ) ; $ this -> addColumn ( $ c ) ; return $ c ; } | Add remote select |
4,893 | public function addButton ( $ name , $ label = '%s' , $ link = '#' , $ binds = [ ] , $ attr = [ ] ) { $ c = new Column \ Button ( $ name , $ label , $ link , $ binds , $ attr ) ; $ c -> setOptionAsDefault ( ) ; $ this -> addColumn ( $ c ) ; return $ c ; } | Add as Button Column |
4,894 | public function addButtonEdit ( $ link = '#' , $ binds = [ ] , $ is_remote = true , $ method = 'post' ) { $ c = new Column \ Button ( configurator ( ) -> get ( 'button.edit.name' ) , configurator ( ) -> get ( 'button.edit.label' ) , $ link , $ binds ) ; $ c -> setOptionAsPrimary ( ) ; $ c -> icon ( configurator ( ) -> ... | Add default edit button |
4,895 | public function addButtonDelete ( $ link = '#' , $ binds = [ ] , $ is_remote = true , $ method = 'delete' ) { $ c = new Column \ Button ( configurator ( ) -> get ( 'button.delete.name' ) , configurator ( ) -> get ( 'button.delete.label' ) , $ link , $ binds ) ; $ c -> setOptionAsDanger ( ) ; $ c -> icon ( configurator ... | Add default delete button |
4,896 | public function addContainer ( $ name , $ label = '' , $ attr = [ ] ) { $ c = new Column \ Container ( $ name , $ label , $ attr ) ; $ this -> addColumn ( $ c ) ; return $ c ; } | Add a container columns |
4,897 | public function addColor ( $ color ) { if ( ! $ color instanceof Color ) { $ color = new Color ( $ color ) ; } $ this -> colors [ ] = $ color ; } | Adds a color to the Mixer . |
4,898 | public function mix ( ) : Color { foreach ( $ this -> colors as $ color ) { $ colors = $ color -> dec ( ) ; $ reds [ ] = $ colors [ 0 ] ; $ greens [ ] = $ colors [ 1 ] ; $ blues [ ] = $ colors [ 2 ] ; } $ red = dechex ( round ( array_sum ( $ reds ) / count ( $ reds ) ) ) ; $ green = dechex ( round ( array_sum ( $ green... | Get the mixed color . |
4,899 | public function isSourceQueryBuilder ( ) { return is_object ( $ this -> getSource ( ) ) && get_class ( $ this -> getSource ( ) ) == \ Illuminate \ Database \ Query \ Builder :: class ; } | Return true if the source is an instance of \ Illuminate \ Database \ Query \ Builder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.