static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
<?php include './sermon.php'; include './sermon_repository.php'; header('Content-type/application-json'); try { $sermonRepository = sermon_repository::getInstance(); $sermons = $sermonRepository->getAll(); echo json_encode($sermons); } catch (Exception $e) { echo $e->getMessage(); }