Completed
Push — master ( 245fbf...00e192 )
by Adeniyi
04:40 queued 02:23
created

src/Helper/GetData.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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 all()
17
    {
18
        return json_encode($this->value);
19
    }
20
21
    public function getData($name)
22
    {
23
        foreach (json_decode($this->all()) as $key) {
24
             return $key->$name;
25
        }
26
   }
27
28
   public function getCount()
29
   {
30
        return sizeof($this->value);
31
   }
32
}