idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
7,700 | public function grantPermissions ( $ permissions ) : void { if ( ! is_array ( $ permissions ) && ! $ permissions instanceof Collection ) { $ permissions = func_get_args ( ) ; } foreach ( $ permissions as $ permission ) { $ permission = $ this -> resolvePermission ( $ permission ) ; $ permission -> assignTo ( $ this ) ;... | Grant given permissions to the group . |
7,701 | public function assign ( $ user , bool $ primary = false ) : bool { if ( $ this -> limitExceeded ( ) ) { return false ; } $ this -> users ( ) -> attach ( $ user ) ; if ( $ primary ) { $ userModel = config ( 'auth.providers.users.model' ) ; if ( is_int ( $ user ) ) { $ user = $ userModel :: find ( $ user ) ; } $ user ->... | Assign a user to the group . |
7,702 | protected function getRequest ( $ url ) { $ Request = new Request ( ) ; $ Request -> setTransport ( Request :: TRANSPORT_CURL ) ; return $ Request -> setUrl ( $ url ) -> setConnectTimeout ( $ this -> getConnectTimeout ( ) ) -> setTimeout ( $ this -> getRequestTimeout ( ) ) -> setContentTypeCode ( Request :: CONTENT_TYP... | Getter for the request |
7,703 | public function updateEditForm ( $ form ) { if ( $ doadd = Config :: inst ( ) -> get ( 'ModelAdmin' , 'addbetterimporters' ) ) { $ modelclass = $ this -> owner -> modelClass ; $ grid = $ form -> Fields ( ) -> fieldByName ( $ modelclass ) ; $ config = $ grid -> getConfig ( ) ; if ( $ config -> getComponentByType ( "Grid... | Add in new bulk GridFieldImporter |
7,704 | public static function is_disposable_email ( $ p_email ) { $ t_domain = DisposableEmailChecker :: _get_domain_from_address ( $ p_email ) ; DisposableEmailChecker :: _load_domains ( ) ; return isset ( DisposableEmailChecker :: $ domains_array [ $ t_domain ] ) ; } | Determines if the email address is disposable . |
7,705 | public static function add_domains ( array $ p_domains ) { DisposableEmailChecker :: _load_domains ( ) ; foreach ( $ p_domains as $ t_domain ) { $ t_domain = strtolower ( $ t_domain ) ; DisposableEmailChecker :: $ domains_array [ $ t_domain ] = true ; } } | Add a list of domains to the black list . |
7,706 | public static function remove_domains ( array $ p_domains ) { DisposableEmailChecker :: _load_domains ( ) ; foreach ( $ p_domains as $ t_domain ) { $ t_domain = strtolower ( $ t_domain ) ; unset ( DisposableEmailChecker :: $ domains_array [ $ t_domain ] ) ; } } | Remove a list of domains from the black list . |
7,707 | private static function _load_file ( ) { $ t_array = file ( __DIR__ . '/../../data/domains.txt' ) ; $ t_result_array = array ( ) ; foreach ( $ t_array as $ t_line ) { $ t_entry = trim ( $ t_line ) ; if ( empty ( $ t_entry ) ) { continue ; } if ( strpos ( $ t_entry , '#' ) === 0 ) { continue ; } $ t_domain = strtolower ... | Loads the domains list from disk . |
7,708 | private static function _get_domain_from_address ( $ p_email ) { $ t_domain_pos = strpos ( $ p_email , '@' ) ; if ( $ t_domain_pos === false ) { return $ p_email ; } return strtolower ( substr ( $ p_email , $ t_domain_pos + 1 ) ) ; } | A helper function that takes in an email address and returns a lower case domain . |
7,709 | public function initializeObject ( ) { $ settings = $ this -> configurationManager -> getConfiguration ( \ Neos \ Flow \ Configuration \ ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , 'Neos.Flow' ) ; if ( isset ( $ settings [ 'security' ] [ 'authentication' ] [ 'providers' ] [ 'Neos.Setup:Login' ] [ 'providerOpt... | Gets the authentication provider configuration needed |
7,710 | public function generateNewPasswordAction ( $ step = 0 ) { $ existingPasswordFile = Files :: concatenatePaths ( [ FLOW_PATH_DATA , 'Persistent' , 'FileBasedSimpleKeyService' , $ this -> keyName ] ) ; if ( file_exists ( $ existingPasswordFile ) ) { unlink ( $ existingPasswordFile ) ; $ this -> addFlashMessage ( 'A new p... | Removes the existing password and starts over by generating a new one . |
7,711 | public function all ( Request $ request ) { $ this -> authorize ( 'list-google-apps-users' ) ; $ perPage = config ( 'users.google_apps_users_per_page' , 15 ) ; if ( $ request -> has ( 'perPage' ) ) { $ perPage = $ request -> input ( 'perPage' ) ; } $ users = $ this -> service -> getUsers ( $ perPage ) ; return $ this -... | List Google apps users . |
7,712 | public function add ( $ element ) { if ( ! in_array ( $ element , $ this -> collection , true ) ) { $ this -> collection [ $ this -> size ( ) ] = $ element ; } return $ this ; } | Adds an element to that set |
7,713 | public function weather ( \ Twig_Environment $ environment , $ city ) { $ weathers = $ this -> weatherFactory -> getWeatherObject ( $ city ) ; return $ environment -> render ( 'PianoSoloWeatherBundle:Weather:weather.html.twig' , array ( 'city' => $ city , 'weathers' => $ weathers , 'downloadEnabled' => $ this -> downlo... | Renders weather object of a city |
7,714 | public function forecast ( \ Twig_Environment $ environment , $ city , $ days = 3 ) { $ weathers = $ this -> weatherFactory -> getForecastObject ( $ city , $ days ) ; return $ environment -> render ( 'PianoSoloWeatherBundle:Weather:weather.html.twig' , array ( 'city' => $ city , 'weathers' => $ weathers , 'downloadEnab... | Renders weather list of a city for days |
7,715 | public function checkUserFollowing ( $ user , $ target ) { $ path = "/user/$user/following/$target" ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; switch ( $ response -> code ) { case '204' : return true ; case '404' : return false ; default : throw new \ UnexpectedValueException ( 'Unexpect... | Check if one user follows another . |
7,716 | protected function paginate ( $ items , $ perPage = 15 ) { $ currentPage = LengthAwarePaginator :: resolveCurrentPage ( ) ; $ currentPageItems = collect ( $ items ) -> slice ( ( $ currentPage - 1 ) * $ perPage , $ perPage ) ; return new LengthAwarePaginator ( $ currentPageItems , count ( $ items ) , $ perPage ) ; } | Create a length aware custom paginator instance . |
7,717 | public static function registerTasks ( array $ tasks ) { foreach ( $ tasks as $ key => $ task ) { $ roles = array_key_exists ( 'roles' , $ task ) ? $ task [ 'roles' ] : null ; self :: registerTask ( $ key , $ task [ 'desc' ] , $ task [ 'callback' ] , $ roles ) ; } } | Register All N98 Tasks |
7,718 | public function update ( $ user , $ repo , $ label , $ name , $ color ) { $ path = '/repos/' . $ user . '/' . $ repo . '/labels/' . $ label ; $ data = json_encode ( array ( 'name' => $ name , 'color' => $ color , ) ) ; return $ this -> processResponse ( $ this -> client -> patch ( $ this -> fetchUrl ( $ path ) , $ data... | Update a label . |
7,719 | public function register ( ) { $ this -> app -> bind ( 'JonathanTorres\LaravelMediumSdk\LaravelMediumSdk' , function ( $ app ) { return new Medium ( [ 'client-id' => config ( 'laravel-medium-sdk.client-id' ) , 'client-secret' => config ( 'laravel-medium-sdk.client-secret' ) , 'redirect-url' => config ( 'laravel-medium-... | Register Medium class instance in the container . |
7,720 | public function getScript ( ) { $ script = view ( 'survivor::script' ) -> with ( [ 'token' => csrf_token ( ) , 'url' => route ( 'survivor.ping' ) , 'interval' => config ( 'survivor.interval' , 300000 ) , 'input_elements' => config ( 'survivor.input_elements' , 'input[name=_token]' ) , ] ) -> render ( ) ; return preg_re... | Return the script tag for the survivor lib |
7,721 | public function has ( string $ criterion ) : bool { foreach ( $ this -> criteria as $ haystack ) { if ( \ get_class ( $ haystack ) === $ criterion ) { return true ; } } return false ; } | The method checks for the presence of the required criterion inside the query . |
7,722 | public function column ( string $ name ) : string { $ name = \ addcslashes ( $ name , "'" ) ; $ table = $ this -> getMetadata ( ) -> getTableName ( ) ; return \ sprintf ( "FIELD('%s', '%s', '%s')" , $ table , $ this -> getAlias ( ) , $ name ) ; } | Creates the ability to directly access the table s column . |
7,723 | public function merge ( Query $ query ) : Query { foreach ( $ query -> getCriteria ( ) as $ criterion ) { $ criterion -> attach ( $ this ) ; } return $ this -> attach ( $ query ) ; } | Copies a set of Criteria from the child query to the parent . |
7,724 | public function create ( ) : Query { $ query = static :: new ( ) -> scope ( ... $ this -> getScopes ( ) ) ; if ( $ this -> repository ) { return $ query -> from ( $ this -> repository ) ; } return $ query ; } | Creates a new query using the current set of scopes . |
7,725 | public static function findIp ( ) { if ( ( int ) Configure :: read ( 'debug' ) > 1 ) { $ ip = Configure :: read ( 'App.defaultIp' ) ; if ( $ ip ) { return $ ip ; } return '127.0.0.1' ; } $ ip = Utility :: getClientIp ( ) ; if ( strpos ( $ ip , ',' ) !== false ) { return false ; } return $ ip ; } | Returns current IP address . Note that in debug mode it will emulate it - and retrieve the preconfigured one . |
7,726 | public function getDistrictsByCity ( $ citySlug , $ type = 'all' ) { $ options = [ 'contain' => [ 'Cities' ] , 'conditions' => [ $ this -> Cities -> getAlias ( ) . '.slug' => $ citySlug , ] , 'fields' => [ $ this -> getAlias ( ) . '.slug' , $ this -> getAlias ( ) . '.name' ] , ] ; return $ this -> find ( $ type , $ opt... | For start page |
7,727 | public function importAction ( Request $ request ) { if ( ! $ request -> files -> has ( 'redirectRoutes' ) ) { return new JsonResponse ( null , Response :: HTTP_BAD_REQUEST ) ; } $ uploadedFile = $ request -> files -> get ( 'redirectRoutes' ) ; $ file = $ uploadedFile -> move ( $ this -> importPath , $ uploadedFile -> ... | Import file which was uploaded . |
7,728 | private function importFile ( File $ file ) { $ response = [ 'fileName' => $ file -> getFilename ( ) , 'total' => 0 , 'exceptions' => [ ] , ] ; foreach ( $ this -> import -> import ( $ file -> getRealPath ( ) ) as $ item ) { ++ $ response [ 'total' ] ; if ( ! $ item -> getException ( ) ) { continue ; } $ response [ 'ex... | Import given file and returns serializable response . |
7,729 | private function interpret ( array $ line , array $ header ) { $ item = [ ] ; foreach ( $ header as $ index => $ key ) { $ item [ $ key ] = array_key_exists ( $ index , $ line ) ? $ line [ $ index ] : null ; } return $ item ; } | Interpret given line . |
7,730 | public function setOption ( $ option , $ value ) { if ( ! is_string ( $ option ) ) { throw new InvalidArgumentException ( 'Option name needs to be a string' ) ; } $ this -> options [ $ option ] = $ value ; } | Sets the value of the specified option . |
7,731 | public function getOption ( $ option ) { if ( ! array_key_exists ( $ option , $ this -> options ) ) { throw new OutOfBoundsException ( "Option '$option' has not been set so cannot be obtained" ) ; } return $ this -> options [ $ option ] ; } | Returns the value of the specified option . If the option is not set an InvalidArgumentException is thrown . |
7,732 | public function codeList ( $ conditions = [ ] ) { $ conditions += [ 'status' => 1 ] ; $ res = $ this -> find ( 'all' , [ 'conditions' => $ conditions , 'fields' => [ 'code' , 'name' ] ] ) ; $ ret = [ ] ; foreach ( $ res as $ language ) { $ ret [ $ language [ 'code' ] ] = $ language [ 'name' ] ; } return $ ret ; } | DE = > Deutsch ... |
7,733 | public function get ( $ name ) { $ this -> initialize ( ) ; if ( ! isset ( $ this -> parameters [ $ name ] ) && ! array_key_exists ( $ name , $ this -> parameters ) ) { if ( $ this -> container ) { return $ this -> container -> getParameter ( $ name ) ; } return null ; } return $ this -> parameters [ $ name ] ; } | Gets a parameter by name . If the parameter is undefined this method will defer to the service container if available . |
7,734 | public function has ( $ name ) { $ this -> initialize ( ) ; if ( parent :: has ( $ name ) ) { return true ; } if ( $ this -> container !== null ) { return $ this -> container -> hasParameter ( $ name ) ; } return false ; } | Returns whether a parameter is defined . This method does not consider parameters from the service container regardless of its availability . |
7,735 | protected function appendVersionToPath ( string $ path ) : string { return ( $ this -> version ) ? ( $ path . '?v=' . $ this -> version ) : ( $ path ) ; } | Append version parameter to the asset path . |
7,736 | protected function createUploadedFile ( $ file ) { try { $ imageManager = new ImageManager ; $ image = $ imageManager -> make ( $ file ) ; $ extension = $ this -> getExtensionFromMime ( $ image -> mime ( ) ) ; $ fileName = $ this -> generateFileName ( $ extension ) ; $ temporaryPath = $ this -> getTemporaryImageBasePat... | create uploaded file |
7,737 | protected function getTemporaryImageBasePath ( ) { $ basePath = $ this -> getImageBasePath ( ) ; $ temporaryPath = $ basePath . '/' . $ this -> temporaryPath ; if ( ! File :: exists ( $ temporaryPath ) ) { File :: makeDirectory ( $ temporaryPath , 0755 , true ) ; } return $ temporaryPath ; } | get temporary image base path |
7,738 | public function generateImageUrl ( $ file , $ size = null ) { $ url = $ this -> config -> get ( 'prefix' ) . '/' . $ file ; if ( ! is_null ( $ size ) ) { $ url .= '?size=' . $ size ; } return URL :: to ( $ url ) ; } | generate image file url |
7,739 | public static function wrap ( $ value ) : self { switch ( true ) { case $ value instanceof self : return new static ( $ value ) ; case $ value instanceof BaseCollection : return new static ( $ value ) ; default : return new static ( Arr :: wrap ( $ value ) ) ; } } | Wrap the given value in a collection if applicable . |
7,740 | public function boot ( ) { $ this -> publishes ( [ __DIR__ . '/../config/config.php' => config_path ( 'survivor.php' ) ] , 'survivor' ) ; $ this -> loadViewsFrom ( __DIR__ . '/../views' , 'survivor' ) ; if ( ! $ this -> app -> routesAreCached ( ) ) { require __DIR__ . '/routes.php' ; } require __DIR__ . '/helpers.php' ... | Boot up the provider and load routes |
7,741 | public function getRevisions ( array $ identifyingInfoArray ) { $ entityIdStrings = array ( ) ; $ siteLinksStringMapping = array ( ) ; foreach ( $ identifyingInfoArray as $ someInfo ) { if ( $ someInfo instanceof EntityId ) { $ entityIdStrings [ ] = $ someInfo -> getSerialization ( ) ; } elseif ( $ someInfo instanceof ... | Get revisions for the entities identified using as few requests as possible . |
7,742 | public function stats ( ) { $ res = [ ] ; $ query = $ this -> find ( ) ; $ list = $ query -> select ( [ 'count' => $ query -> count ( ) , 'country_id' ] ) -> group ( 'country_id' ) -> hydrate ( false ) -> all ( ) ; foreach ( $ list as $ x ) { $ res [ $ x [ 'country_id' ] ] = ( int ) $ x [ 'count' ] ; } return $ res ; } | Postal codes per country |
7,743 | public function redirect ( Request $ request , RedirectRouteInterface $ redirectRoute ) { if ( 410 === $ redirectRoute -> getStatusCode ( ) ) { throw new HttpException ( 410 ) ; } $ queryString = http_build_query ( $ request -> query -> all ( ) ) ; $ url = [ $ redirectRoute -> getTarget ( ) , false === strpos ( $ redir... | Handles redirect for given redirect - route . |
7,744 | public function log ( $ message ) { if ( null !== $ this -> logger ) { call_user_func ( array ( $ this -> logger , $ this -> level ) , $ message ) ; } } | Log a message at the specified level . |
7,745 | protected function _processCountry ( $ cid ) { $ saveCid = true ; if ( empty ( $ cid ) ) { $ saveCid = false ; $ cid = $ this -> request -> getSession ( ) -> read ( 'State.cid' ) ; } if ( ! empty ( $ cid ) && $ cid < 0 ) { $ this -> request -> getSession ( ) -> delete ( 'State.cid' ) ; $ cid = null ; } elseif ( ! empty... | For both index views |
7,746 | public function toggle ( $ field = null , $ id = null ) { $ fields = [ 'active' ] ; if ( ! empty ( $ field ) && in_array ( $ field , $ fields ) && ! empty ( $ id ) ) { $ value = $ this -> { $ this -> modelClass } -> toggleField ( $ field , $ id ) ; } if ( ! $ this -> request -> is ( 'ajax' ) ) { $ this -> Flash -> succ... | Toggle - ajax |
7,747 | private function openConnection ( \ stdClass $ initData ) { $ connectionOptions = $ this -> parseConnectionData ( $ initData ) ; if ( isset ( $ this -> persistent ) && ( boolean ) $ this -> persistent ) { $ this -> persistentConnect ( $ connectionOptions ) ; } else { $ this -> notPersistentConnect ( $ connectionOptions... | Opens a connection to memcached server . |
7,748 | private function parseConnectionData ( \ stdClass $ initData ) { $ return = new \ stdClass ; $ return -> host = isset ( $ initData -> host ) ? $ initData -> host : self :: DEFAULT_HOST ; $ return -> port = isset ( $ initData -> port ) ? $ initData -> port : null ; $ return -> timeout = isset ( $ initData -> timeoutInSe... | Fixes memcached configuration . |
7,749 | public function run ( $ id , $ attribute ) { $ model = $ this -> findModel ( $ this -> modelClass , $ id ) ; if ( ! $ model -> hasAttribute ( $ attribute ) ) { throw new InvalidConfigException ( "Attribute doesn't exist." ) ; } if ( $ model -> $ attribute == $ this -> onValue ) { $ model -> $ attribute = $ this -> offV... | Change column value |
7,750 | private function save ( RedirectRouteInterface $ entity ) { $ this -> manager -> save ( $ entity ) ; if ( 0 === count ( $ this -> sources ) % $ this -> batchSize ) { $ this -> entityManager -> flush ( ) ; } } | Save entity by using manager . |
7,751 | private function validate ( RedirectRouteInterface $ entity ) { if ( '' === $ entity -> getTarget ( ) && Response :: HTTP_GONE !== ( int ) $ entity -> getStatusCode ( ) ) { throw new TargetIsEmptyException ( $ entity ) ; } if ( in_array ( strtolower ( $ entity -> getSource ( ) ) , $ this -> sources ) ) { throw new Dupl... | Validate given redirect - route . |
7,752 | public function importFromCore ( ) { if ( ! empty ( $ this -> request -> query [ 'reset' ] ) ) { $ this -> Languages -> truncate ( ) ; } $ languages = $ this -> Languages -> catalog ( ) ; $ count = 0 ; $ errors = [ ] ; foreach ( $ languages as $ language ) { if ( ! ( $ code = $ this -> Languages -> iso3ToIso2 ( $ langu... | Should only be done once at the very beginning |
7,753 | public function from ( $ number , $ name = null ) { $ this -> senderNumber = $ number ; $ this -> senderName = $ name ; return $ this ; } | set SMS sender details . |
7,754 | public function send ( ) { return $ this -> client -> executeRequest ( new OutboundSMSRequest ( $ this -> message , $ this -> recipientNumber , $ this -> senderNumber , $ this -> senderName ) ) ; } | Send SMS . |
7,755 | public function statistics ( $ country = null , $ appID = null ) { return $ this -> client -> executeRequest ( new StatisticsRequest ( $ country , $ appID ) ) ; } | Get SMS statistics . |
7,756 | public function setDeliveryReceiptNotificationUrl ( $ url , $ sender = null ) { return $ this -> client -> executeRequest ( new SMSDRRegisterCallbackRequest ( $ url , $ sender ? : $ this -> senderNumber ) ) ; } | Set the SMS DR notification endpoint . |
7,757 | public function deleteDeliveryReceiptNotificationUrl ( $ id , $ sender = null ) { return $ this -> client -> executeRequest ( new SMSDRDeleteCallbackRequest ( $ id , $ sender ? : $ this -> senderNumber ) ) ; } | Delete the SMS DR notification endpoint . |
7,758 | public function foreignCurrencies ( $ options = [ ] ) { $ defaults = [ 'conditions' => [ $ this -> getAlias ( ) . '.base' => 0 ] ] ; $ options = Hash :: merge ( $ defaults , $ options ) ; return $ this -> find ( 'all' , $ options ) ; } | All except base one |
7,759 | public function availableCurrencies ( ) { if ( ! isset ( $ this -> CurrencyLib ) ) { $ this -> CurrencyLib = new CurrencyLib ( ) ; } $ base = $ this -> baseCurrency ( ) ; $ res = $ this -> CurrencyLib -> table ( $ base [ 'code' ] , 4 ) ; if ( $ res ) { return $ res ; } return [ ] ; } | For calculation etc |
7,760 | public function currencyList ( ) { $ res = $ this -> availableCurrencies ( ) ; foreach ( $ res as $ key => $ val ) { $ val = $ key ; $ valExt = $ this -> CurrencyLib -> getName ( $ key ) ; if ( $ valExt ) { $ val .= ' - ' . $ valExt ; } $ res [ $ key ] = $ val ; } return $ res ; } | For user selection |
7,761 | private function createInstanceFromArguments ( $ className , array $ arguments ) { $ reflection = new \ ReflectionClass ( $ className ) ; $ constructor = $ reflection -> getConstructor ( ) ; if ( $ constructor === null ) { return $ reflection -> newInstanceArgs ( $ arguments ) ; } if ( ! $ constructor -> isPublic ( ) )... | Handles the constructor arguments and if they re named just sort them to fit constructor ordering . |
7,762 | public function getAggregatePackageContaining ( $ packageName ) { foreach ( $ this -> packages as $ packageNode ) { if ( $ packageNode -> replaces ( $ packageName ) ) { return $ packageNode ; } } return null ; } | Searches the graph for an aggregate package that contains the given package . |
7,763 | public function fitsToCountry ( $ data ) { if ( ! isset ( $ data [ 'country_id' ] ) || ! isset ( $ data [ 'country_province_id' ] ) ) { return true ; } $ res = $ this -> Countries -> States -> find ( 'list' , [ 'conditions' => [ 'country_id' => $ data [ 'country_id' ] ] ] ) -> toArray ( ) ; if ( empty ( $ res ) || arra... | Validation of country_province_id |
7,764 | public function icons ( ) { $ icons = $ this -> _icons ( ) ; $ countries = $ this -> Countries -> find ( 'all' , [ 'fields' => [ 'id' , 'name' , 'iso2' , 'iso3' ] ] ) ; $ usedIcons = [ ] ; $ contriesWithoutIcons = [ ] ; foreach ( $ countries as $ country ) { $ icon = strtoupper ( $ country [ 'iso2' ] ) ; if ( ! in_arra... | Check for missing or unused country flag icons |
7,765 | public function configure ( ) { switch ( count ( $ options = func_get_args ( ) ) ) { case 0 : break ; case 1 : $ this -> configureInstance ( $ options [ 0 ] ) ; break ; case 2 : $ this -> configureInstanceAssoc ( static :: authorize ( $ options [ 0 ] , $ options [ 1 ] ) ) ; break ; default : throw new \ InvalidArgument... | Configure the instance . |
7,766 | protected function configureInstance ( $ options ) { if ( is_string ( $ options ) ) { $ this -> setToken ( $ options ) -> setTokenExpiresIn ( null ) ; } elseif ( is_array ( $ options ) ) { $ this -> configureInstanceAssoc ( $ options ) ; } } | Configure instance using options . |
7,767 | protected function configureInstanceAssoc ( array $ options ) { if ( array_key_exists ( 'access_token' , $ options ) ) { $ this -> setToken ( $ options [ 'access_token' ] ) ; } if ( array_key_exists ( 'expires_in' , $ options ) ) { $ this -> setTokenExpiresIn ( $ options [ 'expires_in' ] ) ; } return $ this ; } | Configure instance using assoc array options . |
7,768 | public function executeRequest ( SMSClientRequest $ request , $ decodeJson = true ) { $ options = $ request -> options ( ) ; if ( ! isset ( $ options [ 'headers' ] [ "Authorization" ] ) ) { $ options [ 'headers' ] [ "Authorization" ] = "Bearer " . $ this -> getToken ( ) ; } $ response = $ request -> execute ( $ options... | Execute a request against the Api server |
7,769 | public static function authorize ( $ clientID , $ clientSecret ) { return json_decode ( ( new AuthorizationRequest ( $ clientID , $ clientSecret ) ) -> execute ( ) -> getBody ( ) , true ) ; } | Get the client access token |
7,770 | public function provideData ( $ ignoreStates = false , $ model = null , $ defaultValue = 0 ) { if ( ! isset ( $ this -> Controller -> Countries ) ) { $ this -> Controller -> Countries = TableRegistry :: get ( 'Data.Countries' ) ; } $ countries = $ this -> Controller -> Countries -> findActive ( ) -> hydrate ( false ) -... | Call in methods where needed |
7,771 | public static function calculateSignature ( $ consumerId , $ privateKey , $ requestUrl , $ requestMethod , $ timestamp = null ) { if ( is_null ( $ timestamp ) || ! is_numeric ( $ timestamp ) ) { $ timestamp = self :: getMilliseconds ( ) ; } $ message = $ consumerId . "\n" . $ requestUrl . "\n" . strtoupper ( $ requestM... | Static method for quick calls to calculate a signature . |
7,772 | public function cgetAction ( Request $ request ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( RedirectRoute :: class ) ; $ restHelper -> initializeListBuilder ( $ listBuilder , $ this... | Returns redirect - routes . |
7,773 | public function postAction ( Request $ request ) { $ data = $ request -> request -> all ( ) ; $ serializer = $ this -> get ( 'serializer' ) ; $ redirectRoute = $ serializer -> deserialize ( json_encode ( $ data ) , $ this -> getParameter ( 'sulu.model.redirect_route.class' ) , 'json' ) ; $ this -> getRedirectRouteManag... | Create a new redirect - route . |
7,774 | public function getAction ( $ id ) { $ entity = $ this -> getRedirectRouteRepository ( ) -> find ( $ id ) ; if ( ! $ entity ) { throw new EntityNotFoundException ( $ this -> getParameter ( 'sulu.model.redirect_route.class' ) , $ id ) ; } return $ this -> handleView ( $ this -> view ( $ entity ) ) ; } | Returns single redirect - route . |
7,775 | public function deleteAction ( $ id ) { $ redirectRoute = $ this -> getRedirectRouteRepository ( ) -> find ( $ id ) ; if ( ! $ redirectRoute ) { throw new EntityNotFoundException ( $ this -> getParameter ( 'sulu.model.redirect_route.class' ) , $ id ) ; } $ this -> getRedirectRouteManager ( ) -> delete ( $ redirectRoute... | Delete a redirect - route identified by id . |
7,776 | public function cdeleteAction ( Request $ request ) { $ repository = $ this -> getRedirectRouteRepository ( ) ; $ manager = $ this -> getRedirectRouteManager ( ) ; $ ids = array_filter ( explode ( ',' , $ request -> query -> get ( 'ids' , '' ) ) ) ; foreach ( $ ids as $ id ) { $ redirectRoute = $ repository -> find ( $... | Delete a list of redirect - route identified by id . |
7,777 | private function importItem ( array $ item ) { if ( ! $ this -> converter -> supports ( $ item ) ) { throw new ConverterNotFoundException ( $ item ) ; } $ entity = $ this -> converter -> convert ( $ item ) ; $ this -> writer -> write ( $ entity ) ; return $ entity ; } | Import given item . |
7,778 | public function set ( $ key , $ value ) { assert ( 'is_string($key)' ) ; $ session = SimpleSAML_Session :: getSessionFromRequest ( ) ; $ session -> setData ( 'openid.session' , $ key , $ value ) ; } | Save a value to the session store under the given key . |
7,779 | public function removeTranslation ( $ locale , $ domain , $ key ) { $ unit = $ this -> findByDomainAndKey ( $ domain , $ key ) ; $ unit -> deleteTranslation ( $ locale ) ; $ this -> persist ( $ unit ) ; } | Remove a specific translation . |
7,780 | public function updateTranslation ( $ locale , $ domain , $ key , $ value ) { $ unit = $ this -> findByDomainAndKey ( $ domain , $ key ) ; $ unit -> setTranslation ( $ locale , $ value ) ; $ this -> persist ( $ unit ) ; } | Update a specific translation . |
7,781 | protected function initShutdownFunction ( ) { if ( ! $ this -> registeredShutdown ) { $ this -> registerShutdownFunction ( [ $ this , 'shutdownFunction' ] ) ? : false ; $ this -> registeredShutdown = true ; $ this -> reserveMemory ( ) ; } } | Register the shutdown function |
7,782 | public function shutdownFunction ( ) { $ this -> reservedMemory = null ; $ err = $ this -> errorGetLast ( ) ; $ unhandled = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR ; if ( empty ( $ err ) || ! ( $ err [ 'type' ] & $ unhandled ) ) { return ; } $ error = new \ ErrorException ( $ err [ 'message' ] , 0 , $ err [ ... | Called when the script has ends |
7,783 | public function securityCheck ( $ domain = null , $ locale = null ) { if ( isset ( $ domain ) && $ this -> getSecurity ( ) -> isSecuredByDomain ( ) ) { if ( ! $ this -> getSecurityContext ( ) -> isGranted ( Security :: getRoleForDomain ( $ domain ) ) ) { throw new AccessDeniedHttpException ( "You don't have permissions... | Process security for the provided locale or domain . Either one of the both parameters can be null if we don t need to check them . |
7,784 | protected function errorResponse ( ServerRequestInterface $ request , ResponseInterface $ response ) { if ( interface_exists ( GlobalEnvironmentInterface :: class , false ) && $ response instanceof GlobalEnvironmentInterface && $ response -> isStale ( ) ) { $ response = $ response -> revive ( ) ; } $ errorResponse = $ ... | Handle caught error |
7,785 | protected function getLogLevel ( $ code = null ) { switch ( $ code ) { case E_STRICT : case E_DEPRECATED : case E_USER_DEPRECATED : return LogLevel :: INFO ; case E_NOTICE : case E_USER_NOTICE : return LogLevel :: NOTICE ; case E_WARNING : case E_CORE_WARNING : case E_COMPILE_WARNING : case E_USER_WARNING : return LogL... | Get the log level for an error code |
7,786 | public function add ( $ type , $ message , $ title = null ) { $ notifications = $ this -> getNotifications ( ) ; $ notifications [ ] = [ 'type' => $ type , 'message' => $ message , 'title' => $ title ] ; $ this -> session -> flash ( self :: SESSION_KEY , $ notifications ) ; } | Add a new notification to the session |
7,787 | public function setTranslation ( $ locale , $ translation , $ isUpdate = true ) { $ this -> offsetSet ( $ locale , $ translation ) ; if ( $ isUpdate ) { $ this -> setIsModified ( true ) ; } } | Set a translation for the given locale without caring if the translation already exists or not . |
7,788 | public function addTranslation ( Translation $ translation , $ isUpdate = true ) { $ this -> translations [ $ translation -> getLocale ( ) ] = $ translation ; if ( $ isUpdate ) { $ this -> setIsModified ( true ) ; } } | Add or set the translation for the locale associated to the given translation . |
7,789 | protected function extractZip ( $ file ) { $ tempFolder = sys_get_temp_dir ( ) . '/' . md5 ( rand ( 0 , 99999 ) ) ; if ( @ mkdir ( $ tempFolder ) === false ) { throw new ImportException ( 'Impossible to create a temp folder for zip extraction' ) ; } $ zip = new \ ZipArchive ( ) ; $ zip -> open ( $ file -> getRealPath (... | Extract a zip file into a temp folder and return the folder path . |
7,790 | protected function importFile ( $ filePath , $ fileName = null ) { if ( $ fileName == null ) { $ fileName = basename ( $ filePath ) ; } if ( ! preg_match ( '/\w+\.\w+\.\w+/' , $ fileName ) ) { throw new ImportException ( "Invalid filename [$fileName], all translation files must be named: domain.locale.format (ex: messa... | Add a file to the current import buffer . |
7,791 | public function getPersistence ( ) { $ persistence = $ this -> getContainer ( ) -> get ( 'liip.translation.persistence' ) ; if ( false === $ persistence instanceof GitPersistence ) { throw new \ RuntimeException ( sprintf ( 'Cannot initialize git repository, configured persistence should be "%s", "%s" given' , 'Liip\Tr... | Returns the configured repository which should be a GitPersistence . |
7,792 | public function cloneRepository ( $ remote ) { $ fileSystem = new Filesystem ( ) ; $ fileSystem -> mkdir ( $ this -> directory ) ; if ( $ fileSystem -> exists ( $ this -> directory . DIRECTORY_SEPARATOR . '.git' ) ) { throw new \ RuntimeException ( sprintf ( '"%s" already is a git repository.' , $ this -> directory ) )... | Clones a given remote . |
7,793 | protected function executeCmd ( $ command ) { $ process = new $ this -> processClass ( $ command ) ; $ process -> run ( ) ; if ( false === $ process -> isSuccessful ( ) && strlen ( $ process -> getErrorOutput ( ) ) > 0 ) { throw new \ RuntimeException ( $ process -> getErrorOutput ( ) ) ; } return $ process -> getOutpu... | Executes a given command on the shell . |
7,794 | protected function getResolvedOptions ( array $ options ) { $ resolver = new OptionsResolver ( ) ; $ resolver -> setDefaults ( array ( 'processClass' => 'Symfony\\Component\\Process\\Process' , ) ) -> setRequired ( array ( 'folder' ) ) -> setAllowedTypes ( array ( 'processClass' => 'string' , 'folder' => 'string' , ) )... | Get a set of usable options . |
7,795 | public function onLogicalExpression ( $ expressionType , $ left , $ right ) { switch ( $ expressionType ) { case ExpressionType :: AND_LOGICAL : return $ this -> _prepareBinaryExpression ( self :: LOGICAL_AND , $ left , $ right ) ; break ; case ExpressionType :: OR_LOGICAL : return $ this -> _prepareBinaryExpression ( ... | Call - back for logical expression |
7,796 | public function onArithmeticExpression ( $ expressionType , $ left , $ right ) { switch ( $ expressionType ) { case ExpressionType :: MULTIPLY : return $ this -> _prepareBinaryExpression ( self :: MULTIPLY , $ left , $ right ) ; break ; case ExpressionType :: DIVIDE : return $ this -> _prepareBinaryExpression ( self ::... | Call - back for arithmetic expression |
7,797 | public function onRelationalExpression ( $ expressionType , $ left , $ right ) { switch ( $ expressionType ) { case ExpressionType :: GREATERTHAN : return $ this -> _prepareBinaryExpression ( self :: GREATERTHAN , $ left , $ right ) ; break ; case ExpressionType :: GREATERTHAN_OR_EQUAL : return $ this -> _prepareBinary... | Call - back for relational expression |
7,798 | public function onUnaryExpression ( $ expressionType , $ child ) { switch ( $ expressionType ) { case ExpressionType :: NEGATE : return $ this -> _prepareUnaryExpression ( self :: NEGATE , $ child ) ; break ; case ExpressionType :: NOT_LOGICAL : return $ this -> _prepareUnaryExpression ( self :: LOGICAL_NOT , $ child )... | Call - back for unary expression |
7,799 | private function _prepareUnaryExpression ( $ operator , $ child ) { return $ this -> _iterName . $ operator . self :: OPEN_BRAKET . $ child . self :: CLOSE_BRACKET ; } | To format unary expression |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.