Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\Core\Plugin\Factory; use Drupal\Component\Plugin\Factory\DefaultF..
Decoded Output download
<?php
namespace Drupal\Core\Plugin\Factory;
use Drupal\Component\Plugin\Factory\DefaultFactory;
/**
* Plugin factory which passes a container to a create method.
*/
class ContainerFactory extends DefaultFactory {
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
$plugin_definition = $this->discovery->getDefinition($plugin_id);
$plugin_class = static::getPluginClass($plugin_id, $plugin_definition, $this->interface);
// If the plugin provides a factory method, pass the container to it.
if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) {
return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition);
}
// Otherwise, create the plugin directly.
return new $plugin_class($configuration, $plugin_id, $plugin_definition);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Core\Plugin\Factory;
use Drupal\Component\Plugin\Factory\DefaultFactory;
/**
* Plugin factory which passes a container to a create method.
*/
class ContainerFactory extends DefaultFactory {
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
$plugin_definition = $this->discovery->getDefinition($plugin_id);
$plugin_class = static::getPluginClass($plugin_id, $plugin_definition, $this->interface);
// If the plugin provides a factory method, pass the container to it.
if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) {
return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition);
}
// Otherwise, create the plugin directly.
return new $plugin_class($configuration, $plugin_id, $plugin_definition);
}
}
Function Calls
None |
Stats
MD5 | f3cc31c542bdb4dced97a91e4da174c5 |
Eval Count | 0 |
Decode Time | 95 ms |