1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @file DocRef.php |
||
5 | * @brief This file contains the DocRef class. |
||
6 | * @details |
||
7 | * @author Filippo F. Fadda |
||
8 | */ |
||
9 | |||
10 | |||
11 | namespace EoC\Doc; |
||
12 | |||
13 | |||
14 | use Meta\Extension; |
||
15 | |||
16 | |||
17 | /** |
||
18 | * @brief This class represent a document reference and it's used in Couch::purgeDocs() method. |
||
19 | * @details Instead to provide a full document, Couch.purgeDocs() accepts an array of DocRef. Every DocRef has an ID and |
||
20 | * a list of revisions you can add calling addRev(). |
||
21 | */ |
||
22 | final class DocRefsArray { |
||
23 | use Extension\TProperty; |
||
24 | |||
25 | private $id; |
||
26 | private $revs; |
||
27 | |||
28 | |||
29 | /** |
||
30 | * @brief Adds a document revision reference. |
||
31 | * @param string $value A document revision. |
||
32 | */ |
||
33 | public function addRev($value) { |
||
34 | $this->revs[] = $value; |
||
35 | } |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @brief Returns a document reference. |
||
40 | * @retval array An associative array |
||
41 | */ |
||
42 | public function asArray() { |
||
43 | $ref = []; |
||
44 | $ref[$this->id] = $this->revs; |
||
45 | return $ref; |
||
46 | } |
||
47 | |||
48 | |||
49 | //! @cond HIDDEN_SYMBOLS |
||
50 | |||
51 | public function getId() { |
||
52 | return $this->id; |
||
53 | } |
||
54 | |||
55 | |||
56 | public function issetId() { |
||
57 | return isset($this->id); |
||
58 | } |
||
59 | |||
60 | |||
61 | public function setId($value) { |
||
62 | if (!empty($value)) |
||
63 | $this->id = (string)$value; |
||
64 | else |
||
65 | throw new \Exception("\$id must be a non-empty string."); |
||
66 | } |
||
67 | |||
68 | |||
69 | public function unsetId() { |
||
70 | unset($this->id); |
||
71 | } |
||
72 | |||
73 | //! @endcond |
||
0 ignored issues
–
show
|
|||
74 | |||
75 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.