protected function repair(Component $vObj)
    {
        $returnCode = 0;

        switch ($vObj->name) {
            case 'VCALENDAR':
                $this->log('iCalendar: '.(string) $vObj->VERSION);
                break;
            case 'VCARD':
                $this->log('vCard: '.(string) $vObj->VERSION);
                break;
        }

        $warnings = $vObj->validate(Node::REPAIR);
        if (!count($warnings)) {
            $this->log('  No warnings!');
        } else {
            $levels = [
                1 => 'REPAIRED',
                2 => 'WARNING',
                3 => 'ERROR',
            ];
            $returnCode = 2;
            foreach ($warnings as $warn) {
                $extra = '';
                if ($warn['node'] instanceof Property) {
                    $extra = ' (property: "'.$warn['node']->name.'")';
                }
                $this->log('  ['.$levels[$warn['level']].'] '.$warn['message'].$extra);
            }
        }
        fwrite($this->stdout, $vObj->serialize());

        return $returnCode;
    }
protected function repair(Component $vObj)
    {
        $returnCode = 0;

        switch ($vObj->name) {
            case 'VCALENDAR':
                $this->log('iCalendar: '.(string) $vObj->VERSION);
                break;
            case 'VCARD':
                $this->log('vCard: '.(string) $vObj->VERSION);
                break;
        }

        $warnings = $vObj->validate(Node::REPAIR);
        if (!count($warnings)) {
            $this->log('  No warnings!');
        } else {
            $levels = [
                1 => 'REPAIRED',
                2 => 'WARNING',
                3 => 'ERROR',
            ];
            $returnCode = 2;
            foreach ($warnings as $warn) {
                $extra = '';
                if ($warn['node'] instanceof Property) {
                    $extra = ' (property: "'.$warn['node']->name.'")';
                }
                $this->log('  ['.$levels[$warn['level']].'] '.$warn['message'].$extra);
            }
        }
        fwrite($this->stdout, $vObj->serialize());

        return $returnCode;
    }
protected function repair ( Component $ vObj ) { $ returnCode = 0 ; switch ( $ vObj -> name ) { case 'VCALENDAR' : $ this -> log ( 'iCalendar: ' . ( string ) $ vObj -> VERSION ) ; break ; case 'VCARD' : $ this -> log ( 'vCard: ' . ( string ) $ vObj -> VERSION ) ; break ; } $ warnings = $ vObj -> validate ( Node :: REPAIR ) ; if ( ! count ( $ warnings ) ) { $ this -> log ( '  No warnings!' ) ; } else { $ levels = [ 1 => 'REPAIRED' , 2 => 'WARNING' , 3 => 'ERROR' , ] ; $ returnCode = 2 ; foreach ( $ warnings as $ warn ) { $ extra = '' ; if ( $ warn [ 'node' ] instanceof Property ) { $ extra = ' (property: "' . $ warn [ 'node' ] -> name . '")' ; } $ this -> log ( '  [' . $ levels [ $ warn [ 'level' ] ] . '] ' . $ warn [ 'message' ] . $ extra ) ; } } fwrite ( $ this -> stdout , $ vObj -> serialize ( ) ) ; return $ returnCode ; }
Repairs a VObject file.

@param Component $vObj

@return int
Repairs a VObject file .