Skip to content

Cut unused functions #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions FindUnusedClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,42 +92,4 @@ public function isARegisteredController($className)
{
return in_array($className, $this->controllerNames);
}

public function ignoreCommonStuff($funcName, $fileName)
{
if ($funcName == 'handle' and preg_match('/(Middleware|Listeners|Commands)/', $fileName) === 1) {
return true;
}
if ($funcName == 'broadcastOn' and preg_match('/Events/', $fileName) === 1) {
return true;
}

return in_array($funcName, $this->crudNames) and Str::contains($fileName, 'Controller');
}

public function shouldConsider($filename)
{
if (Str::contains($filename, 'ServiceProvider')) {
return false;
}
if (Str::contains($filename, 'Policies')) {
return false;
}
if (Str::contains($filename, 'Observers')) {
return false;
}
return true;
}

protected function mangleLaravelNames($fName)
{
$match = '';
if (preg_match('/^scope(.+$)/', $fName, $match) === 1) {
return Str::camel($match[1]);
}
if (preg_match('/^(get|set)(.+)Attribute$/', $fName, $match) === 1) {
return Str::snake($match[2]);
}
return $fName;
}
}