idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
5,600
public function render ( $ view , $ data = [ ] , $ mergeData = [ ] ) { return $ this -> container [ 'view' ] -> make ( $ view , $ data , $ mergeData ) -> render ( ) ; }
Render shortcut .
5,601
public function generate ( $ node = null , $ clockSeq = null ) { $ uuid = uuid_create ( UUID_TYPE_TIME ) ; return uuid_parse ( $ uuid ) ; }
Generate a version 1 UUID using the PECL UUID extension
5,602
public function build ( CodecInterface $ codec , array $ fields ) { return new DegradedUuid ( $ fields , $ this -> numberConverter , $ codec , $ this -> timeConverter ) ; }
Builds a DegradedUuid
5,603
public static function applyVersion ( $ timeHi , $ version ) { $ timeHi = hexdec ( $ timeHi ) & 0x0fff ; $ timeHi &= ~ ( 0xf000 ) ; $ timeHi |= $ version << 12 ; return $ timeHi ; }
Applies the RFC 4122 version number to the time_hi_and_version field
5,604
public function encode ( UuidInterface $ uuid ) { $ sixPieceComponents = array_values ( $ uuid -> getFieldsHex ( ) ) ; $ this -> swapTimestampAndRandomBits ( $ sixPieceComponents ) ; return vsprintf ( '%08s-%04s-%04s-%02s%02s-%012s' , $ sixPieceComponents ) ; }
Encodes a UuidInterface as a string representation of a timestamp first COMB UUID
5,605
public function encodeBinary ( UuidInterface $ uuid ) { $ stringEncoding = $ this -> encode ( $ uuid ) ; return hex2bin ( str_replace ( '-' , '' , $ stringEncoding ) ) ; }
Encodes a UuidInterface as a binary representation of timestamp first COMB UUID
5,606
public function decode ( $ encodedUuid ) { $ fivePieceComponents = $ this -> extractComponents ( $ encodedUuid ) ; $ this -> swapTimestampAndRandomBits ( $ fivePieceComponents ) ; return $ this -> getBuilder ( ) -> build ( $ this , $ this -> getFields ( $ fivePieceComponents ) ) ; }
Decodes a string representation of timestamp first COMB UUID into a UuidInterface object instance
5,607
protected function swapTimestampAndRandomBits ( array & $ components ) { $ last48Bits = $ components [ 4 ] ; if ( count ( $ components ) == 6 ) { $ last48Bits = $ components [ 5 ] ; $ components [ 5 ] = $ components [ 0 ] . $ components [ 1 ] ; } else { $ components [ 4 ] = $ components [ 0 ] . $ components [ 1 ] ; } $...
Swaps the first 48 bits with the last 48 bits
5,608
public function generate ( $ node = null , $ clockSeq = null ) { $ node = $ this -> getValidNode ( $ node ) ; if ( $ clockSeq === null ) { $ clockSeq = random_int ( 0 , 0x3fff ) ; } $ timeOfDay = $ this -> timeProvider -> currentTime ( ) ; $ uuidTime = $ this -> timeConverter -> calculateTime ( ( string ) $ timeOfDay [...
Generate a version 1 UUID from a host ID sequence number and the current time
5,609
protected function uuidFromNsAndName ( $ ns , $ name , $ version , $ hashFunction ) { if ( ! ( $ ns instanceof UuidInterface ) ) { $ ns = $ this -> codec -> decode ( $ ns ) ; } $ hash = call_user_func ( $ hashFunction , ( $ ns -> getBytes ( ) . $ name ) ) ; return $ this -> uuidFromHashedName ( $ hash , $ version ) ; }
Returns a version 3 or 5 namespaced Uuid
5,610
public function decode ( $ encodedUuid ) { $ components = $ this -> extractComponents ( $ encodedUuid ) ; $ fields = $ this -> getFields ( $ components ) ; return $ this -> builder -> build ( $ this , $ fields ) ; }
Decodes a string representation of a UUID into a UuidInterface object instance
5,611
public function decodeBytes ( $ bytes ) { if ( strlen ( $ bytes ) !== 16 ) { throw new InvalidArgumentException ( '$bytes string should contain 16 characters.' ) ; } $ hexUuid = unpack ( 'H*' , $ bytes ) ; return $ this -> decode ( $ hexUuid [ 1 ] ) ; }
Decodes a binary representation of a UUID into a UuidInterface object instance
5,612
protected function getFields ( array $ components ) { return [ 'time_low' => str_pad ( $ components [ 0 ] , 8 , '0' , STR_PAD_LEFT ) , 'time_mid' => str_pad ( $ components [ 1 ] , 4 , '0' , STR_PAD_LEFT ) , 'time_hi_and_version' => str_pad ( $ components [ 2 ] , 4 , '0' , STR_PAD_LEFT ) , 'clock_seq_hi_and_reserved' =>...
Returns the fields that make up this UUID
5,613
public function encode ( UuidInterface $ uuid ) { $ components = array_values ( $ uuid -> getFieldsHex ( ) ) ; $ this -> swapFields ( $ components ) ; return vsprintf ( '%08s-%04s-%04s-%02s%02s-%012s' , $ components ) ; }
Encodes a UuidInterface as a string representation of a GUID
5,614
public function encodeBinary ( UuidInterface $ uuid ) { $ components = array_values ( $ uuid -> getFieldsHex ( ) ) ; return hex2bin ( implode ( '' , $ components ) ) ; }
Encodes a UuidInterface as a binary representation of a GUID
5,615
public function decode ( $ encodedUuid ) { $ components = $ this -> extractComponents ( $ encodedUuid ) ; $ this -> swapFields ( $ components ) ; return $ this -> getBuilder ( ) -> build ( $ this , $ this -> getFields ( $ components ) ) ; }
Decodes a string representation of a GUID into a UuidInterface object instance
5,616
protected function swapFields ( array & $ components ) { $ hex = unpack ( 'H*' , pack ( 'L' , hexdec ( $ components [ 0 ] ) ) ) ; $ components [ 0 ] = $ hex [ 1 ] ; $ hex = unpack ( 'H*' , pack ( 'S' , hexdec ( $ components [ 1 ] ) ) ) ; $ components [ 1 ] = $ hex [ 1 ] ; $ hex = unpack ( 'H*' , pack ( 'S' , hexdec ( $...
Swaps fields to support GUID byte order
5,617
public function getNode ( ) { foreach ( $ this -> nodeProviders as $ provider ) { if ( $ node = $ provider -> getNode ( ) ) { return $ node ; } } return null ; }
Returns the system node ID by iterating over an array of node providers and returning the first non - empty value found
5,618
public function encodeBinary ( UuidInterface $ uuid ) { $ fields = $ uuid -> getFieldsHex ( ) ; $ optimized = [ $ fields [ 'time_hi_and_version' ] , $ fields [ 'time_mid' ] , $ fields [ 'time_low' ] , $ fields [ 'clock_seq_hi_and_reserved' ] , $ fields [ 'clock_seq_low' ] , $ fields [ 'node' ] , ] ; return hex2bin ( im...
Encodes a UuidInterface as an optimized binary representation of a UUID
5,619
public function decodeBytes ( $ bytes ) { if ( strlen ( $ bytes ) !== 16 ) { throw new InvalidArgumentException ( '$bytes string should contain 16 characters.' ) ; } $ hex = unpack ( 'H*' , $ bytes ) [ 1 ] ; $ hex = substr ( $ hex , 8 , 4 ) . substr ( $ hex , 12 , 4 ) . substr ( $ hex , 4 , 4 ) . substr ( $ hex , 0 , 4...
Decodes an optimized binary representation of a UUID into a UuidInterface object instance
5,620
public function build ( CodecInterface $ codec , array $ fields ) { return new Uuid ( $ fields , $ this -> numberConverter , $ codec , $ this -> timeConverter ) ; }
Builds a Uuid
5,621
public function generate ( $ length ) { if ( $ length < self :: TIMESTAMP_BYTES || $ length < 0 ) { throw new \ InvalidArgumentException ( 'Length must be a positive integer.' ) ; } $ hash = '' ; if ( self :: TIMESTAMP_BYTES > 0 && $ length > self :: TIMESTAMP_BYTES ) { $ hash = $ this -> randomGenerator -> generate ( ...
Generates a string of binary data of the specified length
5,622
public function toHex ( $ integer ) { if ( ! $ integer instanceof BigNumber ) { $ integer = new BigNumber ( $ integer ) ; } return BigNumber :: convertFromBase10 ( $ integer , 16 ) ; }
Converts an integer or Moontoast \ Math \ BigNumber integer representation into a hexadecimal string representation
5,623
public function unserialize ( $ serialized ) { $ uuid = self :: fromString ( $ serialized ) ; $ this -> codec = $ uuid -> codec ; $ this -> numberConverter = $ uuid -> getNumberConverter ( ) ; $ this -> fields = $ uuid -> fields ; }
Re - constructs the object from its serialized form .
5,624
protected function getIfconfig ( ) { if ( strpos ( strtolower ( ini_get ( 'disable_functions' ) ) , 'passthru' ) !== false ) { return '' ; } ob_start ( ) ; switch ( strtoupper ( substr ( php_uname ( 'a' ) , 0 , 3 ) ) ) { case 'WIN' : passthru ( 'ipconfig /all 2>&1' ) ; break ; case 'DAR' : passthru ( 'ifconfig 2>&1' ) ...
Returns the network interface configuration for the system
5,625
protected function getSysfs ( ) { $ mac = false ; if ( strtoupper ( php_uname ( 's' ) ) === 'LINUX' ) { $ addressPaths = glob ( '/sys/class/net/*/address' , GLOB_NOSORT ) ; if ( empty ( $ addressPaths ) ) { return false ; } array_walk ( $ addressPaths , function ( $ addressPath ) use ( & $ macs ) { $ macs [ ] = file_ge...
Returns mac address from the first system interface via the sysfs interface
5,626
protected function buildCodec ( $ useGuids = false ) { if ( $ useGuids ) { return new GuidStringCodec ( $ this -> builder ) ; } return new StringCodec ( $ this -> builder ) ; }
Determines which UUID coder - decoder to use and returns the configured codec for this environment
5,627
protected function buildTimeGenerator ( TimeProviderInterface $ timeProvider ) { if ( $ this -> enablePecl ) { return new PeclUuidTimeGenerator ( ) ; } return ( new TimeGeneratorFactory ( $ this -> nodeProvider , $ this -> timeConverter , $ timeProvider ) ) -> getGenerator ( ) ; }
Determines which time - based UUID generator to use and returns the configured time - based UUID generator for this environment
5,628
protected function buildTimeConverter ( ) { if ( $ this -> is64BitSystem ( ) ) { return new PhpTimeConverter ( ) ; } elseif ( $ this -> hasGmp ( ) ) { return new GmpTimeConverter ( ) ; } elseif ( $ this -> hasBigNumber ( ) ) { return new BigNumberTimeConverter ( ) ; } return new DegradedTimeConverter ( ) ; }
Determines which time converter to use and returns the configured time converter for this environment
5,629
protected function buildUuidBuilder ( ) { if ( $ this -> is64BitSystem ( ) ) { return new DefaultUuidBuilder ( $ this -> numberConverter , $ this -> timeConverter ) ; } return new DegradedUuidBuilder ( $ this -> numberConverter , $ this -> timeConverter ) ; }
Determines which UUID builder to use and returns the configured UUID builder for this environment
5,630
public function validate ( $ uuid ) { $ uuid = str_replace ( [ 'urn:' , 'uuid:' , '{' , '}' ] , '' , $ uuid ) ; if ( $ uuid === Uuid :: NIL || preg_match ( '/' . self :: VALID_PATTERN . '/D' , $ uuid ) ) { return true ; } return false ; }
Validate that a string represents a UUID
5,631
public function columnQuote ( $ column ) { if ( empty ( $ column ) ) { return null ; } preg_match ( '/^(?:(?<table>\w+)\.)?(?<column>\w+)$/iu' , $ column , $ match ) ; if ( isset ( $ match [ 'table' ] , $ match [ 'column' ] ) ) { $ table = $ this -> tableQuote ( $ match [ 'table' ] ) ; $ match [ 'column' ] = str_replac...
Quotes a column name for use in a query .
5,632
public function set ( $ column , $ value = null , $ quote = null ) { if ( is_array ( $ column ) ) { foreach ( $ column as $ columnName => $ columnValue ) { $ this -> set ( $ columnName , $ columnValue , $ quote ) ; } } else { $ this -> set [ ] = array ( 'column' => $ this -> columnQuote ( $ column ) , 'value' => $ valu...
Add one or more column values to INSERT UPDATE or REPLACE .
5,633
private function criteria ( array & $ criteria , $ column , $ value , $ operator = self :: EQUALS , $ connector = self :: LOGICAL_AND , $ quote = null ) { $ criteria [ ] = array ( 'column' => $ this -> columnQuote ( $ column ) , 'value' => $ value , 'operator' => $ operator , 'connector' => $ connector , 'quote' => $ q...
Add a condition to the specified WHERE or HAVING criteria .
5,634
public function orHaving ( $ column , $ value , $ operator = self :: EQUALS , $ quote = null ) { return $ this -> orCriteria ( $ this -> having , $ column , $ value , $ operator , self :: LOGICAL_OR , $ quote ) ; }
Add an OR HAVING condition .
5,635
public function getJoinString ( ) { $ statement = "" ; foreach ( $ this -> join as $ i => $ join ) { $ statement .= " " . $ join [ 'type' ] . " " . $ join [ 'table' ] ; if ( $ join [ 'alias' ] ) { $ statement .= " AS " . $ join [ 'alias' ] ; } if ( $ join [ 'criteria' ] ) { $ statement .= " ON " ; foreach ( $ join [ 'c...
Get the JOIN portion of the statement as a string .
5,636
public function mergeInto ( Miner $ Miner , $ overrideLimit = true ) { if ( $ this -> isSelect ( ) ) { $ this -> mergeSelectInto ( $ Miner ) ; $ this -> mergeFromInto ( $ Miner ) ; $ this -> mergeJoinInto ( $ Miner ) ; $ this -> mergeWhereInto ( $ Miner ) ; $ this -> mergeGroupByInto ( $ Miner ) ; $ this -> mergeHaving...
Merge this Miner into the given Miner .
5,637
protected function prepareDirectory ( ) { if ( File :: exists ( $ this -> docDir ) && ! is_writable ( $ this -> docDir ) ) { throw new L5SwaggerException ( 'Documentation storage directory is not writable' ) ; } if ( File :: exists ( $ this -> docDir ) ) { File :: deleteDirectory ( $ this -> docDir ) ; } File :: makeDi...
Check directory structure and permissions .
5,638
protected function defineConstants ( ) { if ( ! empty ( $ this -> constants ) ) { foreach ( $ this -> constants as $ key => $ value ) { defined ( $ key ) || define ( $ key , $ value ) ; } } return $ this ; }
Define constant which will be replaced .
5,639
protected function scanFilesForDocumentation ( ) { if ( $ this -> isOpenApi ( ) ) { $ this -> swagger = \ OpenApi \ scan ( $ this -> appDir , [ 'exclude' => $ this -> excludedDirs ] ) ; } if ( ! $ this -> isOpenApi ( ) ) { $ this -> swagger = \ Swagger \ scan ( $ this -> appDir , [ 'exclude' => $ this -> excludedDirs ]...
Scan directory and create Swagger .
5,640
protected function populateServers ( ) { if ( config ( 'l5-swagger.paths.base' ) !== null ) { if ( $ this -> isOpenApi ( ) ) { $ this -> swagger -> servers = [ new \ OpenApi \ Annotations \ Server ( [ 'url' => config ( 'l5-swagger.paths.base' ) ] ) , ] ; } if ( ! $ this -> isOpenApi ( ) ) { $ this -> swagger -> basePat...
Generate servers section or basePath depending on Swagger version .
5,641
protected function saveJson ( ) { $ this -> swagger -> saveAs ( $ this -> docsFile ) ; $ security = new SecurityDefinitions ( ) ; $ security -> generate ( $ this -> docsFile ) ; return $ this ; }
Save documentation as json file .
5,642
protected function makeYamlCopy ( ) { if ( $ this -> yamlCopyRequired ) { file_put_contents ( $ this -> yamlDocsFile , ( new YamlDumper ( 2 ) ) -> dump ( json_decode ( file_get_contents ( $ this -> docsFile ) , true ) , 20 ) ) ; } }
Save documentation as yaml file .
5,643
public function generateSwaggerApi ( Collection $ documentation , array $ securityConfig ) { $ securityDefinitions = collect ( ) ; if ( $ documentation -> has ( 'securityDefinitions' ) ) { $ securityDefinitions = collect ( $ documentation -> get ( 'securityDefinitions' ) ) ; } foreach ( $ securityConfig as $ key => $ c...
Inject security settings for Swagger 1 & 2 .
5,644
public function generateOpenApi ( Collection $ documentation , array $ securityConfig ) { $ components = collect ( ) ; if ( $ documentation -> has ( 'components' ) ) { $ components = collect ( $ documentation -> get ( 'components' ) ) ; } $ securitySchemes = collect ( ) ; if ( $ components -> has ( 'securitySchemes' ) ...
Inject security settings for OpenApi 3 .
5,645
public function updateGeoIp ( ) { $ updater = new GeoIpUpdater ( ) ; $ success = $ updater -> updateGeoIpFiles ( $ this -> config -> get ( 'geoip_database_path' ) ) ; $ this -> messageRepository -> addMessage ( $ updater -> getMessages ( ) ) ; return $ success ; }
Update the GeoIp2 database .
5,646
public function addMessage ( $ message ) { collect ( ( array ) $ message ) -> each ( function ( $ item ) { collect ( $ item ) -> flatten ( ) -> each ( function ( $ flattened ) { $ this -> messageList -> push ( $ flattened ) ; } ) ; } ) ; }
Add a message to the messages list .
5,647
public function parse ( $ refererUrl , $ pageUrl ) { $ this -> setReferer ( $ this -> parser -> parse ( $ refererUrl , $ pageUrl ) ) ; return $ this ; }
Parse a referer .
5,648
public function fire ( ) { $ tracker = app ( 'tracker' ) ; $ type = $ tracker -> updateGeoIp ( ) ? 'info' : 'error' ; $ this -> displayMessages ( $ type , $ tracker -> getMessages ( ) ) ; }
Update the geo ip database .
5,649
public function display ( $ result , $ method = 'info' ) { if ( $ result ) { if ( is_array ( $ result ) ) { $ this -> displayTable ( $ result ) ; } elseif ( is_bool ( $ result ) ) { $ this -> { $ method } ( $ result ? 'Statement executed sucessfully.' : 'And error ocurred while executing the statement.' ) ; } else { $ ...
Display results .
5,650
public function displayTable ( $ table ) { $ headers = $ this -> makeHeaders ( $ table [ 0 ] ) ; $ rows = [ ] ; foreach ( $ table as $ row ) { $ rows [ ] = ( array ) $ row ; } $ this -> table = $ this -> getHelperSet ( ) -> get ( 'table' ) ; $ this -> table -> setHeaders ( $ headers ) -> setRows ( $ rows ) ; $ this -> ...
Display results in table format .
5,651
protected function registerTracker ( ) { $ this -> app -> singleton ( 'tracker' , function ( $ app ) { $ app [ 'tracker.loaded' ] = true ; return new Tracker ( $ app [ 'tracker.config' ] , $ app [ 'tracker.repositories' ] , $ app [ 'request' ] , $ app [ 'router' ] , $ app [ 'log' ] , $ app , $ app [ 'tracker.messages' ...
Takes all the components of Tracker and glues them together to create Tracker .
5,652
protected function registerGlobalViewComposers ( ) { $ me = $ this ; $ this -> app -> make ( 'view' ) -> composer ( 'pragmarx/tracker::*' , function ( $ view ) use ( $ me ) { $ view -> with ( 'stats_layout' , $ me -> getConfig ( 'stats_layout' ) ) ; $ template_path = url ( '/' ) . $ me -> getConfig ( 'stats_template_pa...
Register global view composers .
5,653
private function calculateStartEnd ( ) { if ( $ this -> minutes == 0 ) { $ this -> setToday ( ) ; } else { $ this -> start = Carbon :: now ( ) -> subMinutes ( $ this -> minutes ) ; $ this -> end = Carbon :: now ( ) ; } }
Calculate start and end dates .
5,654
public function slug ( Model $ model , bool $ force = false ) : bool { $ this -> setModel ( $ model ) ; $ attributes = [ ] ; foreach ( $ this -> model -> sluggable ( ) as $ attribute => $ config ) { if ( is_numeric ( $ attribute ) ) { $ attribute = $ config ; $ config = $ this -> getConfiguration ( ) ; } else { $ confi...
Slug the current model .
5,655
public function buildSlug ( string $ attribute , array $ config , bool $ force = null ) { $ slug = $ this -> model -> getAttribute ( $ attribute ) ; if ( $ force || $ this -> needsSlugging ( $ attribute , $ config ) ) { $ source = $ this -> getSlugSource ( $ config [ 'source' ] ) ; if ( $ source || is_numeric ( $ sourc...
Build the slug for the given attribute of the current model .
5,656
protected function getSlugSource ( $ from ) : string { if ( is_null ( $ from ) ) { return $ this -> model -> __toString ( ) ; } $ sourceStrings = array_map ( function ( $ key ) { $ value = data_get ( $ this -> model , $ key ) ; if ( is_bool ( $ value ) ) { $ value = ( int ) $ value ; } return $ value ; } , ( array ) $ ...
Get the source string for the slug .
5,657
protected function generateSlug ( string $ source , array $ config , string $ attribute ) : string { $ separator = $ config [ 'separator' ] ; $ method = $ config [ 'method' ] ; $ maxLength = $ config [ 'maxLength' ] ; $ maxLengthKeepWords = $ config [ 'maxLengthKeepWords' ] ; if ( $ method === null ) { $ slugEngine = $...
Generate a slug from the given source string .
5,658
protected function validateSlug ( string $ slug , array $ config , string $ attribute ) : string { $ separator = $ config [ 'separator' ] ; $ reserved = $ config [ 'reserved' ] ; if ( $ reserved === null ) { return $ slug ; } if ( $ reserved instanceof \ Closure ) { $ reserved = $ reserved ( $ this -> model ) ; } if ( ...
Checks that the given slug is not a reserved word .
5,659
protected function makeSlugUnique ( string $ slug , array $ config , string $ attribute ) : string { if ( ! $ config [ 'unique' ] ) { return $ slug ; } $ separator = $ config [ 'separator' ] ; $ list = $ this -> getExistingSlugs ( $ slug , $ attribute , $ config ) ; if ( $ list -> count ( ) === 0 || $ list -> contains ...
Checks if the slug should be unique and makes it so if needed .
5,660
protected function generateSuffix ( string $ slug , string $ separator , Collection $ list ) : string { $ len = strlen ( $ slug . $ separator ) ; if ( $ list -> search ( $ slug ) === $ this -> model -> getKey ( ) ) { $ suffix = explode ( $ separator , $ slug ) ; return end ( $ suffix ) ; } $ list -> transform ( functio...
Generate a unique suffix for the given slug ( and list of existing similar slugs .
5,661
public static function createSlug ( $ model , string $ attribute , string $ fromString , array $ config = null ) : string { if ( is_string ( $ model ) ) { $ model = new $ model ; } $ instance = ( new static ( ) ) -> setModel ( $ model ) ; if ( $ config === null ) { $ config = Arr :: get ( $ model -> sluggable ( ) , $ a...
Generate a unique slug for a given string .
5,662
public function scopeFindSimilarSlugs ( Builder $ query , string $ attribute , array $ config , string $ slug ) : Builder { $ separator = $ config [ 'separator' ] ; return $ query -> where ( function ( Builder $ q ) use ( $ attribute , $ slug , $ separator ) { $ q -> where ( $ attribute , '=' , $ slug ) -> orWhere ( $ ...
Query scope for finding similar slugs used to determine uniqueness .
5,663
public function getSlugKeyName ( ) : string { if ( property_exists ( $ this , 'slugKeyName' ) ) { return $ this -> slugKeyName ; } $ config = $ this -> sluggable ( ) ; $ name = reset ( $ config ) ; $ key = key ( $ config ) ; if ( $ key === 0 ) { return $ name ; } return $ key ; }
Primary slug column of this model .
5,664
public function scopeWhereSlug ( Builder $ scope , string $ slug ) : Builder { return $ scope -> where ( $ this -> getSlugKeyName ( ) , $ slug ) ; }
Query scope for finding a model by its primary slug .
5,665
protected function extract ( $ file , $ path ) { $ command = 'tar -xzf ' . ProcessExecutor :: escape ( $ file ) . ' -C ' . ProcessExecutor :: escape ( $ path ) ; if ( 0 === $ this -> process -> execute ( $ command , $ ignoredOutput ) ) { return ; } throw new \ RuntimeException ( "Failed to execute '$command'\n\n" . $ t...
extract using cmdline tar which merges with existing files and folders
5,666
public function download ( PackageInterface $ package , $ path , $ output = true ) { $ temporaryDir = $ this -> config -> get ( 'vendor-dir' ) . '/composer/' . substr ( md5 ( uniqid ( '' , true ) ) , 0 , 8 ) ; $ this -> filesystem -> ensureDirectoryExists ( $ temporaryDir ) ; if ( ! $ package -> getDistUrl ( ) ) { thro...
we can t do that since we need our contents to be merged into the probably existing folder structure
5,667
public function setReplacements ( $ replacements ) { if ( ! ( $ replacements instanceof Swift_Plugins_Decorator_Replacements ) ) { $ this -> replacements = ( array ) $ replacements ; } else { $ this -> replacements = $ replacements ; } }
Sets replacements .
5,668
public function getReplacementsFor ( $ address ) { if ( $ this -> replacements instanceof Swift_Plugins_Decorator_Replacements ) { return $ this -> replacements -> getReplacementsFor ( $ address ) ; } return $ this -> replacements [ $ address ] ?? null ; }
Find a map of replacements for the address .
5,669
private function restoreMessage ( Swift_Mime_SimpleMessage $ message ) { if ( $ this -> lastMessage === $ message ) { if ( isset ( $ this -> originalBody ) ) { $ message -> setBody ( $ this -> originalBody ) ; $ this -> originalBody = null ; } if ( ! empty ( $ this -> originalHeaders ) ) { foreach ( $ message -> getHea...
Restore a changed message back to its original state
5,670
public function reset ( ) { $ this -> headerHash = null ; $ this -> signedHeaders = [ ] ; $ this -> bodyHash = null ; $ this -> bodyHashHandler = null ; $ this -> bodyCanonIgnoreStart = 2 ; $ this -> bodyCanonEmptyCounter = 0 ; $ this -> bodyCanonLastChar = null ; $ this -> bodyCanonSpace = false ; }
Reset the Signer .
5,671
public function setHashAlgorithm ( $ hash ) { switch ( $ hash ) { case 'rsa-sha1' : $ this -> hashAlgorithm = 'rsa-sha1' ; break ; case 'rsa-sha256' : $ this -> hashAlgorithm = 'rsa-sha256' ; if ( ! defined ( 'OPENSSL_ALGO_SHA256' ) ) { throw new Swift_SwiftException ( 'Unable to set sha256 as it is not supported by Op...
Set hash_algorithm must be one of rsa - sha256 | rsa - sha1 .
5,672
public function setBodySignedLen ( $ len ) { if ( true === $ len ) { $ this -> showLen = true ; $ this -> maxLen = PHP_INT_MAX ; } elseif ( false === $ len ) { $ this -> showLen = false ; $ this -> maxLen = PHP_INT_MAX ; } else { $ this -> showLen = true ; $ this -> maxLen = ( int ) $ len ; } return $ this ; }
Set the length of the body to sign .
5,673
public function startBody ( ) { switch ( $ this -> hashAlgorithm ) { case 'rsa-sha256' : $ this -> bodyHashHandler = hash_init ( 'sha256' ) ; break ; case 'rsa-sha1' : $ this -> bodyHashHandler = hash_init ( 'sha1' ) ; break ; } $ this -> bodyCanonLine = '' ; }
Start Body .
5,674
public function setHeaders ( Swift_Mime_SimpleHeaderSet $ headers ) { $ this -> headerCanonData = '' ; $ listHeaders = $ headers -> listAll ( ) ; foreach ( $ listHeaders as $ hName ) { if ( ! isset ( $ this -> ignoredHeaders [ strtolower ( $ hName ) ] ) ) { if ( $ headers -> has ( $ hName ) ) { $ tmp = $ headers -> get...
Set the headers to sign .
5,675
public function setLanguage ( $ lang ) { $ this -> clearCachedValueIf ( $ this -> lang != $ lang ) ; $ this -> lang = $ lang ; }
Set the language used in this Header .
5,676
protected function getEncodableWordTokens ( $ string ) { $ tokens = [ ] ; $ encodedToken = '' ; foreach ( preg_split ( '~(?=[\t ])~' , $ string ) as $ token ) { if ( $ this -> tokenNeedsEncoding ( $ token ) ) { $ encodedToken .= $ token ; } else { if ( strlen ( $ encodedToken ) > 0 ) { $ tokens [ ] = $ encodedToken ; $...
Splits a string into tokens in blocks of words which can be encoded quickly .
5,677
public function reset ( ) { $ this -> hashHandler = null ; $ this -> bodyCanonIgnoreStart = 2 ; $ this -> bodyCanonEmptyCounter = 0 ; $ this -> bodyCanonLastChar = null ; $ this -> bodyCanonSpace = false ; return $ this ; }
Resets internal states .
5,678
public function setNameAddresses ( $ mailboxes ) { $ this -> mailboxes = $ this -> normalizeMailboxes ( ( array ) $ mailboxes ) ; $ this -> setCachedValue ( null ) ; }
Set a list of mailboxes to be shown in this Header .
5,679
public function removeAddresses ( $ addresses ) { $ this -> setCachedValue ( null ) ; foreach ( ( array ) $ addresses as $ address ) { unset ( $ this -> mailboxes [ $ address ] ) ; } }
Remove one or more addresses from this Header .
5,680
protected function normalizeMailboxes ( array $ mailboxes ) { $ actualMailboxes = [ ] ; foreach ( $ mailboxes as $ key => $ value ) { if ( is_string ( $ key ) ) { $ address = $ key ; $ name = $ value ; } else { $ address = $ value ; $ name = null ; } $ this -> assertValidAddress ( $ address ) ; $ actualMailboxes [ $ ad...
Normalizes a user - input list of mailboxes into consistent key = > value pairs .
5,681
protected function createDisplayNameString ( $ displayName , $ shorten = false ) { return $ this -> createPhrase ( $ this , $ displayName , $ this -> getCharset ( ) , $ this -> getEncoder ( ) , $ shorten ) ; }
Produces a compliant formatted display - name based on the string given .
5,682
private function createNameAddressStrings ( array $ mailboxes ) { $ strings = [ ] ; foreach ( $ mailboxes as $ email => $ name ) { $ mailboxStr = $ this -> addressEncoder -> encodeString ( $ email ) ; if ( null !== $ name ) { $ nameStr = $ this -> createDisplayNameString ( $ name , empty ( $ strings ) ) ; $ mailboxStr ...
Return an array of strings conforming the the name - addr spec of RFC 2822 .
5,683
public function bindEventListener ( Swift_Events_EventListener $ listener ) { foreach ( $ this -> listeners as $ l ) { if ( $ l === $ listener ) { return ; } } $ this -> listeners [ ] = $ listener ; }
Bind an event listener to this dispatcher .
5,684
public function dispatchEvent ( Swift_Events_EventObject $ evt , $ target ) { $ this -> prepareBubbleQueue ( $ evt ) ; $ this -> bubble ( $ evt , $ target ) ; }
Dispatch the given Event to all suitable listeners .
5,685
private function getHandle ( $ nsKey , $ itemKey , $ position ) { if ( ! isset ( $ this -> keys [ $ nsKey ] [ $ itemKey ] ) ) { $ openMode = $ this -> hasKey ( $ nsKey , $ itemKey ) ? 'r+b' : 'w+b' ; $ fp = fopen ( $ this -> path . '/' . $ nsKey . '/' . $ itemKey , $ openMode ) ; $ this -> keys [ $ nsKey ] [ $ itemKey ...
Get a file handle on the cache item .
5,686
public function setParameters ( array $ parameters ) { $ this -> clearCachedValueIf ( $ this -> params != $ parameters ) ; $ this -> params = $ parameters ; }
Set an associative array of parameter names mapped to values .
5,687
private function getEndOfParameterValue ( $ value , $ encoded = false , $ firstLine = false ) { if ( ! preg_match ( '/^' . self :: TOKEN_REGEX . '$/D' , $ value ) ) { $ value = '"' . $ value . '"' ; } $ prepend = '=' ; if ( $ encoded ) { $ prepend = '*=' ; if ( $ firstLine ) { $ prepend = '*=' . $ this -> getCharset ( ...
Returns the parameter value from the = and beyond .
5,688
private function getResponse ( $ secret , $ challenge ) { if ( strlen ( $ secret ) > 64 ) { $ secret = pack ( 'H32' , md5 ( $ secret ) ) ; } if ( strlen ( $ secret ) < 64 ) { $ secret = str_pad ( $ secret , 64 , chr ( 0 ) ) ; } $ k_ipad = substr ( $ secret , 0 , 64 ) ^ str_repeat ( chr ( 0x36 ) , 64 ) ; $ k_opad = subs...
Generate a CRAM - MD5 response from a server challenge .
5,689
public function setCharacterSet ( $ charset ) { $ this -> charset = $ charset ; $ this -> charReader = null ; $ this -> mapType = 0 ; }
Set the character set used in this CharacterStream .
5,690
public function afterEhlo ( Swift_Transport_SmtpAgent $ agent ) { if ( $ this -> username ) { $ count = 0 ; $ errors = [ ] ; foreach ( $ this -> getAuthenticatorsForAgent ( ) as $ authenticator ) { if ( in_array ( strtolower ( $ authenticator -> getAuthKeyword ( ) ) , array_map ( 'strtolower' , $ this -> esmtpParams ) ...
Runs immediately after a EHLO has been issued .
5,691
protected function getAuthenticatorsForAgent ( ) { if ( ! $ mode = strtolower ( $ this -> auth_mode ) ) { return $ this -> authenticators ; } foreach ( $ this -> authenticators as $ authenticator ) { if ( strtolower ( $ authenticator -> getAuthKeyword ( ) ) == $ mode ) { return [ $ authenticator ] ; } } throw new Swift...
Returns the authenticator list for the given agent .
5,692
public function queueMessage ( Swift_Mime_SimpleMessage $ message ) { $ ser = serialize ( $ message ) ; $ fileName = $ this -> path . '/' . $ this -> getRandomString ( 10 ) ; for ( $ i = 0 ; $ i < $ this -> retryLimit ; ++ $ i ) { $ fp = @ fopen ( $ fileName . '.message' , 'xb' ) ; if ( false !== $ fp ) { if ( false ==...
Queues a message .
5,693
public function recover ( $ timeout = 900 ) { foreach ( new DirectoryIterator ( $ this -> path ) as $ file ) { $ file = $ file -> getRealPath ( ) ; if ( '.message.sending' == substr ( $ file , - 16 ) ) { $ lockedtime = filectime ( $ file ) ; if ( ( time ( ) - $ lockedtime ) > $ timeout ) { rename ( $ file , substr ( $ ...
Execute a recovery if for any reason a process is sending for too long .
5,694
public function setDisposition ( $ disposition ) { if ( ! $ this -> setHeaderFieldModel ( 'Content-Disposition' , $ disposition ) ) { $ this -> getHeaders ( ) -> addParameterizedHeader ( 'Content-Disposition' , $ disposition ) ; } return $ this ; }
Set the Content - Disposition of this attachment .
5,695
public function setFile ( Swift_FileStream $ file , $ contentType = null ) { $ this -> setFilename ( basename ( $ file -> getPath ( ) ) ) ; $ this -> setBody ( $ file , $ contentType ) ; if ( ! isset ( $ contentType ) ) { $ extension = strtolower ( substr ( $ file -> getPath ( ) , strrpos ( $ file -> getPath ( ) , '.' ...
Set the file that this attachment is for .
5,696
public function getReaderFor ( $ charset ) { $ charset = strtolower ( trim ( $ charset ) ) ; foreach ( self :: $ map as $ pattern => $ spec ) { $ re = '/^' . $ pattern . '$/D' ; if ( preg_match ( $ re , $ charset ) ) { if ( ! array_key_exists ( $ pattern , self :: $ loaded ) ) { $ reflector = new ReflectionClass ( $ sp...
Returns a CharacterReader suitable for the charset applied .
5,697
public function terminate ( ) { if ( isset ( $ this -> stream ) ) { switch ( $ this -> params [ 'type' ] ) { case self :: TYPE_PROCESS : fclose ( $ this -> in ) ; fclose ( $ this -> out ) ; proc_close ( $ this -> stream ) ; break ; case self :: TYPE_SOCKET : default : fclose ( $ this -> stream ) ; break ; } } $ this ->...
Perform any shutdown logic needed .
5,698
public function setWriteTranslations ( array $ replacements ) { foreach ( $ this -> translations as $ search => $ replace ) { if ( ! isset ( $ replacements [ $ search ] ) ) { $ this -> removeFilter ( $ search ) ; unset ( $ this -> translations [ $ search ] ) ; } } foreach ( $ replacements as $ search => $ replace ) { i...
Set an array of string replacements which should be made on data written to the buffer .
5,699
protected function doCommit ( $ bytes ) { if ( isset ( $ this -> in ) ) { $ bytesToWrite = strlen ( $ bytes ) ; $ totalBytesWritten = 0 ; while ( $ totalBytesWritten < $ bytesToWrite ) { $ bytesWritten = fwrite ( $ this -> in , substr ( $ bytes , $ totalBytesWritten ) ) ; if ( false === $ bytesWritten || 0 === $ bytesW...
Write this bytes to the stream