Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
Code Lines | 1 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
43 | public function __invoke(Action $action) |
||
44 | { |
||
45 | // $project = $this->analyzer->getProjectDescriptor(); |
||
46 | // try { |
||
47 | // $this->checkIfGraphVizIsInstalled(); |
||
48 | // } catch (\Exception $e) { |
||
49 | // echo $e->getMessage(); |
||
50 | // |
||
51 | // return; |
||
52 | // } |
||
53 | // |
||
54 | // $graph = GraphVizGraph::create() |
||
55 | // ->setRankSep('1.0') |
||
56 | // ->setCenter('true') |
||
57 | // ->setRank('source') |
||
58 | // ->setRankDir('RL') |
||
59 | // ->setSplines('true') |
||
60 | // ->setConcentrate('true'); |
||
61 | // |
||
62 | // $this->buildNamespaceTree($graph, $project->getNamespace()); |
||
63 | // |
||
64 | // $classes = $project->getIndexes()->get('classes', new Collection())->getAll(); |
||
65 | // $interfaces = $project->getIndexes()->get('interfaces', new Collection())->getAll(); |
||
66 | // $traits = $project->getIndexes()->get('traits', new Collection())->getAll(); |
||
67 | // |
||
68 | // /** @var ClassDescriptor[]|InterfaceDescriptor[]|TraitDescriptor[] $containers */ |
||
69 | // $containers = array_merge($classes, $interfaces, $traits); |
||
70 | // |
||
71 | // foreach ($containers as $container) { |
||
72 | // $from_name = $container->getFullyQualifiedStructuralElementName(); |
||
73 | // |
||
74 | // $parents = array(); |
||
75 | // $implemented = array(); |
||
76 | // if ($container instanceof ClassDescriptor) { |
||
77 | // if ($container->getParent()) { |
||
78 | // $parents[] = $container->getParent(); |
||
79 | // } |
||
80 | // $implemented = $container->getInterfaces()->getAll(); |
||
81 | // } |
||
82 | // if ($container instanceof InterfaceDescriptor) { |
||
83 | // $parents = $container->getParent()->getAll(); |
||
84 | // } |
||
85 | // |
||
86 | // /** @var string|ClassDescriptor|InterfaceDescriptor $parent */ |
||
87 | // foreach ($parents as $parent) { |
||
88 | // $edge = $this->createEdge($graph, $from_name, $parent); |
||
89 | // $edge->setArrowHead('empty'); |
||
90 | // $graph->link($edge); |
||
91 | // } |
||
92 | // |
||
93 | // /** @var string|ClassDescriptor|InterfaceDescriptor $parent */ |
||
94 | // foreach ($implemented as $parent) { |
||
95 | // $edge = $this->createEdge($graph, $from_name, $parent); |
||
96 | // $edge->setStyle('dotted'); |
||
97 | // $edge->setArrowHead('empty'); |
||
98 | // $graph->link($edge); |
||
99 | // } |
||
100 | // } |
||
101 | // |
||
102 | // $destination = $action->getRenderContext()->getDestination() . '/' . $action->getDestination(); |
||
103 | // if (! file_exists(dirname($destination))) { |
||
104 | // @mkdir(dirname($destination), 0777, true); |
||
105 | // } |
||
106 | // $graph->export('svg', $destination); |
||
107 | } |
||
108 | |||
222 |
This check marks private properties in classes that are never used. Those properties can be removed.