Passed
Push — master ( c01fee...eeab5f )
by Daniele
02:33
created

FluidAliasesTrait::size()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace FluidXml;
4
5 View Code Duplication
trait FluidAliasesTrait
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...
6
{
7
8
        // Alias of ->length().
9
        public function size()
10
        {
11
                return $this->length();
0 ignored issues
show
Bug introduced by
It seems like length() 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...
12
        }
13
14
        // Alias of ->query().
15
        public function __invoke(...$query)
16
        {
17
                return $this->query(...$query);
0 ignored issues
show
Bug introduced by
It seems like query() 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...
18
        }
19
20
        // Alias of ->addChild().
21
        public function add($child, ...$optionals)
22
        {
23
                return $this->addChild($child, ...$optionals);
0 ignored issues
show
Bug introduced by
It seems like addChild() 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...
24
        }
25
26
        // Alias of ->prependSibling().
27
        public function prepend($sibling, ...$optionals)
28
        {
29
                return $this->prependSibling($sibling, ...$optionals);
0 ignored issues
show
Bug introduced by
The method prependSibling() does not exist on FluidXml\FluidAliasesTrait. Did you maybe mean prepend()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
30
        }
31
32
        // Alias of ->appendSibling().
33
        public function append($sibling, ...$optionals)
34
        {
35
                return $this->appendSibling($sibling, ...$optionals);
0 ignored issues
show
Bug introduced by
The method appendSibling() does not exist on FluidXml\FluidAliasesTrait. Did you maybe mean append()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
36
        }
37
38
        // Alias of ->setAttribute().
39
        public function attr(...$arguments)
40
        {
41
                return $this->setAttribute(...$arguments);
0 ignored issues
show
Bug introduced by
It seems like setAttribute() 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...
42
        }
43
44
        // Alias of ->setText().
45
        public function text($text)
46
        {
47
                return $this->setText($text);
0 ignored issues
show
Bug introduced by
It seems like setText() 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
        // Alias of ->setCdata().
51
        public function cdata($text)
52
        {
53
                return $this->setCdata($text);
0 ignored issues
show
Bug introduced by
It seems like setCdata() 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...
54
        }
55
56
        // Alias of ->setComment().
57
        public function comment($text)
58
        {
59
                return $this->setComment($text);
0 ignored issues
show
Bug introduced by
The method setComment() does not exist on FluidXml\FluidAliasesTrait. Did you maybe mean comment()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
60
        }
61
62
}
63