Skip to content

Commit

Permalink
Updates for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bookwyrm committed Sep 23, 2019
1 parent 968893e commit e3d8720
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,39 +150,39 @@ public function sortable($sortable)
* Check if an orderby field is a custom sort option.
* @param string $orderby the orderby value from query params
*/
public function is_sortable($orderby)
public function isSortable($orderby)
{
if ( array_key_exists($orderby, $this->sortable) ) {
return true;
}

foreach ($this->sortable as $column => $options) {
if ( is_string($options) && $options === $orderby ) {
return true;
}
if ( is_array($options) && isset($options[0]) && $options[0] === $orderby ) {
return true;
}
}

return false;
if (array_key_exists($orderby, $this->sortable)) {
return true;
}

foreach ($this->sortable as $column => $options) {
if (is_string($options) && $options === $orderby) {
return true;
}
if (is_array($options) && isset($options[0]) && $options[0] === $orderby) {
return true;
}
}

return false;
}

/**
* Get meta key for an orderby.
* @param string $orderby the orderby value from query params
*/
public function sortable_meta($orderby)
public function sortableMeta($orderby)
{
if ( array_key_exists($orderby, $this->sortable) ) {
if (array_key_exists($orderby, $this->sortable)) {
return $this->sortable[$orderby];
}

foreach ($this->sortable as $column => $options) {
if ( is_string($options) && $options === $orderby ) {
if (is_string($options) && $options === $orderby) {
return $options;
}
if ( is_array($options) && isset($options[0]) && $options[0] === $orderby ) {
if (is_array($options) && isset($options[0]) && $options[0] === $orderby) {
return $options;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ public function sortSortableColumns($query)
$orderby = $query->get('orderby');

// if the sorting a custom column
if ( $this->columns()->is_sortable($orderby) ) {
if ($this->columns()->isSortable($orderby)) {
// get the custom column options
$meta = $this->columns()->sortable_meta($orderby);
$meta = $this->columns()->sortableMeta($orderby);

// determine type of ordering
if (is_string($meta)) {
Expand Down

0 comments on commit e3d8720

Please sign in to comment.