public static function isEqual(Row $row1, Row $row2)
    {
        //same columns
        $cols1 = $row1->getColumns();
        $cols2 = $row2->getColumns();

        $diff1 = array_udiff($cols1, $cols2, array(__CLASS__, 'compareElements'));
        $diff2 = array_udiff($cols2, $cols1, array(__CLASS__, 'compareElements'));

        if ($diff1 != $diff2) {
            return false;
        }

        $dets1 = $row1->getMetadata();
        $dets2 = $row2->getMetadata();

        ksort($dets1);
        ksort($dets2);

        if ($dets1 != $dets2) {
            return false;
        }

        // either both are null
        // or both have a value
        if (!(is_null($row1->getIdSubDataTable())
            && is_null($row2->getIdSubDataTable())
        )
        ) {
            $subtable1 = $row1->getSubtable();
            $subtable2 = $row2->getSubtable();
            if (!DataTable::isEqual($subtable1, $subtable2)) {
                return false;
            }
        }
        return true;
    }
public static function isEqual(Row $row1, Row $row2)
    {
        //same columns
        $cols1 = $row1->getColumns();
        $cols2 = $row2->getColumns();

        $diff1 = array_udiff($cols1, $cols2, array(__CLASS__, 'compareElements'));
        $diff2 = array_udiff($cols2, $cols1, array(__CLASS__, 'compareElements'));

        if ($diff1 != $diff2) {
            return false;
        }

        $dets1 = $row1->getMetadata();
        $dets2 = $row2->getMetadata();

        ksort($dets1);
        ksort($dets2);

        if ($dets1 != $dets2) {
            return false;
        }

        // either both are null
        // or both have a value
        if (!(is_null($row1->getIdSubDataTable())
            && is_null($row2->getIdSubDataTable())
        )
        ) {
            $subtable1 = $row1->getSubtable();
            $subtable2 = $row2->getSubtable();
            if (!DataTable::isEqual($subtable1, $subtable2)) {
                return false;
            }
        }
        return true;
    }
public static function isEqual ( Row $ row1 , Row $ row2 ) { //same columns $ cols1 = $ row1 -> getColumns ( ) ; $ cols2 = $ row2 -> getColumns ( ) ; $ diff1 = array_udiff ( $ cols1 , $ cols2 , array ( __CLASS__ , 'compareElements' ) ) ; $ diff2 = array_udiff ( $ cols2 , $ cols1 , array ( __CLASS__ , 'compareElements' ) ) ; if ( $ diff1 != $ diff2 ) { return false ; } $ dets1 = $ row1 -> getMetadata ( ) ; $ dets2 = $ row2 -> getMetadata ( ) ; ksort ( $ dets1 ) ; ksort ( $ dets2 ) ; if ( $ dets1 != $ dets2 ) { return false ; } // either both are null // or both have a value if ( ! ( is_null ( $ row1 -> getIdSubDataTable ( ) ) && is_null ( $ row2 -> getIdSubDataTable ( ) ) ) ) { $ subtable1 = $ row1 -> getSubtable ( ) ; $ subtable2 = $ row2 -> getSubtable ( ) ; if ( ! DataTable :: isEqual ( $ subtable1 , $ subtable2 ) ) { return false ; } } return true ; }
Helper function that tests if two rows are equal.

Two rows are equal if:

- they have exactly the same columns / metadata
- they have a subDataTable associated, then we check that both of them are the same.

Column order is not important.

@param \Piwik\DataTable\Row $row1 first to compare
@param \Piwik\DataTable\Row $row2 second to compare
@return bool
Helper function that tests if two rows are equal .