is_countable example

$time = 0;

        foreach ($this->data['requests'] ?? [] as $calledRequest) {
            $time += $calledRequest['time'];
        }

        return (int) ($time * 1000);
    }

    public function getRequestAmount(): int
    {
        return is_countable($this->data['requests']) ? \count($this->data['requests']) : 0;
    }

    /** * @return RequestInfo[] */
    public function getRequests(): array
    {
        return $this->data['requests'] ?? [];
    }

    /** * @return array{cluster_name: string, status: string, number_of_nodes: int} */
new RangeFilter('product.cheapestPrice.percentage', [
                            $operator => $percentage,
                        ])
                    );
                }

                $criteria->addSorting(new FieldSorting('product.cheapestPrice.percentage', $case['direction']));
                $criteria->addSorting(new FieldSorting('product.productNumber', $case['direction']));

                $result = $searcher->search($this->productDefinition, $criteria$context->getContext());

                static::assertCount(is_countable($case['ids']) ? \count($case['ids']) : 0, $result->getIds()sprintf('Case `%s` failed', $message));
                static::assertEquals(array_map(fn (string $id) => $ids->get($id)$case['ids'])$result->getIds()sprintf('Case `%s` failed', $message));
            }
        } catch (\Exception $e) {
            static::tearDown();

            throw $e;
        }
    }

    public function providerCheapestPricePercentageFilterAndSorting(): \Generator
    {
        
$factor
            );

            $originalCodeItem = $cart->getLineItems()->filter(function DLineItem $item) use ($code) {
                if ($item->getReferencedId() === $code) {
                    return $item;
                }

                return null;
            })->first();

            if ($originalCodeItem && (is_countable($originalCodeItem->getExtensions()) ? \count($originalCodeItem->getExtensions()) : 0) > 0) {
                $discountItem->setExtensions($originalCodeItem->getExtensions());
            }

            $lineItems[] = $discountItem;
        }

        return $lineItems;
    }

    /** * @return array<string> */


        if ($sliderItemsConfig->isDefault()) {
            foreach ($sliderItemsConfig->getArrayValue() as $sliderItem) {
                $this->addDefaultMediaToImageSlider($imageSlider$sliderItem);
            }
        }

        if ($sliderItemsConfig->isMapped() && $resolverContext instanceof EntityResolverContext) {
            $sliderItems = $this->resolveEntityValue($resolverContext->getEntity()$sliderItemsConfig->getStringValue());

            if ($sliderItems === null || (is_countable($sliderItems) ? \count($sliderItems) : 0) < 1) {
                return;
            }
            $this->sortItemsByPosition($sliderItems);

            if ($sliderItemsConfig->getStringValue() === 'product.media') {
                /** @var ProductEntity $productEntity */
                $productEntity = $resolverContext->getEntity();

                if ($productEntity->getCover()) {
                    /** @var ProductMediaCollection $sliderItems */
                    $sliderItems = new ProductMediaCollection(array_merge(
                        [
public function jsonSerialize(): array
    {
        $vars = get_object_vars($this);

        unset($vars['extensions']);
        foreach ($vars['relationships'] as $i => $_x) {
            unset($vars['relationships'][$i]['tmp']);
        }

        // if links are empty it should be decoded as empty object instead of empty array: https://jsonapi.org/format/#document-links         if ((is_countable($vars['links']) ? \count($vars['links']) : 0) === 0) {
            $vars['links'] = new \stdClass();
        }

        // if attributes are empty it should be decoded as empty object instead of empty array: https://jsonapi.org/format/#document-resource-object-attributes         if ((is_countable($vars['attributes']) ? \count($vars['attributes']) : 0) === 0) {
            $vars['attributes'] = new \stdClass();
        }

        return $vars;
    }

    

        $cart = $this->getCart();
        $result = $this->orderConverter->convertToOrder($cart$this->getSalesChannelContext(true)new OrderConversionContext());

        // unset uncheckable ids         unset($result['id']);
        unset($result['billingAddressId']);
        unset($result['deepLinkCode']);
        unset($result['orderDateTime']);
        unset($result['stateId']);
        unset($result['languageId']);
        for ($i = 0; $i < (is_countable($result['lineItems']) ? \count($result['lineItems']) : 0); ++$i) {
            unset($result['lineItems'][$i]['id']);
        }

        for ($i = 0; $i < (is_countable($result['addresses']) ? \count($result['addresses']) : 0); ++$i) {
            unset($result['addresses'][$i]['id']);
        }

        $expected = $this->getExpectedConvertToOrder();
        $expected['deliveries'] = [];

        $expectedJson = \json_encode($expected, \JSON_THROW_ON_ERROR);
        
 catch (\Throwable $exception) {
            if (!isset($data['expectedErrorClass'])) {
                throw $exception;
            }

            static::assertSame($data['expectedErrorClass']$exception::class);

            return;
        }

        $testCase = 'test case data: ' . var_export($data, true);
        static::assertSame(is_countable($data['expectedMappings']) ? \count($data['expectedMappings']) : 0, $guessedMapping->count()$testCase);

        foreach ($data['expectedMappings'] as $mappedKey => $key) {
            $mapping = $guessedMapping->getMapped($mappedKey);
            static::assertNotNull($mapping);

            static::assertSame($mappedKey$mapping->getMappedKey()$testCase);
            static::assertSame($key$mapping->getKey()$testCase);
        }

        if (file_exists($filePath)) {
            unlink($filePath);
        }
$modifiedLineItems = [];

            foreach ($lineItems as $lineItem) {
                $lineItem = $lineItem->jsonSerialize();

                $modifiedLineItems[] = $lineItem['quantity'] . 'x ' . $lineItem['productId'];
            }

            $entity['lineItems'] = implode('|', $modifiedLineItems);
        }

        if (isset($entity['deliveries']) && (is_countable($entity['deliveries']) ? \count($entity['deliveries']) : 0) > 0) {
            $entity['deliveries'] = $entity['deliveries']->first()->jsonSerialize();
            if (!empty($entity['deliveries']['trackingCodes'])) {
                $entity['deliveries']['trackingCodes'] = implode('|', $entity['deliveries']['trackingCodes']);
            }

            if (!empty($entity['deliveries']['shippingOrderAddress'])) {
                $entity['deliveries']['shippingOrderAddress'] = $entity['deliveries']['shippingOrderAddress']->jsonSerialize();
            }
        }

        yield from $entity;
    }
$duplicateColumnNamePrevention[$keyStructure['TABLE_NAME']] = 1;
            }
        }

        return $playbook;
    }

    private function createAddKeysPlaybookEntries(array $keyStructures, string $newColumnName, string $tableName): array
    {
        $playbook = [];
        foreach ($keyStructures as $keyStructure) {
            if ((is_countable($keyStructure['REFERENCED_COLUMN_NAME']) ? \count($keyStructure['REFERENCED_COLUMN_NAME']) : 0) < 2) {
                continue;
            }

            $keyColumns = $keyStructure['REFERENCED_COLUMN_NAME'];
            $keyColumns[] = $newColumnName;
            $uniqueName = implode('_', $keyColumns);

            $playbook[$uniqueName] = sprintf(self::ADD_KEY, $tableName$tableName$uniqueName$this->implodeColumns($keyColumns));
        }

        return array_values($playbook);
    }
