private function eventsAreEqual($e1, $e2)
    {
        // events aren't equal if they have different classes
        if (get_class($e1) != get_class($e2)) {
            return false;
        }

        // compare their values..
        $reflection = new \ReflectionClass($e1);

        $fields = array_map(function ($property) {
            return $property->name;
        }, $reflection->getProperties());

        $allMatch = true;

        foreach ($fields as $field) {
            // compare the single field across both events
            $property = new \ReflectionProperty(get_class($e1), $field);
            $property->setAccessible(true);
            $e1Value = $property->getValue($e1);
            $e2Value = $property->getValue($e2);

            if (is_array($e1Value)) {
                // this part isn't done, jsut copied, think it through
                for ($i = 0; $i < count($e1Value); $i++) {
                    $setMatches = $this->compareProperties($e1, $e1Value[$i], $e2Value[$i], $property);
                    if ( ! $setMatches) {
                        $allMatch = false;
                    }
                }
            } else {
                $setMatches = $this->compareProperties($e1, $e1Value, $e2Value, $property);
                if ( ! $setMatches) {
                    $allMatch = false;
                }
            }
        }

        return $allMatch;
    }
private function eventsAreEqual($e1, $e2)
    {
        // events aren't equal if they have different classes
        if (get_class($e1) != get_class($e2)) {
            return false;
        }

        // compare their values..
        $reflection = new \ReflectionClass($e1);

        $fields = array_map(function ($property) {
            return $property->name;
        }, $reflection->getProperties());

        $allMatch = true;

        foreach ($fields as $field) {
            // compare the single field across both events
            $property = new \ReflectionProperty(get_class($e1), $field);
            $property->setAccessible(true);
            $e1Value = $property->getValue($e1);
            $e2Value = $property->getValue($e2);

            if (is_array($e1Value)) {
                // this part isn't done, jsut copied, think it through
                for ($i = 0; $i < count($e1Value); $i++) {
                    $setMatches = $this->compareProperties($e1, $e1Value[$i], $e2Value[$i], $property);
                    if ( ! $setMatches) {
                        $allMatch = false;
                    }
                }
            } else {
                $setMatches = $this->compareProperties($e1, $e1Value, $e2Value, $property);
                if ( ! $setMatches) {
                    $allMatch = false;
                }
            }
        }

        return $allMatch;
    }
private function eventsAreEqual ( $ e1 , $ e2 ) { // events aren't equal if they have different classes if ( get_class ( $ e1 ) != get_class ( $ e2 ) ) { return false ; } // compare their values.. $ reflection = new \ ReflectionClass ( $ e1 ) ; $ fields = array_map ( function ( $ property ) { return $ property -> name ; } , $ reflection -> getProperties ( ) ) ; $ allMatch = true ; foreach ( $ fields as $ field ) { // compare the single field across both events $ property = new \ ReflectionProperty ( get_class ( $ e1 ) , $ field ) ; $ property -> setAccessible ( true ) ; $ e1Value = $ property -> getValue ( $ e1 ) ; $ e2Value = $ property -> getValue ( $ e2 ) ; if ( is_array ( $ e1Value ) ) { // this part isn't done, jsut copied, think it through for ( $ i = 0 ; $ i < count ( $ e1Value ) ; $ i ++ ) { $ setMatches = $ this -> compareProperties ( $ e1 , $ e1Value [ $ i ] , $ e2Value [ $ i ] , $ property ) ; if ( ! $ setMatches ) { $ allMatch = false ; } } } else { $ setMatches = $ this -> compareProperties ( $ e1 , $ e1Value , $ e2Value , $ property ) ; if ( ! $ setMatches ) { $ allMatch = false ; } } } return $ allMatch ; }
pull requests accepted
pull requests accepted