<commit_before><?php
    class UserController extends ControllerBase {
        public function create( $username = '', $password = '', $password_repeat = '', $email = '',
                                $countryShortname = '', $day = '', $month = '', $year = '' ) {
            require_once 'models/country.php';
            if ( $password !== $password_repeat ) {
                go( 'user', 'create', [ 'password_not_matched' => true ] );
            }
            try {
                $country = Country::findByShortname( $countryShortname );
            }
            catch ( ModelNotFoundException $e ) {
                $country = new Country();
            }
            $_SESSION[ 'create_post' ] = compact( 'username', 'email' );
            $user = new User();
            $user->username = $username;
            $user->password = <PASSWORD>;
            $user->email = $email;
            $user->country = $country;
            $user->dateOfBirth = compact( 'day', 'month', 'year' );
            try {
                $user->save();
            }
            catch( ModelValidationException $e ) {
                go( 'user', 'create', [ $e->error => true ] );
            }
            $_SESSION[ 'user' ] = $user;
            go();
        }

        public function view( $username, $image_invalid ) {
            if ( $username === NULL ) {
                throw new HTTPNotFoundException();
            }
            require_once 'models/extentions.php';
            require_once 'models/image.php';
            require_once 'models/country.php';
            require_once 'models/follow.php';
            try {
                $user = User::findByUsername( $username );
            }
            catch ( ModelNotFoundException $e ) {
                throw new HTTPNotFoundException();
            }
            if ( isset( $_SESSION[ 'user' ] ) ) {
                try {
                    $follow = new Follow( $_SESSION[ 'user' ]->id, $user->id );
                    $followExists = true;
                }
                catch ( ModelNotFoundException $e ) {
                    $followExists = false;
                }
            }
            require_once 'views/user/view.php';
        }

        public function update( $password = '', $password_new = '', $password_repeat = '',
                                $countryShortname = '', $email = '' ) {
            require_once 'models/country.php';
            if ( !isset( $_SESSION[ 'user' ] ) ) {
                throw new HTTPUnauthorizedException();
            }
            $user = $_SESSION[ 'user' ];
            if ( !empty( $password_new ) || !empty( $password_repeat ) ) {
                if ( $user->authenticatesWithPassword( $password ) ) {
                    if ( $password_new !== $password_repeat ) {<commit_msg>rewrite a necessary line in controllers/user<commit_after><?php
    class UserController extends ControllerBase {
        public function create( $username = '', $password = '', $password_repeat = '', $email = '',
                                $countryShortname = '', $day = '', $month = '', $year = '' ) {
            require_once 'models/country.php';
            if ( $password !== $password_repeat ) {
                go( 'user', 'create', [ 'password_not_matched' => true ] );
            }
            try {
                $country = Country::findByShortname( $countryShortname );
            }
            catch ( ModelNotFoundException $e ) {
                $country = new Country();
            }
            $_SESSION[ 'create_post' ] = compact( 'username', 'email' );
            $user = new User();
            $user->username = $username;
            $user->password = <PASSWORD>;
            $user->email = $email;
            $user->country = $country;
            $user->dateOfBirth = compact( 'day', 'month', 'year' );
            try {
                $user->save();
            }
            catch( ModelValidationException $e ) {
                go( 'user', 'create', [ $e->error => true ] );
            }
            $_SESSION[ 'user' ] = $user;
            go();
        }

        public function view( $username, $image_invalid ) {
            if ( $username === NULL ) {
                throw new HTTPNotFoundException();
            }
            require_once 'models/extentions.php';
            require_once 'models/image.php';
            require_once 'models/country.php';
            require_once 'models/follow.php';
            try {
                $user = User::findByUsername( $username );
            }
            catch ( ModelNotFoundException $e ) {
                throw new HTTPNotFoundException();
            }
            if ( isset( $_SESSION[ 'user' ] ) ) {
                try {
                    $follow = new Follow( $_SESSION[ 'user' ]->id, $user->id );
                    $followExists = true;
                }
                catch ( ModelNotFoundException $e ) {
                    $followExists = false;
                }
            }
            require_once 'views/user/view.php';
        }

        public function update( $password = '', $password_new = '', $password_repeat = '',
                                $countryShortname = '', $email = '', $day = '', $month = '', $year = '' ) {
            require_once 'models/country.php';
            if ( !isset( $_SESSION[ 'user' ] ) ) {
                throw new HTTPUnauthorizedException();
            }
            $user = $_SESSION[ 'user' ];
            if ( !empty( $password_new ) || !empty( $password_repeat ) ) {
                if ( $user->authenticatesWithPassword( $password ) ) {
                    if ( $password_new !== $password_repeat ) {
{'fraction_non_alphanumeric': 0.13790677220756375, 'fraction_numerical': 0.0, 'mean_word_length': 1.4113655640373197, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2600381', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1404, 'n_words': 312}