SendProductsCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Richdynamix\PersonalisedProducts\Console\Command;
4
5
use \Richdynamix\PersonalisedProducts\Console\Command\AbstractProductCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use \Symfony\Component\Config\Definition\Exception\Exception;
9
10
/**
11
 * Class SendProductsCommand
12
 *
13
 * @category  Richdynamix
14
 * @package   PersonalisedProducts
15
 * @author    Steven Richardson ([email protected]) @mage_gizmo
16
 */
17 View Code Duplication
class SendProductsCommand extends AbstractProductCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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) {
0 ignored issues
show
Bug introduced by
The class Symfony\Component\Config...ion\Exception\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
44
            $output->writeln('Error: ' . $e->getMessage());
45
        }
46
    }
47
}
48