<commit_before><?php

namespace Northstar\Http\Transformers\Two;

use Northstar\Auth\Scope;
use Northstar\Models\User;
use League\Fractal\TransformerAbstract;
use Gate;

class UserTransformer extends TransformerAbstract
{
    /**
     * @param User $user
     * @return array
     */
    public function transform(User $user)
    {
        $response = [
            'id' => $user->_id,
            'first_name' => $user->first_name,
        ];

        if (Scope::allows('admin') || Gate::allows('view-full-profile', $user)) {
            $response['last_name'] = $user->last_name;
        }

        $response['last_initial'] = $user->last_initial;
        $response['photo'] = null;

        if (Scope::allows('admin') || Gate::allows('view-full-profile', $user)) {
            $response['email'] = $user->email;
            $response['mobile'] = format_legacy_mobile($user->mobile);
            $response['facebook_id'] = $user->facebook_id;

            $response['interests'] = [];
            $response['birthdate'] = format_date($user->birthdate, 'Y-m-d');

            $response['addr_street1'] = $user->addr_street1;
            $response['addr_street2'] = $user->addr_street2;
            $response['addr_city'] = $user->addr_city;
            $response['addr_state'] = $user->addr_state;
            $response['addr_zip'] = $user->addr_zip;

            // Signup source (e.g. cgg, mobile...)
            $response['source'] = $user->source;
            $response['source_detail'] = $user->source_detail;

            // Internal & third-party service IDs:
            $response['slack_id'] = null;

            // Email subscription statuses
            $response['email_subscription_status'] = (bool) $user->email_subscription_status;
            $response['email_subscription_topics'] = $user->email_subscription_topics;

            // Voter registration status
            $response['voter_registration_status'] = $user->voter_registration_status;

            // Voting Plan Status
            $response['voting_plan_status'] = $user->voting_plan_status;
        }

        // Make a Voting Plan fields to be rendered in messaging
        $response['voting_plan_method_of_transport'] = $user->voting_plan_method_of_transport;
        $response['voting_plan_time_of_day'] = $user->voting_plan_time_of_day;
        $response['voting_plan_attending_with'] = $user->voting_plan_attending_with;
        $response['language'] = $user->language;
        $response['country'] = $user->country;

        // SMS subscription status
        $response['sms_status'] = $user->sms_status;
        $response['sms_paused'] = (bool) $user->sms_paused;

        $response['role'] = $user->role;
<commit_msg>Add to the user transformer<commit_after><?php

namespace Northstar\Http\Transformers\Two;

use Northstar\Auth\Scope;
use Northstar\Models\User;
use League\Fractal\TransformerAbstract;
use Gate;

class UserTransformer extends TransformerAbstract
{
    /**
     * @param User $user
     * @return array
     */
    public function transform(User $user)
    {
        $response = [
            'id' => $user->_id,
            'first_name' => $user->first_name,
        ];

        if (Scope::allows('admin') || Gate::allows('view-full-profile', $user)) {
            $response['last_name'] = $user->last_name;
        }

        $response['last_initial'] = $user->last_initial;
        $response['photo'] = null;

        if (Scope::allows('admin') || Gate::allows('view-full-profile', $user)) {
            $response['email'] = $user->email;
            $response['mobile'] = format_legacy_mobile($user->mobile);
            $response['facebook_id'] = $user->facebook_id;

            $response['interests'] = [];
            $response['birthdate'] = format_date($user->birthdate, 'Y-m-d');

            $response['addr_street1'] = $user->addr_street1;
            $response['addr_street2'] = $user->addr_street2;
            $response['addr_city'] = $user->addr_city;
            $response['addr_state'] = $user->addr_state;
            $response['addr_zip'] = $user->addr_zip;

            // Signup source (e.g. cgg, mobile...)
            $response['source'] = $user->source;
            $response['source_detail'] = $user->source_detail;

            // Internal & third-party service IDs:
            $response['slack_id'] = null;

            // Email subscription statuses
            $response['email_subscription_status'] = (bool) $user->email_subscription_status;
            $response['email_subscription_topics'] = $user->email_subscription_topics;

            // Voter registration status
            $response['voter_registration_status'] = $user->voter_registration_status;

            // Voting Plan Status
            $response['voting_plan_status'] = $user->voting_plan_status;

            // Feature Flags
            $response['feature_flags'] = $user->feature_flags;
        }

        // Make a Voting Plan fields to be rendered in messaging
        $response['voting_plan_method_of_transport'] = $user->voting_plan_method_of_transport;
        $response['voting_plan_time_of_day'] = $user->voting_plan_time_of_day;
        $response['voting_plan_attending_with'] = $user->voting_plan_attending_with;
        $response['language'] = $user->language;
        $response['country'] = $user->country;

        // SMS subscription status
        $response['sms_status'] = $user->sms_status;
        $response['sms_paused'] = (bool) $user->sms_paused;

        $response['role'] = $user->role;

{'fraction_non_alphanumeric': 0.15075194781663345, 'fraction_numerical': 0.0014495379597753216, 'mean_word_length': 2.6775483011325782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 62, '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': '2970156', 'n_tokens_mistral': 1666, 'n_tokens_neox': 1613, 'n_words': 260}