This method 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...
55
{
56
17
$order = strtolower($order);
57
17
if (!preg_match('/\A(asc|desc)(?:ending)?\z/', $order, $m)) {
58
throw new BadKeywordException('Order must be "asc", "ascending", "desc" or "descending"');
59
}
60
17
return $m[1];
61
}
62
63
/**
64
* @return array
65
*/
66
17
public function toArray()
67
{
68
17
return [$this->column, $this->order];
69
}
70
71
/**
72
* @return string
73
*/
74
10
public function column()
75
{
76
10
return $this->column;
77
}
78
79
/**
80
* @return string
81
*/
82
10
public function order()
83
{
84
10
return $this->order;
85
}
86
87
/**
88
* @return bool
89
*/
90
public function ascending()
91
{
92
return $this->order === static::ASCENDING;
93
}
94
95
/**
96
* @return bool
97
*/
98
public function descending()
99
{
100
return $this->order === static::DESCENDING;
101
}
102
103
/**
104
* @return static
105
*/
106
12
public function inverse()
107
{
108
12
return new static($this->column, $this->order === static::ASCENDING ? static::DESCENDING : static::ASCENDING);
This check looks for function calls that miss required arguments.