loadTasks   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A taskConcat() 0 4 1
A taskReplaceInFile() 0 4 1
A taskWriteToFile() 0 4 1
A taskTmpFile() 0 4 1
1
<?php
2
3
namespace Robo\Task\File;
4
5
trait loadTasks
6
{
7
    /**
8
     * @param array|\Iterator $files
9
     *
10
     * @return \Robo\Task\File\Concat|\Robo\Collection\CollectionBuilder
11
     */
12
    protected function taskConcat($files)
13
    {
14
        return $this->task(Concat::class, $files);
0 ignored issues
show
Bug introduced by
It seems like task() 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...
15
    }
16
17
    /**
18
     * @param string $file
19
     *
20
     * @return \Robo\Task\File\Replace|\Robo\Collection\CollectionBuilder
21
     */
22
    protected function taskReplaceInFile($file)
23
    {
24
        return $this->task(Replace::class, $file);
0 ignored issues
show
Bug introduced by
It seems like task() 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...
25
    }
26
27
    /**
28
     * @param string $file
29
     *
30
     * @return \Robo\Task\File\Write|\Robo\Collection\CollectionBuilder
31
     */
32
    protected function taskWriteToFile($file)
33
    {
34
        return $this->task(Write::class, $file);
0 ignored issues
show
Bug introduced by
It seems like task() 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...
35
    }
36
37
    /**
38
     * @param string $filename
39
     * @param string $extension
40
     * @param string $baseDir
41
     * @param bool $includeRandomPart
42
     *
43
     * @return \Robo\Task\File\TmpFile|\Robo\Collection\CollectionBuilder
44
     */
45
    protected function taskTmpFile($filename = 'tmp', $extension = '', $baseDir = '', $includeRandomPart = true)
46
    {
47
        return $this->task(TmpFile::class, $filename, $extension, $baseDir, $includeRandomPart);
0 ignored issues
show
Bug introduced by
It seems like task() 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...
48
    }
49
}
50