We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29bb489 commit 52ce7bcCopy full SHA for 52ce7bc
README.md
@@ -111,6 +111,19 @@ $snippet = (new CodeSnippet())
111
echo "Snippet line count: " . count($snippet->getLines()) . PHP_EOL;
112
```
113
114
+### Returning the snippet as a string
115
+
116
+Return the contents of the snippet as as string using the `toString()` method or by casting the snippet to a string directly:
117
118
+```php
119
+$snippet = (new CodeSnippet())
120
+ ->surroundingLines(4, 7)
121
+ ->linesBefore(3)
122
+ ->linesAfter(3)
123
+ ->fromFile('/path/to/a/file.php');
124
125
+echo "Snippet: \n" . $snippet->toString() . PHP_EOL;
126
+```
127
128
## Testing
129
0 commit comments