LocalDoc   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 18
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 2 1
A fixDocId() 0 3 2
1
<?php
2
3
/**
4
 * @file LocalDoc.php
5
 * @brief This file contains the LocalDoc class.
6
 * @details
7
 * @author Filippo F. Fadda
8
 */
9
10
11
namespace EoC\Doc;
12
13
14
/**
15
 * @brief Local document are not replicated and don't have attachments.
16
 * @details CouchDB uses local documents as replication checkpoints. You can use them to store, for example, local
17
 * configurations.\n
18
 * Inherit from LocalDoc if you want create a persistent class that is not replicable.
19
 * @nosubgrouping
20
 */
21
class LocalDoc extends AbstractDoc {
22
23
24
  /**
25
   * @brief Removes `_local/` from he document identifier.
26
   */
27
  protected function fixDocId() {
28
    if (isset($this->meta['_id']))
29
      $this->meta['_id'] = preg_replace('%\A_local/%m', "", $this->meta['_id']);
30
  }
31
32
33
  /**
34
   * @brief Gets the document path: `_local/`.
35
   * @return string
36
   */
37
  public function getPath() {
38
    return "_local/";
39
  }
40
41
}