Conditions | 1 |
Total Lines | 87 |
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 |
||
27 | public static function objectRepositoryWithoutFindOneByOrderBy(): iterable |
||
28 | { |
||
29 | yield [new RepositoryProxy(new class() implements ObjectRepository { |
||
30 | public function find($id) |
||
31 | { |
||
32 | } |
||
33 | |||
34 | public function findAll() |
||
35 | { |
||
36 | } |
||
37 | |||
38 | public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) |
||
39 | { |
||
40 | } |
||
41 | |||
42 | public function findOneBy(array $criteria) |
||
43 | { |
||
44 | } |
||
45 | |||
46 | public function getClassName() |
||
47 | { |
||
48 | } |
||
49 | })]; |
||
50 | |||
51 | yield [new RepositoryProxy(new class() implements ObjectRepository { |
||
52 | public function find($id) |
||
53 | { |
||
54 | } |
||
55 | |||
56 | public function findAll() |
||
57 | { |
||
58 | } |
||
59 | |||
60 | public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) |
||
61 | { |
||
62 | } |
||
63 | |||
64 | public function findOneBy(array $criteria, ?array $foo = null) |
||
65 | { |
||
66 | } |
||
67 | |||
68 | public function getClassName() |
||
69 | { |
||
70 | } |
||
71 | })]; |
||
72 | |||
73 | yield [new RepositoryProxy(new class() implements ObjectRepository { |
||
74 | public function find($id) |
||
75 | { |
||
76 | } |
||
77 | |||
78 | public function findAll() |
||
79 | { |
||
80 | } |
||
81 | |||
82 | public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) |
||
83 | { |
||
84 | } |
||
85 | |||
86 | public function findOneBy(array $criteria, $orderBy = null) |
||
87 | { |
||
88 | } |
||
89 | |||
90 | public function getClassName() |
||
91 | { |
||
92 | } |
||
93 | })]; |
||
94 | |||
95 | yield [new RepositoryProxy(new class() implements ObjectRepository { |
||
96 | public function find($id) |
||
97 | { |
||
98 | } |
||
99 | |||
100 | public function findAll() |
||
101 | { |
||
102 | } |
||
103 | |||
104 | public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) |
||
105 | { |
||
106 | } |
||
107 | |||
108 | public function findOneBy(array $criteria, ?string $orderBy = null) |
||
109 | { |
||
110 | } |
||
111 | |||
112 | public function getClassName() |
||
113 | { |
||
114 | } |
||
118 |