list example


    function _diag ($xoff$xlim$yoff$ylim$nchunks)
    {
        $flip = false;

        if ($xlim - $xoff > $ylim - $yoff) {
            /* Things seems faster (I'm not sure I understand why) when the * shortest sequence is in X. */
            $flip = true;
            list ($xoff$xlim$yoff$ylim)
                = array($yoff$ylim$xoff$xlim);
        }

        if ($flip) {
            for ($i = $ylim - 1; $i >= $yoff$i--) {
                $ymatches[$this->xv[$i]][] = $i;
            }
        } else {
            for ($i = $ylim - 1; $i >= $yoff$i--) {
                $ymatches[$this->yv[$i]][] = $i;
            }
        }
$plain = "plain\ntext";

        $vault->seal('foo', $plain);

        unset($_SERVER['foo']$_ENV['foo']);
        (new Dotenv())->load($this->envFile);

        $decrypted = $vault->reveal('foo');
        $this->assertSame($plain$decrypted);

        $this->assertSame(['foo' => null]array_intersect_key($vault->list()['foo' => 123]));
        $this->assertSame(['foo' => $plain]array_intersect_key($vault->list(true)['foo' => 123]));

        $this->assertTrue($vault->remove('foo'));
        $this->assertFalse($vault->remove('foo'));

        unset($_SERVER['foo']$_ENV['foo']);
        (new Dotenv())->load($this->envFile);

        $this->assertArrayNotHasKey('foo', $vault->list());
    }
}
return true;
    }

    public function seal(string $name, string $value): void
    {
        $this->lastMessage = null;
        $this->validateName($name);
        $this->loadKeys();
        $filename = $this->getFilename($name);
        $this->export($filenamesodium_crypto_box_seal($value$this->encryptionKey ?? sodium_crypto_box_publickey($this->decryptionKey)));

        $list = $this->list();
        $list[$name] = null;
        uksort($list, 'strnatcmp');
        file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list)), \LOCK_EX);

        $this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name$this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
    }

    public function reveal(string $name): ?string
    {
        $this->lastMessage = null;
        $this->validateName($name);

        
static::assertEquals(16, $this->storage->preview($config));
        static::assertEquals(16, $this->storage->preview($config));
    }

    public function testSetAndList(): void
    {
        $states = [
            Uuid::randomHex() => 10,
            Uuid::randomHex() => 5,
        ];

        static::assertEmpty($this->storage->list());

        foreach ($states as $id => $value) {
            $this->storage->set($id$value);
        }

        static::assertEquals($states$this->storage->list());
    }
}
return $this->_column_headers;
    }

    /** * Returns the number of visible columns. * * @since 3.1.0 * * @return int */
    public function get_column_count() {
        list ( $columns$hidden ) = $this->get_column_info();
        $hidden                    = array_intersect( array_keys( $columns )array_filter( $hidden ) );
        return count( $columns ) - count( $hidden );
    }

    /** * Prints column headers, accounting for hidden and sortable columns. * * @since 3.1.0 * * @param bool $with_id Whether to set the ID attribute or not */
    

    public static function getAllCapabilities(TeraWurfl $wurflObj)
    {

        foreach ($wurflObj->capabilities as $group) {
            if (!is_array($group)) {
                continue;
            }
            while (list ($key$value) = each($group)) {
                if (is_bool($value)) {
                    // to have the same type than the official WURFL API                     $features[$key] = ($value ? 'true' : 'false');
                } else {
                    $features[$key] = $value;
                }
            }
        }
        return $features;
    }
}
json_encode($data, \JSON_THROW_ON_ERROR)
        );

        $exists = $this->connection->fetchAllAssociative(
            'SELECT * FROM product WHERE id IN(:id)',
            ['id' => [Uuid::fromHexToBytes($product)]],
            ['id' => ArrayParameterType::STRING]
        );

        static::assertNotEmpty($exists);

        $messages = $this->gateway->list('message_queue_stats');

        static::assertNotEmpty($messages);
        static::assertNotEmpty($messages[ProductIndexingMessage::class]);
        static::assertEquals(1, $messages[ProductIndexingMessage::class]['count']);
    }

    public function testDirectIndexing(): void
    {
        $product = Uuid::randomHex();

        $data = [
            [
/** @var list<string> $numberRangeIds */
        $numberRangeIds = $this->numberRangeRepository->searchIds(new Criteria(), Context::createDefaultContext())->getIds();

        $keys = array_map(fn (string $id) => [$this->getKey($id)]$numberRangeIds);
        $this->redisMock->expects(static::exactly(\count($keys)))
            ->method('get')
            ->willReturnOnConsecutiveCalls(10, 5, false);

        static::assertEquals([
            $numberRangeIds[0] => 10,
            $numberRangeIds[1] => 5,
        ]$this->storage->list());
    }

    public function testSet(): void
    {
        $configId = Uuid::randomHex();

        $this->redisMock->expects(static::once())
            ->method('set')
            ->with($this->getKey($configId), 10);

        $this->storage->set($configId, 10);
    }
private ArrayIncrementer $arrayIncrementer;

    protected function setUp(): void
    {
        $this->arrayIncrementer = new ArrayIncrementer();
        $this->arrayIncrementer->setPool('user-activity-pool');
    }

    public function testDecrementDoesNotCreate(): void
    {
        $this->arrayIncrementer->decrement('test', 'test');
        static::assertEmpty($this->arrayIncrementer->list('test'));
    }

    public function testIncrement(): void
    {
        $this->arrayIncrementer->increment('test-user-1', 'sw.product.index');

        $list = $this->arrayIncrementer->list('test-user-1');

        static::assertNotNull($list['sw.product.index']);
        static::assertEquals(1, $list['sw.product.index']['count']);

        
$block_types = $this->block_registry->get_all_registered();

        // Retrieve the list of registered collection query parameters.         $registered = $this->get_collection_params();
        $namespace  = '';
        if ( isset( $registered['namespace'] ) && ! empty( $request['namespace'] ) ) {
            $namespace = $request['namespace'];
        }

        foreach ( $block_types as $slug => $obj ) {
            if ( $namespace ) {
                list ( $block_namespace ) = explode( '/', $obj->name );

                if ( $namespace !== $block_namespace ) {
                    continue;
                }
            }
            $block_type = $this->prepare_item_for_response( $obj$request );
            $data[]     = $this->prepare_response_for_collection( $block_type );
        }

        return rest_ensure_response( $data );
    }

    
throw new IncrementStorageNotFoundException($storagearray_keys($this->storages));
        }

        return $this->storages[$storage];
    }

    public function migrate(string $from, string $to): void
    {
        $fromStorage = $this->getStorage($from);
        $toStorage = $this->getStorage($to);

        foreach ($fromStorage->list() as $numberRangeId => $state) {
            $toStorage->set($numberRangeId$state);
        }
    }
}
#[Route(path: '/api/_info/queue.json', name: 'api.info.queue', methods: ['GET'])]     public function queue(): JsonResponse
    {
        try {
            $gateway = $this->incrementGatewayRegistry->get(IncrementGatewayRegistry::MESSAGE_QUEUE_POOL);
        } catch (IncrementGatewayNotFoundException) {
            // In case message_queue pool is disabled             return new JsonResponse([]);
        }

        // Fetch unlimited message_queue_stats         $entries = $gateway->list('message_queue_stats', -1);

        return new JsonResponse(array_map(fn (array $entry) => [
            'name' => $entry['key'],
            'size' => (int) $entry['count'],
        ]array_values($entries)));
    }

    #[Route(path: '/api/_info/open-api-schema.json', defaults: ['auth_required' => '%shopware.api.api_browser.auth_required_str%'], name: 'api.info.open-api-schema', methods: ['GET'])]     public function openApiSchema(): JsonResponse
    {
        $data = $this->definitionService->getSchema(OpenApi3Generator::FORMAT, DefinitionService::API);

        
#[Route(path: '/api/_action/increment/{pool}', name: 'api.increment.list', methods: ['GET'])]     public function getIncrement(string $pool, Request $request): Response
    {
        $cluster = $this->getCluster($request);

        $poolGateway = $this->gatewayRegistry->get($pool);

        $limit = $request->query->getInt('limit', 5);
        $offset = $request->query->getInt('offset', 0);

        $result = $poolGateway->list($cluster$limit$offset);

        return new JsonResponse($result);
    }

    #[Route(path: '/api/_action/reset-increment/{pool}', name: 'api.increment.reset', methods: ['POST'])]     public function reset(string $pool, Request $request): Response
    {
        $cluster = $this->getCluster($request);
        $poolGateway = $this->gatewayRegistry->get($pool);

        $key = $request->request->get('key');

        


        return 0;
    }

    public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
    {
        if (!$input->mustSuggestArgumentValuesFor('name')) {
            return;
        }

        $vaultKeys = array_keys($this->vault->list(false));
        if ($input->getOption('local')) {
            if (null === $this->localVault) {
                return;
            }
            $vaultKeys = array_intersect($vaultKeysarray_keys($this->localVault->list(false)));
        }

        $suggestions->suggestValues($vaultKeys);
    }
}
$pool->reset('message_queue_stats');

        /** @var MessageBusInterface $bus */
        $bus = $this->getContainer()->get('messenger.bus.test_shopware');

        $bus->dispatch(new FooMessage());
        $bus->dispatch(new BarMessage());
        $bus->dispatch(new BarMessage());
        $bus->dispatch(new BarMessage());

        $stats = $pool->list('message_queue_stats');
        static::assertEquals(1, $stats[FooMessage::class]['count']);
        static::assertEquals(3, $stats[BarMessage::class]['count']);

        $this->runWorker();

        $stats = $pool->list('message_queue_stats');
        static::assertEquals(0, $stats[FooMessage::class]['count']);
        static::assertEquals(0, $stats[BarMessage::class]['count']);

        $bus->dispatch(new NoHandlerMessage());

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