StdoutLoggerAppender   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Agavi\Logging;
3
4
// +---------------------------------------------------------------------------+
5
// | This file is part of the Agavi package.                                   |
6
// | Copyright (c) 2005-2011 the Agavi Project.                                |
7
// |                                                                           |
8
// | For the full copyright and license information, please view the LICENSE   |
9
// | file that was distributed with this source code. You can also view the    |
10
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
11
// |   vi: set noexpandtab:                                                    |
12
// |   Local Variables:                                                        |
13
// |   indent-tabs-mode: t                                                     |
14
// |   End:                                                                    |
15
// +---------------------------------------------------------------------------+
16
use Agavi\Core\Context;
17
18
/**
19
 * AgaviStdoutLoggerAppender appends an AgaviLoggerMessage to stdout.
20
 *
21
 * @package    agavi
22
 * @subpackage logging
23
 *
24
 * @author     Bob Zoller <[email protected]>
25
 * @copyright  Authors
26
 * @copyright  The Agavi Project
27
 *
28
 * @since      0.10.0
29
 *
30
 * @version    $Id$
31
 */
32 View Code Duplication
class StdoutLoggerAppender extends StreamLoggerAppender
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
{
34
    /**
35
     * Initialize the object.
36
     *
37
     * @param      Context $context A Context instance.
38
     * @param      array   $parameters An associative array of initialization parameters.
39
     *
40
     * @author     Bob Zoller <[email protected]>
41
     * @since      0.10.0
42
     */
43
    public function initialize(Context $context, array $parameters = array())
44
    {
45
        $parameters['destination'] = 'php://stdout';
46
        // 'a' doesn't work on Linux
47
        // http://bugs.php.net/bug.php?id=45303
48
        $parameters['mode'] = 'w';
49
        
50
        parent::initialize($context, $parameters);
51
    }
52
}
53