Completed
Push — master ( c332a7...d97910 )
by Adeniyi
07:05 queued 02:31
created

GetData::toArray()   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 0
1
<?php
2
3
namespace Ibonly\PotatoORM;
4
5
use Ibonly\PotatoORM\GetDataInterface;
6
7
class GetData implements GetDataInterface
8
{
9
    protected $value;
10
11
    function __construct($value)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
12
    {
13
        $this->value = $value;
14
    }
15
16
    public function toArray()
17
    {
18
        return $this->value;
19
    }
20
21
    public function toJson()
22
    {
23
        return json_encode($this->value);
24
    }
25
26
    public function getData($name)
27
    {
28
        foreach (json_decode($this->all()) as $key) {
0 ignored issues
show
Bug introduced by
The method all() does not seem to exist on object<Ibonly\PotatoORM\GetData>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
            return $key->$name;
30
        }
31
   }
32
33
   public function getCount()
34
   {
35
        return sizeof($this->value);
36
   }
37
}