_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q263700
Account.numbers
test
public function numbers($index = 1, $size = 10, $pattern = null, $searchPattern = MatchingStrategy::STARTS_WITH) { return $this->numbers->invoke($index, $size, $pattern, $searchPattern); }
php
{ "resource": "" }
q263701
Cache.factory
test
static function factory($driver = null) { try { switch ($driver) { case APC: return static::getDriver('APC'); case MEMCACHED: try { return static::getDriver('Memcached'); } catch (...
php
{ "resource": "" }
q263702
Manialink.load
test
final public static function load($root = true, $timeout = 0, $version = 1, $background = self::DEFAULT_BACKGROUND, $navigable3d = false) { if (class_exists('\ManiaLib\Application\Config')) { $config = \ManiaLib\Application\Config::getInstance(); self::$langsURL = $config->getLangsUR...
php
{ "resource": "" }
q263703
Manialink.beginFrame
test
final public static function beginFrame($x = 0, $y = 0, $z = 0, $scale = null, \ManiaLib\Gui\Layouts\AbstractLayout $layout = null) { $frame = new Elements\Frame(); $frame->setPosition($x, $y, $z); $frame->setScale($scale); if ($layout inst...
php
{ "resource": "" }
q263704
Manialink.endFrame
test
final public static function endFrame() { if (!end(self::$parentNodes)->hasChildNodes()) { end(self::$parentNodes)->nodeValue = ' '; } array_pop(self::$parentNodes); array_pop(self::$parentLayouts); $frame = array_pop(self::$parentFrames); $frame->save(); ...
php
{ "resource": "" }
q263705
Manialink.redirect
test
final public static function redirect($link, $render = true) { self::$domDocument = new \DOMDocument('1.0', 'utf-8'); self::$parentNodes = array(); self::$parentLayouts = array(); $redirect = self::$domDocument->createElement('redirect'); $redirect->appendChild(self::$domDoc...
php
{ "resource": "" }
q263706
Manialink.appendXML
test
static function appendXML($XML) { $doc = new \DOMDocument('1.0', 'utf-8'); $doc->loadXML($XML); $node = self::$domDocument->importNode($doc->firstChild, true); end(self::$parentNodes)->appendChild($node); }
php
{ "resource": "" }
q263707
RedirectorManager.buildDriver
test
private function buildDriver($driver, array $extra = []) { $router = $this->app->make(\Illuminate\Contracts\Routing\Registrar::class); $class = Seo::getConfig("redirector.drivers.$driver.class"); $options = Seo::getConfig("redirector.drivers.$driver.options", []); return new $cla...
php
{ "resource": "" }
q263708
AbstractLayout.setBorder
test
function setBorder($borderWidth = 0, $borderHeight = 0) { $this->borderWidth = $borderWidth; $this->xIndex = $borderWidth; $this->borderHeight = $borderHeight; $this->yIndex = -$borderHeight; }
php
{ "resource": "" }
q263709
StyleParser.declareFont
test
static function declareFont($name, $normal, $bold = null, $italic = null, $boldItalic = null) { self::$fonts[$name] = array( 0 => $normal, StyleParser::BOLD => $bold ?: $normal, StyleParser::ITALIC => $italic ?: $normal, StyleParser::BOLD | StyleParser::ITALIC...
php
{ "resource": "" }
q263710
StyleParser.onImage
test
static function onImage($string, $image, $fontName, $x = 0, $y = 0, $size = 10, $defaultColor = '000') { if ($size <= 5) self::onImageQuality($string, $image, $fontName, $x, $y, $size, $defaultColor, 3); else if ($size <= 10) self::onImageQuality($string, $image, $fontName, $...
php
{ "resource": "" }
q263711
StyleParser.onImageFast
test
static function onImageFast($string, $image, $fontName, $x = 0, $y = 0, $size = 10, $defaultColor = '000') { $defaultColor = Color::StringToRgb24($defaultColor); $xOffset = 0; foreach (self::parseString($string) as $token) $xOffset += $token->onImage($image, $fontName, $x + $xOf...
php
{ "resource": "" }
q263712
StyleParser.onImageQuality
test
static function onImageQuality($string, $image, $fontName, $x = 0, $y = 0, $size = 10, $defaultColor = '000', $precision = 2) { $defaultColor = Color::StringToRgb24($defaultColor); $factor = 1 << ($precision > 31 ? 31 : $precision); $tokens = self::parseString($string); $rawText = '...
php
{ "resource": "" }
q263713
AbstractRedirector.getRedirectFor
test
public function getRedirectFor(Request $request) { $this->request = $request; collect($this->getRedirectedUrls())->each(function ($redirects, $missingUrl) { $this->router->get($missingUrl, function () use ($redirects) { return redirect()->to( $this->d...
php
{ "resource": "" }
q263714
EloquentRedirector.getRedirectedUrls
test
public function getRedirectedUrls() { return $this->getCachedRedirects() ->keyBy('old_url') ->transform(function (Redirect $item) { return [$item->new_url, $item->status]; }) ->toArray(); }
php
{ "resource": "" }
q263715
EloquentRedirector.getCachedRedirects
test
protected function getCachedRedirects() { return cache()->remember($this->getOption('cache.key'), $this->getOption('cache.duration'), function () { return $this->getRedirectModel()->get(); }); }
php
{ "resource": "" }
q263716
PageNavigator.setSize
test
function setSize($iconSize = 5, $nullValue = null) { $this->arrowNext->setSize($iconSize, $iconSize); $this->arrowPrev->setSize($iconSize, $iconSize); $this->arrowFastNext->setSize($iconSize, $iconSize); $this->arrowFastPrev->setSize($iconSize, $iconSize); $this->arrowLast->s...
php
{ "resource": "" }
q263717
Button.setSelected
test
function setSelected() { $this->isSelected = true; $this->selectedIcon = new \ManiaLib\Gui\Elements\Icons64x64_1(11); $this->selectedIcon->setSubStyle(\ManiaLib\Gui\Elements\Icons64x64_1::ShowRight); $this->selectedIcon->setValign('center'); $this->selectedIcon->setPosX(71);...
php
{ "resource": "" }
q263718
MarketingMessage.invoke
test
public function invoke($from = null, $keyword = null, $to = null, $text = '') { if(!$from) { throw new Exception("\$from parameter cannot be blank"); } if(!$keyword) { throw new Exception("\$keyword parameter cannot be blank"); } if(!$to) { ...
php
{ "resource": "" }
q263719
Music.setData
test
function setData($filename, $absoluteUrl = false) { if (!$absoluteUrl) { $this->data = \ManiaLib\Gui\Manialink::$mediaURL . $filename; } else { $this->data = $filename; } }
php
{ "resource": "" }
q263720
Tools.getLimitString
test
static function getLimitString($offset, $length) { $offset = (int)$offset; $length = (int)$length; if (!$offset && !$length) { return ''; } elseif (!$offset && $length == 1) { return 'LIMIT 1'; } else { return 'LIMIT ' . $offset . ', ' . $l...
php
{ "resource": "" }
q263721
Tools.getUpdateString
test
static function getUpdateString(array $values) { $tmp = array(); foreach ($values as $key => $value) { $tmp[] = $key . '=' . $value; } return implode(', ', $tmp); }
php
{ "resource": "" }
q263722
Request.get
test
function get($name, $default = null) { if (array_key_exists($name, $this->params)) { return $this->params[$name]; } else { return $default; } }
php
{ "resource": "" }
q263723
Request.getStrict
test
function getStrict($name, $message = null) { if (array_key_exists($name, $this->params) && $this->params[$name]) { return $this->params[$name]; } elseif ($message) { throw new UserException($message); } else { throw new InvalidArgumentException($name); ...
php
{ "resource": "" }
q263724
Request.getPostStrict
test
function getPostStrict($name, $message = null) { if (array_key_exists($name, $_POST) && $_POST[$name]) { return $_POST[$name]; } elseif ($message) { throw new UserException($message); } else { throw new InvalidArgumentException($name); } }
php
{ "resource": "" }
q263725
Request.restore
test
function restore($name) { if (array_key_exists($name, $this->requestParams)) { $this->params[$name] = $this->requestParams[$name]; } else { $this->delete($name); } }
php
{ "resource": "" }
q263726
Request.redirectArgList
test
function redirectArgList($route = '') { $args = func_get_args(); array_shift($args); $args = $this->filterArgs($args); $manialink = $this->createLinkString($route, $args); Response::getInstance()->redirect($manialink); }
php
{ "resource": "" }
q263727
Request.createLinkArgList
test
function createLinkArgList($route = '') { $args = func_get_args(); array_shift($args); $args = $this->filterArgs($args); return $this->createLinkString($route, $args); }
php
{ "resource": "" }
q263728
Request.createAbsoluteLinkArgList
test
function createAbsoluteLinkArgList($absoluteLink) { $args = func_get_args(); array_shift($args); $args = $this->filterArgs($args); return $absoluteLink . ($args ? '?' . http_build_query($args) : ''); }
php
{ "resource": "" }
q263729
Component.incPosX
test
function incPosX($posX) { $oldX = $this->posX; $this->posX += $posX; $this->onMove($oldX, $this->posY, $this->posZ); }
php
{ "resource": "" }
q263730
Component.incPosY
test
function incPosY($posY) { $oldY = $this->posY; $this->posY += $posY; $this->onMove($this->posX, $oldY, $this->posZ); }
php
{ "resource": "" }
q263731
Component.incPosZ
test
function incPosZ($posZ) { $oldZ = $this->posZ; $this->posZ += $posZ; $this->onMove($this->posX, $this->posY, $oldZ); }
php
{ "resource": "" }
q263732
Component.setPosition
test
function setPosition() { $oldX = $this->posX; $oldY = $this->posY; $oldZ = $this->posZ; $args = func_get_args(); if (!empty($args)) $this->posX = array_shift($args); if (!empty($args)) $this->posY = array_shift($args); if (!empty($args)) $this->posZ = arra...
php
{ "resource": "" }
q263733
Component.setScale
test
function setScale($scale) { $oldScale = $this->scale; $this->scale = $scale; $this->onScale($oldScale); }
php
{ "resource": "" }
q263734
Component.setValign
test
function setValign($valign) { $old = $this->valign; $this->valign = $valign; $this->onAlign($this->halign, $old); }
php
{ "resource": "" }
q263735
Component.setHalign
test
function setHalign($halign) { $old = $this->halign; $this->halign = $halign; $this->onAlign($old, $this->valign); }
php
{ "resource": "" }
q263736
Component.setAlign
test
function setAlign($halign = null, $valign = null) { $oldHalign = $this->halign; $oldValign = $this->valign; $this->valign = $valign; $this->halign = $halign; $this->onAlign($oldHalign, $oldValign); }
php
{ "resource": "" }
q263737
Component.setSizeX
test
function setSizeX($sizeX) { $oldX = $this->sizeX; $this->sizeX = $sizeX; $this->onResize($oldX, $this->sizeY); }
php
{ "resource": "" }
q263738
Component.setSizeY
test
function setSizeY($sizeY) { $oldY = $this->sizeY; $this->sizeY = $sizeY; $this->onResize($this->sizeX, $oldY); }
php
{ "resource": "" }
q263739
Component.setSize
test
function setSize() { $oldX = $this->sizeX; $oldY = $this->sizeY; $args = func_get_args(); if (!empty($args)) $this->sizeX = array_shift($args); if (!empty($args)) $this->sizeY = array_shift($args); $this->onResize($oldX, $oldY); }
php
{ "resource": "" }
q263740
Menu.addItem
test
function addItem($topItem = self::BUTTONS_TOP) { $item = new Button(); $item->setSubStyle(Bgs1::BgEmpty); if ($topItem == self::BUTTONS_TOP) { $this->items[] = $item; } else { $this->bottomItems[] = $item; } $this->lastItem = $item; }
php
{ "resource": "" }
q263741
Menu.addGap
test
function addGap($gap = 4) { $item = new \ManiaLib\Gui\Elements\Spacer(1, $gap); $this->items[] = $item; }
php
{ "resource": "" }
q263742
RedirectStatuses.keys
test
public static function keys() { return collect([ Response::HTTP_MOVED_PERMANENTLY, Response::HTTP_SEE_OTHER, Response::HTTP_TEMPORARY_REDIRECT, Response::HTTP_PERMANENTLY_REDIRECT, ]); }
php
{ "resource": "" }
q263743
RedirectStatuses.all
test
public static function all($locale = null) { return static::keys()->mapWithKeys(function ($code) use ($locale) { return [$code => Seo::getTrans("redirections.statuses.{$code}", [], $locale)]; }); }
php
{ "resource": "" }
q263744
ErrorHandling.fatalExceptionHandler
test
static function fatalExceptionHandler(\Exception $exception) { throw $exception; file_put_contents(MANIALIB_APP_PATH . 'fatal-error.log', print_r($exception, true), FILE_APPEND); if (array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] == 'GameBox') { ...
php
{ "resource": "" }
q263745
ErrorHandling.computeMessage
test
final static function computeMessage(\Exception $e, $styles = array(), $additionalLines = array()) { if (!$styles) { $styles = static::$messageConfigs['default']; } $trace = $e->getTraceAsString(); $trace = explode("\n", $trace); ...
php
{ "resource": "" }
q263746
ErrorHandling.computeShortMessage
test
final static function computeShortMessage(\Exception $e) { $message = get_class($e) . ' ' . $e->getMessage() . ' (' . $e->getCode() . ') in ' . $e->getFile() . ' at line ' . $e->getLine(); return $message; }
php
{ "resource": "" }
q263747
RedirectsMissingPages.handle
test
public function handle(Request $request, Closure $next) { $response = $next($request); if ($response->getStatusCode() !== Response::HTTP_NOT_FOUND) return $response; return $this->redirector->getRedirectFor($request) ?: $response; }
php
{ "resource": "" }
q263748
Upload.uploadFile
test
static function uploadFile($path, $filename, $maxSize = 2097152) { $inputFile = file_get_contents('php://input', null, null, null, $maxSize); // Else try to get GET data if ($inputFile === false && array_key_exists('input', $_GET)) { $inputFile = $_GET['input']; } ...
php
{ "resource": "" }
q263749
URI.getCurrent
test
static function getCurrent() { $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; $current_uri = $protocol . $_SERVER['HTTP_HOST'] . self::getRequestURI(); $parts = parse_url($current_uri); $query = ''; if (!empty($parts['...
php
{ "resource": "" }
q263750
Tools.getAlignedPosX
test
final public static function getAlignedPosX($posX, $sizeX, $halign, $newAlign) { if (!$halign) { $halign = 'left'; } $alignmentString = $halign . '|' . $newAlign; switch ($alignmentString) { case 'center|center': case 'center|center2': ...
php
{ "resource": "" }
q263751
Tools.getAlignedPosY
test
final public static function getAlignedPosY($posY, $sizeY, $valign, $newAlign) { switch ($valign) { case 'top': case null: $valign = 'right'; break; case 'bottom': $valign = 'left'; break; } ...
php
{ "resource": "" }
q263752
Tools.getAlignedPos
test
final public static function getAlignedPos(\ManiaLib\Gui\Element $object, $newHalign, $newValign) { $newPosX = self::getAlignedPosX( $object->getPosX(), $object->getRealSizeX(), $object->getHalign(), $newHalign); $newPosY = self:...
php
{ "resource": "" }
q263753
GetMinDateTrans.build
test
public function build(\Magento\Framework\DB\Select $source = null) { /* this is root query builder (started from SELECT) */ $result = $this->conn->select(); /* define tables aliases for internal usage (in this method) */ $asAcc = self::AS_ACC; $asTran = self::AS_TRAN; ...
php
{ "resource": "" }
q263754
Reset.quote
test
private function quote($data) { $conn = $this->resource->getConnection(); $result = $conn->quote($data); return $result; }
php
{ "resource": "" }
q263755
Reset.resetAll
test
private function resetAll($dateFrom) { $quoted = $this->quote($dateFrom); $where = EBalance::A_DATE . '>' . $quoted; $result = (int)$this->daoBalance->delete($where); return $result; }
php
{ "resource": "" }
q263756
Reset.queryDeleteByAssets
test
private function queryDeleteByAssets($assetTypeIds, $dateFrom) { $tblAcc = $this->resource->getTableName(EAccount::ENTITY_NAME); $tblBal = $this->resource->getTableName(EBalance::ENTITY_NAME); $conn = $this->resource->getConnection(); $quoted = $conn->quote($dateFrom); $in = ...
php
{ "resource": "" }
q263757
ComposerBridge.configure
test
static function configure(ClassLoader $classLoader, string $vendorDirPath, bool $usePrefixes = true): void { $composerBasePath = $vendorDirPath . '/composer/'; $classLoader->addClassMap(require $composerBasePath . 'autoload_classmap.php'); $classLoader->setUsePrefixes($usePrefixes); ...
php
{ "resource": "" }
q263758
Container.getServiceIds
test
public function getServiceIds() { $services = []; $reserved = ['get', 'getParameter', 'getServiceIds', 'getReturnType']; $container = new \ReflectionClass($this); foreach ($this->factories as $name => $factory) { $services[] = self::underscore($name); } ...
php
{ "resource": "" }
q263759
Container.getReturnType
test
public function getReturnType($name) { $container = new ReflectionClass($this); try { $method = $container->getMethod('get' . self::normalizeName($name)); $doc = $method->getDocComment(); if (!empty($doc)) { preg_match('/@return ([...
php
{ "resource": "" }
q263760
CollectTransactions.exec
test
public function exec($balances, $trans) { $result = []; foreach ($trans as $one) { $accDebit = $one->getDebitAccId(); $accCredit = $one->getCreditAccId(); $timestamp = $one->getDateApplied(); $value = $one->getValue(); /* date_applied is in...
php
{ "resource": "" }
q263761
CollectTransactions.getBalanceEntry
test
private function getBalanceEntry($current, $balances, $accId, $datestamp) { if (isset($balances[$accId][$datestamp])) { /* there is data for this account on this date */ $result = $balances[$accId][$datestamp]; } else { /* there is NO data for this account on this...
php
{ "resource": "" }
q263762
THierarchical.hierarchy
test
protected final static function hierarchy(){ $Hierarchy = [get_called_class()]; while(class_exists($class = get_parent_class($Hierarchy[count($Hierarchy) -1]))){ array_push($Hierarchy, $class); } return $Hierarchy; }
php
{ "resource": "" }
q263763
EasyCurl.changeContentType
test
public function changeContentType($type) { $mime = [ 'json' => 'application/json', 'javascript' => 'application/javascript', 'js' => 'application/javascript', 'ogg' => 'audio/ogg', 'mpeg' => 'audio/mpeg', 'html' => 'text/html', ...
php
{ "resource": "" }
q263764
EasyCurl.headerParse
test
private function headerParse($rawHeader) { $headers = array(); $headerLine = substr($rawHeader, 0, strpos($rawHeader, "\r\n\r\n")); foreach (explode("\r\n", $headerLine) as $i => $line) { if ($i === 0) { $headers['Status-Line'] = $line; continue...
php
{ "resource": "" }
q263765
Str.convertToArray
test
public function convertToArray($string, $value) { $keys = explode('.', $string); return $this->buildDimensionalArray($keys, count($keys), $value); }
php
{ "resource": "" }
q263766
Str.buildDimensionalArray
test
private function buildDimensionalArray(array $keys, $dimensions, $value) { $result = []; // add first dimension $result[$keys[0]] = []; $pointer = &$result[$keys[0]]; for ($i = 1; $i < $dimensions; $i++) { if ($i === ($dimensions - 1)) { $pointer...
php
{ "resource": "" }
q263767
Calc.getAssetTypes
test
private function getAssetTypes($typeIds, $typeCodes) { $result = []; $types = $this->daoTypeAsset->get(); if ( empty($typeIds) && empty($typeCodes) ) { /* return all asset types */ /** @var ETypeAsset $type */ foreach ($type...
php
{ "resource": "" }
q263768
ProcessOneAsset.exec
test
public function exec($assetTypeId) { /* get the last date with balances for given asset then take previous date */ $dsLast = $this->getDateBalanceClose($assetTypeId); $dsPrev = $this->hlpPeriod->getPeriodPrev($dsLast); /* get all closing balances for previous date */ $balance...
php
{ "resource": "" }
q263769
ProcessOneAsset.getDateBalanceClose
test
private function getDateBalanceClose($typeId) { $req = new ARequestLastDate(); $req->setAssetTypeId($typeId); /** @var AResponseLastDate $resp */ $resp = $this->servLastDate->exec($req); $result = $resp->getLastDate(); return $result; }
php
{ "resource": "" }
q263770
ResponseController.checkAction
test
public function checkAction($strategy) { $config = $this->get('dcs_opauth.strategy_parser')->get($strategy); $opauth = new \Opauth($config, false); $this->dispatchEvent(DCSOpauthEvents::BEFORE_PARSE_RESPONSE, new OpauthEvent($opauth)); $responseData = $this->get('dcs_opauth.respons...
php
{ "resource": "" }
q263771
TMutatable.mutate
test
protected final function mutate(string $prefix, string $name, $value = null) { return method_exists($this, $method = Src::tcm(strtolower(Str::join('_', $prefix, $name , 'property')))) ? call_user_func([$this, $method], $value) : $value; }
php
{ "resource": "" }
q263772
Client.fetch
test
public function fetch($url) { $this->builder = new Builder(urlencode($url)); foreach ($this->defaults as $key => $value) { if (method_exists($this->builder, $key)) { call_user_func([$this->builder, $key], $value); } } return $this; }
php
{ "resource": "" }
q263773
Client.url
test
public function url() { if (!isset($this->config['url'])) { throw InvalidConfigurationException::urlNotDefined(); } if (!isset($this->config['client'])) { throw InvalidConfigurationException::clientNotDefined(); } return implode('/', array_filter([ ...
php
{ "resource": "" }
q263774
LazyStrings.generate
test
public function generate() { // validate doc url and sheets if (!$this->validator->validateDocUrl($this->csvUrl)) { throw new Exception('Provided doc url is not valid.'); } $this->validator->validateSheets($this->sheets); $strings = []; foreach ($this->...
php
{ "resource": "" }
q263775
LazyStrings.parse
test
private function parse($csvUrl) { $csvFile = fopen($csvUrl, 'r'); $strings = []; if ($csvFile !== false) { while (($row = fgetcsv($csvFile, 1000, ',')) !== false) { if ($row[0] !== '' && $row[0] !== 'id') { $id = $this->str->strip($row[0]); ...
php
{ "resource": "" }
q263776
LazyStrings.localize
test
private function localize($csvId) { $strings = []; $urlPart = '&single=true&gid='; if (is_array($csvId)) { foreach ($csvId as $id) { $parsed = $this->parse($this->csvUrl . $urlPart . $id); $strings = array_merge($strings, $parsed); } ...
php
{ "resource": "" }
q263777
LazyStrings.backup
test
private function backup(array $strings, $path, $filename) { $stringsFile = $path . '/' . $filename; $jsonStrings = json_encode($strings, JSON_PRETTY_PRINT); $this->createDirectory($path); file_put_contents($stringsFile, $jsonStrings); }
php
{ "resource": "" }
q263778
Account.getAllByAssetTypeCode
test
public function getAllByAssetTypeCode($assetTypeCode) { /* aliases and tables */ $asType = 'at'; $asAcc = 'acc'; /* SELECT FROM prxgt_acc_type_asset */ $query = $this->conn->select(); $tbl = $this->resource->getTableName(TypeAsset::ENTITY_NAME); $cols = []; ...
php
{ "resource": "" }
q263779
Account.getAssetTypeId
test
public function getAssetTypeId($accountId) { $result = null; /** @var Entity $entity */ $entity = $this->getById($accountId); if ($entity) { $result = $entity->getAssetTypeId(); } return $result; }
php
{ "resource": "" }
q263780
Account.getCustomerAccByAssetCode
test
public function getCustomerAccByAssetCode($customerId, $assetTypeCode) { $assetTypeId = $this->daoTypeAsset->getIdByCode($assetTypeCode); $result = $this->getByCustomerId($customerId, $assetTypeId); return $result; }
php
{ "resource": "" }
q263781
Account.getSystemCustomerId
test
public function getSystemCustomerId() { if (is_null($this->cachedSysCustId)) { $conn = $this->conn; /* there is no cached value for the customer ID, select data from DB */ $where = Cfg::E_CUSTOMER_A_EMAIL . '=' . $conn->quote(Cfg::SYS_CUSTOMER_EMAIL); $data = ...
php
{ "resource": "" }
q263782
Create.exec
test
public function exec($request) { assert($request instanceof ARequest); $result = new AResponse(); $debitAccId = $request->getDebitAccId(); $creditAccId = $request->getCreditAccId(); $operationId = $request->getOperationId(); $dateApplied = $request->getDateApplied(); ...
php
{ "resource": "" }
q263783
DCSOpauthExtension.buildStrategiesKey
test
private function buildStrategiesKey($strategies) { foreach ($strategies as $name => $config) { switch ($config['strategy_class']) { case 'Basecamp': case 'Behance': case 'Bitly': case 'Do': case 'Dropbox': ...
php
{ "resource": "" }
q263784
ResponseParser.parse
test
public function parse(\Opauth $opauth) { $callbackTransport = $opauth->env['callback_transport']; switch($callbackTransport) { case 'session': $response = $_SESSION['opauth']; unset($_SESSION['opauth']); break; case 'post': ...
php
{ "resource": "" }
q263785
ConnectController.loginAction
test
public function loginAction($strategy) { $config = $this->get('dcs_opauth.strategy_parser')->get($strategy); $opauth = new \Opauth($config); }
php
{ "resource": "" }
q263786
View.render
test
public function render($path, $data = []) { $this->data = array_merge($this->data, $data); $this->setPath($path); $contents = $this->renderContents(); return $contents; }
php
{ "resource": "" }
q263787
Validate.getAssetTypes
test
private function getAssetTypes() { $result = []; $types = $this->daoTypeAsset->get(); /** @var ETypeAsset $type */ foreach ($types as $type) { $typeId = $type->getId(); $typeCode = $type->getCode(); $result[$typeId] = $typeCode; } r...
php
{ "resource": "" }
q263788
ServerResponse.send
test
public function send() { if ($this->getProtocolVersion() && $this->getStatusCode()) { header(static::VERSION_DELIMITER . $this->getProtocolVersion() . ' ' . $this->getStatusCode() . ' ' . $this->getReasonPhrase()); } foreach ($this->getHeaders() as $key => $value) { header($key . static::HEADER_DELIMITER ...
php
{ "resource": "" }
q263789
Authenticator.authenticate
test
public function authenticate($responseData) { $token = new OpauthToken($responseData, $this->roles); $this->securityContext->setToken($token); }
php
{ "resource": "" }
q263790
VerifyApiToken.verifyToken
test
protected function verifyToken(Request $request) { $time = (int) ($request->input('_time') ?: $request->header('X-API-TIME')); $token = $request->input('_token') ?: $request->header('X-API-TOKEN'); return abs(time() - $time) < (int) config('api.token_duration') && $this->token->...
php
{ "resource": "" }
q263791
Validator.validateDocUrl
test
public function validateDocUrl($url) { $pattern = '/http:\/\/docs\.google\.com\/spreadsheets\/d\/.*\/export\?format=csv/'; if (is_null($url) || $url === '' || preg_match($pattern, $url) !== 1) { return false; } return true; }
php
{ "resource": "" }
q263792
ApiServiceProvider.registerClient
test
protected function registerClient() { $this->app->singleton('api.client', function ($app) { $client = new Client( $app['encrypter'], $app['config']->get('api.clients', []) ); $client->setDefaultAppKey($app['config']->get('api.default_clien...
php
{ "resource": "" }
q263793
ApiServiceProvider.registerToken
test
protected function registerToken() { $this->app->singleton('api.token', function ($app) { return new Token($app['api.client']); }); $this->app->alias('api.token', Token::class); }
php
{ "resource": "" }
q263794
ApiServiceProvider.registerForConsole
test
protected function registerForConsole() { $this->publishes([ __DIR__.'/../config/api.php' => base_path('config/api.php'), ], 'laravel-api'); $this->commands([ Console\GenerateClientCommand::class, Console\GenerateTokenCommand::class, ]); }
php
{ "resource": "" }
q263795
Session.start
test
public static function start($name = null) { if (session_status() !== PHP_SESSION_NONE) { throw new \RuntimeException('Can\'t start a new session.'); } if ($name !== null) { session_name($name); } session_start(); }
php
{ "resource": "" }
q263796
TRetrospective.retrospect
test
protected final static function retrospect(string $name){ return call_user_func_array('array_merge', array_map(function($class) use ($name){ return property_exists($class, $name) ? $class::${$name} : []; }, array_reverse(static::hierarchy()))); }
php
{ "resource": "" }
q263797
Response.setStatus
test
private function setStatus($statusCode, $reasonPhrase = '') { if ($reasonPhrase === '' && isset(self::$reasonPhrases[$statusCode])) { $reasonPhrase = self::$reasonPhrases[$statusCode]; } $this->statusCode = $statusCode; $this->reasonPhrase = $reasonPhrase; return $this; }
php
{ "resource": "" }
q263798
Tokenizer.tree
test
public function tree($css) { // Do stuff $this->_tokens = $this->tokenize($css); $results = $this->_parseTokens(array_shift($this->_tokens)); // Add remaining items to root element while (count($this->_tokens)) { if (!$this->ignoreErrors) { $this->err...
php
{ "resource": "" }
q263799
Tokenizer._findTokens
test
protected function _findTokens($tokens) { $list = []; foreach ($tokens as $token) { $index = 0; while (true) { $index = strpos($this->_cssLC, $token, $index); if ($index === false) { break; } $li...
php
{ "resource": "" }