bookboon/api-php

View on GitHub
src/Entity/ExamQuestion.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

namespace Bookboon\Api\Entity;

class ExamQuestion extends Entity
{
    protected function isValid(array $array) : bool
    {
        return isset($array['_id'], $array['phrasing']);
    }

    /**
     * @return string UUID of entity
     */
    public function getId()
    {
        return $this->safeGet('_id');
    }

    /**
     * Answer phrasing
     *
     * @return string
     */
    public function getPhrasing()
    {
        return $this->safeGet('phrasing');
    }

    /**
     * @return ExamAnswer[]
     */
    public function getAnswers() : array
    {
        return ExamAnswer::getEntitiesFromArray($this->safeGet('answers'));
    }
}