public static function getSource()
    {
        if (false === ($code = @file(__FILE__))) {
            $error = error_get_last();

            throw new RuntimeException($error['message']);
        }

        $code = array_slice($code, 6);

        foreach ($code as $i => $line) {
            if ('' === trim($line)) {
                unset($code[$i]);
                continue;
            }

            if (preg_match('{^\s*(/\*+|\*+)}', $line)) {
                unset($code[$i]);
            }
        }

        return join('', $code);
    }
public static function getSource()
    {
        if (false === ($code = @file(__FILE__))) {
            $error = error_get_last();

            throw new RuntimeException($error['message']);
        }

        $code = array_slice($code, 6);

        foreach ($code as $i => $line) {
            if ('' === trim($line)) {
                unset($code[$i]);
                continue;
            }

            if (preg_match('{^\s*(/\*+|\*+)}', $line)) {
                unset($code[$i]);
            }
        }

        return join('', $code);
    }
public static function getSource ( ) { if ( false === ( $ code = @ file ( __FILE__ ) ) ) { $ error = error_get_last ( ) ; throw new RuntimeException ( $ error [ 'message' ] ) ; } $ code = array_slice ( $ code , 6 ) ; foreach ( $ code as $ i => $ line ) { if ( '' === trim ( $ line ) ) { unset ( $ code [ $ i ] ) ; continue ; } if ( preg_match ( '{^\s*(/\*+|\*+)}' , $ line ) ) { unset ( $ code [ $ i ] ) ; } } return join ( '' , $ code ) ; }
Returns the embeddable source for this class.

This method will return the compacted source code of this class so
that it can be embedded as part of the stub. Note that this is the
only method in the class that is part of the public API.

use Phine\Phar\Builder;
use Phine\Phar\Stub;
use Phine\Phar\Stub\Extract;

Builder::create('example.phar')->setStub(
Stub::create()
->addSource(Extract::getSource())
->getStub()
);

@return string The source code.

@throws RuntimeException If the file could not be read.

@api
Returns the embeddable source for this class .