getLevels example


  public function eventDetails($event_id) {
    $dblog = $this->database->query('SELECT [w].*, [u].[uid] FROM {watchdog} [w] LEFT JOIN {users} [u] ON [u].[uid] = [w].[uid] WHERE [w].[wid] = :id', [':id' => $event_id])->fetchObject();

    if (empty($dblog)) {
      throw new NotFoundHttpException();
    }

    $build = [];
    $severity = RfcLogLevel::getLevels();
    $message = $this->formatMessage($dblog);
    $username = [
      '#theme' => 'username',
      '#account' => $dblog->uid ? $this->userStorage->load($dblog->uid) : User::getAnonymousUser(),
    ];
    $rows = [
      [
        ['data' => $this->t('Type'), 'header' => TRUE],
        $this->t($dblog->type),
      ],
      [
        [
$coll->add('bar', new Route('/bar/{id}', []['id' => '\d+']));
        $coll->add('bar1', new Route('/bar/{name}', []['id' => '\w+'][], '', []['POST']));
        $coll->add('bar2', new Route('/foo', [][][], 'baz'));
        $coll->add('bar3', new Route('/foo1', [][][], 'baz'));
        $coll->add('bar4', new Route('/foo2', [][][], 'baz', [][], 'context.getMethod() == "GET"'));

        $context = new RequestContext();
        $context->setHost('baz');

        $matcher = new TraceableUrlMatcher($coll$context);
        $traces = $matcher->getTraces('/babar');
        $this->assertSame([0, 0, 0, 0, 0, 0]$this->getLevels($traces));

        $traces = $matcher->getTraces('/foo');
        $this->assertSame([1, 0, 0, 2]$this->getLevels($traces));

        $traces = $matcher->getTraces('/bar/12');
        $this->assertSame([0, 2]$this->getLevels($traces));

        $traces = $matcher->getTraces('/bar/dd');
        $this->assertSame([0, 1, 1, 0, 0, 0]$this->getLevels($traces));

        $traces = $matcher->getTraces('/foo1');
        
Home | Imprint | This part of the site doesn't use cookies.