1 | <?php |
||
18 | class ListShortcodesCommand extends Command |
||
19 | { |
||
20 | use PaginatorUtilsTrait; |
||
21 | |||
22 | /** |
||
23 | * @var ShortUrlServiceInterface |
||
24 | */ |
||
25 | private $shortUrlService; |
||
26 | /** |
||
27 | * @var TranslatorInterface |
||
28 | */ |
||
29 | private $translator; |
||
30 | |||
31 | /** |
||
32 | * ListShortcodesCommand constructor. |
||
33 | * @param ShortUrlServiceInterface $shortUrlService |
||
34 | * @param TranslatorInterface $translator |
||
35 | * |
||
36 | * @Inject({ShortUrlService::class, "translator"}) |
||
37 | */ |
||
38 | 5 | public function __construct(ShortUrlServiceInterface $shortUrlService, TranslatorInterface $translator) |
|
44 | |||
45 | 5 | public function configure() |
|
46 | { |
||
47 | 5 | $this->setName('shortcode:list') |
|
48 | 5 | ->setDescription($this->translator->translate('List all short URLs')) |
|
49 | 5 | ->addOption( |
|
50 | 5 | 'page', |
|
51 | 5 | 'p', |
|
52 | 5 | InputOption::VALUE_OPTIONAL, |
|
53 | 5 | sprintf( |
|
54 | 5 | $this->translator->translate('The first page to list (%s items per page)'), |
|
55 | 5 | PaginableRepositoryAdapter::ITEMS_PER_PAGE |
|
56 | ), |
||
57 | 5 | 1 |
|
58 | ) |
||
59 | 5 | ->addOption( |
|
60 | 5 | 'searchTerm', |
|
61 | 5 | 's', |
|
62 | 5 | InputOption::VALUE_OPTIONAL, |
|
63 | 5 | $this->translator->translate( |
|
64 | 5 | 'A query used to filter results by searching for it on the longUrl and shortCode fields' |
|
65 | ) |
||
66 | ) |
||
67 | 5 | ->addOption( |
|
68 | 5 | 'tags', |
|
69 | 5 | 't', |
|
70 | 5 | InputOption::VALUE_OPTIONAL, |
|
71 | 5 | $this->translator->translate('A comma-separated list of tags to filter results') |
|
72 | ) |
||
73 | 5 | ->addOption( |
|
74 | 5 | 'orderBy', |
|
75 | 5 | 'o', |
|
76 | 5 | InputOption::VALUE_OPTIONAL, |
|
77 | 5 | $this->translator->translate( |
|
78 | 5 | 'The field from which we want to order by. Pass ASC or DESC separated by a comma' |
|
79 | ) |
||
80 | ) |
||
81 | 5 | ->addOption( |
|
82 | 5 | 'showTags', |
|
83 | 5 | null, |
|
84 | 5 | InputOption::VALUE_NONE, |
|
85 | 5 | $this->translator->translate('Whether to display the tags or not') |
|
86 | ); |
||
87 | 5 | } |
|
88 | |||
89 | 5 | public function execute(InputInterface $input, OutputInterface $output) |
|
148 | |||
149 | 5 | protected function processOrderBy(InputInterface $input) |
|
159 | } |
||
160 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.