@@ 49-61 (lines=13) @@ | ||
46 | * @param integer $value |
|
47 | * @return integer |
|
48 | */ |
|
49 | public function increment($id, $value = 1) |
|
50 | { |
|
51 | $id = $this->getPrefixedIdentifier($id); |
|
52 | $result = $value; |
|
53 | ||
54 | if ($this->callbacks['exists']($id)) { |
|
55 | $result = $this->callbacks['increment']($id, $value); |
|
56 | } else { |
|
57 | $this->doSaveScalar($value, $id); |
|
58 | } |
|
59 | ||
60 | return $result; |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * {@inheritdoc} |
|
@@ 70-82 (lines=13) @@ | ||
67 | * @param integer $value |
|
68 | * @return integer |
|
69 | */ |
|
70 | public function decrement($id, $value = 1) |
|
71 | { |
|
72 | $id = $this->getPrefixedIdentifier($id); |
|
73 | $result = -$value; |
|
74 | ||
75 | if ($this->callbacks['exists']($id)) { |
|
76 | $result = $this->callbacks['decrement']($id, $value); |
|
77 | } else { |
|
78 | $this->doSaveScalar($result, $id); |
|
79 | } |
|
80 | ||
81 | return $result; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * {@inheritdoc} |