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\Condition; use Drupal\Component\Plugin\CategorizingPluginMan..
Decoded Output download
<?php
namespace Drupal\Core\Condition;
use Drupal\Component\Plugin\CategorizingPluginManagerInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Executable\ExecutableInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\CategorizingPluginManagerTrait;
use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait;
use Drupal\Core\Plugin\DefaultPluginManager;
/**
* A plugin manager for condition plugins.
*
* @see \Drupal\Core\Condition\Annotation\Condition
* @see \Drupal\Core\Condition\ConditionInterface
* @see \Drupal\Core\Condition\ConditionPluginBase
*
* @ingroup plugin_api
*/
class ConditionManager extends DefaultPluginManager implements ExecutableManagerInterface, CategorizingPluginManagerInterface {
use CategorizingPluginManagerTrait;
use ContextAwarePluginManagerTrait;
/**
* Constructs a ConditionManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* Cache backend instance to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke the alter hook with.
*/
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$this->alterInfo('condition_info');
$this->setCacheBackend($cache_backend, 'condition_plugins');
parent::__construct('Plugin/Condition', $namespaces, $module_handler, 'Drupal\Core\Condition\ConditionInterface', 'Drupal\Core\Condition\Annotation\Condition');
}
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
$plugin = $this->getFactory()->createInstance($plugin_id, $configuration);
// If we receive any context values via config set it into the plugin.
if (!empty($configuration['context'])) {
foreach ($configuration['context'] as $name => $context) {
$plugin->setContextValue($name, $context);
}
}
return $plugin->setExecutableManager($this);
}
/**
* {@inheritdoc}
*/
public function execute(ExecutableInterface $condition) {
$result = $condition->evaluate();
return $condition->isNegated() ? !$result : $result;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Core\Condition;
use Drupal\Component\Plugin\CategorizingPluginManagerInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Executable\ExecutableInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\CategorizingPluginManagerTrait;
use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait;
use Drupal\Core\Plugin\DefaultPluginManager;
/**
* A plugin manager for condition plugins.
*
* @see \Drupal\Core\Condition\Annotation\Condition
* @see \Drupal\Core\Condition\ConditionInterface
* @see \Drupal\Core\Condition\ConditionPluginBase
*
* @ingroup plugin_api
*/
class ConditionManager extends DefaultPluginManager implements ExecutableManagerInterface, CategorizingPluginManagerInterface {
use CategorizingPluginManagerTrait;
use ContextAwarePluginManagerTrait;
/**
* Constructs a ConditionManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* Cache backend instance to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke the alter hook with.
*/
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$this->alterInfo('condition_info');
$this->setCacheBackend($cache_backend, 'condition_plugins');
parent::__construct('Plugin/Condition', $namespaces, $module_handler, 'Drupal\Core\Condition\ConditionInterface', 'Drupal\Core\Condition\Annotation\Condition');
}
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
$plugin = $this->getFactory()->createInstance($plugin_id, $configuration);
// If we receive any context values via config set it into the plugin.
if (!empty($configuration['context'])) {
foreach ($configuration['context'] as $name => $context) {
$plugin->setContextValue($name, $context);
}
}
return $plugin->setExecutableManager($this);
}
/**
* {@inheritdoc}
*/
public function execute(ExecutableInterface $condition) {
$result = $condition->evaluate();
return $condition->isNegated() ? !$result : $result;
}
}
Function Calls
None |
Stats
MD5 | 7bef03d152cb2029dfa8b9e5a092e2df |
Eval Count | 0 |
Decode Time | 96 ms |