Conditions | 1 |
Paths | 1 |
Total Lines | 113 |
Code Lines | 81 |
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 |
||
57 | public function setUp() |
||
58 | { |
||
59 | $this->mainContainer = new Picotainer([ |
||
60 | Schema::class => function(ContainerInterface $container) { |
||
61 | return new Schema($container->get(QueryProviderInterface::class), $container->get(RecursiveTypeMapperInterface::class), $container->get(TypeResolver::class)); |
||
62 | }, |
||
63 | QueryProviderInterface::class => function(ContainerInterface $container) { |
||
64 | return new GlobControllerQueryProvider('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers', $container->get(FieldsBuilderFactory::class), |
||
65 | $container->get(RecursiveTypeMapperInterface::class), $container->get(BasicAutoWiringContainer::class), new ArrayCache()); |
||
66 | }, |
||
67 | FieldsBuilderFactory::class => function(ContainerInterface $container) { |
||
68 | return new FieldsBuilderFactory( |
||
69 | $container->get(AnnotationReader::class), |
||
70 | $container->get(HydratorInterface::class), |
||
71 | $container->get(AuthenticationServiceInterface::class), |
||
72 | $container->get(AuthorizationServiceInterface::class), |
||
73 | $container->get(TypeResolver::class), |
||
74 | $container->get(CachedDocBlockFactory::class), |
||
75 | $container->get(NamingStrategyInterface::class) |
||
76 | ); |
||
77 | }, |
||
78 | TypeResolver::class => function(ContainerInterface $container) { |
||
|
|||
79 | return new TypeResolver(); |
||
80 | }, |
||
81 | BasicAutoWiringContainer::class => function(ContainerInterface $container) { |
||
82 | return new BasicAutoWiringContainer(new EmptyContainer()); |
||
83 | }, |
||
84 | AuthorizationServiceInterface::class => function(ContainerInterface $container) { |
||
85 | return new VoidAuthorizationService(); |
||
86 | }, |
||
87 | AuthenticationServiceInterface::class => function(ContainerInterface $container) { |
||
88 | return new VoidAuthenticationService(); |
||
89 | }, |
||
90 | RecursiveTypeMapperInterface::class => function(ContainerInterface $container) { |
||
91 | return new RecursiveTypeMapper( |
||
92 | $container->get(TypeMapperInterface::class), |
||
93 | $container->get(NamingStrategyInterface::class), |
||
94 | new ArrayCache(), |
||
95 | $container->get(TypeRegistry::class) |
||
96 | ); |
||
97 | }, |
||
98 | TypeMapperInterface::class => function(ContainerInterface $container) { |
||
99 | return new CompositeTypeMapper([ |
||
100 | $container->get(GlobTypeMapper::class), |
||
101 | $container->get(GlobTypeMapper::class.'2'), |
||
102 | $container->get(PorpaginasTypeMapper::class), |
||
103 | ]); |
||
104 | }, |
||
105 | GlobTypeMapper::class => function(ContainerInterface $container) { |
||
106 | return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Types', |
||
107 | $container->get(TypeGenerator::class), |
||
108 | $container->get(InputTypeGenerator::class), |
||
109 | $container->get(InputTypeUtils::class), |
||
110 | $container->get(BasicAutoWiringContainer::class), |
||
111 | $container->get(AnnotationReader::class), |
||
112 | $container->get(NamingStrategyInterface::class), |
||
113 | new ArrayCache() |
||
114 | ); |
||
115 | }, |
||
116 | GlobTypeMapper::class.'2' => function(ContainerInterface $container) { |
||
117 | return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Models', |
||
118 | $container->get(TypeGenerator::class), |
||
119 | $container->get(InputTypeGenerator::class), |
||
120 | $container->get(InputTypeUtils::class), |
||
121 | $container->get(BasicAutoWiringContainer::class), |
||
122 | $container->get(AnnotationReader::class), |
||
123 | $container->get(NamingStrategyInterface::class), |
||
124 | new ArrayCache() |
||
125 | ); |
||
126 | }, |
||
127 | PorpaginasTypeMapper::class => function() { |
||
128 | return new PorpaginasTypeMapper(); |
||
129 | }, |
||
130 | TypeGenerator::class => function(ContainerInterface $container) { |
||
131 | return new TypeGenerator( |
||
132 | $container->get(AnnotationReader::class), |
||
133 | $container->get(FieldsBuilderFactory::class), |
||
134 | $container->get(NamingStrategyInterface::class), |
||
135 | $container->get(TypeRegistry::class), |
||
136 | $container->get(BasicAutoWiringContainer::class) |
||
137 | ); |
||
138 | }, |
||
139 | TypeRegistry::class => function() { |
||
140 | return new TypeRegistry(); |
||
141 | }, |
||
142 | InputTypeGenerator::class => function(ContainerInterface $container) { |
||
143 | return new InputTypeGenerator( |
||
144 | $container->get(InputTypeUtils::class), |
||
145 | $container->get(FieldsBuilderFactory::class), |
||
146 | $container->get(HydratorInterface::class) |
||
147 | ); |
||
148 | }, |
||
149 | InputTypeUtils::class => function(ContainerInterface $container) { |
||
150 | return new InputTypeUtils( |
||
151 | $container->get(AnnotationReader::class), |
||
152 | $container->get(NamingStrategyInterface::class) |
||
153 | ); |
||
154 | }, |
||
155 | AnnotationReader::class => function(ContainerInterface $container) { |
||
156 | return new AnnotationReader(new DoctrineAnnotationReader()); |
||
157 | }, |
||
158 | HydratorInterface::class => function(ContainerInterface $container) { |
||
159 | return new FactoryHydrator(); |
||
160 | }, |
||
161 | NamingStrategyInterface::class => function() { |
||
162 | return new NamingStrategy(); |
||
163 | }, |
||
164 | CachedDocBlockFactory::class => function() { |
||
165 | return new CachedDocBlockFactory(new ArrayCache()); |
||
166 | } |
||
167 | ]); |
||
168 | |||
169 | $this->mainContainer->get(TypeResolver::class)->registerSchema($this->mainContainer->get(Schema::class)); |
||
170 | } |
||
464 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.