Skip to content

Commit

Permalink
API Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Nov 25, 2022
1 parent fe4865a commit 2029095
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions src/RecipeInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,39 +220,4 @@ public function installLibrary(PackageInterface $package)
);
}
}

/**
* Perform any file rewrites necessary to a relative path of a file being installed.
* E.g. if 'mysite' folder exists, rewrite 'mysite' to 'app' and 'mysite/code' to 'app/src'
*
* This will be removed in 2.0 as the app folder will be hard coded and no rewrites supported.
*
* @deprecated 1.2.0 Will be removed without equivalent functionality to replace it
* @param string $destinationRoot Project root
* @param string $relativePath Relative path to the resource being installed
* @return string Relative path we should write to
*/
protected function rewriteFilePath($destinationRoot, $relativePath)
{
// If app folder exists, no rewrite
if (is_dir($destinationRoot . DIRECTORY_SEPARATOR . 'app')) {
return $relativePath;
}
// if mysite folder does NOT exist, no rewrite
if (!is_dir($destinationRoot . DIRECTORY_SEPARATOR . 'mysite')) {
return $relativePath;
}

// Return first rewrite
$rewrites = [
'app/src' => 'mysite/code',
'app' => 'mysite',
];
foreach ($rewrites as $from => $to) {
if (stripos($relativePath ?? '', $from ?? '') === 0) {
return $to . substr($relativePath ?? '', strlen($from ?? ''));
}
}
return $relativePath;
}
}

0 comments on commit 2029095

Please sign in to comment.