PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 148
Lasso Lite – Affiliate Link Manager & Product Displays v148
157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 116 All 56 releases
simple-urls / libs / Raven / TransactionStack.php

TransactionStack.php in Lasso Lite – Affiliate Link Manager & Product Displays 148, at libs/Raven/TransactionStack.php

55 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * This file is part of Raven.
4 *
5 * (c) Sentry Team
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 class Raven_TransactionStack
12 {
13 public function __construct()
14 {
15 $this->stack = array();
16 }
17
18 public function clear()
19 {
20 $this->stack = array();
21 }
22
23 public function peek()
24 {
25 $len = count($this->stack);
26 if ($len === 0) {
27 return null;
28 }
29 return $this->stack[$len - 1];
30 }
31
32 public function push($context)
33 {
34 $this->stack[] = $context;
35 }
36
37 /** @noinspection PhpInconsistentReturnPointsInspection
38 * @param string|null $context
39 * @return mixed
40 */
41 public function pop($context = null)
42 {
43 if (!$context) {
44 return array_pop($this->stack);
45 }
46 while (!empty($this->stack)) {
47 if (array_pop($this->stack) === $context) {
48 return $context;
49 }
50 }
51 // @codeCoverageIgnoreStart
52 }
53 // @codeCoverageIgnoreEnd
54 }
55