chamilo/chamilo-lms

View on GitHub
public/plugin/xapi/src/ToolExperience/Verb/BaseVerb.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

/* For licensing terms, see /license.txt */

namespace Chamilo\PluginBundle\XApi\ToolExperience\Verb;

use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\LanguageMap;
use Xabbuh\XApi\Model\Verb;

/**
 * Class BaseVerb.
 */
abstract class BaseVerb
{
    /**
     * @var string
     */
    protected $iri;

    /**
     * @var string
     */
    protected $display;

    public function __construct(string $iri, string $display)
    {
        $this->iri = $iri;
        $this->display = $display;
    }

    public function generate(): Verb
    {
        $langIso = api_get_language_isocode();

        return new Verb(
            IRI::fromString($this->iri),
            LanguageMap::create(
                [
                    $langIso => get_lang($this->display),
                ]
            )
        );
    }
}