idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
33,800
public function score ( $ team , $ points = 1 ) { if ( isset ( $ this -> teams [ $ team ] ) ) { $ this -> teams [ $ team ] -> updateScore ( $ points ) ; } $ this -> drawScoreboard ( ) ; $ this -> drawRainbow ( ) ; $ this -> drawCat ( $ team ) ; }
Updates the score for a team and makes another iteration in the scoreboard animation .
33,801
protected function getPostamble ( $ size ) { $ height_diff = $ this -> height - $ size ; return $ height_diff > 0 ? $ height_diff - floor ( $ height_diff / 2 ) : 0 ; }
Gets the number of newlines from the end that it will take to place the current element in the middle of the scoreboard .
33,802
protected function preamble ( $ size ) { $ preamble = $ this -> getPreamble ( $ size ) ; if ( $ preamble > 0 ) { $ this -> writeLines ( $ preamble ) ; } }
Prints newlines from the top to place the current element in the middle of the scoreboard .
33,803
protected function postamble ( $ size ) { $ postamble = $ this -> getPostamble ( $ size ) ; if ( $ postamble > 0 ) { $ this -> writeLines ( $ postamble ) ; } $ this -> resetCursor ( ) ; }
Prints newlines from the bottom to place the current element in the middle of the scoreboard .
33,804
protected function drawScoreboard ( ) { $ size = count ( $ this -> teams ) ; $ this -> preamble ( $ size ) ; foreach ( $ this -> teams as $ key => $ team ) { $ this -> write ( sprintf ( " %s%sm%s%s\n" , self :: ESC , $ team -> getColor ( ) , $ team -> getScore ( ) , self :: NND ) ) ; } $ this -> postamble ( $ size ) ; }
Draws the scoreboard for the current iteration .
33,805
protected function drawRainbow ( ) { $ rainbow = $ this -> rainbow -> next ( ) ; $ height = $ this -> rainbow -> getHeight ( ) ; $ width = $ this -> rainbow -> getWidth ( ) ; $ preamble = $ this -> getPreamble ( $ height ) ; $ postamble = $ this -> getPostamble ( $ height ) ; while ( $ preamble -- > 0 ) { $ this -> write ( self :: ESC . $ this -> width . 'C' ) ; $ this -> write ( str_repeat ( ' ' , $ width ) ) ; $ this -> write ( "\n" ) ; } foreach ( $ rainbow as $ line ) { $ this -> write ( self :: ESC . $ this -> width . 'C' ) ; $ this -> write ( implode ( $ line ) ) ; $ this -> write ( "\n" ) ; } while ( $ postamble -- > 0 ) { $ this -> write ( self :: ESC . $ this -> width . 'C' ) ; $ this -> write ( str_repeat ( ' ' , $ width ) ) ; $ this -> write ( "\n" ) ; } $ this -> resetCursor ( ) ; }
Draws the rainbow for the current iteration .
33,806
protected function drawCat ( $ team ) { $ cat = $ this -> cat -> next ( isset ( $ this -> teams [ $ team ] ) ? $ this -> teams [ $ team ] -> getEye ( ) : '-' ) ; $ width = $ this -> width + $ this -> rainbow -> getWidth ( ) ; $ size = $ this -> cat -> getHeight ( ) ; $ this -> preamble ( $ size ) ; foreach ( $ cat as $ line ) { $ this -> write ( self :: ESC . $ width . 'C' ) ; $ this -> write ( $ line ) ; $ this -> write ( "\n" ) ; } $ this -> postamble ( $ size ) ; }
Draws the cat for the current iteration .
33,807
private function setTeams ( array $ teams ) { if ( empty ( $ teams ) ) { throw new \ InvalidArgumentException ( 'You must provide at least one team' ) ; } foreach ( $ teams as $ team ) { if ( ! $ team instanceof Team ) { throw new \ InvalidArgumentException ( 'All teams must be an instance of NyanCat\\Team' ) ; } $ this -> teams [ $ team -> getName ( ) ] = $ team ; } }
Sets the teams to track on the scoreboard .
33,808
private function setHeight ( ) { $ this -> height = max ( count ( $ this -> teams ) , $ this -> rainbow -> getHeight ( ) , $ this -> cat -> getHeight ( ) ) ; }
Sets the height in newlines of the tallest element on the scoreboard .
33,809
protected function validateFilter ( $ filter ) { if ( ! isset ( $ this -> filterOptions -> getFilters ( ) [ $ filter ] ) ) { throw new Exception \ FilterNotFoundException ( sprintf ( 'Filter "%s" was not found' , $ filter ) ) ; } $ options = $ this -> filterOptions -> getFilters ( ) [ $ filter ] ; if ( ! isset ( $ options [ 'type' ] ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Filter type for "%s" image filter must be specified' , $ filter ) ) ; } if ( ! isset ( $ options [ 'options' ] ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Options for filter type "%s" must be specified' , $ filter ) ) ; } }
Validates if filter exists and is valid
33,810
public static function fromAlgorithmIdentifier ( PRFAlgorithmIdentifier $ algo ) : PRF { $ oid = $ algo -> oid ( ) ; if ( array_key_exists ( $ oid , self :: MAP_HASH_OID_TO_CLASS ) ) { $ cls = self :: MAP_HASH_OID_TO_CLASS [ $ oid ] ; return new $ cls ( ) ; } throw new \ UnexpectedValueException ( "PRF algorithm " . $ algo -> oid ( ) . " not supported." ) ; }
Get PRF by algorithm identifier .
33,811
public static function validateNodeName ( $ node ) { if ( empty ( $ node ) || is_numeric ( substr ( $ node , 0 , 1 ) ) || substr ( strtolower ( $ node ) , 0 , 3 ) === 'xml' || strstr ( $ node , ' ' ) ) { return false ; } return true ; }
Checks if strings is valid as XML node name .
33,812
public function toString ( $ applystyles = true ) { if ( $ applystyles && ! empty ( $ this -> styles ) ) { $ proc = self :: stylesToProc ( $ this -> styles ) ; $ proc -> registerPhpFunctions ( ) ; } switch ( $ this -> sourceType ) { case self :: SOURCE_TYPE_DOM : $ dom = $ this -> source ; break ; case self :: SOURCE_TYPE_SIMPLEXML : if ( ! isset ( $ proc ) ) { return $ this -> source -> asXML ( ) ; } default : $ dom = $ this -> toDOM ( false ) ; } if ( ! isset ( $ proc ) ) { if ( ! $ dom instanceof DomDocument ) { return $ dom -> ownerDocument -> saveXML ( $ dom ) ; } return $ dom -> saveXML ( ) ; } return ( string ) $ proc -> transformToXML ( $ dom ) ; }
Converts source to XML string .
33,813
public function toDOM ( $ applystyles = true ) { if ( $ applystyles && ! empty ( $ this -> styles ) ) { $ proc = self :: stylesToProc ( $ this -> styles ) ; $ proc -> registerPhpFunctions ( ) ; } switch ( $ this -> sourceType ) { case self :: SOURCE_TYPE_DOM : if ( $ this -> source instanceof DomDocument ) { return $ this -> source ; } $ dom = new DomDocument ( '1.0' , 'utf-8' ) ; $ dome = $ dom -> importNode ( $ this -> source , true ) ; $ dom -> appendChild ( $ dome ) ; return $ dom ; case self :: SOURCE_TYPE_SIMPLEXML : $ dom = new DomDocument ( '1.0' , 'utf-8' ) ; $ dome = dom_import_simplexml ( $ this -> source ) ; $ dome = $ dom -> importNode ( $ dome , true ) ; $ dom -> appendChild ( $ dome ) ; return $ dom ; case self :: SOURCE_TYPE_OBJECT : $ dom = $ this -> objectToDom ( $ this -> source ) ; break ; case self :: SOURCE_TYPE_FILE : $ dom = new DomDocument ( ) ; $ dom -> load ( $ this -> source ) ; break ; case self :: SOURCE_TYPE_STRING : $ dom = new DomDocument ( ) ; $ dom -> loadXML ( $ this -> source ) ; } return isset ( $ proc ) ? $ proc -> transformToDoc ( $ dom ) : $ dom ; }
Converts source to DomDocument .
33,814
public function toSimpleXML ( $ applystyles = true ) { if ( $ applystyles && ! empty ( $ this -> styles ) ) { $ dom = $ this -> toDOM ( $ applystyles ) ; return simplexml_import_dom ( $ dom ) ; } switch ( $ this -> sourceType ) { case self :: SOURCE_TYPE_DOM : return simplexml_import_dom ( $ this -> source ) ; case self :: SOURCE_TYPE_SIMPLEXML : return $ this -> source ; case self :: SOURCE_TYPE_OBJECT : $ dom = $ this -> objectToDom ( $ this -> source ) ; return simplexml_import_dom ( $ dom ) ; case self :: SOURCE_TYPE_FILE : return simplexml_load_file ( $ this -> source ) ; case self :: SOURCE_TYPE_STRING : return simplexml_load_string ( $ this -> source ) ; } }
Converts source to SimpleXMLElement .
33,815
public function toObject ( $ applystyles = true ) { if ( $ this -> sourceType === self :: SOURCE_TYPE_OBJECT && ( ! $ applystyles || empty ( $ this -> styles ) ) ) { return $ this -> source ; } $ dom = $ this -> toDOM ( $ applystyles ) ; return $ this -> domToObject ( $ dom ) ; }
Converts source to PHP object .
33,816
public static function stylesToProc ( $ files = array ( ) ) { if ( ! class_exists ( 'XsltProcessor' ) ) { throw new BadMethodCallException ( 'XSL extension is missing. Can not create XsltProcessor.' ) ; } $ dom = self :: stylesToDOM ( $ files ) ; $ proc = new XsltProcessor ( ) ; $ proc -> importStylesheet ( $ dom ) ; return $ proc ; }
Converts XSL files to XsltProcessor instance .
33,817
public static function stylesToDOM ( $ files = array ( ) ) { foreach ( $ files as $ primary => & $ v ) { if ( ! $ v instanceof DomDocument ) { $ dom = new DomDocument ( ) ; $ dom -> load ( $ v ) ; } else { $ dom = $ v ; } if ( $ dom -> firstChild -> nodeName === 'xsl:stylesheet' ) { break ; } unset ( $ primary ) ; } if ( ! isset ( $ primary ) ) { throw new RuntimeException ( 'No valid XML stylesheets were found for XSLT parser.' ) ; } foreach ( $ files as $ k => & $ v ) { if ( $ k === $ primary ) { continue ; } if ( $ v instanceof DomDocument ) { if ( $ v -> firstChild -> nodeName !== 'xsl:stylesheet' ) { continue ; } foreach ( $ v -> firstChild -> childNodes as $ include ) { $ dom -> appendChild ( $ dom -> importNode ( $ include , true ) ) ; } } else { $ include = $ dom -> createElementNS ( 'http://www.w3.org/1999/XSL/Transform' , 'xsl:include' ) ; $ include -> setAttributeNode ( new DomAttr ( 'href' , $ v ) ) ; $ dom -> firstChild -> appendChild ( $ include ) ; } } return $ dom ; }
Converts XSL files to DomDocument .
33,818
public function objectToDom ( $ obj ) { $ doc = new DomDocument ( '1.0' , 'utf-8' ) ; foreach ( $ obj as $ k => & $ v ) { $ node = $ this -> objectToDomElement ( $ v , $ doc -> createElement ( $ k ) , $ doc ) ; break ; } $ doc -> appendChild ( $ node ) ; return $ doc ; }
Converts PHP object to DomDocument . Note that only the first element in object is converted as XML can only have one root element .
33,819
public function objectToDomElement ( $ obj , DomNode $ node , DomDocument $ doc ) { if ( isset ( $ obj -> __cdata ) ) { $ node -> appendChild ( $ doc -> createCDATASection ( $ obj -> __cdata ) ) ; } foreach ( $ obj as $ key => & $ val ) { if ( in_array ( $ key , array ( '__attr' , '__cdata' ) , true ) ) { continue ; } elseif ( is_array ( $ val ) || $ val instanceof ArrayAccess ) { foreach ( $ val as $ k => & $ v ) { $ e = $ doc -> createElement ( $ key ) ; if ( is_object ( $ v ) ) { $ this -> objectToDomElement ( $ v , $ e , $ doc ) ; } elseif ( is_string ( $ v ) && ! empty ( $ v ) ) { $ e -> appendChild ( $ doc -> createTextNode ( ( string ) $ v ) ) ; } if ( isset ( $ obj -> __attr ) && isset ( $ obj -> __attr [ $ key ] [ $ k ] ) ) { foreach ( ( array ) $ obj -> __attr [ $ key ] [ $ k ] as $ k2 => $ v2 ) { $ e -> setAttribute ( $ k2 , ( string ) $ v2 ) ; } } $ node -> appendChild ( $ e ) ; } continue ; } elseif ( is_object ( $ val ) ) { $ e = $ this -> objectToDomElement ( $ val , $ doc -> createElement ( $ key ) , $ doc ) ; } elseif ( $ val !== null ) { $ e = $ doc -> createElement ( $ key ) ; $ e -> appendChild ( $ doc -> createTextNode ( $ val ) ) ; } else { continue ; } if ( isset ( $ obj -> __attr ) && isset ( $ obj -> __attr [ $ key ] ) ) { foreach ( ( array ) $ obj -> __attr [ $ key ] as $ k => $ v ) { $ e -> setAttribute ( $ k , ( string ) $ v ) ; } } $ node -> appendChild ( $ e ) ; } return $ node ; }
Recursive object to DomElement converter .
33,820
public function consume ( callable $ callback = null , $ flags = AMQP_NOPARAM , $ consumer_tag = null ) { $ this -> last_envelope = null ; $ this -> setupConsume ( $ flags , $ consumer_tag ) ; while ( count ( $ this -> channel -> _getChannel ( ) -> callbacks ) > 0 ) { $ this -> channel -> _getChannel ( ) -> wait ( ) ; call_user_func ( $ callback , $ this -> last_envelope ) ; } }
Consume messages from a queue .
33,821
public function declareQueue ( ) { $ durable = boolval ( $ this -> flags & AMQP_DURABLE ) ; $ passive = boolval ( $ this -> flags & AMQP_PASSIVE ) ; $ exclusive = boolval ( $ this -> flags & AMQP_EXCLUSIVE ) ; $ auto_delete = boolval ( $ this -> flags & AMQP_AUTODELETE ) ; try { list ( $ this -> name , $ num_messages ) = $ this -> channel -> _getChannel ( ) -> queue_declare ( $ this -> name , $ passive , $ durable , $ exclusive , $ auto_delete , $ nowait = false , $ this -> arguments ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return 0 ; } return $ num_messages ; }
Declare a new queue on the broker .
33,822
public function delete ( $ flags = AMQP_NOPARAM ) { $ if_unused = boolval ( $ flags & AMQP_IFUNUSED ) ; try { list ( $ num_deleted ) = $ this -> channel -> _getChannel ( ) -> queue_delete ( $ this -> name , $ if_unused ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return 0 ; } return $ num_deleted ; }
Delete a queue from the broker .
33,823
public function bind ( $ exchange_name , $ routing_key = null , array $ arguments = array ( ) ) { if ( $ routing_key === null ) $ routing_key = '' ; $ bind_arguments = new AMQPTable ( $ arguments ) ; try { $ this -> channel -> _getChannel ( ) -> queue_bind ( $ this -> name , $ exchange_name , $ routing_key , $ nowait = false , $ bind_arguments ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return false ; } return true ; }
Bind the given queue to a routing key on an exchange .
33,824
public function cancel ( $ consumer_tag = '' ) { if ( $ consumer_tag === '' ) $ consumer_tag = $ this -> consumer_tag ; try { $ this -> channel -> _getChannel ( ) -> basic_cancel ( $ consumer_tag ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return false ; } return true ; }
Cancel a queue that is already bound to an exchange and routing key .
33,825
public function reject ( $ delivery_tag , $ flags = AMQP_NOPARAM ) { $ requeue = boolval ( $ flags & AMQP_REQUEUE ) ; try { $ this -> channel -> _getChannel ( ) -> basic_reject ( $ delivery_tag , $ requeue ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return false ; } return true ; }
Mark one message as explicitly not acknowledged .
33,826
public function purge ( ) { try { $ this -> channel -> _getChannel ( ) -> queue_purge ( $ this -> name ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return false ; } return true ; }
Purge the contents of a queue .
33,827
public function setFlags ( $ flags ) { if ( $ flags !== $ flags & ( AMQP_DURABLE | AMQP_PASSIVE | AMQP_EXCLUSIVE | AMQP_AUTODELETE ) ) return false ; $ this -> flags = $ flags ; return true ; }
Set the flags on the queue .
33,828
public function unbind ( $ exchange_name , $ routing_key = null , array $ arguments = array ( ) ) { if ( $ routing_key === null ) $ routing_key = '' ; $ bind_arguments = new AMQPTable ( $ arguments ) ; try { $ this -> channel -> _getChannel ( ) -> queue_unbind ( $ this -> name , $ exchange_name , $ routing_key , $ bind_arguments ) ; } catch ( AMQPRuntimeException $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } catch ( Exception $ e ) { return false ; } return true ; }
Remove a routing key binding on an exchange from the given queue .
33,829
public function find ( $ cacheKey ) { $ key = array_search ( $ cacheKey , $ this -> cachedKeys ) ; if ( $ key != false and ! $ this -> cache -> has ( $ key ) ) { unset ( $ this -> cachedKeys [ $ key ] ) ; $ this -> storeCachedKeys ( ) ; return false ; } return $ key ? $ this -> cache -> get ( $ key ) : false ; }
Find in cache
33,830
public static function get ( ) { $ possibleKeys = [ 'HTTP_X_FORWARDED_FOR' , 'HTTP_X_FORWARDED' , 'HTTP_X_CLUSTER_CLIENT_IP' , 'HTTP_FORWARDED_FOR' , 'HTTP_FORWARDED' , 'HTTP_VIA' , 'HTTP_X_COMING_FROM' , 'HTTP_COMING_FROM' , 'HTTP_X_REAL_IP' , 'REMOTE_ADDR' , ] ; foreach ( $ possibleKeys as $ key ) { if ( $ ip = static :: getGlobalValue ( $ key ) ) { return $ ip ; } } return false ; }
Get user s IP .
33,831
protected static function getGlobalValue ( $ key ) { if ( isset ( $ _SERVER [ $ key ] ) && static :: validate ( $ _SERVER [ $ key ] ) ) { return $ _SERVER [ $ key ] ; } if ( isset ( $ _ENV [ $ key ] ) && static :: validate ( $ _ENV [ $ key ] ) ) { return $ _ENV [ $ key ] ; } if ( @ getenv ( $ key ) && static :: validate ( getenv ( $ key ) ) ) { return getenv ( $ key ) ; } return null ; }
Gets the key value from globals .
33,832
public function guess ( $ binary ) { $ tmpFile = tempnam ( sys_get_temp_dir ( ) , 'ht-img-module' ) ; try { file_put_contents ( $ tmpFile , $ binary ) ; $ mimeType = $ this -> mimeTypeGuesser -> guess ( $ tmpFile ) ; unlink ( $ tmpFile ) ; return $ mimeType ; } catch ( \ Exception $ e ) { unlink ( $ tmpFile ) ; throw $ e ; } }
Gets mime type of binary
33,833
private function init ( ) { if ( ! isset ( $ this -> config ) ) { $ this -> config = Config :: getInstance ( ) ; $ this -> client = new Client ( $ this -> generateClientConfiguration ( ) ) ; } }
Set the actual config instance based on it creates a client instance
33,834
private function generateClientConfiguration ( ) { $ clientConfiguration = [ 'base_uri' => $ this -> config -> api_base , 'timeout' => $ this -> config -> http_timeout , 'headers' => [ 'Connection' => 'keep-alive' , 'Accept-Encoding' => '' ] ] ; if ( $ this -> config -> http_user_agent !== false ) { $ clientConfiguration [ 'headers' ] [ 'User-Agent' ] = 'PhealNG/' . Pheal :: VERSION . ' ' . $ this -> config -> http_user_agent ; } if ( $ this -> config -> http_keepalive !== false ) { $ clientConfiguration [ 'headers' ] [ 'Keep-Alive' ] = 'timeout=' . $ this -> config -> http_keepalive === true ? 15 : $ this -> config -> http_keepalive . ', max=1000' ; } $ clientConfiguration [ 'verify' ] = false ; if ( $ this -> config -> http_ssl_verifypeer === true && $ this -> config -> http_ssl_certificate_file !== false ) { $ clientConfiguration [ 'verify' ] = $ this -> config -> http_ssl_certificate_file ; } elseif ( $ this -> config -> http_ssl_verifypeer === true ) { $ clientConfiguration [ 'verify' ] = true ; } return $ clientConfiguration ; }
Generates Client configuration based on current config instance
33,835
public function fetch ( $ url , $ options ) { $ this -> init ( ) ; $ request_type = $ this -> config -> http_post === true ? 'form_params' : 'query' ; $ options = [ $ request_type => $ options ] ; try { $ response = $ this -> client -> request ( $ this -> config -> http_post === true ? 'POST' : 'GET' , $ url , $ options ) ; } catch ( GuzzleException $ exception ) { throw new ConnectionException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) ) ; } if ( $ response -> getStatusCode ( ) >= 400 ) { switch ( $ response -> getStatusCode ( ) ) { case 400 : case 403 : case 500 : case 503 : return $ response -> getBody ( ) -> getContents ( ) ; break ; } throw new HTTPException ( $ response -> getStatusCode ( ) , $ url ) ; } return $ response -> getBody ( ) -> getContents ( ) ; }
Fetches data from api
33,836
public function includeVariables ( array $ message_variables ) { unset ( $ message_variables [ self :: TEMPLATE_VARIABLE ] ) ; $ this -> message_variables = array_merge ( $ this -> message_variables , $ message_variables ) ; $ this -> assignTemplate ( ) ; }
Assign Message Variables
33,837
public function next ( ) { if ( ! isset ( $ this -> states [ ++ $ this -> index ] ) ) { $ this -> index = 0 ; } $ state = $ this -> fab -> paint ( $ this -> states [ $ this -> index ] ) ; foreach ( $ this -> trajectories as & $ trajectory ) { if ( count ( $ trajectory ) >= $ this -> maxWidth ) { array_shift ( $ trajectory ) ; } $ trajectory [ ] = $ state ; } return $ this -> trajectories ; }
Gets the next rainbow state in the rolling index .
33,838
private function setStates ( array $ states ) { foreach ( $ states as $ state ) { if ( ! is_string ( $ state ) || strlen ( $ state ) !== 1 ) { throw new \ InvalidArgumentException ( 'State must be a one character string' ) ; } } $ this -> states = $ states ; }
Sets the rainbow states .
33,839
protected function flashInput ( array $ fields ) { $ flash = array_where ( $ fields , function ( $ key , $ config ) { return $ config [ 'flash' ] ; } ) ; Input :: flashOnly ( array_keys ( $ flash ) ) ; }
Flash only fields where flash = true
33,840
protected function getValidationRules ( array $ fields ) { $ rules = [ ] ; foreach ( $ fields as $ field => $ data ) { if ( $ data [ 'validate' ] ) $ rules [ $ field ] = $ data [ 'validate' ] ; } return $ rules ; }
Get the validation rules for the request .
33,841
public function getListingPhoto ( ) { return $ this -> photos -> filter ( function ( $ photo ) { return $ photo -> primary ; } ) -> first ( ) ? : new \ Hamjoint \ Mustard \ Media \ Photo ( ) ; }
Return the primary photo .
33,842
public function isBidder ( User $ user ) { return ( bool ) $ this -> bids ( ) -> whereHas ( 'bidder' , function ( $ query ) use ( $ user ) { return $ query -> where ( 'user_id' , $ user -> userId ) ; } ) -> count ( ) ; }
Return true if user has bid on the item .
33,843
public function isWinner ( User $ user ) { if ( ! $ this -> auction || ! $ this -> isEnded ( ) ) { return false ; } return ( bool ) ( $ this -> winningBid && $ this -> winningBid -> bidder == $ user ) ; }
Return true if user has won the item .
33,844
public function isBuyer ( User $ user ) { return ( bool ) $ this -> purchases ( ) -> whereHas ( 'buyer' , function ( $ query ) use ( $ user ) { return $ query -> where ( 'user_id' , $ user -> userId ) ; } ) -> count ( ) ; }
Return true if user has ever purchased the item .
33,845
public function placeBid ( $ amount , User $ user ) { $ bid = new \ Hamjoint \ Mustard \ Auctions \ Bid ( ) ; $ bid -> amount = $ amount ; $ bid -> placed = time ( ) ; $ bid -> bidder ( ) -> associate ( $ user ) ; $ bid -> item ( ) -> associate ( $ this ) ; $ bid -> save ( ) ; }
Shortcut method for placing a bid .
33,846
public function end ( ) { if ( mustard_loaded ( 'auctions' ) && $ this -> auction ) { $ bid = $ this -> getBidHistory ( ) -> first ( ) ; if ( $ bid ) { $ this -> winningBid ( ) -> associate ( $ bid ) ; } } $ now = time ( ) ; if ( $ this -> endDate > $ now ) { $ this -> endedEarly = true ; $ this -> endDate = $ now ; } $ this -> save ( ) ; }
End an item marking a winning bid .
33,847
public function withdraw ( ) { $ this -> withdrawn = $ this -> endedEarly = true ; $ now = time ( ) ; if ( $ this -> endDate > $ now ) { $ this -> endDate = $ now ; } $ this -> save ( ) ; }
Withdraw an item without marking a winning bid .
33,848
public function scopeKeywords ( $ query , $ keyword ) { return $ query -> where ( function ( $ query ) use ( $ keyword ) { $ query -> where ( 'name' , 'LIKE' , "%$keyword%" ) -> orWhere ( 'description' , 'LIKE' , "%$keyword%" ) ; } ) ; }
Search the name and description of items for specific keywords .
33,849
public static function totalWatched ( $ since = 0 , $ until = null ) { $ until = $ until ? : time ( ) ; return ( int ) self :: whereHas ( 'watchers' , function ( $ query ) use ( $ since , $ until ) { $ query -> where ( 'added' , '>=' , $ since ) ; $ query -> where ( 'added' , '<=' , $ until ) ; } ) -> count ( ) ; }
Return the total number of watched items .
33,850
public function asParameters ( ) : Parameters { if ( $ this -> parameters === null ) { $ this -> parameters = new Parameters ( $ this -> all ( ) ) ; } return $ this -> parameters ; }
returns as Parameters instance
33,851
public function asRequestModel ( ) : RequestModel { if ( $ this -> requestModel === null ) { $ this -> requestModel = RequestModel :: fromRequest ( $ this ) ; } return $ this -> requestModel ; }
returns as Request Model
33,852
protected function getChoices ( array $ statuses ) { $ transitions = array ( ) ; foreach ( $ statuses as $ statusFrom ) { foreach ( $ statuses as $ statusTo ) { $ transitionName = $ this -> transitionTransformer -> generateTransitionName ( $ statusFrom , $ statusTo ) ; $ transitions [ $ transitionName ] = $ transitionName ; } } return $ transitions ; }
Generate all possible transitions between statuses
33,853
public function parseSimpleAnnotation ( $ name ) { $ m = array ( ) ; if ( Preg :: match ( $ this -> body , '/@' . $ name . '\s+([^\n]+)/i' , $ m ) ) { return rtrim ( $ m [ 1 ] ) ; } return NULL ; }
Returns the first matching Annotation with the given name and returns its value
33,854
public function append ( $ string ) { if ( isset ( $ this -> body ) ) $ this -> body .= "\n" ; $ this -> body .= $ string ; return $ this ; }
Adds a new line to the DocBlockBody
33,855
protected function getFilename ( $ key ) { $ sha1 = sha1 ( $ key ) ; $ result = $ this -> path . '/' . substr ( $ sha1 , 0 , 2 ) . '/' . substr ( $ sha1 , 2 ) . '.php' ; return $ result ; }
Get cache filename .
33,856
protected function createCacheValue ( $ key , $ value , $ ttl = null ) { $ created = time ( ) ; return array ( 'created' => $ created , 'key' => $ key , 'value' => $ value , 'ttl' => $ ttl , 'expires' => ( $ ttl ) ? $ created + $ ttl : null ) ; }
Creates a cache value object .
33,857
public function processar ( ) { $ retorno = new Retorno ( ) ; $ lote = null ; $ lines = file ( $ this -> processor -> getNomeArquivo ( ) , FILE_IGNORE_NEW_LINES ) ; foreach ( $ lines as $ lineNumber => $ lineContent ) { $ string = new Stringy ( rtrim ( $ lineContent , "\r\n" ) ) ; $ composable = $ this -> processor -> processarLinha ( $ lineNumber , $ string ) ; if ( $ this -> processor -> needToCreateLote ( ) ) { $ lote = $ this -> createLote ( $ retorno ) ; } $ this -> processor -> processCnab ( $ retorno , $ composable , $ lote ) ; $ event = new OnDetailRegisterEvent ( $ this -> processor , $ lineNumber , $ composable ) ; $ this -> dispatcher -> dispatch ( RetornoEvents :: ON_DETAIL_REGISTER , $ event ) ; } return $ retorno ; }
Executa o processamento de todo o arquivo linha a linha .
33,858
public static function mustNotBeginAndEndWith ( $ character = '/' , $ string = '' ) { return self :: mustNotBeginWith ( $ character , self :: mustNotEndWith ( $ character , $ string ) ) ; }
Check if a string doesn t end or begin with a special character
33,859
public static function str_to_hex ( $ string ) { $ hex = '' ; for ( $ i = 0 ; $ i < strlen ( $ string ) ; $ i ++ ) { $ hex .= dechex ( ord ( $ string [ $ i ] ) ) ; } return $ hex ; }
Transform a strin to hexadecimal
33,860
public static function strip_all_tags ( $ string , $ remove_breaks = false ) { $ string = preg_replace ( '@<(script|style)[^>]*?>.*?</\\1>@si' , '' , $ string ) ; $ string = strip_tags ( $ string ) ; if ( $ remove_breaks ) { $ string = preg_replace ( '/[\r\n\t ]+/' , ' ' , $ string ) ; } return trim ( $ string ) ; }
Properly strip all HTML tags including script and style .
33,861
public function setLines ( $ lines ) { if ( ! is_array ( $ lines ) ) { throw new AutoGitIgnoreInvalidParameterException ( "$lines must be an array. Each value is one line" ) ; } if ( current ( $ lines ) !== $ this -> startMarker ) { array_unshift ( $ lines , $ this -> startMarker ) ; } if ( end ( $ lines ) !== $ this -> endMarker ) { $ lines [ ] = $ this -> endMarker ; } $ this -> autoLines = $ lines ; return $ this ; }
Set the lines to appear between the makers
33,862
public function debug ( ) { echo "filePath = " . $ this -> filePath . PHP_EOL ; echo "startMarker = " . $ this -> startMarker . PHP_EOL ; echo "endMarker = " . $ this -> endMarker . PHP_EOL ; echo "startIndex = " . $ this -> startIndex . PHP_EOL ; echo "endIndex = " . $ this -> endIndex . PHP_EOL ; echo "numLines = " . $ this -> numLines . PHP_EOL ; echo "Start = " . print_r ( $ this -> beforeLines , true ) ; echo "Auto = " . print_r ( $ this -> autoLines , true ) ; echo "End = " . print_r ( $ this -> afterLines , true ) ; return $ this ; }
Prints debug info
33,863
public function relatedPost ( ApiRequest $ request , $ resourceModel ) { $ requestModel = $ request -> asRequestModel ( ) ; $ this -> validate ( $ requestModel , $ this -> getCreatingRules ( ) ) ; $ ids = ( array ) $ requestModel -> id ( ) ; $ relation = $ this -> getRelation ( $ resourceModel ) ; $ this -> beforeCreating ( $ ids , $ relation ) ; $ requestModel -> map ( function ( RequestModel $ model ) use ( $ relation ) { $ this -> createRelationshipModel ( $ relation , $ model ) ; } ) ; return $ this -> getRelation ( $ resourceModel -> fresh ( ) ) -> get ( ) ; }
post request on To - Many relationship
33,864
public function getIndex ( $ itemId ) { $ item = Item :: findOrFail ( $ itemId ) ; if ( ! $ item -> isStarted ( ) && $ item -> seller -> userId != Auth :: user ( ) -> userId ) { return mustard_redirect ( '/' ) ; } if ( mustard_loaded ( 'media' ) ) { $ photos = $ item -> photos ( ) -> orderBy ( 'primary' , 'desc' ) -> get ( ) ; if ( $ photos -> isEmpty ( ) ) { $ photos -> push ( new Photo ( ) ) ; } ; } $ bids = mustard_loaded ( 'auctions' ) ? $ item -> getBidHistory ( ) : new Collection ( ) ; $ highest_bid = mustard_loaded ( 'auctions' ) ? ( $ bids -> first ( ) ? : new \ Hamjoint \ Mustard \ Auctions \ Bid ( ) ) : new Collection ( ) ; return view ( 'mustard::item.summary' , [ 'item' => $ item , 'photos' => $ photos , 'bids' => $ bids , 'highest_bid' => $ highest_bid , ] ) ; }
Return the item summary view .
33,865
public function getNew ( ) { $ categories = Category :: leaves ( ) -> orderBy ( 'category_id' ) -> get ( ) ; if ( ! session ( ) -> has ( 'photos' ) ) { $ session_photos = [ ] ; } else { foreach ( session ( 'photos' ) as $ session_photo ) { $ session_photos [ ] = \ Hamjoint \ Mustard \ Media \ Photo :: find ( $ session_photo [ 'photo_id' ] ) ; } } return view ( 'mustard::item.new' , [ 'categories' => $ categories , 'item' => new Item ( ) , 'listing_durations' => ListingDuration :: all ( ) , 'item_conditions' => ItemCondition :: all ( ) , 'photos' => $ session_photos , ] ) ; }
Return the new item view .
33,866
public function getRelist ( $ itemId ) { $ item = Item :: findOrFail ( $ itemId ) ; Session :: forget ( 'photos' ) ; foreach ( $ item -> photos as $ photo ) { Session :: push ( 'photos' , [ 'real_path' => $ photo -> getPath ( ) , 'filename' => $ photo -> photoId , ] ) ; } $ categories = Category :: leaves ( ) -> orderBy ( 'category_id' ) -> get ( ) ; return view ( 'mustard::item.new' , [ 'item' => $ item , 'categories' => $ categories , ] ) ; }
Return the relist item view .
33,867
public function getEnd ( $ itemId ) { $ item = Item :: findOrFail ( $ itemId ) ; if ( $ item -> isEnded ( ) ) { return redirect ( '/item/' . $ item -> itemId ) ; } return view ( 'mustard::item.end' , [ 'item' => $ item , ] ) ; }
Return the end item view .
33,868
public function postEdit ( Request $ request ) { $ item = Item :: findOrFail ( $ request -> input ( 'item_id' ) ) ; if ( $ item -> userId != Auth :: user ( ) -> userId ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'You can only edit your own items.' ] ) ; } if ( ! $ item -> isActive ( ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'You can only edit an active item.' ] ) ; } return redirect ( '/inventory/selling' ) -> withStatus ( $ item -> name . ' has been edited.' ) ; }
Edit an item .
33,869
public function postCancel ( Request $ request ) { $ item = Item :: findOrFail ( $ request -> input ( 'item_id' ) ) ; if ( $ item -> userId != Auth :: user ( ) -> userId ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'You can only end your own items.' ] ) ; } if ( $ item -> endDate < time ( ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'This item has already ended.' ] ) ; } $ item -> cancel ( ) ; return redirect ( '/inventory/unsold' ) -> withStatus ( $ item -> name . ' has been cancelled.' ) ; }
Cancel an item .
33,870
public function postUnwatch ( Request $ request ) { $ item = Item :: findOrFail ( $ request -> input ( 'item_id' ) ) ; if ( ! Auth :: user ( ) -> watching -> contains ( $ item ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ "You aren't watching this item." ] ) ; } Auth :: user ( ) -> watching ( ) -> detach ( $ item ) ; return redirect ( ) -> back ( ) -> withStatus ( $ item -> name . ' has been removed from your watched items.' ) ; }
Unwatch an item .
33,871
public function forgePasswordToken ( ) { $ password_token = Str :: random ( 128 ) ; $ this -> password_token = $ password_token ; if ( $ this -> save ( ) ) { return $ password_token ; } }
Generate a new password token .
33,872
public function changePassword ( $ password_token , $ new_password ) { if ( $ this -> checkPasswordToken ( $ password_token ) ) { $ this -> password = $ new_password ; $ this -> attributes [ 'password_token' ] = null ; FuzzAuthUserProvider :: revokeSessionsForOwnerTypeAndId ( 'user' , $ this -> { $ this -> getKey ( ) } ) ; return true ; } return false ; }
Reset password with a token .
33,873
protected function sendEmail ( $ account , $ token ) { Mail :: queue ( config ( 'store.email_reset_password' ) , compact ( 'account' , 'token' ) , function ( $ message ) use ( $ account ) { $ message -> to ( $ account -> email , $ account -> username ) -> subject ( trans ( 'account.email.password_reset.subject' ) ) ; } ) ; }
Sends an email containing the reset password link with the given token to the user .
33,874
public function requestChangePassword ( CanResetPasswordContract $ account ) { $ token = $ this -> generateToken ( ) ; $ values = [ 'email' => $ account -> getEmailForPasswordReset ( ) , 'token' => $ token , 'created_at' => new \ DateTime ] ; $ reminder = $ this -> getReminder ( ) -> fill ( $ values ) ; $ reminder -> save ( ) ; $ this -> sendEmail ( $ account , $ token ) ; return $ token ; }
Generate a token for password change and saves it in the Reminder table with the email of the user .
33,875
public function getEmailByToken ( $ token ) { $ reminder = $ this -> getReminder ( ) -> where ( 'token' , '=' , $ token ) -> where ( 'created_at' , '>=' , $ this -> getOldestValidDate ( ) ) -> first ( ) ; return $ reminder -> email ; }
Returns the email associated with the given reset password token .
33,876
public function send ( MessageInterface $ message , $ skipErrors = true ) { $ this -> clearErrors ( ) ; $ storePath = $ this -> getParam ( 'store_path' ) ; if ( empty ( $ storePath ) ) { throw new ConfigurationException ( __CLASS__ . ' is not configured properly. Please set "store_path" parameter.' ) ; } $ pathChmod = $ this -> getParam ( 'path_chmod' ) ; $ dir = realpath ( $ storePath ) ; if ( ! is_dir ( $ dir ) ) { if ( ! mkdir ( $ storePath , $ pathChmod , true ) ) { return false ; } } $ format = $ this -> getParam ( 'format' ) ; foreach ( $ message -> getRecipient ( ) as $ recipient ) { $ savePath = $ storePath . DIRECTORY_SEPARATOR . $ this -> getFileName ( $ recipient ) ; $ content = sprintf ( $ format , $ recipient , $ message -> getText ( ) ) ; $ return = file_put_contents ( $ savePath , $ content ) ; if ( $ return === false ) { $ errorMsg = sprintf ( "Error while saving file \"%s\" with SMS message." , $ savePath ) ; $ this -> addError ( new SendingError ( $ recipient , self :: ERROR_NOT_SAVED , $ errorMsg ) ) ; if ( ! $ skipErrors ) { throw new RuntimeException ( $ errorMsg , self :: ERROR_NOT_SAVED ) ; } } } return $ this -> getErrors ( ) -> count ( ) > 0 ; }
Save message in file
33,877
protected function voteForReadAction ( $ subject , TokenInterface $ token ) { $ contentType = $ subject ; if ( is_object ( $ subject ) ) { $ contentType = $ subject -> getContentType ( ) ; } return $ this -> isSubjectInPerimeter ( $ contentType , $ token -> getUser ( ) , ContentTypeInterface :: ENTITY_TYPE ) ; }
Vote for Read action A user can read a content if it is in his perimeter
33,878
public function resizeImage ( $ original , $ path , $ width , $ height ) { $ original = $ this -> getFullPath ( $ original ) ; $ pathArray = explode ( '/' , $ path ) ; array_pop ( $ pathArray ) ; $ folder = implode ( '/' , $ pathArray ) ; if ( ! file_exists ( $ folder ) ) { mkdir ( $ folder , 0777 , true ) ; } $ file = \ File :: get ( $ original ) ; $ img = \ Image :: make ( $ file ) -> resize ( $ width , $ height , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; $ constraint -> upsize ( ) ; } ) ; $ img -> save ( $ path ) ; return $ this -> showFile ( $ path ) ; }
Resize the image .
33,879
public function showFile ( $ path ) { ob_end_clean ( ) ; ob_start ( ) ; $ type = \ File :: mimeType ( $ path ) ; return response ( ) -> file ( $ path , [ 'Content-Type' => $ type ] ) ; }
Show the specified file in the browser .
33,880
public function writeMethod ( GMethod $ method , $ baseIndent = 0 , $ eol = "\n" ) { $ php = NULL ; if ( $ method -> hasDocBlock ( ) ) { $ php = $ this -> writeDocBlock ( $ method -> getDocBlock ( ) , $ baseIndent , $ eol ) ; } $ php .= str_repeat ( ' ' , $ baseIndent ) ; $ php .= $ this -> writeModifiers ( $ method -> getModifiers ( ) ) ; $ php .= $ this -> writeGFunction ( $ method , $ baseIndent , $ eol ) ; return $ php ; }
returns the PHP Code for a GMethod
33,881
public function writeFunctionBody ( GFunctionBody $ body = NULL , $ baseIndent = 0 , $ eol = "\n" ) { $ php = NULL ; $ phpBody = $ body ? $ body -> php ( $ baseIndent + 2 , $ eol ) . $ eol : '' ; $ php .= ' {' ; $ php .= $ eol ; $ php .= $ phpBody ; $ php .= S :: indent ( '}' , $ baseIndent , $ eol ) ; return $ php ; }
Writes a function body
33,882
public function addImport ( ClassInterface $ gClass , $ alias = NULL ) { $ this -> imports -> add ( $ gClass , $ alias ) ; return $ this ; }
Adds an Import that should be added to every written file
33,883
public function policy ( $ force_new = false ) { if ( ( ! $ force_new ) && ( ! is_null ( $ this -> policy ) ) ) { return $ this -> policy ; } return $ this -> policy = policy ( $ this -> policy_class ) ; }
Get this class policy
33,884
public function make ( $ form , $ params = [ ] ) { $ this -> form = $ form ; $ this -> setParams ( $ params ) ; return clone $ this ; }
Get the evaluated view contents for the given form .
33,885
public function handle ( FormRequest $ request ) { try { $ form = $ this -> resolve ( ) ; $ request -> validate ( $ form -> fields ) ; $ form -> request = $ request ; $ this -> kernel -> fireEvent ( $ form ) ; return true ; } catch ( FormException $ e ) { $ this -> kernel -> setErrors ( $ this -> form , $ e -> getErrors ( ) -> messages ( ) ) ; return false ; } catch ( QueryException $ e ) { throw new HttpException ( 500 , $ e -> getMessage ( ) ) ; } catch ( \ Exception $ e ) { throw new HttpException ( 500 , $ e -> getMessage ( ) ) ; } }
Handle form form submission
33,886
public function render ( ) { try { $ output = '' ; $ form = $ this -> resolve ( ) ; $ errors = $ this -> kernel -> getErrors ( $ this -> form ) ; $ output = $ this -> kernel -> render ( $ form , $ errors ) ; } catch ( \ Exception $ e ) { $ output = '<error>' . $ e -> getMessage ( ) . '</error>' ; } return $ output ; }
Render the current form
33,887
public static function call ( $ uri ) { return new \ OtherCode \ Rest \ Rest ( new \ OtherCode \ Rest \ Core \ Configuration ( array ( 'url' => $ uri ) ) ) ; }
Initialize a short chained call .
33,888
public function convertToFloat ( Stringy $ string , $ decimalPoints = self :: DECIMAL_POINTS ) { if ( ! is_int ( $ decimalPoints ) ) { $ decimalPoints = self :: DECIMAL_POINTS ; } return ( float ) preg_replace ( '#(\d*)(\d{' . $ decimalPoints . '})$#' , '$1.$2' , $ string -> __toString ( ) ) ; }
Converte uma stringy para um float de acordo com a quantidade de casas decimais passadas
33,889
public function findResponse ( $ method , $ url , array $ data = [ ] , array $ headers = [ ] , $ basicAuthCredentials = '' ) { $ signature = $ this -> signature -> generate ( $ method , $ url , $ data , $ headers , $ basicAuthCredentials ) ; return $ this -> cacheManager -> find ( $ signature ) ; }
Find a response in the cache
33,890
public function storeResponse ( Response $ response , $ method , $ url , array $ data = [ ] , array $ headers = [ ] , $ basicAuthCredentials = '' , $ minutes = 30 ) { $ signature = $ this -> signature -> generate ( $ method , $ url , $ data , $ headers , $ basicAuthCredentials ) ; $ this -> cacheManager -> store ( $ signature , $ response , $ minutes ) ; }
Store a response in the cache
33,891
public static function install ( $ reservedMemory = 1048576 , Isolator $ isolator = null ) { $ fatalHandler = static :: installFatalHandler ( $ reservedMemory , $ isolator ) ; return array ( static :: installErrorHandler ( $ isolator ) , $ fatalHandler ) ; }
Installs a new error handler and a new fatal error handler simultaneously .
33,892
public static function installErrorHandler ( Isolator $ isolator = null ) { $ handler = new ErrorHandler ( null , $ isolator ) ; $ handler -> install ( ) ; return $ handler ; }
Installs a new error handler .
33,893
public static function installFatalHandler ( $ reservedMemory = 1048576 , Isolator $ isolator = null ) { $ handler = new FatalErrorHandler ( null , $ isolator ) ; $ handler -> install ( $ reservedMemory ) ; return $ handler ; }
Installs a new fatal error handler .
33,894
public static function assertCompatibleHandler ( Isolator $ isolator = null ) { $ isolator = Isolator :: get ( $ isolator ) ; $ message = 'Error handling is incorrectly configured.' ; try { $ isolator -> trigger_error ( $ message , E_USER_NOTICE ) ; } catch ( ErrorException $ e ) { if ( $ e -> getMessage ( ) === $ message && $ e -> getSeverity ( ) === E_USER_NOTICE ) { return ; } } throw new ErrorHandlingConfigurationException ( ) ; }
Asserts that an error handling is configured in a way that is compatible with code expecting error exceptions .
33,895
public function tag ( string $ tag ) : array { return $ this -> hasTag ( $ tag ) ? $ this -> tags [ $ tag ] : null ; }
The value of a tag .
33,896
public function patch ( $ url , array $ data = [ ] , array $ headers = [ ] , HttpExceptionHandler $ handler = null ) { return $ this -> send ( 'patch' , $ url , $ data , $ headers , $ handler ) ; }
Send PATCH request
33,897
public function setBasicAuthentication ( $ username , $ password ) { $ this -> basicAuthCredentials = implode ( ':' , [ $ username , $ password ] ) ; $ this -> curl -> setBasicAuthentication ( $ username , $ password ) ; }
Set basic authentication
33,898
private function getCachedResponse ( $ method , $ url , array $ data , array $ headers ) { if ( $ this -> cache ) { return $ this -> cache -> findResponse ( $ method , $ url , $ data , $ headers , $ this -> basicAuthCredentials ) ; } return false ; }
Get response from cache
33,899
private function throwExceptionOnHttpErrors ( Response $ response ) { $ httpCode = $ response -> getHttpCode ( ) ; if ( $ httpCode >= 400 ) { $ httpMessage = $ response -> getHttpMessage ( $ httpCode ) ; throw new HttpException ( $ response , $ httpMessage , $ httpCode ) ; } }
Check for any HTTP response errors