public function getViolationMessage(Violation $violation)
 {
     foreach ($this->messages as $message) {
         if ($message->supports($violation->getUsage())) {
             return $message->message($violation->getUsage());
         }
     }
     // fallback
     $classNamespace = explode('\\', get_class($violation->getUsage()));
     return sprintf('Deprecated %s <info>%s</info>', array_pop($classNamespace), $violation->getUsage()->name());
 }
 /**
  * {@inheritdoc}
  */
 public function isViolationFiltered(Violation $violation)
 {
     $usage = $violation->getUsage();
     if (!$usage instanceof MethodUsage) {
         return false;
     }
     $className = $usage->className();
     $method = $usage->name();
     $usageString = sprintf('%s::%s', $className, $method);
     return in_array($usageString, $this->filterArray);
 }
 public function testGetters()
 {
     $usage = $this->prophesize('SensioLabs\\DeprecationDetector\\FileInfo\\Usage\\UsageInterface');
     $usage->getLineNumber()->willReturn(10);
     $usage = $usage->reveal();
     $file = $this->prophesize('SensioLabs\\DeprecationDetector\\FileInfo\\PhpFileInfo');
     $file = $file->reveal();
     $violation = new Violation($usage, $file, 'comment');
     $this->assertEquals(10, $violation->getLine());
     $this->assertEquals($usage, $violation->getUsage());
     $this->assertEquals($file, $violation->getFile());
     $this->assertEquals('comment', $violation->getComment());
 }