Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #121 from fiskhandlarn/patch-2
Browse files Browse the repository at this point in the history
Use ReflectionClass to determine Controller inheritance
  • Loading branch information
Darren Jacoby authored Jul 17, 2019
2 parents 4bb384f + fa020a5 commit 523d3fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function setClassesToRun()
}

// Exclude non-Controller classes
if (!Utils::doesFileContain($filename, 'extends Controller')) {
if (!$reflection->isSubclassOf('Sober\Controller\Controller')) {
continue;
}

Expand Down
11 changes: 0 additions & 11 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ public static function isFilePhp($filename)
return (in_array(pathinfo($filename, PATHINFO_EXTENSION), ['php']));
}

/**
* Does File Contain
*
* Determine if the file contains a string
* @return boolean
*/
public static function doesFileContain($filename, $str)
{
return strpos(file_get_contents($filename), $str) !== false;
}

/**
* Is Array Indexed
*
Expand Down

0 comments on commit 523d3fd

Please sign in to comment.