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\TypedData\Plugin\DataType; use Drupal\Core\StringTranslation..

Decoded Output download

<?php

namespace Drupal\Core\TypedData\Plugin\DataType;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\Attribute\DataType;
use Drupal\Core\TypedData\Type\DecimalInterface;

/**
 * The decimal data type.
 *
 * Decimal type is stored as "decimal" in the relational database. Because PHP
 * does not have a primitive type decimal and using float can result in
 * unexpected rounding behavior, it is implemented and displayed as string.
 */
#[DataType(
  id: "decimal",
  label: new TranslatableMarkup("Decimal"),
)]
class DecimalData extends StringData implements DecimalInterface {

  /**
   * {@inheritdoc}
   */
  public function getCastedValue() {
    return $this->getString() ?: '0.0';
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Core\TypedData\Plugin\DataType;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\Attribute\DataType;
use Drupal\Core\TypedData\Type\DecimalInterface;

/**
 * The decimal data type.
 *
 * Decimal type is stored as "decimal" in the relational database. Because PHP
 * does not have a primitive type decimal and using float can result in
 * unexpected rounding behavior, it is implemented and displayed as string.
 */
#[DataType(
  id: "decimal",
  label: new TranslatableMarkup("Decimal"),
)]
class DecimalData extends StringData implements DecimalInterface {

  /**
   * {@inheritdoc}
   */
  public function getCastedValue() {
    return $this->getString() ?: '0.0';
  }

}

Function Calls

None

Variables

None

Stats

MD5 b352cb474b33410ae006473728230678
Eval Count 0
Decode Time 83 ms