_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q259200
Form.getField
test
public function getField($key) { foreach ($this->fields as $field) { if ($field->getKey() == $key) { return $field; } } }
php
{ "resource": "" }
q259201
Form.getFieldsNotInArray
test
public function getFieldsNotInArray($keys) { $fields = []; foreach ($this->fields as $field) { if (!in_array($field->getKey(), $keys)) { $fields[] = $field; } } return $fields; }
php
{ "resource": "" }
q259202
Form.serializeForLocale
test
public function serializeForLocale($locale, Dynamic $dynamic = null) { $fields = []; foreach ($this->fields as $field) { $fieldTranslation = $field->getTranslation($locale, false, true); $value = null; if ($dynamic) { $value = $dynamic->{$field->...
php
{ "resource": "" }
q259203
FormWebsiteController.formAction
test
public function formAction(StructureInterface $structure, $preview = false, $partial = false) { /** @var Request $request */ $request = $this->get('request_stack')->getCurrentRequest(); // get attributes $attributes = $this->getAttributes([], $structure, $preview); $templat...
php
{ "resource": "" }
q259204
FormWebsiteController.onlyAction
test
public function onlyAction(Request $request, $key) { $ajaxTemplates = $this->container->getParameter('sulu_form.ajax_templates'); if (!$ajaxTemplates[$key]) { throw new NotFoundHttpException(); } $typeClass = $this->getTypeClass($key); /** @var AbstractType $typ...
php
{ "resource": "" }
q259205
FormWebsiteController.handleFormSubmit
test
private function handleFormSubmit(Request $request, $type, $attributes) { // handle form submit $configuration = $this->get('sulu_form.configuration.form_configuration_factory')->buildByType( $type, $this->form->getData(), $request->getLocale(), $attri...
php
{ "resource": "" }
q259206
FormWebsiteController.handleFormOnlySubmit
test
private function handleFormOnlySubmit(Request $request, $type) { // handle form submit $configuration = $this->get('sulu_form.configuration.form_configuration_factory')->buildByType( $type, $this->form->getData(), $request->getLocale(), [] ); ...
php
{ "resource": "" }
q259207
FormWebsiteController.tokenAction
test
public function tokenAction(Request $request) { $formName = $request->get('form'); $csrfToken = $this->get('security.csrf.token_manager')->getToken( $request->get('form') )->getValue(); $content = $csrfToken; // this should be the default behaviour in future bec...
php
{ "resource": "" }
q259208
FormWebsiteController.getErrors
test
protected function getErrors() { $errors = []; $generalErrors = []; foreach ($this->form->getErrors() as $error) { $generalErrors[] = $error->getMessage(); } if (!empty($generalErrors)) { $errors['general'] = $generalErrors; } foreac...
php
{ "resource": "" }
q259209
Handler.handle
test
public function handle(FormInterface $form, FormConfigurationInterface $configuration) { if (!$form->isValid()) { return false; } $mediaIds = $this->uploadMedia($form, $configuration); $this->mapMediaIds($form->getData(), $mediaIds); $this->save($form, $configura...
php
{ "resource": "" }
q259210
Handler.save
test
private function save(FormInterface $form, FormConfigurationInterface $configuration) { $this->eventDispatcher->dispatch( self::EVENT_FORM_SAVE, new FormEvent( $form, $configuration ) ); if (!$configuration->getSave()) { ...
php
{ "resource": "" }
q259211
Handler.uploadMedia
test
private function uploadMedia(FormInterface $form, FormConfigurationInterface $configuration) { $this->attachments = []; $mediaIds = []; foreach ($configuration->getFileFields() as $field => $collectionId) { if (!$form->has($field) || !count($form[$field]->getData())) { ...
php
{ "resource": "" }
q259212
Handler.mapMediaIds
test
private function mapMediaIds($entity, $mediaIds) { $accessor = new PropertyAccessor(); foreach ($mediaIds as $key => $value) { $accessor->setValue($entity, $key, $value); } return $entity; }
php
{ "resource": "" }
q259213
Handler.getMediaData
test
protected function getMediaData( UploadedFile $file, FormInterface $form, FormConfigurationInterface $configuration, $collectionId ) { return [ 'collection' => $collectionId, 'locale' => $configuration->getLocale(), 'title' => $file->getCli...
php
{ "resource": "" }
q259214
MailchimpType.getMailChimpLists
test
private function getMailChimpLists() { $lists = []; // If Milchimp class doesn't exist or no key is set return empty list. if (!class_exists(\DrewM\MailChimp\MailChimp::class) || !$this->apiKey) { return $lists; } $mailChimp = new \DrewM\MailChimp\MailChimp($thi...
php
{ "resource": "" }
q259215
DynamicListFactory.getBuilder
test
protected function getBuilder($alias = null) { if (!$alias || 'default' === $alias) { $alias = $this->defaultBuilder; } if (!$this->builders[$alias]) { throw new \Exception(sprintf('Bilder with the name "%s" not found.', $alias)); } return $this->bui...
php
{ "resource": "" }
q259216
AbstractType.getBlockPrefix
test
public function getBlockPrefix() { $fqcn = get_class($this); $name = $this->getName(); // For BC: Use the name as block prefix if one is set return $name !== $fqcn ? $name : StringUtil::fqcnToBlockPrefix($fqcn); }
php
{ "resource": "" }
q259217
CollectionStrategyTree.createCollection
test
private function createCollection($title, $parentId, $collectionKey, $locale) { $parentCollection = $this->collectionManager->save([ 'title' => $title, 'type' => ['id' => 2], 'parent' => $parentId, 'key' => $collectionKey, 'locale' => $locale, ...
php
{ "resource": "" }
q259218
CollectionStrategyTree.loadCollectionId
test
private function loadCollectionId( $collectionKey, $locale ) { try { $collection = $this->collectionManager->getByKey($collectionKey, $locale); if (!$collection) { return; } return $collection->getId(); } catch (\Excep...
php
{ "resource": "" }
q259219
DynamicFormType.getItemWidthNumber
test
private function getItemWidthNumber($width) { switch ($width) { case 'one-sixth': $itemWidth = 2; break; case 'five-sixths': $itemWidth = 10; break; case 'one-quarter': $itemWidth = 3; ...
php
{ "resource": "" }
q259220
DynamicFormType.getLastWidth
test
private function getLastWidth(&$currentWidthValue, $width, $nextWidth) { $widthNumber = $this->getItemWidthNumber($width); $nextWidthNumber = $this->getItemWidthNumber($nextWidth); $currentWidthValue += $widthNumber; if (0 == $currentWidthValue % 12) { return true; ...
php
{ "resource": "" }
q259221
ErrorHandler.rethrow
test
public static function rethrow(PDOException $e) { // the 2-character class of the error (if any) has the highest priority $errorClass = null; // the 3-character subclass of the error (if any) has a medium priority $errorSubClass = null; // the full error code itself has the lowest priority $error = null; ...
php
{ "resource": "" }
q259222
PdoDataSource.setHostname
test
public function setHostname($hostname = null) { $this->hostname = $hostname !== null ? (string) $hostname : null; return $this; }
php
{ "resource": "" }
q259223
PdoDataSource.setUnixSocket
test
public function setUnixSocket($unixSocket = null) { $this->unixSocket = $unixSocket !== null ? (string) $unixSocket : null; return $this; }
php
{ "resource": "" }
q259224
PdoDataSource.setMemory
test
public function setMemory($memory = null) { $this->memory = $memory !== null ? (bool) $memory : null; return $this; }
php
{ "resource": "" }
q259225
PdoDataSource.setFilePath
test
public function setFilePath($filePath = null) { $this->filePath = $filePath !== null ? (string) $filePath : null; return $this; }
php
{ "resource": "" }
q259226
PdoDataSource.setDatabaseName
test
public function setDatabaseName($databaseName = null) { $this->databaseName = $databaseName !== null ? (string) $databaseName : null; return $this; }
php
{ "resource": "" }
q259227
PdoDataSource.setCharset
test
public function setCharset($charset = null) { $this->charset = $charset !== null ? (string) $charset : null; return $this; }
php
{ "resource": "" }
q259228
PdoDatabase.ensureConnected
test
private function ensureConnected() { if ($this->pdo === null) { try { $this->pdo = new PDO($this->dsn->getDsn(), $this->dsn->getUsername(), $this->dsn->getPassword()); } catch (PDOException $e) { ErrorHandler::rethrow($e); } // iterate over all listeners waiting for the connection to be establ...
php
{ "resource": "" }
q259229
PdoDatabase.configureConnection
test
private function configureConnection(array &$newAttributes = null, array &$oldAttributes = null) { // if a connection is available if (isset($this->pdo)) { // if there are attributes that need to be applied if (isset($newAttributes)) { // get the keys and values of the attributes to apply foreach ($ne...
php
{ "resource": "" }
q259230
PdoDatabase.selectInternal
test
private function selectInternal(callable $callback, $query, array $bindValues = null) { $this->normalizeConnection(); try { // create a prepared statement from the supplied SQL string $stmt = $this->pdo->prepare($query); } catch (PDOException $e) { ErrorHandler::rethrow($e); } // if a performance...
php
{ "resource": "" }
q259231
IronMQ.getQueues
test
public function getQueues($previous = null, $per_page = self::LIST_QUEUES_PER_PAGE) { $url = "projects/{$this->project_id}/queues"; $params = array(); if (!is_null($previous)) { $params['previous'] = $previous; } if ($per_page !== self::LIST_QUEUES_PER_PAGE) { ...
php
{ "resource": "" }
q259232
IronMQ.getQueue
test
public function getQueue($queue_name) { $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue"; $this->setJsonHeaders(); return self::json_decode($this->apiCall(self::GET, $url))->queue; }
php
{ "resource": "" }
q259233
IronMQ.postMessage
test
public function postMessage($queue_name, $message, $properties = array()) { $msg = new IronMQMessage($message, $properties); $req = array( "messages" => array($msg->asArray()), ); $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "project...
php
{ "resource": "" }
q259234
IronMQ.postMessages
test
public function postMessages($queue_name, $messages, $properties = array()) { $req = array( "messages" => array(), ); foreach ($messages as $message) { $msg = new IronMQMessage($message, $properties); array_push($req['messages'], $msg->asArray()); ...
php
{ "resource": "" }
q259235
IronMQ.getMessageById
test
public function getMessageById($queue_name, $message_id) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue/messages/{$message_id}"; return self::json_decode($this->apiCall(self::GET, $url))->message; }
php
{ "resource": "" }
q259236
IronMQ.touchMessage
test
public function touchMessage($queue_name, $message_id, $reservation_id, $timeout) { $req = array( "reservation_id" => $reservation_id, ); if ($timeout !== 0) { $req['timeout'] = (int) $timeout; } $this->setJsonHeaders(); $queue = rawurlencode($...
php
{ "resource": "" }
q259237
IronMQ.releaseMessage
test
public function releaseMessage($queue_name, $message_id, $reservation_id, $delay) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $params = array('reservation_id' => $reservation_id); if ($delay !== 0) { $params['delay'] = (int) $delay; } $u...
php
{ "resource": "" }
q259238
IronMQ.addAlerts
test
public function addAlerts($queue_name, $alerts_hash) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue"; $options = array( 'queue' => array( 'alerts' => $alerts_hash, ), );...
php
{ "resource": "" }
q259239
IronMQ.deleteAlertById
test
public function deleteAlertById($queue_name, $alert_id) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue/alerts/$alert_id"; return self::json_decode($this->apiCall(self::DELETE, $url)); }
php
{ "resource": "" }
q259240
IronMQ.deleteQueue
test
public function deleteQueue($queue_name) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue"; return self::json_decode($this->apiCall(self::DELETE, $url)); }
php
{ "resource": "" }
q259241
IronMQ.updateQueue
test
public function updateQueue($queue_name, $options) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue"; return self::json_decode($this->apiCall(self::PATCH, $url, array('queue' => $options))); }
php
{ "resource": "" }
q259242
IronMQ.createQueue
test
public function createQueue($queue_name, $options) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue"; return self::json_decode($this->apiCall(self::PUT, $url, array('queue' => $options))); }
php
{ "resource": "" }
q259243
IronMQ.replaceSubscribers
test
public function replaceSubscribers($queue_name, $subscribers_hash) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue/subscribers"; $options = array( 'subscribers' => $subscribers_hash, ); retu...
php
{ "resource": "" }
q259244
IronMQ.removeSubscribers
test
public function removeSubscribers($queue_name, $subscriber_hash) { $this->setJsonHeaders(); $queue = rawurlencode($queue_name); $url = "projects/{$this->project_id}/queues/$queue/subscribers"; $options = array( 'subscribers' => $subscriber_hash, ); return ...
php
{ "resource": "" }
q259245
GenerateCommand.outputJson
test
protected function outputJson(OutputInterface $output, $data) { $json = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); $output->write($json); }
php
{ "resource": "" }
q259246
GenerateCommand.outputXml
test
protected function outputXml(OutputInterface $output, $data) { $doc = new \DOMDocument(); $doc->formatOutput = true; $doc->appendChild($this->generateXml($doc, $data)); $xml = $doc->saveXML(); $output->write($xml); }
php
{ "resource": "" }
q259247
GenerateCommand.generateXml
test
protected function generateXml(\DOMDocument $doc, $data) { if (is_array($data) && range(0, count($data) - 1) == array_keys($data)) { // $data is a regular indexed array $array = $doc->createElement('array'); foreach ($data as $value) { $entry = $doc->createElement('item'); $entry->appendChild($this...
php
{ "resource": "" }
q259248
GenerateCommand.outputCsv
test
protected function outputCsv(InputInterface $input, OutputInterface $output, $data) { $delimiter = $input->getOption('delimiter'); $enclosure = $input->getOption('enclosure'); $stream = fopen('php://temp', 'w+'); foreach ($data as $row) { if ($enclosure === null) { fputcsv($stream, $this->flattenArray...
php
{ "resource": "" }
q259249
GenerateCommand.flattenArray
test
protected function flattenArray($data) { if (is_array($data) || is_object($data)) { $buffer = array(); foreach ($data as $item) { $buffer = array_merge($buffer, $this->flattenArray($item)); } return $buffer; } else { return (array) $data; } }
php
{ "resource": "" }
q259250
CacheClientStatsCommand.execute
test
protected function execute(InputInterface $input, OutputInterface $output) { $debug = $input->getOption('debug'); $client = $this->getContainer()->get('beryllium_cache.client'); if (is_object($client) && method_exists($client, 'getStats')) { $text = $this->formatStats($client->g...
php
{ "resource": "" }
q259251
CacheClientStatsCommand.formatStats
test
public function formatStats($stats, $debug = false) { if (!is_array($stats)) { return "No statistics returned.\n"; } if (count($stats) == 0) { return "No statistics returned.\n"; } $out = "Servers found: " . count($stats) . "\n\n"; foreach ($...
php
{ "resource": "" }
q259252
CacheClientStatsCommand.formatUsage
test
public function formatUsage($bytes, $maxbytes) { if (!is_numeric($maxbytes) || $maxbytes < 1) { return '(undefined)'; } $out = round($bytes / $maxbytes, 3) . "% ("; $out .= round($bytes / 1024 / 1024, 2) . 'MB of '; $out .= round($maxbytes / 1024 / 1024, 2) . 'MB...
php
{ "resource": "" }
q259253
CacheClientStatsCommand.formatUptime
test
public function formatUptime($uptime) { $days = floor($uptime / 24 / 60 / 60); $days_remainder = $uptime - ($days * 24 * 60 * 60); $hours = floor($days_remainder / 60 / 60); $hours_remainder = $days_remainder - ($hours * 60 * 60); $minutes = floor($hours_remainder / 60); ...
php
{ "resource": "" }
q259254
MemcacheClient.addServer
test
public function addServer($ip, $port = 11211) { if (is_object($this->mem)) { return $this->mem->addServer($ip, $port); } }
php
{ "resource": "" }
q259255
MemcacheClient.addServers
test
public function addServers(array $servers) { if (count($servers) == 0) { return false; } foreach ($servers as $ip => $port) { if (intval($port) == 0) { $port = null; } if ($this->probeServer($ip, $port)) { $sta...
php
{ "resource": "" }
q259256
MemcacheClient.probeServer
test
public function probeServer($ip, $port) { $errno = null; $errstr = null; $fp = @fsockopen($ip, $port, $errno, $errstr, $this->sockttl); if ($fp) { fclose($fp); return true; } else { return false; } }
php
{ "resource": "" }
q259257
MemcacheClient.get
test
public function get($key) { if ($this->isSafe()) { $key = $this->prefix . $key; return $this->mem->get($key); } return false; }
php
{ "resource": "" }
q259258
MemcacheClient.set
test
public function set($key, $value, $ttl) { if ($this->isSafe()) { $key = $this->prefix . $key; return $this->mem->set($key, $value, $this->compression, $ttl); } return false; }
php
{ "resource": "" }
q259259
MemcacheClient.delete
test
public function delete($key) { if ($this->isSafe()) { $key = $this->prefix . $key; return $this->mem->delete($key, 0); } return false; }
php
{ "resource": "" }
q259260
Cache.setClient
test
public function setClient(CacheClientInterface $client) { if (is_object($client) && ($client instanceof CacheClientInterface)) $this->client = $client; else { throw new \Exception('Invalid Cache Client Interface'); } }
php
{ "resource": "" }
q259261
Cache.get
test
public function get($key) { if ($this->isSafe() && !empty($key)) { return $this->client->get($key); } return false; }
php
{ "resource": "" }
q259262
Cache.delete
test
public function delete($key) { if ($this->isSafe() && !empty($key)) { return $this->client->delete($key); } return false; }
php
{ "resource": "" }
q259263
FCMMessage.makeInvalidArgumentException
test
protected static function makeInvalidArgumentException($data, $method, $container, $builder) { $type = gettype($data); if (is_object($data)) { $type = get_class($data); } return new InvalidArgumentException( 'The argument for %s::%s must be instanceof %s, %s, ...
php
{ "resource": "" }
q259264
FCMMessage.populateBuilder
test
protected static function populateBuilder($builder, array $map, array $data) { foreach ($map as $key => $method) { $value = Arr::get($data, $key); $builder->{$method}($value); } return $builder; }
php
{ "resource": "" }
q259265
FCMMessage.options
test
public function options($options = null) { if (is_array($options)) { if ($this->options && $this->options instanceof Options) { $options = array_merge($this->options->toArray(), $options); } if (! Arr::has($options, 'priority')) { $options[...
php
{ "resource": "" }
q259266
FCMMessage.notification
test
public function notification($notification = null) { if (is_array($notification)) { if ($this->notification && $this->notification instanceof PayloadNotification) { $notification = array_merge($this->notification->toArray(), $notification); } $builder = ne...
php
{ "resource": "" }
q259267
FCMMessage.data
test
public function data($data = null) { if (is_array($data)) { if ($this->data && $this->data instanceof PayloadData) { $data = array_merge($this->data->toArray(), $data); } $data = (new PayloadDataBuilder())->setData($data); } if ($data inst...
php
{ "resource": "" }
q259268
LoggerLayoutXml.encodeCDATA
test
private function encodeCDATA($string) { $string = str_replace(self::CDATA_END, self::CDATA_EMBEDDED_END, $string); return self::CDATA_START . $string . self::CDATA_END; }
php
{ "resource": "" }
q259269
UrlBuilder.getNonAuthenticationUrl
test
public function getNonAuthenticationUrl( $action, \FACTFinder\Util\Parameters $parameters ) { $configuration = $this->configuration; $this->ensureChannelParameter($parameters); $url = $this->buildAddress($action) . (count($parameters) ? '?' : '') . $parameters-...
php
{ "resource": "" }
q259270
UrlBuilder.getAuthenticationUrl
test
public function getAuthenticationUrl( $action, \FACTFinder\Util\Parameters $parameters ) { $this->ensureChannelParameter($parameters); $c = $this->configuration; if ($c->isAdvancedAuthenticationType()) return $this->getAdvancedAuthenticationUrl($action, $paramete...
php
{ "resource": "" }
q259271
UrlBuilder.getAdvancedAuthenticationUrl
test
protected function getAdvancedAuthenticationUrl( $action, \FACTFinder\Util\Parameters $parameters ) { $configuration = $this->configuration; $ts = time() . '000'; //milliseconds needed $prefix = $configuration->getAuthenticationPrefix(); $postfix = $co...
php
{ "resource": "" }
q259272
UrlBuilder.getSimpleAuthenticationUrl
test
protected function getSimpleAuthenticationUrl( $action, \FACTFinder\Util\Parameters $parameters ) { $configuration = $this->configuration; $ts = time() . '000'; //milliseconds needed but won't be considered $authenticationParameters = "timestamp=" . $ts ...
php
{ "resource": "" }
q259273
UrlBuilder.getHttpAuthenticationUrl
test
protected function getHttpAuthenticationUrl( $action, \FACTFinder\Util\Parameters $parameters ) { $configuration = $this->configuration; $authentication = sprintf( '%s:%s@', $configuration->getUserName(), $configuration->getPassword() ); ...
php
{ "resource": "" }
q259274
UrlBuilder.ensureChannelParameter
test
protected function ensureChannelParameter($parameters) { if ((!isset($parameters['channel']) || $parameters['channel'] == '') && $this->configuration->getChannel() != '' ) { $parameters['channel'] = $this->configuration->getChannel(); } }
php
{ "resource": "" }
q259275
SimilarRecords.setProductID
test
public function setProductID($productID) { $parameters = $this->request->getParameters(); $parameters['id'] = $productID; $this->upToDate = false; }
php
{ "resource": "" }
q259276
SimilarRecords.getSimilarAttributes
test
public function getSimilarAttributes() { if (is_null($this->similarAttributes) || !$this->upToDate ) { $this->similarAttributes = $this->createSimilarAttributes(); $this->upToDate = true; } return $this->similarAttributes; }
php
{ "resource": "" }
q259277
SimilarRecords.getSimilarRecords
test
public function getSimilarRecords() { if (is_null($this->similarRecords) || !$this->upToDate ) { $this->request->resetLoaded(); $this->similarRecords = $this->createSimilarRecords(); $this->upToDate = true; } return $this->similarRecor...
php
{ "resource": "" }
q259278
LoggerAppenderFile.write
test
protected function write($string) { // Lazy file open if(!isset($this->fp)) { if ($this->openFile() === false) { return; // Do not write if file open failed. } } if ($this->locking) { $this->writeWithLocking($string); } else { $this->writeWithoutLocking($string); } }
php
{ "resource": "" }
q259279
LoggerAutoloader.autoload
test
public static function autoload($className) { if(isset(self::$classes[$className])) { include dirname(__FILE__) . self::$classes[$className]; } }
php
{ "resource": "" }
q259280
LoggerAppenderConsole.setTarget
test
public function setTarget($target) { $value = trim($target); if ($value == self::STDOUT || strtoupper($value) == 'STDOUT') { $this->target = self::STDOUT; } elseif ($value == self::STDERR || strtoupper($value) == 'STDERR') { $this->target = self::STDERR; } else { $target = var_export($target); ...
php
{ "resource": "" }
q259281
Import.triggerDataImport
test
public function triggerDataImport($download = false) { //this function changes parameters, action, ... so reload of response is neccessary $this->request->resetLoaded(); $this->request->setAction('Import.ff'); $this->parameters['download'] = $download ? 'true' : 'false'; ...
php
{ "resource": "" }
q259282
Import.triggerSuggestImport
test
public function triggerSuggestImport($download = false) { //this function changes parameters, action, ... so reload of response is neccessary $this->request->resetLoaded(); $this->request->setAction('Import.ff'); $this->parameters['download'] = $download ? 'true' : 'false';...
php
{ "resource": "" }
q259283
ParametersConverter.applyParameterMappings
test
protected function applyParameterMappings($parameters, $mappingRules) { foreach ($mappingRules as $k => $v) { if ($k != $v && isset($parameters[$k])) { $parameters[$v] = $parameters[$k]; unset($parameters[$k]); } } }
php
{ "resource": "" }
q259284
ParametersConverter.ensureChannelParameter
test
protected function ensureChannelParameter($parameters) { if (!isset($parameters['channel']) || strlen($parameters['channel']) == 0) $parameters['channel'] = $this->configuration->getChannel(); }
php
{ "resource": "" }
q259285
ParametersConverter.addRequiredParameters
test
protected function addRequiredParameters($parameters, $requireRules) { foreach ($requireRules as $k => $v) if (!isset($parameters[$k])) $parameters[$k] = $v; }
php
{ "resource": "" }
q259286
LoggerAppenderPool.add
test
public static function add(LoggerAppender $appender) { $name = $appender->getName(); if(empty($name)) { trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING); return; } if (isset(self::$appenders[$name])) { trigger_error("log4php: Appender [$name] already exists in pool. ...
php
{ "resource": "" }
q259287
LoggerAppenderPool.get
test
public static function get($name) { return isset(self::$appenders[$name]) ? self::$appenders[$name] : null; }
php
{ "resource": "" }
q259288
Logger.trace
test
public function trace($message, $throwable = null) { $this->log(LoggerLevel::getLevelTrace(), $message, $throwable); }
php
{ "resource": "" }
q259289
Logger.debug
test
public function debug($message, $throwable = null) { $this->log(LoggerLevel::getLevelDebug(), $message, $throwable); }
php
{ "resource": "" }
q259290
Logger.warn
test
public function warn($message, $throwable = null) { $this->log(LoggerLevel::getLevelWarn(), $message, $throwable); }
php
{ "resource": "" }
q259291
Logger.log
test
public function log(LoggerLevel $level, $message, $throwable = null) { if($this->isEnabledFor($level)) { $event = new LoggerLoggingEvent($this->fqcn, $this, $level, $message, null, $throwable); $this->callAppenders($event); } // Forward the event upstream if additivity is turned on if(isset($thi...
php
{ "resource": "" }
q259292
Logger.logEvent
test
public function logEvent(LoggerLoggingEvent $event) { if($this->isEnabledFor($event->getLevel())) { $this->callAppenders($event); } // Forward the event upstream if additivity is turned on if(isset($this->parent) && $this->getAdditivity()) { $this->parent->logEvent($event); } }
php
{ "resource": "" }
q259293
Logger.forcedLog
test
public function forcedLog($fqcn, $throwable, LoggerLevel $level, $message) { $event = new LoggerLoggingEvent($fqcn, $this, $level, $message, null, $throwable); $this->callAppenders($event); // Forward the event upstream if additivity is turned on if(isset($this->parent) && $this->getAdditivity()) { ...
php
{ "resource": "" }
q259294
Logger.removeAppender
test
public function removeAppender($appender) { if($appender instanceof LoggerAppender) { $appender->close(); unset($this->appenders[$appender->getName()]); } else if (is_string($appender) and isset($this->appenders[$appender])) { $this->appenders[$appender]->close(); unset($this->appenders[$appender]...
php
{ "resource": "" }
q259295
Logger.getEffectiveLevel
test
public function getEffectiveLevel() { for($logger = $this; $logger !== null; $logger = $logger->getParent()) { if($logger->getLevel() !== null) { return $logger->getLevel(); } } }
php
{ "resource": "" }
q259296
Logger.getHierarchy
test
public static function getHierarchy() { if(!isset(self::$hierarchy)) { self::$hierarchy = new LoggerHierarchy(new LoggerRoot()); } return self::$hierarchy; }
php
{ "resource": "" }
q259297
Logger.getLogger
test
public static function getLogger($name) { if(!self::isInitialized()) { self::configure(); } return self::getHierarchy()->getLogger($name); }
php
{ "resource": "" }
q259298
Logger.resetConfiguration
test
public static function resetConfiguration() { self::getHierarchy()->resetConfiguration(); self::getHierarchy()->clear(); // TODO: clear or not? self::$initialized = false; }
php
{ "resource": "" }
q259299
Logger.configure
test
public static function configure($configuration = null, $configurator = null) { self::resetConfiguration(); $configurator = self::getConfigurator($configurator); $configurator->configure(self::getHierarchy(), $configuration); self::$initialized = true; }
php
{ "resource": "" }