idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
57,100
public function createCollection ( $ channelIdentifier , $ title , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } if ( ! is_numeric ( $ channelIdentifier ) ) { throw new InvalidIdentifierException ( 'channel' ) ; } if ( ! is_string ( $ ti...
Create a new collection owned a channel
57,101
public function updateCollection ( $ collectionId , $ title , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } if ( ! is_string ( $ title ) ) { throw new InvalidTypeException ( 'Title' , 'string' , gettype ( $ title ) ) ; } $ params = [ 'ti...
Update a collection
57,102
public function createCollectionThumbnail ( $ collectionId , $ itemId , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } if ( ! is_string ( $ itemId ) ) { throw new InvalidTypeException ( 'Item ID' , 'string' , gettype ( $ itemId ) ) ; } $ ...
Create a collection thumbnail
57,103
public function deleteCollection ( $ collectionId , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } return $ this -> delete ( sprintf ( 'collections/%s' , $ collectionId ) , [ ] , $ accessToken ) ; }
Delete a collection
57,104
public function deleteCollectionItem ( $ collectionId , $ itemId , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } if ( ! is_string ( $ itemId ) ) { throw new InvalidTypeException ( 'Item ID' , 'string' , gettype ( $ itemId ) ) ; } return ...
Delete an item from a collection
57,105
public function moveCollectionThumbnail ( $ collectionId , $ itemId , $ position , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } if ( ! is_string ( $ itemId ) ) { throw new InvalidTypeException ( 'Item ID' , 'string' , gettype ( $ itemId...
Move a collection item
57,106
public function getUser ( $ userIdentifier ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) && ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } return $ this -> get ( sprintf ( 'users/%s' , $ userIdentifier ) ) ; }
Get a user
57,107
public function getUserByUsername ( $ username ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } $ params = [ 'login' => $ username , ] ; return $ this -> get ( 'users' , $ params ) ; }
Get a user from their username
57,108
public function getUserEmotes ( $ userIdentifier , $ accessToken ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) && ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } return $ this -> get ( sprintf ( 'users/%s/emotes' , $ userIdentifier ) , [ ] , $ accessToken ) ; }
Get a user s emotes
57,109
public function checkUserSubscriptionToChannel ( $ userIdentifier , $ channelIdentifier , $ accessToken ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } if ( ! is_numeric ( $ channelIdentifier ) ) { throw new InvalidIdent...
Check if a user is subscribed to a channel
57,110
public function getUsersFollowedChannels ( $ userIdentifier , $ limit = 25 , $ offset = 0 , $ direction = 'desc' , $ sortby = 'created_at' ) { $ availableSortBys = [ 'created_at' , 'last_broadcast' , 'login' ] ; if ( $ this -> apiVersionIsGreaterThanV3 ( ) && ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdent...
Gets a list of all channels followed by a user
57,111
public function checkUserFollowsChannel ( $ userIdentifier , $ channelIdentifier ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } if ( ! is_numeric ( $ channelIdentifier ) ) { throw new InvalidIdentifierException ( 'chann...
Check if a user follows a channel
57,112
public function followChannel ( $ userIdentifier , $ channelIdentifier , $ accessToken , $ notifications = false ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } if ( ! is_numeric ( $ channelIdentifier ) ) { throw new Inv...
Have a user follow a channel
57,113
public function unfollowChannel ( $ userIdentifier , $ channelIdentifier , $ accessToken ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } if ( ! is_numeric ( $ channelIdentifier ) ) { throw new InvalidIdentifierException ...
Have a user unfollow a channel
57,114
public function blockUser ( $ userIdentifier , $ userToBlockIdentifier , $ accessToken ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) || ! is_numeric ( $ userToBlockIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } } return $ this -> put ( sprintf ( 'users...
Block a user
57,115
public function unblockUser ( $ userIdentifier , $ userToUnlockIdentifier , $ accessToken ) { if ( $ this -> apiVersionIsGreaterThanV3 ( ) ) { if ( ! is_numeric ( $ userIdentifier ) || ! is_numeric ( $ userToUnlockIdentifier ) ) { throw new InvalidIdentifierException ( 'user' ) ; } } return $ this -> delete ( sprintf (...
Unblock a user
57,116
public function createUserVHSConnection ( $ identifier , $ accessToken ) { if ( ! $ this -> apiVersionIsGreaterThanV3 ( ) ) { throw new EndpointNotSupportedByApiVersionException ( ) ; } $ params = [ 'identifier' => $ identifier , ] ; return $ this -> put ( 'user/vhs' , $ params , $ accessToken ) ; }
Creates a connection between a user and VHS
57,117
public function searchChannels ( $ query , $ limit = 25 , $ offset = 0 ) { if ( ! is_string ( $ query ) ) { throw new InvalidTypeException ( 'Query' , 'string' , gettype ( $ query ) ) ; } if ( empty ( $ query ) ) { throw new TwitchApiException ( 'A \'query\' parameter is required.' ) ; } if ( ! $ this -> isValidLimit (...
Search for channels by name or description
57,118
public function searchGames ( $ query ) { if ( ! is_string ( $ query ) ) { throw new InvalidTypeException ( 'Query' , 'string' , gettype ( $ query ) ) ; } if ( empty ( $ query ) ) { throw new TwitchApiException ( 'A \'query\' parameter is required.' ) ; } return $ this -> get ( 'search/games' , [ 'query' => $ query ] )...
Search for games by name
57,119
public function searchStreams ( $ query , $ limit = 25 , $ offset = 0 , $ hls = null ) { if ( ! is_string ( $ query ) ) { throw new InvalidTypeException ( 'Query' , 'string' , gettype ( $ query ) ) ; } if ( empty ( $ query ) ) { throw new TwitchApiException ( 'A \'query\' parameter is required.' ) ; } if ( ! $ this -> ...
Search for streams by channel description or game name
57,120
public function httpAuth ( ) { $ client_id = $ this -> settings [ 'client_id' ] ; $ client_secret = $ this -> settings [ 'client_secret' ] ; $ headerToken = base64_encode ( "$client_id:$client_secret" ) ; $ headers = array ( 'Accept' => 'application/json' , 'Authorization' => "Basic $headerToken" ) ; $ request_path = "...
Generate authentifikasi ke server berupa OAUTH .
57,121
public function getBalanceInfo ( $ oauth_token , $ sourceAccountId = [ ] ) { $ corp_id = $ this -> settings [ 'corp_id' ] ; $ apikey = $ this -> settings [ 'api_key' ] ; $ secret = $ this -> settings [ 'secret_key' ] ; $ this -> validateArray ( $ sourceAccountId ) ; ksort ( $ sourceAccountId ) ; $ arraySplit = implode ...
Ambil informasi saldo berdasarkan nomor akun BCA .
57,122
public function getAccountStatement ( $ oauth_token , $ sourceAccount , $ startDate , $ endDate ) { $ corp_id = $ this -> settings [ 'corp_id' ] ; $ apikey = $ this -> settings [ 'api_key' ] ; $ secret = $ this -> settings [ 'secret_key' ] ; $ uriSign = "GET:/banking/v3/corporates/$corp_id/accounts/$sourceAccount/state...
Ambil Daftar transaksi pertanggal .
57,123
public function getAtmLocation ( $ oauth_token , $ latitude , $ longitude , $ count = '10' , $ radius = '20' ) { $ apikey = $ this -> settings [ 'api_key' ] ; $ secret = $ this -> settings [ 'secret_key' ] ; $ params = array ( ) ; $ params [ 'SearchBy' ] = 'Distance' ; $ params [ 'Latitude' ] = $ latitude ; $ params [ ...
Ambil informasi ATM berdasarkan lokasi GEO .
57,124
public function getForexRate ( $ oauth_token , $ rateType = 'e-rate' , $ currency = 'USD' ) { $ apikey = $ this -> settings [ 'api_key' ] ; $ secret = $ this -> settings [ 'secret_key' ] ; $ params = array ( ) ; $ params [ 'RateType' ] = strtolower ( $ rateType ) ; $ params [ 'Currency' ] = strtoupper ( $ currency ) ; ...
Ambil KURS mata uang .
57,125
public function fundTransfers ( $ oauth_token , $ amount , $ sourceAccountNumber , $ beneficiaryAccountNumber , $ referenceID , $ remark1 , $ remark2 , $ transactionID ) { $ corp_id = $ this -> settings [ 'corp_id' ] ; $ apikey = $ this -> settings [ 'api_key' ] ; $ secret = $ this -> settings [ 'secret_key' ] ; $ uriS...
Transfer dana kepada akun lain dengan jumlah nominal tertentu .
57,126
public static function generateSign ( $ url , $ auth_token , $ secret_key , $ isoTime , $ bodyToHash = [ ] ) { $ hash = hash ( "sha256" , "" ) ; if ( is_array ( $ bodyToHash ) ) { ksort ( $ bodyToHash ) ; $ encoderData = json_encode ( $ bodyToHash , JSON_UNESCAPED_SLASHES ) ; $ hash = hash ( "sha256" , $ encoderData ) ...
Generate Signature .
57,127
public static function generateIsoTime ( ) { $ date = \ Carbon \ Carbon :: now ( self :: getTimeZone ( ) ) ; date_default_timezone_set ( self :: getTimeZone ( ) ) ; $ fmt = $ date -> format ( 'Y-m-d\TH:i:s' ) ; $ ISO8601 = sprintf ( "$fmt.%s%s" , substr ( microtime ( ) , 2 , 3 ) , date ( 'P' ) ) ; return $ ISO8601 ; }
Generate ISO8601 Time .
57,128
private function validateArray ( $ sourceAccountId = [ ] ) { if ( ! is_array ( $ sourceAccountId ) ) { throw new BcaHttpException ( 'Data harus array.' ) ; } if ( empty ( $ sourceAccountId ) ) { throw new BcaHttpException ( 'AccountNumber tidak boleh kosong.' ) ; } else { $ max = sizeof ( $ sourceAccountId ) ; if ( $ m...
Validasi jika clientsecret telah di - definsikan .
57,129
public static function arrayImplode ( $ glue , $ separator , $ array = [ ] ) { if ( ! is_array ( $ array ) ) { throw new BcaHttpException ( 'Data harus array.' ) ; } if ( empty ( $ array ) ) { throw new BcaHttpException ( 'parameter array tidak boleh kosong.' ) ; } foreach ( $ array as $ key => $ val ) { if ( is_array ...
Implode an array with the key and value pair giving a glue a separator between pairs and the array to implode .
57,130
protected function initFullDriver ( ) { try { $ driver = $ this -> initDriver ( ) ; $ this -> initRootIdentifier ( $ driver ) ; $ this -> initTags ( $ driver ) ; $ this -> initBranches ( $ driver ) ; $ driver -> cleanup ( ) ; } catch ( \ Exception $ e ) { } }
Init the driver with branches and tags .
57,131
protected function initTags ( VcsDriverInterface $ driver ) { foreach ( $ driver -> getTags ( ) as $ tag => $ identifier ) { $ packageName = $ this -> createPackageName ( ) ; $ tag = str_replace ( array ( 'release-' , 'version/' ) , '' , $ tag ) ; $ this -> initTag ( $ driver , $ packageName , $ tag , $ identifier ) ; ...
Initializes all tags .
57,132
protected function initBranches ( VcsDriverInterface $ driver ) { foreach ( $ driver -> getBranches ( ) as $ branch => $ identifier ) { if ( \ is_array ( $ this -> rootData ) && $ branch === $ driver -> getRootIdentifier ( ) ) { $ this -> preInitBranchPackage ( $ driver , $ this -> rootData , $ branch , $ identifier ) ...
Initializes all branches .
57,133
protected function preInitBranchPackage ( VcsDriverInterface $ driver , array $ data , $ branch , $ identifier ) { $ packageName = $ this -> createPackageName ( ) ; $ data = array_merge ( $ this -> createMockOfPackageConfig ( $ packageName , $ branch ) , $ data ) ; $ data = $ this -> preProcessAsset ( $ data ) ; $ data...
Pre inits the branch of complete package .
57,134
protected function preInitBranchLazyPackage ( VcsDriverInterface $ driver , $ branch , $ identifier ) { $ packageName = $ this -> createPackageName ( ) ; $ data = $ this -> createMockOfPackageConfig ( $ packageName , $ branch ) ; $ data = $ this -> configureBranchPackage ( $ branch , $ data ) ; $ this -> initBranchLazy...
Pre inits the branch of lazy package .
57,135
protected function configureBranchPackage ( $ branch , array $ data ) { $ parsedBranch = $ this -> versionParser -> normalizeBranch ( $ branch ) ; $ data [ 'version_normalized' ] = $ parsedBranch ; if ( 'dev-' === substr ( ( string ) $ parsedBranch , 0 , 4 ) || '9999999-dev' === $ parsedBranch ) { $ data [ 'version' ] ...
Configures the package of branch .
57,136
protected function initBranchLazyPackage ( VcsDriverInterface $ driver , array $ data , $ branch , $ identifier ) { $ packageClass = 'Fxp\Composer\AssetPlugin\Package\LazyCompletePackage' ; $ packageData = $ this -> preProcessAsset ( $ data ) ; $ package = $ this -> loader -> load ( $ packageData , $ packageClass ) ; $...
Inits the branch of lazy package .
57,137
protected function includeBranchAlias ( VcsDriverInterface $ driver , PackageInterface $ package , $ branch ) { if ( null !== $ this -> rootPackageVersion && $ branch === $ driver -> getRootIdentifier ( ) ) { $ aliasNormalized = $ this -> normalizeBranchAlias ( $ package ) ; $ package = $ package instanceof AliasPackag...
Include the package in the alias package if the branch is a root branch identifier and having a package version .
57,138
protected function normalizeBranchAlias ( PackageInterface $ package ) { $ stability = VersionParser :: parseStability ( $ this -> versionParser -> normalize ( $ this -> rootPackageVersion ) ) ; $ aliasNormalized = 'dev-' . $ this -> rootPackageVersion ; if ( BasePackage :: STABILITY_STABLE === BasePackage :: $ stabili...
Normalize the alias of branch .
57,139
protected function initRegistryVersions ( ) { if ( isset ( $ this -> repoConfig [ 'registry-versions' ] ) ) { foreach ( $ this -> repoConfig [ 'registry-versions' ] as $ package ) { $ this -> addPackage ( $ package ) ; } } }
Init the package versions added directly in the Asset Registry .
57,140
public static function validateBranch ( $ branch , VersionParser $ parser = null ) { if ( null === $ parser ) { $ parser = new VersionParser ( ) ; } $ normalize = $ parser -> normalizeBranch ( $ branch ) ; if ( false !== strpos ( $ normalize , '.9999999-dev' ) ) { return false ; } return $ normalize ; }
Validates the branch .
57,141
public static function validateTag ( $ tag , AssetTypeInterface $ assetType , VersionParser $ parser = null ) { if ( \ in_array ( $ tag , array ( 'master' , 'trunk' , 'default' ) , true ) ) { return false ; } if ( null === $ parser ) { $ parser = new VersionParser ( ) ; } try { $ tag = $ assetType -> getVersionConverte...
Validates the tag .
57,142
protected function getVcsRepositoryUrl ( array $ data , $ registryName = null ) { if ( ! isset ( $ data [ 'repository' ] [ 'url' ] ) ) { $ msg = sprintf ( 'The "repository.url" parameter of "%s" %s asset package must be present for create a VCS Repository' , $ registryName , $ this -> assetType -> getName ( ) ) ; $ msg...
Get the URL of VCS repository .
57,143
public static function addInstallers ( Config $ config , Composer $ composer , IOInterface $ io ) { $ im = $ composer -> getInstallationManager ( ) ; $ im -> addInstaller ( new BowerInstaller ( $ config , $ io , $ composer , Assets :: createType ( 'bower' ) ) ) ; $ im -> addInstaller ( new AssetInstaller ( $ config , $...
Adds asset installers .
57,144
public static function createAssetOptions ( array $ config , $ assetType ) { $ options = array ( ) ; foreach ( $ config as $ key => $ value ) { if ( 0 === strpos ( $ key , $ assetType . '-' ) ) { $ key = substr ( $ key , \ strlen ( $ assetType ) + 1 ) ; $ options [ $ key ] = $ value ; } } return $ options ; }
Creates the asset options .
57,145
public static function createRepositoryConfig ( AssetRepositoryManager $ arm , VcsPackageFilter $ filter , Config $ config , $ assetType ) { return array ( 'asset-repository-manager' => $ arm , 'vcs-package-filter' => $ filter , 'asset-options' => static :: createAssetOptions ( $ config -> getArray ( 'registry-options'...
Create the repository config .
57,146
public static function addRegistryRepositories ( AssetRepositoryManager $ arm , VcsPackageFilter $ filter , Config $ config ) { foreach ( Assets :: getRegistryFactories ( ) as $ registryType => $ factoryClass ) { $ ref = new \ ReflectionClass ( $ factoryClass ) ; if ( $ ref -> implementsInterface ( 'Fxp\Composer\AssetP...
Adds asset registry repositories .
57,147
public static function setVcsTypeRepositories ( RepositoryManager $ rm ) { foreach ( Assets :: getTypes ( ) as $ assetType ) { foreach ( Assets :: getVcsRepositoryDrivers ( ) as $ driverType => $ repositoryClass ) { $ rm -> setRepositoryClass ( $ assetType . '-' . $ driverType , $ repositoryClass ) ; } } }
Sets vcs type repositories .
57,148
public static function addMainFiles ( Config $ config , PackageInterface $ package , $ section = 'main-files' ) { if ( $ package instanceof Package ) { $ packageExtra = $ package -> getExtra ( ) ; $ rootMainFiles = $ config -> getArray ( $ section ) ; foreach ( $ rootMainFiles as $ packageName => $ files ) { if ( $ pac...
Adds the main file definitions from the root package .
57,149
public static function checkUrlVersion ( AssetTypeInterface $ assetType , $ dependency , $ version , array & $ vcsRepos , array $ composer ) { if ( preg_match ( '/(\:\/\/)|\@/' , $ version ) ) { list ( $ url , $ version ) = static :: splitUrlVersion ( $ version ) ; if ( ! static :: isUrlArchive ( $ url ) && static :: h...
Checks if the version is a URL version .
57,150
public static function isUrlArchive ( $ url ) { if ( 0 === strpos ( $ url , 'http' ) ) { foreach ( self :: $ extensions as $ extension ) { if ( substr ( $ url , - \ strlen ( $ extension ) ) === $ extension ) { return true ; } } } return false ; }
Check if the url is a url of a archive file .
57,151
public static function checkAliasVersion ( AssetTypeInterface $ assetType , $ dependency , $ version ) { $ pos = strpos ( $ version , '#' ) ; if ( $ pos > 0 && ! preg_match ( '{[0-9a-f]{40}$}' , $ version ) ) { $ dependency = substr ( $ version , 0 , $ pos ) ; $ version = substr ( $ version , $ pos ) ; $ searchVerion =...
Checks if the version is a alias version .
57,152
public static function convertDependencyVersion ( AssetTypeInterface $ assetType , $ dependency , $ version ) { $ containsHash = false !== strpos ( $ version , '#' ) ; $ version = str_replace ( '#' , '' , $ version ) ; $ version = empty ( $ version ) ? '*' : trim ( $ version ) ; $ searchVersion = str_replace ( array ( ...
Convert the dependency version .
57,153
protected static function splitUrlVersion ( $ version ) { $ pos = strpos ( $ version , '#' ) ; if ( false !== $ pos ) { $ url = substr ( $ version , 0 , $ pos ) ; $ version = substr ( $ version , $ pos ) ; } else { $ url = $ version ; $ version = '#' ; } return array ( $ url , $ version ) ; }
Split the URL and version .
57,154
protected static function getUrlFileDependencyName ( AssetTypeInterface $ assetType , array $ composer , $ dependency ) { $ prefix = isset ( $ composer [ 'name' ] ) ? substr ( $ composer [ 'name' ] , \ strlen ( $ assetType -> getComposerVendorName ( ) ) + 1 ) . '-' : '' ; return $ prefix . $ dependency . '-file' ; }
Get the name of url file dependency .
57,155
protected static function getUrlFileDependencyVersion ( AssetTypeInterface $ assetType , $ url , $ version ) { if ( '#' !== $ version ) { return substr ( $ version , 1 ) ; } if ( preg_match ( '/(\d+)(\.\d+)(\.\d+)?(\.\d+)?/' , $ url , $ match ) ) { return $ assetType -> getVersionConverter ( ) -> convertVersion ( $ mat...
Get the version of url file dependency .
57,156
protected static function hasUrlDependencySupported ( $ url ) { $ io = new NullIO ( ) ; $ config = new Config ( ) ; foreach ( Assets :: getVcsDrivers ( ) as $ driver ) { $ supported = $ driver :: supports ( $ io , $ config , $ url ) ; if ( $ supported ) { return true ; } } return false ; }
Check if url is supported by vcs drivers .
57,157
protected static function convertBrachVersion ( AssetTypeInterface $ assetType , $ version ) { $ oldVersion = $ version ; $ version = 'dev-' . $ assetType -> getVersionConverter ( ) -> convertVersion ( $ version ) ; if ( ! Validator :: validateBranch ( $ oldVersion ) ) { $ version .= ' || ' . $ oldVersion ; } return $ ...
Convert the dependency branch version .
57,158
private function initializeLocalPath ( ) { $ this -> url = preg_replace ( '{[\\/]\.git/?$}' , '' , $ this -> url ) ; $ this -> repoDir = $ this -> url ; return realpath ( $ this -> url ) ; }
Initialize the local path .
57,159
private function initializeRemotePath ( $ skipSync ) { $ this -> repoDir = $ this -> config -> get ( 'cache-vcs-dir' ) . '/' . preg_replace ( '{[^a-z0-9.]}i' , '-' , $ this -> url ) . '/' ; GitUtil :: cleanEnv ( ) ; $ fs = new Filesystem ( ) ; $ fs -> ensureDirectoryExists ( \ dirname ( $ this -> repoDir ) ) ; if ( ! i...
Initialize the remote path .
57,160
public static function deleteIgnoredFiles ( PackageEvent $ event ) { if ( null === $ package = static :: getLibraryPackage ( $ event -> getOperation ( ) ) ) { return ; } $ section = static :: getIgnoreConfigSection ( ) ; $ manager = IgnoreFactory :: create ( static :: getConfig ( $ event ) , $ event -> getComposer ( ) ...
Remove ignored files of the installed package defined in the root package config section .
57,161
public static function getConfig ( PackageEvent $ event ) { foreach ( $ event -> getComposer ( ) -> getPluginManager ( ) -> getPlugins ( ) as $ plugin ) { if ( $ plugin instanceof FxpAssetPlugin ) { return $ plugin -> getConfig ( ) ; } } throw new \ RuntimeException ( 'The fxp composer asset plugin is not found' ) ; }
Get the plugin config .
57,162
protected static function getOperationPackage ( OperationInterface $ operation ) { $ data = null ; if ( $ operation instanceof UpdateOperation ) { $ data = $ operation -> getTargetPackage ( ) ; } elseif ( $ operation instanceof InstallOperation ) { $ data = $ operation -> getPackage ( ) ; } return $ data ; }
Get the package defined in the composer operation .
57,163
protected static function isAsset ( PackageInterface $ package ) { foreach ( Assets :: getTypes ( ) as $ type ) { $ type = Assets :: createType ( $ type ) ; if ( $ package -> getType ( ) === $ type -> getComposerType ( ) ) { return true ; } } return false ; }
Check if the package is a asset package .
57,164
public static function getVersionConstraint ( $ normalizedVersion , VersionParser $ versionParser ) { if ( preg_match ( '/^\d+(\.\d+)(\.\d+)(\.\d+)\-[A-Za-z0-9]+$/' , $ normalizedVersion ) ) { $ normalizedVersion = substr ( $ normalizedVersion , 0 , strpos ( $ normalizedVersion , '-' ) ) ; } return $ versionParser -> p...
Get the link constraint of normalized version .
57,165
public static function findFlagStabilityName ( $ level ) { $ stability = 'dev' ; foreach ( Package :: $ stabilities as $ stabilityName => $ stabilityLevel ) { if ( $ stabilityLevel === $ level ) { $ stability = $ stabilityName ; break ; } } return $ stability ; }
Find the stability name with the stability value .
57,166
public static function findInlineStabilities ( array $ stabilities , VersionParser $ versionParser ) { $ lowestStability = 'stable' ; foreach ( $ stabilities as $ stability ) { $ stability = $ versionParser -> normalizeStability ( $ stability ) ; $ stability = $ versionParser -> parseStability ( $ stability ) ; if ( Pa...
Find the lowest stability .
57,167
private function convertEnvValue ( $ value , $ environmentVariable ) { $ value = trim ( trim ( trim ( $ value , '\'' ) , '"' ) ) ; if ( $ this -> isBoolean ( $ value ) ) { $ value = $ this -> convertBoolean ( $ value ) ; } elseif ( $ this -> isInteger ( $ value ) ) { $ value = $ this -> convertInteger ( $ value ) ; } e...
Convert the value of environment variable into php variable .
57,168
protected function getComposerContent ( $ identifier ) { $ composer = $ this -> perforce -> getComposerInformation ( $ identifier ) ; if ( empty ( $ composer ) || ! \ is_array ( $ composer ) ) { $ composer = array ( '_nonexistent_package' => true ) ; } return $ composer ; }
Get composer content .
57,169
public static function validate ( IOInterface $ io , RootPackageInterface $ package , $ commandName = null ) { if ( null === $ commandName || \ in_array ( $ commandName , array ( 'install' , 'update' , 'validate' , 'require' , 'remove' ) , true ) ) { $ extra = ( array ) $ package -> getExtra ( ) ; foreach ( self :: $ d...
Validate the config of root package .
57,170
private static function injectDeprecatedConfig ( array $ config , array $ extra ) { foreach ( self :: $ deprecatedOptions as $ key => $ deprecatedKey ) { if ( \ array_key_exists ( $ deprecatedKey , $ extra ) && ! \ array_key_exists ( $ key , $ config ) ) { $ config [ $ key ] = $ extra [ $ deprecatedKey ] ; } } return $...
Inject the deprecated keys in config if the config keys are not present .
57,171
private static function getGlobalConfig ( Composer $ composer , $ filename , $ io = null ) { $ home = self :: getComposerHome ( $ composer ) ; $ file = new JsonFile ( $ home . '/' . $ filename . '.json' ) ; $ config = array ( ) ; if ( $ file -> exists ( ) ) { $ data = $ file -> read ( ) ; if ( isset ( $ data [ 'config'...
Get the data of the global config .
57,172
private static function getComposerHome ( Composer $ composer ) { return null !== $ composer -> getConfig ( ) && $ composer -> getConfig ( ) -> has ( 'home' ) ? $ composer -> getConfig ( ) -> get ( 'home' ) : '' ; }
Get the home directory of composer .
57,173
protected function checkGithubRepositoryVersion ( $ dependency , $ version ) { if ( preg_match ( '/^[A-Za-z0-9\-_]+\/[A-Za-z0-9\-_.]+/' , $ version ) ) { $ pos = strpos ( $ version , '#' ) ; $ pos = false === $ pos ? \ strlen ( $ version ) : $ pos ; $ realVersion = substr ( $ version , $ pos ) ; $ version = 'git://gith...
Checks if the version is a Github alias version of repository .
57,174
public function onPluginCommand ( CommandEvent $ event ) { if ( $ this -> config -> get ( 'enabled' , true ) ) { ConfigBuilder :: validate ( $ this -> io , $ this -> composer -> getPackage ( ) , $ event -> getCommandName ( ) ) ; if ( ! \ in_array ( $ event -> getCommandName ( ) , array ( 'install' , 'update' ) , true )...
Disable the package filter for all command but for install and update command .
57,175
public function onPreDependenciesSolving ( InstallerEvent $ event ) { if ( $ this -> config -> get ( 'enabled' , true ) ) { $ this -> assetRepositoryManager -> setPool ( $ event -> getPool ( ) ) ; } }
Add pool in asset repository manager .
57,176
public static function addRepository ( IOInterface $ io , RepositoryManager $ rm , array & $ repos , $ name , array $ repoConfig , Pool $ pool = null ) { $ repoConfig [ 'name' ] = $ name ; $ repo = $ rm -> createRepository ( $ repoConfig [ 'type' ] , $ repoConfig ) ; return static :: addRepositoryInstance ( $ io , $ rm...
Add repository config . The instance of repository is returned if the repository in t added in the pool .
57,177
public static function addRepositoryInstance ( IOInterface $ io , RepositoryManager $ rm , array & $ repos , $ name , RepositoryInterface $ repo , Pool $ pool = null ) { $ notAddedRepo = null ; if ( ! isset ( $ repos [ $ name ] ) ) { static :: writeAddRepository ( $ io , $ name ) ; $ notAddedRepo = $ repo ; $ repos [ $...
Add repository instance . The instance of repository is returned if the repository in t added in the pool .
57,178
public static function cleanPackageName ( $ name ) { if ( preg_match ( '/^[a-z]+\-asset\//' , $ name , $ matches ) ) { $ name = substr ( $ name , \ strlen ( $ matches [ 0 ] ) ) ; } return $ name ; }
Cleans the package name removing the Composer prefix if present .
57,179
protected function parseComposerContent ( $ resource ) { $ composer = ( array ) JsonFile :: parseJson ( $ this -> getContents ( $ resource ) ) ; if ( empty ( $ composer [ 'content' ] ) || 'base64' !== $ composer [ 'encoding' ] || ! ( $ composer = base64_decode ( $ composer [ 'content' ] , true ) ) ) { throw new \ Runti...
Parse the composer content .
57,180
protected function convertComposerContent ( $ composer , $ resource , $ identifier ) { $ composer = JsonFile :: parseJson ( $ composer , $ resource ) ; $ resource = $ this -> getApiUrl ( ) . '/repos/' . $ this -> owner . '/' . $ this -> repository . '/commits/' . urlencode ( $ identifier ) ; $ composer = Util :: addCom...
Converts json composer file to array .
57,181
protected function setupGitDriver ( $ url ) { $ this -> gitDriver = new GitDriver ( array ( 'url' => $ url , 'asset-type' => $ this -> repoConfig [ 'asset-type' ] , 'filename' => $ this -> repoConfig [ 'filename' ] , 'asset-repository-manager' => $ this -> repoConfig [ 'asset-repository-manager' ] , ) , $ this -> io , ...
Setup git driver .
57,182
public function skip ( AssetTypeInterface $ assetType , $ name , $ version ) { try { $ cVersion = $ assetType -> getVersionConverter ( ) -> convertVersion ( $ version ) ; $ normalizedVersion = $ this -> versionParser -> normalize ( $ cVersion ) ; } catch ( \ Exception $ ex ) { return true ; } if ( false !== $ this -> s...
Check if the version must be skipped .
57,183
protected function doSkip ( $ name , $ normalizedVersion ) { if ( ! isset ( $ this -> requires [ $ name ] ) || false !== strpos ( $ normalizedVersion , '-p' ) ) { return false ; } $ require = $ this -> requires [ $ name ] ; return ! $ this -> satisfy ( $ require , $ normalizedVersion ) && $ this -> isEnabled ( ) ; }
Do check if the version must be skipped .
57,184
protected function skipByPattern ( ) { $ skip = $ this -> config -> get ( 'pattern-skip-version' , false ) ; return \ is_string ( $ skip ) ? trim ( $ skip , '/' ) : false ; }
Check if the filter must be skipped the version by pattern or not .
57,185
protected function satisfyVersion ( Link $ require , $ normalizedVersion ) { $ constraintSame = $ this -> versionParser -> parseConstraints ( $ normalizedVersion ) ; $ sameVersion = ( bool ) $ require -> getConstraint ( ) -> matches ( $ constraintSame ) ; $ consNormalizedVersion = FilterUtil :: getVersionConstraint ( $...
Check if the require dependency has a satisfactory version .
57,186
protected function satisfyStability ( Link $ require , $ normalizedVersion ) { $ requireStability = $ this -> getRequireStability ( $ require ) ; $ stability = $ this -> versionParser -> parseStability ( $ normalizedVersion ) ; return Package :: $ stabilities [ $ stability ] <= Package :: $ stabilities [ $ requireStabi...
Check if the require dependency has a satisfactory stability .
57,187
private function initInstalledPackages ( ) { foreach ( $ this -> installedRepository -> getPackages ( ) as $ package ) { $ operator = $ this -> getFilterOperator ( $ package ) ; $ link = current ( $ this -> arrayLoader -> parseLinks ( $ this -> package -> getName ( ) , $ this -> package -> getVersion ( ) , 'installed' ...
Initialize the installed package .
57,188
private function includeRootConstraint ( PackageInterface $ package , Link $ link ) { if ( isset ( $ this -> requires [ $ package -> getName ( ) ] ) ) { $ rLink = $ this -> requires [ $ package -> getName ( ) ] ; $ useConjunctive = FilterUtil :: checkConfigOption ( $ this -> config , 'optimize-with-conjunctive' ) ; $ c...
Include the constraint of root dependency version in the constraint of installed package .
57,189
public function getComposerPackageName ( ) { if ( null === $ this -> packages ) { $ this -> initialize ( ) ; } return $ this -> assetType -> formatComposerName ( $ this -> packageName ) ; }
Gets the package name of this repository .
57,190
protected function initLoader ( ) { $ this -> versionParser = new VersionParser ( ) ; if ( ! $ this -> loader ) { $ this -> loader = new ArrayLoader ( $ this -> versionParser ) ; } }
Initializes the version parser and loader .
57,191
protected function initRootIdentifier ( VcsDriverInterface $ driver ) { try { if ( $ driver -> hasComposerFile ( $ driver -> getRootIdentifier ( ) ) ) { $ data = $ driver -> getComposerInformation ( $ driver -> getRootIdentifier ( ) ) ; $ sc = new SemverConverter ( ) ; $ this -> rootPackageVersion = ! empty ( $ data [ ...
Initializes the root identifier .
57,192
protected function createPackageName ( ) { if ( null === $ this -> packageName ) { return $ this -> url ; } return sprintf ( '%s/%s' , $ this -> assetType -> getComposerVendorName ( ) , $ this -> packageName ) ; }
Creates the package name with the composer prefix and the asset package name or only with the URL .
57,193
protected function createLazyLoader ( $ type , $ identifier , array $ packageData , VcsDriverInterface $ driver ) { $ lazyLoader = new LazyAssetPackageLoader ( $ type , $ identifier , $ packageData ) ; $ lazyLoader -> setAssetType ( $ this -> assetType ) ; $ lazyLoader -> setLoader ( $ this -> loader ) ; $ lazyLoader -...
Creates the lazy loader of package .
57,194
protected function overrideBranchAliasConfig ( PackageInterface $ package , $ aliasNormalized , $ branch ) { if ( $ package instanceof Package && false === strpos ( 'dev-' , $ aliasNormalized ) ) { $ extra = $ package -> getExtra ( ) ; $ extra [ 'branch-alias' ] = array ( 'dev-' . $ branch => $ this -> rootPackageVersi...
Override the branch alias extra config of the current package .
57,195
protected function addPackageAliases ( PackageInterface $ package , $ aliasNormalized ) { $ alias = new AliasPackage ( $ package , $ aliasNormalized , $ this -> rootPackageVersion ) ; $ this -> addPackage ( $ alias ) ; if ( false === strpos ( 'dev-' , $ aliasNormalized ) ) { $ alias = new AliasPackage ( $ package , $ a...
Add the alias packages .
57,196
private function injectExtraConfig ( PackageInterface $ package , array $ extra ) { $ ref = new \ ReflectionClass ( $ package ) ; $ met = $ ref -> getProperty ( 'extra' ) ; $ met -> setAccessible ( true ) ; $ met -> setValue ( $ package , $ extra ) ; }
Inject the overriding extra config in the current package .
57,197
protected static function getUrlResource ( $ scheme , array $ repoConfig , $ identifier , $ owner , $ repository , VcsDriverInterface $ driver ) { if ( false === strpos ( \ get_class ( $ driver ) , 'Git' ) ) { return $ scheme . '://bitbucket.org/' . $ owner . '/' . $ repository . '/raw/' . $ identifier . '/' . $ repoCo...
Get the url of resource .
57,198
protected static function getComposerContentOfFile ( $ resource , VcsDriverInterface $ driver , $ method ) { try { $ ref = new \ ReflectionClass ( $ driver ) ; $ meth = $ ref -> getMethod ( $ method ) ; $ meth -> setAccessible ( true ) ; $ composer = $ meth -> invoke ( $ driver , $ resource ) ; if ( 'getContents' !== $...
Get the parsed content of composer .
57,199
protected static function formatComposerContent ( array $ composer , $ identifier , $ scheme , $ owner , $ repository , $ driver , $ method ) { $ resource = $ scheme . '://api.bitbucket.org/1.0/repositories/' . $ owner . '/' . $ repository . '/changesets/' . $ identifier ; return Util :: addComposerTime ( $ composer , ...
Format composer content .