_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q246000
MailerTransformer.transformTemplate
validation
protected function transformTemplate(Template $template) { return array( 'template' => $template->getTemplate(), 'engine' => $template->getEngine(), 'vars' => $this->transform($template->getVars()), 'streamable' => $this->transformBoolean($template->isStreamab...
php
{ "resource": "" }
q246001
StatsD.updateStats
validation
public function updateStats($stats, $delta = 1, $sampleRate = 1) { if (!is_array($stats)) { $stats = array($stats); } $data = array(); foreach ($stats as $stat) { $data[$stat] = "$delta|c"; } $this->queue($data, $sampleRate); }
php
{ "resource": "" }
q246002
StatsD.flush
validation
public function flush() { if ($this->doNotTrack) { return; } if (empty($this->queue)) { return; } if ($this->mergePackets) { $this->send(implode("\n", $this->queue)); } else { foreach ($this->queue as $data) { ...
php
{ "resource": "" }
q246003
StatsD.send
validation
protected function send($data) { if ($this->doNotTrack) { return; } // Wrap this in a try/catch - failures in any of this should be silently ignored try { $fp = fsockopen("udp://$this->host", $this->port, $errno, $errstr); if (!$fp) { ...
php
{ "resource": "" }
q246004
UserComponent.createUser
validation
public function createUser() { if (false == $this->validateRegistrationOptin()) { //show error message on submit but not on page reload. if ($this->getRequestParameter('stoken')) { \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\UtilsView::class)->addError...
php
{ "resource": "" }
q246005
UserComponent.validateDeliveryAddressOptIn
validation
protected function validateDeliveryAddressOptIn() { $return = true; $optin = (int) $this->getRequestParameter('oegdproptin_deliveryaddress'); $changeExistigAddress = (int) $this->getRequestParameter('oegdproptin_changeDelAddress'); $addressId = $this->getRequestParameter('oxaddressid...
php
{ "resource": "" }
q246006
UserComponent.validateRegistrationOptin
validation
protected function validateRegistrationOptin() { $return = true; $optin = (int) $this->getRequestParameter('oegdproptin_userregistration'); //1 is for guest buy, 3 for account creation $registrationOption = (int) $this->getRequestParameter('option'); if (\OxidEsales\Eshop\Cor...
php
{ "resource": "" }
q246007
UserComponent.validateInvoiceAddressOptIn
validation
protected function validateInvoiceAddressOptIn() { $return = true; $optin = (int) $this->getRequestParameter('oegdproptin_invoiceaddress'); $changeExistigAddress = (int) $this->getRequestParameter('oegdproptin_changeInvAddress'); if (\OxidEsales\Eshop\Core\Registry::getConfig()->get...
php
{ "resource": "" }
q246008
OP_API.convertXmlToPhpObj
validation
public static function convertXmlToPhpObj ($node) { $ret = array(); if (is_object($node) && $node->hasChildNodes()) { foreach ($node->childNodes as $child) { $name = self::decode($child->nodeName); if ($child->nodeType == XML_TEXT_NODE) { ...
php
{ "resource": "" }
q246009
OP_API.convertPhpObjToDom
validation
public static function convertPhpObjToDom ($arr, $node, $dom) { if (is_array($arr)) { /** * If arr has integer keys, this php-array must be converted in * xml-array representation (<array><item>..</item>..</array>) */ $arrayParam = array(); ...
php
{ "resource": "" }
q246010
Plugin.run
validation
public function run() { if ( ! $this->is_debug() || ! $this->is_debug_display() ) { return; } /** @var Run $run */ $run = $this['run']; $run->register(); ob_start(); // Or we are going to be spitting out WP markup before whoops. }
php
{ "resource": "" }
q246011
WidgetExtension.renderWidget
validation
public function renderWidget(string $widgetGroup = '', array $widgetId = []) { $widgets = $this->widgetBuilder->build($this->widgets->getWidgets(), $widgetGroup, $widgetId); return $this->engine->render($widgets); }
php
{ "resource": "" }
q246012
WidgetController.status
validation
public function status(Request $request, WidgetInterface $widget, string $widgetId, bool $status = true) { // Build Widget $widgets = $widget->getWidgets(); if (isset($widgets[$widgetId])) { // Get User Widgets $widgetConfig = $this->getDoctrine() ...
php
{ "resource": "" }
q246013
WidgetController.configs
validation
public function configs(Request $request, WidgetInterface $widget, CacheInterface $cache, string $widgetId) { // Build Widget $widgets = $widget->getWidgets(); if (isset($widgets[$widgetId])) { // Get User Widgets $widgetConfig = $this->getDoctrine() ...
php
{ "resource": "" }
q246014
WidgetController.order
validation
public function order(Request $request, WidgetInterface $widget, string $widgetId, int $order) { // Build Widget $widgets = $widget->getWidgets(); if (isset($widgets[$widgetId])) { // Get User Widgets $widgetConfig = $this->getDoctrine() ->getRepo...
php
{ "resource": "" }
q246015
WidgetBuilder.build
validation
public function build($widgets, string $widgetGroup = '', array $widgetId = []) { // Without Widgets if (!$widgets) { return $widgets; } // Load User Widget Configuration $this->loadUserConfig(); // Output Widgets $outputWidget = []; // ...
php
{ "resource": "" }
q246016
WidgetBuilder.loadUserConfig
validation
private function loadUserConfig() { if (!$this->widgetConfig) { $this->widgetConfig = $this->entityManager ->getRepository('PdWidgetBundle:WidgetUser') ->findOneBy([ 'owner' => $this->tokenStorage->getToken()->getUser(), ]); ...
php
{ "resource": "" }
q246017
TwigRender.render
validation
public function render($widgets, bool $base = true) { if (!$widgets) { return false; } // Output Storage $output = ''; // Get User ID $userId = $this->tokenStorage->getToken()->getUser()->getId(); foreach ($widgets as $widget) { if (...
php
{ "resource": "" }
q246018
TwigRender.getOutput
validation
public function getOutput(ItemInterface $item, $userId) { if ($item->getCacheTime()) { // Get Cache Item $cache = $this->cache->getItem($item->getId().$userId); // Set Cache Expires $cache->expiresAfter($item->getCacheTime()); // Save ...
php
{ "resource": "" }
q246019
Widget.addWidget
validation
public function addWidget(ItemInterface $item) { // Check Security if ($this->checkRole) { if ($item->getRole() && !$this->security->isGranted($item->getRole())) { return $this; } } // Add $this->widgets[$item->getId()] = $item; ...
php
{ "resource": "" }
q246020
Widget.removeWidget
validation
public function removeWidget(string $widgetId) { if (isset($this->widgets[$widgetId])) { unset($this->widgets[$widgetId]); } return $this; }
php
{ "resource": "" }
q246021
Widget.clearWidgetCache
validation
public function clearWidgetCache() { // Get Widgets $widgets = $this->getWidgets(false); $userId = $this->token->getToken()->getUser()->getId(); // Clear Cache foreach ($widgets as $widget) { $this->cache->deleteItem($widget->getId().$userId); } }
php
{ "resource": "" }
q246022
WidgetUser.addWidgetConfig
validation
public function addWidgetConfig(string $widgetId, array $config = []) { $this->config[$widgetId] = array_merge($this->config[$widgetId] ?? [], $config); return $this; }
php
{ "resource": "" }
q246023
WidgetUser.removeWidgetConfig
validation
public function removeWidgetConfig(string $widgetId, array $config = []) { foreach ($config as $id => $content) { if (isset($this->config[$widgetId][$id])) { unset($this->config[$widgetId][$id]); } } return $this; }
php
{ "resource": "" }
q246024
GetModuleTrait.getModule
validation
public function getModule() { if (!is_object($this->_module)) { $this->_module = Yii::$app->getModule($this->_module); } return $this->_module; }
php
{ "resource": "" }
q246025
PublishesUnhandledMessages.handle
validation
public function handle($message, callable $next) { try { $next($message); } catch (UndefinedCallable $exception) { $this->logger->log( $this->logLevel, 'No message handler found, trying to handle it asynchronously', [ ...
php
{ "resource": "" }
q246026
NotORM_Row.offsetExists
validation
function offsetExists($key) { $this->access($key); $return = array_key_exists($key, $this->row); if (!$return) { $this->access($key, true); } return $return; }
php
{ "resource": "" }
q246027
NotORM_Row.offsetGet
validation
function offsetGet($key) { $this->access($key); if (!array_key_exists($key, $this->row)) { $this->access($key, true); } return $this->row[$key]; }
php
{ "resource": "" }
q246028
NotORM_Row.offsetSet
validation
function offsetSet($key, $value) { $this->row[$key] = $value; $this->modified[$key] = $value; }
php
{ "resource": "" }
q246029
NotORM_Result.insert
validation
function insert($data){ $rows = func_get_args(); $return = $this->insert_multi($rows); if(!$return){ return false; } if(!is_array($data)){ return $return; } // #56 postgresql无法获取新增数据的主键ID @ clov4r-连友 201608 if ($this->notORM->dri...
php
{ "resource": "" }
q246030
NotORM_Result.update
validation
function update(array $data){ if($this->notORM->freeze){ return false; } if(!$data){ return 0; } $values = array(); $parameters = array(); $quoteChar = $this->getQuoteChar(); foreach($data as $key => $val){ // doesn...
php
{ "resource": "" }
q246031
NotORM_Result.insert_update
validation
function insert_update(array $unique, array $insert, array $update = array()){ if(!$update){ $update = $insert; } $insert = $unique + $insert; $values = "(" . implode(", ", array_keys($insert)) . ") VALUES " . $this->quote($insert); //! parameters if($this->no...
php
{ "resource": "" }
q246032
NotORM_Result.delete
validation
function delete(){ if($this->notORM->freeze){ return false; } //防止误删,禁止全表的删除 //@dogstar - 2014-10-24 $where = $this->whereString(); if(empty($where)){ throw new Exception('sorry, you can not delete the whole table --dogstar'); } $r...
php
{ "resource": "" }
q246033
NotORM_Result.select
validation
function select($columns){ $this->__destruct(); if($columns != ""){ foreach(func_get_args() as $columns){ $this->select[] = $columns; } }else{ $this->select = array(); } return $this; }
php
{ "resource": "" }
q246034
NotORM_Result.order
validation
function order($columns){ $this->rows = null; if($columns != ""){ foreach(func_get_args() as $columns){ if($this->union){ $this->unionOrder[] = $columns; }else{ $this->order[] = $columns; } } ...
php
{ "resource": "" }
q246035
NotORM_Result.group
validation
function group($columns, $having = ""){ $this->__destruct(); $this->group = $columns; $this->having = $having; return $this; }
php
{ "resource": "" }
q246036
NotORM_Result.aggregation
validation
function aggregation($function){ $join = $this->createJoins(implode(",", $this->conditions) . ",$function"); $query = "SELECT $function FROM $this->table" . implode($join); if($this->where){ $query .= " WHERE " . implode($this->where); } foreach($this->query($query,...
php
{ "resource": "" }
q246037
NotORM_Result.execute
validation
protected function execute(){ if(!isset($this->rows)){ $result = false; $exception = null; $parameters = array(); foreach(array_merge($this->select, array( $this, $this->group, $this->having ), $this...
php
{ "resource": "" }
q246038
NotORM_Result.fetch
validation
function fetch($column = ''){ // no $this->select($column) because next calls can access different columns $this->execute(); $return = current($this->data); next($this->data); if($return && $column != ''){ return $return[$column]; } return $return; ...
php
{ "resource": "" }
q246039
NotORM_Result.offsetGet
validation
function offsetGet($key){ if($this->single && !isset($this->data)){ $clone = clone $this; if(is_array($key)){ $clone->where($key)->limit(1); }else{ $clone->where($this->primary, $key); } $return = $clone->fetch(); ...
php
{ "resource": "" }
q246040
NotORM_Result.exec
validation
function exec($query) { $conn = $this->getConn(); $sql = $conn->quote($query); return $conn->exec($sql); }
php
{ "resource": "" }
q246041
NotORM_MultiResult.via
validation
function via($column) { $this->column = $column; $this->conditions[0] = "$this->table.$column AND"; $this->where[0] = "(" . $this->whereIn("$this->table.$column", array_keys((array) $this->result->rows)) . ")"; return $this; }
php
{ "resource": "" }
q246042
SqlQuery.injectSpecialBindings
validation
public function injectSpecialBindings( string $sql, array $bindings ):string { foreach(self::SPECIAL_BINDINGS as $special) { $specialPlaceholder = ":" . $special; if(!array_key_exists($special, $bindings)) { continue; } $replacement = $this->escapeSpecialBinding( $bindings[$special], $s...
php
{ "resource": "" }
q246043
QueryCollectionFactory.locateDirectory
validation
protected function locateDirectory(string $name):?string { $parts = [$name]; foreach(Database::COLLECTION_SEPARATOR_CHARACTERS as $char) { if(!strstr($name, $char)) { continue; } $parts = explode($char, $name); break; } return $this->recurseLocateDirectory($parts); }
php
{ "resource": "" }
q246044
Tx_HappyFeet_Service_Rendering.renderRichText
validation
public function renderRichText($richText) { if (strlen($richText) < 1) { return ''; } $templatePath = $this->getTemplatePathAndFilename('RichText'); $view = $this->createView($templatePath); $view->assign('richText', $richText); return $view->render($tem...
php
{ "resource": "" }
q246045
Tx_HappyFeet_Service_Rendering.getTemplatePath
validation
private function getTemplatePath() { /** * @var $tsfe TypoScriptFrontendController */ $tsfe = $GLOBALS['TSFE']; if (isset($tsfe->tmpl->setup['lib.']['plugins.']['tx_happyfeet.']['view.']['template'])) { $templateFile = GeneralUtility::getFileAbsFileName( ...
php
{ "resource": "" }
q246046
Tx_HappyFeet_Domain_Repository_FootnoteRepository.getLowestFreeIndexNumber
validation
public function getLowestFreeIndexNumber() { $query = $this->createQuery(); $query->statement('SELECT index_number from ' . strtolower($this->objectType) . ' WHERE deleted=0'); $index = 1; $results = $query->execute(true); if (false === is_array($results) || sizeof($results) ...
php
{ "resource": "" }
q246047
InlineVariableCommentSniff.processMemberVar
validation
protected function processMemberVar( File $phpcsFile, $stackPtr ) { $tokens = $phpcsFile->getTokens(); $commentToken = [ T_COMMENT, T_DOC_COMMENT_CLOSE_TAG, ]; $commentEnd = $phpcsFile->findPrevious($commentToken, $stackPtr); $com...
php
{ "resource": "" }
q246048
CronPlus.schedule_event
validation
public function schedule_event() { if ( $this->is_scheduled( $this->args[ 'name' ] ) ) { return; } if ( $this->args[ 'run_on_creation' ] ) { call_user_func( $this->args[ 'cb' ], $this->args[ 'args' ] ); } if ( $this->args[ 'schedule' ] === 'schedule' ) { wp_schedule_event( $this->args[ 'time' ], $thi...
php
{ "resource": "" }
q246049
CronPlus.unschedule_specific_event
validation
public function unschedule_specific_event( $timestamp = '' ) { if ( empty( $timestamp ) ) { $timestamp = wp_next_scheduled( $this->args[ 'name' ], $this->args[ 'args' ] ); } wp_unschedule_event( $timestamp, $this->args[ 'name' ], $this->args[ 'args' ] ); }
php
{ "resource": "" }
q246050
CronPlus.deactivate
validation
public function deactivate() { $this->clear_schedule(); if ( !is_multisite() || wp_is_large_network() ) { return; } $sites = ( array ) get_site_option( $this->args[ 'name' ] . '_sites', array() ); $sites and $sites = array_diff( $sites, [ get_current_blog_id() ] ); foreach ( $sites as $site ) { swi...
php
{ "resource": "" }
q246051
CronPlus.is_scheduled
validation
private function is_scheduled( $name ) { $crons = _get_cron_array(); if ( empty( $crons ) ) { return false; } foreach ( $crons as $cron ) { if ( isset( $cron[ $name ] ) ) { return true; } } return false; }
php
{ "resource": "" }
q246052
ExpressionLanguageFactory.create
validation
public function create() { $language = new ExpressionLanguage(); foreach ($this->providers as $provider) { $language->registerProvider($provider); } return $language; }
php
{ "resource": "" }
q246053
Context.add
validation
public function add($name, $value) { if (array_key_exists($name, $this->storage)) { throw new AlreadyDefinedException(sprintf('Context value with key `%s` already defined', $name)); } $this->storage[$name] = $value; }
php
{ "resource": "" }
q246054
Context.get
validation
public function get($name, $default = null) { return array_key_exists($name, $this->storage) ? $this->storage[$name] : $default; }
php
{ "resource": "" }
q246055
AnyDataset.createFrom
validation
private function createFrom($filepath) { if (file_exists($filepath)) { $anyDataSet = XmlUtil::createXmlDocumentFromFile($filepath); $this->collection = array(); $rows = $anyDataSet->getElementsByTagName("row"); foreach ($rows as $row) { $sr = ...
php
{ "resource": "" }
q246056
AnyDataset.getAsDom
validation
public function getAsDom() { $anyDataSet = XmlUtil::createXmlDocumentFromStr("<anydataset></anydataset>"); $nodeRoot = $anyDataSet->getElementsByTagName("anydataset")->item(0); foreach ($this->collection as $sr) { $row = $sr->getAsDom(); $nodeRow = $row->getElementsBy...
php
{ "resource": "" }
q246057
AnyDataset.appendRow
validation
public function appendRow($singleRow = null) { if (!is_null($singleRow)) { if ($singleRow instanceof Row) { $this->collection[] = $singleRow; $singleRow->acceptChanges(); } elseif (is_array($singleRow)) { $this->collection[] = new Row($...
php
{ "resource": "" }
q246058
AnyDataset.insertRowBefore
validation
public function insertRowBefore($rowNumber, $row = null) { if ($rowNumber > count($this->collection)) { $this->appendRow($row); } else { $singleRow = $row; if (!($row instanceof Row)) { $singleRow = new Row($row); } array_sp...
php
{ "resource": "" }
q246059
AnyDataset.addField
validation
public function addField($name, $value) { if ($this->currentRow < 0) { $this->appendRow(); } $this->collection[$this->currentRow]->addField($name, $value); }
php
{ "resource": "" }
q246060
AnyDataset.getIterator
validation
public function getIterator(IteratorFilter $itf = null) { if (is_null($itf)) { return new AnyIterator($this->collection); } return new AnyIterator($itf->match($this->collection)); }
php
{ "resource": "" }
q246061
Row.addField
validation
public function addField($name, $value) { if (!array_key_exists($name, $this->row)) { $this->row[$name] = $value; } elseif (is_array($this->row[$name])) { $this->row[$name][] = $value; } else { $this->row[$name] = array($this->row[$name], $value); ...
php
{ "resource": "" }
q246062
Row.getAsArray
validation
public function getAsArray($fieldName) { if (!array_key_exists($fieldName, $this->row)) { return []; } $result = $this->row[$fieldName]; if (empty($result)) { return []; } return (array)$result; }
php
{ "resource": "" }
q246063
Row.set
validation
public function set($name, $value) { if (!array_key_exists($name, $this->row)) { $this->addField($name, $value); } else { $this->row[$name] = $value; } $this->informChanges(); }
php
{ "resource": "" }
q246064
Row.removeField
validation
public function removeField($fieldName) { if (array_key_exists($fieldName, $this->row)) { unset($this->row[$fieldName]); $this->informChanges(); } }
php
{ "resource": "" }
q246065
Row.removeValue
validation
public function removeValue($fieldName, $value) { $result = $this->row[$fieldName]; if (!is_array($result)) { if ($value == $result) { unset($this->row[$fieldName]); $this->informChanges(); } } else { $qty = count($result); ...
php
{ "resource": "" }
q246066
Row.replaceValue
validation
public function replaceValue($fieldName, $oldvalue, $newvalue) { $result = $this->row[$fieldName]; if (!is_array($result)) { if ($oldvalue == $result) { $this->row[$fieldName] = $newvalue; $this->informChanges(); } } else { ...
php
{ "resource": "" }
q246067
Row.getAsDom
validation
public function getAsDom() { if (is_null($this->node)) { $this->node = XmlUtil::createXmlDocumentFromStr("<row></row>"); $root = $this->node->getElementsByTagName("row")->item(0); foreach ($this->row as $key => $value) { if (!is_array($value)) { ...
php
{ "resource": "" }
q246068
GoCardless_PreAuthorization.find
validation
public static function find($id) { $endpoint = self::$endpoint . '/' . $id; return new self(GoCardless::$client, GoCardless::$client->request('get', $endpoint)); }
php
{ "resource": "" }
q246069
GoCardless_PreAuthorization.create_bill
validation
public function create_bill($attrs) { if ( ! isset($attrs['amount'])) { throw new GoCardless_ArgumentsException('Amount required'); } $params = array( 'bill' => array( 'amount' => $attrs['amount'], 'pre_authorization_id' => $this->id ) ); if (isse...
php
{ "resource": "" }
q246070
GoCardless_PreAuthorization.cancel
validation
public function cancel() { $endpoint = self::$endpoint . '/' . $this->id . '/cancel'; return new self($this->client, $this->client->request('put', $endpoint)); }
php
{ "resource": "" }
q246071
GoCardless_Merchant.find
validation
public static function find($id) { $client = GoCardless::$client; return new self($client, $client->request('get', self::$endpoint . '/' . $id)); }
php
{ "resource": "" }
q246072
GoCardless_Bill.retry
validation
public function retry() { $endpoint = self::$endpoint . '/' . $this->id . '/retry'; return new self($this->client, $this->client->request('post', $endpoint)); }
php
{ "resource": "" }
q246073
GoCardless_Bill.payout
validation
public function payout() { if (!$this->payout_id) { throw new GoCardless_ClientException("Cannot fetch payout for a bill that has not been paid out"); } return GoCardless_Payout::find_with_client($this->client, $this->payout_id); }
php
{ "resource": "" }
q246074
GoCardless_Client.authorize_url
validation
public function authorize_url($options = null) { if ( ! isset($options['redirect_uri'])) { throw new GoCardless_ArgumentsException('redirect_uri required'); } $required_options = array( "client_id" => $this->account_details['app_id'], "scope" => "manage_merchant", "response_type" =...
php
{ "resource": "" }
q246075
GoCardless_Client.fetch_access_token
validation
public function fetch_access_token($params) { if ( ! isset($params['redirect_uri'])) { throw new GoCardless_ArgumentsException('redirect_uri required'); } $params['http_authorization'] = $this->account_details['app_id'] . ':' . $this->account_details['app_secret']; $response = $this->requ...
php
{ "resource": "" }
q246076
GoCardless_Client.merchant
validation
public function merchant($id = null) { if ($id == null) { $id = $this->account_details['merchant_id']; } return GoCardless_Merchant::find_with_client($this, $id); }
php
{ "resource": "" }
q246077
GoCardless_Client.create_bill
validation
public function create_bill($params) { if ( ! isset($params['pre_authorization_id'])) { throw new GoCardless_ArgumentsException('pre_authorization_id missing'); } $pre_auth = new GoCardless_PreAuthorization($this, array( 'id' => $params['pre_authorization_id'] )); return $pre_auth->cr...
php
{ "resource": "" }
q246078
GoCardless_Client.confirm_resource
validation
public function confirm_resource($params) { // Define confirm endpoint $endpoint = '/confirm'; // First validate signature // Then send confirm request // List of required params $required_params = array( 'resource_id', 'resource_type' ); // Loop through required params // ...
php
{ "resource": "" }
q246079
GoCardless_Client.new_limit_url
validation
public function new_limit_url($type, $params) { // $params are passed in // Optional $params are saved in $request and removed from $params // $params now only contains params for the payments // $payment_params is created containing sub-object named after $type // Merge $payment_params, $request a...
php
{ "resource": "" }
q246080
GoCardless_Client.request
validation
public function request($method, $endpoint, $params = array()) { // If there is no http_authorization, try checking for access_token if ( ! isset($params['http_authorization'])) { // No http_authorization and no access_token? Fail if ( ! isset($this->account_details['access_token'])) { thr...
php
{ "resource": "" }
q246081
GoCardless_Client.validate_webhook
validation
public function validate_webhook($params) { $sig = $params['signature']; unset($params['signature']); if ( ! isset($sig)) { return false; } $data = array( 'data' => $params, 'secret' => $this->account_details['app_secret'], 'signature' => $sig ); return $t...
php
{ "resource": "" }
q246082
GoCardless_Resource.fetch_sub_resource
validation
public function fetch_sub_resource($type, $params = array()) { // Generate subresource endpoint by snipping out the // right part of the sub_resource_uri $endpoint = preg_replace('/api\/v[0-9]+\//', '', parse_url($this->sub_resource_uris[$type], PHP_URL_PATH)); $sub_resource_params = array(); ...
php
{ "resource": "" }
q246083
GoCardless_Utils.generate_query_string
validation
public static function generate_query_string($params, &$pairs = array(), $namespace = null) { if (is_array($params)) { foreach ($params as $k => $v) { if (is_int($k)) { GoCardless_Utils::generate_query_string($v, $pairs, $namespace . '[]'); } else { GoCar...
php
{ "resource": "" }
q246084
GoCardless_Utils.sortPairs
validation
public static function sortPairs($a, $b) { $keys = strcmp($a[0], $b[0]); if ($keys !== 0) { return $keys; } return strcmp($a[1], $b[1]); }
php
{ "resource": "" }
q246085
GoCardless_Utils.singularize
validation
public static function singularize($string) { if (substr($string, -1) == 's') { return substr($string, 0, -1); } elseif (substr($string, -1) == 'i') { return substr($string, 0, -1) . 'us'; } else { return $string; } }
php
{ "resource": "" }
q246086
GoCardless_Request.call
validation
protected static function call($method, $url, $params = array()) { // Initialize curl $ch = curl_init(); // Default curl options, including library & version number $curl_options = array( CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, ...
php
{ "resource": "" }
q246087
ClassAliaser.register
validation
public static function register(array $aliases) { if (!$aliases) { return; } if (!isset(self::$autoloadFn)) { $classAliases = &self::$aliases; self::$autoloadFn = function ($className) use (&$classAliases) { if (isset($classAliases[$classN...
php
{ "resource": "" }
q246088
ClassAliaser.unregister
validation
public static function unregister() { if (isset(self::$autoloadFn)) { spl_autoload_unregister(self::$autoloadFn); self::$autoloadFn = null; } self::$aliases = []; }
php
{ "resource": "" }
q246089
PathFinder.destinationsFor
validation
public function destinationsFor(string $filePath): array { $filePath = Path::canonicalize($filePath); $source = $this->matchingSource($filePath); return $this->resolveDestinations($filePath, $source); }
php
{ "resource": "" }
q246090
DriverCreator.createDriver
validation
protected function createDriver($driverClass): Driver\DriverInterface { return isset($this->container) ? $this->container->get($driverClass) : new $driverClass(); }
php
{ "resource": "" }
q246091
PrepareCounter.prepare
validation
public function prepare($value) { /** @var Importer $importer */ $importer = $this->getVariably()->get('importer'); $table = $importer->getCurrentTable(); if (!isset($this->counter[$table])) { $db = $importer->getDb(); $counter = $db->fetchOne('SELECT MAX(DIS...
php
{ "resource": "" }
q246092
Importer.applyId
validation
protected function applyId(& $row, $id, $identifierField) { $ids = (array) $id; $findId = function ($row) use ($ids, $identifierField) { foreach ($ids as $id) { // Foton == FOTON $bool = true; $identifierField = $this->flatten($identifierFi...
php
{ "resource": "" }
q246093
Importer.getDriver
validation
public function getDriver($configTask, $source) { $driverFactory = $this->getDriverCreator(); /** @var DriverInterface $driver */ $driver = $driverFactory->create($configTask); $driver->source($source); if (method_exists($driver, 'getLogger') && $driver instanceof LoggerAwa...
php
{ "resource": "" }
q246094
Importer.getCurrentRealRows
validation
public function getCurrentRealRows($table = null) { $table = $table ?: $this->getCurrentTable(); if (!isset($this->currentRealRows[$table]) || !$this->currentRealRows[$table]) { $fields = $this->getPreparedFields()[$table]; $this->currentRealRows[$table] = $this->getRealRow($...
php
{ "resource": "" }
q246095
Importer.profiling
validation
protected function profiling($signal = true) { static $timeStart; if ($signal) { $timeStart = microtime(true); } if (!$signal) { $this->timeExecution = (microtime(true) - $timeStart) / 60; return $this->timeExecution; } }
php
{ "resource": "" }
q246096
Importer.log
validation
public function log($level, $message, array $context = []) { static $counter = []; !$this->logger || $this->logger->log($level, $message, $context); // If message is exception convert it to string $message = is_object($message) ? $message->__toString() : $message; // Group ...
php
{ "resource": "" }
q246097
PaginationParams.setParams
validation
public function setParams($namespace, $params) { $session = new Container($namespace); $session->params = $params; unset($session->list); return $this; }
php
{ "resource": "" }
q246098
PaginationParams.getParams
validation
public function getParams($namespace, $defaults, $params = null) { $session = new Container($namespace); $sessionParams = $session->params ?: array(); $params = $params ?: clone $this->getController()->getRequest()->getQuery(); if ($params->get('clear')) { ...
php
{ "resource": "" }
q246099
PaginationParams.getList
validation
public function getList($namespace, $callback) { $session = new Container($namespace); $params = $session->params?:array(); if (!$session->list) { $session->list = is_array($callback) ? call_user_func($callback, $session->params) : $callback->getPaginatio...
php
{ "resource": "" }