static function run_copy_paste_report( $task=null, $args=array(), $cliopts=array() )
    {
        $opts = self::getOpts( @$args[0], @$args[1], $cliopts );
        if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
            throw new PakeException( "Source code locked by another process" );

        $destdir = self::getReportDir( $opts ) . '/' . $opts['extension']['name'];
        $phpcpd = self::getTool( 'phpcpd', $opts, true );
        // phpcpd will exit with a non-0 value as soon as there is any violation (which generates an exception in pake_sh),
        // but we do not consider this a fatal error, as we are only generating reports
        try
        {
            $out = pake_sh( "$phpcpd " .
                escapeshellarg( self::getBuildDir( $opts ) . '/' . $opts['extension']['name'] ) );
        }
        catch ( pakeException $e )
        {
            $out = preg_replace( '/^Problem executing command/', '', $e->getMessage() );
        }
        pake_mkdirs( $destdir );
        pake_write_file( $destdir . '/phpcpd.txt', $out, true );

        SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
    }
static function run_copy_paste_report( $task=null, $args=array(), $cliopts=array() )
    {
        $opts = self::getOpts( @$args[0], @$args[1], $cliopts );
        if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
            throw new PakeException( "Source code locked by another process" );

        $destdir = self::getReportDir( $opts ) . '/' . $opts['extension']['name'];
        $phpcpd = self::getTool( 'phpcpd', $opts, true );
        // phpcpd will exit with a non-0 value as soon as there is any violation (which generates an exception in pake_sh),
        // but we do not consider this a fatal error, as we are only generating reports
        try
        {
            $out = pake_sh( "$phpcpd " .
                escapeshellarg( self::getBuildDir( $opts ) . '/' . $opts['extension']['name'] ) );
        }
        catch ( pakeException $e )
        {
            $out = preg_replace( '/^Problem executing command/', '', $e->getMessage() );
        }
        pake_mkdirs( $destdir );
        pake_write_file( $destdir . '/phpcpd.txt', $out, true );

        SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
    }
static function run_copy_paste_report ( $ task = null , $ args = array ( ) , $ cliopts = array ( ) ) { $ opts = self :: getOpts ( @ $ args [ 0 ] , @ $ args [ 1 ] , $ cliopts ) ; if ( ! SharedLock :: acquire ( $ opts [ 'extension' ] [ 'name' ] , LOCK_SH , $ opts ) ) throw new PakeException ( "Source code locked by another process" ) ; $ destdir = self :: getReportDir ( $ opts ) . '/' . $ opts [ 'extension' ] [ 'name' ] ; $ phpcpd = self :: getTool ( 'phpcpd' , $ opts , true ) ; // phpcpd will exit with a non-0 value as soon as there is any violation (which generates an exception in pake_sh),
 // but we do not consider this a fatal error, as we are only generating reports
 try { $ out = pake_sh ( "$phpcpd " . escapeshellarg ( self :: getBuildDir ( $ opts ) . '/' . $ opts [ 'extension' ] [ 'name' ] ) ) ; } catch ( pakeException $ e ) { $ out = preg_replace ( '/^Problem executing command/' , '' , $ e -> getMessage ( ) ) ; } pake_mkdirs ( $ destdir ) ; pake_write_file ( $ destdir . '/phpcpd.txt' , $ out , true ) ; SharedLock :: release ( $ opts [ 'extension' ] [ 'name' ] , LOCK_SH , $ opts ) ; }
Generates a "copy-pasted code" report using phpcpd
Generates a copy - pasted code report using phpcpd