This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the xAPI package. |
||
5 | * |
||
6 | * (c) Christian Flothmann <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Xabbuh\XApi\DataFixtures; |
||
13 | |||
14 | use Xabbuh\XApi\Model\Account; |
||
15 | use Xabbuh\XApi\Model\Agent; |
||
16 | use Xabbuh\XApi\Model\Activity; |
||
17 | use Xabbuh\XApi\Model\Definition; |
||
18 | use Xabbuh\XApi\Model\Group; |
||
19 | use Xabbuh\XApi\Model\Result; |
||
20 | use Xabbuh\XApi\Model\Score; |
||
21 | use Xabbuh\XApi\Model\Statement; |
||
22 | use Xabbuh\XApi\Model\StatementReference; |
||
23 | use Xabbuh\XApi\Model\SubStatement; |
||
24 | use Xabbuh\XApi\Model\Verb; |
||
25 | |||
26 | /** |
||
27 | * Statement fixtures. |
||
28 | * |
||
29 | * @author Christian Flothmann <[email protected]> |
||
30 | */ |
||
31 | class StatementFixtures |
||
32 | { |
||
33 | const DEFAULT_STATEMENT_ID = '12345678-1234-5678-8234-567812345678'; |
||
34 | |||
35 | /** |
||
36 | * Loads a minimal valid statement. |
||
37 | * |
||
38 | * @param string $id The id of the new Statement |
||
39 | * |
||
40 | * @return Statement |
||
41 | */ |
||
42 | View Code Duplication | public static function getMinimalStatement($id = self::DEFAULT_STATEMENT_ID) |
|
0 ignored issues
–
show
|
|||
43 | { |
||
44 | $actor = new Agent('mailto:[email protected]'); |
||
45 | $verb = new Verb('http://adlnet.gov/expapi/verbs/created', array('en-US' => 'created')); |
||
46 | $activity = new Activity('http://example.adlnet.gov/xapi/example/activity'); |
||
47 | |||
48 | return new Statement($id, $actor, $verb, $activity); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Loads a statement with a group as an actor. |
||
53 | * |
||
54 | * @param string $id The id of the new Statement |
||
55 | * |
||
56 | * @return Statement |
||
57 | */ |
||
58 | View Code Duplication | public static function getStatementWithGroupActor($id = self::DEFAULT_STATEMENT_ID) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
59 | { |
||
60 | $group = ActorFixtures::getGroup(); |
||
61 | $verb = VerbFixtures::getVerb(); |
||
62 | $activity = ActivityFixtures::getActivity(); |
||
63 | |||
64 | return new Statement($id, $group, $verb, $activity); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Loads a statement with a group that has no members as an actor. |
||
69 | * |
||
70 | * @param string $id The id of the new Statement |
||
71 | * |
||
72 | * @return Statement |
||
73 | */ |
||
74 | View Code Duplication | public static function getStatementWithGroupActorWithoutMembers($id = self::DEFAULT_STATEMENT_ID) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
75 | { |
||
76 | $group = ActorFixtures::getGroupWithoutMembers(); |
||
77 | $verb = VerbFixtures::getVerb(); |
||
78 | $activity = ActivityFixtures::getActivity(); |
||
79 | |||
80 | return new Statement($id, $group, $verb, $activity); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Loads a statement including a reference to another statement. |
||
85 | * |
||
86 | * @param string $id The id of the new Statement |
||
87 | * |
||
88 | * @return Statement |
||
89 | */ |
||
90 | public static function getStatementWithStatementRef($id = self::DEFAULT_STATEMENT_ID) |
||
91 | { |
||
92 | $minimalStatement = static::getMinimalStatement($id); |
||
93 | |||
94 | return new Statement( |
||
95 | $minimalStatement->getId(), |
||
96 | $minimalStatement->getActor(), |
||
97 | $minimalStatement->getVerb(), |
||
98 | new StatementReference('8f87ccde-bb56-4c2e-ab83-44982ef22df0') |
||
99 | ); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Loads a statement including a result. |
||
104 | * |
||
105 | * @param string $id The id of the new Statement |
||
106 | * |
||
107 | * @return Statement |
||
108 | */ |
||
109 | public static function getStatementWithResult($id = self::DEFAULT_STATEMENT_ID) |
||
110 | { |
||
111 | $actor = new Agent('mailto:[email protected]'); |
||
112 | $verb = new Verb('http://adlnet.gov/expapi/verbs/created', array('en-US' => 'created')); |
||
113 | $activity = new Activity('http://example.adlnet.gov/xapi/example/activity'); |
||
114 | $score = new Score(0.95, 31, 0, 50); |
||
115 | $result = new Result($score, true, true, 'Wow, nice work!', 'PT1H0M0S'); |
||
116 | |||
117 | return new Statement($id, $actor, $verb, $activity, $result); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Loads a statement including a sub statement. |
||
122 | * |
||
123 | * @param string $id The id of the new Statement |
||
124 | * |
||
125 | * @return Statement |
||
126 | */ |
||
127 | public static function getStatementWithSubStatement($id = self::DEFAULT_STATEMENT_ID) |
||
128 | { |
||
129 | $actor = new Agent('mailto:[email protected]'); |
||
130 | $verb = new Verb('http://example.com/visited', array('en-US' => 'will visit')); |
||
131 | $definition = new Definition( |
||
132 | array('en-US' => 'Some Awesome Website'), |
||
133 | array('en-US' => 'The visited website'), |
||
134 | 'http://example.com/definition-type' |
||
135 | ); |
||
136 | $activity = new Activity('http://example.com/website', $definition); |
||
137 | $subStatement = new SubStatement(null, $actor, $verb, $activity); |
||
138 | |||
139 | $actor = new Agent('mailto:[email protected]'); |
||
140 | $verb = new Verb('http://example.com/planned', array('en-US' => 'planned')); |
||
141 | |||
142 | return new Statement($id, $actor, $verb, $subStatement); |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * Loads a statement including an agent authority. |
||
147 | * |
||
148 | * @param string $id The id of the new Statement |
||
149 | * |
||
150 | * @return Statement |
||
151 | */ |
||
152 | public static function getStatementWithAgentAuthority($id = self::DEFAULT_STATEMENT_ID) |
||
153 | { |
||
154 | $actor = new Agent('mailto:[email protected]'); |
||
155 | $verb = new Verb('http://adlnet.gov/expapi/verbs/created', array('en-US' => 'created')); |
||
156 | $activity = new Activity('http://example.adlnet.gov/xapi/example/activity'); |
||
157 | $authority = new Agent(null, null, null, new Account('anonymous', 'http://cloud.scorm.com/')); |
||
158 | |||
159 | return new Statement($id, $actor, $verb, $activity, null, $authority); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * Loads a statement including a group authority. |
||
164 | * |
||
165 | * @param string $id The id of the new Statement |
||
166 | * |
||
167 | * @return Statement |
||
168 | */ |
||
169 | View Code Duplication | public static function getStatementWithGroupAuthority($id = self::DEFAULT_STATEMENT_ID) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
170 | { |
||
171 | $actor = new Agent('mailto:[email protected]'); |
||
172 | $verb = new Verb('http://adlnet.gov/expapi/verbs/created', array('en-US' => 'created')); |
||
173 | $activity = new Activity('http://example.adlnet.gov/xapi/example/activity'); |
||
174 | $user = new Agent(null, null, null, new Account('oauth_consumer_x75db', 'http://example.com/xAPI/OAuth/Token')); |
||
175 | $application = new Agent('mailto:[email protected]'); |
||
176 | $authority = new Group(null, null, null, null, null, array($user, $application)); |
||
177 | |||
178 | return new Statement($id, $actor, $verb, $activity, null, $authority); |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * Loads a void statement. |
||
183 | * |
||
184 | * @param string $id The id of the new Statement |
||
185 | * |
||
186 | * @return Statement |
||
187 | */ |
||
188 | public static function getVoidStatement($id = self::DEFAULT_STATEMENT_ID) |
||
189 | { |
||
190 | $actor = new Agent('mailto:[email protected]'); |
||
191 | $verb = Verb::createVoidVerb(); |
||
192 | $object = new StatementReference('e05aa883-acaf-40ad-bf54-02c8ce485fb0'); |
||
193 | |||
194 | return new Statement($id, $actor, $verb, $object); |
||
195 | } |
||
196 | } |
||
197 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.