/**
  * @param ReflectionClass $sus
  * @param Params          $params
  * @param Reporter        $reporter
  */
 public function check(ReflectionClass $sus, Params $params, Reporter $reporter)
 {
     foreach ($sus->getMethods() as $method) {
         if ($method->getNumberOfParameters() > $params->getDependenciesLimit()) {
             $reporter->act($sus, self::class, "{$method->getName()} has too many dependencies ({$method->getNumberOfParameters()})", 'Dependencies size');
         }
     }
 }
 function it_complains_if_the_number_of_dependencies_are_high(ReflectionClass $sus, Params $params, Reporter $reporter, ReflectionMethod $reflectionMethod)
 {
     $params->getDependenciesLimit()->willReturn(self::DEPENDENCIES_LIMIT);
     $sus->getName()->willReturn("Elfiggo/Brobdingnagian/Detector/DependenciesSize");
     $reflectionMethod->getName()->willReturn('random_method');
     $reflectionMethod->getNumberOfParameters()->willReturn(20);
     $sus->getMethods()->willReturn([$reflectionMethod]);
     $reporter->act($sus, 'Elfiggo\\Brobdingnagian\\Detector\\DependenciesSize', 'random_method has too many dependencies (20)', 'Dependencies size')->willThrow(DependenciesSizeTooLarge::class);
     $this->shouldThrow(DependenciesSizeTooLarge::class)->duringCheck($sus, $params, $reporter);
 }
 function it_should_analyse_the_number_of_methods_size(SpecificationEvent $specificationEvent, SpecificationNode $specificationNode, Params $params, Reporter $reporter)
 {
     $specificationEvent->getSpecification()->willReturn($specificationNode);
     $specificationNode->getTitle()->willReturn('Elfiggo\\Brobdingnagian\\Detector\\ClassSize');
     $this->shouldNotThrow('Elfiggo\\Brobdingnagian\\Exception\\TooManyMethodsDetected');
     $params->getClassSize()->willReturn(200);
     $params->getDependenciesLimit()->willReturn(2);
     $params->getNumberOfMethods()->willReturn(5);
     $params->getMethodSize()->willReturn(10);
     $params->getNumberOfInterfaces()->willReturn(2);
     $params->getNumberOfTraits()->willReturn(1);
     $this->analyse($specificationEvent, $params, $reporter);
 }