-1

I am using php-xapi/client library to get all the statements stored in LRS.

Code:

$results = $statementsApiClient->getStatements();

Document link:

https://github.com/php-xapi/client/blob/master/doc/statements.md

It returns the StatementResult object. But I'm not able to access it's private properties. Nothing is mentioned in their document.

Below is the output:

Xabbuh\XApi\Model\StatementResult Object
(
    [statements:Xabbuh\XApi\Model\StatementResult:private] => Array
        (
            [0] => Xabbuh\XApi\Model\Statement Object
                (
                    [id:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\StatementId Object
                        (
                            [uuid:Xabbuh\XApi\Model\StatementId:private] => Rhumsaa\Uuid\Uuid Object
                                (
                                    [fields:protected] => Array
                                        (
                                            [time_low] => e994a27f
                                            [time_mid] => cbfe
                                            [time_hi_and_version] => 4272
                                            [clock_seq_hi_and_reserved] => bf
                                            [clock_seq_low] => d7
                                            [node] => 147d334723b3
                                        )

                                )

                        )

                    [verb:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Verb Object
                        (
                            [id:Xabbuh\XApi\Model\Verb:private] => Xabbuh\XApi\Model\IRI Object
                                (
                                    [value:Xabbuh\XApi\Model\IRI:private] => http://adlnet.gov/expapi/verbs/experienced
                                )

                            [display:Xabbuh\XApi\Model\Verb:private] => Xabbuh\XApi\Model\LanguageMap Object
                                (
                                    [map:Xabbuh\XApi\Model\LanguageMap:private] => Array
                                        (
                                            [en-US] => experienced
                                        )

                                )

                        )

                    [actor:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Agent Object
                        (
                            [iri:Xabbuh\XApi\Model\Actor:private] => Xabbuh\XApi\Model\InverseFunctionalIdentifier Object
                                (
                                    [mbox:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => Xabbuh\XApi\Model\IRI Object
                                        (
                                            [value:Xabbuh\XApi\Model\IRI:private] => mailto:cwaghmare@xento.com
                                        )

                                    [mboxSha1Sum:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                    [openId:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                    [account:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                )

                            [name:Xabbuh\XApi\Model\Actor:private] => Chinmay
                        )

                    [object:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Activity Object
                        (
                            [id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
                                (
                                    [value:Xabbuh\XApi\Model\IRI:private] => http:///68DFljpCPci
                                )

                            [definition:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\Definition Object
                                (
                                    [name:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\LanguageMap Object
                                        (
                                            [map:Xabbuh\XApi\Model\LanguageMap:private] => Array
                                                (
                                                    [und] => Video Slide 1
                                                )

                                        )

                                    [description:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\LanguageMap Object
                                        (
                                            [map:Xabbuh\XApi\Model\LanguageMap:private] => Array
                                                (
                                                    [und] => Video Slide 1
                                                )

                                        )

                                    [type:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\IRI Object
                                        (
                                            [value:Xabbuh\XApi\Model\IRI:private] => http://adlnet.gov/expapi/activities/module
                                        )

                                    [moreInfo:Xabbuh\XApi\Model\Definition:private] => 
                                    [extensions:Xabbuh\XApi\Model\Definition:private] => 
                                )

                        )

                    [result:Xabbuh\XApi\Model\Statement:private] => 
                    [authority:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Agent Object
                        (
                            [iri:Xabbuh\XApi\Model\Actor:private] => Xabbuh\XApi\Model\InverseFunctionalIdentifier Object
                                (
                                    [mbox:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => Xabbuh\XApi\Model\IRI Object
                                        (
                                            [value:Xabbuh\XApi\Model\IRI:private] => mailto:hello@learninglocker.net
                                        )

                                    [mboxSha1Sum:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                    [openId:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                    [account:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => 
                                )

                            [name:Xabbuh\XApi\Model\Actor:private] => New Client
                        )

                    [created:Xabbuh\XApi\Model\Statement:private] => DateTime Object
                        (
                            [date] => 2018-04-11 06:46:15.231000
                            [timezone_type] => 2
                            [timezone] => Z
                        )

                    [stored:Xabbuh\XApi\Model\Statement:private] => DateTime Object
                        (
                            [date] => 2018-04-11 06:46:14.746000
                            [timezone_type] => 2
                            [timezone] => Z
                        )

                    [context:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Context Object
                        (
                            [registration:Xabbuh\XApi\Model\Context:private] => 
                            [instructor:Xabbuh\XApi\Model\Context:private] => 
                            [team:Xabbuh\XApi\Model\Context:private] => 
                            [contextActivities:Xabbuh\XApi\Model\Context:private] => Xabbuh\XApi\Model\ContextActivities Object
                                (
                                    [parentActivities:Xabbuh\XApi\Model\ContextActivities:private] => Array
                                        (
                                            [0] => Xabbuh\XApi\Model\Activity Object
                                                (
                                                    [id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
                                                        (
                                                            [value:Xabbuh\XApi\Model\IRI:private] => http://
                                                        )

                                                    [definition:Xabbuh\XApi\Model\Activity:private] => 
                                                )

                                        )

                                    [groupingActivities:Xabbuh\XApi\Model\ContextActivities:private] => Array
                                        (
                                            [0] => Xabbuh\XApi\Model\Activity Object
                                                (
                                                    [id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
                                                        (
                                                            [value:Xabbuh\XApi\Model\IRI:private] => http://
                                                        )

                                                    [definition:Xabbuh\XApi\Model\Activity:private] => 
                                                )

                                        )

                                    [categoryActivities:Xabbuh\XApi\Model\ContextActivities:private] => 
                                    [otherActivities:Xabbuh\XApi\Model\ContextActivities:private] => 
                                )

                            [revision:Xabbuh\XApi\Model\Context:private] => 
                            [platform:Xabbuh\XApi\Model\Context:private] => 
                            [language:Xabbuh\XApi\Model\Context:private] => 
                            [statement:Xabbuh\XApi\Model\Context:private] => 
                            [extensions:Xabbuh\XApi\Model\Context:private] => 
                        )

                    [attachments:Xabbuh\XApi\Model\Statement:private] => 
                )
        )

    [moreUrlPath:Xabbuh\XApi\Model\StatementResult:private] => Xabbuh\XApi\Model\IRL Object
        (
            [value:Xabbuh\XApi\Model\IRL:private] => 
        )

)

How can I access Id, Actor and Verb properties of the above StatementResult Object?

Any help would be highy appreciated.

1 Answers1

1

The StatementResult object does not contain those properties, it contains a list of statements where each of those objects will then contain those properties. You would need to call $statements = $results->getStatements(); to retrieve an array of the Statement objects, then access those properties (id, actor, etc.) via the Statement class interface. The individual model classes are defined in a separate repo, see https://github.com/php-xapi/model/tree/master/src.

Brian J. Miller
  • 2,169
  • 1
  • 12
  • 12