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\Validation; use Drupal\Core\DependencyInjection\ClassResolve..

Decoded Output download

<?php

namespace Drupal\Core\Validation;

use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidatorFactory as BaseConstraintValidatorFactory;

/**
 * Defines a constraint validator factory that works with container injection.
 */
class ConstraintValidatorFactory extends BaseConstraintValidatorFactory {

  /**
   * Constructs a new ConstraintValidatorFactory.
   *
   * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
   */
  public function __construct(ClassResolverInterface $class_resolver) {
    $this->classResolver = $class_resolver;
  }

  /**
   * {@inheritdoc}
   */
  public function getInstance(Constraint $constraint) {
    $class_name = $constraint->validatedBy();

    if (!isset($this->validators[$class_name])) {
      $this->validators[$class_name] = $this->classResolver->getInstanceFromDefinition($class_name);
    }

    return $this->validators[$class_name];
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Core\Validation;

use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidatorFactory as BaseConstraintValidatorFactory;

/**
 * Defines a constraint validator factory that works with container injection.
 */
class ConstraintValidatorFactory extends BaseConstraintValidatorFactory {

  /**
   * Constructs a new ConstraintValidatorFactory.
   *
   * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
   */
  public function __construct(ClassResolverInterface $class_resolver) {
    $this->classResolver = $class_resolver;
  }

  /**
   * {@inheritdoc}
   */
  public function getInstance(Constraint $constraint) {
    $class_name = $constraint->validatedBy();

    if (!isset($this->validators[$class_name])) {
      $this->validators[$class_name] = $this->classResolver->getInstanceFromDefinition($class_name);
    }

    return $this->validators[$class_name];
  }

}

Function Calls

None

Variables

None

Stats

MD5 a0900783ad08d55890b2cd7f655360f5
Eval Count 0
Decode Time 82 ms