interface_exists does not work how I expected, switch to is_subclass_of

This commit is contained in:
Dane Everitt 2017-09-30 12:06:16 -05:00
parent 048784607d
commit 238ce435d6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 12 additions and 1 deletions

View file

@ -242,6 +242,7 @@ class ServersController extends Controller
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function store(ServerFormRequest $request) public function store(ServerFormRequest $request)
{ {
@ -278,6 +279,8 @@ class ServersController extends Controller
* *
* @param int $server * @param int $server
* @return \Illuminate\View\View * @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function viewDetails($server) public function viewDetails($server)
{ {
@ -294,6 +297,8 @@ class ServersController extends Controller
* *
* @param int $server * @param int $server
* @return \Illuminate\View\View * @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function viewBuild($server) public function viewBuild($server)
{ {
@ -316,6 +321,8 @@ class ServersController extends Controller
* *
* @param int $server * @param int $server
* @return \Illuminate\View\View * @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function viewStartup($server) public function viewStartup($server)
{ {
@ -346,6 +353,8 @@ class ServersController extends Controller
* *
* @param int $server * @param int $server
* @return \Illuminate\View\View * @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function viewDatabase($server) public function viewDatabase($server)
{ {
@ -388,6 +397,7 @@ class ServersController extends Controller
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function setDetails(Request $request, Server $server) public function setDetails(Request $request, Server $server)
{ {
@ -409,6 +419,7 @@ class ServersController extends Controller
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function setContainer(Request $request, Server $server) public function setContainer(Request $request, Server $server)
{ {

View file

@ -187,7 +187,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf
public function all() public function all()
{ {
$instance = $this->getBuilder(); $instance = $this->getBuilder();
if (interface_exists(SearchableInterface::class)) { if (is_subclass_of(get_called_class(), SearchableInterface::class)) {
$instance = $instance->search($this->searchTerm); $instance = $instance->search($this->searchTerm);
} }