_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q3200
DataTablesFactory.parseColumns
train
protected static function parseColumns(array $rawColumns, DataTablesWrapperInterface $wrapper) { $dtColumns = []; foreach ($rawColumns as $current) { $dtColumn = static::parseColumn($current, $wrapper); if (null === $dtColumn) { continue; } ...
php
{ "resource": "" }
q3201
DataTablesFactory.parseOrder
train
protected static function parseOrder(array $rawOrder) { $dtOrder = new DataTablesOrder(); if (false === static::isValidRawOrder($rawOrder)) { return $dtOrder; } $dtOrder->setColumn(intval($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN])); $dtOrder-...
php
{ "resource": "" }
q3202
DataTablesFactory.parseOrders
train
protected static function parseOrders(array $rawOrders) { $dtOrders = []; foreach ($rawOrders as $current) { $dtOrders[] = static::parseOrder($current); } return $dtOrders; }
php
{ "resource": "" }
q3203
DataTablesFactory.parseSearch
train
protected static function parseSearch(array $rawSearch) { $dtSearch = new DataTablesSearch(); if (false === static::isValidRawSearch($rawSearch)) { return $dtSearch; } $dtSearch->setRegex(BooleanHelper::parseString($rawSearch[DataTablesSearchInterface::DATATABLES_PARAMETER...
php
{ "resource": "" }
q3204
ObjectRegistry.register
train
public function register($nickname, $object) { if (isset($this->autoInstantiations[$nickname])) { throw new DuplicateObjectException($nickname); } $this->autoInstantiations[$nickname] = $object; }
php
{ "resource": "" }
q3205
ObjectRegistry.get
train
public function get($nickname) { if (isset($this->autoInstantiations[$nickname])) { return $this->autoInstantiations[$nickname]; } return null; }
php
{ "resource": "" }
q3206
MailruResourceOwner.getLocation
train
public function getLocation() { $country = $this->getCountry(); $city = $this->getCity(); return (empty($country)) ? $city : $country . ', ' . $city; }
php
{ "resource": "" }
q3207
WhiteHTMLFilter.loadHTML
train
public function loadHTML($html) { $html = str_replace(chr(13), '', $html); $html = '<?xml version="1.0" encoding="utf-8" ?><' . $this->PARENT_TAG_NAME . '>' . $html . '</' . $this->PARENT_TAG_NAME . '>'; if (defined('LIBXML_HTML_NODEFDTD')) { return $this->dom->loadHTML($html, LI...
php
{ "resource": "" }
q3208
WhiteHTMLFilter.outputHtml
train
public function outputHtml() { $result = ''; if (!is_null($this->dom)) { //SaveXML : <br/><img/> //SaveHTML: <br><img> $result = trim($this->dom->saveXML($this->getRealElement())); $result = str_replace($this->TEMP_CONTENT, '', $result); $p...
php
{ "resource": "" }
q3209
WhiteHTMLFilter.cleanNodes
train
private function cleanNodes(DOMElement $elem, $isFirstNode = false) { $nodeName = strtolower($elem->nodeName); $textContent = $elem->textContent; if ($isFirstNode || array_key_exists($nodeName, $this->config->WhiteListTag)) { if ($elem->hasAttributes()) { $this->c...
php
{ "resource": "" }
q3210
WhiteHTMLFilter.cleanAttributes
train
private function cleanAttributes(DOMElement $elem) { $tagName = strtolower($elem->nodeName); $attributes = $elem->attributes; $attributesWhiteList = $this->config->WhiteListHtmlGlobalAttributes; $attributesFilterMap = array(); $allowDataAttribute = in_array("data-*", $attribu...
php
{ "resource": "" }
q3211
WhiteHTMLFilter.cleanAttrValue
train
private function cleanAttrValue(DOMAttr $domAttr) { $attrName = strtolower($domAttr->name); if ($attrName === 'style' && !empty($this->config->WhiteListStyle)) { $styles = explode(';', $domAttr->value); foreach ($styles as $key => &$subStyle) { $subStyle = arr...
php
{ "resource": "" }
q3212
WhiteHTMLFilter.clean
train
public function clean() { $this->removedTags = array(); $elem = $this->getRealElement(); if (is_null($elem)) { return array(); } $this->cleanNodes($elem, true); return $this->removedTags; }
php
{ "resource": "" }
q3213
NGSIAPIv1.getEntities
train
public function getEntities($type = false, $offset = 0, $limit = 1000, $details = "on") { if ($type) { $url = $this->url . "contextTypes/" . $type; } else { $url = $this->url . "contextEntities/"; } $ret = $this->restRequest($url . "?offset=$offset&limit=$limit&d...
php
{ "resource": "" }
q3214
Util.strEscape
train
public static function strEscape( $str, $escape = 'plain' ) { switch ( $escape ) { case 'html' : case 'htmlspecialchars' : $str = htmlspecialchars( $str ); break; case 'htmlentities': $str = htmlentities( $str, ENT_QUOTES, 'UTF-8' ); break; // 'plain' or anything else: Do nothing } ret...
php
{ "resource": "" }
q3215
Util.tag
train
public static function tag( $str, $wrapTag = 0, $attributes = [] ) { $selfclose = [ 'link', 'input', 'br', 'img' ]; if ( !is_string( $str ) ) { return ''; } if ( !is_string( $wrapTag ) ) { return $str; } $wrapTag = trim( strtolower( $wrapTag ) ); $attrString = ''; if ( is_array( $attributes ) ) {...
php
{ "resource": "" }
q3216
Util.getAcceptableLanguages
train
public static function getAcceptableLanguages( $rawList = false ) { // Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang // Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header // @codeCoverageIgnoreStart if ( $rawList === false ) { $rawList = isset( $_SERVER['...
php
{ "resource": "" }
q3217
Util.parseExternalLinks
train
public static function parseExternalLinks( $text ) { static $urlProtocols = false; static $counter = 0; // @codeCoverageIgnoreStart if ( !$urlProtocols ) { if ( function_exists( 'wfUrlProtocols' ) ) { // Allow custom protocols $urlProtocols = wfUrlProtocols(); } else { $urlProtocols = 'https?:...
php
{ "resource": "" }
q3218
Util.parseWikiLinks
train
public static function parseWikiLinks( $text, $articlePath ) { self::$articlePath = $articlePath; return preg_replace_callback( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/', function ( array $bits ) { if ( !isset( $bits[2] ) || $bits[2] == '' ) { $bits[2] = strtr( $bits[1], '_', ' ' ); } $article =...
php
{ "resource": "" }
q3219
Util.prettyEncodedWikiUrl
train
public static function prettyEncodedWikiUrl( $articlePath, $article ) { $s = strtr( $article, ' ', '_' ); $s = urlencode( $s ); $s = str_ireplace( [ '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F', '%3A' ], [ ';', '@', '$', '!', '*', '(', ')', ',', '/', ':' ], $s ); $s = str_replace( '...
php
{ "resource": "" }
q3220
FileUploader.upload
train
public function upload(ApiClientContract $api, $path, $body, array $params = [], $verifyChecksum = true) { $response = $api->request('PUT', $path, [ 'headers' => $this->convertUploadParamsToHeaders($body, $params, $verifyChecksum), 'body' => $body, 'query' => $this->extra...
php
{ "resource": "" }
q3221
FileUploader.convertUploadParamsToHeaders
train
protected function convertUploadParamsToHeaders($body = null, array $params = [], $verifyChecksum = true) { $headers = []; if ($verifyChecksum) { $headers['ETag'] = md5($body); } $availableParams = [ 'contentType' => 'Content-Type', 'contentDispo...
php
{ "resource": "" }
q3222
FileUploader.extractQueryParameters
train
protected function extractQueryParameters(array $params) { $availableParams = ['extract-archive']; $query = []; foreach ($params as $key => $value) { if (in_array($key, $availableParams)) { $query[$key] = $value; } } return $query; ...
php
{ "resource": "" }
q3223
TokenStorage.getToken
train
public function getToken() { $token = $this->cache->get($this->tokenName); if ($token === false) { $token = Algorithms::generateRandomToken(20); $this->storeToken($token); } return $token; }
php
{ "resource": "" }
q3224
DataTablesOrder.setDir
train
public function setDir($dir) { if (false === in_array($dir, DataTablesEnumerator::enumDirs())) { $dir = self::DATATABLES_DIR_ASC; } $this->dir = strtoupper($dir); return $this; }
php
{ "resource": "" }
q3225
ApiClient.getHttpClient
train
public function getHttpClient() { if (!is_null($this->httpClient)) { return $this->httpClient; } return $this->httpClient = new Client([ 'base_uri' => $this->storageUrl(), 'headers' => [ 'X-Auth-Token' => $this->token(), ], ...
php
{ "resource": "" }
q3226
ApiClient.authenticate
train
public function authenticate() { if (!is_null($this->token)) { return; } $response = $this->authenticationResponse(); if (!$response->hasHeader('X-Auth-Token')) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } ...
php
{ "resource": "" }
q3227
ApiClient.authenticationResponse
train
public function authenticationResponse() { $client = new Client(); try { $response = $client->request('GET', static::AUTH_URL, [ 'headers' => [ 'X-Auth-User' => $this->username, 'X-Auth-Key' => $this->password, ], ...
php
{ "resource": "" }
q3228
LanguageEo.iconv
train
function iconv( $in, $out, $string ) { if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { #...
php
{ "resource": "" }
q3229
GiroCheckout_SDK_TransactionType_helper.getTransactionTypeByName
train
public static function getTransactionTypeByName($transType) { switch ($transType) { //credit card apis case 'creditCardTransaction': return new GiroCheckout_SDK_CreditCardTransaction(); case 'creditCardCapture': return new GiroCheckout_SDK_CreditCardCapture(); case 'creditCar...
php
{ "resource": "" }
q3230
ControllerInspector.getRoutable
train
public function getRoutable($controller, $prefix) { $routable = []; $reflection = new ReflectionClass($controller); $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); // To get the routable methods, we will simply spin through all methods on the // controller in...
php
{ "resource": "" }
q3231
ControllerInspector.getMethodData
train
public function getMethodData(ReflectionMethod $method, $prefix) { $verb = $this->getVerb($name = $method->name); $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); return compact('verb', 'plain', 'uri'); }
php
{ "resource": "" }
q3232
Tx_Oelib_Model_BackEndUser.getLanguage
train
public function getLanguage() { $configuration = $this->getConfiguration(); $result = !empty($configuration['lang']) ? $configuration['lang'] : $this->getDefaultLanguage(); return ($result !== '') ? $result : 'default'; }
php
{ "resource": "" }
q3233
Tx_Oelib_Model_BackEndUser.getAllGroups
train
public function getAllGroups() { $result = new \Tx_Oelib_List(); $groupsToProcess = $this->getGroups(); do { $groupsForNextStep = new \Tx_Oelib_List(); $result->append($groupsToProcess); /** @var \Tx_Oelib_Model_BackEndUserGroup $group */ fore...
php
{ "resource": "" }
q3234
Tx_Oelib_Model_BackEndUser.getConfiguration
train
private function getConfiguration() { if (empty($this->configuration)) { $this->configuration = unserialize($this->getAsString('uc')); } return $this->configuration; }
php
{ "resource": "" }
q3235
Response.getErrorData
train
public function getErrorData($key = null) { if ($this->isSuccessful()) { return null; } // get error data (array in data) $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null; if ($key) { return isset($data[$key]) ? $data[$key] :...
php
{ "resource": "" }
q3236
Response.getMessage
train
public function getMessage() { if ($this->getErrorMessage()) { return $this->getErrorMessage() . ' (' . $this->getErrorFieldName() . ')'; } if ($this->isSuccessful()) { return ($this->getStatus()) ? ucfirst($this->getStatus()) : 'Successful'; } // def...
php
{ "resource": "" }
q3237
Response.getHttpResponseCodeText
train
public function getHttpResponseCodeText() { $code = $this->getHttpResponseCode(); $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts; return (isset($statusTexts[$code])) ? $statusTexts[$code] : null; }
php
{ "resource": "" }
q3238
AbstractController.buildDataTablesResponse
train
protected function buildDataTablesResponse(Request $request, $name, ActionResponse $output) { if (true === $request->isXmlHttpRequest()) { return new JsonResponse($output); } // Notify the user. switch ($output->getStatus()) { case 200: $this->n...
php
{ "resource": "" }
q3239
AbstractController.exportDataTablesCallback
train
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) { $em = $this->getDoctrine()->getManager(); $stream = fopen("php://output", "w+"); // Export the columns. ...
php
{ "resource": "" }
q3240
AbstractController.getDataTablesColumn
train
protected function getDataTablesColumn(DataTablesProviderInterface $dtProvider, $data) { $this->getLogger()->debug(sprintf("DataTables controller search for a column with name \"%s\"", $data)); $dtColumn = $this->getDataTablesWrapper($dtProvider)->getColumn($data); if (null === $dtColumn) { ...
php
{ "resource": "" }
q3241
AbstractController.getDataTablesEntityById
train
protected function getDataTablesEntityById(DataTablesProviderInterface $dtProvider, $id) { $repository = $this->getDataTablesRepository($dtProvider); $this->getLogger()->debug(sprintf("DataTables controller search for an entity [%s]", $id)); $entity = $repository->find($id); if (null ...
php
{ "resource": "" }
q3242
AbstractController.getDataTablesURL
train
protected function getDataTablesURL(DataTablesProviderInterface $dtProvider) { $this->getLogger()->debug(sprintf("DataTables controller search for an URL with name \"%s\"", $dtProvider->getName())); if (false === ($dtProvider instanceof DataTablesRouterInterface)) { return $this->getRouter...
php
{ "resource": "" }
q3243
AbstractController.getDataTablesWrapper
train
protected function getDataTablesWrapper(DataTablesProviderInterface $dtProvider) { $url = $this->getDataTablesURL($dtProvider); $dtWrapper = DataTablesFactory::newWrapper($url, $dtProvider, $this->getKernelEventListener()->getUser()); foreach ($dtProvider->getColumns() as $dtColumn) { ...
php
{ "resource": "" }
q3244
AbstractController.prepareActionResponse
train
protected function prepareActionResponse($status, $notificationId) { $response = new ActionResponse(); $response->setStatus($status); $response->setNotify($this->getDataTablesNotification($notificationId)); return $response; }
php
{ "resource": "" }
q3245
GalleryHubController.PaginatedGalleries
train
public function PaginatedGalleries() { $children = $this->AllChildren(); $limit = $this->ThumbnailsPerPage; $list = ArrayList::create(); foreach ($children as $child) { $image = $child->SortedImages()->first(); $child_data = $child->toMap(); $chil...
php
{ "resource": "" }
q3246
FluentFilesLoader.setParam
train
protected function setParam($key, $value, $trimLeadingSlashes = true) { $this->params[$key] = $trimLeadingSlashes ? ltrim($value, '/') : $value; return $this; }
php
{ "resource": "" }
q3247
FluentFilesLoader.limit
train
public function limit($limit, $markerFile = '') { return $this->setParam('limit', intval($limit), false) ->setParam('marker', $markerFile, false); }
php
{ "resource": "" }
q3248
FluentFilesLoader.find
train
public function find($path) { $file = $this->findFileAt($path); if (is_null($file)) { throw new FileNotFoundException('File "'.$path.'" was not found.'); } return new File($this->api, $this->containerName(), $file); }
php
{ "resource": "" }
q3249
FluentFilesLoader.findFileAt
train
protected function findFileAt($path) { try { $files = $this->fromDirectory('') ->withPrefix($path) ->withDelimiter('') ->limit(1) ->get(); } catch (ApiRequestFailedException $e) { return; } retur...
php
{ "resource": "" }
q3250
FluentFilesLoader.get
train
public function get() { $response = $this->api->request('GET', $this->containerUrl, [ 'query' => $this->buildParams(), ]); if ($response->getStatusCode() !== 200) { throw new ApiRequestFailedException('Unable to list container files.', $response->getStatusCode()); ...
php
{ "resource": "" }
q3251
Tx_Oelib_AbstractMailer.formatEmailBody
train
protected function formatEmailBody($rawEmailBody) { if (!$this->enableFormatting) { return $rawEmailBody; } $body = str_replace([CRLF, CR], LF, $rawEmailBody); $body = preg_replace('/\\n{2,}/', LF . LF, $body); return trim($body); }
php
{ "resource": "" }
q3252
Tx_Oelib_SalutationSwitcher.getAvailableLanguages
train
private function getAvailableLanguages() { if ($this->availableLanguages === null) { $this->availableLanguages = []; if (!empty($this->LLkey)) { $this->availableLanguages[] = $this->LLkey; } // The key for English is "default", not "en". ...
php
{ "resource": "" }
q3253
Tx_Oelib_SalutationSwitcher.getSuffixesToTry
train
private function getSuffixesToTry() { if ($this->suffixesToTry === null) { $this->suffixesToTry = []; if (isset($this->conf['salutation'])) { if ($this->conf['salutation'] === 'informal') { $this->suffixesToTry[] = '_informal'; } ...
php
{ "resource": "" }
q3254
Tx_Oelib_Visibility_Tree.buildTreeFromArray
train
private function buildTreeFromArray( array $treeStructure, \Tx_Oelib_Visibility_Node $parentNode ) { foreach ($treeStructure as $nodeKey => $nodeContents) { /** @var \Tx_Oelib_Visibility_Node $childNode */ $childNode = GeneralUtility::makeInstance(\Tx_Oelib_Visibility...
php
{ "resource": "" }
q3255
Tx_Oelib_Visibility_Tree.getKeysOfHiddenSubparts
train
public function getKeysOfHiddenSubparts() { $keysToHide = []; foreach ($this->nodes as $key => $node) { if (!$node->isVisible()) { $keysToHide[] = $key; } } return $keysToHide; }
php
{ "resource": "" }
q3256
Tx_Oelib_Visibility_Tree.makeNodesVisible
train
public function makeNodesVisible(array $nodeKeys) { foreach ($nodeKeys as $nodeKey) { if (isset($this->nodes[$nodeKey])) { $this->nodes[$nodeKey]->markAsVisible(); } } }
php
{ "resource": "" }
q3257
GiroCheckout_SDK_Curl_helper.submit
train
public static function submit($url, $params) { $Config = GiroCheckout_SDK_Config::getInstance(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl...
php
{ "resource": "" }
q3258
GiroCheckout_SDK_Curl_helper.getJSONResponseToArray
train
public static function getJSONResponseToArray($string) { $json = json_decode($string,true); if($json !== NULL) { return $json; } else { throw new \Exception('Response is not a valid json string.'); } }
php
{ "resource": "" }
q3259
GiroCheckout_SDK_Curl_helper.getHeaderAndBody
train
private static function getHeaderAndBody($response) { $header = self::http_parse_headers(substr($response, 0, strrpos($response,"\r\n\r\n"))); $body = substr($response, strrpos($response,"\r\n\r\n")+4); return array($header,$body); }
php
{ "resource": "" }
q3260
Tx_Oelib_BackEndLoginManager.getLoggedInUser
train
public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_BackEndUser::class) { if ($mapperName === '') { throw new \InvalidArgumentException('$mapperName must not be empty.', 1331318483); } if (!$this->isLoggedIn()) { return null; } if ($this->lo...
php
{ "resource": "" }
q3261
Package.boot
train
public function boot(\Neos\Flow\Core\Bootstrap $bootstrap) { $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect(ConfigurationManager::class, 'configurationManagerReady', function (ConfigurationManager $configurationManager) use ($dispatcher) { $enabled = $configura...
php
{ "resource": "" }
q3262
Customizer.defaultPanel
train
public static function defaultPanel() { $argCount = func_num_args(); $args = func_get_args(); $sections = array(); for ($i = 0; $i < $argCount; ++$i) { $sections[$args[$i]['id']] = $args[$i]; } return array( 'sections' => $sections );...
php
{ "resource": "" }
q3263
Customizer.panel
train
public static function panel($title, $description) { $argCount = func_num_args(); $args = func_get_args(); $sections = array(); for ($i = 2; $i < $argCount; ++$i) { $sections[$args[$i]['id']] = $args[$i]; } return array( 'title' => $tit...
php
{ "resource": "" }
q3264
NextrasOrmEventsExtension.loadEntityMapping
train
private function loadEntityMapping(): array { $mapping = []; $builder = $this->getContainerBuilder(); $repositories = $builder->findByType(IRepository::class); foreach ($repositories as $repository) { /** @var string $repositoryClass */ $repositoryClass = $repository->getEntity(); // Skip invalid r...
php
{ "resource": "" }
q3265
GalleryPageController.Gallery
train
public function Gallery() { if ($this->Images()->exists()) { // Create a list of images with generated gallery image and thumbnail $images = ArrayList::create(); $pages = $this->PaginatedImages(); foreach ($this->PaginatedImages() as $image) { ...
php
{ "resource": "" }
q3266
GiroCheckout_SDK_Request_Cart.addItem
train
public function addItem($p_strName, $p_iQuantity, $p_iGrossAmt, $p_strEAN = "") { if (empty($p_strName) || empty($p_iQuantity) || !isset($p_iGrossAmt)) { throw new GiroCheckout_SDK_Exception_helper('Name, quantity and amount are mandatory for cart items'); } $aItem = array( "name" => $p_strNam...
php
{ "resource": "" }
q3267
GiroCheckout_SDK_Request_Cart.getAllItems
train
public function getAllItems() { if (version_compare(phpversion(), '5.3.0', '<')) { return json_encode($this->m_aItems); } else { return json_encode($this->m_aItems, JSON_UNESCAPED_UNICODE); } }
php
{ "resource": "" }
q3268
subscribeContext.notifyConditions
train
public function notifyConditions($type, $condValues = array()) { if (!is_array($condValues)) { $condValues = array($condValues); } $context = new \Orion\Context\ContextFactory(); $context->put("type", $type); $context->put("condValues", $condValues); $this->...
php
{ "resource": "" }
q3269
DataTablesWrapper.removeColumn
train
public function removeColumn(DataTablesColumnInterface $column) { if (true === array_key_exists($column->getData(), $this->columns)) { $this->columns[$column->getData()]->getMapping()->setPrefix(null); unset($this->columns[$column->getData()]); } return $this; }
php
{ "resource": "" }
q3270
Strings.sanitizeJsVarName
train
public static function sanitizeJsVarName($str) { $out = preg_replace("/ /", '_', trim($str)); $out = preg_replace("/[^A-Za-z_]/", '', $out); return $out; }
php
{ "resource": "" }
q3271
ContextFactory.addAttribute
train
public function addAttribute($name, $value, $type = "Integer", $metadata = null) { $attr = (object) [ "value" => $value, "type" => $type ]; if(null != $metadata){ $attr->metadata = (object) $metadata; } $this->...
php
{ "resource": "" }
q3272
Tx_Oelib_Visibility_Node.setParent
train
public function setParent(\Tx_Oelib_Visibility_Node $parentNode) { if ($this->parentNode !== null) { throw new \InvalidArgumentException('This node already has a parent node.', 1331488668); } $this->parentNode = $parentNode; }
php
{ "resource": "" }
q3273
TextualDateExtension.textualDateFilter
train
public function textualDateFilter($date) { if ( ! $date instanceof \DateTime) { throw new \InvalidArgumentException('Textual Date Filter expects input to be a instance of DateTime'); } $now = new \DateTime('now'); $diff = $now->diff($date); $diffUnit =...
php
{ "resource": "" }
q3274
TextualDateExtension.getHighestDiffUnitAndValue
train
protected function getHighestDiffUnitAndValue($diff) { // Manually define props due to Reflection Bug #53439 (PHP) $properties = array('y', 'm', 'd', 'h', 'i', 's'); foreach($properties as $prop) { if ($diff->$prop > 0) { return array('unit' => $prop, 'value' => ...
php
{ "resource": "" }
q3275
GiroCheckout_SDK_ResponseCode_helper.getMessage
train
public static function getMessage( $code, $lang = 'EN' ) { if( $code < 0 ) { return null; } //code invalid $lang = strtoupper( $lang ); if( !array_key_exists( $lang, self::$code ) ) { //language not found $lang = 'EN'; } if( array_key_exists( $code, self::$code[$lang] ) ) { //code...
php
{ "resource": "" }
q3276
AjaxHandler.registerHooks
train
protected function registerHooks() { // Our callbacks are registered only on the admin side even for guest and frontend callbacks if (is_admin()) { switch ($this->accessType) { case 'guest': Hooks::action('wp_ajax_nopriv_' . static:...
php
{ "resource": "" }
q3277
AjaxHandler.addGlobalVariables
train
public function addGlobalVariables($vars) { $globalVars = $this->getGlobalVariables(); if ($globalVars == null || empty($globalVars)) { return $vars; } return array_merge($vars, $this->getGlobalVariables()); }
php
{ "resource": "" }
q3278
Tx_Oelib_TemplateRegistry.getByFileName
train
public function getByFileName($fileName) { if (!isset($this->templates[$fileName])) { /** @var \Tx_Oelib_Template $template */ $template = GeneralUtility::makeInstance(\Tx_Oelib_Template::class); if ($fileName !== '') { $template->processTemplateFromFile(...
php
{ "resource": "" }
q3279
GiroCheckout_SDK_Config.setConfig
train
public function setConfig($key,$value) { switch ($key) { //curl options case 'CURLOPT_CAINFO': case 'CURLOPT_SSL_VERIFYPEER': case 'CURLOPT_SSL_VERIFYHOST': case 'CURLOPT_CONNECTTIMEOUT': // Proxy case 'CURLOPT_PROXY': case 'CURLOPT_PROXYPORT': case 'CURLOPT_P...
php
{ "resource": "" }
q3280
AbstractDataTablesTwigExtension.encodeOptions
train
protected function encodeOptions(array $options) { if (0 === count($options)) { return "{}"; } ksort($options); $output = json_encode($options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); return str_replace("\n", "\n ", $output); }
php
{ "resource": "" }
q3281
AbstractDataTablesTwigExtension.jQueryDataTablesStandalone
train
protected function jQueryDataTablesStandalone($selector, $language, array $options) { if (null !== $language) { $options["language"] = ["url" => DataTablesWrapperHelper::getLanguageURL($language)]; } $searches = ["%selector%", "%options%"]; $replaces = [$selector, $this->en...
php
{ "resource": "" }
q3282
AbstractDataTablesTwigExtension.renderDataTablesColumn
train
private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $rowScope = false) { $attributes = []; $attributes["scope"] = true === $rowScope ? "row" : null; $attributes["class"] = $dtColumn->getClassname(); $attributes["width"] = $dtColumn->getWidth(); return ...
php
{ "resource": "" }
q3283
AbstractDataTablesTwigExtension.renderDataTablesRow
train
private function renderDataTablesRow(DataTablesWrapperInterface $dtWrapper, $wrapper) { $innerHTML = ""; $count = count($dtWrapper->getColumns()); for ($i = 0; $i < $count; ++$i) { $dtColumn = array_values($dtWrapper->getColumns())[$i]; $th = $this->renderDataTablesCo...
php
{ "resource": "" }
q3284
Tx_Oelib_List.rebuildUidCache
train
private function rebuildUidCache() { $this->hasItemWithoutUid = false; /** @var \Tx_Oelib_Model $item */ foreach ($this as $item) { if ($item->hasUid()) { $uid = $item->getUid(); $this->uids[$uid] = $uid; } else { $this...
php
{ "resource": "" }
q3285
Tx_Oelib_List.sort
train
public function sort($callbackFunction) { $items = iterator_to_array($this, false); usort($items, $callbackFunction); /** @var \Tx_Oelib_Model $item */ foreach ($items as $item) { $this->detach($item); $this->attach($item); } $this->markAsDir...
php
{ "resource": "" }
q3286
Tx_Oelib_List.purgeCurrent
train
public function purgeCurrent() { if (!$this->valid()) { return; } if ($this->current()->hasUid()) { $uid = $this->current()->getUid(); if (isset($this->uids[$uid])) { unset($this->uids[$uid]); } } $this->detach...
php
{ "resource": "" }
q3287
Tx_Oelib_Model.resetData
train
public function resetData(array $data) { $this->data = $data; if ($this->existsKey('uid')) { if (!$this->hasUid()) { $this->setUid((int)$this->data['uid']); } unset($this->data['uid']); } $this->markAsLoaded(); if ($this->h...
php
{ "resource": "" }
q3288
Tx_Oelib_Model.setUid
train
public function setUid($uid) { if ($this->hasUid()) { throw new \BadMethodCallException('The UID of a model cannot be set a second time.', 1331489260); } if ($this->isVirgin()) { $this->setLoadStatus(self::STATUS_GHOST); } $this->uid = $uid; }
php
{ "resource": "" }
q3289
Tx_Oelib_Model.load
train
private function load() { if ($this->isVirgin()) { throw new \BadMethodCallException( get_class($this) . '#' . $this->getUid() . ': Please call setData() directly after instantiation first.', 1331489395 ); } if ($this->...
php
{ "resource": "" }
q3290
Tx_Oelib_Model.setToDeleted
train
public function setToDeleted() { if ($this->isLoaded()) { $this->data['deleted'] = true; $this->markAsDirty(); } else { $this->markAsDead(); } }
php
{ "resource": "" }
q3291
Tx_Oelib_Model.isEmpty
train
public function isEmpty() { if ($this->isGhost()) { $this->load(); $this->markAsLoaded(); } return empty($this->data); }
php
{ "resource": "" }
q3292
DataTablesEnumerator.enumParameters
train
public static function enumParameters() { return [ DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS, DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW, DataTablesRequestInterface::DATATABLES_PARAMETER_LENGTH, DataTablesRequestInterface::DATATABLES_PARA...
php
{ "resource": "" }
q3293
DataTablesEnumerator.enumTypes
train
public static function enumTypes() { return [ DataTablesColumnInterface::DATATABLES_TYPE_DATE, DataTablesColumnInterface::DATATABLES_TYPE_HTML, DataTablesColumnInterface::DATATABLES_TYPE_HTML_NUM, DataTablesColumnInterface::DATATABLES_TYPE_NUM, DataTab...
php
{ "resource": "" }
q3294
Tx_Oelib_IdentityMap.add
train
public function add(\Tx_Oelib_Model $model) { if (!$model->hasUid()) { throw new \InvalidArgumentException('Add() requires a model that has a UID.', 1331488748); } $this->items[$model->getUid()] = $model; $this->highestUid = max($this->highestUid, $model->getUid()); ...
php
{ "resource": "" }
q3295
Tx_Oelib_IdentityMap.get
train
public function get($uid) { if ($uid <= 0) { throw new \InvalidArgumentException('$uid must be > 0.', 1331488761); } if (!isset($this->items[$uid])) { throw new \Tx_Oelib_Exception_NotFound( 'This map currently does not contain a model with the UID ' ...
php
{ "resource": "" }
q3296
ClientFactory.getKeyAuthClient
train
public function getKeyAuthClient($forceNew = false) { if ( ! isset($this->instances[self::CLIENT_KEY]) || $forceNew) { $this->instances[self::CLIENT_KEY] = MeetupKeyAuthClient::factory($this->config); } return $this->instances[self::CLIENT_KEY]; }
php
{ "resource": "" }
q3297
ClientFactory.getOauthClient
train
public function getOauthClient($forceNew = false) { if ( ! isset($this->instances[self::CLIENT_OAUTH]) || $forceNew) { $this->instances[self::CLIENT_OAUTH] = MeetupOAuthClient::factory($this->getUpdatedOauthConfig()); } return $this->instances[self::CLIENT_OAUTH]; }
php
{ "resource": "" }
q3298
ClientFactory.getUpdatedOauthConfig
train
public function getUpdatedOauthConfig() { $token = $this->session->has(self::SESSION_TOKEN_KEY) ? $this->session->get(self::SESSION_TOKEN_KEY) : false; $tokenSecret = $this->session->has(self::SESSION_TOKEN_SECRET_KEY) ? $this->session->get(s...
php
{ "resource": "" }
q3299
ClientFactory.setSessionTokens
train
public function setSessionTokens($token, $tokenSecret = null) { $this->session->set(self::SESSION_TOKEN_KEY, $token); $this->session->set(self::SESSION_TOKEN_SECRET_KEY, $tokenSecret); }
php
{ "resource": "" }