Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder;
6
7use Drupal\Component\Render\FormattableMarkup;
8use Drupal\display_builder\Plugin\Field\FieldType\HistoryStep;
9
10/**
11 * History interface.
12 *
13 * When you implement Undo and Redo, you want to keep track of the history
14 * of this state at different points in time.
15 *
16 * Inspired from https://redux.js.org/usage/implementing-undo-history
17 */
18interface HistoryInterface {
19
20  /**
21   * Get current step.
22   *
23   * @return \Drupal\display_builder\Plugin\Field\FieldType\HistoryStep|null
24   *   The current data.
25   */
26  public function getCurrent(): ?HistoryStep;
27
28  /**
29   * Get the state of the current step.
30   *
31   * @return array
32   *   The current state.
33   */
34  public function getCurrentState(): array;
35
36  /**
37   * Set a new present.
38   *
39   * @param array $state
40   *   The state to set.
41   * @param string|\Drupal\Component\Render\FormattableMarkup $log_message
42   *   (Optional) The log message.
43   * @param bool $check_hash
44   *   (Optional) Should check hash to avoid duplicates. Default to TRUE.
45   */
46  public function setNewPresent(array $state, FormattableMarkup|string $log_message = '', bool $check_hash = TRUE): void;
47
48  /**
49   * Get number of past logs.
50   *
51   * @return int
52   *   The number of past logs.
53   */
54  public function getCountPast(): int;
55
56  /**
57   * Get number of future logs.
58   *
59   * @return int
60   *   The number of future logs.
61   */
62  public function getCountFuture(): int;
63
64  /**
65   * Move history to the last past state.
66   */
67  public function undo(): void;
68
69  /**
70   * Move history to the first future state.
71   */
72  public function redo(): void;
73
74  /**
75   * Reset history to the current state.
76   */
77  public function clear(): void;
78
79}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.