diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-05-31 09:31:18 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-06-23 10:08:54 +0200 |
commit | bf6c0346d8d35a719dd1bff1cb4d573d422f99ff (patch) | |
tree | 04fb80e20ad1cffacb72357a632a9afe2ec058cb /src/Wallabag/CoreBundle/Event/Activity/Actions/Federation | |
parent | d6d3f4ec3698effd1d4b063e295341791bdcf7d7 (diff) | |
download | wallabag-federation.tar.gz wallabag-federation.tar.zst wallabag-federation.zip |
WIPfederation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/Activity/Actions/Federation')
4 files changed, 161 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FederationEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FederationEvent.php new file mode 100644 index 00000000..da18330e --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FederationEvent.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Federation; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\FederationBundle\Entity\Account; | ||
7 | |||
8 | abstract class FederationEvent extends Event | ||
9 | { | ||
10 | protected $account; | ||
11 | |||
12 | /** | ||
13 | * FederationEvent constructor. | ||
14 | * @param Account $account | ||
15 | */ | ||
16 | public function __construct(Account $account) | ||
17 | { | ||
18 | $this->account = $account; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * @return Account | ||
23 | */ | ||
24 | public function getAccount() | ||
25 | { | ||
26 | return $this->account; | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * @param Account $account | ||
31 | * @return FederationEvent | ||
32 | */ | ||
33 | public function setAccount(Account $account) | ||
34 | { | ||
35 | $this->account = $account; | ||
36 | return $this; | ||
37 | } | ||
38 | |||
39 | |||
40 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FollowEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FollowEvent.php new file mode 100644 index 00000000..4004932e --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/FollowEvent.php | |||
@@ -0,0 +1,39 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Federation; | ||
4 | |||
5 | use Wallabag\FederationBundle\Entity\Account; | ||
6 | |||
7 | /** | ||
8 | * This event is fired as soon as an account was followed. | ||
9 | */ | ||
10 | class FollowEvent extends FederationEvent | ||
11 | { | ||
12 | const NAME = 'federation.follow'; | ||
13 | |||
14 | protected $follower; | ||
15 | |||
16 | public function __construct(Account $accountFollowed, Account $follower) | ||
17 | { | ||
18 | parent::__construct($accountFollowed); | ||
19 | $this->follower = $follower; | ||
20 | } | ||
21 | |||
22 | /** | ||
23 | * @return Account | ||
24 | */ | ||
25 | public function getFollower() | ||
26 | { | ||
27 | return $this->follower; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Account $follower | ||
32 | * @return FollowEvent | ||
33 | */ | ||
34 | public function setFollower(Account $follower) | ||
35 | { | ||
36 | $this->follower = $follower; | ||
37 | return $this; | ||
38 | } | ||
39 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/RecommendedEntryEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/RecommendedEntryEvent.php new file mode 100644 index 00000000..998b56d5 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/RecommendedEntryEvent.php | |||
@@ -0,0 +1,43 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Federation; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as an entry was recommended. | ||
10 | */ | ||
11 | class RecommendedEntryEvent extends Event | ||
12 | { | ||
13 | const NAME = 'federation.recommend'; | ||
14 | |||
15 | protected $entry; | ||
16 | |||
17 | /** | ||
18 | * FederationEvent constructor. | ||
19 | * @param Entry $entry | ||
20 | */ | ||
21 | public function __construct(Entry $entry) | ||
22 | { | ||
23 | $this->entry = $entry; | ||
24 | } | ||
25 | |||
26 | /** | ||
27 | * @return Entry | ||
28 | */ | ||
29 | public function getEntry() | ||
30 | { | ||
31 | return $this->entry; | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * @param Entry $entry | ||
36 | * @return RecommendedEntryEvent | ||
37 | */ | ||
38 | public function setEntry(Entry $entry) | ||
39 | { | ||
40 | $this->entry = $entry; | ||
41 | return $this; | ||
42 | } | ||
43 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/UnfollowEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/UnfollowEvent.php new file mode 100644 index 00000000..bf9a35f8 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Federation/UnfollowEvent.php | |||
@@ -0,0 +1,39 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Federation; | ||
4 | |||
5 | use Wallabag\FederationBundle\Entity\Account; | ||
6 | |||
7 | /** | ||
8 | * This event is fired as soon as an account is being unfollowed | ||
9 | */ | ||
10 | class UnfollowEvent extends FederationEvent | ||
11 | { | ||
12 | const NAME = 'federation.unfollow'; | ||
13 | |||
14 | protected $follower; | ||
15 | |||
16 | public function __construct(Account $accountFollowed, Account $follower) | ||
17 | { | ||
18 | parent::__construct($accountFollowed); | ||
19 | $this->follower = $follower; | ||
20 | } | ||
21 | |||
22 | /** | ||
23 | * @return Account | ||
24 | */ | ||
25 | public function getFollower() | ||
26 | { | ||
27 | return $this->follower; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Account $follower | ||
32 | * @return UnfollowEvent | ||
33 | */ | ||
34 | public function setFollower(Account $follower) | ||
35 | { | ||
36 | $this->follower = $follower; | ||
37 | return $this; | ||
38 | } | ||
39 | } | ||