computeValue example

/** * Computes the values for an item list. */
  abstract protected function computeValue();

  /** * Ensures that values are only computed once. */
  protected function ensureComputedValue() {
    if ($this->valueComputed === FALSE) {
      $this->computeValue();
      $this->valueComputed = TRUE;
    }
  }

  /** * {@inheritdoc} */
  public function getValue() {
    $this->ensureComputedValue();
    return parent::getValue();
  }

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