Completed
Push — master ( abd772...b3b6a4 )
by Sergi Tur
03:23
created

DevTools   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A devtools() 0 9 3
A idehelper() 0 4 1
A debugbar() 0 4 1
1
<?php
2
3
namespace Acacha\Llum\Traits;
4
5
/**
6
 * Class DevTools.
7
 */
8
trait DevTools
9
{
10
    /**
11
     * Execute devtools command.
12
     * @return int -1 if error occurred
13
     */
14
    protected function devtools()
15
    {
16
        if ($this->idehelper() == -1) {
17
            return -1;
18
        }
19
        if ($this->debugbar() == -1) {
20
            return -1;
21
        }
22
    }
23
24
    /**
25
     *  Install Laravel ide helper package.
26
     *  @return int -1 if error occurred
27
     */
28
    protected function idehelper()
29
    {
30
        return $this->package('barryvdh/laravel-ide-helper');
0 ignored issues
show
Bug introduced by
It seems like package() 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...
31
    }
32
33
    /**
34
     * Install Laravel debugbar package.
35
     * @return int -1 if error occurred
36
     */
37
    protected function debugbar()
38
    {
39
        return $this->package('barryvdh/laravel-debugbar');
0 ignored issues
show
Bug introduced by
It seems like package() 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...
40
    }
41
}
42