Field   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 62
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 3 1
A getName() 0 3 1
A setSubmitValue() 0 3 1
A getSubmitValue() 0 3 1
A setDisabled() 0 3 1
A getDisabled() 0 3 1
A setValue() 0 3 1
A getValue() 0 3 1
1
<?php
2
/**
3
 * ExtForms - Field.php
4
 *
5
 * Initial version by: MisterX
6
 * Initial version created on: 31.07.2015
7
 */
8
9
namespace Ext\Form\Field;
10
11
12
trait Field
13
{
14
	/**
15
	 * The name of the field.To prevent the field from being included in the form submit, set submitValue to false.
16
	 * @param $name
17
	 * @return mixed
18
	 */
19
	public function setName($name){
20
		return $this->setProperty('name',$name);
0 ignored issues
show
Bug introduced by
It seems like setProperty() 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...
21
	}
22
	
23
	public function getName(){
24
		return $this->getProperty('name');
0 ignored issues
show
Bug introduced by
It seems like getProperty() 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
	/**
30
	 * Setting this to false will prevent the field from being submitted even when it is not disabled.
31
	 * @param bool $submitValue
32
	 * @return mixed
33
	 */
34
	public function setSubmitValue($submitValue){
35
		return $this->setProperty('submitValue',$submitValue);
0 ignored issues
show
Bug introduced by
It seems like setProperty() 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...
36
	}
37
38
	public function getSubmitValue(){
39
		return $this->getProperty('submitValue');
0 ignored issues
show
Bug introduced by
It seems like getProperty() 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
43
44
	/**
45
	 * True to disable the field. Disabled Fields will not be submitted.
46
	 * @param $disabled
47
	 * @return mixed
48
	 */
49
	public function setDisabled($disabled){
50
		return $this->setProperty('disabled',(bool)$disabled);
0 ignored issues
show
Bug introduced by
It seems like setProperty() 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...
51
	}
52
53
	public function getDisabled(){
54
		return $this->getProperty('disabled');
0 ignored issues
show
Bug introduced by
It seems like getProperty() 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
	/**
60
	 * A value to initialize this field with.
61
	 * @param $value
62
	 * @return mixed
63
	 */
64
	public function setValue($value){
65
		return $this->setProperty('value',$value);
0 ignored issues
show
Bug introduced by
It seems like setProperty() 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...
66
	}
67
68
	public function getValue(){
69
		return $this->getProperty('value');
0 ignored issues
show
Bug introduced by
It seems like getProperty() 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...
70
	}
71
72
73
}