Completed
Push — master ( b7739e...2077f6 )
by
unknown
22s queued 10s
created

MeCollection::getCollectionsList()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of Phraseanet SDK.
5
 *
6
 * (c) Alchemy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhraseanetSDK\Repository;
13
14
use PhraseanetSDK\AbstractRepository;
15
use PhraseanetSDK\Exception\NotFoundException;
16
use PhraseanetSDK\Exception\RuntimeException;
17
use PhraseanetSDK\Exception\UnauthorizedException;
18
19
class MeCollection extends AbstractRepository
20
{
21
	/**
22
	 * Return all collections available
23
	 *
24
	 * @return MeCollection[]
25
	 * @throws NotFoundException
26
	 * @throws UnauthorizedException
27
	 */
28
	public function getCollectionsList()
29
	{
30
		$response = $this->query('GET', 'v1/me/collections/');
31
32
		if ($response->hasProperty(('collections')) !== true) {
33
			throw new RuntimeException('Missing "collections" property in response content');
34
		}
35
36
		return \PhraseanetSDK\Entity\MeCollection::fromList($response->getProperty('collections'));
37
	}
38
}
39