<?php


namespace MezzoLabs\Mezzo\Modules\User\Http\Requests;


trait StoresOrUpdatesUser
{
    protected function unsetPasswordConfirmationRules($rules) : array
    {
        if (isset($rules['password']))
            $rules['password'] = str_replace(['|confirmed', 'confirmed'], '', $rules['password']);

        if (isset($rules['password_confirmation']))
            unset($rules['password_confirmation']);

        return $rules;
    }

    protected function setPasswordRulesForCreate($rules) : array
    {
        $rules['password'] = str_replace('sometimes', 'required', $rules['password']);

        return $rules;
    }

}
{'avg_line_length': 23.40740740740741, 'max_line_length': 98, 'alphanum_fraction': 0.6281645569620253, 'licenses': ['MIT'], 'repository_name': 'MezzoLabs/Mezzo', 'path': 'src/Modules/User/Http/Requests/StoresOrUpdatesUser.php', 'size': 632, 'lang': 'PHP'}