ContentTransformer::doTransform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 3 Features 0
Metric Value
c 4
b 3
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace PEIP\ABS\Transformer;
4
5
/*
6
 * This file is part of the PEIP package.
7
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
/**
14
 * PEIP\ABS\Transformer\ContentTransformer
15
 * Abstract base class for content-transformers.
16
 *
17
 * @author Timo Michna <timomichna/yahoo.de>
18
 * @extends PEIP\Pipe\Pipe
19
 * @implements \PEIP\INF\Transformer\Transformer, \PEIP\INF\Event\Connectable, \PEIP\INF\Channel\SubscribableChannel, \PEIP\INF\Channel\Channel, \PEIP\INF\Handler\Handler, \PEIP\INF\Message\MessageBuilder
20
 */
21
abstract class ContentTransformer extends \PEIP\ABS\Transformer\Transformer
22
{
23
    /**
24
     * Transforms a message.
25
     *
26
     * @abstract
27
     *
28
     * @param \PEIP\INF\Message\Message $message
29
     *
30
     * @return mixed result of transforming the message payload/content
31
     */
32
    protected function doTransform(\PEIP\INF\Message\Message $message)
33
    {
34
        return $this->transformContent($message->getContent());
35
    }
36
37
    /**
38
     * Transforms message-content.
39
     *
40
     * @abstract
41
     *
42
     * @param mixed $content content/payload of message
43
     *
44
     * @return mixed result of transforming the message payload/content
45
     */
46
    abstract protected function transformContent($content);
47
}
48