| @@ 111-131 (lines=21) @@ | ||
| 108 | /** |
|
| 109 | * @param Url $url |
|
| 110 | */ |
|
| 111 | public function push(Url $url) |
|
| 112 | { |
|
| 113 | if (!$this->state->isReady()) { |
|
| 114 | throw StreamStateException::notReady(); |
|
| 115 | } |
|
| 116 | ||
| 117 | if ($this->counter >= self::LINKS_LIMIT) { |
|
| 118 | throw LinksOverflowException::withLimit(self::LINKS_LIMIT); |
|
| 119 | } |
|
| 120 | ||
| 121 | $render_url = $this->render->url($url); |
|
| 122 | ||
| 123 | $this->write($render_url); |
|
| 124 | ++$this->counter; |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * @return int |
|
| 129 | */ |
|
| 130 | public function count() |
|
| 131 | { |
|
| 132 | return $this->counter; |
|
| 133 | } |
|
| 134 | ||
| @@ 122-142 (lines=21) @@ | ||
| 119 | /** |
|
| 120 | * @param Url $url |
|
| 121 | */ |
|
| 122 | public function push(Url $url) |
|
| 123 | { |
|
| 124 | if (!$this->state->isReady()) { |
|
| 125 | throw StreamStateException::notReady(); |
|
| 126 | } |
|
| 127 | ||
| 128 | if ($this->counter >= self::LINKS_LIMIT) { |
|
| 129 | throw LinksOverflowException::withLimit(self::LINKS_LIMIT); |
|
| 130 | } |
|
| 131 | ||
| 132 | $render_url = $this->render->url($url); |
|
| 133 | ||
| 134 | $this->write($render_url); |
|
| 135 | ++$this->counter; |
|
| 136 | } |
|
| 137 | ||
| 138 | /** |
|
| 139 | * @return int |
|
| 140 | */ |
|
| 141 | public function count() |
|
| 142 | { |
|
| 143 | return $this->counter; |
|
| 144 | } |
|
| 145 | ||