StringMessage::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 3 Features 0
Metric Value
c 3
b 3
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace PEIP\Message;
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
 * StringMessage
15
 *
16
 * @author Timo Michna <timomichna/yahoo.de>
17
 * @package PEIP
18
 * @subpackage message
19
 * @extends \PEIP\Message\GenericMessage
20
 * @implements \PEIP\INF\Base\Buildable, \PEIP\INF\Message\Message, \PEIP\INF\Base\Container
21
 */
22
23
use PEIP\Base\GenericBuilder;
24
25
class StringMessage extends \PEIP\Message\GenericMessage
26
{
27
    const CONTENT_CAST_TYPE = 'string';
28
29
    public function __toString()
30
    {
31
        return (string) $this->getContent();
32
    }
33
34
    public function getContent()
35
    {
36
        return (string) parent::getContent();
37
    }
38
39
    /**
40
     * Provides a static build method to create new Instances of this class.
41
     * Implements \PEIP\INF\Base\Buildable. Overwrites \PEIP\Message\GenericMessage::build.
42
     *
43
     * @static
44
     * @implements \PEIP\INF\Base\Buildable
45
     *
46
     * @param string $name the name of the header
0 ignored issues
show
Bug introduced by
There is no parameter named $name. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
47
     *
48
     * @return bool wether the header is set
49
     */
50
    public static function build(array $arguments = [])
51
    {
52
        return GenericBuilder::getInstance(__CLASS__)->build($arguments);
53
    }
54
}
55