V
V
Vladimir2018-09-24 09:38:36
PHP
Vladimir, 2018-09-24 09:38:36

How to access ["data:protected"]?

I work with the Yandex api library and get the following object:

spoiler
object(Yandex\Metrica\Stat\Models\ByTimeData)#31 (11) {
["totalRows":protected]=>
int(7)
["sampled":protected]=>
bool(false)
["sampleShare":protected]=>
float(1)
["sampleSize":protected]=>
int(6077)
["sampleSpace":protected]=>
int(6077)
["dataLag":protected]=>
int(76)
["query":protected]=>
object(Yandex\Metrica\Stat\Models\Query)#29 (16) {
["id":protected]=>
NULL
["ids":protected]=>
array(1) {
[0]=>
int(22870099)
}
["preset":protected]=>
NULL
["dimensions":protected]=>
array(0) {
}
["metrics":protected]=>
array(1) {
[0]=>
string(9) "ym:s:hits"
}
["sort":protected]=>
array(1) {
[0]=>
string(10) "-ym:s:hits"
}
["limit":protected]=>
NULL
["offset":protected]=>
NULL
["date1":protected]=>
string(10) "2018-09-18"
["date2":protected]=>
string(10) "2018-09-24"
["filters":protected]=>
NULL
["group":protected]=>
string(3) "day"
["autoGroupType":protected]=>
string(3) "day"
["autoGroupSize":protected]=>
string(1) "1"
["mappingClasses":protected]=>
array(0) {
}
["propNameMap":protected]=>
array(2) {
["auto_group_type"]=>
string(13) "autoGroupType"
["auto_group_size"]=>
string(13) "autoGroupSize"
}
}
["data":protected]=>
object(Yandex\Metrica\Stat\Models\Data)#36 (4) {
["collection":protected]=>
array(1) {
[0]=>
object(Yandex\Metrica\Stat\Models\Items)#34 (4) {
["dimensions":protected]=>
object(Yandex\Metrica\Stat\Models\Dimensions)#21 (4) {
["collection":protected]=>
array(0) {
}
["mappingClasses":protected]=>
array(0) {
}
["propNameMap":protected]=>
array(0) {
}
["innerCounter":protected]=>
int(-1)
}
["metrics":protected]=>
array(1) {
[0]=>
array(7) {
[0]=>
float(5034)
[1]=>
float(4699)
[2]=>
float(5724)
[3]=>
float(3852)
[4]=>
float(2871)
[5]=>
float(3596)
[6]=>
float(680)
}
}
["mappingClasses":protected]=>
array(1) {
["dimensions"]=>
string(37) "Yandex\Metrica\Stat\Models\Dimensions"
}
["propNameMap":protected]=>
array(0) {
}
}
}
["mappingClasses":protected]=>
array(0) {
}
["propNameMap":protected]=>
array(0) {
}
["innerCounter":protected]=>
int(-1)
}
["totals":protected]=>
array(1) {
[0]=>
array(1) {
[0]=>
float(26456)
}
}
["mappingClasses":protected]=>
array(2) {
["query"]=>
string(32) "Yandex\Metrica\Stat\Models\Query"
["data"]=>
string(31) "Yandex\Metrica\Stat\Models\Data"
}
["propNameMap":protected]=>
array(5) {
["total_rows"]=>
string(9) "totalRows"
["sample_share"]=>
string(11) "sampleShare"
["sample_size"]=>
string(10) "sampleSize"
["sample_space"]=>
string(11) "sampleSpace"
["data_lag"]=>
string(7) "dataLag"
}
}

The question is how can I access the [data:protected] array?!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-09-24
Khatter @mrKhatter

protected cannot be accessed directly from outside.
or see if the object has methods to access them (normal), or change visibility through reflection (hack).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question