Text

Text’s parent is Beat.

Read text informations

use PhpTabs\PhpTabs;

$song = new PhpTabs('my-song.gp5');

// Get a text
$text = $song->getTrack(0)
             ->getMeasure(0)
             ->getBeat(0)
             ->getText();

echo sprintf("
Text
----

value: %s
is empty: %s
",

$text->getValue(),
$text->isEmpty() ? 'true' : 'false'
);

It will ouput something like:

Text
----

value: My text
is empty: false

Write text informations

$text->setValue('My other text');

Beat

You may handle its beat.

// Get text beat
$beat = $text->getBeat();

// Set text beat
$text->setBeat($beat);

Copy

You may copy all attributes from another text.

// Copy from another text
$newText->copyFrom($text);