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\Session; /** * Trait for \Drupal\Core\Session\CalculatedPer..

Decoded Output download

<?php

namespace Drupal\Core\Session;

/**
 * Trait for \Drupal\Core\Session\CalculatedPermissionsInterface.
 */
trait CalculatedPermissionsTrait {

  /**
   * A list of calculated permission items, keyed by scope and identifier.
   *
   * @var array
   */
  protected array $items = [];

  /**
   * {@inheritdoc}
   */
  public function getItem(string $scope = AccessPolicyInterface::SCOPE_DRUPAL, string|int $identifier = AccessPolicyInterface::SCOPE_DRUPAL): CalculatedPermissionsItemInterface|false {
    return $this->items[$scope][$identifier] ?? FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getItems(): array {
    $item_sets = [];
    foreach ($this->items as $scope_items) {
      $item_sets[] = array_values($scope_items);
    }
    return array_merge(...$item_sets);
  }

  /**
   * {@inheritdoc}
   */
  public function getScopes(): array {
    return array_keys($this->items);
  }

  /**
   * {@inheritdoc}
   */
  public function getItemsByScope(string $scope = AccessPolicyInterface::SCOPE_DRUPAL): array {
    return isset($this->items[$scope])
      ? array_values($this->items[$scope])
      : [];
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Core\Session;

/**
 * Trait for \Drupal\Core\Session\CalculatedPermissionsInterface.
 */
trait CalculatedPermissionsTrait {

  /**
   * A list of calculated permission items, keyed by scope and identifier.
   *
   * @var array
   */
  protected array $items = [];

  /**
   * {@inheritdoc}
   */
  public function getItem(string $scope = AccessPolicyInterface::SCOPE_DRUPAL, string|int $identifier = AccessPolicyInterface::SCOPE_DRUPAL): CalculatedPermissionsItemInterface|false {
    return $this->items[$scope][$identifier] ?? FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getItems(): array {
    $item_sets = [];
    foreach ($this->items as $scope_items) {
      $item_sets[] = array_values($scope_items);
    }
    return array_merge(...$item_sets);
  }

  /**
   * {@inheritdoc}
   */
  public function getScopes(): array {
    return array_keys($this->items);
  }

  /**
   * {@inheritdoc}
   */
  public function getItemsByScope(string $scope = AccessPolicyInterface::SCOPE_DRUPAL): array {
    return isset($this->items[$scope])
      ? array_values($this->items[$scope])
      : [];
  }

}

Function Calls

None

Variables

None

Stats

MD5 19ebe0047559b39b273da48c754fcd45
Eval Count 0
Decode Time 94 ms