function SystemStateEdit::checkObject

Same name and namespace in other branches
  1. 5.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 172

Class

SystemStateEdit
Form API form to edit a state.

Namespace

Drupal\devel\Form

Code

protected function checkObject($data) {
    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;
}