KJ\Magento\Command\Order\Create\DummyCommand::getCustomer PHP Method

getCustomer() protected method

protected getCustomer ( ) : Mage_Customer_Model_Customer
return Mage_Customer_Model_Customer
    protected function getCustomer()
    {
        if (isset($this->_customer)) {
            return $this->_customer;
        }
        if ($this->_input->getOption('new-customer')) {
            $faker = Faker\Factory::create();
            $customer = \Mage::getModel('customer/customer');
            $customer->setData('firstname', $faker->firstName)->setData('lastname', $faker->lastName)->setData('email', $faker->safeEmail);
            $customer->save();
            $this->_customer = $customer;
            return $this->_customer;
        }
        if ($this->_input->getOption('customer')) {
            $customer = \Mage::getModel('customer/customer')->load($this->_input->getOption('customer'));
        } else {
            $customer = $this->_loadRandomCustomer();
        }
        // Load customer to make sure we have the full customer information
        $this->_customer = \Mage::getModel('customer/customer')->load($customer->getId());
        return $this->_customer;
    }