You are here

public function SiteAuditCheckAbstract::getRelativePath in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Check/Abstract.php \SiteAuditCheckAbstract::getRelativePath()

Gives path relative to DRUPAL_ROOT of the path is inside Drupal.

Parameters

string $filename: Absolute path of a file or directory.

Return value

string Path relative to Drupal root path.

4 calls to SiteAuditCheckAbstract::getRelativePath()
SiteAuditCheckCodebasePhpCodeSniffer::calculateScore in Check/Codebase/PhpCodeSniffer.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpCopyPasteDetection::getResultWarn in Check/Codebase/PhpCopyPasteDetection.php
Implements \SiteAudit\Check\Abstract\getResultWarn().
SiteAuditCheckCodebasePhpDeadCodeDetection::calculateScore in Check/Codebase/PhpDeadCodeDetection.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpMessDetection::calculateScore in Check/Codebase/PhpMessDetection.php
Implements \SiteAudit\Check\Abstract\calculateScore().

File

Check/Abstract.php, line 393
Contains \SiteAudit\Check\Abstract.

Class

SiteAuditCheckAbstract
Class SiteAuditCheckAbstract.

Code

public function getRelativePath($filename) {
  $pos = strpos($filename, DRUPAL_ROOT);
  if ($pos !== FALSE) {
    $filename = substr($filename, $pos + strlen(DRUPAL_ROOT) + 1);
  }
  return $filename;
}