chamilo/chamilo-lms

View on GitHub
public/plugin/migrationmoodle/src/Transformer/Property/CourseUserStatus.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Chamilo\PluginBundle\MigrationMoodle\Transformer\Property;

use Chamilo\PluginBundle\MigrationMoodle\Interfaces\TransformPropertyInterface;

/**
 * Class CourseUserStatus.
 *
 * @package Chamilo\PluginBundle\MigrationMoodle\Transformer\Property
 */
class CourseUserStatus implements TransformPropertyInterface
{
    /**
     * @return int
     */
    public function transform(array $data)
    {
        $archetype = current($data);

        if (in_array($archetype, ['teacher', 'editingteacher'])) {
            return COURSEMANAGER;
        }

        return STUDENT;
    }
}