Completed
Push — master ( 0cb84b...609616 )
by Maciej
07:36 queued 01:06
created

Entity::setSecure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
/**
3
 * Created by Maciej Paprocki for Bureau-VA.
4
 * Date: 17/02/2016
5
 * Project Name: MaciekPaprocki\WordpressGuzzle
6
 * Time: 11:27.
7
 */
8
namespace BureauVa\WordpressGuzzle\Entity;
9
10
/**
11
 * Class Entity.
12
 */
13
abstract class Entity implements \ArrayAccess
14
{
15
    protected $internaleCounter = 0;
16
17
    /**
18
     * @param $offset
19
     * @param $value
20
     */
21
    public function offsetSet($offset, $value)
22
    {
23
        if (is_null($offset)) {
24
            $this->{$this->internaleCounter} = $value;
25
            ++$this->internaleCounter;
26
        } else {
27
            $this->{$offset} = $value;
28
        }
29
    }
30
31
    /**
32
     * @param $offset
33
     *
34
     * @return bool
35
     */
36
    public function offsetExists($offset)
37
    {
38
        return isset($this->{$offset});
39
    }
40
41
    /**
42
     * @param $offset
43
     */
44
    public function offsetUnset($offset)
45
    {
46
        unset($this->{$offset});
47
    }
48
49
    /**
50
     * @param $offset
51
     */
52
    public function offsetGet($offset)
53
    {
54
        return isset($this->{$offset}) ? $this->{$offset} : null;
55
    }
56
}
57