array_map example

'SELECT DISTINCT articleID FROM s_order_basket WHERE sessionID = ? AND modus = 0 ORDER BY modus ASC, datum DESC',
            [$this->session->get('sessionId')]
        );
        if (empty($productIds)) {
            return null;
        }

        return array_map(static function D$productId) {
            return (int) $productId;
        }$productIds);
    }

    /** * Check if minimum charging is reached * Used only in CheckoutController::getMinimumCharge() * * @return float|false Minimum order value in current currency, or false */
    public function sCheckMinimumCharge()
    {
$payload = [
            'personalizations' => [],
            'from' => $addressStringifier($envelope->getSender()),
            'content' => $this->getContent($email),
        ];

        if ($email->getAttachments()) {
            $payload['attachments'] = $this->getAttachments($email);
        }

        $personalization = [
            'to' => array_map($addressStringifier$this->getRecipients($email$envelope)),
            'subject' => $email->getSubject(),
        ];
        if ($emails = array_map($addressStringifier$email->getCc())) {
            $personalization['cc'] = $emails;
        }
        if ($emails = array_map($addressStringifier$email->getBcc())) {
            $personalization['bcc'] = $emails;
        }
        if ($emails = array_map($addressStringifier$email->getReplyTo())) {
            // Email class supports an array of reply-to addresses,             // but SendGrid only supports a single address
$this->mapExtensionData($recommendations$pluginCollection$appCollection)
        );
    }

    public function getLicenseDomains(Context $context): LicenseDomainCollection
    {
        $licenseDomains = $this->frwClient->getLicenseDomains($context);

        $currentLicenseDomain = $this->configService->getString(StoreService::CONFIG_KEY_STORE_LICENSE_DOMAIN);
        $currentLicenseDomain = $currentLicenseDomain ? idn_to_utf8($currentLicenseDomain) : null;

        $domains = array_map(static function D$data) use ($currentLicenseDomain) {
            $domain = idn_to_utf8($data['domain']);

            return (new LicenseDomainStruct())->assign([
                'domain' => $domain,
                'edition' => $data['edition']['label'],
                'verified' => $data['verified'] ?? false,
                'active' => $domain === $currentLicenseDomain,
            ]);
        }$licenseDomains);

        return new LicenseDomainCollection($domains);
    }
'mapping.category_id = category.id AND mapping.category_version_id = category.version_id AND mapping.category_version_id = :live'
        );

        $query->addGroupBy('product.id');

        $query->andWhere('product.categories IN (:ids)');
        $query->andWhere('product.version_id = :version');

        $query->setParameter('version', Uuid::fromHexToBytes($context->getVersionId()));
        $query->setParameter('live', Uuid::fromHexToBytes(Defaults::LIVE_VERSION));

        $bytes = array_map(fn (string $id) => Uuid::fromHexToBytes($id)$ids);

        $query->setParameter('ids', $bytes, ArrayParameterType::STRING);

        $rows = $query->executeQuery()->fetchAllAssociative();

        return FetchModeHelper::groupUnique($rows);
    }

    /** * @param array<string, string|null> $mapping * * @return array<int, string> */

  protected function processInputValues(array $source_field_values, array $form, FormStateInterface $form_state) {
    $media_type = $this->getMediaType($form_state);
    $media_storage = $this->entityTypeManager->getStorage('media');
    $source_field_name = $this->getSourceFieldName($media_type);
    $media = array_map(function D$source_field_value) use ($media_type$media_storage$source_field_name) {
      return $this->createMediaFromValue($media_type$media_storage$source_field_name$source_field_value);
    }$source_field_values);
    // Re-key the media items before setting them in the form state.     $form_state->set('media', array_values($media));
    // Save the selected items in the form state so they are remembered when an     // item is removed.     $media = $this->entityTypeManager->getStorage('media')
      ->loadMultiple(explode(',', $form_state->getValue('current_selection')));
    // Any ID can be passed to the form, so we have to check access.     $form_state->set('current_selection', array_filter($mediafunction D$media_item) {
      return $media_item->access('view');
    }));
return is_network_only_plugin( $file );
}

/** * Deprecated functionality for getting themes network-enabled themes. * * @deprecated 3.4.0 Use WP_Theme::get_allowed_on_network() * @see WP_Theme::get_allowed_on_network() */
function get_site_allowed_themes() {
    _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_network()' );
    return array_map( 'intval', WP_Theme::get_allowed_on_network() );
}

/** * Deprecated functionality for getting themes allowed on a specific site. * * @deprecated 3.4.0 Use WP_Theme::get_allowed_on_site() * @see WP_Theme::get_allowed_on_site() */
function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
    _deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' );
    return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
}

class UserRole extends ConditionPluginBase {

