<commit_before><?php

namespace CultuurNet\UDB3\SavedSearches;

use CultuurNet\UDB3\SavedSearches\Properties\CreatedByQueryString;
use CultuurNet\UDB3\SavedSearches\ReadModel\SavedSearch;
use CultuurNet\UDB3\SavedSearches\ReadModel\SavedSearchRepositoryInterface;
use ValueObjects\String\String;
use ValueObjects\Web\EmailAddress;

class FixedSavedSearchRepository implements SavedSearchRepositoryInterface
{
    /**
     * @var \CultureFeed_User
     */
    protected $user;

    /**
     * @param String $userId
     */
    public function __construct(\CultureFeed_User $user)
    {
        $this->user = $user;
        $this->emailAddress = new EmailAddress($user->mbox);
    }

    /**
     * @return SavedSearch[]
     */
    public function ownedByCurrentUser()
    {
        return [
            $this->getCreatedByCurrentUserSearch(),
        ];
    }

    /**
     * @return SavedSearch
     */
    protected function getCreatedByCurrentUserSearch()
    {
        $name = new String('Door mij ingevoerd');
        $query = new CreatedByQueryString($this->emailAddress);

        return new SavedSearch($name, $query);
    }
}<commit_msg>III-748 Update FixedSavedSearchRepository to allow for empty CulturefeedUser<commit_after><?php

namespace CultuurNet\UDB3\SavedSearches;

use CultuurNet\UDB3\SavedSearches\Properties\CreatedByQueryString;
use CultuurNet\UDB3\SavedSearches\ReadModel\SavedSearch;
use CultuurNet\UDB3\SavedSearches\ReadModel\SavedSearchRepositoryInterface;
use ValueObjects\String\String;
use ValueObjects\Web\EmailAddress;

class FixedSavedSearchRepository implements SavedSearchRepositoryInterface
{
    /**
     * @var \CultureFeed_User
     */
    protected $user;

    /**
     * @param String $userId
     */
    public function __construct(\CultureFeed_User $user)
    {
        $this->user = $user;
    }

    /**
     * @return SavedSearch[]
     */
    public function ownedByCurrentUser()
    {
        return [
            $this->getCreatedByCurrentUserSearch(),
        ];
    }

    /**
     * @return SavedSearch
     */
    protected function getCreatedByCurrentUserSearch()
    {
        $name = new String('Door mij ingevoerd');
        $emailAddress = new EmailAddress($this->user->mbox);
        $query = new CreatedByQueryString($emailAddress);

        return new SavedSearch($name, $query);
    }
}
{'fraction_non_alphanumeric': 0.10600255427841634, 'fraction_numerical': 0.004682843763303533, 'mean_word_length': 3.0517241379310347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '5005019', 'n_tokens_mistral': 721, 'n_tokens_neox': 709, 'n_words': 121}