<?php


namespace Sargilla\Flatlab4\Console;

/**
 * Class HasUsername.
 *
 * @package Sargilla\Flatlab4\Console
 */
trait HasUsername
{
    /**
     * Obtains username.
     *
     * @return mixed|null|string
     */
    public function username()
    {
        if (($username = env('ADMIN_USERNAME', null)) != null) {
            return $username;
        }

        if (($username = git_user_name()) != null) {
            return $username;
        }

        return "Admin";
    }
}
