private function setData(array $data = null)
    {
        if (null === $data || count($data) === 0) {
            $data = new \stdClass();
        }

        $this->data = $data;

        return $this;
    }
private function setData(array $data = null)
    {
        if (null === $data || count($data) === 0) {
            $data = new \stdClass();
        }

        $this->data = $data;

        return $this;
    }
private function setData ( array $ data = null ) { if ( null === $ data || count ( $ data ) === 0 ) { $ data = new \ stdClass ( ) ; } $ this -> data = $ data ; return $ this ; }
Sets data to the response.

If no datas provided, a stdClass if set,
so the serialized datas will be objects

@param array $datas

@return Result
Sets data to the response .