function SystemStateEdit::checkObject

Same name in other branches
  1. 8.x-1.x src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::checkObject()
  2. 4.x src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::checkObject()

Helper function to determine if a variable is or contains an object.

Parameters

mixed $data: Input data to check.

Return value

bool TRUE if the variable is not an object and does not contain one.

1 call to SystemStateEdit::checkObject()
SystemStateEdit::buildForm in src/Form/SystemStateEdit.php
Form constructor.

File

src/Form/SystemStateEdit.php, line 175

Class

SystemStateEdit
Form API form to edit a state.

Namespace

Drupal\devel\Form

Code

protected function checkObject(mixed $data) : bool {
    if (is_object($data)) {
        return FALSE;
    }
    if (is_array($data)) {
        // If the current object is an array, then check recursively.
        foreach ($data as $value) {
            // If there is an object the whole container is "contaminated".
            if (!$this->checkObject($value)) {
                return FALSE;
            }
        }
    }
    // All checks pass.
    return TRUE;
}