| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/wordpress-seo/config/dependency-injection/ |
Upload File : |
<?php
/**
* Yoast SEO Plugin File.
*
* @package Yoast\YoastSEO\Dependency_Injection
*/
namespace Yoast\WP\Free\Dependency_Injection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Yoast\WP\Free\Conditionals\Conditional;
use Yoast\WP\Free\Loader;
use Yoast\WP\Free\WordPress\Initializer;
use Yoast\WP\Free\WordPress\Integration;
/**
* A pass is a step in the compilation process of the container.
*
* This step will automatically ensure all classes implementing the Integration interface
* are registered with the Loader class.
*/
class Loader_Pass implements CompilerPassInterface {
/**
* Checks all definitions to ensure all classes implementing the Integration interface
* are registered with the Loader class.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
*/
public function process( ContainerBuilder $container ) {
if ( ! $container->hasDefinition( Loader::class ) ) {
return;
}
$loader_definition = $container->getDefinition( Loader::class );
$loader_definition->setArgument( 0, new Reference( 'service_container' ) );
$loader_definition->setPublic( true );
$definitions = $container->getDefinitions();
foreach ( $definitions as $definition ) {
$this->process_definition( $definition, $loader_definition );
}
}
/**
* Processes a definition in the container.
*
* @param \Symfony\Component\DependencyInjection\Definition $definition The definition to process.
* @param \Symfony\Component\DependencyInjection\Definition $loader_definition The loader definition.
*/
private function process_definition( Definition $definition, Definition $loader_definition ) {
$class = $definition->getClass();
if ( \is_subclass_of( $class, Initializer::class ) ) {
$loader_definition->addMethodCall( 'register_initializer', [ $class ] );
$definition->setPublic( true );
}
if ( \is_subclass_of( $class, Integration::class ) ) {
$loader_definition->addMethodCall( 'register_integration', [ $class ] );
$definition->setPublic( true );
}
if ( \is_subclass_of( $class, Conditional::class ) ) {
$definition->setPublic( true );
}
}
}