for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis
engine instead. Learn more
* This file is part of phpDocumentor.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @author Mike van Riel <[email protected]>
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
* Register all services and subservices necessary to get phpDocumentor up and running.
* This provider exposes no services of its own but populates the Writer Collection with the basic writers for
* phpDocumentor and, for backwards compatibility, registers the service providers for Graphs, Twig and PDF to
* the container.
final class ServiceProvider implements ServiceProviderInterface
* Registers services on the given app.
* @param Container $app An Application instance.
public function register(Container $app): void
This check looks for parameters that are defined as one type in their type
hint or doc comment but seem to be used as a narrower type, i.e an
implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming
your parameter is of the expected type.
* Creates all writers for this plugin and adds them to the WriterCollection object.
* This action will enable transformations in templates to make use of these writers.
private function registerWriters(Application $app)
$writerCollection = $this->getWriterCollection($app);
$writerCollection['FileIo'] = new Writer\FileIo();
$writerCollection['sourcecode'] = new Writer\Sourcecode();
$writerCollection['statistics'] = new Writer\Statistics();
$writerCollection['xsl'] = new Writer\Xsl($app['monolog']);
$checkstyleWriter = new Writer\Checkstyle();
$writerCollection['checkstyle'] = $checkstyleWriter;
$xmlWriter = new Writer\Xml($app['transformer.routing.standard']);
$writerCollection['xml'] = $xmlWriter;
* Registers the Routing Queue and Descriptor Builder objects on the XSLT Extension class.
* In every template we use PHP helpers in order to be able to have routing that is universal between templates and
* convert Markdown text into HTML (for example). The only way for XSL to do this is by having global functions or
* static methods in a class because you cannot inject an object into an XSL processor.
* With this method we make sure that all dependencies used by the static methods are injected as static properties.
private function registerDependenciesOnXsltExtension(Application $app)
$queue = new Queue();
Xslt\Extension::$routers = $queue;
Xslt\Extension::$descriptorBuilder = $app['descriptor.builder'];
* Returns the WriterCollection service from the Service Locator.
* @return Collection
private function getWriterCollection(Application $app)