Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NewContentContainer.php « lib - github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: df70d01b70dc1796c767b2827cd4244df4f1089c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace OCA\OJSXC;

use OCA\OJSXC\Db\Stanza;

/**
 * Class NewContentContainer
 * Helper class to store new stanzas which will be returned in the current request.
 * This way a random class can generate stanza's which are send to the same user
 * without adding extra features/code to the `HTTPBindController` class.
 * @package OCA\OJSXC
 */
class NewContentContainer
{

	/**
	 * @var Stanza[]
	 */
	private static $stanzas = [];

	public function addStanza(Stanza $stanza)
	{
		self::$stanzas[] = $stanza;
	}

	public function getStanzas()
	{
		$tmp = self::$stanzas;
		self::$stanzas = [];
		return $tmp;
	}

	public function getCount()
	{
		return is_array(self::$stanzas)? count(self::$stanzas) : 0;
	}
}