Skip to content

Commit

Permalink
Dev: Abort if class extended_type is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 6, 2016
1 parent de3bf36 commit ef407bf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion application/helpers/QuestionObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
*/
namespace ls\helpers;

class QuestionObjectException extends \CException {}

/**
* Entry point for the question object system.
* @since 2016-10-06
* @author Olle Haerstedt
*/
final class QuestionObjectHelper {
final class QuestionObjectHelper
{

/**
* Used in createFieldMap.
Expand Down Expand Up @@ -101,6 +104,13 @@ public static function getAttributeNames($extendedType)
private static function getInstance($extendedType)
{
$file = '/core/questions/' . $extendedType . '/' . $extendedType . '.php';
$fullFilePath = \Yii::app()->basePath . $file;

$fileExists = file_exists($fullFilePath);

if (!$fileExists) {
throw new QuestionObjectException('Found no class or file with name ' . $extendedType);
}

require_once(\Yii::app()->basePath . $file);

Expand Down

0 comments on commit ef407bf

Please sign in to comment.