Code Duplication    Length = 31-31 lines in 2 locations

Console/Command/SendCustomersCommand.php 1 location

@@ 16-46 (lines=31) @@
13
 * @package   PersonalisedProducts
14
 * @author    Steven Richardson ([email protected]) @mage_gizmo
15
 */
16
class SendCustomersCommand extends AbstractCustomerCommand
17
{
18
    /**
19
     * Configure the console command's name and description
20
     */
21
    protected function configure()
22
    {
23
        $this->setName('pio:send:customers');
24
        $this->setDescription('Send all customers to the PredictionIO event server');
25
        parent::configure();
26
    }
27
28
    /**
29
     * Execute the command
30
     *
31
     * @param InputInterface $input
32
     * @param OutputInterface $output
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $collection = $this->_getCustomerCollection();
37
        $output->writeln('Preparing to send '. count($collection) .' customers');
38
39
        try {
40
            $sentCount = $this->_sendCustomerData($collection);
41
            $output->writeln('Successfully sent '. $sentCount .' customers to the PredictionIO event server');
42
        } catch (\Exception $e) {
43
            $output->writeln('Error: ' . $e->getMessage());
44
        }
45
    }
46
}
47

Console/Command/SendProductsCommand.php 1 location

@@ 17-47 (lines=31) @@
14
 * @package   PersonalisedProducts
15
 * @author    Steven Richardson ([email protected]) @mage_gizmo
16
 */
17
class SendProductsCommand extends AbstractProductCommand
18
{
19
    /**
20
     * Configure the console command's name and description
21
     */
22
    protected function configure()
23
    {
24
        $this->setName('pio:send:products');
25
        $this->setDescription('Send all products to the PredictionIO event server');
26
        parent::configure();
27
    }
28
29
    /**
30
     * Execute the command
31
     *
32
     * @param InputInterface $input
33
     * @param OutputInterface $output
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $collection = $this->_getProductCollection();
38
        $output->writeln('Preparing to send '. count($collection) .' products');
39
40
        try {
41
            $sentCount = $this->_sendProductData($collection);
42
            $output->writeln('Successfully sent '. $sentCount .' customers to the PredictionIO event server');
43
        } catch (Exception $e) {
44
            $output->writeln('Error: ' . $e->getMessage());
45
        }
46
    }
47
}
48