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\Entity\Plugin\Validation\Constraint; use Drupal\Core\StringT..
Decoded Output download
<?php
namespace Drupal\Core\Entity\Plugin\Validation\Constraint;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
/**
* Checks if a value is an entity that has a specific field.
*/
#[Constraint(
id: 'EntityHasField',
label: new TranslatableMarkup('Entity has field', [], ['context' => 'Validation']),
type: ['entity']
)]
class EntityHasFieldConstraint extends SymfonyConstraint {
/**
* The default violation message.
*
* @var string
*/
public $message = 'The entity must have the %field_name field.';
/**
* The violation message for non-fieldable entities.
*
* @var string
*/
public $notFieldableMessage = 'The entity does not support fields.';
/**
* The field name option.
*
* @var string
*/
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
public $field_name;
/**
* {@inheritdoc}
*/
public function getDefaultOption(): ?string {
return 'field_name';
}
/**
* {@inheritdoc}
*/
public function getRequiredOptions(): array {
return (array) $this->getDefaultOption();
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Core\Entity\Plugin\Validation\Constraint;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
/**
* Checks if a value is an entity that has a specific field.
*/
#[Constraint(
id: 'EntityHasField',
label: new TranslatableMarkup('Entity has field', [], ['context' => 'Validation']),
type: ['entity']
)]
class EntityHasFieldConstraint extends SymfonyConstraint {
/**
* The default violation message.
*
* @var string
*/
public $message = 'The entity must have the %field_name field.';
/**
* The violation message for non-fieldable entities.
*
* @var string
*/
public $notFieldableMessage = 'The entity does not support fields.';
/**
* The field name option.
*
* @var string
*/
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
public $field_name;
/**
* {@inheritdoc}
*/
public function getDefaultOption(): ?string {
return 'field_name';
}
/**
* {@inheritdoc}
*/
public function getRequiredOptions(): array {
return (array) $this->getDefaultOption();
}
}
Function Calls
None |
Stats
MD5 | db95eee1ce6410a80291aa54fde12411 |
Eval Count | 0 |
Decode Time | 91 ms |