_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q258300
Extension.reducing
test
public function reducing($name) { // note, once we stop supporting php 5.5, we can rewrite the code below // to the reducing($name, ...$args) structure. // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list if (is_string($name) && in_array( ...
php
{ "resource": "" }
q258301
ComposerPlugin.dump
test
public static function dump(Event $event) { $composer = $event->getComposer(); $installationManager = $composer->getInstallationManager(); $repoManager = $composer->getRepositoryManager(); $localRepo = $repoManager->getLocalRepository(); $package ...
php
{ "resource": "" }
q258302
ComposerPlugin.getExtraKey
test
private static function getExtraKey($key, $fallback) { static $autosplitter = null; if (null === $autosplitter) { $autosplitter = isset(self::$extra[self::EXTRA_KEY]) ? self::$extra[self::EXTRA_KEY] : array(); } return isset($autosplitter...
php
{ "resource": "" }
q258303
NormalizerBase.escapePrefix
test
public static function escapePrefix($predicate, array $namespaces) { $exploded = explode(":", $predicate); if (!isset($namespaces[$exploded[0]])) { return $predicate; } return $namespaces[$exploded[0]] . $exploded[1]; }
php
{ "resource": "" }
q258304
JsonldContextGenerator.parseCompactedIri
test
protected function parseCompactedIri($iri) { // As naive as it gets. list($prefix, $rest) = array_pad(explode(":", $iri, 2), 2, ''); if ((substr($rest, 0, 2) == "//") || ($prefix == $iri)) { // Means this was never a compacted IRI. return ['prefix' => NULL, 'term' => $iri]; } return ['pr...
php
{ "resource": "" }
q258305
JsonldContextGenerator.getTermContextFromField
test
protected function getTermContextFromField($field_type) { // Be aware that drupal field definitions can be complex. // e.g text_with_summary has a text, a summary, a number of lines, etc // we are only dealing with the resulting ->value() of all this separate // pieces and mapping only that as a whole. ...
php
{ "resource": "" }
q258306
Eager.persistCacheIfNeeded
test
public function persistCacheIfNeeded($lifeTime) { if ($this->isDirty) { $this->storage->doSave($this->storageId, $this->content, $lifeTime); } }
php
{ "resource": "" }
q258307
JsonldContextController.content
test
public function content($entity_type, $bundle, Request $request) { // TODO: expose cached/not cached through // more varied HTTP response codes. try { $context = $this->jsonldContextGenerator->getContext("$entity_type.$bundle"); $response = new CacheableJsonResponse(json_decode($context), 200);...
php
{ "resource": "" }
q258308
FieldNormalizer.normalizeFieldItems
test
protected function normalizeFieldItems(FieldItemListInterface $field, $format, array $context) { $normalized_field_items = []; if (!$field->isEmpty()) { foreach ($field as $field_item) { $normalized_field_items[] = $this->serializer->normalize($field_item, $format, $context); } } re...
php
{ "resource": "" }
q258309
Chained.doDelete
test
public function doDelete($id) { foreach ($this->backends as $backend) { if ($backend->doContains($id)) { $backend->doDelete($id); } } return true; }
php
{ "resource": "" }
q258310
FieldItemNormalizer.createTranslatedInstance
test
protected function createTranslatedInstance(FieldItemInterface $item, $langcode) { // Remove the untranslated item that was created for the default language // by FieldNormalizer::denormalize(). $items = $item->getParent(); $delta = $item->getName(); unset($items[$delta]); // Instead, create a...
php
{ "resource": "" }
q258311
ContentEntityNormalizer.getEntityUri
test
protected function getEntityUri(EntityInterface $entity) { // Some entity types don't provide a canonical link template, at least call // out to ->url(). if ($entity->isNew() || !$entity->hasLinkTemplate('canonical')) { return $entity->toUrl('canonical', []); } $url = $entity->toUrl('canonica...
php
{ "resource": "" }
q258312
ContentEntityNormalizer.getTypedDataIds
test
protected function getTypedDataIds(array $types, array $context = []) { // The 'type' can potentially contain an array of type objects. By default, // Drupal only uses a single type in serializing, but allows for multiple // types when deserializing. if (isset($types['href'])) { $types = [$types]...
php
{ "resource": "" }
q258313
Factory.buildBackend
test
public function buildBackend($type, array $options) { switch ($type) { case 'array': return $this->buildArrayCache(); case 'file': return $this->buildFileCache($options); case 'chained': return $this->buildChainedCache(...
php
{ "resource": "" }
q258314
Lazy.fetch
test
public function fetch($id) { $id = $this->getCompletedCacheIdIfValid($id); return $this->backend->doFetch($id); }
php
{ "resource": "" }
q258315
SilentResponse.runString
test
protected function runString($callable, array $arguments) { if (! function_exists($callable)) { throw new FunctionNotFoundException("Function $callable not found"); } $this->startBuffer(); $this->return = call_user_func_array($callable, $arguments); $this->endB...
php
{ "resource": "" }
q258316
BaseCommand.error
test
public function error($line) { if (is_array($line)) { $lines = []; foreach ($line as $one) { $lines[] = "<error>$one</error>"; } $this->output->writeln($lines); return; } $this->output->writeln("<error>$line</erro...
php
{ "resource": "" }
q258317
BaseCommand.ask
test
public function ask($question, $default = false) { $handler = $this->getHelper('question'); $confirmation = new ConfirmationQuestion($question, $default); return $handler->ask($this->input, $this->output, $confirmation); }
php
{ "resource": "" }
q258318
AttributeOptionCreateProcessor.execute
test
public function execute($row, $name = null) { parent::execute($row, $name); return $this->getConnection()->lastInsertId(); }
php
{ "resource": "" }
q258319
Factory.create
test
public function create(array $overrides = []) { $factory = static::$factories[$this->table]['callback']; $data = []; for ($i = 0; $i < $this->times; $i++) { $values = $this->override($factory(\Faker\Factory::create($this->locale)), $overrides); $data[] = $this->inse...
php
{ "resource": "" }
q258320
Factory.override
test
protected function override(array $values, array $overrides) { if (count($overrides) === 0) { return $values; } foreach ($overrides as $key => $value) { $values[$key] = $overrides[$key]; } return $values; }
php
{ "resource": "" }
q258321
Factory.insert
test
protected function insert($values) { $id = db_insert($this->table)->fields($values)->execute(); $query = db_select($this->table, 'T'); $query->fields('T'); $query->condition($this->primary_key, $id); return $query->execute()->fetchObject(); }
php
{ "resource": "" }
q258322
Factory.extractPrimaryKey
test
protected function extractPrimaryKey() { if (static::$factories[$this->table]['primary_key'] !== null) { return static::$factories[$this->table]['primary_key']; } if (preg_match('/^chado\./', $this->table)) { $schema = chado_get_schema(str_replace('chado.', '', $this...
php
{ "resource": "" }
q258323
InteractsWithAuthSystem.actingAs
test
public function actingAs($uid) { global $user; // Load the new requested user if (is_object($uid)) { if($uid->uid === 0) { $user = drupal_anonymous_user(); } else{ $user = user_load($uid->uid); } } else { ...
php
{ "resource": "" }
q258324
InitCommand.copyStubs
test
protected function copyStubs(array $files) { foreach ($files as $file => $to) { $to = "{$this->path}/{$to}"; if (! file_exists($to) || $this->getOption('force') !== false) { copy("{$this->stubsDir}/{$file}", $to); } else { $this->line("TRIP...
php
{ "resource": "" }
q258325
InitCommand.configureVariables
test
protected function configureVariables(array $files) { foreach ($files as $file => $values) { $file = "{$this->path}/{$file}"; if (! file_exists($file)) { throw new \Exception("TRIPALTEST: Unable to configure variables. $file does not exist!"); } ...
php
{ "resource": "" }
q258326
CatalogAttributeObserver.serializeAdditionalData
test
protected function serializeAdditionalData(array $attr) { // serialize the additional data value if available if (isset($attr[MemberNames::ADDITIONAL_DATA]) && $attr[MemberNames::ADDITIONAL_DATA] !== null) { $attr[MemberNames::ADDITIONAL_DATA] = json_encode($attr[MemberNames::ADDITIONAL...
php
{ "resource": "" }
q258327
CatalogAttributeObserver.isSwatchType
test
protected function isSwatchType(array $additionalData) { return isset($additionalData[CatalogAttributeObserver::SWATCH_INPUT_TYPE]) && in_array($additionalData[CatalogAttributeObserver::SWATCH_INPUT_TYPE], $this->swatchTypes); }
php
{ "resource": "" }
q258328
SwatchTypeLoader.loadSwatchType
test
public function loadSwatchType($entityTypeId, $attributeCode) { // prepare a unique key for the swatch type from the given code and entity type ID $key = sprintf('%d-%s', $entityTypeId, $attributeCode); // query whether or not a swatch type has been set if ($this->hasSwatchType($ke...
php
{ "resource": "" }
q258329
DBSeedCommand.handle
test
public function handle() { // Let's bootstrap first new TripalTestBootstrap(false); $this->loadDatabaseSeeders(); $seeder = $this->getArgument('name'); if ($seeder) { $this->runSeeder($seeder); $this->success($seeder); return; }...
php
{ "resource": "" }
q258330
DBSeedCommand.prepSeeder
test
protected function prepSeeder($name) { $name = trim($name, '\\'); if (strstr($name, 'Tests\\DatabaseSeeders') !== false) { return $name; } return 'Tests\\DatabaseSeeders\\'.$name; }
php
{ "resource": "" }
q258331
AttributeOptionSwatchRepository.findOneByOptionIdAndStoreId
test
public function findOneByOptionIdAndStoreId($optionId, $storeId) { // the parameters of the EAV attribute option to load $params = array( MemberNames::OPTION_ID => $optionId, MemberNames::STORE_ID => $storeId, ); // load and return the EAV attribute option ...
php
{ "resource": "" }
q258332
EntityAttributeRepository.findOneByAttributeIdAndAttributeSetId
test
public function findOneByAttributeIdAndAttributeSetId($attributeId, $attributeSetId) { // initialize the params $params = array( MemberNames::ATTRIBUTE_ID => $attributeId, MemberNames::ATTRIBUTE_SET_ID => $attributeSetId ); // load and return the EAV...
php
{ "resource": "" }
q258333
AttributeOptionRepository.findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue
test
public function findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value) { // the parameters of the EAV attribute option to load $params = array( MemberNames::ENTITY_TYPE_ID => $entityTypeId, MemberNames::ATTRIBUTE_CODE => $att...
php
{ "resource": "" }
q258334
AttributeOptionRepository.findOneByAttributeIdAndHighestSortOrder
test
public function findOneByAttributeIdAndHighestSortOrder($attributeId) { // load and return the EAV attribute option with the passed parameters $this->attributeOptionByAttributeIdOrderBySortOrderDescStmt->execute(array(MemberNames::ATTRIBUTE_ID => $attributeId)); return $this->attributeOptio...
php
{ "resource": "" }
q258335
MakeSeederCommand.createDatabaseSeedersFolder
test
protected function createDatabaseSeedersFolder() { $path = getcwd().'/tests'; if (! file_exists($path)) { throw new FileNotFoundException('Tests folder not found.'); } if (! file_exists($path.'/DatabaseSeeders')) { mkdir($path.'/DatabaseSeeders'); } ...
php
{ "resource": "" }
q258336
MakeSeederCommand.makeSeeder
test
protected function makeSeeder() { $path = getcwd().'/tests/DatabaseSeeders'; $name = $this->getArgument('name'); $stub = __DIR__.'/../../../stubs/SeederStub.php'; $content = file_get_contents($stub); $content = str_replace('$$CLASS_NAME$$', $name, $content); $path = "...
php
{ "resource": "" }
q258337
AttributeOptionUpdateObserver.initializeAttribute
test
protected function initializeAttribute(array $attr) { // load the entity type ID for the value from the system configuration $entityTypeId = $this->getEntityTypeId(); // initialize the data to load the EAV attribute option $value = $this->getValue(ColumnKeys::VALUE); $store...
php
{ "resource": "" }
q258338
DBTransaction.DBTransactionSetUp
test
protected function DBTransactionSetUp() { $this->_transaction = db_transaction(uniqid()); $shutdown = '\\StatonLab\\TripalTestSuite\\DBTransaction::rollbackTransaction'; register_shutdown_function($shutdown, $this->_transaction); }
php
{ "resource": "" }
q258339
CatalogAttributeRepository.load
test
public function load($attributeId) { // load and return the EAV catalog attribute with the ID $this->catalogAttributeStmt->execute(array(MemberNames::ATTRIBUTE_ID => $attributeId)); return $this->catalogAttributeStmt->fetch(\PDO::FETCH_ASSOC); }
php
{ "resource": "" }
q258340
MenuCaller.setPath
test
public function setPath($path) { $this->path = trim($path, '/'); if(empty($this->path)) { // Home page requested so let's use /node $this->path = 'node'; } return $this; }
php
{ "resource": "" }
q258341
MenuCaller.addParams
test
public function addParams($params) { if (isset($params['form_params'])) { $params = $params['form_params']; $params['form_token'] = drupal_get_token(); } elseif (isset($params['query'])) { $params = $params['query']; } foreach ($params as $key => ...
php
{ "resource": "" }
q258342
MenuCaller.send
test
public function send() { $allowed_methods = ['POST', 'GET', 'PUT', 'PATCH', 'DELETE']; if (! in_array($this->method, $allowed_methods)) { throw new \Exception("Unknown method $this->method."); } $_SERVER['REQUEST_METHOD'] = $this->method; $this->injectParams(); ...
php
{ "resource": "" }
q258343
MenuCaller.execute
test
protected function execute() { $this->resetHeaders(); $this->resetStaticCache(); // Move to drupal root where the index.php is $current_dir = getcwd(); chdir(DRUPAL_ROOT); $value = ''; ob_start(function ($str) use (&$value) { $value .= $str; ...
php
{ "resource": "" }
q258344
MenuCaller.injectParams
test
protected function injectParams() { $_GET['q'] = $this->path; $_SERVER['REQUEST_URI'] = $this->path; if (in_array($this->method, ['GET', 'DELETE'])) { foreach ($this->params as $key => $param) { $_GET[$key] = $param; } return; } ...
php
{ "resource": "" }
q258345
AttributeRepository.findOneByAttributeCode
test
public function findOneByAttributeCode($attributeCode) { // load and return the EAV attribute with the passed code $this->attributeByAttributeCodeStmt->execute(array(MemberNames::ATTRIBUTE_CODE => $attributeCode)); return $this->attributeByAttributeCodeStmt->fetch(\PDO::FETCH_ASSOC); }
php
{ "resource": "" }
q258346
BunchSubject.tearDown
test
public function tearDown($serial) { // invoke the parent method parent::tearDown($serial); // load the registry processor $registryProcessor = $this->getRegistryProcessor(); // update the status $registryProcessor->mergeAttributesRecursive( $serial, ...
php
{ "resource": "" }
q258347
BunchSubject.preLoadAttributeId
test
public function preLoadAttributeId(array $attribute) { $this->preLoadedAttributeIds[$attribute[MemberNames::ATTRIBUTE_CODE]]= $attribute[MemberNames::ATTRIBUTE_ID]; }
php
{ "resource": "" }
q258348
PublishesData.publish
test
public function publish($data_table, array $ids = [], $primary_key = '') { $publisher = new PublishRecords($data_table, $ids, $primary_key); $publisher->publish(); return $publisher; }
php
{ "resource": "" }
q258349
BaseResponse.assertSee
test
public function assertSee($content) { $response = (string)$this->getResponseBody(); PHPUnit::assertContains($content, $response, "Unable to find [$content] in response."); return $this; }
php
{ "resource": "" }
q258350
BaseResponse.json
test
public function json() { $json = json_decode($this->getResponseBody(), true); if (is_null($json)) { PHPUnit::fail('Unable to decode json response!'); throw new InvalidJSONException('Unable to decode json response!'); } return $json; }
php
{ "resource": "" }
q258351
BaseResponse.assertJsonStructure
test
public function assertJsonStructure(array $structure, $data = null) { if (is_null($data)) { try { $data = $this->json(); } catch (InvalidJSONException $exception) { PHPUnit::fail('Unable to decode json response!'); } } fore...
php
{ "resource": "" }
q258352
BootstrapDrupal.run
test
public function run() { // Don't bootstrap twice in runtime if (static::$bootstrapped) { return; } // Read environment variables to set drupal root $this->readEnvironmentFile(); // Set the base url if provided in environment $this->setBaseURL(); ...
php
{ "resource": "" }
q258353
BootstrapDrupal.getDrupalRoot
test
protected function getDrupalRoot() { if ($path = getenv('DRUPAL_ROOT')) { return $path; } $path = getcwd(); while ($path !== '/') { if (file_exists($path.'/includes/bootstrap.inc')) { return $path; } $path = dirname($p...
php
{ "resource": "" }
q258354
BootstrapDrupal.getEnvironmentFilePath
test
protected function getEnvironmentFilePath() { $dir = getcwd(); // If running phpunit from the module root dir if (file_exists($dir.'/tests/.env')) { return $dir.'/tests/.env'; } // If running phpunit from the module root dir if (file_exists($dir.'/test/....
php
{ "resource": "" }
q258355
BootstrapDrupal.readEnvironmentFile
test
protected function readEnvironmentFile() { $env_file_path = $this->getEnvironmentFilePath(); if ($env_file_path) { $line_count = 0; $file = fopen($env_file_path, 'r'); while ($line = fgets($file)) { $line++; $line = trim($line); ...
php
{ "resource": "" }
q258356
PublishRecords.publish
test
public function publish() { // Find the bundle $this->bundles = db_query('SELECT name, bundle_id FROM chado_bundle JOIN tripal_bundle ON tripal_bundle.id = chado_bundle.bundle_id WHERE data_table = :data_table', [':data_table' => $this->data_...
php
{ "resource": "" }
q258357
LoadsDatabaseSeeders.loadDatabaseSeeders
test
public function loadDatabaseSeeders() { $workingDir = getcwd(); if (file_exists("$workingDir/tests/DatabaseSeeders")) { foreach (glob("$workingDir/tests/DatabaseSeeders/*.php") as $seeder) { require_once $seeder; // Extract the class name ...
php
{ "resource": "" }
q258358
AbstractAttributeSubject.getEntityType
test
public function getEntityType($entityTypeCode = null) { // set the default entity type code, if non has been passed if ($entityTypeCode === null) { $entityTypeCode = $this->getDefaultEntityTypeCode(); } // query whether or not, the entity type with the passed code is av...
php
{ "resource": "" }
q258359
AbstractAttributeSubject.getEntityTypeId
test
public function getEntityTypeId($entityTypeCode = null) { // load the entity type for the given code, or the default one otherwise $entityType = $this->getEntityType($entityTypeCode ? $entityTypeCode : $this->getDefaultEntityTypeCode()); // return the entity type ID return $entityT...
php
{ "resource": "" }
q258360
MakesHTTPRequests._call
test
private function _call($method, $uri, $params = []) { if (! str_begins_with('http', $uri)) { $client = new MenuCaller(); return $client->setPath($uri)->setMethod($method)->addParams($params)->send(); } try { $client = new Client(); $uri = $th...
php
{ "resource": "" }
q258361
MakesHTTPRequests._prepareURI
test
private function _prepareURI($uri) { global $base_url; if (str_begins_with($uri, '/') || ! str_begins_with($uri, 'http')) { return trim($base_url.'/'.trim($uri, '/'), '/'); } return trim($uri, '/'); }
php
{ "resource": "" }
q258362
Agent.acceptDistributedTracePayloadHttpsafe
test
public function acceptDistributedTracePayloadHttpsafe(string $payload, string $type = 'HTTP'): bool { if (!$this->isLoaded()) { return false; } return newrelic_accept_distributed_trace_payload_httpsafe($payload, $type); }
php
{ "resource": "" }
q258363
Agent.endTransaction
test
public function endTransaction(bool $ignore = false): bool { if (!$this->isLoaded()) { return false; } return newrelic_end_transaction($ignore); }
php
{ "resource": "" }
q258364
Agent.setAppname
test
public function setAppname($name, string $license = null, bool $xmit = false): bool { if (!$this->isLoaded()) { return false; } $name = is_array($name) ? implode(';', $name) : $name; if (isset($license)) { return newrelic_set_appname($name, $license, $xmit);...
php
{ "resource": "" }
q258365
Agent.setUserAttributes
test
public function setUserAttributes(string $user, string $account, string $product): bool { if (!$this->isLoaded()) { return false; } return newrelic_set_user_attributes($user, $account, $product); }
php
{ "resource": "" }
q258366
Agent.startTransaction
test
public function startTransaction(string $appname, string $license = null): bool { if (!$this->isLoaded()) { return false; } if (isset($license)) { return newrelic_start_transaction($appname, $license); } return newrelic_start_transaction($appname); ...
php
{ "resource": "" }
q258367
Redirect.toUrl
test
public function toUrl($url) { $allow_not_routed_url = $this->config['allow_not_routed_url'] ?? false; $exclude_urls = $this->config['options']['exclude_urls'] ?? []; $exclude_hosts = $this->config['options']['exclude_hosts'] ?? []; $uriTargetHost = (new Uri($url))->g...
php
{ "resource": "" }
q258368
ConfigurationUtil.prepareConstructorArgs
test
public static function prepareConstructorArgs(\ReflectionClass $reflectionClass, array $params) { // prepare the array for the initialized arguments $initializedParams = array(); // prepare the array for the arguments in camel case (in configuration we use a '-' notation) $paramsIn...
php
{ "resource": "" }
q258369
AbstractCallback.appendExceptionSuffix
test
protected function appendExceptionSuffix($message = null, $filename = null, $lineNumber = null) { return $this->getSubject()-> appendExceptionSuffix($message, $filename, $lineNumber); }
php
{ "resource": "" }
q258370
AbstractCallback.wrapException
test
protected function wrapException( $columnName, \Exception $parent = null, $className = '\TechDivision\Import\Exceptions\WrappedColumnException' ) { return $this->getSubject()->wrapException($columnName, $parent, $className); }
php
{ "resource": "" }
q258371
Lexer.parse
test
public function parse($filename, InterpreterInterface $interpreter) { // for mac's office excel csv ini_set('auto_detect_line_endings', true); // initialize the configuration $delimiter = $this->config->getDelimiter(); $enclosure = $this->config->getEnclosure(); ...
php
{ "resource": "" }
q258372
EavAttributeGroupRepository.load
test
public function load($id) { // execute the prepared statement and return the EAV attribute group with the passed ID $this->eavAttributeGroupStmt->execute(array($id)); return $this->eavAttributeGroupStmt->fetch(\PDO::FETCH_ASSOC); }
php
{ "resource": "" }
q258373
EavAttributeGroupRepository.findAllByAttributeSetId
test
public function findAllByAttributeSetId($attributeSetId) { // initialize the array for the EAV attribute sets $eavAttributeGroups = array(); // load the attributes $this->eavAttributeGroupsByAttributeSetIdStmt->execute(array(MemberNames::ATTRIBUTE_SET_ID => $attributeSetId)); ...
php
{ "resource": "" }
q258374
EavAttributeGroupRepository.findOneByEntityTypeCodeAndAttributeSetNameAndAttributeGroupName
test
public function findOneByEntityTypeCodeAndAttributeSetNameAndAttributeGroupName($entityTypeCode, $attributeSetName, $attributeGroupName) { // initialize the params $params = array( MemberNames::ENTITY_TYPE_CODE => $entityTypeCode, MemberNames::ATTRIBUTE_SET_NAME => $at...
php
{ "resource": "" }
q258375
LexerConfigFactory.createLexerConfig
test
public function createLexerConfig() { // initialize the lexer configuration $config = new LexerConfig(); // query whether or not a delimiter character has been configured if ($delimiter = $this->configuration->getDelimiter()) { $config->setDelimiter($delimiter); ...
php
{ "resource": "" }
q258376
EavAttributeOptionValueRepository.findOneByOptionIdAndStoreId
test
public function findOneByOptionIdAndStoreId($optionId, $storeId) { // the parameters of the EAV attribute option to load $params = array( MemberNames::OPTION_ID => $optionId, MemberNames::STORE_ID => $storeId, ); // prepare the cache key $cacheKey =...
php
{ "resource": "" }
q258377
FileResolverFactory.createFileResolver
test
public function createFileResolver(SubjectConfigurationInterface $subject) { // create a new file resolver instance for the subject with the passed configuration $fileResolver = $this->container->get($subject->getFileResolver()->getId()); $fileResolver->setSubjectConfiguration($subject); ...
php
{ "resource": "" }
q258378
CoreConfigDataRepository.findAll
test
public function findAll() { // prepare the core configuration data $coreConfigDatas = array(); // execute the prepared statement $this->coreConfigDataStmt->execute(); // load the available core config data $availableCoreConfigDatas = $this->coreConfigDataStmt->fetc...
php
{ "resource": "" }
q258379
SystemLoggerTrait.getSystemLogger
test
public function getSystemLogger($name = LoggerKeys::SYSTEM) { // query whether or not, the requested logger is available if (isset($this->systemLoggers[$name])) { return $this->systemLoggers[$name]; } // throw an exception if the requested logger is NOT available ...
php
{ "resource": "" }
q258380
PluginFactory.createPlugin
test
public function createPlugin(PluginConfigurationInterface $pluginConfiguration) { // load the plugin instance from the DI container and set the plugin configuration $pluginInstance = $this->container->get($pluginConfiguration->getId()); $pluginInstance->setPluginConfiguration($pluginConfigu...
php
{ "resource": "" }
q258381
AbstractObserver.mergeEntity
test
protected function mergeEntity(array $entity, array $attr) { return array_merge($entity, $attr, array(EntityStatus::MEMBER_NAME => EntityStatus::STATUS_UPDATE)); }
php
{ "resource": "" }
q258382
NumberConverterFactory.createNumberConverter
test
public function createNumberConverter(SubjectConfigurationInterface $subject) { // create a new number converter instance for the subject with the passed configuration $numberConverter = $this->container->get($subject->getNumberConverter()->getId()); $numberConverter->setSubjectConfiguratio...
php
{ "resource": "" }
q258383
AbstractEavSubject.castValueByBackendType
test
public function castValueByBackendType($backendType, $value) { // cast the value to a valid timestamp if ($backendType === BackendTypeKeys::BACKEND_TYPE_DATETIME) { return \DateTime::createFromFormat($this->getConfiguration()->getDateConverter()->getSourceDateFormat(), $value)->format('...
php
{ "resource": "" }
q258384
AbstractEavSubject.getEntityTypeCode
test
public function getEntityTypeCode() { // load the entity type code from the configuration $entityTypeCode = $this->getConfiguration()->getConfiguration()->getEntityTypeCode(); // try to map the entity type code if (isset($this->entityTypeCodeToAttributeSetMappings[$entityTypeCode])...
php
{ "resource": "" }
q258385
AbstractEavSubject.getAttributes
test
public function getAttributes() { // query whether or not, the requested EAV attributes are available if (isset($this->attributes[$entityTypeCode = $this->getEntityTypeCode()])) { // load the attributes for the entity type code $attributes = $this->attributes[$entityTypeCode...
php
{ "resource": "" }
q258386
AbstractEavSubject.getEavUserDefinedAttributes
test
public function getEavUserDefinedAttributes() { // initialize the array with the user defined EAV attributes $eavUserDefinedAttributes = array(); // query whether or not user defined EAV attributes for the actualy entity type are available if (isset($this->userDefinedAttributes[$en...
php
{ "resource": "" }
q258387
AbstractEavSubject.getEavAttributeByAttributeCode
test
public function getEavAttributeByAttributeCode($attributeCode) { // load the attributes $attributes = $this->getAttributes(); // query whether or not the attribute exists if (isset($attributes[$attributeCode])) { return $attributes[$attributeCode]; } //...
php
{ "resource": "" }
q258388
CategoryAssembler.getCategoriesWithResolvedPath
test
public function getCategoriesWithResolvedPath() { // prepare the categories $categories = array(); // load the categories from the database $availableCategories = $this->categoryRepository->findAll(); // create the array with the resolved category path as keys fore...
php
{ "resource": "" }
q258389
CategoryAssembler.getCategoriesWithResolvedPathByStoreView
test
public function getCategoriesWithResolvedPathByStoreView($storeViewId) { // prepare the categories $categories = array(); // load the categories from the database $availableCategories = $this->categoryRepository->findAllByStoreView($storeViewId); // create the array with th...
php
{ "resource": "" }
q258390
HeaderTrait.getHeader
test
public function getHeader($name) { // map column => attribute name $name = $this->mapAttributeCodeByHeaderMapping($name); // query whether or not, the header is available if (isset($this->headers[$name])) { return $this->headers[$name]; } // throw an ex...
php
{ "resource": "" }
q258391
HeaderTrait.addHeader
test
public function addHeader($name) { // add the header $this->headers[$name] = $position = sizeof($this->headers); // return the new header's position return $position; }
php
{ "resource": "" }
q258392
HeaderTrait.mapAttributeCodeByHeaderMapping
test
public function mapAttributeCodeByHeaderMapping($attributeCode) { // load the header mappings $headerMappings = $this->getHeaderMappings(); // query weather or not we've a mapping, if yes, map the attribute code if (isset($headerMappings[$attributeCode])) { $attributeCo...
php
{ "resource": "" }
q258393
AbstractSubject.tearDown
test
public function tearDown($serial) { // load the registry processor $registryProcessor = $this->getRegistryProcessor(); // update the source directory for the next subject $registryProcessor->mergeAttributesRecursive( $serial, array( RegistryK...
php
{ "resource": "" }
q258394
AbstractSubject.registerObserver
test
public function registerObserver(ObserverInterface $observer, $type) { // query whether or not the array with the callbacks for the // passed type has already been initialized, or not if (!isset($this->observers[$type])) { $this->observers[$type] = array(); } //...
php
{ "resource": "" }
q258395
AbstractSubject.registerCallback
test
public function registerCallback(CallbackInterface $callback, $type) { // query whether or not the array with the callbacks for the // passed type has already been initialized, or not if (!isset($this->callbacks[$type])) { $this->callbacks[$type] = array(); } //...
php
{ "resource": "" }
q258396
AbstractSubject.getCallbacksByType
test
public function getCallbacksByType($type) { // initialize the array for the callbacks $callbacks = array(); // query whether or not callbacks for the type are available if (isset($this->callbacks[$type])) { $callbacks = $this->callbacks[$type]; } // ret...
php
{ "resource": "" }
q258397
AbstractSubject.importRow
test
public function importRow(array $row) { // initialize the row $this->row = $row; // raise the line number and reset the skip row flag $this->lineNumber++; $this->skipRow = false; // invoke the events that has to be fired before the artfact's row will be processed ...
php
{ "resource": "" }
q258398
AbstractSubject.prepareStoreViewCode
test
public function prepareStoreViewCode() { // re-set the store view code $this->setStoreViewCode(null); // initialize the store view code if ($storeViewCode = $this->getValue(ColumnKeys::STORE_VIEW_CODE)) { $this->setStoreViewCode($storeViewCode); } }
php
{ "resource": "" }
q258399
AbstractSubject.getStoreId
test
public function getStoreId($storeViewCode) { // query whether or not, the requested store is available if (isset($this->stores[$storeViewCode])) { return (integer) $this->stores[$storeViewCode][MemberNames::STORE_ID]; } // throw an exception, if not throw new \E...
php
{ "resource": "" }