Conditions | 1 |
Paths | 1 |
Total Lines | 81 |
Code Lines | 56 |
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 |
||
53 | public function setUp() |
||
54 | { |
||
55 | $this->mainContainer = new Picotainer([ |
||
56 | Schema::class => function(ContainerInterface $container) { |
||
57 | return new Schema($container->get(QueryProviderInterface::class), $container->get(RecursiveTypeMapperInterface::class), $container->get(TypeResolver::class)); |
||
58 | }, |
||
59 | QueryProviderInterface::class => function(ContainerInterface $container) { |
||
60 | return new GlobControllerQueryProvider('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers', $container->get(FieldsBuilderFactory::class), |
||
61 | $container->get(RecursiveTypeMapperInterface::class), $container->get(BasicAutoWiringContainer::class), new ArrayCache()); |
||
62 | }, |
||
63 | FieldsBuilderFactory::class => function(ContainerInterface $container) { |
||
64 | return new FieldsBuilderFactory( |
||
65 | $container->get(AnnotationReader::class), |
||
66 | $container->get(HydratorInterface::class), |
||
67 | $container->get(AuthenticationServiceInterface::class), |
||
68 | $container->get(AuthorizationServiceInterface::class), |
||
69 | $container->get(TypeResolver::class), |
||
70 | $container->get(CachedDocBlockFactory::class) |
||
71 | ); |
||
72 | }, |
||
73 | TypeResolver::class => function(ContainerInterface $container) { |
||
|
|||
74 | return new TypeResolver(); |
||
75 | }, |
||
76 | BasicAutoWiringContainer::class => function(ContainerInterface $container) { |
||
77 | return new BasicAutoWiringContainer(new EmptyContainer()); |
||
78 | }, |
||
79 | AuthorizationServiceInterface::class => function(ContainerInterface $container) { |
||
80 | return new VoidAuthorizationService(); |
||
81 | }, |
||
82 | AuthenticationServiceInterface::class => function(ContainerInterface $container) { |
||
83 | return new VoidAuthenticationService(); |
||
84 | }, |
||
85 | RecursiveTypeMapperInterface::class => function(ContainerInterface $container) { |
||
86 | return new RecursiveTypeMapper($container->get(TypeMapperInterface::class), $container->get(NamingStrategyInterface::class), new ArrayCache()); |
||
87 | }, |
||
88 | TypeMapperInterface::class => function(ContainerInterface $container) { |
||
89 | return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Types', |
||
90 | $container->get(TypeGenerator::class), |
||
91 | $container->get(InputTypeGenerator::class), |
||
92 | $container->get(InputTypeUtils::class), |
||
93 | $container->get(BasicAutoWiringContainer::class), |
||
94 | $container->get(AnnotationReader::class), |
||
95 | $container->get(NamingStrategyInterface::class), |
||
96 | new ArrayCache() |
||
97 | ); |
||
98 | }, |
||
99 | TypeGenerator::class => function(ContainerInterface $container) { |
||
100 | return new TypeGenerator( |
||
101 | $container->get(AnnotationReader::class), |
||
102 | $container->get(FieldsBuilderFactory::class), |
||
103 | $container->get(NamingStrategyInterface::class) |
||
104 | ); |
||
105 | }, |
||
106 | InputTypeGenerator::class => function(ContainerInterface $container) { |
||
107 | return new InputTypeGenerator( |
||
108 | $container->get(InputTypeUtils::class), |
||
109 | $container->get(FieldsBuilderFactory::class), |
||
110 | $container->get(HydratorInterface::class) |
||
111 | ); |
||
112 | }, |
||
113 | InputTypeUtils::class => function(ContainerInterface $container) { |
||
114 | return new InputTypeUtils( |
||
115 | $container->get(AnnotationReader::class), |
||
116 | $container->get(NamingStrategyInterface::class) |
||
117 | ); |
||
118 | }, |
||
119 | AnnotationReader::class => function(ContainerInterface $container) { |
||
120 | return new AnnotationReader(new DoctrineAnnotationReader()); |
||
121 | }, |
||
122 | HydratorInterface::class => function(ContainerInterface $container) { |
||
123 | return new FactoryHydrator(); |
||
124 | }, |
||
125 | NamingStrategyInterface::class => function() { |
||
126 | return new NamingStrategy(); |
||
127 | }, |
||
128 | CachedDocBlockFactory::class => function() { |
||
129 | return new CachedDocBlockFactory(new ArrayCache()); |
||
130 | } |
||
131 | ]); |
||
132 | |||
133 | $this->mainContainer->get(TypeResolver::class)->registerSchema($this->mainContainer->get(Schema::class)); |
||
134 | } |
||
243 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.