src/SimpleDOM.php
public function propagateBooleanAttribute($strSource, $strDestination, $strStopAtNode = null, $strMode = 'AND')
    {
        $blnValue = false;

        // Is there a parent ?
        if (($this->getParent() !== false) && ($this->getParent()->getName() !== $strStopAtNode)) {

            if ($strMode == 'AND') {
                $blnValue = ($this->getBooleanAttribute($strSource) && $this->getParent()->getBooleanAttribute(
                        $strDestination,
                        true
                    ));
            } elseif ($strMode == 'OR') {
                $blnValue = ($this->getBooleanAttribute($strSource) || $this->getParent()->getBooleanAttribute(
                        $strDestination,
                        true
                    ));
            }

            // Set it
            $this->getParent()->setAttribute($strDestination, $blnValue ? 'true' : 'false');
            $this->getParent()->propagateBooleanAttribute($strDestination, $strDestination, $strStopAtNode, $strMode);
        }
    }
public function propagateBooleanAttribute($strSource, $strDestination, $strStopAtNode = null, $strMode = 'AND')
    {
        $blnValue = false;

        // Is there a parent ?
        if (($this->getParent() !== false) && ($this->getParent()->getName() !== $strStopAtNode)) {

            if ($strMode == 'AND') {
                $blnValue = ($this->getBooleanAttribute($strSource) && $this->getParent()->getBooleanAttribute(
                        $strDestination,
                        true
                    ));
            } elseif ($strMode == 'OR') {
                $blnValue = ($this->getBooleanAttribute($strSource) || $this->getParent()->getBooleanAttribute(
                        $strDestination,
                        true
                    ));
            }

            // Set it
            $this->getParent()->setAttribute($strDestination, $blnValue ? 'true' : 'false');
            $this->getParent()->propagateBooleanAttribute($strDestination, $strDestination, $strStopAtNode, $strMode);
        }
    }
public function propagateBooleanAttribute ( $ strSource , $ strDestination , $ strStopAtNode = null , $ strMode = 'AND' ) { $ blnValue = false ; // Is there a parent ? if ( ( $ this -> getParent ( ) !== false ) && ( $ this -> getParent ( ) -> getName ( ) !== $ strStopAtNode ) ) { if ( $ strMode == 'AND' ) { $ blnValue = ( $ this -> getBooleanAttribute ( $ strSource ) && $ this -> getParent ( ) -> getBooleanAttribute ( $ strDestination , true ) ) ; } elseif ( $ strMode == 'OR' ) { $ blnValue = ( $ this -> getBooleanAttribute ( $ strSource ) || $ this -> getParent ( ) -> getBooleanAttribute ( $ strDestination , true ) ) ; } // Set it $ this -> getParent ( ) -> setAttribute ( $ strDestination , $ blnValue ? 'true' : 'false' ) ; $ this -> getParent ( ) -> propagateBooleanAttribute ( $ strDestination , $ strDestination , $ strStopAtNode , $ strMode ) ; } }
Propagate (copy) a boolean attribute (source) to all parents above it as (destination) attribute
Default logical operator between current parent value and source value is AND
so any parent (destination) attribute must be TRUE (considdered default) in order to alter it from source
@param $strSource
@param $strDestination
@param null $strStopAtNode
@param string $strMode
@throws Exception
Propagate ( copy ) a boolean attribute ( source ) to all parents above it as ( destination ) attribute Default logical operator between current parent value and source value is AND so any parent ( destination ) attribute must be TRUE ( considdered default ) in order to alter it from source