_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q13500
SessionHandler.close
train
public function close() { $id = session_id(); // Make sure the session is unlocked and the expiration time is updated, // even if the write did not occur if ($this->openSessionId !== $id || !$this->sessionWritten) {
php
{ "resource": "" }
q13501
SessionHandler.read
train
public function read($id) { $this->openSessionId = $id; // PHP expects an empty string to be returned from this method if no // data is retrieved $this->dataRead = ''; // Get session data using the selected locking strategy $item = $this->connection->read($this->formatId($id)); // Return the data if it is not expired. If it is expired, remove it if (isset($item['expires'])
php
{ "resource": "" }
q13502
SessionHandler.write
train
public function write($id, $data) { $changed = $id !== $this->openSessionId || $data !== $this->dataRead; $this->openSessionId = $id;
php
{ "resource": "" }
q13503
SessionHandler.destroy
train
public function destroy($id) { $this->openSessionId = $id; // Delete the session data using the selected locking strategy $this->sessionWritten
php
{ "resource": "" }
q13504
AbstractUploader.isEof
train
private function isEof($seekable) { return $seekable ?
php
{ "resource": "" }
q13505
AbstractUploader.determineSource
train
private function determineSource($source) { // Use the contents of a file as the data source. if (is_string($source)) { $source = Psr7\try_fopen($source, 'r'); } // Create a source stream. $stream = Psr7\stream_for($source);
php
{ "resource": "" }
q13506
PollyClient.createSynthesizeSpeechPreSignedUrl
train
public function createSynthesizeSpeechPreSignedUrl(array $args) { $uri = new Uri($this->getEndpoint()); $uri = $uri->withPath('/v1/speech'); // Formatting parameters follows rest-json protocol $this->formatter = $this->formatter ?: new JsonBody($this->getApi()); $queryArray = json_decode( $this->formatter->build( $this->getApi()->getOperation('SynthesizeSpeech')->getInput(), $args ), true ); // Mocking a 'GET' request in pre-signing the Url
php
{ "resource": "" }
q13507
ClassAnnotationUpdater.update
train
public function update() { // copy the code into memory $backup = file($this->reflection->getFileName()); list($preamble, $class) = $this->splitClassFile($backup); $preamble = $this->stripOutExistingDocBlock($preamble); $preamble .= $this->buildUpdatedDocBlock(); if ($this->writeClassFile(implode(PHP_EOL, [$preamble, $class]))
php
{ "resource": "" }
q13508
TimestampShape.format
train
public static function format($value, $format) { if ($value instanceof \DateTime) { $value = $value->getTimestamp(); } elseif (is_string($value)) { $value = strtotime($value); } elseif (!is_int($value)) { throw new \InvalidArgumentException('Unable to handle the provided' . ' timestamp type: ' . gettype($value)); } switch ($format) { case 'iso8601':
php
{ "resource": "" }
q13509
SignatureProvider.resolve
train
public static function resolve(callable $provider, $version, $service, $region) { $result = $provider($version, $service, $region); if ($result instanceof SignatureInterface) { return $result; } throw new UnresolvedSignatureException(
php
{ "resource": "" }
q13510
SignatureProvider.memoize
train
public static function memoize(callable $provider) { $cache = []; return function ($version, $service, $region) use (&$cache, $provider) { $key = "($version)($service)($region)"; if (!isset($cache[$key])) {
php
{ "resource": "" }
q13511
SesClient.generateSmtpPassword
train
public static function generateSmtpPassword(CredentialsInterface $creds) { static $version = "\x02"; static $algo = 'sha256'; static $message = 'SendRawEmail';
php
{ "resource": "" }
q13512
CommandPool.batch
train
public static function batch( AwsClientInterface $client, $commands, array $config = [] ) { $results = []; self::cmpCallback($config, 'fulfilled', $results); self::cmpCallback($config, 'rejected', $results); return (new self($client, $commands, $config))
php
{ "resource": "" }
q13513
CommandPool.cmpCallback
train
private static function cmpCallback(array &$config, $name, array &$results) { if (!isset($config[$name])) { $config[$name] = function ($v, $k) use (&$results) {
php
{ "resource": "" }
q13514
EndpointDiscoveryMiddleware.parseEndpoint
train
private function parseEndpoint($endpoint) { $parsed = parse_url($endpoint); // parse_url() will correctly parse full URIs with schemes if (isset($parsed['host'])) { return $parsed; } // parse_url() will put host & path in 'path' if scheme is not provided if (isset($parsed['path'])) { $split = explode('/', $parsed['path'], 2); $parsed['host'] = $split[0]; if (isset($split[1])) {
php
{ "resource": "" }
q13515
MachineLearningClient.predictEndpoint
train
private function predictEndpoint() { return static function (callable $handler) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler) { if
php
{ "resource": "" }
q13516
S3Client.isBucketDnsCompatible
train
public static function isBucketDnsCompatible($bucket) { $bucketLen = strlen($bucket); return ($bucketLen >= 3 && $bucketLen <= 63)
php
{ "resource": "" }
q13517
S3Client.getLocationConstraintMiddleware
train
private function getLocationConstraintMiddleware() { $region = $this->getRegion(); return static function (callable $handler) use ($region) { return function (Command $command, $request = null) use ($handler, $region) { if ($command->getName() === 'CreateBucket') { $locationConstraint = isset($command['CreateBucketConfiguration']['LocationConstraint']) ? $command['CreateBucketConfiguration']['LocationConstraint'] : null;
php
{ "resource": "" }
q13518
S3Client.getSaveAsParameter
train
private function getSaveAsParameter() { return static function (callable $handler) { return function (Command $command, $request = null) use ($handler) { if ($command->getName()
php
{ "resource": "" }
q13519
S3Client.getHeadObjectMiddleware
train
private function getHeadObjectMiddleware() { return static function (callable $handler) { return function ( CommandInterface $command, RequestInterface $request = null
php
{ "resource": "" }
q13520
MultipartUploader.decorateWithHashes
train
private function decorateWithHashes(Stream $stream, array &$data) { // Decorate source with a hashing stream $hash = new PhpHash('sha256'); return new HashingStream($stream, $hash,
php
{ "resource": "" }
q13521
HandlerList.appendInit
train
public function appendInit(callable $middleware, $name =
php
{ "resource": "" }
q13522
HandlerList.prependInit
train
public function prependInit(callable $middleware, $name =
php
{ "resource": "" }
q13523
HandlerList.appendValidate
train
public function appendValidate(callable $middleware, $name =
php
{ "resource": "" }
q13524
HandlerList.prependValidate
train
public function prependValidate(callable $middleware, $name =
php
{ "resource": "" }
q13525
HandlerList.appendBuild
train
public function appendBuild(callable $middleware, $name =
php
{ "resource": "" }
q13526
HandlerList.prependBuild
train
public function prependBuild(callable $middleware, $name =
php
{ "resource": "" }
q13527
HandlerList.appendSign
train
public function appendSign(callable $middleware, $name =
php
{ "resource": "" }
q13528
HandlerList.prependSign
train
public function prependSign(callable $middleware, $name =
php
{ "resource": "" }
q13529
HandlerList.appendAttempt
train
public function appendAttempt(callable $middleware, $name =
php
{ "resource": "" }
q13530
HandlerList.prependAttempt
train
public function prependAttempt(callable $middleware, $name =
php
{ "resource": "" }
q13531
HandlerList.before
train
public function before($findName, $withName, callable $middleware) {
php
{ "resource": "" }
q13532
HandlerList.remove
train
public function remove($nameOrInstance) { if (is_callable($nameOrInstance)) { $this->removeByInstance($nameOrInstance); }
php
{ "resource": "" }
q13533
HandlerList.sortMiddleware
train
private function sortMiddleware() { $this->sorted = []; if (!$this->interposeFn) { foreach ($this->steps as $step) { foreach ($step as $fn) { $this->sorted[] = $fn[0]; } } return; } $ifn = $this->interposeFn; // Interpose the interposeFn into the handler stack.
php
{ "resource": "" }
q13534
HandlerList.add
train
private function add($step, $name, callable $middleware, $prepend = false) { $this->sorted = null; if ($prepend) { $this->steps[$step][] = [$middleware, $name]; } else {
php
{ "resource": "" }
q13535
ResultPaginator.each
train
public function each(callable $handleResult) { return Promise\coroutine(function () use ($handleResult) { $nextToken = null; do { $command = $this->createNextCommand($this->args, $nextToken); $result = (yield $this->client->executeAsync($command));
php
{ "resource": "" }
q13536
ResultPaginator.search
train
public function search($expression) { // Apply JMESPath expression on each result, but as a flat sequence.
php
{ "resource": "" }
q13537
ShapeMap.resolve
train
public function resolve(array $shapeRef) { $shape = $shapeRef['shape']; if (!isset($this->definitions[$shape])) { throw new \InvalidArgumentException('Shape not found: ' . $shape); } $isSimple = count($shapeRef) == 1; if ($isSimple && isset($this->simple[$shape])) { return $this->simple[$shape]; }
php
{ "resource": "" }
q13538
EncryptionTrait.encrypt
train
protected function encrypt( Stream $plaintext, array $cipherOptions, MaterialsProvider $provider, MetadataEnvelope $envelope ) { $materialsDescription = $provider->getMaterialsDescription(); $cipherOptions = array_intersect_key( $cipherOptions, self::$allowedOptions ); if (empty($cipherOptions['Cipher'])) { throw new \InvalidArgumentException('An encryption cipher must be' . ' specified in the "cipher_options".'); } if (!self::isSupportedCipher($cipherOptions['Cipher'])) { throw new \InvalidArgumentException('The cipher requested is not' . ' supported by the SDK.'); } if (empty($cipherOptions['KeySize'])) { $cipherOptions['KeySize'] = 256; } if (!is_int($cipherOptions['KeySize'])) { throw new \InvalidArgumentException('The cipher "KeySize" must be' . ' an integer.'); } if (!MaterialsProvider::isSupportedKeySize( $cipherOptions['KeySize'] )) { throw new \InvalidArgumentException('The cipher "KeySize" requested' . ' is not supported by AES (128, 192, or 256).'); } $cipherOptions['Iv'] = $provider->generateIv( $this->getCipherOpenSslName( $cipherOptions['Cipher'], $cipherOptions['KeySize'] ) ); $cek = $provider->generateCek($cipherOptions['KeySize']); list($encryptingStream, $aesName) = $this->getEncryptingStream( $plaintext, $cek, $cipherOptions ); // Populate envelope data $envelope[MetadataEnvelope::CONTENT_KEY_V2_HEADER] = $provider->encryptCek( $cek, $materialsDescription
php
{ "resource": "" }
q13539
PartitionEndpointProvider.getPartition
train
public function getPartition($region, $service) { foreach ($this->partitions as $partition) { if ($partition->isRegionMatch($region, $service)) {
php
{ "resource": "" }
q13540
PartitionEndpointProvider.getPartitionByName
train
public function getPartitionByName($name) { foreach ($this->partitions as $partition) { if ($name === $partition->getName()) {
php
{ "resource": "" }
q13541
PartitionEndpointProvider.mergePrefixData
train
public static function mergePrefixData($data, $prefixData) { $prefixGroups = $prefixData['prefix-groups']; foreach ($data["partitions"] as $index => $partition) { foreach ($prefixGroups as $current => $old) { $serviceData = Env::search("services.{$current}", $partition);
php
{ "resource": "" }
q13542
CredentialProvider.env
train
public static function env() { return function () { // Use credentials from environment variables, if available $key = getenv(self::ENV_KEY); $secret = getenv(self::ENV_SECRET); if ($key &&
php
{ "resource": "" }
q13543
CredentialProvider.ini
train
public static function ini($profile = null, $filename = null) { $filename = $filename ?: (self::getHomeDir() . '/.aws/credentials'); $profile = $profile ?: (getenv(self::ENV_PROFILE) ?: 'default'); return function () use ($profile, $filename) { if (!is_readable($filename)) { return self::reject("Cannot read credentials from $filename"); } $data = \Aws\parse_ini_file($filename, true, INI_SCANNER_RAW); if ($data === false) { return self::reject("Invalid credentials file: $filename"); } if (!isset($data[$profile])) { return self::reject("'$profile' not found in credentials file"); } if (!isset($data[$profile]['aws_access_key_id']) || !isset($data[$profile]['aws_secret_access_key']) ) { return self::reject("No credentials present in INI profile " . "'$profile' ($filename)"); }
php
{ "resource": "" }
q13544
CredentialProvider.process
train
public static function process($profile = null, $filename = null) { $filename = $filename ?: (self::getHomeDir() . '/.aws/credentials'); $profile = $profile ?: (getenv(self::ENV_PROFILE) ?: 'default'); return function () use ($profile, $filename) { if (!is_readable($filename)) { return self::reject("Cannot read process credentials from $filename"); } $data = \Aws\parse_ini_file($filename, true, INI_SCANNER_RAW); if ($data === false) { return self::reject("Invalid credentials file: $filename"); } if (!isset($data[$profile])) { return self::reject("'$profile' not found in credentials file"); } if (!isset($data[$profile]['credential_process']) ) { return self::reject("No credential_process present in INI profile " . "'$profile' ($filename)"); } $credentialProcess = $data[$profile]['credential_process']; $json = shell_exec($credentialProcess);
php
{ "resource": "" }
q13545
Middleware.requestBuilder
train
public static function requestBuilder(callable $serializer) { return function (callable $handler) use ($serializer) { return function (CommandInterface $command) use
php
{ "resource": "" }
q13546
Middleware.signer
train
public static function signer(callable $credProvider, callable $signatureFunction) { return function (callable $handler) use ($signatureFunction, $credProvider) { return function ( CommandInterface $command, RequestInterface $request ) use ($handler, $signatureFunction, $credProvider) { $signer = $signatureFunction($command); return $credProvider()->then( function (CredentialsInterface $creds)
php
{ "resource": "" }
q13547
Middleware.tap
train
public static function tap(callable $fn) { return function (callable $handler) use ($fn) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler,
php
{ "resource": "" }
q13548
Middleware.invocationId
train
public static function invocationId() { return function (callable $handler) { return function ( CommandInterface $command, RequestInterface $request ) use ($handler){ return $handler($command, $request->withHeader(
php
{ "resource": "" }
q13549
Middleware.contentType
train
public static function contentType(array $operations) { return function (callable $handler) use ($operations) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler, $operations) { if (!$request->hasHeader('Content-Type') && in_array($command->getName(), $operations, true) && ($uri = $request->getBody()->getMetadata('uri')) ) {
php
{ "resource": "" }
q13550
Middleware.history
train
public static function history(History $history) { return function (callable $handler) use ($history) { return function ( CommandInterface $command, RequestInterface $request = null ) use ($handler, $history) { $ticket = $history->start($command, $request); return $handler($command, $request) ->then( function ($result) use ($history, $ticket) { $history->finish($ticket, $result); return $result; },
php
{ "resource": "" }
q13551
Middleware.mapRequest
train
public static function mapRequest(callable $f) { return function (callable $handler) use ($f) { return function ( CommandInterface $command, RequestInterface $request = null
php
{ "resource": "" }
q13552
Middleware.mapCommand
train
public static function mapCommand(callable $f) { return function (callable $handler) use ($f) { return function ( CommandInterface $command, RequestInterface $request = null
php
{ "resource": "" }
q13553
Middleware.mapResult
train
public static function mapResult(callable $f) { return function (callable $handler) use ($f) { return function ( CommandInterface $command, RequestInterface $request = null
php
{ "resource": "" }
q13554
AbstractUploadManager.determineState
train
private function determineState() { // If the state was provided via config, then just use it. if ($this->config['state'] instanceof UploadState) { return $this->config['state']; } // Otherwise, construct a new state from the provided identifiers. $required = $this->info['id']; $id = [$required['upload_id'] => null]; unset($required['upload_id']); foreach ($required as $key => $param) { if (!$this->config[$key]) { throw new IAE('You must provide a value for "' . $key . '" in '
php
{ "resource": "" }
q13555
S3ClientTrait.checkExistenceWithCommand
train
private function checkExistenceWithCommand(CommandInterface $command) { try { $this->execute($command); return true; } catch (S3Exception $e) { if ($e->getAwsErrorCode() == 'AccessDenied') {
php
{ "resource": "" }
q13556
MultipartUploader.decorateWithHashes
train
private function decorateWithHashes(Stream $stream, array &$data) { // Make sure that a tree hash is calculated. $stream = new HashingStream($stream, new TreeHash(), function ($result) use (&$data) {
php
{ "resource": "" }
q13557
MultipartUploader.parseRange
train
private static function parseRange($range, $partSize) { // Strip away the prefix and suffix. if (strpos($range, 'bytes') !== false) { $range = substr($range, 6, -2); } // Split that range into it's parts. list($firstByte, $lastByte) = explode('-',
php
{ "resource": "" }
q13558
JsonBody.build
train
public function build(Shape $shape, array $args) { $result
php
{ "resource": "" }
q13559
PhpHash.getContext
train
private function getContext() { if (!$this->context) { $key = isset($this->options['key']) ? $this->options['key'] : null; $this->context = hash_init( $this->algo,
php
{ "resource": "" }
q13560
Waiter.getArgsForAttempt
train
private function getArgsForAttempt($attempt) { $args = $this->args; // Determine the delay. $delay = ($attempt === 1) ? $this->config['initDelay'] : $this->config['delay']; if (is_callable($delay)) { $delay = $delay($attempt); }
php
{ "resource": "" }
q13561
Waiter.determineState
train
private function determineState($result) { foreach ($this->config['acceptors'] as $acceptor) { $matcher = 'matches' . ucfirst($acceptor['matcher']);
php
{ "resource": "" }
q13562
Transfer.promise
train
public function promise() { // If the promise has been created, just return it. if (!$this->promise) { // Create an upload/download promise for the transfer. $this->promise = $this->sourceMetadata['scheme'] === 'file'
php
{ "resource": "" }
q13563
Transfer.getS3Args
train
private function getS3Args($path) { $parts = explode('/', str_replace('s3://', '', $path), 2); $args = ['Bucket' => $parts[0]];
php
{ "resource": "" }
q13564
ClientResolver.resolve
train
public function resolve(array $args, HandlerList $list) { $args['config'] = []; foreach ($this->argDefinitions as $key => $a) { // Add defaults, validate required values, and skip if not set. if (!isset($args[$key])) { if (isset($a['default'])) { // Merge defaults in when not present. if (is_callable($a['default']) && ( is_array($a['default']) || $a['default'] instanceof \Closure ) ) { $args[$key] = $a['default']($args); } else {
php
{ "resource": "" }
q13565
ClientResolver.getArgMessage
train
private function getArgMessage($name, $args = [], $useRequired = false) { $arg = $this->argDefinitions[$name]; $msg = ''; $modifiers = []; if (isset($arg['valid'])) { $modifiers[] = implode('|', $arg['valid']); } if (isset($arg['choice'])) { $modifiers[] = 'One of ' . implode(', ', $arg['choice']); } if ($modifiers) { $msg .= '(' . implode('; ', $modifiers) . ')'; } $msg = wordwrap("{$name}: {$msg}", 75, "\n ");
php
{ "resource": "" }
q13566
ClientResolver.invalidType
train
private function invalidType($name, $provided) { $expected = implode('|', $this->argDefinitions[$name]['valid']); $msg = "Invalid configuration value " . "provided for \"{$name}\". Expected {$expected}, but got "
php
{ "resource": "" }
q13567
ClientResolver.throwRequired
train
private function throwRequired(array $args) { $missing = []; foreach ($this->argDefinitions as $k => $a) { if (empty($a['required']) || isset($a['default']) || isset($args[$k]) ) { continue; } $missing[] =
php
{ "resource": "" }
q13568
AbstractMonitoringMiddleware.sendEventData
train
private function sendEventData(array $eventData) { $socket = $this->prepareSocket(); $datagram = json_encode($eventData); $result = socket_write($socket, $datagram, strlen($datagram));
php
{ "resource": "" }
q13569
AbstractMonitoringMiddleware.unwrappedOptions
train
private function unwrappedOptions() { if (!($this->options instanceof ConfigurationInterface)) {
php
{ "resource": "" }
q13570
CloudSearchDomainClient.searchByPost
train
private function searchByPost() { return static function (callable $handler) { return function ( CommandInterface $c, RequestInterface $r = null ) use ($handler) { if
php
{ "resource": "" }
q13571
CloudSearchDomainClient.convertGetToPost
train
public static function convertGetToPost(RequestInterface $r) { if ($r->getMethod() === 'POST') { return $r; } $query = $r->getUri()->getQuery(); $req = $r->withMethod('POST') ->withBody(Psr7\stream_for($query)) ->withHeader('Content-Length', strlen($query))
php
{ "resource": "" }
q13572
Validator.validate
train
public function validate($name, Shape $shape, array $input) { $this->dispatch($shape, $input); if ($this->errors) { $message = sprintf( "Found %d error%s while validating the input provided for the " . "%s operation:\n%s", count($this->errors), count($this->errors) > 1 ? 's' : '',
php
{ "resource": "" }
q13573
S3EncryptionClient.getObjectAsync
train
public function getObjectAsync(array $args) { $provider = $this->getMaterialsProvider($args); unset($args['@MaterialsProvider']); $instructionFileSuffix = $this->getInstructionFileSuffix($args); unset($args['@InstructionFileSuffix']); $strategy = $this->getMetadataStrategy($args, $instructionFileSuffix); unset($args['@MetadataStrategy']); $saveAs = null; if (!empty($args['SaveAs'])) { $saveAs = $args['SaveAs']; } $promise = $this->client->getObjectAsync($args) ->then( function ($result) use ( $provider, $instructionFileSuffix, $strategy, $args ) { if ($strategy === null) { $strategy = $this->determineGetObjectStrategy( $result, $instructionFileSuffix ); } $envelope = $strategy->load($args + [ 'Metadata' => $result['Metadata'] ]); $provider = $provider->fromDecryptionEnvelope($envelope); $result['Body'] = $this->decrypt( $result['Body'],
php
{ "resource": "" }
q13574
AwsClient.parseClass
train
private function parseClass() { $klass = get_class($this); if ($klass === __CLASS__) { return ['', 'Aws\Exception\AwsException']; } $service = substr($klass, strrpos($klass, '\\') + 1, -6); return
php
{ "resource": "" }
q13575
StructureShape.getMember
train
public function getMember($name) { $members = $this->getMembers(); if (!isset($members[$name])) {
php
{ "resource": "" }
q13576
IdempotencyTokenMiddleware.wrap
train
public static function wrap( Service $service, callable $bytesGenerator = null ) {
php
{ "resource": "" }
q13577
IdempotencyTokenMiddleware.getUuidV4
train
private static function getUuidV4($bytes) { // set version to 0100 $bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40); // set bits 6-7 to 10
php
{ "resource": "" }
q13578
CheckstyleErrorFormatter.formatErrors
train
public function formatErrors( AnalysisResult $analysisResult, OutputStyle $style ): int { $style->writeln('<?xml version="1.0" encoding="UTF-8"?>'); $style->writeln('<checkstyle>'); foreach ($this->groupByFile($analysisResult) as $relativeFilePath => $errors) { $style->writeln(sprintf( '<file name="%s">', $this->escape($relativeFilePath) )); foreach ($errors as $error) { $style->writeln(sprintf( ' <error line="%d" column="1" severity="error" message="%s" />', $this->escape((string) $error->getLine()), $this->escape((string) $error->getMessage()) )); }
php
{ "resource": "" }
q13579
CheckstyleErrorFormatter.groupByFile
train
private function groupByFile(AnalysisResult $analysisResult): array { $files = []; /** @var \PHPStan\Analyser\Error $fileSpecificError */ foreach ($analysisResult->getFileSpecificErrors()
php
{ "resource": "" }
q13580
Pay.registerLogService
train
protected function registerLogService() { $logger = Log::createLogger( $this->config->get('log.file'), 'yansongda.pay', $this->config->get('log.level', 'warning'),
php
{ "resource": "" }
q13581
Wechat.refund
train
public function refund($order): Collection { $this->payload = Support::filterPayload($this->payload, $order, true); Events::dispatch(Events::METHOD_CALLED, new
php
{ "resource": "" }
q13582
Wechat.download
train
public function download(array $params): string { unset($this->payload['spbill_create_ip']); $this->payload = Support::filterPayload($this->payload, $params, true); Events::dispatch(Events::METHOD_CALLED, new Events\MethodCalled('Wechat', 'Download', $this->gateway, $this->payload)); $result = Support::getInstance()->post( 'pay/downloadbill',
php
{ "resource": "" }
q13583
Support.getSignContent
train
public static function getSignContent($data): string { $buff = ''; foreach ($data as $k => $v) { $buff .= ($k
php
{ "resource": "" }
q13584
Support.decryptRefundContents
train
public static function decryptRefundContents($contents): string { return openssl_decrypt(
php
{ "resource": "" }
q13585
Support.toXml
train
public static function toXml($data): string { if (!is_array($data) || count($data) <= 0) { throw new InvalidArgumentException('Convert To Xml Error! Invalid Array!'); } $xml = '<xml>'; foreach ($data as $key => $val) {
php
{ "resource": "" }
q13586
Support.fromXml
train
public static function fromXml($xml): array { if (!$xml) { throw new InvalidArgumentException('Convert To Array Error! Invalid Xml!');
php
{ "resource": "" }
q13587
Support.getConfig
train
public function getConfig($key = null, $default = null) { if (is_null($key)) { return $this->config->all(); }
php
{ "resource": "" }
q13588
Alipay.cancel
train
public function cancel($order): Collection { $this->payload['method'] = 'alipay.trade.cancel'; $this->payload['biz_content'] = json_encode(is_array($order) ? $order : ['out_trade_no' => $order]); $this->payload['sign'] = Support::generateSign($this->payload);
php
{ "resource": "" }
q13589
Alipay.success
train
public function success(): Response { Events::dispatch(Events::METHOD_CALLED,
php
{ "resource": "" }
q13590
Support.getSignContent
train
public static function getSignContent(array $data, $verify = false): string { $data = self::encoding($data, $data['charset'] ?? 'gb2312', 'utf-8'); ksort($data); $stringToBeSigned = ''; foreach ($data as $k => $v) { if ($verify && $k != 'sign' && $k != 'sign_type') { $stringToBeSigned .= $k.'='.$v.'&'; } if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) {
php
{ "resource": "" }
q13591
Support.setHttpOptions
train
protected function setHttpOptions(): self { if ($this->config->has('http') && is_array($this->config->get('http'))) { $this->config->forget('http.base_uri');
php
{ "resource": "" }
q13592
Gateway.preOrder
train
protected function preOrder($payload): Collection { $payload['sign'] = Support::generateSign($payload);
php
{ "resource": "" }
q13593
SchemaParser.render
train
public function render() { $results = ''; foreach ($this->toArray() as $column => $attributes) { $results .=
php
{ "resource": "" }
q13594
SchemaParser.parse
train
public function parse($schema) { $this->schema = $schema; $parsed = []; foreach ($this->getSchemas() as $schemaArray) { $column = $this->getColumn($schemaArray);
php
{ "resource": "" }
q13595
SchemaParser.getAttributes
train
public function getAttributes($column, $schema) { $fields = str_replace($column . ':', '', $schema);
php
{ "resource": "" }
q13596
SchemaParser.down
train
public function down() { $results = ''; foreach ($this->toArray() as $column =>
php
{ "resource": "" }
q13597
RulesParser.parse
train
public function parse($rules) { $this->rules = $rules; $parsed = []; foreach ($this->getRules() as $rulesArray) { $column = $this->getColumn($rulesArray);
php
{ "resource": "" }
q13598
RepositoryEloquentGenerator.getFillable
train
public function getFillable() { if (!$this->fillable) { return '[]'; } $results = '[' . PHP_EOL; foreach ($this->getSchemaParser()->toArray() as $column => $value) {
php
{ "resource": "" }
q13599
CacheableRepository.getCacheRepository
train
public function getCacheRepository() { if (is_null($this->cacheRepository)) { $this->cacheRepository =
php
{ "resource": "" }