SpaceService::findByKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of the Adlogix package.
4
 *
5
 * (c) Allan Segebarth <[email protected]>
6
 * (c) Jean-Jacques Courtens <[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 Adlogix\ConfluenceClient\Service;
13
14
use Adlogix\ConfluenceClient\Entity\Collection\SpaceCollection;
15
use Adlogix\ConfluenceClient\Entity\Space;
16
17
/**
18
 * Class SpaceService
19
 * @package Adlogix\ConfluenceClient\Service
20
 * @author  Cedric Michaux <[email protected]>
21
 */
22
class SpaceService extends AbstractApiService
23
{
24
25
    /**
26
     * @param array $options
27
     *
28
     * @return SpaceCollection|null
29
     */
30
    public function all(array $options = [])
31
    {
32
        $all = $this->get('space', $options);
33
34
        return $this->deserialize(
35
            $all,
36
            SpaceCollection::class
37
        );
38
    }
39
40
    /**
41
     * @param string $key
42
     * @param array  $options
43
     *
44
     * @return Space
45
     */
46
    public function findByKey($key, array $options = [])
47
    {
48
        $space = $this->get(sprintf('space/%s', $key), $options);
49
50
        return $this->deserialize(
51
            $space,
52
            Space::class
53
        );
54
    }
55
}
56