Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Activity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
17
100.00% covered (success)
100.00%
1 / 1
 setId
n/a
0 / 0
1
n/a
0 / 0
 getId
n/a
0 / 0
1
n/a
0 / 0
 setGSActorId
n/a
0 / 0
1
n/a
0 / 0
 getGSActorId
n/a
0 / 0
1
n/a
0 / 0
 setVerb
n/a
0 / 0
1
n/a
0 / 0
 getVerb
n/a
0 / 0
1
n/a
0 / 0
 setObjectType
n/a
0 / 0
1
n/a
0 / 0
 getObjectType
n/a
0 / 0
1
n/a
0 / 0
 setObjectId
n/a
0 / 0
1
n/a
0 / 0
 getObjectId
n/a
0 / 0
1
n/a
0 / 0
 setIsLocal
n/a
0 / 0
1
n/a
0 / 0
 getIsLocal
n/a
0 / 0
1
n/a
0 / 0
 setSource
n/a
0 / 0
1
n/a
0 / 0
 getSource
n/a
0 / 0
1
n/a
0 / 0
 setCreated
n/a
0 / 0
1
n/a
0 / 0
 getCreated
n/a
0 / 0
1
n/a
0 / 0
 schemaDef
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
1<?php
2
3// {{{ License
4
5// This file is part of GNU social - https://www.gnu.org/software/social
6//
7// GNU social is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Affero General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// GNU social is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU Affero General Public License for more details.
16//
17// You should have received a copy of the GNU Affero General Public License
18// along with GNU social.  If not, see <http://www.gnu.org/licenses/>.
19
20// }}}
21
22namespace App\Entity;
23
24use App\Core\DB\DB;
25use App\Core\Entity;
26use DateTimeInterface;
27
28/**
29 * Entity for all activities we know about
30 *
31 * @category  DB
32 * @package   GNUsocial
33 *
34 * @author    Hugo Sales <hugo@hsal.es>
35 * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org
36 * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
37 */
38class Activity extends Entity
39{
40    // {{{ Autocode
41    // @codeCoverageIgnoreStart
42    private int $id;
43    private int $gsactor_id;
44    private string $verb;
45    private string $object_type;
46    private int $object_id;
47    private bool $is_local;
48    private ?string $source;
49    private \DateTimeInterface $created;
50
51    public function setId(int $id): self
52    {
53        $this->id = $id;
54        return $this;
55    }
56
57    public function getId(): int
58    {
59        return $this->id;
60    }
61
62    public function setGSActorId(int $gsactor_id): self
63    {
64        $this->gsactor_id = $gsactor_id;
65        return $this;
66    }
67
68    public function getGSActorId(): int
69    {
70        return $this->gsactor_id;
71    }
72
73    public function setVerb(string $verb): self
74    {
75        $this->verb = $verb;
76        return $this;
77    }
78
79    public function getVerb(): string
80    {
81        return $this->verb;
82    }
83
84    public function setObjectType(string $object_type): self
85    {
86        $this->object_type = $object_type;
87        return $this;
88    }
89
90    public function getObjectType(): string
91    {
92        return $this->object_type;
93    }
94
95    public function setObjectId(int $object_id): self
96    {
97        $this->object_id = $object_id;
98        return $this;
99    }
100
101    public function getObjectId(): int
102    {
103        return $this->object_id;
104    }
105
106    public function setIsLocal(bool $is_local): self
107    {
108        $this->is_local = $is_local;
109        return $this;
110    }
111
112    public function getIsLocal(): bool
113    {
114        return $this->is_local;
115    }
116
117    public function setSource(?string $source): self
118    {
119        $this->source = $source;
120        return $this;
121    }
122
123    public function getSource(): ?string
124    {
125        return $this->source;
126    }
127
128    public function setCreated(DateTimeInterface $created): self
129    {
130        $this->created = $created;
131        return $this;
132    }
133
134    public function getCreated(): DateTimeInterface
135    {
136        return $this->created;
137    }
138
139    // @codeCoverageIgnoreEnd
140    // }}} Autocode
141
142    public static function schemaDef(): array
143    {
144        return [
145            'name'   => 'activity',
146            'fields' => [
147                'id'          => ['type' => 'serial',   'not null' => true],
148                'gsactor_id'  => ['type' => 'int',      'not null' => true, 'description' => 'foreign key to gsactor table'],
149                'verb'        => ['type' => 'varchar',  'length' => 32,     'not null' => true, 'description' => 'internal activity verb, influenced by activity pub verbs'],
150                'object_type' => ['type' => 'varchar',  'length' => 32,     'not null' => true, 'description' => 'the name of the table this object refers to'],
151                'object_id'   => ['type' => 'int',      'not null' => true, 'description' => 'id in the referenced table'],
152                'is_local'    => ['type' => 'bool',     'not null' => true, 'description' => 'whether this was a locally generated or an imported activity'],
153                'source'      => ['type' => 'varchar',  'length' => 32,     'description' => 'the source of this activity'],
154                'created'     => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created',  'default' => 'CURRENT_TIMESTAMP'],
155            ],
156            'primary key' => ['id'],
157        ];
158    }
159}