close example

public function close(): bool
    {
        if (isset($this->redis)) {
            try {
                $pingReply = $this->redis->ping();

                if (($pingReply === true) || ($pingReply === '+PONG')) {
                    if (isset($this->lockKey)) {
                        $this->redis->del($this->lockKey);
                    }

                    if ($this->redis->close()) {
                        return false;
                    }
                }
            } catch (RedisException $e) {
                $this->logger->error('Session: Got RedisException on close(): ' . $e->getMessage());
            }

            $this->redis = null;

            return true;
        }

        
->with('path', 'name')->willReturn(true);

        $marshallingSessionHandler->open('path', 'name');
    }

    public function testClose()
    {
        $marshallingSessionHandler = new MarshallingSessionHandler($this->handler, $this->marshaller);

        $this->handler->expects($this->once())->method('close')->willReturn(true);

        $this->assertTrue($marshallingSessionHandler->close());
    }

    public function testDestroy()
    {
        $marshallingSessionHandler = new MarshallingSessionHandler($this->handler, $this->marshaller);

        $this->handler->expects($this->once())->method('destroy')
            ->with('session_id')->willReturn(true);

        $marshallingSessionHandler->destroy('session_id');
    }

    
 catch (PluginExtractionException $e) {
            throw PluginException::noPluginFoundInZip($zipFilePath);
        }

        try {
            return match (true) {
                $this->isPlugin($archive) => PluginManagementService::PLUGIN,
                $this->isApp($archive) => PluginManagementService::APP,
                default => throw PluginException::noPluginFoundInZip($zipFilePath)
            };
        } finally {
            $archive->close();
        }
    }

    public function isPlugin(\ZipArchive $archive): bool
    {
        $entry = $archive->statIndex(0);
        if ($entry === false) {
            return false;
        }

        $pluginName = explode('/', (string) $entry['name'])[0];
        
call_user_func($callback$path);
    }
    if (is_dir($path)) {
      $dir = dir($path);
      while (($entry = $dir->read()) !== FALSE) {
        if ($entry == '.' || $entry == '..') {
          continue;
        }
        $entry_path = $path . '/' . $entry;
        $this->fileUnmanagedDeleteRecursive($entry_path$callback);
      }
      $dir->close();

      return rmdir($path);
    }
    return unlink($path);
  }

}
$zip = new ZipArchive();
    if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
        if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
            $error = __( 'Unable to archive the personal data export file (JSON format).' );
        }

        if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) {
            $error = __( 'Unable to archive the personal data export file (HTML format).' );
        }

        $zip->close();

        if ( ! $error ) {
            /** * Fires right after all personal data has been written to the export file. * * @since 4.9.6 * @since 5.4.0 Added the `$json_report_pathname` parameter. * * @param string $archive_pathname The full path to the export file on the filesystem. * @param string $archive_url The URL of the archive file. * @param string $html_report_pathname The full path to the HTML personal data report on the filesystem. * @param int $request_id The export request ID. * @param string $json_report_pathname The full path to the JSON personal data report on the filesystem. */
if ($throw) {
            $this->checkStatusCode();
        }

        return $this->headers;
    }

    public function cancel(): void
    {
        $this->info['canceled'] = true;
        $this->info['error'] = 'Response has been canceled.';
        $this->close();
    }

    /** * Closes the response and all its network handles. */
    protected function close(): void
    {
        $this->canary->cancel();
        $this->inflate = null;
    }

    

    public function getEntry($position)
    {
        return $this->stream->statIndex($position);
    }

    /** * @return bool */
    public function close()
    {
        return $this->stream->close();
    }

    /** * Give a meaningful error message to the user. * * @param int $retval * @param string $file * * @return string */
    protected function getErrorMessage($retval$file)
    {
$this->assertInstanceOf(AbstractSessionHandler::class$proxy);
        $this->assertTrue($proxy->open('path', 'name'));
    }

    public function testCloseSession()
    {
        $handler = $this->createMock(\SessionHandlerInterface::class);
        $handler->expects($this->once())->method('close')
            ->willReturn(true);
        $proxy = new StrictSessionHandler($handler);

        $this->assertTrue($proxy->close());
    }

    public function testValidateIdOK()
    {
        $handler = $this->createMock(\SessionHandlerInterface::class);
        $handler->expects($this->once())->method('read')
            ->with('id')->willReturn('data');
        $proxy = new StrictSessionHandler($handler);

        $this->assertTrue($proxy->validateId('id'));
    }

    
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->connect(...\func_get_args());
    }

    public function pconnect($host$port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, #[\SensitiveParameter] $context = [], $database = 0): bool     {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pconnect(...\func_get_args());
    }

    public function close(): bool
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args());
    }

    public function pclose(): bool
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pclose(...\func_get_args());
    }

    public function listen($callback): bool
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->listen(...\func_get_args());
    }

    

        throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
    }

    public function __wakeup()
    {
        throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
    }

    public function __destruct()
    {
        $this->close();
    }

    public function getDescriptors(): array
    {
        if (!$this->haveReadSupport) {
            $nullstream = fopen('/dev/null', 'c');

            return [
                ['pipe', 'r'],
                $nullstream,
                $nullstream,
            ];
$this->assertNotContains("NOOP\r\n", $stream->getCommands());
    }

    public function testSendPingAfterTransportException()
    {
        $stream = new DummyStream();
        $envelope = new Envelope(new Address('sender@example.org')[new Address('recipient@example.org')]);

        $transport = new SmtpTransport($stream);
        $transport->send(new RawMessage('Message 1')$envelope);
        $stream->close();
        $catch = false;

        try {
            $transport->send(new RawMessage('Message 2')$envelope);
        } catch (TransportException $exception) {
            $catch = true;
        }
        $this->assertTrue($catch);
        $this->assertTrue($stream->isClosed());

        $transport->send(new RawMessage('Message 3')$envelope);

        


    if (is_dir($path)) {
      $dir = dir($path);
      while (($entry = $dir->read()) !== FALSE) {
        if ($entry == '.' || $entry == '..') {
          continue;
        }
        $entry_path = $path . '/' . $entry;
        $this->deleteRecursive($entry_path$callback);
      }
      $dir->close();

      return $this->rmdir($path);
    }

    return $this->delete($path);
  }

  /** * {@inheritdoc} */
  public function move($source$destination$replace = self::EXISTS_RENAME) {
    

class DoctrineCloseConnectionMiddleware extends AbstractDoctrineMiddleware
{
    protected function handleForManager(EntityManagerInterface $entityManager, Envelope $envelope, StackInterface $stack): Envelope
    {
        try {
            $connection = $entityManager->getConnection();

            return $stack->next()->handle($envelope$stack);
        } finally {
            if (null !== $envelope->last(ConsumedByWorkerStamp::class)) {
                $connection->close();
            }
        }
    }
}


    protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool     {
        $this->doDestroy = false;

        return $this->handler->destroy($sessionId);
    }

    public function close(): bool
    {
        return $this->handler->close();
    }

    public function gc(int $maxlifetime): int|false
    {
        return $this->handler->gc($maxlifetime);
    }
}

    public function getEntry($position)
    {
        return $this->stream->statIndex($position);
    }

    /** * @return bool */
    public function close()
    {
        return $this->stream->close();
    }

    /** * Give a meaningful error message to the user. * * @param int $retval * @param string $file * * @return string */
    protected function getErrorMessage($retval$file)
    {
Home | Imprint | This part of the site doesn't use cookies.