Completed
Push — master ( 79b035...e37d9a )
by Jean-Christophe
03:44
created

BootstrapComponentsTrait::tooltip()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Ajax\bootstrap\traits;
4
5
use Ajax\common\components\GenericComponent;
6
use Ajax\bootstrap\components\Modal;
7
use Ajax\bootstrap\components\Tooltip;
8
use Ajax\bootstrap\components\Popover;
9
use Ajax\bootstrap\components\Dropdown;
10
use Ajax\bootstrap\components\Splitbutton;
11
use Ajax\bootstrap\components\Tab;
12
use Ajax\bootstrap\components\Carousel;
13
use Ajax\bootstrap\components\Collapse;
14
15
trait BootstrapComponentsTrait {
16
17
	/**
18
	 *
19
	 * @param string $attachTo
20
	 * @param string|array $params
21
	 * @return $this
22
	 */
23
	public function generic($attachTo=NULL, $params=NULL) {
24
		return $this->addComponent(new GenericComponent($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
The property js does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like addComponent() 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
	 *
29
	 * @param string $attachTo
30
	 * @param string|array $params
31
	 * @return $this
32
	 */
33
	public function modal($attachTo=NULL, $params=NULL) {
34
		return $this->addComponent(new Modal($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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
	 *
39
	 * @param string $attachTo
40
	 * @param string|array $params
41
	 * @return $this
42
	 */
43
	public function tooltip($attachTo=NULL, $params=NULL) {
44
		return $this->addComponent(new Tooltip($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
45
	}
46
47
	/**
48
	 *
49
	 * @param string $attachTo
50
	 * @param string|array $params
51
	 * @return $this
52
	 */
53
	public function popover($attachTo=NULL, $params=NULL) {
54
		return $this->addComponent(new Popover($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
55
	}
56
57
	/**
58
	 *
59
	 * @param string $attachTo
60
	 * @param string|array $params
61
	 * @return $this
62
	 */
63
	public function dropdown($attachTo=NULL, $params=NULL) {
64
		return $this->addComponent(new Dropdown($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
65
	}
66
67
	/**
68
	 *
69
	 * @param string $attachTo
70
	 * @param string|array $params
71
	 * @return $this
72
	 */
73
	public function splitbutton($attachTo=NULL, $params=NULL) {
74
		return $this->addComponent(new Splitbutton($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
75
	}
76
77
	/**
78
	 *
79
	 * @param string $attachTo
80
	 * @param string|array $params
81
	 * @return $this
82
	 */
83
	public function tab($attachTo=NULL, $params=NULL) {
84
		return $this->addComponent(new Tab($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
85
	}
86
87
	/**
88
	 *
89
	 * @param string $attachTo
90
	 * @param string|array $params
91
	 * @return $this
92
	 */
93
	public function collapse($attachTo=NULL, $params=NULL) {
94
		return $this->addComponent(new Collapse($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
95
	}
96
97
	/**
98
	 *
99
	 * @param string $attachTo
100
	 * @param string|array $params
101
	 * @return $this
102
	 */
103
	public function carousel($attachTo=NULL, $params=NULL) {
104
		return $this->addComponent(new Carousel($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
It seems like addComponent() 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...
105
	}
106
}