<commit_before><?php

/*
|--------------------------------------------------------------------------
| Mobile App Factory
|--------------------------------------------------------------------------
|
| Create models with stub data for all data coming from the Mobile App
| Data Service.
|
*/

if (!function_exists('mobileAppIdsAndTitle'))
{
    function mobileAppIdsAndTitle($faker, $title = '')
    {

        return [
            'mobile_id' => $faker->unique()->randomNumber(4),
            'title' => $title ? $title : ucfirst($faker->words(3, true)),
        ];

    }

    function mobileAppDates($faker)
    {

        return [
            'source_created_at' => $faker->dateTimeThisYear,
            'source_modified_at' => $faker->dateTimeThisYear,
        ];

    }

}


$factory->define(App\Models\Mobile\Artwork::class, function (Faker\Generator $faker) {
    static $artworks;

    if (!$artworks)
    {
        $artworks = App\Models\Collections\Artwork::all()->pluck('citi_id')->all();
    }

    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'artwork_citi_id' => $faker->randomElement($artworks),
            'latitude' => $faker->latitude,
            'longitude' => $faker->longitude,
            'highlighted' => $faker->boolean,
            'selector_number' => $faker->randomNumber(3),
        ],
        mobileAppDates($faker)
    );
});

$factory->define(App\Models\Mobile\Sound::class, function (Faker\Generator $faker) {
    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'link' => $faker->url,
            'transcript' => $faker->paragraph(3),
        ],
        mobileAppDates($faker)
    );
});

$factory->define(App\Models\Mobile\Tour::class, function (Faker\Generator $faker) {
    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'image' => $faker->imageUrl(),
            'description' => $faker->paragraph(5),
            'intro_text' => $faker->paragraph(3),
            'intro_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'weight' => $faker->randomDigit,
        ],
        mobileAppDates($faker)
    );
});

$factory->define(App\Models\Mobile\TourStop::class, function (Faker\Generator $faker) {
    static $artworks;

    if (!$artworks)
    {
        $artworks = App\Models\Collections\Artwork::all()->pluck('citi_id')->all();
    }

    return array_merge(
        [
            'tour_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'artwork_citi_id' => $faker->randomElement($artworks),
            'sound_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'weight' => $faker->randomDigit,
            'description' => $faker->paragraph(5),
        ]
    );
});

<commit_msg>Remove mobileAppDates from its factory<commit_after><?php

/*
|--------------------------------------------------------------------------
| Mobile App Factory
|--------------------------------------------------------------------------
|
| Create models with stub data for all data coming from the Mobile App
| Data Service.
|
*/

if (!function_exists('mobileAppIdsAndTitle'))
{
    function mobileAppIdsAndTitle($faker, $title = '')
    {

        return [
            'mobile_id' => $faker->unique()->randomNumber(4),
            'title' => $title ? $title : ucfirst($faker->words(3, true)),
        ];

    }

}


$factory->define(App\Models\Mobile\Artwork::class, function (Faker\Generator $faker) {
    static $artworks;

    if (!$artworks)
    {
        $artworks = App\Models\Collections\Artwork::all()->pluck('citi_id')->all();
    }

    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'artwork_citi_id' => $faker->randomElement($artworks),
            'latitude' => $faker->latitude,
            'longitude' => $faker->longitude,
            'highlighted' => $faker->boolean,
            'selector_number' => $faker->randomNumber(3),
        ]
    );
});

$factory->define(App\Models\Mobile\Sound::class, function (Faker\Generator $faker) {
    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'link' => $faker->url,
            'transcript' => $faker->paragraph(3),
        ]
    );
});

$factory->define(App\Models\Mobile\Tour::class, function (Faker\Generator $faker) {
    return array_merge(
        mobileAppIdsAndTitle($faker),
        [
            'image' => $faker->imageUrl(),
            'description' => $faker->paragraph(5),
            'intro_text' => $faker->paragraph(3),
            'intro_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'weight' => $faker->randomDigit,
        ]
    );
});

$factory->define(App\Models\Mobile\TourStop::class, function (Faker\Generator $faker) {
    static $artworks;

    if (!$artworks)
    {
        $artworks = App\Models\Collections\Artwork::all()->pluck('citi_id')->all();
    }

    return array_merge(
        [
            'tour_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'artwork_citi_id' => $faker->randomElement($artworks),
            'sound_mobile_id' => $faker->randomElement(App\Models\Mobile\Sound::all()->pluck('mobile_id')->all()),
            'weight' => $faker->randomDigit,
            'description' => $faker->paragraph(5),
        ]
    );
});


{'fraction_non_alphanumeric': 0.22020678396517324, 'fraction_numerical': 0.002539452203881734, 'mean_word_length': 2.150857142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 113, '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': '5614735', 'n_tokens_mistral': 1685, 'n_tokens_neox': 1660, 'n_words': 224}