Conditions | 1 |
Total Lines | 65 |
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 |
||
48 | private $mainContainer; |
||
49 | |||
50 | public function setUp() |
||
51 | { |
||
52 | $this->mainContainer = new Picotainer([ |
||
53 | Schema::class => function(ContainerInterface $container) { |
||
54 | return new Schema($container->get(QueryProviderInterface::class), $container->get(RecursiveTypeMapperInterface::class)); |
||
55 | }, |
||
56 | QueryProviderInterface::class => function(ContainerInterface $container) { |
||
57 | return new GlobControllerQueryProvider('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers', $container->get(ControllerQueryProviderFactory::class), |
||
58 | $container->get(RecursiveTypeMapperInterface::class), $container->get(BasicAutoWiringContainer::class), new ArrayCache()); |
||
59 | }, |
||
60 | ControllerQueryProviderFactory::class => function(ContainerInterface $container) { |
||
61 | return new ControllerQueryProviderFactory( |
||
62 | $container->get(AnnotationReader::class), |
||
63 | $container->get(HydratorInterface::class), |
||
64 | $container->get(AuthenticationServiceInterface::class), |
||
65 | $container->get(AuthorizationServiceInterface::class), |
||
66 | $container->get(BasicAutoWiringContainer::class), |
||
67 | $container->get(CachedDocBlockFactory::class) |
||
68 | ); |
||
69 | }, |
||
70 | BasicAutoWiringContainer::class => function(ContainerInterface $container) { |
||
|
|||
71 | return new BasicAutoWiringContainer(new EmptyContainer()); |
||
72 | }, |
||
73 | AuthorizationServiceInterface::class => function(ContainerInterface $container) { |
||
74 | return new VoidAuthorizationService(); |
||
75 | }, |
||
76 | AuthenticationServiceInterface::class => function(ContainerInterface $container) { |
||
77 | return new VoidAuthenticationService(); |
||
78 | }, |
||
79 | RecursiveTypeMapperInterface::class => function(ContainerInterface $container) { |
||
80 | return new RecursiveTypeMapper($container->get(TypeMapperInterface::class), $container->get(NamingStrategyInterface::class), new ArrayCache()); |
||
81 | }, |
||
82 | TypeMapperInterface::class => function(ContainerInterface $container) { |
||
83 | return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Types', |
||
84 | $container->get(TypeGenerator::class), |
||
85 | $container->get(InputTypeGenerator::class), |
||
86 | $container->get(BasicAutoWiringContainer::class), |
||
87 | $container->get(AnnotationReader::class), |
||
88 | $container->get(NamingStrategyInterface::class), |
||
89 | new ArrayCache() |
||
90 | ); |
||
91 | }, |
||
92 | TypeGenerator::class => function(ContainerInterface $container) { |
||
93 | return new TypeGenerator( |
||
94 | $container->get(AnnotationReader::class), |
||
95 | $container->get(ControllerQueryProviderFactory::class), |
||
96 | $container->get(NamingStrategyInterface::class) |
||
97 | ); |
||
98 | }, |
||
99 | InputTypeGenerator::class => function(ContainerInterface $container) { |
||
100 | return new InputTypeGenerator( |
||
101 | $container->get(AnnotationReader::class), |
||
102 | $container->get(ControllerQueryProviderFactory::class), |
||
103 | $container->get(NamingStrategyInterface::class), |
||
104 | $container->get(HydratorInterface::class) |
||
105 | ); |
||
106 | }, |
||
107 | AnnotationReader::class => function(ContainerInterface $container) { |
||
108 | return new AnnotationReader(new DoctrineAnnotationReader()); |
||
109 | }, |
||
110 | HydratorInterface::class => function(ContainerInterface $container) { |
||
111 | return new FactoryHydrator(); |
||
112 | }, |
||
113 | NamingStrategyInterface::class => function() { |
||
220 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.