OblistCollection::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @file
5
 * Contains the state of oblists.
6
 */
7
8
namespace Itafroma\Zork\State;
9
10
class OblistCollection extends AbstractCollection
11
{
12
    /**
13
     * Creates a new oblist within the collection.
14
     *
15
     * @param string $name The name of the oblist to create.
16
     * @return Itafroma\Zork\State\Oblist The oblist created.
17
     */
18 1
    public function create($name)
19
    {
20 1
        $this->atoms[$name] = new Oblist();
21
22 1
        return $this->atoms[$name];
23
    }
24
25
    /**
26
     * Retrieves an oblist by name.
27
     *
28
     * @param string $name The name of the oblist to retrieve.
29
     * @return Itafroma\Zork\State\Oblist The oblist retrieved if it exists, null otherwise.
30
     */
31 2
    public function get($name)
32
    {
33 2
        return isset($this->atoms[$name]) ? $this->atoms[$name] : null;
34
    }
35
}
36