getFilename() public method

Return the filename.
public getFilename ( ) : string
return string
Example #1
0
 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::addCheckResults()
  *
  * @param File          $file
  * @param CheckResult[] $checkResults
  */
 public function addCheckResults(File $file, array $checkResults)
 {
     if (empty($this->loggedSeverities)) {
         return;
     }
     if ($this->firstFile) {
         $this->firstFile = false;
     } else {
         $this->write(PHP_EOL);
     }
     // TODO: Only output if the file has violations?
     $this->write('Checking ' . $file->getFilename() . PHP_EOL);
     $violations = [];
     foreach ($checkResults as $checkResult) {
         $violations = array_merge($violations, $this->getFilteredViolations($checkResult->getViolations()));
     }
     if ($violations) {
         $this->write($file->getFilename() . ':' . PHP_EOL);
         $this->write(str_repeat('-', 80) . PHP_EOL);
         foreach ($violations as $violation) {
             $this->write('Line ' . $violation->getLine());
             if ($violation->getColumn() > 0) {
                 $this->write(':' . $violation->getColumn());
             }
             $this->write(' (' . $violation->getSeverityName() . ') : ');
             $this->write($violation->getMessage() . PHP_EOL);
         }
         $this->write(PHP_EOL);
     }
     flush();
 }
Example #2
0
 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::addCheckResults()
  *
  * @param File        $file
  * @param CheckResult $checkResults
  */
 public function addCheckResults(File $file, array $checkResults)
 {
     foreach ($checkResults as $checkResult) {
         foreach ($checkResult->getViolations() as $violation) {
             $key = $this->getArrayKey($violation);
             if (!isset($this->report[$key])) {
                 $this->report[$key] = [];
             }
             $this->report[$key][] = ['file' => $file->getFilename(), 'line' => $violation->getLine(), 'column' => $violation->getColumn(), 'severity' => $violation->getSeverity(), 'message' => $violation->getMessage()];
         }
     }
 }
Example #3
0
 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::addCheckResults()
  *
  * @param File          $file
  * @param CheckResult[] $checkResults
  */
 public function addCheckResults(File $file, array $checkResults)
 {
     $this->writer->startElement('file');
     $this->writer->writeAttribute('name', $file->getFilename());
     foreach ($checkResults as $checkResult) {
         foreach ($checkResult->getViolations() as $violation) {
             $this->writer->startElement('error');
             $this->writer->writeAttribute('line', $violation->getLine());
             if ($violation->getColumn() > 0) {
                 $this->writer->writeAttribute('column', $violation->getColumn());
             }
             $this->writer->writeAttribute('severity', $violation->getSeverity());
             $this->writer->writeAttribute('message', $violation->getMessage());
             $this->writer->endElement();
         }
     }
     $this->writer->endElement();
 }