Passed
Branch 8.x-1.x (e6d5ba)
by Frédéric G.
03:03
created

QaCommands::forceRemoved()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Drupal\qa\Commands;
4
5
use Drupal\qa\Controller\WorkflowsReportController;
6
use Drupal\qa\Workflows\ContentModerationGraph;
7
use Drupal\qa\Workflows\ContentModerationGrid;
8
use Drush\Commands\DrushCommands;
0 ignored issues
show
Bug introduced by
The type Drush\Commands\DrushCommands was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use OSInet\qa\ForceRemoved;
10
use Symfony\Component\Yaml\Yaml;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Yaml\Yaml was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
/**
13
 * A Drush commandfile.
14
 *
15
 * In addition to this file, you need a drush.services.yml
16
 * in root of your module, and a composer.json file that provides the name
17
 * of the services file to use.
18
 *
19
 * See these files for an example of injecting Drupal services:
20
 *   - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php
21
 *   - http://cgit.drupalcode.org/devel/tree/drush.services.yml
22
 */
23
class QaCommands extends DrushCommands {
24
25
  /**
26
   * Show the content moderation as a table.
27
   *
28
   *
29
   * @command como:table
30
   * @aliases cmt,como-table
31
   */
32
  public function table() {
33
    $table = ContentModerationGrid::create(\Drupal::getContainer());
34
    $table->report();
35
  }
36
37
  /**
38
   * Show the content moderation as a Graphviz DOT file.
39
   *
40
   * @param $workflow
41
   *   The machine name of a workflow
42
   *
43
   * @command como:graphviz
44
   * @aliases cmg,como-graphviz
45
   */
46
  public function graphviz($workflow = NULL) {
47
    $graph = ContentModerationGraph::create(\Drupal::getContainer());
48
    echo $graph->report();
49
  }
50
51
52
  /**
53
   * Show a summary of available workflows
54
   *
55
   *
56
   * @command qa:workflows-list
57
   * @aliases qawl,qa-workflows-list
58
   */
59
  public function workflowsList() {
60
    $listBuilder = WorkflowsReportController::create(\Drupal::getContainer());
61
    $list = $listBuilder->getWorkflowSummary(
62
      $listBuilder->storage->loadMultiple()
63
    );
64
    $this->output->writeln(Yaml::dump($list));
65
  }
66
67
  /**
68
   * Build a Graphviz DOT file showing the module and theme dependencies.
69
   *
70
   *
71
   * @command qa:dependencies
72
   * @aliases qadep,qa-dependencies
73
   */
74
  public function dependencies() {
75
    /** @var \Drupal\qa\Dependencies $qaDep */
76
    $qaDep = \Drupal::service('qa.dependencies');
77
    $G = $qaDep->build();
78
    echo $G->build();
79
  }
80
81
  /**
82
   * List extensions removed without a clean uninstall.
83
   *
84
   *
85
   * @command qa:force-removed
86
   * @aliases qafrm,qa-force-removed
87
   */
88
  public function forceRemoved() {
89
    $finder = ForceRemoved::create();
90
    echo $finder->find();
91
  }
92
93
}
94