Skip to content

Commit

Permalink
Fix spacing issues and improve function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Jan 5, 2024
1 parent 1934de3 commit b1eb98b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions includes/CLI/Plugin_Check_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public function check( $args, $assoc_args ) {
'ignore-warnings' => false,
'ignore-errors' => false,
'include-experimental' => false,

)
);

Expand Down Expand Up @@ -236,7 +235,7 @@ static function ( $dirs ) use ( $excluded_directories ) {
}

/**
* Runs plugin list-checks.
* Lists the available checks for plugins.
*
* ## OPTIONS
*
Expand All @@ -260,16 +259,14 @@ static function ( $dirs ) use ( $excluded_directories ) {
* @param array $args List of the positional arguments.
* @param array $assoc_args List of the associative arguments.
*
* @throws WP_CLI\ExitException Show error if not valid runner.
* @throws WP_CLI\ExitException Show error if invalid format argument.
*/
public function list_checks( $args, $assoc_args ) {
$check_repo = new Default_Check_Repository();

$all_checks = array();

$checks_items = $check_repo->get_checks()->to_map();

foreach ( $checks_items as $key => $check ) {
foreach ( $check_repo->get_checks() as $key => $check ) {
$item = array();

$item['slug'] = $key;
Expand Down Expand Up @@ -297,7 +294,7 @@ public function list_checks( $args, $assoc_args ) {
}

/**
* Runs plugin list-check-categories.
* Lists the available check categories for plugins.
*
* ## OPTIONS
*
Expand Down Expand Up @@ -325,6 +322,8 @@ public function list_checks( $args, $assoc_args ) {
*
* @param array $args List of the positional arguments.
* @param array $assoc_args List of the associative arguments.
*
* @throws WP_CLI\ExitException Show error if invalid format argument.
*/
public function list_check_categories( $args, $assoc_args ) {
// Get options based on the CLI arguments.
Expand Down Expand Up @@ -354,12 +353,10 @@ public function list_check_categories( $args, $assoc_args ) {
* @return array List of the check categories.
*/
private function get_check_categories() {
$categories = array();

$check_categories = new Check_Categories();
$categories_slugs = $check_categories->get_categories();

$categories = array_map(
return array_map(
function ( $slug ) {
return array(
'slug' => $slug,
Expand All @@ -368,8 +365,6 @@ function ( $slug ) {
},
$categories_slugs
);

return $categories;
}

/**
Expand Down

0 comments on commit b1eb98b

Please sign in to comment.