ArticleTopic   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 6 1
A onArticleCreated() 0 6 1
1
<?php
2
3
namespace Eole\Sandstone\Tests\Integration\App;
4
5
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
6
use Eole\Sandstone\Websocket\Topic;
7
use Eole\Sandstone\Tests\Integration\App\ArticleCreatedEvent;
8
9
class ArticleTopic extends Topic implements EventSubscriberInterface
10
{
11
    /**
12
     * {@InheritDoc}
13
     */
14
    public static function getSubscribedEvents()
15
    {
16
        return [
17
            'article.created' => 'onArticleCreated',
18
        ];
19
    }
20
21
    /**
22
     * @param ArticleCreatedEvent $event
23
     */
24
    public function onArticleCreated(ArticleCreatedEvent $event)
25
    {
26
        $this->broadcast([
27
            'message' => 'An article has just been published: '.$event->title,
0 ignored issues
show
Bug introduced by
The property title cannot be accessed from this context as it is declared private in class Eole\Sandstone\Tests\Int...App\ArticleCreatedEvent.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
28
        ]);
29
    }
30
}
31