Skip to content

Commit

Permalink
Dev: Add question object base and array object (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 6, 2016
1 parent ef407bf commit db0df44
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
@@ -0,0 +1,7 @@
<?php

Yii::import('application.core.questions.QuestionObjectBase', true);

class ArrayQuestionObject extends QuestionObjectBase
{
}
67 changes: 67 additions & 0 deletions application/core/questions/QuestionObjectBase.php
@@ -0,0 +1,67 @@
<?php

abstract class QuestionObjectBase
{
/**
* Specification for this array is in top of qanda helper.
* @var array
* @todo Rename to a more descriptive name
*/
private $ia;

/**
* List of attributes is in questionHelper.
* @var array
*/
private $questionAttributes;

/**
* @var Question
*/
private $questionModel;

/**
* Data used to create fieldmap
* @var array
*/
private $data;

/**
* @var TestQuestionObject
*/
static private $instance = null;

/**
* @return TestQuestionObject
*/
public static function getInstance()
{
$inheritedClassName = get_called_class(); // Late static binding
if (empty(self::$instance))
{
self::$instance = new $inheritedClassName();
}

return self::$instance;
}

/**
* Set data needed to create the fieldmap
* @param array $data
* @return void
*/
public function setData(array $data)
{
$this->data = $data;
}

/**
* Called from qanda_helper.
* @param array $ia
* @return void
*/
public function setIa(array $ia)
{
$this->ia = $ia;
}
}

0 comments on commit db0df44

Please sign in to comment.