_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q256400 | JedGenerator.buildMessages | test | public static function buildMessages( Translations $translations ) {
$plural_forms = $translations->getPluralForms();
$number_of_plurals = is_array( $plural_forms ) ? ( $plural_forms[0] - 1 ) : null;
$messages = [];
$context_glue = chr( 4 );
foreach ( $translations as $translation ) {
/... | php | {
"resource": ""
} |
q256401 | PotGenerator.setCommentBeforeHeaders | test | public static function setCommentBeforeHeaders( $comment ) {
$comments = explode( "\n", $comment );
foreach ( $comments as $line ) {
if ( '' !== trim( $line ) ) {
static::$comments_before_headers[] = '# ' . $line;
}
}
} | php | {
"resource": ""
} |
q256402 | PotGenerator.addLines | test | private static function addLines( array &$lines, $name, $value ) {
$newlines = self::multilineQuote( $value );
if ( count( $newlines ) === 1 ) {
$lines[] = $name . ' ' . $newlines[0];
} else {
$lines[] = $name . ' ""';
foreach ( $newlines as $line ) {
$lines[] = $line;
}
}
} | php | {
"resource": ""
} |
q256403 | MakePotCommand.get_main_file_data | test | protected function get_main_file_data() {
$files = new IteratorIterator( new DirectoryIterator( $this->source ) );
/** @var DirectoryIterator $file */
foreach ( $files as $file ) {
// wp-content/themes/my-theme/style.css
if ( $file->isFile() && 'style' === $file->getBasename( '.css' ) && $file->isReadable(... | php | {
"resource": ""
} |
q256404 | MakePotCommand.extract_strings | test | protected function extract_strings() {
$translations = new Translations();
// Add existing strings first but don't keep headers.
if ( ! empty( $this->merge ) ) {
$existing_translations = new Translations();
Po::fromFile( $this->merge, $existing_translations );
$translations->mergeWith( $existing_transla... | php | {
"resource": ""
} |
q256405 | MakePotCommand.get_file_comment | test | protected function get_file_comment() {
if ( '' === $this->file_comment ) {
return '';
}
if ( isset( $this->file_comment ) ) {
return implode( "\n", explode( '\n', $this->file_comment ) );
}
if ( isset( $this->main_file_data['Theme Name'] ) ) {
if ( isset( $this->main_file_data['License'] ) ) {
... | php | {
"resource": ""
} |
q256406 | MakePotCommand.set_default_headers | test | protected function set_default_headers( $translations ) {
$name = null;
$version = $this->get_wp_version();
$bugs_address = null;
if ( ! $version && isset( $this->main_file_data['Version'] ) ) {
$version = $this->main_file_data['Version'];
}
if ( isset( $this->main_file_data['Theme Name'] ... | php | {
"resource": ""
} |
q256407 | MakePotCommand.get_file_data | test | protected static function get_file_data( $file, $headers ) {
// We don't need to write to the file, so just open for reading.
$fp = fopen( $file, 'rb' );
// Pull only the first 8kiB of the file in.
$file_data = fread( $fp, 8192 );
// PHP will close file handle, but we are good citizens.
fclose( $fp );
... | php | {
"resource": ""
} |
q256408 | MakePotCommand.get_file_data_from_string | test | public static function get_file_data_from_string( $string, $headers ) {
foreach ( $headers as $field => $regex ) {
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $string, $match ) && $match[1] ) {
$headers[ $field ] = static::_cleanup_header_comment( $match[1] );
} else {
$h... | php | {
"resource": ""
} |
q256409 | JsFunctionsScanner.resolveExpressionCallee | test | private function resolveExpressionCallee( Node\CallExpression $node ) {
$callee = $node->getCallee();
// If the callee is a simple identifier it can simply be returned.
// For example: __( "translation" ).
if ( 'Identifier' === $callee->getType() ) {
return [
'name' => $callee->getName(),
'comme... | php | {
"resource": ""
} |
q256410 | JsFunctionsScanner.commentPrecedesNode | test | private function commentPrecedesNode( Node\Comment $comment, Node\Node $node ) {
// Comments should be on the same or an earlier line than the translation.
if ( $node->getLocation()->getStart()->getLine() - $comment->getLocation()->getEnd()->getLine() > 1 ) {
return false;
}
// Comments on the same line sho... | php | {
"resource": ""
} |
q256411 | IterableCodeExtractor.calculateMatchScore | test | protected static function calculateMatchScore( SplFileInfo $file, array $matchers = [] ) {
if ( empty( $matchers ) ) {
return 0;
}
if ( in_array( $file->getBasename(), $matchers, true ) ) {
return 10;
}
// Check for more complex paths, e.g. /some/sub/folder.
$root_relative_path = str_replace( static... | php | {
"resource": ""
} |
q256412 | IterableCodeExtractor.containsMatchingChildren | test | protected static function containsMatchingChildren( SplFileInfo $dir, array $matchers = [] ) {
if ( empty( $matchers ) ) {
return false;
}
/** @var string $root_relative_path */
$root_relative_path = str_replace( static::$dir, '', $dir->getPathname() );
foreach ( $matchers as $path_or_file ) {
// If t... | php | {
"resource": ""
} |
q256413 | IterableCodeExtractor.getFilesFromDirectory | test | public static function getFilesFromDirectory( $dir, array $include = [], array $exclude = [], $extensions = [] ) {
$filtered_files = [];
$files = new RecursiveIteratorIterator(
new RecursiveCallbackFilterIterator(
new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirecto... | php | {
"resource": ""
} |
q256414 | MakeJsonCommand.make_json | test | protected function make_json( $source_file, $destination ) {
/** @var Translations[] $mapping */
$mapping = [];
$translations = new Translations();
$result = [];
PoExtractor::fromFile( $source_file, $translations );
$base_file_name = basename( $source_file, '.po' );
foreach ( $translations a... | php | {
"resource": ""
} |
q256415 | MakeJsonCommand.build_json_files | test | protected function build_json_files( $mapping, $base_file_name, $destination ) {
$result = [];
foreach ( $mapping as $file => $translations ) {
/** @var Translations $translations */
$hash = md5( $file );
$destination_file = "${destination}/{$base_file_name}-{$hash}.json";
$success = JedG... | php | {
"resource": ""
} |
q256416 | MakeJsonCommand.remove_js_strings_from_po_file | test | protected function remove_js_strings_from_po_file( $source_file ) {
/** @var Translations[] $mapping */
$translations = new Translations();
PoExtractor::fromFile( $source_file, $translations );
foreach ( $translations->getArrayCopy() as $translation ) {
/** @var Translation $translation */
if ( ! $tran... | php | {
"resource": ""
} |
q256417 | UpdateChecklist.markUpdatesSuccessful | test | public function markUpdatesSuccessful(array $names, $checkListPoints = TRUE) {
if ($this->updateChecklist === FALSE) {
return;
}
$this->setSuccessfulByHook($names, TRUE);
if ($checkListPoints) {
$this->checkListPoints($names);
}
} | php | {
"resource": ""
} |
q256418 | UpdateChecklist.markAllUpdates | test | public function markAllUpdates($status = TRUE) {
if ($this->updateChecklist === FALSE) {
return;
}
$keys = [];
foreach ($this->updateChecklist->items as $versionItems) {
foreach ($versionItems as $key => $item) {
if (is_array($item)) {
$keys[] = $key;
}
}
... | php | {
"resource": ""
} |
q256419 | UpdateChecklist.setSuccessfulByHook | test | protected function setSuccessfulByHook(array $keys, $status = TRUE) {
foreach ($keys as $key) {
if ($update = Update::load($key)) {
$update->setSuccessfulByHook($status)->save();
}
else {
Update::create(
[
'id' => $key,
'successful_by_hook' => $sta... | php | {
"resource": ""
} |
q256420 | UpdateChecklist.checkListPoints | test | protected function checkListPoints(array $names) {
/* @var \Drupal\Core\Config\Config $drooplerUpdateConfig */
$drooplerUpdateConfig = $this->configFactory->getEditable('checklistapi.progress.d_update');
$user = $this->account->id();
$time = time();
foreach ($names as $name) {
if ($drooplerUp... | php | {
"resource": ""
} |
q256421 | UpdateChecklist.checkAllListPoints | test | protected function checkAllListPoints($status = TRUE) {
$drooplerUpdateConfig = $this->configFactory
->getEditable('checklistapi.progress.d_update');
$user = $this->account->id();
$time = time();
$drooplerUpdateConfig
->set(ChecklistapiChecklist::PROGRESS_CONFIG_KEY . '.#changed', $time)
... | php | {
"resource": ""
} |
q256422 | UpdateChecklist.saveProgress | test | public function saveProgress(array $values) {
$user = \Drupal::currentUser();
$time = time();
$num_changed_items = 0;
$progress = [
'#changed' => $time,
'#changed_by' => $user->id(),
'#completed_items' => 0,
'#items' => [],
];
$status = [
'positive' => [],
'n... | php | {
"resource": ""
} |
q256423 | SupportController.render | test | public function render() {
$output = '<h3>' . t('Droopler is a Drupal 8 profile designed to kickstart a new webpage in a few minutes') . '</h3>';
$output .= '<p>' . t('More info about Droopler - <a href=":link">See official Droopler website</a>.', [':link' => 'https://droopler.com/']) . '</p>';
$output .= '... | php | {
"resource": ""
} |
q256424 | ConfigManager.generateHashFromDatabase | test | public function generateHashFromDatabase($configName) {
$config = \Drupal::config($configName)->getRawData();
if (empty($config)) {
return FALSE;
}
unset($config['uuid']);
unset($config['lang']);
unset($config['langcode']);
$configString = serialize($config);
return md5($configSt... | php | {
"resource": ""
} |
q256425 | ConfigManager.compare | test | public function compare($configName, $hash = NULL) {
if (empty($hash)) {
return TRUE;
}
else {
return $this->generateHashFromDatabase($configName) == $hash;
}
} | php | {
"resource": ""
} |
q256426 | Updater.importConfig | test | public function importConfig($module, $name, $hash) {
$configPath = drupal_get_path('module', $module) . '/config/install';
$source = new FileStorage($configPath);
$data = $source->read($name);
if (!$data || !$this->configManager->compare($name, $hash)) {
return false;
}
return $this->con... | php | {
"resource": ""
} |
q256427 | Updater.importConfigs | test | public function importConfigs(array $configs) {
$status = [];
foreach ($configs as $module => $config) {
foreach ($config as $configName => $configHash) {
$status[] = $this->importConfig($module, $configName, $configHash);
}
}
return !in_array(false, $status);
} | php | {
"resource": ""
} |
q256428 | Updater.installModules | test | public function installModules(array $modules, $enableDependencies = TRUE) {
if (empty($modules) || !is_array($modules)) {
return FALSE;
}
$moduleData = system_rebuild_module_data();
$modules = array_combine($modules, $modules);
if ($missing_modules = array_diff_key($modules, $moduleData)) {
... | php | {
"resource": ""
} |
q256429 | DownloadFile.checkLink | test | public function checkLink($link_hash, $paragraph_id) {
// Load file and paragraph.
$entity = $this->getSubscribeFileEntity('link_hash', $link_hash);
$this->checkLinkActive($entity);
$paragraph = Paragraph::load($paragraph_id);
$file_hash = $entity->get('file_hash')->get(0)->getValue();
$link_opt... | php | {
"resource": ""
} |
q256430 | DownloadFile.checkLinkActive | test | private function checkLinkActive($entity) {
$created = $entity->get('created')->get(0)->getValue();
if (time() > $created['value'] + 86400) {
$this->goHomeWithMessage(t('Link is not active, please add your email again'));
}
} | php | {
"resource": ""
} |
q256431 | DownloadFile.goHomeWithMessage | test | private function goHomeWithMessage($message) {
drupal_set_message($message);
$url = Url::fromRoute('<front>');
$response = new RedirectResponse($url->toString());
$response->send();
} | php | {
"resource": ""
} |
q256432 | DownloadFile.getFile | test | public function getFile($file_hash) {
$entity = $this->getSubscribeFileEntity('file_hash', $file_hash);
$this->checkLinkActive($entity);
$file = File::load($entity->get('fid')->getValue()[0]['value']);
$uri = $file->getFileUri();
$response = new BinaryFileResponse($uri);
$response->setContentDis... | php | {
"resource": ""
} |
q256433 | Source.getItemsFromData | test | protected function getItemsFromData($columns)
{
$items = [];
foreach ($this->data as $key => $item) {
foreach ($columns as $column) {
$fieldName = $column->getField();
$fieldValue = '';
if ($this instanceof Entity) {
/... | php | {
"resource": ""
} |
q256434 | Source.getTotalCountFromData | test | public function getTotalCountFromData($maxResults = null)
{
return $maxResults === null ? $this->count : min($this->count, $maxResults);
} | php | {
"resource": ""
} |
q256435 | Source.prepareStringForLikeCompare | test | protected function prepareStringForLikeCompare($input, $type = null)
{
if ($type === 'array') {
$outputString = str_replace(':{i:0;', ':{', serialize($input));
} else {
$outputString = $this->removeAccents($input);
}
return $outputString;
} | php | {
"resource": ""
} |
q256436 | Vector.setData | test | public function setData($data)
{
$this->data = $data;
if (!is_array($this->data) || empty($this->data)) {
throw new \InvalidArgumentException('Data should be an array with content');
}
// This seems to exclude ...
if (is_object(reset($this->data))) {
... | php | {
"resource": ""
} |
q256437 | GridFactory.resolveType | test | private function resolveType($type)
{
if (!$type instanceof GridTypeInterface) {
if (!is_string($type)) {
throw new UnexpectedTypeException($type, 'string, APY\DataGridBundle\Grid\GridTypeInterface');
}
$type = $this->registry->getType($type);
}
... | php | {
"resource": ""
} |
q256438 | GridFactory.resolveOptions | test | private function resolveOptions(GridTypeInterface $type, Source $source = null, array $options = [])
{
$resolver = new OptionsResolver();
$type->configureOptions($resolver);
if (null !== $source && !isset($options['source'])) {
$options['source'] = $source;
}
$... | php | {
"resource": ""
} |
q256439 | DataGridExtension.getGrid | test | public function getGrid(Twig_Environment $environment, $grid, $theme = null, $id = '', array $params = [], $withjs = true)
{
$this->initGrid($grid, $theme, $id, $params);
// For export
$grid->setTemplate($theme);
return $this->renderBlock($environment, 'grid', ['grid' => $grid, 'wi... | php | {
"resource": ""
} |
q256440 | DataGridExtension.getGridCell | test | public function getGridCell(Twig_Environment $environment, $column, $row, $grid)
{
$value = $column->renderCell($row->getField($column->getId()), $row, $this->router);
$id = $this->names[$grid->getHash()];
if (($id != '' && ($this->hasBlock($environment, $block = 'grid_' . $id . '_column_'... | php | {
"resource": ""
} |
q256441 | DataGridExtension.getGridFilter | test | public function getGridFilter(Twig_Environment $environment, $column, $grid, $submitOnChange = true)
{
$id = $this->names[$grid->getHash()];
if (($id != '' && ($this->hasBlock($environment, $block = 'grid_' . $id . '_column_' . $column->getRenderBlockId() . '_filter')
|| $this->... | php | {
"resource": ""
} |
q256442 | DataGridExtension.getGridColumnOperator | test | public function getGridColumnOperator(Twig_Environment $environment, $column, $grid, $operator, $submitOnChange = true)
{
return $this->renderBlock($environment, 'grid_column_operator', ['grid' => $grid, 'column' => $column, 'submitOnChange' => $submitOnChange, 'op' => $operator]);
} | php | {
"resource": ""
} |
q256443 | DataGridExtension.hasBlock | test | protected function hasBlock(Twig_Environment $environment, $name)
{
foreach ($this->getTemplates($environment) as $template) {
/** @var $template Twig_Template */
if ($template->hasBlock($name, [])) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q256444 | ORMCountWalker.walkSelectStatement | test | public function walkSelectStatement(SelectStatement $AST)
{
$rootComponents = [];
foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) {
if (array_key_exists('parent', $qComp) && $qComp['parent'] === null && $qComp['nestingLevel'] == 0) {
$rootComponents[] = [$dq... | php | {
"resource": ""
} |
q256445 | Grid.setSource | test | public function setSource(Source $source)
{
if ($this->source !== null) {
throw new \InvalidArgumentException(self::SOURCE_ALREADY_SETTED_EX_MSG);
}
$this->source = $source;
$this->source->initialise($this->container);
// Get columns from the source
$th... | php | {
"resource": ""
} |
q256446 | Grid.isReadyForRedirect | test | public function isReadyForRedirect()
{
if ($this->source === null) {
throw new \Exception(self::SOURCE_NOT_SETTED_EX_MSG);
}
if ($this->redirect !== null) {
return $this->redirect;
}
$this->createHash();
$this->requestData = (array) $this->r... | php | {
"resource": ""
} |
q256447 | Grid.processRequestData | test | protected function processRequestData()
{
$this->processMassActions($this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION));
if ($this->processExports($this->getFromRequest(self::REQUEST_QUERY_EXPORT))
|| $this->processTweaks($this->getFromRequest(self::REQUEST_QUERY_TWEAK))) {
... | php | {
"resource": ""
} |
q256448 | Grid.processMassActions | test | protected function processMassActions($actionId)
{
if ($actionId > -1 && '' !== $actionId) {
if (array_key_exists($actionId, $this->massActions)) {
$action = $this->massActions[$actionId];
$actionAllKeys = (boolean) $this->getFromRequest(self::REQUEST_QUERY_MASS_A... | php | {
"resource": ""
} |
q256449 | Grid.processExports | test | protected function processExports($exportId)
{
if ($exportId > -1 && '' !== $exportId) {
if (array_key_exists($exportId, $this->exports)) {
$this->isReadyForExport = true;
$this->processSessionData();
$this->page = 0;
$this->limit ... | php | {
"resource": ""
} |
q256450 | Grid.processFilters | test | protected function processFilters($permanent = true)
{
foreach (($permanent ? $this->permanentFilters : $this->defaultFilters) as $columnId => $value) {
/* @var $column Column */
$column = $this->columns->getColumnById($columnId);
if ($permanent) {
// Dis... | php | {
"resource": ""
} |
q256451 | Grid.processSessionData | test | protected function processSessionData()
{
// Filters
foreach ($this->columns as $column) {
if (($data = $this->get($column->getId())) !== null) {
$column->setData($data);
}
}
// Page
if (($page = $this->get(self::REQUEST_QUERY_PAGE)) !... | php | {
"resource": ""
} |
q256452 | Grid.prepare | test | protected function prepare()
{
if ($this->prepared) {
return $this;
}
if ($this->source->isDataLoaded()) {
$this->rows = $this->source->executeFromData($this->columns->getIterator(true), $this->page, $this->limit, $this->maxResults);
} else {
$thi... | php | {
"resource": ""
} |
q256453 | Grid.set | test | protected function set($key, $data)
{
// Only the filters values are removed from the session
$fromIsEmpty = isset($data['from']) && ((is_string($data['from']) && $data['from'] === '') || (is_array($data['from']) && $data['from'][0] === ''));
$toIsSet = isset($data['to']) && (is_string($data... | php | {
"resource": ""
} |
q256454 | Grid.getColumn | test | public function getColumn($columnId)
{
foreach ($this->lazyAddColumn as $column) {
if ($column['column']->getId() == $columnId) {
return $column['column'];
}
}
return $this->columns->getColumnById($columnId);
} | php | {
"resource": ""
} |
q256455 | Grid.hasColumn | test | public function hasColumn($columnId)
{
foreach ($this->lazyAddColumn as $column) {
if ($column['column']->getId() == $columnId) {
return true;
}
}
return $this->columns->hasColumnById($columnId);
} | php | {
"resource": ""
} |
q256456 | Grid.setColumnsOrder | test | public function setColumnsOrder(array $columnIds, $keepOtherColumns = true)
{
$this->columns->setColumnsOrder($columnIds, $keepOtherColumns);
return $this;
} | php | {
"resource": ""
} |
q256457 | Grid.addMassAction | test | public function addMassAction(MassActionInterface $action)
{
if ($action->getRole() === null || $this->securityContext->isGranted($action->getRole())) {
$this->massActions[] = $action;
}
return $this;
} | php | {
"resource": ""
} |
q256458 | Grid.addTweak | test | public function addTweak($title, array $tweak, $id = null, $group = null)
{
if ($id !== null && !preg_match('/^[0-9a-zA-Z_\+-]+$/', $id)) {
throw new \InvalidArgumentException(sprintf(self::TWEAK_MALFORMED_ID_EX_MSG, $id));
}
$tweak = array_merge(['id' => $id, 'title' => $title,... | php | {
"resource": ""
} |
q256459 | Grid.getTweaks | test | public function getTweaks()
{
$separator = strpos($this->getRouteUrl(), '?') ? '&' : '?';
$url = $this->getRouteUrl() . $separator . $this->getHash() . '[' . self::REQUEST_QUERY_TWEAK . ']=';
foreach ($this->tweaks as $id => $tweak) {
$this->tweaks[$id] = array_merge($tweak, ['u... | php | {
"resource": ""
} |
q256460 | Grid.getTweak | test | public function getTweak($id)
{
$tweaks = $this->getTweaks();
if (isset($tweaks[$id])) {
return $tweaks[$id];
}
throw new \InvalidArgumentException(sprintf(self::NOT_VALID_TWEAK_ID_EX_MSG, $id));
} | php | {
"resource": ""
} |
q256461 | Grid.getTweaksGroup | test | public function getTweaksGroup($group)
{
$tweaksGroup = $this->getTweaks();
foreach ($tweaksGroup as $id => $tweak) {
if ($tweak['group'] != $group) {
unset($tweaksGroup[$id]);
}
}
return $tweaksGroup;
} | php | {
"resource": ""
} |
q256462 | Grid.addRowAction | test | public function addRowAction(RowActionInterface $action)
{
if ($action->getRole() === null || $this->securityContext->isGranted($action->getRole())) {
$this->rowActions[$action->getColumn()][] = $action;
}
return $this;
} | php | {
"resource": ""
} |
q256463 | Grid.setTemplate | test | public function setTemplate($template)
{
if ($template !== null) {
if ($template instanceof \Twig_Template) {
$template = '__SELF__' . $template->getTemplateName();
} elseif (!is_string($template)) {
throw new \Exception(self::TWIG_TEMPLATE_LOAD_EX_MSG... | php | {
"resource": ""
} |
q256464 | Grid.addExport | test | public function addExport(ExportInterface $export)
{
if ($export->getRole() === null || $this->securityContext->isGranted($export->getRole())) {
$this->exports[] = $export;
}
return $this;
} | php | {
"resource": ""
} |
q256465 | Grid.getRouteUrl | test | public function getRouteUrl()
{
if ($this->routeUrl === null) {
$this->routeUrl = $this->router->generate($this->request->get('_route'), $this->getRouteParameters());
}
return $this->routeUrl;
} | php | {
"resource": ""
} |
q256466 | Grid.setFilters | test | protected function setFilters(array $filters, $permanent = true)
{
foreach ($filters as $columnId => $value) {
if ($permanent) {
$this->permanentFilters[$columnId] = $value;
} else {
$this->defaultFilters[$columnId] = $value;
}
}
... | php | {
"resource": ""
} |
q256467 | Grid.setLimits | test | public function setLimits($limits)
{
if (is_array($limits)) {
if ((int) key($limits) === 0) {
$this->limits = array_combine($limits, $limits);
} else {
$this->limits = $limits;
}
} elseif (is_int($limits)) {
$this->limit... | php | {
"resource": ""
} |
q256468 | Grid.getPageCount | test | public function getPageCount()
{
$pageCount = 1;
if ($this->getLimit() > 0) {
$pageCount = ceil($this->getTotalCount() / $this->getLimit());
}
// @todo why this should be a float?
return $pageCount;
} | php | {
"resource": ""
} |
q256469 | Grid.setMaxResults | test | public function setMaxResults($maxResults = null)
{
if ((is_int($maxResults) && $maxResults < 0) && $maxResults !== null) {
throw new \InvalidArgumentException(self::NOT_VALID_MAX_RESULT_EX_MSG);
}
$this->maxResults = $maxResults;
return $this;
} | php | {
"resource": ""
} |
q256470 | Grid.isTitleSectionVisible | test | public function isTitleSectionVisible()
{
if ($this->showTitles === true) {
foreach ($this->columns as $column) {
if ($column->getTitle() != '') {
return true;
}
}
}
return false;
} | php | {
"resource": ""
} |
q256471 | Grid.isFilterSectionVisible | test | public function isFilterSectionVisible()
{
if ($this->showFilters === true) {
foreach ($this->columns as $column) {
if ($column->isFilterable() && $column->getType() != 'massaction' && $column->getType() != 'actions') {
return true;
}
... | php | {
"resource": ""
} |
q256472 | Grid.isPagerSectionVisible | test | public function isPagerSectionVisible()
{
$limits = $this->getLimits();
if (empty($limits)) {
return false;
}
// true when totalCount rows exceed the minimum pager limit
return min(array_keys($limits)) < $this->totalCount;
} | php | {
"resource": ""
} |
q256473 | Grid.showColumns | test | public function showColumns($columnIds)
{
foreach ((array) $columnIds as $columnId) {
$this->lazyHideShowColumns[$columnId] = true;
}
return $this;
} | php | {
"resource": ""
} |
q256474 | Grid.hideColumns | test | public function hideColumns($columnIds)
{
foreach ((array) $columnIds as $columnId) {
$this->lazyHideShowColumns[$columnId] = false;
}
return $this;
} | php | {
"resource": ""
} |
q256475 | Grid.getGridResponse | test | public function getGridResponse($param1 = null, $param2 = null, Response $response = null)
{
$isReadyForRedirect = $this->isReadyForRedirect();
if ($this->isReadyForExport()) {
return $this->getExportResponse();
}
if ($this->isMassActionRedirect()) {
return ... | php | {
"resource": ""
} |
q256476 | Grid.getRawData | test | public function getRawData($columnNames = null, $namedIndexes = true)
{
if ($columnNames === null) {
foreach ($this->getColumns() as $column) {
$columnNames[] = $column->getId();
}
}
$columnNames = (array) $columnNames;
$result = [];
f... | php | {
"resource": ""
} |
q256477 | Grid.getFilters | test | public function getFilters()
{
if ($this->hash === null) {
throw new \Exception(self::GET_FILTERS_NO_REQUEST_HANDLED_EX_MSG);
}
if ($this->sessionFilters === null) {
$this->sessionFilters = [];
$session = $this->sessionData;
$requestQueries =... | php | {
"resource": ""
} |
q256478 | Grid.getFilter | test | public function getFilter($columnId)
{
if ($this->hash === null) {
throw new \Exception(self::GET_FILTERS_NO_REQUEST_HANDLED_EX_MSG);
}
$sessionFilters = $this->getFilters();
return isset($sessionFilters[$columnId]) ? $sessionFilters[$columnId] : null;
} | php | {
"resource": ""
} |
q256479 | Grid.hasFilter | test | public function hasFilter($columnId)
{
if ($this->hash === null) {
throw new \Exception(self::HAS_FILTER_NO_REQUEST_HANDLED_EX_MSG);
}
return $this->getFilter($columnId) !== null;
} | php | {
"resource": ""
} |
q256480 | Entity.initQueryBuilder | test | public function initQueryBuilder(QueryBuilder $queryBuilder)
{
$this->queryBuilder = clone $queryBuilder;
//Try to guess the new root alias and apply it to our queries+
//as the external querybuilder almost certainly is not used our default alias
$externalTableAliases = $this->query... | php | {
"resource": ""
} |
q256481 | Column.renderCell | test | public function renderCell($value, $row, $router)
{
if (is_callable($this->callback)) {
return call_user_func($this->callback, $value, $row, $router);
}
$value = is_bool($value) ? (int) $value : $value;
if (array_key_exists((string) $value, $this->values)) {
... | php | {
"resource": ""
} |
q256482 | Column.isVisible | test | public function isVisible($isExported = false)
{
$visible = $isExported && $this->export !== null ? $this->export : $this->visible;
if ($visible && $this->authorizationChecker !== null && $this->getRole() !== null) {
return $this->authorizationChecker->isGranted($this->getRole());
... | php | {
"resource": ""
} |
q256483 | Column.setOrder | test | public function setOrder($order)
{
if ($order !== null) {
$this->order = $order;
$this->isSorted = true;
}
return $this;
} | php | {
"resource": ""
} |
q256484 | Column.setSize | test | public function setSize($size)
{
if ($size < -1) {
throw new \InvalidArgumentException(sprintf('Unsupported column size %s, use positive value or -1 for auto resize', $size));
}
$this->size = $size;
return $this;
} | php | {
"resource": ""
} |
q256485 | Column.setData | test | public function setData($data)
{
$this->data = ['operator' => $this->getDefaultOperator(), 'from' => static::DEFAULT_VALUE, 'to' => static::DEFAULT_VALUE];
$hasValue = false;
if (isset($data['from']) && $this->isQueryValid($data['from'])) {
$this->data['from'] = $data['from'];
... | php | {
"resource": ""
} |
q256486 | Column.getData | test | public function getData()
{
$result = [];
$hasValue = false;
if ($this->data['from'] != $this::DEFAULT_VALUE) {
$result['from'] = $this->data['from'];
$hasValue = true;
}
if ($this->data['to'] != $this::DEFAULT_VALUE) {
$result['to'] = $t... | php | {
"resource": ""
} |
q256487 | Column.setAlign | test | public function setAlign($align)
{
if (!in_array($align, self::$aligns)) {
throw new \InvalidArgumentException(sprintf('Unsupported align %s, just left, right and center are supported', $align));
}
$this->align = $align;
return $this;
} | php | {
"resource": ""
} |
q256488 | Column.getOperators | test | public function getOperators()
{
// Issue with Doctrine
// -------------------
// @see http://www.doctrine-project.org/jira/browse/DDC-1857
// @see http://www.doctrine-project.org/jira/browse/DDC-1858
if ($this->hasDQLFunction() && version_compare(DoctrineVersion::VERSION, '2... | php | {
"resource": ""
} |
q256489 | Columns.addColumn | test | public function addColumn(Column $column, $position = 0)
{
$column->setAuthorizationChecker($this->authorizationChecker);
if ($position == 0) {
$this->columns[] = $column;
} else {
if ($position > 0) {
--$position;
} else {
... | php | {
"resource": ""
} |
q256490 | Columns.setColumnsOrder | test | public function setColumnsOrder(array $columnIds, $keepOtherColumns = true)
{
$reorderedColumns = [];
$columnsIndexedByIds = [];
foreach ($this->columns as $column) {
$columnsIndexedByIds[$column->getId()] = $column;
}
foreach ($columnIds as $columnId) {
... | php | {
"resource": ""
} |
q256491 | RowAction.addRouteParameters | test | public function addRouteParameters($routeParameters)
{
$routeParameters = (array) $routeParameters;
foreach ($routeParameters as $key => $routeParameter) {
if (is_int($key)) {
$this->routeParameters[] = $routeParameter;
} else {
$this->routePa... | php | {
"resource": ""
} |
q256492 | RowAction.getRouteParametersMapping | test | public function getRouteParametersMapping($name)
{
return isset($this->routeParametersMapping[$name]) ? $this->routeParametersMapping[$name] : null;
} | php | {
"resource": ""
} |
q256493 | RowAction.render | test | public function render($row)
{
foreach ($this->callbacks as $callback) {
if (is_callable($callback)) {
if (null === call_user_func($callback, $this, $row)) {
return;
}
}
}
return $this;
} | php | {
"resource": ""
} |
q256494 | GridRegistry.addType | test | public function addType(GridTypeInterface $type)
{
$name = $type->getName();
if ($this->hasType($name)) {
throw new TypeAlreadyExistsException($name);
}
$this->types[$name] = $type;
return $this;
} | php | {
"resource": ""
} |
q256495 | GridRegistry.addColumn | test | public function addColumn(Column $column)
{
$type = $column->getType();
if ($this->hasColumn($type)) {
throw new ColumnAlreadyExistsException($type);
}
$this->columns[$type] = $column;
return $this;
} | php | {
"resource": ""
} |
q256496 | Export.setContainer | test | public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
$this->twig = $this->container->get('twig');
return $this;
} | php | {
"resource": ""
} |
q256497 | Export.getResponse | test | public function getResponse()
{
// Response
$kernelCharset = $this->container->getParameter('kernel.charset');
if ($this->charset != $kernelCharset && function_exists('mb_strlen')) {
$this->content = mb_convert_encoding($this->content, $this->charset, $kernelCharset);
... | php | {
"resource": ""
} |
q256498 | Export.getGridData | test | protected function getGridData($grid)
{
$result = [];
$this->grid = $grid;
if ($this->grid->isTitleSectionVisible()) {
$result['titles'] = $this->getGridTitles();
}
$result['rows'] = $this->getGridRows();
return $result;
} | php | {
"resource": ""
} |
q256499 | Export.getFlatGridData | test | protected function getFlatGridData($grid)
{
$data = $this->getGridData($grid);
$flatData = [];
if (isset($data['titles'])) {
$flatData[] = $data['titles'];
}
return array_merge($flatData, $data['rows']);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.