repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
nicklaw5/twitch-api-php
src/Api/Collections.php
Collections.createCollectionThumbnail
public function createCollectionThumbnail($collectionId, $itemId, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } if (!is_string($itemId)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemId)); } $params = [ 'item_id' => $itemId, ]; return $this->put(sprintf('collections/%s/thumbnail', $collectionId), $params, $accessToken); }
php
public function createCollectionThumbnail($collectionId, $itemId, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } if (!is_string($itemId)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemId)); } $params = [ 'item_id' => $itemId, ]; return $this->put(sprintf('collections/%s/thumbnail', $collectionId), $params, $accessToken); }
[ "public", "function", "createCollectionThumbnail", "(", "$", "collectionId", ",", "$", "itemId", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "EndpointNotSupportedByApiVers...
Create a collection thumbnail @param string $collectionId @param string $itemId @param string $accessToken @throws EndpointNotSupportedByApiVersionException @return null
[ "Create", "a", "collection", "thumbnail" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Collections.php#L167-L182
nicklaw5/twitch-api-php
src/Api/Collections.php
Collections.deleteCollection
public function deleteCollection($collectionId, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } return $this->delete(sprintf('collections/%s', $collectionId), [], $accessToken); }
php
public function deleteCollection($collectionId, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } return $this->delete(sprintf('collections/%s', $collectionId), [], $accessToken); }
[ "public", "function", "deleteCollection", "(", "$", "collectionId", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "EndpointNotSupportedByApiVersionException", "(", ")", ";",...
Delete a collection @param string $collectionId @param string $accessToken @throws EndpointNotSupportedByApiVersionException @throws InvalidTypeException @return null
[ "Delete", "a", "collection" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Collections.php#L193-L200
nicklaw5/twitch-api-php
src/Api/Collections.php
Collections.addCollectionItem
public function addCollectionItem($collectionId, $itemId, $itemType = 'video', $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } if (!is_string($itemId)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemId)); } if (!is_string($itemType)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemType)); } $params = [ 'item_id' => $itemId, 'type' => $itemType, ]; return $this->post(sprintf('collections/%s/items', $collectionId), $params, $accessToken); }
php
public function addCollectionItem($collectionId, $itemId, $itemType = 'video', $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } if (!is_string($itemId)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemId)); } if (!is_string($itemType)) { throw new InvalidTypeException('Item ID', 'string', gettype($itemType)); } $params = [ 'item_id' => $itemId, 'type' => $itemType, ]; return $this->post(sprintf('collections/%s/items', $collectionId), $params, $accessToken); }
[ "public", "function", "addCollectionItem", "(", "$", "collectionId", ",", "$", "itemId", ",", "$", "itemType", "=", "'video'", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", ...
Add an item to a collection @param string $collectionId @param string $itemId @param string $itemType @param string $accessToken @throws EndpointNotSupportedByApiVersionException @throws InvalidTypeException @return array|json
[ "Add", "an", "item", "to", "a", "collection" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Collections.php#L213-L233
nicklaw5/twitch-api-php
src/Api/Collections.php
Collections.deleteCollectionItem
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 $this->delete(sprintf('collections/%s/items/%s', $collectionId, $itemId), [], $accessToken); }
php
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 $this->delete(sprintf('collections/%s/items/%s', $collectionId, $itemId), [], $accessToken); }
[ "public", "function", "deleteCollectionItem", "(", "$", "collectionId", ",", "$", "itemId", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "EndpointNotSupportedByApiVersionEx...
Delete an item from a collection @param string $collectionId @param string $itemId @param string $accessToken @throws EndpointNotSupportedByApiVersionException @throws InvalidTypeException @return null
[ "Delete", "an", "item", "from", "a", "collection" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Collections.php#L245-L256
nicklaw5/twitch-api-php
src/Api/Collections.php
Collections.moveCollectionThumbnail
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)); } if ($position < 1) { throw new TwitchApiException('Collection position cannot be less than 1.'); } $params = [ 'position' => $position, ]; return $this->put(sprintf('collections/%s/itmes/%s', $collectionId, $itemId), $params, $accessToken); }
php
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)); } if ($position < 1) { throw new TwitchApiException('Collection position cannot be less than 1.'); } $params = [ 'position' => $position, ]; return $this->put(sprintf('collections/%s/itmes/%s', $collectionId, $itemId), $params, $accessToken); }
[ "public", "function", "moveCollectionThumbnail", "(", "$", "collectionId", ",", "$", "itemId", ",", "$", "position", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "End...
Move a collection item @param string $collectionId @param string $itemId @param int $position @param string $accessToken @throws EndpointNotSupportedByApiVersionException @throws InvalidTypeException @throws TwitchApiException @return null
[ "Move", "a", "collection", "item" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Collections.php#L270-L289
nicklaw5/twitch-api-php
src/NewTwitchApi/Resources/AbstractResource.php
AbstractResource.generateQueryParams
protected function generateQueryParams(array $queryParamsMap): string { $queryStringParams = ''; foreach ($queryParamsMap as $paramMap) { if ($paramMap['value']) { $format = is_int($paramMap['value']) ? '%d' : '%s'; $queryStringParams .= sprintf('&%s='.$format, $paramMap['key'], $paramMap['value']); } } return $queryStringParams ? '?'.substr($queryStringParams, 1) : ''; }
php
protected function generateQueryParams(array $queryParamsMap): string { $queryStringParams = ''; foreach ($queryParamsMap as $paramMap) { if ($paramMap['value']) { $format = is_int($paramMap['value']) ? '%d' : '%s'; $queryStringParams .= sprintf('&%s='.$format, $paramMap['key'], $paramMap['value']); } } return $queryStringParams ? '?'.substr($queryStringParams, 1) : ''; }
[ "protected", "function", "generateQueryParams", "(", "array", "$", "queryParamsMap", ")", ":", "string", "{", "$", "queryStringParams", "=", "''", ";", "foreach", "(", "$", "queryParamsMap", "as", "$", "paramMap", ")", "{", "if", "(", "$", "paramMap", "[", ...
$queryParamsMap should be a mapping of the param key expected in the API call URL, and the value to be sent for that key. [['key' => 'param_key', 'value' => 42],['key' => 'other_key', 'value' => 'asdf']] would result in ?param_key=42&other_key=asdf
[ "$queryParamsMap", "should", "be", "a", "mapping", "of", "the", "param", "key", "expected", "in", "the", "API", "call", "URL", "and", "the", "value", "to", "be", "sent", "for", "that", "key", "." ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/NewTwitchApi/Resources/AbstractResource.php#L43-L54
nicklaw5/twitch-api-php
src/Api/Users.php
Users.getUser
public function getUser($userIdentifier) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } return $this->get(sprintf('users/%s', $userIdentifier)); }
php
public function getUser($userIdentifier) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } return $this->get(sprintf('users/%s', $userIdentifier)); }
[ "public", "function", "getUser", "(", "$", "userIdentifier", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", "&&", "!", "is_numeric", "(", "$", "userIdentifier", ")", ")", "{", "throw", "new", "InvalidIdentifierException", "(", ...
Get a user @param string|int $userIdentifier @throws InvalidIdentifierException @return array|json
[ "Get", "a", "user" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L32-L39
nicklaw5/twitch-api-php
src/Api/Users.php
Users.getUserByUsername
public function getUserByUsername($username) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } $params = [ 'login' => $username, ]; return $this->get('users', $params); }
php
public function getUserByUsername($username) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } $params = [ 'login' => $username, ]; return $this->get('users', $params); }
[ "public", "function", "getUserByUsername", "(", "$", "username", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "EndpointNotSupportedByApiVersionException", "(", ")", ";", "}", "$", "params", "=", ...
Get a user from their username @param string $username @throws EndpointNotSupportedByApiVersionException @return array|json
[ "Get", "a", "user", "from", "their", "username" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L48-L59
nicklaw5/twitch-api-php
src/Api/Users.php
Users.getUserEmotes
public function getUserEmotes($userIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } return $this->get(sprintf('users/%s/emotes', $userIdentifier), [], $accessToken); }
php
public function getUserEmotes($userIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } return $this->get(sprintf('users/%s/emotes', $userIdentifier), [], $accessToken); }
[ "public", "function", "getUserEmotes", "(", "$", "userIdentifier", ",", "$", "accessToken", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", "&&", "!", "is_numeric", "(", "$", "userIdentifier", ")", ")", "{", "throw", "new", "...
Get a user's emotes @param string|int $userIdentifier @param string $accessToken @throws InvalidIdentifierException @return array|json
[ "Get", "a", "user", "s", "emotes" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L69-L76
nicklaw5/twitch-api-php
src/Api/Users.php
Users.checkUserSubscriptionToChannel
public function checkUserSubscriptionToChannel($userIdentifier, $channelIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->get(sprintf('users/%s/subscriptions/%s', $userIdentifier, $channelIdentifier), [], $accessToken); }
php
public function checkUserSubscriptionToChannel($userIdentifier, $channelIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->get(sprintf('users/%s/subscriptions/%s', $userIdentifier, $channelIdentifier), [], $accessToken); }
[ "public", "function", "checkUserSubscriptionToChannel", "(", "$", "userIdentifier", ",", "$", "channelIdentifier", ",", "$", "accessToken", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if", "(", "!", "is_numeric", "...
Check if a user is subscribed to a channel @param string|int $userIdentifier @param string|int $channelIdentifier @param string $accessToken @throws InvalidIdentifierException @return array|json
[ "Check", "if", "a", "user", "is", "subscribed", "to", "a", "channel" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L87-L100
nicklaw5/twitch-api-php
src/Api/Users.php
Users.getUsersFollowedChannels
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 InvalidIdentifierException('user'); } if (!$this->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } if (!$this->isValidDirection($direction)) { throw new InvalidDirectionException(); } if (!in_array($sortby = strtolower($sortby), $availableSortBys)) { throw new UnsupportedOptionException('sortby', $availableSortBys); } return $this->get(sprintf('users/%s/follows/channels', $userIdentifier), [ 'limit' => intval($limit), 'offset' => intval($offset), 'direction' => $direction, 'sortby' => $sortby, ]); }
php
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 InvalidIdentifierException('user'); } if (!$this->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } if (!$this->isValidDirection($direction)) { throw new InvalidDirectionException(); } if (!in_array($sortby = strtolower($sortby), $availableSortBys)) { throw new UnsupportedOptionException('sortby', $availableSortBys); } return $this->get(sprintf('users/%s/follows/channels', $userIdentifier), [ 'limit' => intval($limit), 'offset' => intval($offset), 'direction' => $direction, 'sortby' => $sortby, ]); }
[ "public", "function", "getUsersFollowedChannels", "(", "$", "userIdentifier", ",", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ",", "$", "direction", "=", "'desc'", ",", "$", "sortby", "=", "'created_at'", ")", "{", "$", "availableSortBys", "=",...
Gets a list of all channels followed by a user @param string|int $userIdentifier @param int $limit @param int $offset @param string $direction @param string $sortby @throws InvalidIdentifierException @throws InvalidLimitException @throws InvalidOffsetException @throws UnsupportedOptionException @return array|json
[ "Gets", "a", "list", "of", "all", "channels", "followed", "by", "a", "user" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L116-L146
nicklaw5/twitch-api-php
src/Api/Users.php
Users.checkUserFollowsChannel
public function checkUserFollowsChannel($userIdentifier, $channelIdentifier) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->get(sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier)); }
php
public function checkUserFollowsChannel($userIdentifier, $channelIdentifier) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->get(sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier)); }
[ "public", "function", "checkUserFollowsChannel", "(", "$", "userIdentifier", ",", "$", "channelIdentifier", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "userIdentifier", ")", ...
Check if a user follows a channel @param string|int $userIdentifier @param string|int $channelIdentifier @throws InvalidIdentifierException @return array|json
[ "Check", "if", "a", "user", "follows", "a", "channel" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L156-L169
nicklaw5/twitch-api-php
src/Api/Users.php
Users.followChannel
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 InvalidIdentifierException('channel'); } } if (!is_bool($notifications)) { throw new InvalidTypeException('Notifications', 'boolean', gettype($notifications)); } return $this->put( sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier), ['notifications' => $notifications], $accessToken ); }
php
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 InvalidIdentifierException('channel'); } } if (!is_bool($notifications)) { throw new InvalidTypeException('Notifications', 'boolean', gettype($notifications)); } return $this->put( sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier), ['notifications' => $notifications], $accessToken ); }
[ "public", "function", "followChannel", "(", "$", "userIdentifier", ",", "$", "channelIdentifier", ",", "$", "accessToken", ",", "$", "notifications", "=", "false", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if",...
Have a user follow a channel @param string|int $userIdentifier @param string|int $channelIdentifier @param string $accessToken @param bool $notifications @throws InvalidIdentifierException @throws InvalidTypeException @return array|json
[ "Have", "a", "user", "follow", "a", "channel" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L182-L203
nicklaw5/twitch-api-php
src/Api/Users.php
Users.unfollowChannel
public function unfollowChannel($userIdentifier, $channelIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->delete(sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier), [], $accessToken); }
php
public function unfollowChannel($userIdentifier, $channelIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!is_numeric($channelIdentifier)) { throw new InvalidIdentifierException('channel'); } } return $this->delete(sprintf('users/%s/follows/channels/%s', $userIdentifier, $channelIdentifier), [], $accessToken); }
[ "public", "function", "unfollowChannel", "(", "$", "userIdentifier", ",", "$", "channelIdentifier", ",", "$", "accessToken", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "u...
Have a user unfollow a channel @param string|int $userIdentifier @param string|int $channelIdentifier @param string $accessToken @throws InvalidIdentifierException @return null|array|json
[ "Have", "a", "user", "unfollow", "a", "channel" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L214-L227
nicklaw5/twitch-api-php
src/Api/Users.php
Users.getUserBlockList
public function getUserBlockList($userIdentifier, $accessToken, $limit = 25, $offset = 0) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!$this->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } $params = [ 'limit' => intval($limit), 'offset' => intval($offset), ]; return $this->get(sprintf('users/%s/blocks', $userIdentifier), $params, $accessToken); }
php
public function getUserBlockList($userIdentifier, $accessToken, $limit = 25, $offset = 0) { if ($this->apiVersionIsGreaterThanV3() && !is_numeric($userIdentifier)) { throw new InvalidIdentifierException('user'); } if (!$this->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } $params = [ 'limit' => intval($limit), 'offset' => intval($offset), ]; return $this->get(sprintf('users/%s/blocks', $userIdentifier), $params, $accessToken); }
[ "public", "function", "getUserBlockList", "(", "$", "userIdentifier", ",", "$", "accessToken", ",", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", "&&", "!", "is_numer...
Get a user’s block list @param string|int $userIdentifier @param string $accessToken @param int $limit @param int $offset @throws InvalidIdentifierException @throws InvalidLimitException @throws InvalidOffsetException @return array|json
[ "Get", "a", "user’s", "block", "list" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L241-L261
nicklaw5/twitch-api-php
src/Api/Users.php
Users.blockUser
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/%s/blocks/%s', $userIdentifier, $userToBlockIdentifier), [], $accessToken); }
php
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/%s/blocks/%s', $userIdentifier, $userToBlockIdentifier), [], $accessToken); }
[ "public", "function", "blockUser", "(", "$", "userIdentifier", ",", "$", "userToBlockIdentifier", ",", "$", "accessToken", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "use...
Block a user @param string|int $userIdentifier @param string|int $userToBlockIdentifier @param string $accessToken @throws InvalidIdentifierException @return array|json
[ "Block", "a", "user" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L272-L281
nicklaw5/twitch-api-php
src/Api/Users.php
Users.unblockUser
public function unblockUser($userIdentifier, $userToUnlockIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier) || !is_numeric($userToUnlockIdentifier)) { throw new InvalidIdentifierException('user'); } } return $this->delete(sprintf('users/%s/blocks/%s', $userIdentifier, $userToUnlockIdentifier), [], $accessToken); }
php
public function unblockUser($userIdentifier, $userToUnlockIdentifier, $accessToken) { if ($this->apiVersionIsGreaterThanV3()) { if (!is_numeric($userIdentifier) || !is_numeric($userToUnlockIdentifier)) { throw new InvalidIdentifierException('user'); } } return $this->delete(sprintf('users/%s/blocks/%s', $userIdentifier, $userToUnlockIdentifier), [], $accessToken); }
[ "public", "function", "unblockUser", "(", "$", "userIdentifier", ",", "$", "userToUnlockIdentifier", ",", "$", "accessToken", ")", "{", "if", "(", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "...
Unblock a user @param string|int $userIdentifier @param string|int $userToBlockIdentifier @param string $accessToken @throws InvalidIdentifierException @return null|array|json
[ "Unblock", "a", "user" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L292-L301
nicklaw5/twitch-api-php
src/Api/Users.php
Users.createUserVHSConnection
public function createUserVHSConnection($identifier, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } $params = [ 'identifier' => $identifier, ]; return $this->put('user/vhs', $params, $accessToken); }
php
public function createUserVHSConnection($identifier, $accessToken) { if (!$this->apiVersionIsGreaterThanV3()) { throw new EndpointNotSupportedByApiVersionException(); } $params = [ 'identifier' => $identifier, ]; return $this->put('user/vhs', $params, $accessToken); }
[ "public", "function", "createUserVHSConnection", "(", "$", "identifier", ",", "$", "accessToken", ")", "{", "if", "(", "!", "$", "this", "->", "apiVersionIsGreaterThanV3", "(", ")", ")", "{", "throw", "new", "EndpointNotSupportedByApiVersionException", "(", ")", ...
Creates a connection between a user and VHS @param string $identifier @param string $accessToken @throws EndpointNotSupportedByApiVersionException @return null|array|json
[ "Creates", "a", "connection", "between", "a", "user", "and", "VHS" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Users.php#L311-L322
nicklaw5/twitch-api-php
src/Api/Search.php
Search.searchChannels
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($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } $params = [ 'query' => $query, 'limit' => intval($limit), 'offset' => intval($offset), ]; return $this->get('search/channels', $params); }
php
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($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } $params = [ 'query' => $query, 'limit' => intval($limit), 'offset' => intval($offset), ]; return $this->get('search/channels', $params); }
[ "public", "function", "searchChannels", "(", "$", "query", ",", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", ")", "{", "throw", "new", "InvalidTypeException", "(", "'Query'", ",...
Search for channels by name or description @param string $query @param int $limit @param int $offset @throws InvalidTypeException @throws TwitchApiException @throws InvalidLimitException @throws InvalidOffsetException @return array|json
[ "Search", "for", "channels", "by", "name", "or", "description" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Search.php#L24-L49
nicklaw5/twitch-api-php
src/Api/Search.php
Search.searchGames
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]); }
php
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]); }
[ "public", "function", "searchGames", "(", "$", "query", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", ")", "{", "throw", "new", "InvalidTypeException", "(", "'Query'", ",", "'string'", ",", "gettype", "(", "$", "query", ")", ")", ";", ...
Search for games by name @param string $query @throws InvalidTypeException @throws TwitchApiException @return array|json
[ "Search", "for", "games", "by", "name" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Search.php#L59-L70
nicklaw5/twitch-api-php
src/Api/Search.php
Search.searchStreams
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->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } if ($hls !== null && !is_bool($hls)) { throw new InvalidTypeException('HLS', 'boolean', gettype($hls)); } $params = [ 'query' => $query, 'limit' => intval($limit), 'offset' => intval($offset), 'hls' => $hls, ]; return $this->get('search/streams', $params); }
php
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->isValidLimit($limit)) { throw new InvalidLimitException(); } if (!$this->isValidOffset($offset)) { throw new InvalidOffsetException(); } if ($hls !== null && !is_bool($hls)) { throw new InvalidTypeException('HLS', 'boolean', gettype($hls)); } $params = [ 'query' => $query, 'limit' => intval($limit), 'offset' => intval($offset), 'hls' => $hls, ]; return $this->get('search/streams', $params); }
[ "public", "function", "searchStreams", "(", "$", "query", ",", "$", "limit", "=", "25", ",", "$", "offset", "=", "0", ",", "$", "hls", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", ")", "{", "throw", "new", "InvalidT...
Search for streams by channel description or game name @param string $query @param int $limit @param int $offset @param boolean $hls @throws InvalidTypeException @throws TwitchApiException @throws InvalidLimitException @throws InvalidOffsetException @return array|json
[ "Search", "for", "streams", "by", "channel", "description", "or", "game", "name" ]
train
https://github.com/nicklaw5/twitch-api-php/blob/171ef0e43662ea186ec5a6b7a452b3bd3822f3a3/src/Api/Search.php#L85-L115
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.httpAuth
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 = "api/oauth/token"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::post($full_url, $headers, $body); return $response; }
php
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 = "api/oauth/token"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::post($full_url, $headers, $body); return $response; }
[ "public", "function", "httpAuth", "(", ")", "{", "$", "client_id", "=", "$", "this", "->", "settings", "[", "'client_id'", "]", ";", "$", "client_secret", "=", "$", "this", "->", "settings", "[", "'client_secret'", "]", ";", "$", "headerToken", "=", "bas...
Generate authentifikasi ke server berupa OAUTH. @return \Unirest\Response
[ "Generate", "authentifikasi", "ke", "server", "berupa", "OAUTH", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L108-L133
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.getBalanceInfo
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(",", $sourceAccountId); $arraySplit = urlencode($arraySplit); $uriSign = "GET:/banking/v3/corporates/$corp_id/accounts/$arraySplit"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "banking/v3/corporates/$corp_id/accounts/$arraySplit"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; $data = array('grant_type' => 'client_credentials'); \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
php
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(",", $sourceAccountId); $arraySplit = urlencode($arraySplit); $uriSign = "GET:/banking/v3/corporates/$corp_id/accounts/$arraySplit"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "banking/v3/corporates/$corp_id/accounts/$arraySplit"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; $data = array('grant_type' => 'client_credentials'); \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
[ "public", "function", "getBalanceInfo", "(", "$", "oauth_token", ",", "$", "sourceAccountId", "=", "[", "]", ")", "{", "$", "corp_id", "=", "$", "this", "->", "settings", "[", "'corp_id'", "]", ";", "$", "apikey", "=", "$", "this", "->", "settings", "[...
Ambil informasi saldo berdasarkan nomor akun BCA. @param string $oauth_token nilai token yang telah didapatkan setelah login @param array $sourceAccountId nomor akun yang akan dicek @return \Unirest\Response
[ "Ambil", "informasi", "saldo", "berdasarkan", "nomor", "akun", "BCA", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L143-L184
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.getAccountStatement
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/statements?EndDate=$endDate&StartDate=$startDate"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "banking/v3/corporates/$corp_id/accounts/$sourceAccount/statements?EndDate=$endDate&StartDate=$startDate"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
php
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/statements?EndDate=$endDate&StartDate=$startDate"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "banking/v3/corporates/$corp_id/accounts/$sourceAccount/statements?EndDate=$endDate&StartDate=$startDate"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
[ "public", "function", "getAccountStatement", "(", "$", "oauth_token", ",", "$", "sourceAccount", ",", "$", "startDate", ",", "$", "endDate", ")", "{", "$", "corp_id", "=", "$", "this", "->", "settings", "[", "'corp_id'", "]", ";", "$", "apikey", "=", "$"...
Ambil Daftar transaksi pertanggal. @param string $oauth_token nilai token yang telah didapatkan setelah login @param array $sourceAccount nomor akun yang akan dicek @param string $startDate tanggal awal @param string $endDate tanggal akhir @param string $corp_id nilai CorporateID yang telah diberikan oleh pihak BCA @return \Unirest\Response
[ "Ambil", "Daftar", "transaksi", "pertanggal", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L197-L233
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.getAtmLocation
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['Longitude'] = $longitude; $params['Count'] = $count; $params['Radius'] = $radius; ksort($params); $auth_query_string = self::arrayImplode('=', '&', $params); $uriSign = "GET:/general/info-bca/atm?$auth_query_string"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "general/info-bca/atm?SearchBy=Distance&Latitude=$latitude&Longitude=$longitude&Count=$count&Radius=$radius"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
php
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['Longitude'] = $longitude; $params['Count'] = $count; $params['Radius'] = $radius; ksort($params); $auth_query_string = self::arrayImplode('=', '&', $params); $uriSign = "GET:/general/info-bca/atm?$auth_query_string"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "general/info-bca/atm?SearchBy=Distance&Latitude=$latitude&Longitude=$longitude&Count=$count&Radius=$radius"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
[ "public", "function", "getAtmLocation", "(", "$", "oauth_token", ",", "$", "latitude", ",", "$", "longitude", ",", "$", "count", "=", "'10'", ",", "$", "radius", "=", "'20'", ")", "{", "$", "apikey", "=", "$", "this", "->", "settings", "[", "'api_key'"...
Ambil informasi ATM berdasarkan lokasi GEO. @param string $oauth_token nilai token yang telah didapatkan setelah login @param string $latitude Langitude GPS @param string $longitude Longitude GPS @param string $count Jumlah ATM BCA yang akan ditampilkan @param string $radius Nilai radius dari lokasi GEO @return \Unirest\Response
[ "Ambil", "informasi", "ATM", "berdasarkan", "lokasi", "GEO", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L246-L295
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.getForexRate
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); ksort($params); $auth_query_string = self::arrayImplode('=', '&', $params); $uriSign = "GET:/general/rate/forex?$auth_query_string"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "general/rate/forex?$auth_query_string"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
php
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); ksort($params); $auth_query_string = self::arrayImplode('=', '&', $params); $uriSign = "GET:/general/rate/forex?$auth_query_string"; $isoTime = self::generateIsoTime(); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, null); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $headers['X-BCA-Signature'] = $authSignature; $request_path = "general/rate/forex?$auth_query_string"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); $data = array('grant_type' => 'client_credentials'); $body = \Unirest\Request\Body::form($data); $response = \Unirest\Request::get($full_url, $headers, $body); return $response; }
[ "public", "function", "getForexRate", "(", "$", "oauth_token", ",", "$", "rateType", "=", "'e-rate'", ",", "$", "currency", "=", "'USD'", ")", "{", "$", "apikey", "=", "$", "this", "->", "settings", "[", "'api_key'", "]", ";", "$", "secret", "=", "$", ...
Ambil KURS mata uang. @param string $oauth_token nilai token yang telah didapatkan setelah login @param string $rateType type rate @param string $currency Mata uang @return \Unirest\Response
[ "Ambil", "KURS", "mata", "uang", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L306-L350
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.fundTransfers
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']; $uriSign = "POST:/banking/corporates/transfers"; $isoTime = self::generateIsoTime(); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $request_path = "banking/corporates/transfers"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; $bodyData = array(); $bodyData['Amount'] = $amount; $bodyData['BeneficiaryAccountNumber'] = strtolower(str_replace(' ', '', $beneficiaryAccountNumber)); $bodyData['CorporateID'] = strtolower(str_replace(' ', '', $corp_id)); $bodyData['CurrencyCode'] = 'idr'; $bodyData['ReferenceID'] = strtolower(str_replace(' ', '', $referenceID)); $bodyData['Remark1'] = strtolower(str_replace(' ', '', $remark1)); $bodyData['Remark2'] = strtolower(str_replace(' ', '', $remark2)); $bodyData['SourceAccountNumber'] = strtolower(str_replace(' ', '', $sourceAccountNumber)); $bodyData['TransactionDate'] = $isoTime; $bodyData['TransactionID'] = strtolower(str_replace(' ', '', $transactionID)); // Harus disort agar mudah kalkulasi HMAC ksort($bodyData); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, $bodyData); $headers['X-BCA-Signature'] = $authSignature; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); // Supaya jgn strip "ReferenceID" "/" jadi "/\" karena HMAC akan menjadi tidak cocok $encoderData = json_encode($bodyData, JSON_UNESCAPED_SLASHES); $body = \Unirest\Request\Body::form($encoderData); $response = \Unirest\Request::post($full_url, $headers, $body); return $response; }
php
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']; $uriSign = "POST:/banking/corporates/transfers"; $isoTime = self::generateIsoTime(); $headers = array(); $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $headers['Authorization'] = "Bearer $oauth_token"; $headers['X-BCA-Key'] = $apikey; $headers['X-BCA-Timestamp'] = $isoTime; $request_path = "banking/corporates/transfers"; $domain = $this->ddnDomain(); $full_url = $domain . $request_path; $bodyData = array(); $bodyData['Amount'] = $amount; $bodyData['BeneficiaryAccountNumber'] = strtolower(str_replace(' ', '', $beneficiaryAccountNumber)); $bodyData['CorporateID'] = strtolower(str_replace(' ', '', $corp_id)); $bodyData['CurrencyCode'] = 'idr'; $bodyData['ReferenceID'] = strtolower(str_replace(' ', '', $referenceID)); $bodyData['Remark1'] = strtolower(str_replace(' ', '', $remark1)); $bodyData['Remark2'] = strtolower(str_replace(' ', '', $remark2)); $bodyData['SourceAccountNumber'] = strtolower(str_replace(' ', '', $sourceAccountNumber)); $bodyData['TransactionDate'] = $isoTime; $bodyData['TransactionID'] = strtolower(str_replace(' ', '', $transactionID)); // Harus disort agar mudah kalkulasi HMAC ksort($bodyData); $authSignature = self::generateSign($uriSign, $oauth_token, $secret, $isoTime, $bodyData); $headers['X-BCA-Signature'] = $authSignature; \Unirest\Request::curlOpts(array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSLVERSION => 6, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => $this->settings['timeout'] !== 30 ? $this->settings['timeout'] : 30 )); // Supaya jgn strip "ReferenceID" "/" jadi "/\" karena HMAC akan menjadi tidak cocok $encoderData = json_encode($bodyData, JSON_UNESCAPED_SLASHES); $body = \Unirest\Request\Body::form($encoderData); $response = \Unirest\Request::post($full_url, $headers, $body); return $response; }
[ "public", "function", "fundTransfers", "(", "$", "oauth_token", ",", "$", "amount", ",", "$", "sourceAccountNumber", ",", "$", "beneficiaryAccountNumber", ",", "$", "referenceID", ",", "$", "remark1", ",", "$", "remark2", ",", "$", "transactionID", ")", "{", ...
Transfer dana kepada akun lain dengan jumlah nominal tertentu. @param string $oauth_token nilai token yang telah didapatkan setelah login @param int $amount nilai dana dalam RUPIAH yang akan ditransfer, Format: 13.2 @param string $beneficiaryAccountNumber BCA Account number to be credited (Destination) @param string $referenceID Sender's transaction reference ID @param string $remark1 Transfer remark for receiver @param string $remark2 ransfer remark for receiver @param string $sourceAccountNumber Source of Fund Account Number @param string $transactionID Transcation ID unique per day (using UTC+07 Time Zone). Format: Number @param string $corp_id nilai CorporateID yang telah diberikan oleh pihak BCA [Optional] @return \Unirest\Response
[ "Transfer", "dana", "kepada", "akun", "lain", "dengan", "jumlah", "nominal", "tertentu", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L367-L429
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.generateSign
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); } $stringToSign = $url . ":" . $auth_token . ":" . $hash . ":" . $isoTime; $auth_signature = hash_hmac('sha256', $stringToSign, $secret_key, false); return $auth_signature; }
php
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); } $stringToSign = $url . ":" . $auth_token . ":" . $hash . ":" . $isoTime; $auth_signature = hash_hmac('sha256', $stringToSign, $secret_key, false); return $auth_signature; }
[ "public", "static", "function", "generateSign", "(", "$", "url", ",", "$", "auth_token", ",", "$", "secret_key", ",", "$", "isoTime", ",", "$", "bodyToHash", "=", "[", "]", ")", "{", "$", "hash", "=", "hash", "(", "\"sha256\"", ",", "\"\"", ")", ";",...
Generate Signature. @param string $url Url yang akan disign. @param string $auth_token string nilai token dari login. @param string $secret_key string secretkey yang telah diberikan oleh BCA. @param string $isoTime string Waktu ISO8601. @param array|mixed $bodyToHash array Body yang akan dikirimkan ke Server BCA. @return string
[ "Generate", "Signature", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L485-L497
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.generateIsoTime
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; }
php
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; }
[ "public", "static", "function", "generateIsoTime", "(", ")", "{", "$", "date", "=", "\\", "Carbon", "\\", "Carbon", "::", "now", "(", "self", "::", "getTimeZone", "(", ")", ")", ";", "date_default_timezone_set", "(", "self", "::", "getTimeZone", "(", ")", ...
Generate ISO8601 Time. @param string $timeZone Time yang akan dipergunakan @return string
[ "Generate", "ISO8601", "Time", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L572-L580
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.validateArray
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 ($max > 20) { throw new BcaHttpException('Maksimal Account Number ' . 20); } } return true; }
php
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 ($max > 20) { throw new BcaHttpException('Maksimal Account Number ' . 20); } } return true; }
[ "private", "function", "validateArray", "(", "$", "sourceAccountId", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "sourceAccountId", ")", ")", "{", "throw", "new", "BcaHttpException", "(", "'Data harus array.'", ")", ";", "}", "if", "(", ...
Validasi jika clientsecret telah di-definsikan. @param array $sourceAccountId @return bool
[ "Validasi", "jika", "clientsecret", "telah", "di", "-", "definsikan", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L589-L604
odenktools/php-bca
lib/Bca/BcaHttp.php
BcaHttp.arrayImplode
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($val)) { $val = implode(',', $val); } $string[] = "{$key}{$glue}{$val}"; } return implode($separator, $string); }
php
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($val)) { $val = implode(',', $val); } $string[] = "{$key}{$glue}{$val}"; } return implode($separator, $string); }
[ "public", "static", "function", "arrayImplode", "(", "$", "glue", ",", "$", "separator", ",", "$", "array", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "array", ")", ")", "{", "throw", "new", "BcaHttpException", "(", "'Data harus arr...
Implode an array with the key and value pair giving a glue, a separator between pairs and the array to implode. @param string $glue The glue between key and value @param string $separator Separator between pairs @param array $array The array to implode @return string The imploded array
[ "Implode", "an", "array", "with", "the", "key", "and", "value", "pair", "giving", "a", "glue", "a", "separator", "between", "pairs", "and", "the", "array", "to", "implode", "." ]
train
https://github.com/odenktools/php-bca/blob/10351e5fa61a212c63190a14e7d4d18b03818f0d/lib/Bca/BcaHttp.php#L617-L633
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initialize
protected function initialize() { $this->packages = array(); $this->packageName = isset($this->repoConfig['name']) ? Util::cleanPackageName($this->repoConfig['name']) : null; $this->initLoader(); $this->initRegistryVersions(); $this->initFullDriver(); if (!$this->getPackages()) { throw new InvalidRepositoryException('No valid '.$this->assetType->getFilename().' was found in any branch or tag of '.$this->url.', could not load a package from it.'); } }
php
protected function initialize() { $this->packages = array(); $this->packageName = isset($this->repoConfig['name']) ? Util::cleanPackageName($this->repoConfig['name']) : null; $this->initLoader(); $this->initRegistryVersions(); $this->initFullDriver(); if (!$this->getPackages()) { throw new InvalidRepositoryException('No valid '.$this->assetType->getFilename().' was found in any branch or tag of '.$this->url.', could not load a package from it.'); } }
[ "protected", "function", "initialize", "(", ")", "{", "$", "this", "->", "packages", "=", "array", "(", ")", ";", "$", "this", "->", "packageName", "=", "isset", "(", "$", "this", "->", "repoConfig", "[", "'name'", "]", ")", "?", "Util", "::", "clean...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L35-L46
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initFullDriver
protected function initFullDriver() { try { $driver = $this->initDriver(); $this->initRootIdentifier($driver); $this->initTags($driver); $this->initBranches($driver); $driver->cleanup(); } catch (\Exception $e) { // do nothing } }
php
protected function initFullDriver() { try { $driver = $this->initDriver(); $this->initRootIdentifier($driver); $this->initTags($driver); $this->initBranches($driver); $driver->cleanup(); } catch (\Exception $e) { // do nothing } }
[ "protected", "function", "initFullDriver", "(", ")", "{", "try", "{", "$", "driver", "=", "$", "this", "->", "initDriver", "(", ")", ";", "$", "this", "->", "initRootIdentifier", "(", "$", "driver", ")", ";", "$", "this", "->", "initTags", "(", "$", ...
Init the driver with branches and tags.
[ "Init", "the", "driver", "with", "branches", "and", "tags", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L51-L62
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initTags
protected function initTags(VcsDriverInterface $driver) { foreach ($driver->getTags() as $tag => $identifier) { $packageName = $this->createPackageName(); // strip the release- prefix from tags if present $tag = str_replace(array('release-', 'version/'), '', $tag); $this->initTag($driver, $packageName, $tag, $identifier); } if (!$this->verbose) { $this->io->overwrite('', false); } }
php
protected function initTags(VcsDriverInterface $driver) { foreach ($driver->getTags() as $tag => $identifier) { $packageName = $this->createPackageName(); // strip the release- prefix from tags if present $tag = str_replace(array('release-', 'version/'), '', $tag); $this->initTag($driver, $packageName, $tag, $identifier); } if (!$this->verbose) { $this->io->overwrite('', false); } }
[ "protected", "function", "initTags", "(", "VcsDriverInterface", "$", "driver", ")", "{", "foreach", "(", "$", "driver", "->", "getTags", "(", ")", "as", "$", "tag", "=>", "$", "identifier", ")", "{", "$", "packageName", "=", "$", "this", "->", "createPac...
Initializes all tags. @param VcsDriverInterface $driver
[ "Initializes", "all", "tags", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L69-L82
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initTag
protected function initTag(VcsDriverInterface $driver, $packageName, $tag, $identifier) { if (null !== $this->filter && $this->filter->skip($this->assetType, $packageName, $tag)) { return; } if (!$parsedTag = Validator::validateTag($tag, $this->assetType, $this->versionParser)) { if ($this->verbose) { $this->io->write('<warning>Skipped tag '.$tag.', invalid tag name</warning>'); } return; } $this->initTagAddPackage($driver, $packageName, $tag, $identifier, $parsedTag); }
php
protected function initTag(VcsDriverInterface $driver, $packageName, $tag, $identifier) { if (null !== $this->filter && $this->filter->skip($this->assetType, $packageName, $tag)) { return; } if (!$parsedTag = Validator::validateTag($tag, $this->assetType, $this->versionParser)) { if ($this->verbose) { $this->io->write('<warning>Skipped tag '.$tag.', invalid tag name</warning>'); } return; } $this->initTagAddPackage($driver, $packageName, $tag, $identifier, $parsedTag); }
[ "protected", "function", "initTag", "(", "VcsDriverInterface", "$", "driver", ",", "$", "packageName", ",", "$", "tag", ",", "$", "identifier", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "filter", "&&", "$", "this", "->", "filter", "->", "s...
Initializes the tag: check if tag must be skipped and validate the tag. @param VcsDriverInterface $driver @param string $packageName @param string $tag @param string $identifier
[ "Initializes", "the", "tag", ":", "check", "if", "tag", "must", "be", "skipped", "and", "validate", "the", "tag", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L92-L107
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initTagAddPackage
protected function initTagAddPackage(VcsDriverInterface $driver, $packageName, $tag, $identifier, $parsedTag) { $packageClass = 'Fxp\Composer\AssetPlugin\Package\LazyCompletePackage'; $data = $this->createMockOfPackageConfig($packageName, $tag); $data['version'] = $this->assetType->getVersionConverter()->convertVersion($tag); $data['version_normalized'] = $parsedTag; // make sure tag packages have no -dev flag $data['version'] = preg_replace('{[.-]?dev$}i', '', (string) $data['version']); $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', (string) $data['version_normalized']); $packageData = $this->preProcessAsset($data); $package = $this->loader->load($packageData, $packageClass); $lazyLoader = $this->createLazyLoader('tag', $identifier, $packageData, $driver); /* @var LazyCompletePackage $package */ $package->setLoader($lazyLoader); if (!$this->hasPackage($package)) { $this->addPackage($package); } }
php
protected function initTagAddPackage(VcsDriverInterface $driver, $packageName, $tag, $identifier, $parsedTag) { $packageClass = 'Fxp\Composer\AssetPlugin\Package\LazyCompletePackage'; $data = $this->createMockOfPackageConfig($packageName, $tag); $data['version'] = $this->assetType->getVersionConverter()->convertVersion($tag); $data['version_normalized'] = $parsedTag; // make sure tag packages have no -dev flag $data['version'] = preg_replace('{[.-]?dev$}i', '', (string) $data['version']); $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', (string) $data['version_normalized']); $packageData = $this->preProcessAsset($data); $package = $this->loader->load($packageData, $packageClass); $lazyLoader = $this->createLazyLoader('tag', $identifier, $packageData, $driver); /* @var LazyCompletePackage $package */ $package->setLoader($lazyLoader); if (!$this->hasPackage($package)) { $this->addPackage($package); } }
[ "protected", "function", "initTagAddPackage", "(", "VcsDriverInterface", "$", "driver", ",", "$", "packageName", ",", "$", "tag", ",", "$", "identifier", ",", "$", "parsedTag", ")", "{", "$", "packageClass", "=", "'Fxp\\Composer\\AssetPlugin\\Package\\LazyCompletePack...
Initializes the tag: convert data and create package. @param VcsDriverInterface $driver @param string $packageName @param string $tag @param string $identifier @param string $parsedTag
[ "Initializes", "the", "tag", ":", "convert", "data", "and", "create", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L118-L138
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initBranches
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); continue; } $this->preInitBranchLazyPackage($driver, $branch, $identifier); } if (!$this->verbose) { $this->io->overwrite('', false); } }
php
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); continue; } $this->preInitBranchLazyPackage($driver, $branch, $identifier); } if (!$this->verbose) { $this->io->overwrite('', false); } }
[ "protected", "function", "initBranches", "(", "VcsDriverInterface", "$", "driver", ")", "{", "foreach", "(", "$", "driver", "->", "getBranches", "(", ")", "as", "$", "branch", "=>", "$", "identifier", ")", "{", "if", "(", "\\", "is_array", "(", "$", "thi...
Initializes all branches. @param VcsDriverInterface $driver
[ "Initializes", "all", "branches", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L145-L160
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.preInitBranchPackage
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['version'] = $branch; $data = $this->configureBranchPackage($branch, $data); if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); } $loader = new ArrayLoader(); $package = $loader->load($data); $package = $this->includeBranchAlias($driver, $package, $branch); $this->addPackage($package); }
php
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['version'] = $branch; $data = $this->configureBranchPackage($branch, $data); if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); } $loader = new ArrayLoader(); $package = $loader->load($data); $package = $this->includeBranchAlias($driver, $package, $branch); $this->addPackage($package); }
[ "protected", "function", "preInitBranchPackage", "(", "VcsDriverInterface", "$", "driver", ",", "array", "$", "data", ",", "$", "branch", ",", "$", "identifier", ")", "{", "$", "packageName", "=", "$", "this", "->", "createPackageName", "(", ")", ";", "$", ...
Pre inits the branch of complete package. @param VcsDriverInterface $driver The vcs driver @param array $data The asset package data @param string $branch The branch name @param string $identifier The branch identifier
[ "Pre", "inits", "the", "branch", "of", "complete", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L170-L189
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.preInitBranchLazyPackage
protected function preInitBranchLazyPackage(VcsDriverInterface $driver, $branch, $identifier) { $packageName = $this->createPackageName(); $data = $this->createMockOfPackageConfig($packageName, $branch); $data = $this->configureBranchPackage($branch, $data); $this->initBranchLazyPackage($driver, $data, $branch, $identifier); }
php
protected function preInitBranchLazyPackage(VcsDriverInterface $driver, $branch, $identifier) { $packageName = $this->createPackageName(); $data = $this->createMockOfPackageConfig($packageName, $branch); $data = $this->configureBranchPackage($branch, $data); $this->initBranchLazyPackage($driver, $data, $branch, $identifier); }
[ "protected", "function", "preInitBranchLazyPackage", "(", "VcsDriverInterface", "$", "driver", ",", "$", "branch", ",", "$", "identifier", ")", "{", "$", "packageName", "=", "$", "this", "->", "createPackageName", "(", ")", ";", "$", "data", "=", "$", "this"...
Pre inits the branch of lazy package. @param VcsDriverInterface $driver The vcs driver @param string $branch The branch name @param string $identifier The branch identifier
[ "Pre", "inits", "the", "branch", "of", "lazy", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L198-L205
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.configureBranchPackage
protected function configureBranchPackage($branch, array $data) { $parsedBranch = $this->versionParser->normalizeBranch($branch); $data['version_normalized'] = $parsedBranch; // make sure branch packages have a dev flag if ('dev-' === substr((string) $parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) { $data['version'] = 'dev-'.$data['version']; } else { $data['version'] = preg_replace('{(\.9{7})+}', '.x', (string) $parsedBranch); } return $data; }
php
protected function configureBranchPackage($branch, array $data) { $parsedBranch = $this->versionParser->normalizeBranch($branch); $data['version_normalized'] = $parsedBranch; // make sure branch packages have a dev flag if ('dev-' === substr((string) $parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) { $data['version'] = 'dev-'.$data['version']; } else { $data['version'] = preg_replace('{(\.9{7})+}', '.x', (string) $parsedBranch); } return $data; }
[ "protected", "function", "configureBranchPackage", "(", "$", "branch", ",", "array", "$", "data", ")", "{", "$", "parsedBranch", "=", "$", "this", "->", "versionParser", "->", "normalizeBranch", "(", "$", "branch", ")", ";", "$", "data", "[", "'version_norma...
Configures the package of branch. @param string $branch The branch name @param array $data The data @return array
[ "Configures", "the", "package", "of", "branch", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L215-L228
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initBranchLazyPackage
protected function initBranchLazyPackage(VcsDriverInterface $driver, array $data, $branch, $identifier) { $packageClass = 'Fxp\Composer\AssetPlugin\Package\LazyCompletePackage'; $packageData = $this->preProcessAsset($data); /** @var LazyCompletePackage $package */ $package = $this->loader->load($packageData, $packageClass); $lazyLoader = $this->createLazyLoader('branch', $identifier, $packageData, $driver); $package->setLoader($lazyLoader); $package = $this->includeBranchAlias($driver, $package, $branch); $this->addPackage($package); }
php
protected function initBranchLazyPackage(VcsDriverInterface $driver, array $data, $branch, $identifier) { $packageClass = 'Fxp\Composer\AssetPlugin\Package\LazyCompletePackage'; $packageData = $this->preProcessAsset($data); /** @var LazyCompletePackage $package */ $package = $this->loader->load($packageData, $packageClass); $lazyLoader = $this->createLazyLoader('branch', $identifier, $packageData, $driver); $package->setLoader($lazyLoader); $package = $this->includeBranchAlias($driver, $package, $branch); $this->addPackage($package); }
[ "protected", "function", "initBranchLazyPackage", "(", "VcsDriverInterface", "$", "driver", ",", "array", "$", "data", ",", "$", "branch", ",", "$", "identifier", ")", "{", "$", "packageClass", "=", "'Fxp\\Composer\\AssetPlugin\\Package\\LazyCompletePackage'", ";", "$...
Inits the branch of lazy package. @param VcsDriverInterface $driver The vcs driver @param array $data The package data @param string $branch The branch name @param string $identifier The branch identifier
[ "Inits", "the", "branch", "of", "lazy", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L238-L249
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.includeBranchAlias
protected function includeBranchAlias(VcsDriverInterface $driver, PackageInterface $package, $branch) { if (null !== $this->rootPackageVersion && $branch === $driver->getRootIdentifier()) { $aliasNormalized = $this->normalizeBranchAlias($package); $package = $package instanceof AliasPackage ? $package->getAliasOf() : $package; $package = $this->overrideBranchAliasConfig($package, $aliasNormalized, $branch); $package = $this->addPackageAliases($package, $aliasNormalized); } return $package; }
php
protected function includeBranchAlias(VcsDriverInterface $driver, PackageInterface $package, $branch) { if (null !== $this->rootPackageVersion && $branch === $driver->getRootIdentifier()) { $aliasNormalized = $this->normalizeBranchAlias($package); $package = $package instanceof AliasPackage ? $package->getAliasOf() : $package; $package = $this->overrideBranchAliasConfig($package, $aliasNormalized, $branch); $package = $this->addPackageAliases($package, $aliasNormalized); } return $package; }
[ "protected", "function", "includeBranchAlias", "(", "VcsDriverInterface", "$", "driver", ",", "PackageInterface", "$", "package", ",", "$", "branch", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "rootPackageVersion", "&&", "$", "branch", "===", "$", ...
Include the package in the alias package if the branch is a root branch identifier and having a package version. @param VcsDriverInterface $driver The vcs driver @param PackageInterface $package The package instance @param string $branch The branch name @return AliasPackage|PackageInterface
[ "Include", "the", "package", "in", "the", "alias", "package", "if", "the", "branch", "is", "a", "root", "branch", "identifier", "and", "having", "a", "package", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L261-L271
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.normalizeBranchAlias
protected function normalizeBranchAlias(PackageInterface $package) { $stability = VersionParser::parseStability($this->versionParser->normalize($this->rootPackageVersion)); $aliasNormalized = 'dev-'.$this->rootPackageVersion; if (BasePackage::STABILITY_STABLE === BasePackage::$stabilities[$stability] && null === $this->findPackage($package->getName(), $this->rootPackageVersion)) { $aliasNormalized = $this->versionParser->normalize($this->rootPackageVersion); } return $aliasNormalized; }
php
protected function normalizeBranchAlias(PackageInterface $package) { $stability = VersionParser::parseStability($this->versionParser->normalize($this->rootPackageVersion)); $aliasNormalized = 'dev-'.$this->rootPackageVersion; if (BasePackage::STABILITY_STABLE === BasePackage::$stabilities[$stability] && null === $this->findPackage($package->getName(), $this->rootPackageVersion)) { $aliasNormalized = $this->versionParser->normalize($this->rootPackageVersion); } return $aliasNormalized; }
[ "protected", "function", "normalizeBranchAlias", "(", "PackageInterface", "$", "package", ")", "{", "$", "stability", "=", "VersionParser", "::", "parseStability", "(", "$", "this", "->", "versionParser", "->", "normalize", "(", "$", "this", "->", "rootPackageVers...
Normalize the alias of branch. @param PackageInterface $package The package instance @return string The alias branch name
[ "Normalize", "the", "alias", "of", "branch", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L280-L291
fxpio/composer-asset-plugin
Repository/AssetVcsRepository.php
AssetVcsRepository.initRegistryVersions
protected function initRegistryVersions() { if (isset($this->repoConfig['registry-versions'])) { /** @var CompletePackageInterface $package */ foreach ($this->repoConfig['registry-versions'] as $package) { $this->addPackage($package); } } }
php
protected function initRegistryVersions() { if (isset($this->repoConfig['registry-versions'])) { /** @var CompletePackageInterface $package */ foreach ($this->repoConfig['registry-versions'] as $package) { $this->addPackage($package); } } }
[ "protected", "function", "initRegistryVersions", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "repoConfig", "[", "'registry-versions'", "]", ")", ")", "{", "/** @var CompletePackageInterface $package */", "foreach", "(", "$", "this", "->", "repoConfi...
Init the package versions added directly in the Asset Registry.
[ "Init", "the", "package", "versions", "added", "directly", "in", "the", "Asset", "Registry", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/AssetVcsRepository.php#L296-L304
fxpio/composer-asset-plugin
Util/Validator.php
Validator.validateBranch
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; }
php
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; }
[ "public", "static", "function", "validateBranch", "(", "$", "branch", ",", "VersionParser", "$", "parser", "=", "null", ")", "{", "if", "(", "null", "===", "$", "parser", ")", "{", "$", "parser", "=", "new", "VersionParser", "(", ")", ";", "}", "$", ...
Validates the branch. @param string $branch @param null|VersionParser $parser @return false|string
[ "Validates", "the", "branch", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/Validator.php#L32-L45
fxpio/composer-asset-plugin
Util/Validator.php
Validator.validateTag
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->getVersionConverter()->convertVersion($tag); $tag = $parser->normalize($tag); } catch (\Exception $e) { $tag = false; } return $tag; }
php
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->getVersionConverter()->convertVersion($tag); $tag = $parser->normalize($tag); } catch (\Exception $e) { $tag = false; } return $tag; }
[ "public", "static", "function", "validateTag", "(", "$", "tag", ",", "AssetTypeInterface", "$", "assetType", ",", "VersionParser", "$", "parser", "=", "null", ")", "{", "if", "(", "\\", "in_array", "(", "$", "tag", ",", "array", "(", "'master'", ",", "'t...
Validates the tag. @param string $tag @param AssetTypeInterface $assetType @param null|VersionParser $parser @return false|string
[ "Validates", "the", "tag", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/Validator.php#L56-L74
fxpio/composer-asset-plugin
Repository/Vcs/HgDriver.php
HgDriver.initialize
public function initialize() { parent::initialize(); $cacheUrl = Filesystem::isLocalPath($this->url) ? realpath($this->url) : $this->url; $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl)); }
php
public function initialize() { parent::initialize(); $cacheUrl = Filesystem::isLocalPath($this->url) ? realpath($this->url) : $this->url; $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl)); }
[ "public", "function", "initialize", "(", ")", "{", "parent", "::", "initialize", "(", ")", ";", "$", "cacheUrl", "=", "Filesystem", "::", "isLocalPath", "(", "$", "this", "->", "url", ")", "?", "realpath", "(", "$", "this", "->", "url", ")", ":", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/HgDriver.php#L34-L42
fxpio/composer-asset-plugin
Repository/Vcs/HgDriver.php
HgDriver.getComposerInformation
public function getComposerInformation($identifier) { $resource = sprintf('%s %s', ProcessExecutor::escape($identifier), $this->repoConfig['filename']); return ProcessUtil::getComposerInformation($this->cache, $this->infoCache, $this->repoConfig['asset-type'], $this->process, $identifier, $resource, sprintf('hg cat -r %s', $resource), sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $this->repoDir); }
php
public function getComposerInformation($identifier) { $resource = sprintf('%s %s', ProcessExecutor::escape($identifier), $this->repoConfig['filename']); return ProcessUtil::getComposerInformation($this->cache, $this->infoCache, $this->repoConfig['asset-type'], $this->process, $identifier, $resource, sprintf('hg cat -r %s', $resource), sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $this->repoDir); }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "$", "resource", "=", "sprintf", "(", "'%s %s'", ",", "ProcessExecutor", "::", "escape", "(", "$", "identifier", ")", ",", "$", "this", "->", "repoConfig", "[", "'filename'", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/HgDriver.php#L47-L52
fxpio/composer-asset-plugin
Repository/BowerPrivateRepository.php
BowerPrivateRepository.createVcsRepositoryConfig
protected function createVcsRepositoryConfig(array $data, $registryName = null) { $myArray = array(); $myArray['repository'] = $data; return array( 'type' => $this->assetType->getName().'-vcs', 'url' => $this->getVcsRepositoryUrl($myArray, $registryName), 'name' => $registryName, ); }
php
protected function createVcsRepositoryConfig(array $data, $registryName = null) { $myArray = array(); $myArray['repository'] = $data; return array( 'type' => $this->assetType->getName().'-vcs', 'url' => $this->getVcsRepositoryUrl($myArray, $registryName), 'name' => $registryName, ); }
[ "protected", "function", "createVcsRepositoryConfig", "(", "array", "$", "data", ",", "$", "registryName", "=", "null", ")", "{", "$", "myArray", "=", "array", "(", ")", ";", "$", "myArray", "[", "'repository'", "]", "=", "$", "data", ";", "return", "arr...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/BowerPrivateRepository.php#L78-L88
fxpio/composer-asset-plugin
Repository/BowerPrivateRepository.php
BowerPrivateRepository.getVcsRepositoryUrl
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 .= PHP_EOL.'If the config comes from the Bower Private Registry, override the config with a custom Asset VCS Repository'; $ex = new InvalidCreateRepositoryException($msg); $ex->setData($data); throw $ex; } return (string) $data['repository']['url']; }
php
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 .= PHP_EOL.'If the config comes from the Bower Private Registry, override the config with a custom Asset VCS Repository'; $ex = new InvalidCreateRepositoryException($msg); $ex->setData($data); throw $ex; } return (string) $data['repository']['url']; }
[ "protected", "function", "getVcsRepositoryUrl", "(", "array", "$", "data", ",", "$", "registryName", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'repository'", "]", "[", "'url'", "]", ")", ")", "{", "$", "msg", "=", "sprin...
Get the URL of VCS repository. @param array $data The repository config @param string $registryName The package name in asset registry @throws InvalidCreateRepositoryException When the repository.url parameter does not exist @return string
[ "Get", "the", "URL", "of", "VCS", "repository", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/BowerPrivateRepository.php#L100-L112
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.addInstallers
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, $io, $composer, Assets::createType('npm'))); }
php
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, $io, $composer, Assets::createType('npm'))); }
[ "public", "static", "function", "addInstallers", "(", "Config", "$", "config", ",", "Composer", "$", "composer", ",", "IOInterface", "$", "io", ")", "{", "$", "im", "=", "$", "composer", "->", "getInstallationManager", "(", ")", ";", "$", "im", "->", "ad...
Adds asset installers. @param Config $config @param Composer $composer @param IOInterface $io
[ "Adds", "asset", "installers", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L40-L46
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.createAssetOptions
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; }
php
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; }
[ "public", "static", "function", "createAssetOptions", "(", "array", "$", "config", ",", "$", "assetType", ")", "{", "$", "options", "=", "array", "(", ")", ";", "foreach", "(", "$", "config", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(",...
Creates the asset options. @param array $config The composer config section of asset options @param string $assetType The asset type @return array The asset registry options
[ "Creates", "the", "asset", "options", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L56-L68
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.createRepositoryConfig
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'), $assetType), 'vcs-driver-options' => $config->getArray('vcs-driver-options'), ); }
php
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'), $assetType), 'vcs-driver-options' => $config->getArray('vcs-driver-options'), ); }
[ "public", "static", "function", "createRepositoryConfig", "(", "AssetRepositoryManager", "$", "arm", ",", "VcsPackageFilter", "$", "filter", ",", "Config", "$", "config", ",", "$", "assetType", ")", "{", "return", "array", "(", "'asset-repository-manager'", "=>", ...
Create the repository config. @param AssetRepositoryManager $arm The asset repository manager @param VcsPackageFilter $filter The vcs package filter @param Config $config The plugin config @param string $assetType The asset type @return array
[ "Create", "the", "repository", "config", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L80-L88
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.addRegistryRepositories
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\AssetPlugin\Repository\RegistryFactoryInterface')) { \call_user_func(array($factoryClass, 'create'), $arm, $filter, $config); } } }
php
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\AssetPlugin\Repository\RegistryFactoryInterface')) { \call_user_func(array($factoryClass, 'create'), $arm, $filter, $config); } } }
[ "public", "static", "function", "addRegistryRepositories", "(", "AssetRepositoryManager", "$", "arm", ",", "VcsPackageFilter", "$", "filter", ",", "Config", "$", "config", ")", "{", "foreach", "(", "Assets", "::", "getRegistryFactories", "(", ")", "as", "$", "re...
Adds asset registry repositories. @param AssetRepositoryManager $arm @param VcsPackageFilter $filter @param Config $config
[ "Adds", "asset", "registry", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L97-L106
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.setVcsTypeRepositories
public static function setVcsTypeRepositories(RepositoryManager $rm) { foreach (Assets::getTypes() as $assetType) { foreach (Assets::getVcsRepositoryDrivers() as $driverType => $repositoryClass) { $rm->setRepositoryClass($assetType.'-'.$driverType, $repositoryClass); } } }
php
public static function setVcsTypeRepositories(RepositoryManager $rm) { foreach (Assets::getTypes() as $assetType) { foreach (Assets::getVcsRepositoryDrivers() as $driverType => $repositoryClass) { $rm->setRepositoryClass($assetType.'-'.$driverType, $repositoryClass); } } }
[ "public", "static", "function", "setVcsTypeRepositories", "(", "RepositoryManager", "$", "rm", ")", "{", "foreach", "(", "Assets", "::", "getTypes", "(", ")", "as", "$", "assetType", ")", "{", "foreach", "(", "Assets", "::", "getVcsRepositoryDrivers", "(", ")"...
Sets vcs type repositories. @param RepositoryManager $rm
[ "Sets", "vcs", "type", "repositories", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L113-L120
fxpio/composer-asset-plugin
Util/AssetPlugin.php
AssetPlugin.addMainFiles
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 ($packageName === $package->getName()) { $packageExtra['bower-asset-main'] = $files; break; } } $package->setExtra($packageExtra); } return $package; }
php
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 ($packageName === $package->getName()) { $packageExtra['bower-asset-main'] = $files; break; } } $package->setExtra($packageExtra); } return $package; }
[ "public", "static", "function", "addMainFiles", "(", "Config", "$", "config", ",", "PackageInterface", "$", "package", ",", "$", "section", "=", "'main-files'", ")", "{", "if", "(", "$", "package", "instanceof", "Package", ")", "{", "$", "packageExtra", "=",...
Adds the main file definitions from the root package. @param Config $config @param PackageInterface $package @param string $section @return PackageInterface
[ "Adds", "the", "main", "file", "definitions", "from", "the", "root", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Util/AssetPlugin.php#L131-L149
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.checkUrlVersion
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::hasUrlDependencySupported($url)) { $vcsRepos[] = array( 'type' => sprintf('%s-vcs', $assetType->getName()), 'url' => $url, 'name' => $assetType->formatComposerName($dependency), ); } else { $dependency = static::getUrlFileDependencyName($assetType, $composer, $dependency); $vcsRepos[] = array( 'type' => 'package', 'package' => array( 'name' => $assetType->formatComposerName($dependency), 'type' => $assetType->getComposerType(), 'version' => static::getUrlFileDependencyVersion($assetType, $url, $version), 'dist' => array( 'url' => $url, 'type' => 'file', ), ), ); } } return array($dependency, $version); }
php
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::hasUrlDependencySupported($url)) { $vcsRepos[] = array( 'type' => sprintf('%s-vcs', $assetType->getName()), 'url' => $url, 'name' => $assetType->formatComposerName($dependency), ); } else { $dependency = static::getUrlFileDependencyName($assetType, $composer, $dependency); $vcsRepos[] = array( 'type' => 'package', 'package' => array( 'name' => $assetType->formatComposerName($dependency), 'type' => $assetType->getComposerType(), 'version' => static::getUrlFileDependencyVersion($assetType, $url, $version), 'dist' => array( 'url' => $url, 'type' => 'file', ), ), ); } } return array($dependency, $version); }
[ "public", "static", "function", "checkUrlVersion", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "dependency", ",", "$", "version", ",", "array", "&", "$", "vcsRepos", ",", "array", "$", "composer", ")", "{", "if", "(", "preg_match", "(", "'/(\\:\\/...
Checks if the version is a URL version. @param AssetTypeInterface $assetType The asset type @param string $dependency The dependency @param string $version The version @param array $vcsRepos The list of new vcs configs @param array $composer The partial composer data @return string[] The new dependency and the new version
[ "Checks", "if", "the", "version", "is", "a", "URL", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L54-L83
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.isUrlArchive
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; }
php
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; }
[ "public", "static", "function", "isUrlArchive", "(", "$", "url", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "url", ",", "'http'", ")", ")", "{", "foreach", "(", "self", "::", "$", "extensions", "as", "$", "extension", ")", "{", "if", "(",...
Check if the url is a url of a archive file. @param string $url The url @return bool
[ "Check", "if", "the", "url", "is", "a", "url", "of", "a", "archive", "file", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L92-L103
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.checkAliasVersion
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 = substr($version, 1); if (false === strpos($version, '*') && Validator::validateTag($searchVerion, $assetType)) { $dependency .= '-'.str_replace('#', '', $version); } } return array($dependency, $version); }
php
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 = substr($version, 1); if (false === strpos($version, '*') && Validator::validateTag($searchVerion, $assetType)) { $dependency .= '-'.str_replace('#', '', $version); } } return array($dependency, $version); }
[ "public", "static", "function", "checkAliasVersion", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "dependency", ",", "$", "version", ")", "{", "$", "pos", "=", "strpos", "(", "$", "version", ",", "'#'", ")", ";", "if", "(", "$", "pos", ">", "...
Checks if the version is a alias version. @param AssetTypeInterface $assetType The asset type @param string $dependency The dependency @param string $version The version @return string[] The new dependency and the new version
[ "Checks", "if", "the", "version", "is", "a", "alias", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L114-L129
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.convertDependencyVersion
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(' ', '<', '>', '=', '^', '~'), '', $version); // sha version or branch version // sha size: 4-40. See https://git-scm.com/book/tr/v2/Git-Tools-Revision-Selection#_short_sha_1 if ($containsHash && preg_match('{^[0-9a-f]{4,40}$}', $version)) { $version = 'dev-default#'.$version; } elseif ('*' !== $version && !Validator::validateTag($searchVersion, $assetType) && !static::depIsRange($version)) { $version = static::convertBrachVersion($assetType, $version); } return array($dependency, $version); }
php
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(' ', '<', '>', '=', '^', '~'), '', $version); // sha version or branch version // sha size: 4-40. See https://git-scm.com/book/tr/v2/Git-Tools-Revision-Selection#_short_sha_1 if ($containsHash && preg_match('{^[0-9a-f]{4,40}$}', $version)) { $version = 'dev-default#'.$version; } elseif ('*' !== $version && !Validator::validateTag($searchVersion, $assetType) && !static::depIsRange($version)) { $version = static::convertBrachVersion($assetType, $version); } return array($dependency, $version); }
[ "public", "static", "function", "convertDependencyVersion", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "dependency", ",", "$", "version", ")", "{", "$", "containsHash", "=", "false", "!==", "strpos", "(", "$", "version", ",", "'#'", ")", ";", "$"...
Convert the dependency version. @param AssetTypeInterface $assetType The asset type @param string $dependency The dependency @param string $version The version @return string[] The new dependency and the new version
[ "Convert", "the", "dependency", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L140-L156
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.convertStringKey
public static function convertStringKey(array $asset, $assetKey, array &$composer, $composerKey) { if (isset($asset[$assetKey])) { $composer[$composerKey] = $asset[$assetKey]; } }
php
public static function convertStringKey(array $asset, $assetKey, array &$composer, $composerKey) { if (isset($asset[$assetKey])) { $composer[$composerKey] = $asset[$assetKey]; } }
[ "public", "static", "function", "convertStringKey", "(", "array", "$", "asset", ",", "$", "assetKey", ",", "array", "&", "$", "composer", ",", "$", "composerKey", ")", "{", "if", "(", "isset", "(", "$", "asset", "[", "$", "assetKey", "]", ")", ")", "...
Converts the simple key of package. @param array $asset The asset data @param string $assetKey The asset key @param array $composer The composer data @param string $composerKey The composer key
[ "Converts", "the", "simple", "key", "of", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L166-L171
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.convertArrayKey
public static function convertArrayKey(array $asset, $assetKey, array &$composer, $composerKey) { if (2 !== \count($composerKey) || !\is_string($composerKey[0]) || !$composerKey[1] instanceof \Closure) { throw new InvalidArgumentException('The "composerKey" argument of asset packager converter must be an string or an array with the composer key and closure'); } $closure = $composerKey[1]; $composerKey = $composerKey[0]; $data = isset($asset[$assetKey]) ? $asset[$assetKey] : null; $previousData = isset($composer[$composerKey]) ? $composer[$composerKey] : null; $data = $closure($data, $previousData); if (null !== $data) { $composer[$composerKey] = $data; } }
php
public static function convertArrayKey(array $asset, $assetKey, array &$composer, $composerKey) { if (2 !== \count($composerKey) || !\is_string($composerKey[0]) || !$composerKey[1] instanceof \Closure) { throw new InvalidArgumentException('The "composerKey" argument of asset packager converter must be an string or an array with the composer key and closure'); } $closure = $composerKey[1]; $composerKey = $composerKey[0]; $data = isset($asset[$assetKey]) ? $asset[$assetKey] : null; $previousData = isset($composer[$composerKey]) ? $composer[$composerKey] : null; $data = $closure($data, $previousData); if (null !== $data) { $composer[$composerKey] = $data; } }
[ "public", "static", "function", "convertArrayKey", "(", "array", "$", "asset", ",", "$", "assetKey", ",", "array", "&", "$", "composer", ",", "$", "composerKey", ")", "{", "if", "(", "2", "!==", "\\", "count", "(", "$", "composerKey", ")", "||", "!", ...
Converts the simple key of package. @param array $asset The asset data @param string $assetKey The asset key @param array $composer The composer data @param array $composerKey The array with composer key name and closure @throws InvalidArgumentException When the 'composerKey' argument of asset packager converter is not an string or an array with the composer key and closure
[ "Converts", "the", "simple", "key", "of", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L183-L199
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.splitUrlVersion
protected static function splitUrlVersion($version) { $pos = strpos($version, '#'); // number version or empty version if (false !== $pos) { $url = substr($version, 0, $pos); $version = substr($version, $pos); } else { $url = $version; $version = '#'; } return array($url, $version); }
php
protected static function splitUrlVersion($version) { $pos = strpos($version, '#'); // number version or empty version if (false !== $pos) { $url = substr($version, 0, $pos); $version = substr($version, $pos); } else { $url = $version; $version = '#'; } return array($url, $version); }
[ "protected", "static", "function", "splitUrlVersion", "(", "$", "version", ")", "{", "$", "pos", "=", "strpos", "(", "$", "version", ",", "'#'", ")", ";", "// number version or empty version", "if", "(", "false", "!==", "$", "pos", ")", "{", "$", "url", ...
Split the URL and version. @param string $version The url and version (in the same string) @return string[] The url and version
[ "Split", "the", "URL", "and", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L208-L222
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.getUrlFileDependencyName
protected static function getUrlFileDependencyName(AssetTypeInterface $assetType, array $composer, $dependency) { $prefix = isset($composer['name']) ? substr($composer['name'], \strlen($assetType->getComposerVendorName()) + 1).'-' : ''; return $prefix.$dependency.'-file'; }
php
protected static function getUrlFileDependencyName(AssetTypeInterface $assetType, array $composer, $dependency) { $prefix = isset($composer['name']) ? substr($composer['name'], \strlen($assetType->getComposerVendorName()) + 1).'-' : ''; return $prefix.$dependency.'-file'; }
[ "protected", "static", "function", "getUrlFileDependencyName", "(", "AssetTypeInterface", "$", "assetType", ",", "array", "$", "composer", ",", "$", "dependency", ")", "{", "$", "prefix", "=", "isset", "(", "$", "composer", "[", "'name'", "]", ")", "?", "sub...
Get the name of url file dependency. @param AssetTypeInterface $assetType The asset type @param array $composer The partial composer @param string $dependency The dependency name @return string The dependency name
[ "Get", "the", "name", "of", "url", "file", "dependency", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L233-L240
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.getUrlFileDependencyVersion
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($match[0]); } return '0.0.0.0'; }
php
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($match[0]); } return '0.0.0.0'; }
[ "protected", "static", "function", "getUrlFileDependencyVersion", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "url", ",", "$", "version", ")", "{", "if", "(", "'#'", "!==", "$", "version", ")", "{", "return", "substr", "(", "$", "version", ",", ...
Get the version of url file dependency. @param AssetTypeInterface $assetType The asset type @param string $url The url @param string $version The version @return string The version
[ "Get", "the", "version", "of", "url", "file", "dependency", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L251-L262
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.hasUrlDependencySupported
protected static function hasUrlDependencySupported($url) { $io = new NullIO(); $config = new Config(); /** @var VcsDriverInterface $driver */ foreach (Assets::getVcsDrivers() as $driver) { $supported = $driver::supports($io, $config, $url); if ($supported) { return true; } } return false; }
php
protected static function hasUrlDependencySupported($url) { $io = new NullIO(); $config = new Config(); /** @var VcsDriverInterface $driver */ foreach (Assets::getVcsDrivers() as $driver) { $supported = $driver::supports($io, $config, $url); if ($supported) { return true; } } return false; }
[ "protected", "static", "function", "hasUrlDependencySupported", "(", "$", "url", ")", "{", "$", "io", "=", "new", "NullIO", "(", ")", ";", "$", "config", "=", "new", "Config", "(", ")", ";", "/** @var VcsDriverInterface $driver */", "foreach", "(", "Assets", ...
Check if url is supported by vcs drivers. @param string $url The url @return bool
[ "Check", "if", "url", "is", "supported", "by", "vcs", "drivers", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L271-L286
fxpio/composer-asset-plugin
Converter/PackageUtil.php
PackageUtil.convertBrachVersion
protected static function convertBrachVersion(AssetTypeInterface $assetType, $version) { $oldVersion = $version; $version = 'dev-'.$assetType->getVersionConverter()->convertVersion($version); if (!Validator::validateBranch($oldVersion)) { $version .= ' || '.$oldVersion; } return $version; }
php
protected static function convertBrachVersion(AssetTypeInterface $assetType, $version) { $oldVersion = $version; $version = 'dev-'.$assetType->getVersionConverter()->convertVersion($version); if (!Validator::validateBranch($oldVersion)) { $version .= ' || '.$oldVersion; } return $version; }
[ "protected", "static", "function", "convertBrachVersion", "(", "AssetTypeInterface", "$", "assetType", ",", "$", "version", ")", "{", "$", "oldVersion", "=", "$", "version", ";", "$", "version", "=", "'dev-'", ".", "$", "assetType", "->", "getVersionConverter", ...
Convert the dependency branch version. @param AssetTypeInterface $assetType The asset type @param string $version The version @return string
[ "Convert", "the", "dependency", "branch", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/PackageUtil.php#L310-L320
fxpio/composer-asset-plugin
Repository/Vcs/GitDriver.php
GitDriver.getComposerInformation
public function getComposerInformation($identifier) { $resource = sprintf('%s:%s', escapeshellarg($identifier), $this->repoConfig['filename']); return ProcessUtil::getComposerInformation($this->cache, $this->infoCache, $this->repoConfig['asset-type'], $this->process, $identifier, $resource, sprintf('git show %s', $resource), sprintf('git log -1 --format=%%at %s', escapeshellarg($identifier)), $this->repoDir, '@'); }
php
public function getComposerInformation($identifier) { $resource = sprintf('%s:%s', escapeshellarg($identifier), $this->repoConfig['filename']); return ProcessUtil::getComposerInformation($this->cache, $this->infoCache, $this->repoConfig['asset-type'], $this->process, $identifier, $resource, sprintf('git show %s', $resource), sprintf('git log -1 --format=%%at %s', escapeshellarg($identifier)), $this->repoDir, '@'); }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "$", "resource", "=", "sprintf", "(", "'%s:%s'", ",", "escapeshellarg", "(", "$", "identifier", ")", ",", "$", "this", "->", "repoConfig", "[", "'filename'", "]", ")", ";", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitDriver.php#L36-L41
fxpio/composer-asset-plugin
Repository/Vcs/GitDriver.php
GitDriver.initialize
public function initialize() { /** @var AssetRepositoryManager $arm */ $arm = $this->repoConfig['asset-repository-manager']; $skipSync = false; if (null !== ($skip = $arm->getConfig()->get('git-skip-update'))) { $localUrl = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url).'/'; // check if local copy exists and if it is a git repository and that modification time is within threshold if (is_dir($localUrl) && is_file($localUrl.'/config') && filemtime($localUrl) > strtotime('-'.$skip)) { $skipSync = true; $this->io->write('(<comment>skip update</comment>) ', false, IOInterface::VERBOSE); } } $cacheUrl = Filesystem::isLocalPath($this->url) ? $this->initializeLocalPath() : $this->initializeRemotePath($skipSync); $this->getTags(); $this->getBranches(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl)); }
php
public function initialize() { /** @var AssetRepositoryManager $arm */ $arm = $this->repoConfig['asset-repository-manager']; $skipSync = false; if (null !== ($skip = $arm->getConfig()->get('git-skip-update'))) { $localUrl = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url).'/'; // check if local copy exists and if it is a git repository and that modification time is within threshold if (is_dir($localUrl) && is_file($localUrl.'/config') && filemtime($localUrl) > strtotime('-'.$skip)) { $skipSync = true; $this->io->write('(<comment>skip update</comment>) ', false, IOInterface::VERBOSE); } } $cacheUrl = Filesystem::isLocalPath($this->url) ? $this->initializeLocalPath() : $this->initializeRemotePath($skipSync); $this->getTags(); $this->getBranches(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl)); }
[ "public", "function", "initialize", "(", ")", "{", "/** @var AssetRepositoryManager $arm */", "$", "arm", "=", "$", "this", "->", "repoConfig", "[", "'asset-repository-manager'", "]", ";", "$", "skipSync", "=", "false", ";", "if", "(", "null", "!==", "(", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitDriver.php#L46-L66
fxpio/composer-asset-plugin
Repository/Vcs/GitDriver.php
GitDriver.initializeLocalPath
private function initializeLocalPath() { $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url); $this->repoDir = $this->url; return realpath($this->url); }
php
private function initializeLocalPath() { $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url); $this->repoDir = $this->url; return realpath($this->url); }
[ "private", "function", "initializeLocalPath", "(", ")", "{", "$", "this", "->", "url", "=", "preg_replace", "(", "'{[\\\\/]\\.git/?$}'", ",", "''", ",", "$", "this", "->", "url", ")", ";", "$", "this", "->", "repoDir", "=", "$", "this", "->", "url", ";...
Initialize the local path. @return string
[ "Initialize", "the", "local", "path", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitDriver.php#L73-L79
fxpio/composer-asset-plugin
Repository/Vcs/GitDriver.php
GitDriver.initializeRemotePath
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 (!is_writable(\dirname($this->repoDir))) { throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.\dirname($this->repoDir).'" directory is not writable by the current user.'); } if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) { throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.'); } $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs); // patched line, sync from local dir without modifying url if (!$skipSync && !$gitUtil->syncMirror($this->url, $this->repoDir)) { $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>'); } return $this->url; }
php
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 (!is_writable(\dirname($this->repoDir))) { throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.\dirname($this->repoDir).'" directory is not writable by the current user.'); } if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) { throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.'); } $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs); // patched line, sync from local dir without modifying url if (!$skipSync && !$gitUtil->syncMirror($this->url, $this->repoDir)) { $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>'); } return $this->url; }
[ "private", "function", "initializeRemotePath", "(", "$", "skipSync", ")", "{", "$", "this", "->", "repoDir", "=", "$", "this", "->", "config", "->", "get", "(", "'cache-vcs-dir'", ")", ".", "'/'", ".", "preg_replace", "(", "'{[^a-z0-9.]}i'", ",", "'-'", ",...
Initialize the remote path. @param bool $skipSync Check if sync must be skipped @return string
[ "Initialize", "the", "remote", "path", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitDriver.php#L88-L112
fxpio/composer-asset-plugin
Composer/ScriptHandler.php
ScriptHandler.deleteIgnoredFiles
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(), $package, null, $section); $manager->cleanup(); }
php
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(), $package, null, $section); $manager->cleanup(); }
[ "public", "static", "function", "deleteIgnoredFiles", "(", "PackageEvent", "$", "event", ")", "{", "if", "(", "null", "===", "$", "package", "=", "static", "::", "getLibraryPackage", "(", "$", "event", "->", "getOperation", "(", ")", ")", ")", "{", "return...
Remove ignored files of the installed package defined in the root package config section. @param PackageEvent $event
[ "Remove", "ignored", "files", "of", "the", "installed", "package", "defined", "in", "the", "root", "package", "config", "section", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Composer/ScriptHandler.php#L37-L46
fxpio/composer-asset-plugin
Composer/ScriptHandler.php
ScriptHandler.getConfig
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'); }
php
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'); }
[ "public", "static", "function", "getConfig", "(", "PackageEvent", "$", "event", ")", "{", "foreach", "(", "$", "event", "->", "getComposer", "(", ")", "->", "getPluginManager", "(", ")", "->", "getPlugins", "(", ")", "as", "$", "plugin", ")", "{", "if", ...
Get the plugin config. @param PackageEvent $event @return Config
[ "Get", "the", "plugin", "config", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Composer/ScriptHandler.php#L55-L64
fxpio/composer-asset-plugin
Composer/ScriptHandler.php
ScriptHandler.getLibraryPackage
protected static function getLibraryPackage(OperationInterface $operation) { $package = static::getOperationPackage($operation); $data = null; if ($package && !static::isAsset($package)) { $data = $package; } return $data; }
php
protected static function getLibraryPackage(OperationInterface $operation) { $package = static::getOperationPackage($operation); $data = null; if ($package && !static::isAsset($package)) { $data = $package; } return $data; }
[ "protected", "static", "function", "getLibraryPackage", "(", "OperationInterface", "$", "operation", ")", "{", "$", "package", "=", "static", "::", "getOperationPackage", "(", "$", "operation", ")", ";", "$", "data", "=", "null", ";", "if", "(", "$", "packag...
Get the library package (not asset package). @param OperationInterface $operation The operation @return null|PackageInterface Return NULL if the package is an asset
[ "Get", "the", "library", "package", "(", "not", "asset", "package", ")", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Composer/ScriptHandler.php#L83-L93
fxpio/composer-asset-plugin
Composer/ScriptHandler.php
ScriptHandler.getOperationPackage
protected static function getOperationPackage(OperationInterface $operation) { $data = null; if ($operation instanceof UpdateOperation) { $data = $operation->getTargetPackage(); } elseif ($operation instanceof InstallOperation) { $data = $operation->getPackage(); } return $data; }
php
protected static function getOperationPackage(OperationInterface $operation) { $data = null; if ($operation instanceof UpdateOperation) { $data = $operation->getTargetPackage(); } elseif ($operation instanceof InstallOperation) { $data = $operation->getPackage(); } return $data; }
[ "protected", "static", "function", "getOperationPackage", "(", "OperationInterface", "$", "operation", ")", "{", "$", "data", "=", "null", ";", "if", "(", "$", "operation", "instanceof", "UpdateOperation", ")", "{", "$", "data", "=", "$", "operation", "->", ...
Get the package defined in the composer operation. @param OperationInterface $operation The operation @return null|PackageInterface Return NULL if the operation is not INSTALL or UPDATE
[ "Get", "the", "package", "defined", "in", "the", "composer", "operation", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Composer/ScriptHandler.php#L102-L112
fxpio/composer-asset-plugin
Composer/ScriptHandler.php
ScriptHandler.isAsset
protected static function isAsset(PackageInterface $package) { foreach (Assets::getTypes() as $type) { $type = Assets::createType($type); if ($package->getType() === $type->getComposerType()) { return true; } } return false; }
php
protected static function isAsset(PackageInterface $package) { foreach (Assets::getTypes() as $type) { $type = Assets::createType($type); if ($package->getType() === $type->getComposerType()) { return true; } } return false; }
[ "protected", "static", "function", "isAsset", "(", "PackageInterface", "$", "package", ")", "{", "foreach", "(", "Assets", "::", "getTypes", "(", ")", "as", "$", "type", ")", "{", "$", "type", "=", "Assets", "::", "createType", "(", "$", "type", ")", "...
Check if the package is a asset package. @param PackageInterface $package The package instance @return bool
[ "Check", "if", "the", "package", "is", "a", "asset", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Composer/ScriptHandler.php#L121-L132
fxpio/composer-asset-plugin
Repository/FilterUtil.php
FilterUtil.getVersionConstraint
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->parseConstraints($normalizedVersion); }
php
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->parseConstraints($normalizedVersion); }
[ "public", "static", "function", "getVersionConstraint", "(", "$", "normalizedVersion", ",", "VersionParser", "$", "versionParser", ")", "{", "if", "(", "preg_match", "(", "'/^\\d+(\\.\\d+)(\\.\\d+)(\\.\\d+)\\-[A-Za-z0-9]+$/'", ",", "$", "normalizedVersion", ")", ")", "{...
Get the link constraint of normalized version. @param string $normalizedVersion The normalized version @param VersionParser $versionParser The version parser @return ConstraintInterface The constraint
[ "Get", "the", "link", "constraint", "of", "normalized", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/FilterUtil.php#L36-L43
fxpio/composer-asset-plugin
Repository/FilterUtil.php
FilterUtil.findFlagStabilityName
public static function findFlagStabilityName($level) { $stability = 'dev'; /** @var string $stabilityName */ /** @var int $stabilityLevel */ foreach (Package::$stabilities as $stabilityName => $stabilityLevel) { if ($stabilityLevel === $level) { $stability = $stabilityName; break; } } return $stability; }
php
public static function findFlagStabilityName($level) { $stability = 'dev'; /** @var string $stabilityName */ /** @var int $stabilityLevel */ foreach (Package::$stabilities as $stabilityName => $stabilityLevel) { if ($stabilityLevel === $level) { $stability = $stabilityName; break; } } return $stability; }
[ "public", "static", "function", "findFlagStabilityName", "(", "$", "level", ")", "{", "$", "stability", "=", "'dev'", ";", "/** @var string $stabilityName */", "/** @var int $stabilityLevel */", "foreach", "(", "Package", "::", "$", "stabilities", "as", "$", "stabilit...
Find the stability name with the stability value. @param int $level The stability level @return string The stability name
[ "Find", "the", "stability", "name", "with", "the", "stability", "value", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/FilterUtil.php#L52-L67
fxpio/composer-asset-plugin
Repository/FilterUtil.php
FilterUtil.findInlineStabilities
public static function findInlineStabilities(array $stabilities, VersionParser $versionParser) { $lowestStability = 'stable'; foreach ($stabilities as $stability) { $stability = $versionParser->normalizeStability($stability); $stability = $versionParser->parseStability($stability); if (Package::$stabilities[$stability] > Package::$stabilities[$lowestStability]) { $lowestStability = $stability; } } return $lowestStability; }
php
public static function findInlineStabilities(array $stabilities, VersionParser $versionParser) { $lowestStability = 'stable'; foreach ($stabilities as $stability) { $stability = $versionParser->normalizeStability($stability); $stability = $versionParser->parseStability($stability); if (Package::$stabilities[$stability] > Package::$stabilities[$lowestStability]) { $lowestStability = $stability; } } return $lowestStability; }
[ "public", "static", "function", "findInlineStabilities", "(", "array", "$", "stabilities", ",", "VersionParser", "$", "versionParser", ")", "{", "$", "lowestStability", "=", "'stable'", ";", "foreach", "(", "$", "stabilities", "as", "$", "stability", ")", "{", ...
Find the lowest stability. @param string[] $stabilities The list of stability @param VersionParser $versionParser The version parser @return string The lowest stability
[ "Find", "the", "lowest", "stability", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/FilterUtil.php#L77-L91
fxpio/composer-asset-plugin
Repository/FilterUtil.php
FilterUtil.getMinimumStabilityFlag
public static function getMinimumStabilityFlag(RootPackageInterface $package, Link $require) { $flags = $package->getStabilityFlags(); if (isset($flags[$require->getTarget()])) { return static::findFlagStabilityName($flags[$require->getTarget()]); } return $package->getPreferStable() ? 'stable' : $package->getMinimumStability(); }
php
public static function getMinimumStabilityFlag(RootPackageInterface $package, Link $require) { $flags = $package->getStabilityFlags(); if (isset($flags[$require->getTarget()])) { return static::findFlagStabilityName($flags[$require->getTarget()]); } return $package->getPreferStable() ? 'stable' : $package->getMinimumStability(); }
[ "public", "static", "function", "getMinimumStabilityFlag", "(", "RootPackageInterface", "$", "package", ",", "Link", "$", "require", ")", "{", "$", "flags", "=", "$", "package", "->", "getStabilityFlags", "(", ")", ";", "if", "(", "isset", "(", "$", "flags",...
Get the minimum stability for the require dependency defined in root package. @param RootPackageInterface $package The root package @param Link $require The require link defined in root package @return string The minimum stability defined in root package (in links or global project)
[ "Get", "the", "minimum", "stability", "for", "the", "require", "dependency", "defined", "in", "root", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/FilterUtil.php#L101-L110
fxpio/composer-asset-plugin
Repository/Vcs/GitBitbucketDriver.php
GitBitbucketDriver.initialize
public function initialize() { parent::initialize(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository); }
php
public function initialize() { parent::initialize(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository); }
[ "public", "function", "initialize", "(", ")", "{", "parent", "::", "initialize", "(", ")", ";", "$", "this", "->", "cache", "=", "new", "Cache", "(", "$", "this", "->", "io", ",", "$", "this", "->", "config", "->", "get", "(", "'cache-repo-dir'", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitBitbucketDriver.php#L32-L37
fxpio/composer-asset-plugin
Repository/Vcs/GitBitbucketDriver.php
GitBitbucketDriver.getComposerInformation
public function getComposerInformation($identifier) { $method = method_exists($this, 'getContentsWithOAuthCredentials') ? 'getContentsWithOAuthCredentials' : 'getContents'; return BitbucketUtil::getComposerInformation($this->cache, $this->infoCache, $this->getScheme(), $this->repoConfig, $identifier, $this->owner, $this->repository, $this, $method); }
php
public function getComposerInformation($identifier) { $method = method_exists($this, 'getContentsWithOAuthCredentials') ? 'getContentsWithOAuthCredentials' : 'getContents'; return BitbucketUtil::getComposerInformation($this->cache, $this->infoCache, $this->getScheme(), $this->repoConfig, $identifier, $this->owner, $this->repository, $this, $method); }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "$", "method", "=", "method_exists", "(", "$", "this", ",", "'getContentsWithOAuthCredentials'", ")", "?", "'getContentsWithOAuthCredentials'", ":", "'getContents'", ";", "return", "Bitb...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/GitBitbucketDriver.php#L42-L47
fxpio/composer-asset-plugin
Config/Config.php
Config.convertEnvValue
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); } elseif ($this->isJson($value)) { $value = $this->convertJson($value, $environmentVariable); } return $value; }
php
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); } elseif ($this->isJson($value)) { $value = $this->convertJson($value, $environmentVariable); } return $value; }
[ "private", "function", "convertEnvValue", "(", "$", "value", ",", "$", "environmentVariable", ")", "{", "$", "value", "=", "trim", "(", "trim", "(", "trim", "(", "$", "value", ",", "'\\''", ")", ",", "'\"'", ")", ")", ";", "if", "(", "$", "this", "...
Convert the value of environment variable into php variable. @param string $value The value of environment variable @param string $environmentVariable The environment variable name @return array|bool|int|string
[ "Convert", "the", "value", "of", "environment", "variable", "into", "php", "variable", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/Config.php#L101-L114
fxpio/composer-asset-plugin
Config/Config.php
Config.convertJson
private function convertJson($value, $environmentVariable) { $value = json_decode($value, true); if (json_last_error()) { throw new InvalidArgumentException(sprintf('The "%s" environment variable isn\'t a valid JSON', $environmentVariable)); } return $value; }
php
private function convertJson($value, $environmentVariable) { $value = json_decode($value, true); if (json_last_error()) { throw new InvalidArgumentException(sprintf('The "%s" environment variable isn\'t a valid JSON', $environmentVariable)); } return $value; }
[ "private", "function", "convertJson", "(", "$", "value", ",", "$", "environmentVariable", ")", "{", "$", "value", "=", "json_decode", "(", "$", "value", ",", "true", ")", ";", "if", "(", "json_last_error", "(", ")", ")", "{", "throw", "new", "InvalidArgu...
Convert the value of environment variable into a json array. @param string $value The value of environment variable @param string $environmentVariable The environment variable name @return array
[ "Convert", "the", "value", "of", "environment", "variable", "into", "a", "json", "array", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/Config.php#L186-L195
fxpio/composer-asset-plugin
Package/Version/VersionParser.php
VersionParser.parseStability
public static function parseStability($version) { $stability = parent::parseStability($version); return false !== strpos($version, '-patch') ? 'dev' : $stability; }
php
public static function parseStability($version) { $stability = parent::parseStability($version); return false !== strpos($version, '-patch') ? 'dev' : $stability; }
[ "public", "static", "function", "parseStability", "(", "$", "version", ")", "{", "$", "stability", "=", "parent", "::", "parseStability", "(", "$", "version", ")", ";", "return", "false", "!==", "strpos", "(", "$", "version", ",", "'-patch'", ")", "?", "...
Returns the stability of a version. @param string $version @return string
[ "Returns", "the", "stability", "of", "a", "version", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Package/Version/VersionParser.php#L30-L35
fxpio/composer-asset-plugin
Repository/Vcs/PerforceDriver.php
PerforceDriver.initialize
public function initialize() { $this->depot = $this->repoConfig['depot']; $this->branch = ''; if (!empty($this->repoConfig['branch'])) { $this->branch = $this->repoConfig['branch']; } $this->initAssetPerforce($this->repoConfig); $this->perforce->p4Login(); $this->perforce->checkStream(); $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->depot); return true; }
php
public function initialize() { $this->depot = $this->repoConfig['depot']; $this->branch = ''; if (!empty($this->repoConfig['branch'])) { $this->branch = $this->repoConfig['branch']; } $this->initAssetPerforce($this->repoConfig); $this->perforce->p4Login(); $this->perforce->checkStream(); $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->depot); return true; }
[ "public", "function", "initialize", "(", ")", "{", "$", "this", "->", "depot", "=", "$", "this", "->", "repoConfig", "[", "'depot'", "]", ";", "$", "this", "->", "branch", "=", "''", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "repoConfig...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/PerforceDriver.php#L43-L61
fxpio/composer-asset-plugin
Repository/Vcs/PerforceDriver.php
PerforceDriver.getComposerInformation
public function getComposerInformation($identifier) { $this->infoCache[$identifier] = Util::readCache($this->infoCache, $this->cache, $this->repoConfig['asset-type'], $identifier, true); if (!isset($this->infoCache[$identifier])) { $composer = $this->getComposerContent($identifier); Util::writeCache($this->cache, $this->repoConfig['asset-type'], $identifier, $composer, true); $this->infoCache[$identifier] = $composer; } return $this->infoCache[$identifier]; }
php
public function getComposerInformation($identifier) { $this->infoCache[$identifier] = Util::readCache($this->infoCache, $this->cache, $this->repoConfig['asset-type'], $identifier, true); if (!isset($this->infoCache[$identifier])) { $composer = $this->getComposerContent($identifier); Util::writeCache($this->cache, $this->repoConfig['asset-type'], $identifier, $composer, true); $this->infoCache[$identifier] = $composer; } return $this->infoCache[$identifier]; }
[ "public", "function", "getComposerInformation", "(", "$", "identifier", ")", "{", "$", "this", "->", "infoCache", "[", "$", "identifier", "]", "=", "Util", "::", "readCache", "(", "$", "this", "->", "infoCache", ",", "$", "this", "->", "cache", ",", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/PerforceDriver.php#L66-L78
fxpio/composer-asset-plugin
Repository/Vcs/PerforceDriver.php
PerforceDriver.getComposerContent
protected function getComposerContent($identifier) { $composer = $this->perforce->getComposerInformation($identifier); if (empty($composer) || !\is_array($composer)) { $composer = array('_nonexistent_package' => true); } return $composer; }
php
protected function getComposerContent($identifier) { $composer = $this->perforce->getComposerInformation($identifier); if (empty($composer) || !\is_array($composer)) { $composer = array('_nonexistent_package' => true); } return $composer; }
[ "protected", "function", "getComposerContent", "(", "$", "identifier", ")", "{", "$", "composer", "=", "$", "this", "->", "perforce", "->", "getComposerInformation", "(", "$", "identifier", ")", ";", "if", "(", "empty", "(", "$", "composer", ")", "||", "!"...
Get composer content. @param string $identifier @return array
[ "Get", "composer", "content", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Vcs/PerforceDriver.php#L87-L96
fxpio/composer-asset-plugin
Config/ConfigBuilder.php
ConfigBuilder.validate
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::$deprecatedOptions as $new => $old) { if (\array_key_exists($old, $extra)) { $io->write(sprintf('<warning>The "extra.%s" option is deprecated, use the "config.fxp-asset.%s" option</warning>', $old, $new)); } } } }
php
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::$deprecatedOptions as $new => $old) { if (\array_key_exists($old, $extra)) { $io->write(sprintf('<warning>The "extra.%s" option is deprecated, use the "config.fxp-asset.%s" option</warning>', $old, $new)); } } } }
[ "public", "static", "function", "validate", "(", "IOInterface", "$", "io", ",", "RootPackageInterface", "$", "package", ",", "$", "commandName", "=", "null", ")", "{", "if", "(", "null", "===", "$", "commandName", "||", "\\", "in_array", "(", "$", "command...
Validate the config of root package. @param IOInterface $io The composer input/output @param RootPackageInterface $package The root package @param string $commandName The command name
[ "Validate", "the", "config", "of", "root", "package", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/ConfigBuilder.php#L51-L62
fxpio/composer-asset-plugin
Config/ConfigBuilder.php
ConfigBuilder.build
public static function build(Composer $composer, $io = null) { $config = self::getConfigBase($composer, $io); $config = self::injectDeprecatedConfig($config, (array) $composer->getPackage()->getExtra()); return new Config($config); }
php
public static function build(Composer $composer, $io = null) { $config = self::getConfigBase($composer, $io); $config = self::injectDeprecatedConfig($config, (array) $composer->getPackage()->getExtra()); return new Config($config); }
[ "public", "static", "function", "build", "(", "Composer", "$", "composer", ",", "$", "io", "=", "null", ")", "{", "$", "config", "=", "self", "::", "getConfigBase", "(", "$", "composer", ",", "$", "io", ")", ";", "$", "config", "=", "self", "::", "...
Build the config of plugin. @param Composer $composer The composer @param null|IOInterface $io The composer input/output @return Config
[ "Build", "the", "config", "of", "plugin", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/ConfigBuilder.php#L72-L78
fxpio/composer-asset-plugin
Config/ConfigBuilder.php
ConfigBuilder.injectDeprecatedConfig
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 $config; }
php
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 $config; }
[ "private", "static", "function", "injectDeprecatedConfig", "(", "array", "$", "config", ",", "array", "$", "extra", ")", "{", "foreach", "(", "self", "::", "$", "deprecatedOptions", "as", "$", "key", "=>", "$", "deprecatedKey", ")", "{", "if", "(", "\\", ...
Inject the deprecated keys in config if the config keys are not present. @param array $config The config @param array $extra The root package extra section @return array
[ "Inject", "the", "deprecated", "keys", "in", "config", "if", "the", "config", "keys", "are", "not", "present", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/ConfigBuilder.php#L88-L97
fxpio/composer-asset-plugin
Config/ConfigBuilder.php
ConfigBuilder.getGlobalConfig
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']['fxp-asset']) && \is_array($data['config']['fxp-asset'])) { $config = $data['config']['fxp-asset']; if ($io instanceof IOInterface && $io->isDebug()) { $io->writeError('Loading fxp-asset config in file '.$file->getPath()); } } } return $config; }
php
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']['fxp-asset']) && \is_array($data['config']['fxp-asset'])) { $config = $data['config']['fxp-asset']; if ($io instanceof IOInterface && $io->isDebug()) { $io->writeError('Loading fxp-asset config in file '.$file->getPath()); } } } return $config; }
[ "private", "static", "function", "getGlobalConfig", "(", "Composer", "$", "composer", ",", "$", "filename", ",", "$", "io", "=", "null", ")", "{", "$", "home", "=", "self", "::", "getComposerHome", "(", "$", "composer", ")", ";", "$", "file", "=", "new...
Get the data of the global config. @param Composer $composer The composer @param string $filename The filename @param null|IOInterface $io The composer input/output @return array
[ "Get", "the", "data", "of", "the", "global", "config", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/ConfigBuilder.php#L128-L147
fxpio/composer-asset-plugin
Config/ConfigBuilder.php
ConfigBuilder.getComposerHome
private static function getComposerHome(Composer $composer) { return null !== $composer->getConfig() && $composer->getConfig()->has('home') ? $composer->getConfig()->get('home') : ''; }
php
private static function getComposerHome(Composer $composer) { return null !== $composer->getConfig() && $composer->getConfig()->has('home') ? $composer->getConfig()->get('home') : ''; }
[ "private", "static", "function", "getComposerHome", "(", "Composer", "$", "composer", ")", "{", "return", "null", "!==", "$", "composer", "->", "getConfig", "(", ")", "&&", "$", "composer", "->", "getConfig", "(", ")", "->", "has", "(", "'home'", ")", "?...
Get the home directory of composer. @param Composer $composer The composer @return string
[ "Get", "the", "home", "directory", "of", "composer", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Config/ConfigBuilder.php#L156-L161
fxpio/composer-asset-plugin
Converter/BowerPackageConverter.php
BowerPackageConverter.getMapKeys
protected function getMapKeys() { $assetType = $this->assetType; return array( 'name' => array('name', function ($value) use ($assetType) { return $assetType->formatComposerName($value); }), 'type' => array('type', function () use ($assetType) { return $assetType->getComposerType(); }), 'version' => array('version', function ($value) use ($assetType) { return $assetType->getVersionConverter()->convertVersion($value); }), 'version_normalized' => 'version_normalized', 'description' => 'description', 'keywords' => 'keywords', 'license' => 'license', 'time' => 'time', 'bin' => 'bin', ); }
php
protected function getMapKeys() { $assetType = $this->assetType; return array( 'name' => array('name', function ($value) use ($assetType) { return $assetType->formatComposerName($value); }), 'type' => array('type', function () use ($assetType) { return $assetType->getComposerType(); }), 'version' => array('version', function ($value) use ($assetType) { return $assetType->getVersionConverter()->convertVersion($value); }), 'version_normalized' => 'version_normalized', 'description' => 'description', 'keywords' => 'keywords', 'license' => 'license', 'time' => 'time', 'bin' => 'bin', ); }
[ "protected", "function", "getMapKeys", "(", ")", "{", "$", "assetType", "=", "$", "this", "->", "assetType", ";", "return", "array", "(", "'name'", "=>", "array", "(", "'name'", ",", "function", "(", "$", "value", ")", "use", "(", "$", "assetType", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/BowerPackageConverter.php#L24-L45
fxpio/composer-asset-plugin
Converter/BowerPackageConverter.php
BowerPackageConverter.convertDependency
protected function convertDependency($dependency, $version, array &$vcsRepos, array $composer) { list($dependency, $version) = $this->checkGithubRepositoryVersion($dependency, $version); return parent::convertDependency($dependency, $version, $vcsRepos, $composer); }
php
protected function convertDependency($dependency, $version, array &$vcsRepos, array $composer) { list($dependency, $version) = $this->checkGithubRepositoryVersion($dependency, $version); return parent::convertDependency($dependency, $version, $vcsRepos, $composer); }
[ "protected", "function", "convertDependency", "(", "$", "dependency", ",", "$", "version", ",", "array", "&", "$", "vcsRepos", ",", "array", "$", "composer", ")", "{", "list", "(", "$", "dependency", ",", "$", "version", ")", "=", "$", "this", "->", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/BowerPackageConverter.php#L62-L67
fxpio/composer-asset-plugin
Converter/BowerPackageConverter.php
BowerPackageConverter.checkGithubRepositoryVersion
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://github.com/'.substr($version, 0, $pos).'.git'.$realVersion; } return array($dependency, $version); }
php
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://github.com/'.substr($version, 0, $pos).'.git'.$realVersion; } return array($dependency, $version); }
[ "protected", "function", "checkGithubRepositoryVersion", "(", "$", "dependency", ",", "$", "version", ")", "{", "if", "(", "preg_match", "(", "'/^[A-Za-z0-9\\-_]+\\/[A-Za-z0-9\\-_.]+/'", ",", "$", "version", ")", ")", "{", "$", "pos", "=", "strpos", "(", "$", ...
Checks if the version is a Github alias version of repository. @param string $dependency The dependency @param string $version The version @return string[] The new dependency and the new version
[ "Checks", "if", "the", "version", "is", "a", "Github", "alias", "version", "of", "repository", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Converter/BowerPackageConverter.php#L77-L87
fxpio/composer-asset-plugin
FxpAssetPlugin.php
FxpAssetPlugin.activate
public function activate(Composer $composer, IOInterface $io) { $this->config = ConfigBuilder::build($composer, $io); if ($this->config->get('enabled', true)) { /** @var InstalledFilesystemRepository $installedRepository */ $installedRepository = $composer->getRepositoryManager()->getLocalRepository(); $this->composer = $composer; $this->io = $io; $this->packageFilter = new VcsPackageFilter($this->config, $composer->getPackage(), $composer->getInstallationManager(), $installedRepository); $this->assetRepositoryManager = new AssetRepositoryManager($io, $composer->getRepositoryManager(), $this->config, $this->packageFilter); $this->assetRepositoryManager->setResolutionManager(new ResolutionManager($this->config->getArray('resolutions'))); AssetPlugin::addRegistryRepositories($this->assetRepositoryManager, $this->packageFilter, $this->config); AssetPlugin::setVcsTypeRepositories($composer->getRepositoryManager()); $this->assetRepositoryManager->addRepositories($this->config->getArray('repositories')); AssetPlugin::addInstallers($this->config, $composer, $io); } }
php
public function activate(Composer $composer, IOInterface $io) { $this->config = ConfigBuilder::build($composer, $io); if ($this->config->get('enabled', true)) { /** @var InstalledFilesystemRepository $installedRepository */ $installedRepository = $composer->getRepositoryManager()->getLocalRepository(); $this->composer = $composer; $this->io = $io; $this->packageFilter = new VcsPackageFilter($this->config, $composer->getPackage(), $composer->getInstallationManager(), $installedRepository); $this->assetRepositoryManager = new AssetRepositoryManager($io, $composer->getRepositoryManager(), $this->config, $this->packageFilter); $this->assetRepositoryManager->setResolutionManager(new ResolutionManager($this->config->getArray('resolutions'))); AssetPlugin::addRegistryRepositories($this->assetRepositoryManager, $this->packageFilter, $this->config); AssetPlugin::setVcsTypeRepositories($composer->getRepositoryManager()); $this->assetRepositoryManager->addRepositories($this->config->getArray('repositories')); AssetPlugin::addInstallers($this->config, $composer, $io); } }
[ "public", "function", "activate", "(", "Composer", "$", "composer", ",", "IOInterface", "$", "io", ")", "{", "$", "this", "->", "config", "=", "ConfigBuilder", "::", "build", "(", "$", "composer", ",", "$", "io", ")", ";", "if", "(", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/FxpAssetPlugin.php#L80-L100
fxpio/composer-asset-plugin
FxpAssetPlugin.php
FxpAssetPlugin.onPluginCommand
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)) { $this->packageFilter->setEnabled(false); } } }
php
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)) { $this->packageFilter->setEnabled(false); } } }
[ "public", "function", "onPluginCommand", "(", "CommandEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "config", "->", "get", "(", "'enabled'", ",", "true", ")", ")", "{", "ConfigBuilder", "::", "validate", "(", "$", "this", "->", "io", ",...
Disable the package filter for all command, but for install and update command. @param CommandEvent $event
[ "Disable", "the", "package", "filter", "for", "all", "command", "but", "for", "install", "and", "update", "command", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/FxpAssetPlugin.php#L107-L116
fxpio/composer-asset-plugin
FxpAssetPlugin.php
FxpAssetPlugin.onPreDependenciesSolving
public function onPreDependenciesSolving(InstallerEvent $event) { if ($this->config->get('enabled', true)) { $this->assetRepositoryManager->setPool($event->getPool()); } }
php
public function onPreDependenciesSolving(InstallerEvent $event) { if ($this->config->get('enabled', true)) { $this->assetRepositoryManager->setPool($event->getPool()); } }
[ "public", "function", "onPreDependenciesSolving", "(", "InstallerEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "config", "->", "get", "(", "'enabled'", ",", "true", ")", ")", "{", "$", "this", "->", "assetRepositoryManager", "->", "setPool", ...
Add pool in asset repository manager. @param InstallerEvent $event
[ "Add", "pool", "in", "asset", "repository", "manager", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/FxpAssetPlugin.php#L123-L128
fxpio/composer-asset-plugin
Repository/Util.php
Util.addRepository
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, $repos, $name, $repo, $pool); }
php
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, $repos, $name, $repo, $pool); }
[ "public", "static", "function", "addRepository", "(", "IOInterface", "$", "io", ",", "RepositoryManager", "$", "rm", ",", "array", "&", "$", "repos", ",", "$", "name", ",", "array", "$", "repoConfig", ",", "Pool", "$", "pool", "=", "null", ")", "{", "$...
Add repository config. The instance of repository is returned if the repository in't added in the pool. @param IOInterface $io The IO instance @param RepositoryManager $rm The repository manager @param array $repos The list of already repository added (passed by reference) @param string $name The name of the new repository @param array $repoConfig The config of the new repository @param null|Pool $pool The pool @return null|RepositoryInterface
[ "Add", "repository", "config", ".", "The", "instance", "of", "repository", "is", "returned", "if", "the", "repository", "in", "t", "added", "in", "the", "pool", "." ]
train
https://github.com/fxpio/composer-asset-plugin/blob/6d5cfd0a4f4c3e167d2048eb8f5347309a6bbe10/Repository/Util.php#L39-L45