Skip to content

Commit

Permalink
Make naming consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 6, 2023
1 parent a12783f commit 8b91013
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions includes/Checker/AJAX_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ protected function get_check_slugs_param() {
}

/**
* Returns an array of Check slugs to ignore based on the request.
* Returns an array of Check slugs to exclude based on the request.
*
* @since n.e.x.t
*
* @return array An array of Check slugs to ignore.
* @return array An array of Check slugs to exclude.
*/
protected function get_check_ignore_slugs_param() {
protected function get_check_exclude_slugs_param() {
$checks = filter_input( INPUT_POST, 'ignore-checks', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
$checks = is_null( $checks ) ? array() : $checks;

Expand Down
29 changes: 15 additions & 14 deletions includes/Checker/Abstract_Check_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ abstract class Abstract_Check_Runner implements Check_Runner {
protected $check_slugs;

/**
* The check slugs to ignore.
* The check slugs to exclude.
*
* @since n.e.x.t
* @var array
*/
protected $check_ignore_slugs;
protected $check_exclude_slugs;

/**
* The plugin parameter.
Expand Down Expand Up @@ -117,14 +117,15 @@ abstract protected function get_plugin_param();
* @return array An array of Check slugs.
*/
abstract protected function get_check_slugs_param();

/**
* Returns an array of Check slugs to ignore based on the request.
* Returns an array of Check slugs to exclude based on the request.
*
* @since n.e.x.t
*
* @return array An array of Check slugs.
*/
abstract protected function get_check_ignore_slugs_param();
abstract protected function get_check_exclude_slugs_param();

/**
* Returns the include experimental parameter based on the request.
Expand Down Expand Up @@ -186,17 +187,17 @@ final public function set_check_slugs( array $check_slugs ) {
*
* @throws Exception Thrown if the checks do not match those in the original request.
*/
final public function set_check_ignore_slugs( array $check_slugs ) {
final public function set_check_exclude_slugs( array $check_slugs ) {
if ( $this->initialized_early ) {
// Compare the check slugs to see if there was an error.
if ( $check_slugs !== $this->get_check_ignore_slugs_param() ) {
if ( $check_slugs !== $this->get_check_exclude_slugs_param() ) {
throw new Exception(
__( 'Invalid checks: The checks to ignore do not match the original request.', 'plugin-check' )
);
}
}

$this->check_ignore_slugs = $check_slugs;
$this->check_exclude_slugs = $check_slugs;
}

/**
Expand Down Expand Up @@ -406,7 +407,7 @@ final public function get_checks_to_run() {
$check_flags = $check_flags | Check_Repository::INCLUDE_EXPERIMENTAL;
}

$excluded_checks = $this->get_check_ignore_slugs();
$excluded_checks = $this->get_check_exclude_slugs();

$collection = $this->check_repository->get_checks( $check_flags )
->include( $check_slugs ) // Ensures only the checks with the given slugs are included.
Expand Down Expand Up @@ -458,18 +459,18 @@ private function get_check_slugs() {
}

/**
* Returns the check slugs to ignore.
* Returns the check slugs to exclude.
*
* @since n.e.x.t
*
* @return array An array of check slugs to ignore.
* @return array An array of check slugs to exclude.
*/
private function get_check_ignore_slugs() {
if ( null !== $this->check_ignore_slugs ) {
return $this->check_ignore_slugs;
private function get_check_exclude_slugs() {
if ( null !== $this->check_exclude_slugs ) {
return $this->check_exclude_slugs;
}

return $this->get_check_ignore_slugs_param();
return $this->get_check_exclude_slugs_param();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions includes/Checker/CLI_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ protected function get_check_slugs_param() {
}

/**
* Returns an array of Check slugs to ignore based on the request.
* Returns an array of Check slugs to exclude based on the request.
*
* @since n.e.x.t
*
* @return array An array of Check slugs to run.
*/
protected function get_check_ignore_slugs_param() {
protected function get_check_exclude_slugs_param() {
$checks = array();

foreach ( $_SERVER['argv'] as $value ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/Default_Check_Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function include( array $check_slugs ): Check_Collection {
* @return Check_Collection New check collection, effectively a subset of this one.
*/
public function exclude( array $check_slugs ): Check_Collection {
// Return unmodified collection if no check slugs to ignore are given.
// Return unmodified collection if no check slugs to exclude are given.
if ( ! $check_slugs ) {
return $this;
}
Expand Down

0 comments on commit 8b91013

Please sign in to comment.