These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | /** |
||
5 | * This file is part of phpDocumentor. |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | * |
||
10 | * @author Mike van Riel <[email protected]> |
||
11 | * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) |
||
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
13 | * @link http://phpdoc.org |
||
14 | */ |
||
15 | |||
16 | namespace phpDocumentor\Plugin\Scrybe\Command\Manual; |
||
17 | |||
18 | use phpDocumentor\Plugin\Scrybe\Converter\Format; |
||
19 | use phpDocumentor\Plugin\Scrybe\Converter\ToLatexInterface; |
||
20 | use Symfony\Component\Console\Input\InputInterface; |
||
21 | use Symfony\Component\Console\Input\InputOption; |
||
22 | |||
23 | /** |
||
24 | * Command used to tell the application to convert from a format to Latex. |
||
25 | */ |
||
26 | class ToLatexCommand extends BaseConvertCommand |
||
27 | { |
||
28 | /** @var string The string representation of the output format */ |
||
29 | protected $output_format = Format\Format::LATEX; |
||
30 | |||
31 | /** |
||
32 | * Defines the name, description and additional options for this command |
||
33 | * and inherits the behaviour of the parent configure. |
||
34 | * |
||
35 | * @see ConvertCommandAbstract::configure() for the common business rules. |
||
36 | */ |
||
37 | protected function configure() |
||
38 | { |
||
39 | parent::configure(); |
||
40 | |||
41 | $this->setName('manual:to-latex'); |
||
42 | $this->setDescription( |
||
43 | 'Generates reference documentation as a single Latex file' |
||
44 | ); |
||
45 | |||
46 | $this->addOption( |
||
47 | 'author', |
||
48 | null, |
||
49 | InputOption::VALUE_OPTIONAL, |
||
50 | 'Name of the author' |
||
51 | ); |
||
52 | $this->addOption( |
||
53 | 'cover-logo', |
||
54 | null, |
||
55 | InputOption::VALUE_OPTIONAL, |
||
56 | 'Path to a cover logo relative to the source root' |
||
57 | ); |
||
58 | $this->addOption( |
||
59 | 'toc', |
||
60 | null, |
||
61 | InputOption::VALUE_OPTIONAL, |
||
62 | 'Whether the document should have a table of contents', |
||
63 | true |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Returns and configures the converter for this operation. |
||
69 | * |
||
70 | * This method overrides the parent getConverter method and invokes the |
||
71 | * configureConverterFromInputOptions() method to set the options coming |
||
72 | * from the Input object. |
||
73 | * |
||
74 | * @see BaseConvertCommand::getConverter() for the basic functionality. |
||
75 | * @return phpDocumentor\Plugin\Scrybe\Converter\ConverterInterface |
||
76 | */ |
||
77 | protected function getConverter(InputInterface $input) |
||
78 | { |
||
79 | /** @var ToLatexInterface $converter */ |
||
80 | $converter = parent::getConverter($input); |
||
81 | $this->configureConverterFromInputOptions($converter, $input); |
||
82 | |||
83 | return $converter; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Configures the converter with the options provided by the Input options. |
||
88 | * |
||
89 | * @param ToLatexInterface $converter |
||
90 | * @param InputInterface $input |
||
91 | * |
||
92 | * @throws \InvalidArgumentException if the provided converter is not derived |
||
93 | * from ToLatexInterface |
||
94 | */ |
||
95 | protected function configureConverterFromInputOptions($converter, $input) |
||
96 | { |
||
97 | if (!$converter instanceof ToLatexInterface) { |
||
98 | throw new \InvalidArgumentException( |
||
99 | 'The converter used to process ' |
||
100 | . $input->getOption('input-format') . ' should implement the ' |
||
101 | . 'phpDocumentor\Plugin\Scrybe\Converter\ToPdfInterface' |
||
102 | ); |
||
103 | } |
||
104 | |||
105 | $converter->setTitle($input->getOption('title')); |
||
106 | $converter->setAuthor($input->getOption('author')); |
||
107 | $converter->setCoverLogo($input->getOption('cover-logo')); |
||
108 | $converter->setTableOfContents($input->getOption('toc') !== 'false'); |
||
0 ignored issues
–
show
|
|||
109 | } |
||
110 | } |
||
111 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.