You are here

public function Blacklist::isStaticAttributeBlacklisted in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/global-state/src/Blacklist.php \SebastianBergmann\GlobalState\Blacklist::isStaticAttributeBlacklisted()

Parameters

string $className:

string $attributeName:

Return value

boolean

File

vendor/sebastian/global-state/src/Blacklist.php, line 154

Class

Blacklist
A blacklist for global state elements that should not be snapshotted.

Namespace

SebastianBergmann\GlobalState

Code

public function isStaticAttributeBlacklisted($className, $attributeName) {
  if (in_array($className, $this->classes)) {
    return true;
  }
  foreach ($this->classNamePrefixes as $prefix) {
    if (strpos($className, $prefix) === 0) {
      return true;
    }
  }
  $class = new ReflectionClass($className);
  foreach ($this->parentClasses as $type) {
    if ($class
      ->isSubclassOf($type)) {
      return true;
    }
  }
  foreach ($this->interfaces as $type) {
    if ($class
      ->implementsInterface($type)) {
      return true;
    }
  }
  if (isset($this->staticAttributes[$className][$attributeName])) {
    return true;
  }
  return false;
}