Completed
Push — master ( c2be97...312fc5 )
by Stephen
02:08
created

Threads::__set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace StarCitizen\Models;
4
5
/**
6
 * Class Threads
7
 *
8
 * @package StarCitizen\Models
9
 * @method bool|Thread __get($name) magic method. Returns a thread if the id is set
10
 * @method bool|Thread offsetGet($offset) Returns a thread if the id is set
11
 */
12 View Code Duplication
class Threads extends Store
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * Threads constructor.
16
     *
17
     * @param $threadsData
18
     */
19
    public function __construct($threadsData)
20
    {
21
        foreach ($threadsData as $thread) {
22
            $this->offsetSet($thread['thread_id'], new Thread($thread));
23
        }
24
    }
25
26
    public function offsetSet($offset, $value)
27
    {
28
        if ($value instanceof Thread)
29
            parent::offsetSet($offset, $value);
30
    }
31
}