File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php namespace Locker \XApi ;
2+ use Locker \XApi \Errors \Error as Error ;
23
34class StatementBase extends Element {
45 protected $ props = [
@@ -11,4 +12,20 @@ class StatementBase extends Element {
1112 'attachments ' => 'Locker\XApi\Attachments '
1213 ];
1314 protected $ required_props = ['actor ' , 'verb ' , 'object ' ];
15+
16+ public function validate () {
17+ $ errors = [];
18+ $ verb_id = $ this ->getPropValue ('verb.id ' );
19+ $ object_type = $ this ->getPropValue ('object.objectType ' );
20+
21+ // Validates voider.
22+ if (
23+ $ verb_id === 'http://adlnet.gov/expapi/verbs/voided ' &&
24+ $ object_type !== 'StatementRef '
25+ ) {
26+ $ errors [] = new Error ("`object.objectType` must be `StatementRef` not ` $ object_type` when voiding " );
27+ }
28+
29+ return array_merge ($ errors , parent ::validate ());
30+ }
1431}
Original file line number Diff line number Diff line change 11{
2- "id" : " 710cc790-9d8d-11e4-bd06-0800200c9a66" ,
3- "actor" : {
4- "objectType" : " Agent" ,
5- "mbox" : " mailto:duy.nguyen@go1.com.au" ,
6- "name" : " quanvm"
2+ "actor" :{
3+ "mbox" :" mailto:test@example.com"
74 },
8- "verb" : {
9- "id" : " http://adlnet.gov/expapi/verbs/experienced" ,
10- "display" : {"en-us" : " experienced" }
5+ "verb" :{
6+ "id" :" http://adlnet.gov/expapi/verbs/voided"
117 },
12- "context" : {
13- "contextActivities" : {
14- "parent" : {
15- "id" : " http://tincanapi.com/GolfExample_TCAPI" ,
16- "objectType" : " Activity"
17- },
18- "grouping" : [{
19- "id" : " http://tincanapi.com/GolfExample_TCAPI" ,
20- "objectType" : " Activity"
21- }]
22- }
23- },
24- "object" : {
25- "id" : " http://tincanapi.com/GolfExample_TCAPI/Playing/Scoring.html" ,
26- "objectType" : " Activity" ,
27- "definition" : {
28- "name" : {
29- "en-US" : " Scoring"
30- },
31- "description" : {
32- "en-US" : " An overview of how to score a round of golf."
33- },
34- "type" : " http:///activitystrea.ms/schema/1.0/badge"
35- }
36- },
37- "authority" : {
38- "name" : " " ,
39- "mbox" : " mailto:quan@ll.com" ,
40- "objectType" : " Agent"
8+ "object" :{
9+ "id" :" http://kiem.curatr3.com/courses/mentoropleiding"
4110 }
4211}
Original file line number Diff line number Diff line change 33
44use Locker \XApi as XApi ;
55
6-
6+ header ( ' Content-Type: application/json ' );
77try {
88 // Code.
99 $ file_location = 'assets/test.json ' ;
You can’t perform that action at this time.
0 commit comments