ObjectEventSubscriber   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 17
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A supportsClass() 0 4 1
A isDataModificationNeeded() 0 4 1
A getAdditionalData() 0 4 1
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\Serializer\Event;
13
14
/**
15
 * Event listener modifying {@link \Xabbuh\XApi\Model\Actor} data during
16
 * the serialization and deserialization process.
17
 *
18
 * @author Christian Flothmann <[email protected]>
19
 */
20
class ObjectEventSubscriber extends AddDataSubscriber
21
{
22
    protected function supportsClass($class)
23
    {
24
        return 'Xabbuh\XApi\Model\Object' === $class;
25
    }
26
27
    protected function isDataModificationNeeded($data)
28
    {
29
        return !isset($data['objectType']);
30
    }
31
32
    protected function getAdditionalData()
33
    {
34
        return array('objectType' => 'Activity');
35
    }
36
}
37