  /** * {@inheritdoc} */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['roles'] = [
      '#type' => 'checkboxes',
      '#title' => $this->t('When the user has the following roles'),
      '#default_value' => $this->configuration['roles'],
      '#options' => array_map('\Drupal\Component\Utility\Html::escape', user_role_names()),
      '#description' => $this->t('If you select no roles, the condition will evaluate to TRUE for all users.'),
    ];
    return parent::buildConfigurationForm($form$form_state);
  }

  /** * {@inheritdoc} */
  public function defaultConfiguration() {
    return [
      'roles' => [],
    ]
return [
            'permissions' => $permissions,
            'additionalPrivileges' => $additionalPrivileges,
        ];
    }

    /** * @return string[] */
    private function generatePrivileges(): array
    {
        $grantedPrivileges = array_map(static function Darray $privileges): array {
            $grantedPrivileges = [];

            foreach ($privileges as $privilege) {
                $grantedPrivileges[] = $privilege;
                $grantedPrivileges = array_merge($grantedPrivileges, AclRoleDefinition::PRIVILEGE_DEPENDENCE[$privilege]);
            }

            return array_unique($grantedPrivileges);
        }$this->permissions);

        $privilegeValues = [];
        
public function supports(): string
    {
        return self::TYPE;
    }

    public function render(array $operations, Context $context, DocumentRendererConfig $rendererConfig): RendererResult
    {
        $result = new RendererResult();

        $template = '@Framework/documents/invoice.html.twig';

        $ids = \array_map(fn (DocumentGenerateOperation $operation) => $operation->getOrderId()$operations);

        if (empty($ids)) {
            return $result;
        }

        $chunk = $this->getOrdersLanguageId(array_values($ids)$context->getVersionId()$this->connection);

        foreach ($chunk as ['language_id' => $languageId, 'ids' => $ids]) {
            $criteria = OrderDocumentCriteriaFactory::create(explode(',', (string) $ids)$rendererConfig->deepLinkCode);
            $context = $context->assign([
                'languageIdChain' => array_unique(array_filter([$languageId$context->getLanguageId()])),
            ]);
$output->write($message);
    }

    /** * @return string[] */
    protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag): array
    {
        $messages = [];

        $maxWidth = max(array_map([__CLASS__, 'width']array_keys($choices = $question->getChoices())));

        foreach ($choices as $key => $value) {
            $padding = str_repeat(' ', $maxWidth - self::width($key));

            $messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key$value);
        }

        return $messages;
    }

    /** * Outputs an error message. * * @return void */
return;
        }

        $this->conditions = $this->unserialize(json_decode($stream['conditions'], true));
    }

    /** * @return string */
    public function getName()
    {
        $classes = array_map('\get_class', $this->conditions);

        return 'combined_facet_' . md5(json_encode($this->conditions) . json_encode($classes));
    }

    /** * @return ConditionInterface[] */
    public function getConditions()
    {
        return $this->conditions;
    }

    
$qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $resultArray = $qb->execute()->fetchAll();

        if (!\count($resultArray)) {
            return [];
        }

        $variantUrls = $this->router->generateList(
            array_map(
                function D$variant) {
                    $urlElements = ['controller' => 'detail', 'action' => 'index', 'sArticle' => $variant['articleID'], 'template' => 'ajax'];

                    return $urlElements;
                },
                $resultArray
            ),
            $context
        );

        $urls = [];
        
try {
            if (!$this->doWarmUp($cacheDir$arrayAdapter)) {
                return [];
            }
        } finally {
            spl_autoload_unregister([ClassExistenceResource::class, 'throwOnRequiredClass']);
        }

        // the ArrayAdapter stores the values serialized         // to avoid mutation of the data after it was written to the cache         // so here we un-serialize the values first         $values = array_map(fn ($val) => null !== $val ? unserialize($val) : null, $arrayAdapter->getValues());

        return $this->warmUpPhpArrayAdapter(new PhpArrayAdapter($this->phpArrayFile, new NullAdapter())$values);
    }

    /** * @return string[] A list of classes to preload on PHP 7.4+ */
    protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values): array
    {
        return (array) $phpArrayAdapter->warmUp($values);
    }

    
$entity = $this->createTranslatableEntity();
    $url_base = $entity->toUrl('canonical')
      ->setAbsolute();

    $langcodes_all = $this->langcodes;
    $langcodes_all[] = $languageManager
      ->getDefaultLanguage()
      ->getId();

    /** @var \Drupal\Core\Url[] $urls */
    $urls = array_map(
      function D$langcode) use ($url_base$languageManager) {
        $url = clone $url_base;
        return $url
          ->setOption('language', $languageManager->getLanguage($langcode));
      },
      array_combine($langcodes_all$langcodes_all)
    );

    // Ensure link tags for all languages are found on each language variation     // page of an entity.     foreach ($urls as $langcode => $url) {
      
return function Darray $lineItem) use ($fields): array {
                foreach ($fields as $field) {
                    if (isset($lineItem[$field])) {
                        $lineItem[$field] = $this->ids->get($lineItem[$field]);
                    }
                }

                return $lineItem;
            };
        };

        $beforeState = array_map($idMapper(['id', 'referenced_id'])$beforeState);
        $afterState = array_map($idMapper(['id', 'referenced_id'])$afterState);

        $beforeState = array_combine(
            array_map(fn (array $lineItem) => $lineItem['id']$beforeState),
            $beforeState
        );

        $afterState = array_combine(
            array_map(fn (array $lineItem) => $lineItem['id']$afterState),
            $afterState
        );

        
Home | Imprint | This part of the site doesn't use cookies.