<?php
//phpcs:disable VariableAnalysis // There are "undefined" variables here because they're defined in the code that includes this file as a template.
$submit_classes_attr = 'akismet-button';

if ( isset( $classes ) && ( is_countable( $classes ) ? count( $classes ) : 0 ) > 0 ) {
    $submit_classes_attr = implode( ' ', $classes );
}
?> <form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> <input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/> <button type="submit" class="<?php echo esc_attr( $submit_classes_attr ); ?>" value="<?php echo esc_attr( $text ); ?>"><?php echo esc_attr( $text ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'akismet' ) . '</span>'; ?></button> </form>
if (!isset($classes[Kernel::class])) {
            static::markTestSkipped('This test does not work if the root package is shopware/platform');
        }

        $entities = $this->getContainer()->get(DefinitionInstanceRegistry::class)
            ->getDefinitions();

        $aliases = array_keys($entities);
        $aliases = array_flip($aliases);

        $count = is_countable($aliases) ? \count($aliases) : 0;

        foreach ($classes as $class) {
            $parts = explode('\\', $class);
            if ($parts[0] !== 'Shopware') {
                continue;
            }

            $reflector = new \ReflectionClass($class);

            if (!$reflector->isSubclassOf(Struct::class)) {
                continue;
            }
public function testRequestWithNoParameters(): void
    {
        $this->browser
            ->request(
                'POST',
                '/store-api/account/address'
            );

        $response = \json_decode((string) $this->browser->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertArrayHasKey('errors', $response);
        static::assertGreaterThanOrEqual(1, is_countable($response['errors']) ? \count($response['errors']) : 0);
    }

    public function testUpdateExistingAddress(): void
    {
        // Fetch address         $this->browser
            ->request(
                'POST',
                '/store-api/account/customer'
            );

        
/** * Gets if line items have been found at all. */
    public function hasFoundItems(): bool
    {
        if (\count($this->results) <= 0) {
            return false;
        }

        foreach ($this->results as $groupResult) {
            if ((is_countable($groupResult['total']) ? \count($groupResult['total']) : 0) > 0) {
                return true;
            }
        }

        return false;
    }

    /** * Gets the count of found groups for the * provided group definition. */
    
if (!$child->isEmpty()) {
                return false;
            }
        }

        if (null !== $isEmptyCallback = $this->config->getIsEmptyCallback()) {
            return $isEmptyCallback($this->modelData);
        }

        return FormUtil::isEmpty($this->modelData)
            // arrays, countables             || (is_countable($this->modelData) && 0 === \count($this->modelData))
            // traversables that are not countable             || ($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
    }

    public function isValid(): bool
    {
        if (!$this->submitted) {
            throw new LogicException('Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() and ensure that it\'s true before calling Form::isValid().');
        }

        if ($this->isDisabled()) {
            


    private function restrictFilters(CmsSlotEntity $slot, Request $request): void
    {
        // setup the default behavior         $defaults = ['manufacturer-filter', 'rating-filter', 'shipping-free-filter', 'price-filter', 'property-filter'];

        $request->request->set(ProductListingFeaturesSubscriber::PROPERTY_GROUP_IDS_REQUEST_PARAM, null);

        $config = $slot->get('config');

        if (isset($config['propertyWhitelist']['value']) && (is_countable($config['propertyWhitelist']['value']) ? \count($config['propertyWhitelist']['value']) : 0) > 0) {
            $request->request->set(ProductListingFeaturesSubscriber::PROPERTY_GROUP_IDS_REQUEST_PARAM, $config['propertyWhitelist']['value']);
        }

        if (!isset($config['filters']['value'])) {
            return;
        }

        // apply config settings         $config = explode(',', (string) $config['filters']['value']);

        foreach ($defaults as $filter) {
            
Home | Imprint | This part of the site doesn't use cookies.