_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q259800
Configure.configured
test
public static function configured($name = null) { if ($name !== null) { return isset(static::$engines[$name]); } return array_keys(static::$engines); }
php
{ "resource": "" }
q259801
Hash.expand
test
public static function expand(array $data, $separator = '.') { $result = []; foreach ($data as $flat => $value) { $keys = explode($separator, $flat); $keys = array_reverse($keys); $child = [ $keys[0] => $value ]; array_shift($ke...
php
{ "resource": "" }
q259802
Hash.splitConditions
test
protected static function splitConditions($token) { $conditions = false; $position = strpos($token, '['); if ($position !== false) { $conditions = substr($token, $position); $token = substr($token, 0, $position); } return [$token, $conditions]; }
php
{ "resource": "" }
q259803
Hash.matchToken
test
protected static function matchToken($key, $token) { if ($token === '{n}') { return is_numeric($key); } if ($token === '{s}') { return is_string($key); } if (is_numeric($token)) { return ($key == $token); } return ($key ===...
php
{ "resource": "" }
q259804
Inflector.cache
test
protected static function cache($type, $key, $value = false) { $key = '_' . $key; $type = '_' . $type; if ($value !== false) { static::$cache[$type][$key] = $value; return $value; } if (!isset(static::$cache[$type][$key])) { return false; ...
php
{ "resource": "" }
q259805
Wrapper.setInstances
test
public function setInstances($message, $moduleManager) { $this->ModuleManager = $moduleManager; $this->Message = $message; $this->Channel = $message->channel; if (isset($message->channel->guild) && is_object($message->channel->guild)) { $this->Guild = $message->channel->...
php
{ "resource": "" }
q259806
Debugger.trace
test
public static function trace(array $options = []) { $self = Debugger::getInstance(); $defaults = [ 'depth' => 999, 'format' => $self->outputFormat, 'args' => false, 'start' => 0, 'scope' => null, 'exclude' => ['call_user_func_ar...
php
{ "resource": "" }
q259807
Debugger.export
test
protected static function export($var, $depth, $indent) { switch (static::getType($var)) { case 'boolean': return ($var) ? 'true' : 'false'; case 'integer': return '(int) ' . $var; case 'float': return '(float) ' . $var; ...
php
{ "resource": "" }
q259808
Server.listen
test
public function listen() { $this->Discord->on('ready', function ($discord) { $discord->on('message', function ($message) { if ($this->Discord->id === $message->author->id) { return; } $content = Message::parse($message->content...
php
{ "resource": "" }
q259809
Message.parse
test
public static function parse($message) { static::resetConfig(); $chr32 = chr(32); $config = []; if (empty($message) || !is_string($message)) { return static::read(); } $config += [ 'raw' => $message, 'parts' => explode($chr32, tr...
php
{ "resource": "" }
q259810
FileConfigTrait.getFilePath
test
protected function getFilePath($key, $checkExists = false) { if (strpos($key, '..') !== false) { throw new Exception('Cannot load/dump configuration files with ../ in them.'); } list($plugin, $key) = pluginSplit($key); if ($plugin) { $file = Plugin::configPa...
php
{ "resource": "" }
q259811
Plugin.load
test
public static function load($plugin, array $config = []) { if (is_array($plugin)) { foreach ($plugin as $name => $conf) { list($name, $conf) = (is_numeric($name)) ? [$conf, $config] : [$name, $conf]; static::load($name, $conf); } return; ...
php
{ "resource": "" }
q259812
Plugin.loadConfig
test
protected static function loadConfig() { if (Configure::check('plugins')) { return; } $vendorFile = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'skinny-plugins.php'; if (!file_exists($vendorFile)) { $vendorFile = dirname(dirname(dirname(dirname(__DIR__))...
php
{ "resource": "" }
q259813
Plugin.loadAll
test
public static function loadAll(array $options = []) { static::loadConfig(); $plugins = []; foreach ((array)Configure::read('App.paths.plugins') as $path) { if (!is_dir($path)) { continue; } $dir = new DirectoryIterator($path); f...
php
{ "resource": "" }
q259814
Plugin.bootstrap
test
public static function bootstrap($plugin) { $config = static::$plugins[$plugin]; if ($config['bootstrap'] === false) { return false; } if ($config['bootstrap'] === true) { return static::includeFile( $config['configPath'] . 'bootstrap.php', ...
php
{ "resource": "" }
q259815
PhpConfig.read
test
public function read($key) { $file = $this->getFilePath($key, true); $return = include $file; if (!is_array($return)) { throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php')); } return $return; }
php
{ "resource": "" }
q259816
StaticMessageTrait.config
test
public static function config($key, $value = null) { if (is_string($key)) { static::$config[$key] = $value; return; } if (!is_array($key)) { throw new InvalidArgumentException('Only string and array can be passed to config.'); } foreach ...
php
{ "resource": "" }
q259817
StaticMessageTrait.read
test
public static function read($key = null) { if ($key === null) { return static::$config; } return isset(static::$config[$key]) ? static::$config[$key] : null; }
php
{ "resource": "" }
q259818
ModuleManager.loadModules
test
protected function loadModules(DirectoryIterator $files, array $config = []) { foreach ($files as $file) { $filename = $file->getFilename(); if ($file->isDot() || $file->isDir() || $filename[0] == '.') { continue; } elseif ($file->isFile() && substr($filen...
php
{ "resource": "" }
q259819
ModuleManager.checkPlugins
test
protected function checkPlugins($module) { $loadedPlugins = Configure::read('plugins'); $arr = []; if (empty($loadedPlugins) || !is_array($loadedPlugins)) { return $arr; } foreach ($loadedPlugins as $plugin => $pluginPath) { $pluginPath = Plugin::cla...
php
{ "resource": "" }
q259820
ModuleManager.unload
test
public function unload($module) { $module = Inflector::camelize($module); if (!isset($this->loadedModules[$module])) { //Return the message AlreadyUnloaded. return 'AU'; } //Remove this module, also calling the __destruct method of it. $object = $thi...
php
{ "resource": "" }
q259821
ModuleManager.reload
test
public function reload($module) { $module = Inflector::camelize($module); $config = []; if (isset($this->loadedModules[$module]) && $this->loadedModules[$module]['plugin'] === true) { $config += [ 'pathDir' => $this->loadedModules[$module]['pluginPath'], ...
php
{ "resource": "" }
q259822
ModuleManager.timeLoaded
test
public function timeLoaded($module) { $module = Inflector::camelize($module); if (!isset($this->loadedModules[$module])) { return false; } return $this->loadedModules[$module]['loaded']; }
php
{ "resource": "" }
q259823
ModuleManager.isModified
test
public function isModified($module) { $module = Inflector::camelize($module); if (!isset($this->loadedModules[$module])) { return -1; } return $this->loadedModules[$module]['modified']; }
php
{ "resource": "" }
q259824
ModuleManager.offsetGet
test
public function offsetGet($module) { $module = Inflector::camelize($module); if (!isset($this->loadedModules[$module])) { return false; } return $this->loadedModules[$module]; }
php
{ "resource": "" }
q259825
ModuleManager.offsetExists
test
public function offsetExists($module) { $module = Inflector::camelize($module); return isset($this->loadedModules[$module]); }
php
{ "resource": "" }
q259826
ModuleManager.offsetSet
test
public function offsetSet($offset, $module) { if (!$module instanceof ModuleInterface) { throw new RuntimeException( sprintf('ModuleManager::offsetSet() expects "%s" to be an instance of ModuleInterface.', $module) ); } $newModule = [ 'obj...
php
{ "resource": "" }
q259827
Redis.get
test
public function get($key, $default = null) { $result = $this->call('get', [$key]); if ($result === false || $result === null) { return $default; } return $result; }
php
{ "resource": "" }
q259828
Redis.set
test
public function set($key, $value, $ttl = null): bool { $ttl = $this->getTtl($ttl); $params = ($ttl <= 0) ? [$key, $value] : [$key, $value, $ttl]; return $this->call('set', $params); }
php
{ "resource": "" }
q259829
Redis.getMultiple
test
public function getMultiple($keys, $default = null) { $mgetResult = $this->call('mget', [$keys]); if ($mgetResult === false) { return $default; } $result = []; foreach ($mgetResult ?? [] as $key => $value) { $result[$keys[$key]] = $value; } ...
php
{ "resource": "" }
q259830
Redis.setMultiple
test
public function setMultiple($values, $ttl = null): bool { $result = $this->call('mset', [$values]); return $result; }
php
{ "resource": "" }
q259831
Redis.call
test
public function call(string $method, array $params) { /* @var PoolInterface $connectPool */ $connectPool = App::getPool($this->poolName); /* @var ConnectionInterface $client */ $connection = $connectPool->getConnection(); $result = $connection->$method(...$params); ...
php
{ "resource": "" }
q259832
RedisAspect.before
test
public function before(JoinPoint $joinPoint) { $profileKey = $this->getProfileKey($joinPoint); Log::profileStart($profileKey); }
php
{ "resource": "" }
q259833
RedisAspect.afterReturning
test
public function afterReturning(JoinPoint $joinPoint) { $profileKey = $this->getProfileKey($joinPoint); Log::profileEnd($profileKey); return $joinPoint->getReturn(); }
php
{ "resource": "" }
q259834
RedisAspect.getProfileKey
test
private function getProfileKey(JoinPoint $joinPoint) { $method = $joinPoint->getMethod(); if ($method == '__call') { list($method) = $joinPoint->getArgs(); } return self::PROFILE_PREFIX . '.' . $method; }
php
{ "resource": "" }
q259835
PrefixProcessor.all
test
public static function all(CommandInterface $command, $prefix) { if ($arguments = $command->getArguments()) { foreach ($arguments as &$key) { $key = "$prefix$key"; } $arguments = [$arguments]; $command->setRawArguments($arguments); } ...
php
{ "resource": "" }
q259836
PrefixProcessor.interleaved
test
public static function interleaved(CommandInterface $command, $prefix) { if ($arguments = $command->getArguments()) { $newArguments = []; foreach ($arguments as $key => $value) { $newKey = "{$prefix}{$key}"; $newArguments[$newKey] = $value; ...
php
{ "resource": "" }
q259837
PrefixProcessor.evalKeys
test
public static function evalKeys(CommandInterface $command, $prefix) { if ($arguments = $command->getArguments()) { $command->setRawArguments($arguments); } }
php
{ "resource": "" }
q259838
Token.setExpires
test
protected function setExpires() { $created = $this->created; if ($this->lifetime === null) { $this->lifetime = self::DEFAULT_LIFETIME; } $this->expires = $created->modify($this->lifetime); }
php
{ "resource": "" }
q259839
RandomBytesAdapter.setLength
test
protected function setLength($length) { if ($length === null) { $length = self::DEFAULT_LENGTH; } $this->length = $length; }
php
{ "resource": "" }
q259840
OrientDBSocket.read
test
public function read($length = null) { $data = fread($this->socket, $length === null ? $this->bufferLen : $length); if ($this->debug) { OrientDBHelpers::hexDump($data); } return $data; }
php
{ "resource": "" }
q259841
OrientDBSocket.send
test
public function send($data) { fwrite($this->socket, $data); if ($this->debug) { OrientDBHelpers::hexDump($data); } }
php
{ "resource": "" }
q259842
OrientDB.canExecute
test
protected function canExecute($command) { if (!$this->active) { throw new OrientDBWrongCommandException('DBClose was executed. No interaction is possible.'); } if (in_array($command->opType, $this->getCommandsRequiresConnect()) && !$this->isConnected()) { throw new O...
php
{ "resource": "" }
q259843
OrientDB.setProtocolVersion
test
public function setProtocolVersion($version) { $this->protocolVersion = $version; if ($this->protocolVersion < $this->clientVersion) { throw new OrientDBException('Binary protocol is uncompatible with the Server connected: clientVersion=' . $this->clientVersion . ', serverVersion=' . $th...
php
{ "resource": "" }
q259844
OrientDBRecordEncoder.process
test
protected function process($data, $isAssoc = true, $isArray = false) { $tokens = array(); foreach ($data as $key => $value) { $buffer = ''; if ($isAssoc) { if ($isArray) { $buffer = self::encodeString($key) . ':'; } else { ...
php
{ "resource": "" }
q259845
OrientDBRecordDecoder.stackGetLastKey
test
protected function stackGetLastKey() { $depth = false; for ($i = count($this->stackTT) - 1; $i >= 0; $i--) { if ($this->stackTT[$i] === self::TTYPE_NAME) { $depth = $i; break; } } if ($depth !== false) { return $this...
php
{ "resource": "" }
q259846
OrientDBCommandAbstract.prepare
test
public function prepare() { $this->addByte(chr($this->opType)); if ($this->opType === self::DB_OPEN || $this->opType === self::CONNECT) { $this->currentTransactionID = -(++self::$transactionID); } else { if (in_array($this->opType, $this->parent->getCommandsRequiresCo...
php
{ "resource": "" }
q259847
OrientDBCommandAbstract.execute
test
public function execute() { $this->socket->debug = $this->debug; $this->socket->send($this->requestBytes); if (is_null($this->parent->protocolVersion)) { $this->debugCommand('protocol_version'); $serverProtocolVersion = $this->readShort(); $this->parent->...
php
{ "resource": "" }
q259848
OrientDBCommandAbstract.readRaw
test
protected function readRaw($length) { $data = ''; $dataLeft = $length; do { $data .= $this->socket->read($dataLeft); $dataLeft = $length - strlen($data); } while ($dataLeft > 0); return $data; }
php
{ "resource": "" }
q259849
OrientDBCommandAbstract.readLong
test
protected function readLong() { // First of all, read 8 bytes, divided into hi and low parts $hi = unpack('N', $this->readRaw(4)); $hi = reset($hi); $low = unpack('N', $this->readRaw(4)); $low = reset($low); // Unpack 64-bit signed long return self::unpackI64(...
php
{ "resource": "" }
q259850
OrientDBCommandAbstract.readString
test
protected function readString() { $size = $this->readInt(); if ($size === -1) { return null; } if ($size === 0) { return ''; } return $this->readRaw($size); }
php
{ "resource": "" }
q259851
OrientDBCommandAbstract.readBytes
test
protected function readBytes() { $size = $this->readInt(); if ($size === -1) { return null; } if ($size === 0) { return ''; } return $this->readRaw($size); }
php
{ "resource": "" }
q259852
OrientDBCommandAbstract.readRecord
test
protected function readRecord() { $this->debugCommand('record_marker'); $marker = $this->readShort(); /** * @see enterprise/src/main/java/com/orientechnologies/orient/enterprise/channel/binary/OChannelBinaryProtocol.java */ // -2=no record if ($marker == -...
php
{ "resource": "" }
q259853
OrientDBCommandAbstract.addBytes
test
protected function addBytes($string) { if ($string instanceof OrientDBRecord) { $string = (string) $string; } $this->addInt(strlen($string)); $this->requestBytes .= $string; }
php
{ "resource": "" }
q259854
OrientDBCommandAbstract.unpackI64
test
public static function unpackI64($hi, $low) { // Packing is: // OrientDBHelpers::hexDump(pack('NN', $int >> 32, $int & 0xFFFFFFFF)); // If x64 system, just shift hi bytes to the left, add low bytes. Piece of cake. if (PHP_INT_SIZE === 8) { return ($hi << 32) + $low; ...
php
{ "resource": "" }
q259855
OrientDBRecord.resetData
test
public function resetData() { $this->data = new OrientDBData($this); $this->content = null; $this->isParsed = true; $this->recordPos = null; $this->recordID = null; $this->version = null; }
php
{ "resource": "" }
q259856
ComponentImplementation.getProps
test
public function getProps() { $sortedChildFusionKeys = $this->sortNestedFusionKeys(); $props = []; foreach ($sortedChildFusionKeys as $key) { try { $props[$key] = $this->fusionValue($key); } catch (\Exception $e) { $props[$key] = $this-...
php
{ "resource": "" }
q259857
ComponentImplementation.renderComponent
test
public function renderComponent(array $props) { $context = $this->runtime->getCurrentContext(); $context['props'] = $props; $this->runtime->pushContextArray($context); $result = $this->runtime->render($this->path . '/renderer'); $this->runtime->popContext(); return $...
php
{ "resource": "" }
q259858
AtomicFusionHelper.classNames
test
public function classNames(...$arguments) { $classNames = []; foreach ($arguments as $argument) { if ((bool)$argument === true) { if (is_array($argument)) { $keys = array_keys($argument); $isAssoc = array_keys($keys) !== $keys; ...
php
{ "resource": "" }
q259859
Client.getIdealIssuers
test
public function getIdealIssuers() { try { $response = $this->getHttpClient() ->method(Http::GET) ->uri($this->baseUrl . 'ideal/issuers/') ->send(); if ($response->hasErrors()) { throw new \Exception($response->raw_body,...
php
{ "resource": "" }
q259860
Client.getAllowedProducts
test
public function getAllowedProducts() { try { $response = $this->getHttpClient() ->method(Http::GET) ->uri($this->baseUrl . 'merchants/self/projects/self/') ->send(); if ($response->hasErrors()) { throw new \Exception($r...
php
{ "resource": "" }
q259861
Client.processProducts
test
private function processProducts($details) { $result = array(); if (!array_key_exists('permissions', $details)) { return $result; } $products_to_check = array( 'ideal' => 'ideal', 'bank-transfer' => 'banktransfer', 'bancontact' => 'ba...
php
{ "resource": "" }
q259862
Client.createIdealOrder
test
public function createIdealOrder( $amount, $currency, $issuerId, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return $this->po...
php
{ "resource": "" }
q259863
Client.createSepaOrder
test
public function createSepaOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { ...
php
{ "resource": "" }
q259864
Client.createSofortOrder
test
public function createSofortOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { ...
php
{ "resource": "" }
q259865
Client.createPayconicOrder
test
public function createPayconicOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) ...
php
{ "resource": "" }
q259866
Client.createCreditCardOrder
test
public function createCreditCardOrder( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return $this->postOrder( ...
php
{ "resource": "" }
q259867
Client.createBancontactOrder
test
public function createBancontactOrder( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return $this->postOrder( ...
php
{ "resource": "" }
q259868
Client.createCashOnDeliveryOrder
test
public function createCashOnDeliveryOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259869
Client.createKlarnaOrder
test
public function createKlarnaOrder( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null, $orderLines = null ) { return...
php
{ "resource": "" }
q259870
Client.createPaypalOrder
test
public function createPaypalOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { ...
php
{ "resource": "" }
q259871
Client.createHomepayOrder
test
public function createHomepayOrder( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) {...
php
{ "resource": "" }
q259872
Client.createAfterPayOrder
test
public function createAfterPayOrder( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null, $orderLines = null ) { retu...
php
{ "resource": "" }
q259873
Client.createOrder
test
public function createOrder( $amount, $currency, $paymentMethod, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookU...
php
{ "resource": "" }
q259874
Client.getOrder
test
public function getOrder($id) { try { $response = $this->getHttpClient() ->method(Http::GET) ->uri($this->baseUrl . 'orders/' . $id . '/') ->send(); if ($response->hasErrors()) { throw new \Exception($response->raw_body...
php
{ "resource": "" }
q259875
Client.postOrder
test
private function postOrder(Order $order) { try { $response = $this->getHttpClient() ->method(Http::POST) ->uri($this->baseUrl . 'orders/') ->timeout(30) ->sends(Mime::JSON) ->body(ArrayFunctions::withoutNullValues($o...
php
{ "resource": "" }
q259876
Client.setOrderCapturedStatus
test
public function setOrderCapturedStatus(Order $order) { try { $transactionId = $order->transactions()->current()->id()->toString(); $response = $this->getHttpClient() ->method(Http::POST) ->uri($this->baseUrl . 'orders/' . $order->id() . '/transactio...
php
{ "resource": "" }
q259877
Order.createWithIdeal
test
public static function createWithIdeal( $amount, $currency, $issuerId, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return sta...
php
{ "resource": "" }
q259878
Order.createWithCreditCard
test
public static function createWithCreditCard( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return static::create( ...
php
{ "resource": "" }
q259879
Order.createWithSepa
test
public static function createWithSepa( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259880
Order.createWithSofort
test
public static function createWithSofort( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259881
Order.createWithBancontact
test
public static function createWithBancontact( $amount, $currency, $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ) { return static::create( ...
php
{ "resource": "" }
q259882
Order.createWithPaypal
test
public static function createWithPaypal( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259883
Order.createWithHomepay
test
public static function createWithHomepay( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259884
Order.createWithPayconiq
test
public static function createWithPayconiq( $amount, $currency, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhookUrl = null ...
php
{ "resource": "" }
q259885
Order.create
test
public static function create( $amount, $currency, $paymentMethod, array $paymentMethodDetails = [], $description = null, $merchantOrderId = null, $returnUrl = null, $expirationPeriod = null, $customer = null, $extra = null, $webhoo...
php
{ "resource": "" }
q259886
ArrayFunctions.withoutNullValues
test
public static function withoutNullValues(array $array) { static $fn = __FUNCTION__; foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = self::$fn($array[$key]); } if (empty($array[$key]) && $array[$key] !== '0' && $array[$...
php
{ "resource": "" }
q259887
Ginger.createClient
test
public static function createClient($apiKey, $product = null) { Guard::uuid( static::apiKeyToUuid($apiKey), 'ING API key is invalid: '.$apiKey ); if (!static::validPHPVersion()) { throw new \Exception('Minimum required PHP version must be '.MIN_PHP_VERSIO...
php
{ "resource": "" }
q259888
Ginger.getEndpoint
test
public static function getEndpoint($product) { switch ($product) { case 'kassacompleet': return (new Client\EndpointResolver())->getEndpointKassa(); case 'ingcheckout': return (new Client\EndpointResolver())->getEndpointIng(); case 'epay': ...
php
{ "resource": "" }
q259889
ISO3166.isValid
test
public static function isValid($value) { try { $ISO3166 = new Alcohol\ISO3166(); $ISO3166->getByAlpha2($value); return true; } catch (\DomainException $e) { return false; } }
php
{ "resource": "" }
q259890
PaymentRequestBodyBuilder.build
test
public function build($intent, $payer, $urls, $transactions, $returnArray = false) { $this->assertIntent($intent); $this->intent = $intent; $requestBody = array(); $requestBody['intent'] = $this->intent; $requestBody['payer'] = $this->payerBuilder->buildArray($payer); ...
php
{ "resource": "" }
q259891
PaymentService.execute
test
public function execute( AccessToken $accessToken, Payment $payment, $payerId ) { $request = $this->client->createRequest( 'POST', $payment->getExecuteUrl(), array( 'Accept' => 'application/json', 'Accept-Language' =...
php
{ "resource": "" }
q259892
PaymentService.capture
test
public function capture(AccessToken $accessToken, PaymentAuthorizationInterface $paymentAuthorization, $isFinalCapture = true) { $amount = $paymentAuthorization->getAmount(); $data = array( 'amount' => array( 'total' => $amount->getTotal(), 'currency' => $...
php
{ "resource": "" }
q259893
PaymentService.authorize
test
public function authorize( AccessToken $accessToken, $payer, $urls, $transactions ) { $requestBody = $this->paymentRequestBodyBuilder->build( 'authorize', $payer, $urls, $transactions ); $this->assertReqeustJson...
php
{ "resource": "" }
q259894
PaymentService.create
test
public function create( AccessToken $accessToken, $payer, $urls, $transactions ) { $requestBody = $this->paymentRequestBodyBuilder->build( 'sale', $payer, $urls, $transactions ); $this->assertReqeustJsonSchema($...
php
{ "resource": "" }
q259895
AccessTokenRepository.getAccessToken
test
public function getAccessToken($clientId, $secret) { $request = $this->client->createRequest( 'POST', $this->baseUrl.'/v1/oauth2/token', array( 'Accept' => 'application/json', 'Accept-Language' => 'en_US', 'Content-Type' => ...
php
{ "resource": "" }
q259896
LinkBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('href', 'rel', 'method'), $data ); $link = new Link( $data['href'], $data['rel'], $data['method'] ); return $link; }
php
{ "resource": "" }
q259897
CaptureBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('id', 'create_time', 'update_time', 'amount', 'is_final_capture', 'state', 'parent_payment', 'links'), $data ); $links = array(); foreach ($data['links'] as $link) { $links[] = $...
php
{ "resource": "" }
q259898
AmountBuilder.build
test
public function build(array $data) { $this->validateArrayKeys( array('currency', 'total'), $data ); $details = array(); if (isset($data['details'])) { $details = $data['details']; } $amount = new Amount( $data['currenc...
php
{ "resource": "" }
q259899
UrlsBuilder.buildArray
test
public function buildArray($urls) { if ( ($urls instanceof \ArrayAccess || is_array($urls)) && (isset($urls['return_url']) && isset($urls['cancel_url'])) ) { return array( 'return_url' => $urls['return_url'], 'cancel_url' => $urls[...
php
{ "resource": "" }