FOSSology  4.7.1
Open Source License Compliance by Open Source Software
PagedResult.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: Andreas Würl
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 namespace Fossology\Lib\View;
9 
10 
11 abstract class PagedResult
12 {
13  public $empty;
14 
15  const TARGET_CHARSET = "UTF-8";
16 
20  private $text;
21 
25  private $startOffset;
26 
30  private $currentOffset;
31 
32  public function __construct($startOffset)
33  {
34  $this->text = "";
35  $this->startOffset = $startOffset;
36  $this->currentOffset = $startOffset;
37  $this->empty = true;
38  }
39 
43  public function appendMetaText($text)
44  {
45  $this->text .= $text;
46  }
47 
51  public function appendContentText($text)
52  {
53  $this->empty = false;
54  $this->currentOffset += strlen($text);
55  $this->appendMetaText($this->renderContentText($text));
56  }
57 
61  public function getStartOffset()
62  {
63  return $this->startOffset;
64  }
65 
69  public function getCurrentOffset()
70  {
71  return $this->currentOffset;
72  }
73 
77  public function getText()
78  {
79  return $this->text;
80  }
81 
85  public function isEmpty()
86  {
87  return $this->empty;
88  }
89 
94  protected abstract function renderContentText($text);
95 }