BlockMessage   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 12
lcom 0
cbo 0
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A blockMessage() 0 7 1
1
<?php namespace Modules\Core\Console\Installers\Traits;
2
3
trait BlockMessage
4
{
5
    public function blockMessage($title, $message, $style = 'info')
0 ignored issues
show
Best Practice introduced by
Using PHP4-style constructors that are named like the class is not recommend; better use the more explicit __construct method.
Loading history...
6
    {
7
        $formatter = $this->getHelperSet()->get('formatter');
0 ignored issues
show
Bug introduced by
It seems like getHelperSet() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
8
        $errorMessages = [$title, $message];
9
        $formattedBlock = $formatter->formatBlock($errorMessages, $style, true);
10
        $this->line($formattedBlock);
0 ignored issues
show
Bug introduced by
It seems like line() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
11
    }
12
}
13