<commit_before><?php
declare(strict_types=1);

namespace TddWizard\Fixtures\Customer;

use Faker\Factory as FakerFactory;
use Magento\Customer\Api\AddressRepositoryInterface;
use Magento\Customer\Api\Data\AddressInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\ObjectManagerInterface;
use Magento\Directory\Model\Region;
use Magento\TestFramework\Helper\Bootstrap;

/**
 * Builder to be used by fixtures
 */
class AddressBuilder
{
    /**
     * @var AddressInterface
     */
    private $address;

    /**
     * @var AddressRepositoryInterface
     */
    private $addressRepository;

    public function __construct(AddressRepositoryInterface $addressRepository, AddressInterface $address)
    {
        $this->address = $address;
        $this->addressRepository = $addressRepository;
    }

    public function __clone()
    {
        $this->address = clone $this->address;
    }

    public static function anAddress(
        ObjectManagerInterface $objectManager = null,
        string $locale = 'de_DE'
    ): AddressBuilder {
        if ($objectManager === null) {
            $objectManager = Bootstrap::getObjectManager();
        }

        $faker = FakerFactory::create($locale);
        $countryCode = substr($locale, -2);

        try {
            $region = $faker->province;
        } catch (\InvalidArgumentException $exception) {
            $region = $faker->state;
        }

        $regionId = $objectManager->create(Region::class)->loadByName($region, $countryCode)->getId();

        /** @var AddressInterface $address */
        $address = $objectManager->create(AddressInterface::class);
        $address
            ->setTelephone($faker->phoneNumber)
            ->setPostcode($faker->postcode)
            ->setCountryId($countryCode)
            ->setCity($faker->city)
            ->setCompany($faker->company)
            ->setStreet([$faker->streetAddress])
            ->setLastname($faker->lastName)
            ->setFirstname($faker->firstName)
            ->setRegionId($regionId);

        return new self($objectManager->create(AddressRepositoryInterface::class), $address);
    }

    public function asDefaultShipping(): AddressBuilder
    {<commit_msg>Remove ObjectManager parameter from AddressBuilder constructor functions<commit_after><?php
declare(strict_types=1);

namespace TddWizard\Fixtures\Customer;

use Faker\Factory as FakerFactory;
use Magento\Customer\Api\AddressRepositoryInterface;
use Magento\Customer\Api\Data\AddressInterface;
use Magento\Directory\Model\Region;
use Magento\Framework\Exception\LocalizedException;
use Magento\TestFramework\Helper\Bootstrap;

/**
 * Builder to be used by fixtures
 */
class AddressBuilder
{
    /**
     * @var AddressInterface
     */
    private $address;

    /**
     * @var AddressRepositoryInterface
     */
    private $addressRepository;

    public function __construct(AddressRepositoryInterface $addressRepository, AddressInterface $address)
    {
        $this->address = $address;
        $this->addressRepository = $addressRepository;
    }

    public function __clone()
    {
        $this->address = clone $this->address;
    }

    public static function anAddress(
        string $locale = 'de_DE'
    ): AddressBuilder {
        $objectManager = Bootstrap::getObjectManager();
        $faker = FakerFactory::create($locale);
        $countryCode = substr($locale, -2);

        try {
            $region = $faker->province;
        } catch (\InvalidArgumentException $exception) {
            $region = $faker->state;
        }

        $regionId = $objectManager->create(Region::class)->loadByName($region, $countryCode)->getId();

        /** @var AddressInterface $address */
        $address = $objectManager->create(AddressInterface::class);
        $address
            ->setTelephone($faker->phoneNumber)
            ->setPostcode($faker->postcode)
            ->setCountryId($countryCode)
            ->setCity($faker->city)
            ->setCompany($faker->company)
            ->setStreet([$faker->streetAddress])
            ->setLastname($faker->lastName)
            ->setFirstname($faker->firstName)
            ->setRegionId($regionId);

        return new self($objectManager->create(AddressRepositoryInterface::class), $address);
    }

    public function asDefaultShipping(): AddressBuilder
    {
{'fraction_non_alphanumeric': 0.1222807419280971, 'fraction_numerical': 0.0009159606136936112, 'mean_word_length': 2.9, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '6696056', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1139, 'n_words': 212}