<commit_before><?php
/**
 * Created by PhpStorm.
 * User: melon
 * Date: 11/12/15
 * Time: 9:49 AM
 */

namespace App\UUD\Transformers;


use App\Model\Email;
use App\Model\Phone;
use App\Model\User;

class UserTransformer extends Transformer
{
    /**
     * @param $item
     * @return array
     */
    public function transform($item)
    {
        $phones = Phone::all()->where('user_id',$item['id'])->toArray();
        $emails = Email::all()->where('user_id',$item['id'])->toArray();

        //dd($phones);

        if ($phones) {
            $phoneTrans = new PhoneTransformer;
            $phones = $phoneTrans->transformCollection($phones);
        }

        if ($emails) {
            $emailTrans = new EmailTransformer;
            $emails = $emailTrans->transformCollection($emails);
        }

        return [
            'id' => (int)$item['id'],
            'user_identifier' => $item['user_identifier'],
            'username' => $item['username'],
            'name_prefix' => $item['name_prefix'],
            'name_first' => $item['name_first'],
            'name_middle' => $item['name_middle'],
            'name_last' => $item['name_last'],
            'name_postfix' => $item['name_postfix'],
            'name_phonetic' => $item['name_phonetic'],
            'emails' => $emails,
            'phones' => $phones
        ];
    }
}<commit_msg>retrieving users does not return emails and phones<commit_after><?php
/**
 * Created by PhpStorm.
 * User: melon
 * Date: 11/12/15
 * Time: 9:49 AM
 */

namespace App\UUD\Transformers;


use App\Model\Email;
use App\Model\Phone;
use App\Model\User;

class UserTransformer extends Transformer
{
    /**
     * @param $item
     * @return array
     */
    public function transform($item)
    {
             /* $phones = Phone::all()->where('user_id',$item['id'])->toArray();
                $emails = Email::all()->where('user_id',$item['id'])->toArray();

                if ($phones) {
                    $phoneTrans = new PhoneTransformer;
                    $phones = $phoneTrans->transformCollection($phones);
                }

                if ($emails) {
                    $emailTrans = new EmailTransformer;
                    $emails = $emailTrans->transformCollection($emails);
                }*/

        return [
            'id' => (int)$item['id'],
            'user_identifier' => $item['user_identifier'],
            'username' => $item['username'],
            'name_prefix' => $item['name_prefix'],
            'name_first' => $item['name_first'],
            'name_middle' => $item['name_middle'],
            'name_last' => $item['name_last'],
            'name_postfix' => $item['name_postfix'],
            'name_phonetic' => $item['name_phonetic'],
            //  'emails' => $emails,
            //  'phones' => $phones
        ];
    }
}
{'fraction_non_alphanumeric': 0.17094618360886388, 'fraction_numerical': 0.006331340133661625, 'mean_word_length': 2.0319829424307034, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '4215496', 'n_tokens_mistral': 873, 'n_tokens_neox': 839, 'n_words': 150}