Skip to content

Commit 114f27a

Browse files
obenlandpfefferle
andauthored
Magic method docs (#1307)
* Magic method docs Part I * Add missing function docs Part II * Update docs * Revert comment changes * Use correct class docs * adjust alignment * Update property type docs * Update property types in base_object --------- Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent 66dbef9 commit 114f27a

File tree

9 files changed

+84
-134
lines changed

9 files changed

+84
-134
lines changed

includes/activity/class-activity.php

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,38 @@
2020
*
2121
* @see https://www.w3.org/TR/activitystreams-core/#activities
2222
* @see https://www.w3.org/TR/activitystreams-core/#intransitiveactivities
23+
*
24+
* @method string|array|null get_actor() Gets one or more entities that performed or are expected to perform the activity.
25+
* @method string|null get_id() Gets the object's unique global identifier.
26+
* @method string get_type() Gets the type of the object.
27+
* @method string|null get_name() Gets the natural language name of the object.
28+
* @method string|null get_url() Gets the URL of the object.
29+
* @method string|null get_summary() Gets the natural language summary of the object.
30+
* @method string|null get_published() Gets the date and time the object was published in ISO 8601 format.
31+
* @method string|null get_updated() Gets the date and time the object was updated in ISO 8601 format.
32+
* @method string|null get_attributed_to() Gets the entity attributed as the original author.
33+
* @method array|string|null get_cc() Gets the secondary recipients of the object.
34+
* @method array|string|null get_to() Gets the primary recipients of the object.
35+
* @method array|null get_attachment() Gets the attachment property of the object.
36+
* @method array|null get_icon() Gets the icon property of the object.
37+
* @method array|null get_image() Gets the image property of the object.
38+
* @method Base_Object|string|null get_object() Gets the direct object of the activity.
39+
* @method array|string|null get_in_reply_to() Gets the objects this object is in reply to.
40+
*
41+
* @method Activity set_actor( string|array $actor ) Sets one or more entities that performed the activity.
42+
* @method Activity set_id( string $id ) Sets the object's unique global identifier.
43+
* @method Activity set_type( string $type ) Sets the type of the object.
44+
* @method Activity set_name( string $name ) Sets the natural language name of the object.
45+
* @method Activity set_url( string $url ) Sets the URL of the object.
46+
* @method Activity set_summary( string $summary ) Sets the natural language summary of the object.
47+
* @method Activity set_published( string $published ) Sets the date and time the object was published in ISO 8601 format.
48+
* @method Activity set_updated( string $updated ) Sets the date and time the object was updated in ISO 8601 format.
49+
* @method Activity set_attributed_to( string $attributed_to ) Sets the entity attributed as the original author.
50+
* @method Activity set_cc( array|string $cc ) Sets the secondary recipients of the object.
51+
* @method Activity set_to( array|string $to ) Sets the primary recipients of the object.
52+
* @method Activity set_attachment( array $attachment ) Sets the attachment property of the object.
53+
* @method Activity set_icon( array $icon ) Sets the icon property of the object.
54+
* @method Activity set_image( array $image ) Sets the image property of the object.
2355
*/
2456
class Activity extends Base_Object {
2557
const JSON_LD_CONTEXT = array(
@@ -40,10 +72,7 @@ class Activity extends Base_Object {
4072
*
4173
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object-term
4274
*
43-
* @var string
44-
* | Base_Object
45-
* | Link
46-
* | null
75+
* @var string|Base_Object|null
4776
*/
4877
protected $object;
4978

@@ -55,11 +84,7 @@ class Activity extends Base_Object {
5584
*
5685
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
5786
*
58-
* @var string
59-
* | \ActivityPhp\Type\Extended\AbstractActor
60-
* | array<Actor>
61-
* | array<Link>
62-
* | Link
87+
* @var string|array
6388
*/
6489
protected $actor;
6590

@@ -74,11 +99,7 @@ class Activity extends Base_Object {
7499
*
75100
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target
76101
*
77-
* @var string
78-
* | ObjectType
79-
* | array<ObjectType>
80-
* | Link
81-
* | array<Link>
102+
* @var string|array
82103
*/
83104
protected $target;
84105

@@ -90,10 +111,7 @@ class Activity extends Base_Object {
90111
*
91112
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-result
92113
*
93-
* @var string
94-
* | ObjectType
95-
* | Link
96-
* | null
114+
* @var string|Base_Object
97115
*/
98116
protected $result;
99117

@@ -106,9 +124,6 @@ class Activity extends Base_Object {
106124
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-replies
107125
*
108126
* @var array
109-
* | ObjectType
110-
* | Link
111-
* | null
112127
*/
113128
protected $replies;
114129

@@ -122,10 +137,7 @@ class Activity extends Base_Object {
122137
*
123138
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-origin
124139
*
125-
* @var string
126-
* | ObjectType
127-
* | Link
128-
* | null
140+
* @var string|array
129141
*/
130142
protected $origin;
131143

@@ -135,10 +147,7 @@ class Activity extends Base_Object {
135147
*
136148
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-instrument
137149
*
138-
* @var string
139-
* | ObjectType
140-
* | Link
141-
* | null
150+
* @var string|array
142151
*/
143152
protected $instrument;
144153

@@ -151,8 +160,6 @@ class Activity extends Base_Object {
151160
* @see https://www.w3.org/TR/activitypub/#object-without-create
152161
*
153162
* @param array|string|Base_Object|Link|null $data Activity object.
154-
*
155-
* @return void
156163
*/
157164
public function set_object( $data ) {
158165
// Convert array to object.

includes/activity/class-actor.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ class Actor extends Base_Object {
6666
*
6767
* @see https://www.w3.org/TR/activitypub/#inbox
6868
*
69-
* @var string
70-
* | null
69+
* @var string|null
7170
*/
7271
protected $inbox;
7372

@@ -77,8 +76,7 @@ class Actor extends Base_Object {
7776
*
7877
* @see https://www.w3.org/TR/activitypub/#outbox
7978
*
80-
* @var string
81-
* | null
79+
* @var string|null
8280
*/
8381
protected $outbox;
8482

includes/activity/class-base-object.php

Lines changed: 18 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ class Base_Object {
6161
*
6262
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attachment
6363
*
64-
* @var string
65-
* | ObjectType
66-
* | Link
67-
* | array<ObjectType>
68-
* | array<Link>
69-
* | null
64+
* @var string|null
7065
*/
7166
protected $attachment;
7267

@@ -77,12 +72,7 @@ class Base_Object {
7772
*
7873
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
7974
*
80-
* @var string
81-
* | ObjectType
82-
* | Link
83-
* | array<ObjectType>
84-
* | array<Link>
85-
* | null
75+
* @var string|null
8676
*/
8777
protected $attributed_to;
8878

@@ -92,12 +82,7 @@ class Base_Object {
9282
*
9383
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audience
9484
*
95-
* @var string
96-
* | ObjectType
97-
* | Link
98-
* | array<ObjectType>
99-
* | array<Link>
100-
* | null
85+
* @var string|null
10186
*/
10287
protected $audience;
10388

@@ -127,10 +112,7 @@ class Base_Object {
127112
*
128113
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-context
129114
*
130-
* @var string
131-
* | ObjectType
132-
* | Link
133-
* | null
115+
* @var string|null
134116
*/
135117
protected $context;
136118

@@ -191,12 +173,7 @@ class Base_Object {
191173
*
192174
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon
193175
*
194-
* @var string
195-
* | Image
196-
* | Link
197-
* | array<Image>
198-
* | array<Link>
199-
* | null
176+
* @var string|array|null
200177
*/
201178
protected $icon;
202179

@@ -207,12 +184,7 @@ class Base_Object {
207184
*
208185
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image-term
209186
*
210-
* @var string
211-
* | Image
212-
* | Link
213-
* | array<Image>
214-
* | array<Link>
215-
* | null
187+
* @var string|array|null
216188
*/
217189
protected $image;
218190

@@ -222,12 +194,7 @@ class Base_Object {
222194
*
223195
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-inreplyto
224196
*
225-
* @var string
226-
* | ObjectType
227-
* | Link
228-
* | array<ObjectType>
229-
* | array<Link>
230-
* | null
197+
* @var string|null
231198
*/
232199
protected $in_reply_to;
233200

@@ -237,12 +204,7 @@ class Base_Object {
237204
*
238205
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-location
239206
*
240-
* @var string
241-
* | ObjectType
242-
* | Link
243-
* | array<ObjectType>
244-
* | array<Link>
245-
* | null
207+
* @var string|null
246208
*/
247209
protected $location;
248210

@@ -251,10 +213,7 @@ class Base_Object {
251213
*
252214
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-preview
253215
*
254-
* @var string
255-
* | ObjectType
256-
* | Link
257-
* | null
216+
* @var string|null
258217
*/
259218
protected $preview;
260219

@@ -286,10 +245,7 @@ class Base_Object {
286245
*
287246
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-summary
288247
*
289-
* @var string
290-
* | ObjectType
291-
* | Link
292-
* | null
248+
* @var string|null
293249
*/
294250
protected $summary;
295251

@@ -299,7 +255,7 @@ class Base_Object {
299255
*
300256
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-summary
301257
*
302-
* @var array<string>|null
258+
* @var string[]|null
303259
*/
304260
protected $summary_map;
305261

@@ -312,12 +268,7 @@ class Base_Object {
312268
*
313269
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tag
314270
*
315-
* @var string
316-
* | ObjectType
317-
* | Link
318-
* | array<ObjectType>
319-
* | array<Link>
320-
* | null
271+
* @var string|null
321272
*/
322273
protected $tag;
323274

@@ -333,11 +284,7 @@ class Base_Object {
333284
/**
334285
* One or more links to representations of the object.
335286
*
336-
* @var string
337-
* | array<string>
338-
* | Link
339-
* | array<Link>
340-
* | null
287+
* @var string|null
341288
*/
342289
protected $url;
343290

@@ -347,12 +294,7 @@ class Base_Object {
347294
*
348295
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-to
349296
*
350-
* @var string
351-
* | ObjectType
352-
* | Link
353-
* | array<ObjectType>
354-
* | array<Link>
355-
* | null
297+
* @var string|array|null
356298
*/
357299
protected $to;
358300

@@ -362,12 +304,7 @@ class Base_Object {
362304
*
363305
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bto
364306
*
365-
* @var string
366-
* | ObjectType
367-
* | Link
368-
* | array<ObjectType>
369-
* | array<Link>
370-
* | null
307+
* @var string|array|null
371308
*/
372309
protected $bto;
373310

@@ -377,12 +314,7 @@ class Base_Object {
377314
*
378315
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-cc
379316
*
380-
* @var string
381-
* | ObjectType
382-
* | Link
383-
* | array<ObjectType>
384-
* | array<Link>
385-
* | null
317+
* @var string|array|null
386318
*/
387319
protected $cc;
388320

@@ -392,12 +324,7 @@ class Base_Object {
392324
*
393325
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bcc
394326
*
395-
* @var string
396-
* | ObjectType
397-
* | Link
398-
* | array<ObjectType>
399-
* | array<Link>
400-
* | null
327+
* @var string|array|null
401328
*/
402329
protected $bcc;
403330

@@ -443,10 +370,7 @@ class Base_Object {
443370
*
444371
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-replies
445372
*
446-
* @var string
447-
* | Collection
448-
* | Link
449-
* | null
373+
* @var string|array|null
450374
*/
451375
protected $replies;
452376

0 commit comments

Comments
 (0)