idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
19,700 | function status ( $ reference_id , array $ params = [ ] ) { return $ this -> get ( sprintf ( self :: MESSAGING_STATUS_RESOURCE , $ reference_id ) , $ params ) ; } | Retrieves the current status of the message . |
19,701 | public static function copyTpl ( CommandEvent $ event ) { $ config = self :: getOptions ( $ event ) ; $ sources = new Finder ( ) ; $ sources -> files ( ) -> ignoreVCS ( true ) -> ignoreDotFiles ( true ) -> name ( '*.tpl.json' ) -> name ( '*.php' ) -> in ( dirname ( dirname ( __DIR__ ) ) . '/tpl' ) ; foreach ( $ sources... | Copy teleport tpl files in local tpl directory . |
19,702 | protected static function getOptions ( CommandEvent $ event ) { $ options = array_merge ( array ( 'teleport-tpl-dir' => 'tpl' , 'teleport-tpl-update' => true ) , $ event -> getComposer ( ) -> getPackage ( ) -> getExtra ( ) ) ; return $ options ; } | Get the config data from the extra definition in composer . json . |
19,703 | public function __isset ( $ name ) { $ isset = false ; if ( ! empty ( $ name ) ) { $ isset = array_key_exists ( $ name , $ this -> arguments ) ; } return $ isset ; } | See if an argument or member variable isset for this request . |
19,704 | public function args ( $ key = array ( ) ) { if ( is_array ( $ key ) ) { $ args = array ( ) ; if ( ! empty ( $ key ) ) { foreach ( $ key as $ k ) $ args [ $ k ] = $ this -> args ( $ k ) ; } else { $ args = $ this -> arguments ; } return $ args ; } elseif ( is_string ( $ key ) && ! empty ( $ key ) ) { return $ this -> $... | Get one or more arguments from the request . |
19,705 | public function handle ( array $ arguments ) { $ this -> parseArguments ( $ arguments ) ; $ actionClass = $ this -> getActionClass ( ) ; if ( class_exists ( $ actionClass , true ) ) { try { $ handler = new $ actionClass ( $ this ) ; $ this -> beforeHandle ( $ handler ) ; $ handler -> process ( ) ; $ this -> afterHandle... | Handle the requested action . |
19,706 | public function log ( $ msg , $ timestamp = true ) { if ( $ timestamp ) { $ timestamp = strftime ( "%Y-%m-%d %H:%M:%S" ) ; $ msg = "[{$timestamp}] {$msg}" ; } $ this -> addResult ( $ msg ) ; if ( $ this -> verbose ) echo $ msg . PHP_EOL ; } | Log a result message and echo it if verbose is true . |
19,707 | public function parseArguments ( array $ args ) { if ( ! isset ( $ args [ 'action' ] ) || empty ( $ args [ 'action' ] ) ) { if ( isset ( $ args [ 'version' ] ) || isset ( $ args [ 'V' ] ) ) { $ this -> action = 'Version' ; $ this -> arguments = $ args ; return $ this -> arguments ; } if ( isset ( $ args [ 'help' ] ) ||... | Parse the request arguments into a normalized format . |
19,708 | public function withIdentity ( $ name , $ group = null ) { $ this -> key = new Key ( $ name , $ group ) ; return $ this ; } | Use a TriggerKey with the given name and group to identify the Trigger . |
19,709 | public function forJobDetail ( JobDetail $ jobDetail ) { if ( null == $ key = $ jobDetail -> getKey ( ) ) { throw new InvalidArgumentException ( 'The given job has not yet had a key assigned to it.' ) ; } $ this -> jobKey = clone $ key ; return $ this ; } | Set the identity of the Job which should be fired by the produced Trigger by extracting the JobKey from the given job . |
19,710 | final public function render ( $ ifIssetGet = null ) : string { $ html = '' ; $ andIfHasQueryParams = $ this -> accumulateIfHasQueryParams ( $ ifIssetGet ) ; if ( $ this -> pagination -> getGetPP ( ) != Pagination :: ALL && $ this -> pagination -> getCount ( ) > $ this -> pagination -> getPerPage ( ) ) { $ html .= $ th... | Pour afficher la pagination |
19,711 | public function rewind ( ) { $ this -> file -> rewind ( ) ; if ( $ this -> useFirstRecordAsHeader ) { if ( ! $ this -> file -> valid ( ) ) { throw new \ RuntimeException ( 'Expected first row to be header, but reached EOF instead' ) ; } $ this -> header = $ this -> file -> current ( ) ; $ this -> file -> next ( ) ; } } | Rewind the Iterator to the first element . Optionally consumes the first record as the header . |
19,712 | public function current ( ) { $ line = $ this -> file -> current ( ) ; if ( $ this -> useFirstRecordAsHeader ) { $ header = $ this -> header ; if ( count ( $ line ) != count ( $ header ) ) { $ size = min ( count ( $ header ) , count ( $ line ) ) ; $ header = array_slice ( $ this -> header , 0 , $ size ) ; $ line = arra... | Return the current record . Optionally uses the header record as keys . |
19,713 | public function run ( $ name , $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( '$callback is not callable' ) ; } $ this -> Storage -> setup ( ) ; $ pid = pcntl_fork ( ) ; if ( $ pid === - 1 ) { return false ; } if ( $ pid ) { $ this -> pids [ $ name ] = $ pid ; return true ; ... | Run a new fork with some name |
19,714 | public function configDefault ( $ key , $ default = null ) { $ value = $ this -> config ( $ key ) ; if ( $ value === null ) { $ this -> config ( $ key , $ default ) ; } } | Sets a default value for a given key |
19,715 | public function concat ( $ value , $ preAppend = false ) { $ transformer = new Concat ( $ this -> value , $ value ) ; $ transformer -> setPreAppend ( $ preAppend ) ; $ this -> value = $ transformer -> execute ( ) ; return $ this ; } | Append 2 String values |
19,716 | public function delete ( $ needles ) { $ this -> value = ( new Replace ( $ this -> value , $ needles , "" ) ) -> execute ( ) ; return $ this ; } | Delete runes in str matching the pattern similiar in Ruby |
19,717 | public function truncate ( $ numberToTruncate ) { $ this -> value = ( new Truncate ( $ this -> value , $ numberToTruncate ) ) -> execute ( ) ; return $ this ; } | Truncate remove the number of indicated values at the end of the string |
19,718 | public function getSourceAdapter ( $ name ) { foreach ( array_reverse ( $ this -> sourceAdapters ) as $ pattern => $ adapter ) { if ( preg_match ( $ pattern , $ name ) ) { return $ adapter ; } } return null ; } | Decide if a template is twital - compilable or not . |
19,719 | public function getCountryCodeByName ( $ name ) { if ( isset ( $ this -> countryList [ $ name ] ) ) { return $ this -> countryList [ $ name ] ; } $ name = strtolower ( $ name ) ; foreach ( $ this -> countryList as $ countryName => $ countryCode ) { if ( strtolower ( $ countryName ) == $ name ) { return $ countryCode ; ... | Get the country code by country name |
19,720 | public function isValidLocale ( $ locale ) { $ locale = strtoupper ( $ locale ) ; if ( substr_count ( $ locale , '_' ) ) { $ locale = substr ( $ locale , strpos ( $ locale , '_' ) + 1 ) ; } if ( substr_count ( $ locale , '-' ) ) { $ locale = substr ( $ locale , strpos ( $ locale , '-' ) + 1 ) ; } return in_array ( $ lo... | return true if the locale is valid |
19,721 | public function setStartTimeOfDay ( \ DateTime $ startTimeOfDay ) { $ startTimeOfDay = clone $ startTimeOfDay ; $ startTimeOfDay -> setDate ( 1970 , 1 , 1 ) ; if ( $ this -> getEndTimeOfDay ( ) && $ this -> getEndTimeOfDay ( ) < $ startTimeOfDay ) { throw new \ InvalidArgumentException ( 'End time of day cannot be befo... | The time of day to complete firing at the given interval . |
19,722 | private function advanceToNextDayOfWeekIfNecessary ( \ DateTime $ fireTime , $ forceToAdvanceNextDay ) { $ sTimeOfDay = $ this -> getStartTimeOfDay ( ) ; $ fireTimeStartDate = $ this -> getTimeOfDayForDate ( $ fireTime , $ sTimeOfDay ) ; $ dayOfWeekOfFireTime = ( int ) $ fireTimeStartDate -> format ( 'N' ) ; $ daysOfWe... | Given fireTime time determine if it is on a valid day of week . If so simply return it unaltered if not advance to the next valid week day and set the time of day to the start time of day |
19,723 | public function onDaysOfTheWeek ( array $ onDaysOfWeek ) { if ( false == $ onDaysOfWeek ) { throw new \ InvalidArgumentException ( 'Days of week must be an non-empty set.' ) ; } foreach ( $ onDaysOfWeek as $ day ) { DateBuilder :: validateDayOfWeek ( $ day ) ; } $ this -> daysOfWeek = $ onDaysOfWeek ; return $ this ; } | Set the trigger to fire on the given days of the week . |
19,724 | public function onMondayThroughFriday ( ) { $ this -> daysOfWeek = [ DateBuilder :: MONDAY , DateBuilder :: THURSDAY , DateBuilder :: WEDNESDAY , DateBuilder :: THURSDAY , DateBuilder :: FRIDAY ] ; return $ this ; } | Set the trigger to fire on the days from Monday through Friday . |
19,725 | public function endingDailyAfterCount ( $ count ) { if ( false == is_int ( $ count ) || $ count <= 0 ) { throw new \ InvalidArgumentException ( 'Ending daily after count must be a positive number!' ) ; } if ( null == $ this -> startTimeOfDay ) { throw new \ InvalidArgumentException ( 'You must set the startDailyAt() be... | Calculate and set the endTimeOfDay using count interval and starTimeOfDay . This means that these must be set before this method is call . |
19,726 | private function fixDuplicateArgs ( $ origArgs , $ result ) { $ duplicates = array_intersect_key ( $ result [ 'args' ] , $ origArgs ) ; if ( count ( $ duplicates ) === 0 ) return $ result ; foreach ( $ duplicates as $ argKey => $ argVal ) { $ valHash = substr ( md5 ( $ argVal ) , 0 , 5 ) ; $ newKey = $ argKey . $ valHa... | Returns result with duplicate issues removed |
19,727 | public function withIntervalInSeconds ( $ intervalInSeconds ) { $ this -> validateInterval ( $ intervalInSeconds ) ; $ this -> interval = $ intervalInSeconds ; $ this -> intervalUnit = IntervalUnit :: SECOND ; return $ this ; } | Specify an interval in the IntervalUnit . SECOND that the produced Trigger will repeat at . |
19,728 | public function withIntervalInMinutes ( $ intervalInMinutes ) { $ this -> validateInterval ( $ intervalInMinutes ) ; $ this -> interval = $ intervalInMinutes ; $ this -> intervalUnit = IntervalUnit :: MINUTE ; return $ this ; } | Specify an interval in the IntervalUnit . MINUTE that the produced Trigger will repeat at . |
19,729 | public function withIntervalInHours ( $ intervalInHours ) { $ this -> validateInterval ( $ intervalInHours ) ; $ this -> interval = $ intervalInHours ; $ this -> intervalUnit = IntervalUnit :: HOUR ; return $ this ; } | Specify an interval in the IntervalUnit . HOUR that the produced Trigger will repeat at . |
19,730 | public function withIntervalInDays ( $ intervalInDays ) { $ this -> validateInterval ( $ intervalInDays ) ; $ this -> interval = $ intervalInDays ; $ this -> intervalUnit = IntervalUnit :: DAY ; return $ this ; } | Specify an interval in the IntervalUnit . DAY that the produced Trigger will repeat at . |
19,731 | public function withIntervalInWeeks ( $ intervalInWeeks ) { $ this -> validateInterval ( $ intervalInWeeks ) ; $ this -> interval = $ intervalInWeeks ; $ this -> intervalUnit = IntervalUnit :: WEEK ; return $ this ; } | Specify an interval in the IntervalUnit . WEEK that the produced Trigger will repeat at . |
19,732 | public function withIntervalInMonths ( $ intervalInMonths ) { $ this -> validateInterval ( $ intervalInMonths ) ; $ this -> interval = $ intervalInMonths ; $ this -> intervalUnit = IntervalUnit :: MONTH ; return $ this ; } | Specify an interval in the IntervalUnit . MONTH that the produced Trigger will repeat at . |
19,733 | public function withIntervalInYears ( $ intervalInYears ) { $ this -> validateInterval ( $ intervalInYears ) ; $ this -> interval = $ intervalInYears ; $ this -> intervalUnit = IntervalUnit :: YEAR ; return $ this ; } | Specify an interval in the IntervalUnit . YEAR that the produced Trigger will repeat at . |
19,734 | public function paginate ( int $ count ) { $ this -> count = $ count ; $ this -> treatmentPerPage ( ) ; if ( $ this -> perPage !== null ) { $ this -> nbPages = ceil ( $ this -> count / $ this -> perPage ) ; } else { $ this -> nbPages = 1 ; } if ( $ this -> getP !== null && $ this -> getP > 0 && $ this -> getP <= $ this... | Active la pagination |
19,735 | private function setLimitAndSetOffset ( ) { if ( $ this -> perPage === null ) { $ this -> offset = null ; $ this -> limit = null ; } else { $ this -> offset = ( $ this -> currentPage - 1 ) * $ this -> perPage ; $ this -> limit = $ this -> perPage ; } } | Pour setter le limit et le offset |
19,736 | public function render ( $ ifIssetGet = null ) : string { $ this -> setPageStart ( ) -> setPageEnd ( ) ; return $ this -> htmlRenderer -> render ( $ ifIssetGet ) ; } | Rendre le rendu de la pagination au format HTML |
19,737 | public function perPage ( string $ action = null ) : string { return $ this -> htmlRenderer -> perPage ( $ this -> request , $ action ) ; } | Rendre le rendu du per page au format HTML |
19,738 | public function setContent ( $ records , callable $ callback = null ) { $ this -> content = $ records ; $ this -> callback = $ callback ; return $ this ; } | Set the content records along with an optional callback to render them into CSV fields |
19,739 | public function setControls ( $ delimiter , $ enclosure ) { $ this -> delimiter = $ delimiter ; $ this -> enclosure = $ enclosure ; return $ this ; } | Set the CSV controls |
19,740 | public function getResponse ( ) { if ( method_exists ( $ this -> controller , 'getResponse' ) ) { $ response = $ this -> controller -> getResponse ( ) ; } else { $ response = new HttpResponse ; } $ fp = fopen ( 'php://output' , 'w' ) ; ob_start ( ) ; fputcsv ( $ fp , $ this -> header , $ this -> delimiter , $ this -> e... | Prepare the response with the CSV export and return it |
19,741 | public static function repeatMinutelyForTotalCount ( $ count , $ minutes = 1 ) { if ( $ count < 1 ) { throw new \ InvalidArgumentException ( sprintf ( 'Total count of firings must be at least one! Given count: "%s"' , $ count ) ) ; } return static :: simpleSchedule ( ) -> withIntervalInMinutes ( $ minutes ) -> withRepe... | Create a SimpleScheduleBuilder set to repeat the given number of times - 1 with an interval of the given number of minutes . |
19,742 | public static function repeatSecondlyForTotalCount ( $ count , $ seconds = 1 ) { if ( $ count < 1 ) { throw new \ InvalidArgumentException ( sprintf ( 'Total count of firings must be at least one! Given count: "%s"' , $ count ) ) ; } return static :: simpleSchedule ( ) -> withIntervalInSeconds ( $ seconds ) -> withRepe... | Create a SimpleScheduleBuilder set to repeat the given number of times - 1 with an interval of the given number of seconds . |
19,743 | public static function repeatHourlyForTotalCount ( $ count , $ hours = 1 ) { if ( $ count < 1 ) { throw new \ InvalidArgumentException ( sprintf ( 'Total count of firings must be at least one! Given count: "%s"' , $ count ) ) ; } return static :: simpleSchedule ( ) -> withIntervalInHours ( $ hours ) -> withRepeatCount ... | Create a SimpleScheduleBuilder set to repeat the given number of times - 1 with an interval of the given number of hours . |
19,744 | public function set ( $ element ) { if ( ! is_scalar ( $ element ) ) { $ element = serialize ( $ element ) ; } $ hashes = $ this -> hash ( $ element ) ; foreach ( $ hashes as $ hash ) { $ offset = ( int ) floor ( $ hash / 8 ) ; $ bit = ( int ) ( $ hash % 8 ) ; $ this -> filter [ $ offset ] = chr ( ord ( $ this -> filte... | Set element in the filter |
19,745 | public function check ( $ element ) { if ( ! is_scalar ( $ element ) ) { $ element = serialize ( $ element ) ; } $ hashes = $ this -> hash ( $ element ) ; foreach ( $ hashes as $ hash ) { $ offset = ( int ) floor ( $ hash / 8 ) ; $ bit = ( int ) ( $ hash % 8 ) ; if ( ! ( ord ( $ this -> filter [ $ offset ] ) & ( 2 ** $... | Is element in the hash |
19,746 | public function decodeData ( $ data ) { $ output = array ( ) ; while ( strlen ( $ data ) > 0 ) { preg_match ( '/(\w+)(\[(\d+)\])?=/' , $ data , $ matches ) ; $ key = $ matches [ 1 ] ; $ data = substr ( $ data , strlen ( $ matches [ 0 ] ) ) ; if ( isset ( $ matches [ 3 ] ) ) { $ value = substr ( $ data , 0 , $ matches [... | Decode absurd name value pair format |
19,747 | public function cancelImmediately ( $ id ) { $ service = $ this -> getService ( ) ; $ rawData = ! empty ( $ this -> _params ) ? $ this -> getRawData ( array ( 'subscription' => $ this -> _params ) ) : null ; $ response = $ service -> request ( 'subscriptions/' . ( int ) $ id , 'DELETE' , $ rawData ) ; $ responseArray =... | Set the given subscription ID to be canceled immediately |
19,748 | public function cancelDelayed ( $ id ) { $ this -> setCancelAtEndOfPeriod ( true ) ; $ service = $ this -> getService ( ) ; $ rawData = $ this -> getRawData ( array ( 'subscription' => $ this -> _params ) ) ; $ response = $ service -> request ( 'subscriptions/' . ( int ) $ id , 'PUT' , $ rawData ) ; $ responseArray = $... | Set the subscription to be canceled at the end of the current billing period . |
19,749 | public function reactivate ( $ id ) { $ service = $ this -> getService ( ) ; $ params = array ( ) ; $ includeTrial = $ this -> getParam ( 'include_trial' ) ; if ( is_int ( $ includeTrial ) ) { $ params [ 'include_trial' ] = $ includeTrial ; } $ response = $ service -> request ( 'subscriptions/' . ( int ) $ id . '/react... | Reactivate the given subscription ID |
19,750 | public function resetBalance ( $ subscriptionId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'subscriptions/' . ( int ) $ subscriptionId . '/reset_balance' , 'GET' ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ this -> _data = $ res... | Chargify offers the ability to easily reset the balance of a subscription to zero . If a subscription has a positive balance this API call will issue a credit to the subscription for the outstanding balance . This is particularly helpful if you want to reactivate a canceled subscription without charging the customer fo... |
19,751 | public function listByCustomer ( $ customerId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'customers/' . ( int ) $ customerId . '/subscriptions' , 'GET' ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ this -> _data = $ this -> _norm... | List subscriptions by customer ID |
19,752 | public function notify ( $ notify_class = '' ) { $ this -> each ( function ( $ mention ) use ( $ notify_class ) { $ mention -> notify ( $ notify_class ) ; } ) ; return $ this ; } | Notifies all mentions in the collection . |
19,753 | public function getStats ( ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'stats' , 'GET' , NULL , $ this -> getParams ( ) ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ this -> _data = $ responseArray ; } else { $ this -> _data = arr... | Get stats for a site |
19,754 | public function setData ( $ data = array ( ) ) { if ( isset ( $ this -> requestSignature ) ) { throw new BadMethodCallException ( 'The signature for this request has already been generated.' ) ; } $ this -> data = $ data ; $ this -> mergeRedirect ( ) ; } | Tamper - proof data that you want to send to Chargify |
19,755 | public function setRedirect ( $ redirect ) { if ( isset ( $ this -> requestSignature ) ) { throw new BadMethodCallException ( 'The signature for this request has already been generated.' ) ; } $ this -> redirect = $ redirect ; $ this -> mergeRedirect ( ) ; } | Set the URI where Chargify should redirect |
19,756 | protected function generateNonce ( ) { $ bits = 256 ; $ bytes = ceil ( $ bits / 8 ) ; $ string = '' ; for ( $ i = 0 ; $ i < $ bytes ; $ i ++ ) { $ string .= chr ( mt_rand ( 0 , 255 ) ) ; } return hash ( 'sha1' , $ string ) ; } | Get a 40 character string to use as a nonce |
19,757 | public function getRequestSignature ( ) { if ( empty ( $ this -> requestSignature ) ) { $ string = $ this -> getApiId ( ) . $ this -> getTimeStamp ( ) . $ this -> getNonce ( ) . $ this -> getDataString ( ) ; $ this -> requestSignature = hash_hmac ( 'sha1' , $ string , $ this -> getService ( ) -> getApiSecret ( ) ) ; } ... | Calculate the hmac - sha1 signature of the request |
19,758 | public function getResponseSignature ( $ apiId , $ timestamp , $ nonce , $ statusCode , $ resultCode , $ callId ) { $ string = $ apiId . $ timestamp . $ nonce . $ statusCode . $ resultCode . $ callId ; return hash_hmac ( 'sha1' , $ string , $ this -> getService ( ) -> getApiSecret ( ) ) ; } | Calculate the hmac - sha1 signature of the response |
19,759 | public function isValidResponseSignature ( $ signature , $ apiId , $ timestamp , $ nonce , $ statusCode , $ resultCode , $ callId ) { return ( $ signature == $ this -> getResponseSignature ( $ apiId , $ timestamp , $ nonce , $ statusCode , $ resultCode , $ callId ) ) ; } | Test if response signature matches what we expect |
19,760 | public function getHiddenFields ( ) { $ apiId = '<input type="hidden" name="secure[api_id]" value="' . $ this -> getApiId ( ) . '" />' ; $ timestamp = '<input type="hidden" name="secure[timestamp]" value="' . $ this -> getTimeStamp ( ) . '" />' ; $ nonce = '<input type="hidden" name="secure[nonce]" value="' . $ ... | Get the html for all hidden fields |
19,761 | public function initializeObject ( ) { $ clientOptions = $ this -> s3DefaultProfile ; $ this -> s3Client = new S3Client ( $ clientOptions ) ; $ this -> s3Client -> registerStreamWrapper ( ) ; } | Initialize the S3 Client |
19,762 | public function request ( $ path , $ method , $ rawData = null , $ params = [ ] ) { $ method = strtoupper ( $ method ) ; $ path = ltrim ( $ path , '/' ) ; $ path = $ path . '.' . $ this -> format ; $ client = $ this -> getHttpClient ( ) ; $ method = strtoupper ( $ method ) ; $ options = [ 'query' => $ params , 'body' =... | Send the request to Chargify |
19,763 | public function apply ( Builder $ builder , Model $ model ) { $ column = $ model -> getQualifiedPublishedAtColumn ( ) ; $ builder -> where ( $ column , '=' , 1 ) ; $ this -> addWithDrafts ( $ builder ) ; } | This remains unchanged - it s the only method that needs to be implemented |
19,764 | protected function addWithDrafts ( Builder $ builder ) { $ builder -> macro ( 'withDrafts' , function ( Builder $ builder ) { $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; return $ builder ; } ) ; } | Remains unchanged - it s just a helper method |
19,765 | protected function getScopeConstraints ( Model $ model ) { $ builder = $ model -> newQueryWithoutScopes ( ) ; $ this -> apply ( $ builder , $ model ) ; return ( array ) $ builder -> getQuery ( ) -> wheres ; } | Get an array of the constraints applied by the scope . |
19,766 | protected function removeBindings ( Query $ query , $ key , $ count ) { $ bindings = $ query -> getRawBindings ( ) [ 'where' ] ; array_splice ( $ bindings , $ key , $ count ) ; $ query -> setBindings ( $ bindings , 'where' ) ; } | Remove bindings from the query builder . |
19,767 | protected function prepare ( ) { if ( ! is_array ( $ this -> data ) || count ( $ this -> data ) == 0 ) { $ this -> setData ( $ this -> read ( ) ) ; } } | Read the data and set it |
19,768 | public function show ( $ productFamilyId , $ couponId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'product_families/' . $ productFamilyId . '/coupons/' . $ couponId , 'GET' ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ this -> _da... | You can retrieve a coupon via the API with the show method . Retrieving a coupon via the API will allow you to determine whether or not the coupon is valid . |
19,769 | public function find ( $ productFamilyId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'product_families/' . $ productFamilyId . '/coupons/find' , 'GET' , NULL , $ this -> _params ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) && '200' == ... | You can search for a coupon via the API with the find method . By passing a code parameter the find record will attempt to locate a coupon that matches that code . This method is useful for validating coupon codes that are entered by a customer . If no coupon is found a 404 is returned . |
19,770 | public function register ( ) { $ this -> app -> bind ( ClientInterface :: class , function ( ) { return new Client ( [ 'handler' => $ this -> app -> make ( HandlerStack :: class ) ] ) ; } ) ; $ this -> app -> alias ( ClientInterface :: class , Client :: class ) ; $ this -> app -> bind ( HandlerStack :: class , function... | Register method . |
19,771 | public function setPagination ( $ page , $ perPage ) { $ this -> setParam ( 'page' , $ page ) ; $ this -> setParam ( 'per_page' , $ perPage ) ; return $ this ; } | The page number and number of results used for pagination . By default results are paginated 30 per page . |
19,772 | public function forSubscription ( $ subscriptionId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'subscriptions/' . $ subscriptionId . '/events' , 'GET' , NULL , $ this -> getParams ( ) ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ ... | Return events for the given subscription |
19,773 | public function encodeData ( array $ data ) { $ output = array ( ) ; foreach ( $ data as $ key => $ value ) { $ output [ ] = $ key . '[' . strlen ( $ value ) . ']=' . $ value ; } return implode ( '&' , $ output ) ; } | Encode absurd name value pair format |
19,774 | public function encoded ( ) { $ mentions = $ this -> get ( ) ; $ encoded = collect ( ) ; foreach ( $ mentions as $ mention ) { $ pool = $ this -> mention -> pool ( $ mention ) ; $ encoded -> push ( "{$pool->key}:{$mention->getKey()}" ) ; } return $ encoded -> implode ( ',' ) ; } | Gets the mentions as an encoded string for use in form fields . |
19,775 | public function parse ( string $ list ) { if ( ! $ list ) { return $ list ; } $ list = collect ( explode ( ',' , $ list ) ) ; return $ list -> map ( function ( $ item ) { $ parts = explode ( ':' , $ item ) ; $ model = app ( ) -> make ( config ( 'mentions.pools.' . $ parts [ 0 ] . '.model' ) ) ; return $ model :: findOr... | Parses the encoded string and returns a collection of models . |
19,776 | public function create ( Model $ recipient , $ notify = true ) { $ mention = $ this -> mention -> create ( [ 'model_type' => get_class ( $ this -> model ) , 'model_id' => $ this -> model -> getKey ( ) , 'recipient_type' => get_class ( $ recipient ) , 'recipient_id' => $ recipient -> getKey ( ) ] ) ; $ mention -> setRef... | Creates a mention record . |
19,777 | public function destroy ( Model $ model ) { $ this -> mention -> where ( 'model_type' , get_class ( $ this -> model ) ) -> where ( 'model_id' , $ this -> model -> getKey ( ) ) -> where ( 'recipient_type' , get_class ( $ model ) ) -> where ( 'recipient_id' , $ model -> getKey ( ) ) -> delete ( ) ; } | Destroys all mentions for the given model . |
19,778 | protected function prepareDocument ( $ document , SVMModel $ model ) { $ tokenMap = $ model -> getTokenMap ( ) ; $ data = array ( ) ; if ( $ this -> documentNormalizer ) { $ document = $ this -> documentNormalizer -> normalize ( $ document ) ; } $ tokens = $ this -> tokenizer -> tokenize ( $ document ) ; if ( $ this ->... | Formats the document for use in \ SVMModel |
19,779 | public function setThreshold ( $ threshold ) { if ( is_numeric ( $ threshold ) ) { $ this -> threshold = $ threshold ; $ this -> svm -> setOptions ( array ( \ SVM :: OPT_PROBABILITY => true ) ) ; if ( $ this -> model -> isPrepared ( ) ) { $ this -> model -> setPrepared ( false ) ; } } else { throw new \ InvalidArgument... | Set the threshold probability a classifier document must meet |
19,780 | public function getProbabilities ( $ document ) { if ( $ this -> hasThreshold ( ) ) { $ model = $ this -> preparedModel ( ) ; $ data = $ this -> prepareDocument ( $ document , $ model ) ; $ probabilities = array ( ) ; $ model -> getModel ( ) -> predict_probability ( $ data , $ probabilities ) ; return array_combine ( $... | Returns the probabilities of the document being in each category |
19,781 | public function getParam ( $ paramName ) { return ! empty ( $ this -> _params [ $ paramName ] ) ? $ this -> _params [ $ paramName ] : NULL ; } | Get a single parameter . |
19,782 | public function arrayToObject ( $ array ) { $ object = new \ stdClass ( ) ; foreach ( $ array as $ k => $ v ) { if ( is_array ( $ v ) ) { $ v = $ this -> arrayToObject ( $ v ) ; } $ object -> { $ k } = $ v ; } return $ object ; } | Assmbles an object from given array |
19,783 | public function offsetGet ( $ offset ) { return isset ( $ this -> _data [ $ offset ] ) ? $ this -> _data [ $ offset ] : NULL ; } | For \ ArrayAccess interface |
19,784 | protected function parseCurlOptions ( $ config ) { $ options = array ( ) ; $ prefix = 'CURLOPT_' ; foreach ( $ config as $ key => $ value ) { $ constantName = $ prefix . strtoupper ( $ key ) ; if ( ! defined ( $ constantName ) ) { $ messageTemplate = "Invalid option '%s' in apicaller.config parameter. " ; $ messageTemp... | Private method to parse cURL options from the bundle config . If some option is not defined an exception will be thrown . |
19,785 | public function run ( ) { $ this -> convertTo -> setData ( $ this -> convertFrom -> getData ( ) ) ; $ this -> convertTo -> write ( ) ; } | run the conversion |
19,786 | public function call ( ApiCallInterface $ call ) { if ( $ call instanceof CurlCall ) { if ( $ this -> freshConnect || $ this -> engine === null || ! ( $ this -> engine instanceof Curl ) ) { $ this -> engine = new Curl ( ) ; } } else { if ( $ this -> freshConnect || $ this -> engine === null || ! ( $ this -> engine inst... | Execute an API call using a certain method |
19,787 | public function withCustomer ( $ telephone , $ email = null , $ sendEmail = false ) { $ this -> customer = [ 'telephoneNumber' => $ telephone , 'email' => $ email , 'sendEmail' => $ sendEmail ? 1 : 0 , ] ; return $ this ; } | Set the customer details to be used during the transaction . |
19,788 | public function usingVendorId ( $ vendorId , $ hash ) { $ this -> vendorId = $ vendorId ; $ this -> hashKey = $ hash ; return $ this ; } | Set up the vendor details . |
19,789 | public function withPayloads ( $ first , $ second , $ third , $ fourth ) { $ this -> payloads = [ 'payload1' => $ first , 'payload2' => $ second , 'payload3' => $ third , 'payload4' => $ fourth , ] ; return $ this ; } | Set up the additional parameters to go with the request . |
19,790 | public function withCallback ( $ successCallback , $ failedCallback = null , $ callbackMode = self :: CALLBACK_MODE_HTTP ) { $ this -> callback = $ successCallback ; $ this -> failedCallback = $ failedCallback ; $ this -> callbackMode = $ callbackMode ; return $ this ; } | Set up the callbacks . |
19,791 | public function transact ( $ amount , $ orderId , $ invoiceNumber = null ) { $ this -> transaction = [ 'amount' => $ amount , 'orderId' => $ orderId , 'invoiceNumber' => $ invoiceNumber ? : $ orderId , ] ; return $ this -> initiateTransaction ( ) ; } | Set up the transaction details and forward the request to be handled . |
19,792 | private function initiateTransaction ( ) { $ params = [ "live" => $ this -> isLive , "oid" => $ this -> transaction [ 'orderId' ] , "inv" => $ this -> transaction [ 'invoiceNumber' ] ? : $ this -> transaction [ 'orderId' ] , "ttl" => $ this -> transaction [ 'amount' ] , "tel" => $ this -> customer [ 'telephoneNumber' ]... | Initiate the transaction and send the information to IPay . |
19,793 | private function generateInitialHash ( ) { $ mergedString = $ this -> isLive . $ this -> transaction [ 'orderId' ] . $ this -> transaction [ 'invoiceNumber' ] . $ this -> transaction [ 'amount' ] . $ this -> customer [ 'telephoneNumber' ] . $ this -> customer [ 'email' ] . $ this -> vendorId . $ this -> currency . $ th... | Generate the hash from the data to be sent . |
19,794 | protected function getParameters ( RequestInterface $ request , ResponseInterface $ response = null ) { $ params = [ ] ; $ result = '' ; $ keys = array_intersect ( $ this -> context , $ this -> availableParameters ) ; foreach ( $ keys as $ key ) { switch ( $ key ) { case 'method' : $ result = $ request -> getMethod ( )... | Get context fields to add to the time - line entry . |
19,795 | public function deleteResource ( PersistentResource $ resource ) { $ this -> s3Client -> deleteObject ( array ( 'Bucket' => $ this -> bucketName , 'Key' => $ this -> keyPrefix . $ resource -> getSha1 ( ) ) ) ; return true ; } | Deletes the storage data related to the given Resource object |
19,796 | public function listBucketsCommand ( ) { try { $ s3Client = new S3Client ( $ this -> s3DefaultProfile ) ; $ result = $ s3Client -> listBuckets ( ) ; } catch ( \ Exception $ e ) { $ this -> outputLine ( $ e -> getMessage ( ) ) ; $ this -> quit ( 1 ) ; exit ; } if ( count ( $ result [ 'Buckets' ] ) === 0 ) { $ this -> ou... | Displays a list of buckets |
19,797 | public function flushBucketCommand ( $ bucket ) { try { $ s3Client = new S3Client ( $ this -> s3DefaultProfile ) ; $ batchDelete = BatchDelete :: fromListObjects ( $ s3Client , [ 'Bucket' => $ bucket ] ) ; $ promise = $ batchDelete -> promise ( ) ; } catch ( \ Exception $ e ) { $ this -> outputLine ( $ e -> getMessage ... | Removes all objects from a bucket |
19,798 | public function listSubscription ( $ id ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'subscriptions/' . ( int ) $ id . '/components' , 'GET' ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this -> isError ( ) ) { $ this -> _data = $ this -> _normalizeResponse... | List components for a subscription |
19,799 | public function readSubscription ( $ subscriptionId , $ componentId ) { $ service = $ this -> getService ( ) ; $ response = $ service -> request ( 'subscriptions/' . ( int ) $ subscriptionId . '/components/' . ( int ) $ componentId , 'GET' ) ; $ responseArray = $ this -> getResponseArray ( $ response ) ; if ( ! $ this ... | Read component for a subscription |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.